فهرست منبع

Merge remote-tracking branch 'origin/master'

lipenghui 13 ساعت پیش
والد
کامیت
09a786ea18
2فایلهای تغییر یافته به همراه26 افزوده شده و 4 حذف شده
  1. 18 3
      src/views/pms/iotmainworkorder/DeviceAlarmBomList.vue
  2. 8 1
      src/views/pms/iotmainworkorder/IotDeviceMainAlarm.vue

+ 18 - 3
src/views/pms/iotmainworkorder/DeviceAlarmBomList.vue

@@ -16,6 +16,10 @@
           <span class="info-label">{{ t('iotDevice.name') }}:</span>
           <span class="info-value">{{ deviceInfo.deviceName }}</span>
         </div>
+        <div class="info-item" v-if="deviceInfo.model">
+          <span class="info-label">{{ t('deviceForm.model') }}:</span>
+          <span class="info-value">{{ deviceInfo.model }}</span>
+        </div>
       </div>
 
       <div class="table-container">
@@ -126,6 +130,9 @@ const total = ref(0) // 列表的总页数
 // 分页重置标志
 const shouldResetPagination = ref(false)
 
+// 添加外部传入的设备信息
+const externalDeviceInfo = ref(null)
+
 const dialogWidth = '1500px';
 
 const tableRef = ref(null)    // 表格实例引用
@@ -283,7 +290,7 @@ const paginatedList = computed(() => {
   return list.value.slice(start, end);
 });
 
-const open = async (id?: number, flag?: string, deviceId?: number) => {
+const open = async (id?: number, flag?: string, deviceInfo?: any) => {
   // 重置分页参数
   queryParams.pageNo = 1
   queryParams.pageSize = 10
@@ -291,7 +298,10 @@ const open = async (id?: number, flag?: string, deviceId?: number) => {
   total.value = 0
 
   await nextTick() // 确保DOM更新完成
-  queryParams.deviceId = deviceId
+  if (deviceInfo) {
+    externalDeviceInfo.value = deviceInfo
+    queryParams.deviceId = deviceInfo.id // 如果需要的话
+  }
   if('workOrder' === flag) {
     // 加载保养工单 BOM
     queryParams.workOrderId = id
@@ -365,11 +375,16 @@ const getPlanList = async () => {
 
 // 添加设备信息计算属性
 const deviceInfo = computed(() => {
+  // 优先使用外部传入的设备信息
+  if (externalDeviceInfo.value) {
+    return externalDeviceInfo.value;
+  }
   if (list.value.length > 0) {
     const firstRecord = list.value[0];
     return {
       deviceCode: firstRecord.deviceCode,
-      deviceName: firstRecord.deviceName
+      deviceName: firstRecord.deviceName,
+      model: firstRecord.model // 确保列表数据中也有 model
     };
   }
   return null;

+ 8 - 1
src/views/pms/iotmainworkorder/IotDeviceMainAlarm.vue

@@ -257,12 +257,19 @@ const drawerVisible = ref<boolean>(false)
 const showDrawer = ref()
 
 const openBomForm = async (row) => {
+  // 构建设备信息对象,包含所有需要的属性
+  const deviceInfo = {
+    deviceId: row.id,
+    deviceCode: row.deviceCode,
+    deviceName: row.deviceName,
+    model: row.model // 新增 model 属性
+  }
   if (row.workOrderId) {
     flag.value = 'workOrder';
     modelFormRef.value.open(row.workOrderId, flag.value, row.id)
   } else if (row.planId) {
     flag.value = 'plan';
-    modelFormRef.value.open(row.planId, flag.value, row.id)
+    modelFormRef.value.open(row.planId, flag.value, deviceInfo)
   }
 }