Pārlūkot izejas kodu

pms 保养工单详情 BOM明细 保养状态

zhangcl 2 mēneši atpakaļ
vecāks
revīzija
34aeb10414

+ 4 - 1
src/locales/en.ts

@@ -963,7 +963,10 @@ export default {
     MaintItems:'MaintItems',
     nextMaintTime:'NextMaintTime(H)',
     nextMaintKil:'NextMaintKil(KM)',
-    nextMaintDate:'NextMaintDate'
+    nextMaintDate:'NextMaintDate',
+    completed: 'Completed',
+    delayed: 'Delayed',
+    maintaining: 'Maintaining'
   },
   inspect:{
     InspectionItems:'InspectionItems',

+ 4 - 1
src/locales/ru.ts

@@ -954,7 +954,10 @@ export default {
     MaintItems:'保养项',
     nextMaintTime:'距离下次保养运行时长(H)',
     nextMaintKil:'距离下次保养公里数(KM)',
-    nextMaintDate:'下次保养自然日期'
+    nextMaintDate:'下次保养自然日期',
+    completed: '完成',
+    delayed: '延时',
+    maintaining: '保养中'
   },
   inspect:{
     InspectionItems:'巡检项',

+ 4 - 1
src/locales/zh-CN.ts

@@ -957,7 +957,10 @@ export default {
     MaintItems:'保养项',
     nextMaintTime:'距离下次保养运行时长(H)',
     nextMaintKil:'距离下次保养公里数(KM)',
-    nextMaintDate:'下次保养自然日期'
+    nextMaintDate:'下次保养自然日期',
+    completed: '完成',
+    delayed: '延时',
+    maintaining: '保养中'
   },
   inspect:{
     InspectionItems:'巡检项',

+ 19 - 1
src/views/pms/iotmainworkorder/IotMainWorkOrderDetail.vue

@@ -178,7 +178,7 @@
         </el-table-column>
         <el-table-column :label="t('common.status')" align="center" width="100">
           <template #default="scope">
-            {{ (scope.row.status === 0) ? '延时' : '完成' }}
+            {{ getStatusText(scope.row) }}
           </template>
         </el-table-column>
         <el-table-column :label="t('iotMaintain.operation')" align="center" min-width="120px">
@@ -601,6 +601,24 @@ const openMaterialForm = (row: any) => {
   materialFormRef.value.open(formData.value.deptId, bomNodeId.value)
 }
 
+const getStatusText = (row: any) => {
+  // 状态为1直接返回"完成"
+  if (row.status === 1) return t('mainPlan.completed');
+
+  // 状态为0时判断延迟字段
+  const delayDuration = Number(row.delayDuration) || 0;
+  const delayKilometers = Number(row.delayKilometers) || 0;
+  const delayNaturalDate = Number(row.delayNaturalDate) || 0;
+
+  // 任意延迟字段大于0 -> 延时
+  if (delayDuration > 0 || delayKilometers > 0 || delayNaturalDate > 0) {
+    return t('mainPlan.delayed');
+  }
+
+  // 否则显示保养中
+  return t('mainPlan.maintaining');
+};
+
 const selectChoose = (selectedMaterial) => {
   selectedMaterial.bomNodeId = bomNodeId.value
   // 关联 bomNodeId

+ 2 - 18
src/views/pms/maintenance/IotMaintenancePlan.vue

@@ -327,7 +327,6 @@
 
 </template>
 <script setup lang="ts">
-import { IotMaintainApi, IotMaintainVO } from '@/api/pms/maintain'
 import { IotDeviceApi, IotDeviceVO } from '@/api/pms/device'
 import * as UserApi from '@/api/system/user'
 import { useUserStore } from '@/store/modules/user'
@@ -609,8 +608,6 @@ const deviceChoose = async(selectedDevices) => {
       list.value.push(item)
     }
   })
-  // 新增完设备后 查询现有设备-bom明细中 所有设备配置的负责人姓名 逗号分隔
-  // await getDevicePersons();
 }
 
 const deviceFormRef = ref<InstanceType<typeof MainPlanDeviceList>>()
@@ -812,11 +809,7 @@ onMounted(async () => {
     const plan = await IotMaintenancePlanApi.getIotMaintenancePlan(id);
     deviceLabel.value = plan.deviceName
     formData.value = plan
-    // 查询保养责任人
-    /* const personId = formData.value.responsiblePerson ? Number(formData.value.responsiblePerson) : 0;
-    UserApi.getUser(personId).then((res) => {
-      formData.value.responsiblePerson = res.nickname;
-    }) */
+
     // 查询保养计划明细
     const data = await IotMaintenanceBomApi.getMainPlanBOMs(queryParams);
     list.value = []
@@ -826,8 +819,7 @@ onMounted(async () => {
         // 这里可以添加必要的字段转换(如果有日期等需要格式化的字段)
         lastNaturalDate: item.lastNaturalDate
       }))
-      // 同时查询所有设备的责任人
-      // await getDevicePersons();
+
     }
   } else {
     formType.value = 'create';
@@ -837,14 +829,6 @@ onMounted(async () => {
   }
 })
 const handleDelete = async (str: string) => {
-  /* try {
-    const index = list.value.findIndex((item) => (item.id+'-'+item.bomNodeId) === str)
-    if (index !== -1) {
-      // 通过 splice 删除元素
-      list.value.splice(index, 1)
-      deviceIds.value = []
-    }
-  } catch {} */
   try {
     const [deviceIdStr, bomNodeId] = str.split('-')
     const deviceId = parseInt(deviceIdStr)