yanghao 3 viikkoa sitten
vanhempi
commit
f74d72f100
2 muutettua tiedostoa jossa 33 lisäystä ja 10 poistoa
  1. 25 7
      src/api/pms/failure/index.ts
  2. 8 3
      src/views/pms/failure/IotFailureReportForm.vue

+ 25 - 7
src/api/pms/failure/index.ts

@@ -4,7 +4,8 @@ import request from '@/config/axios'
 export interface IotFailureReportVO {
   id: number // 主键id
   failureCode: string // 故障编码
-  failureName: string // 故障名称
+  failureName: string
+  typeDesc?: string // 其他故障描述
   deviceId: number // 设备id
   status: string // 状态
   ifStop: boolean // 是否停机
@@ -21,10 +22,9 @@ export interface IotFailureReportVO {
 
 // 故障上报 API
 export const IotFailureReportApi = {
-
   // 提交审核
   submitForApproval: async (id: number) => {
-    return await request.put({ url: `/rq/iot-failure-report/submitForApproval?id=${id}`})
+    return await request.put({ url: `/rq/iot-failure-report/submitForApproval?id=${id}` })
   },
   // 查询故障上报分页
   getIotFailureReportPage: async (params: any) => {
@@ -37,7 +37,7 @@ export const IotFailureReportApi = {
   },
 
   getApproval: async () => {
-    return await request.get({ url: `/rq/iot-failure-report/get/approval`})
+    return await request.get({ url: `/rq/iot-failure-report/get/approval` })
   },
 
   // 新增故障上报
@@ -59,7 +59,25 @@ export const IotFailureReportApi = {
   exportIotFailureReport: async (params) => {
     return await request.download({ url: `/rq/iot-failure-report/export-excel`, params })
   },
-  updateIotMaintainProcess: async (processId:any,id:any, type:any,assigneeUserId:any, trans:any) => {
-    return await request.put({ url: `/rq/iot-failure-report/process-info?processId=`+processId+`&id=`+id+`&type=`+type+`&assigneeUserId=`+assigneeUserId+`&trans=`+ trans})
-  },
+  updateIotMaintainProcess: async (
+    processId: any,
+    id: any,
+    type: any,
+    assigneeUserId: any,
+    trans: any
+  ) => {
+    return await request.put({
+      url:
+        `/rq/iot-failure-report/process-info?processId=` +
+        processId +
+        `&id=` +
+        id +
+        `&type=` +
+        type +
+        `&assigneeUserId=` +
+        assigneeUserId +
+        `&trans=` +
+        trans
+    })
+  }
 }

+ 8 - 3
src/views/pms/failure/IotFailureReportForm.vue

@@ -387,9 +387,14 @@ const open = async (type: string, id?: number, disable?: boolean, fallbackData?:
   if (id) {
     formLoading.value = true
     try {
-      formData.value = await IotFailureReportApi.getIotFailureReport(id)
-      if (formData.value.failureType === 'other' && formData.value.typeDesc == null) {
-        formData.value.typeDesc = fallbackData?.typeDesc ?? ''
+      const data = await IotFailureReportApi.getIotFailureReport(id)
+      formData.value = {
+        ...formData.value,
+        ...data,
+        typeDesc:
+          data.typeDesc ??
+          fallbackData?.typeDesc ??
+          (data.failureType === 'other' ? data.description ?? fallbackData?.description ?? data.failureName ?? '' : data.typeDesc)
       }
     } finally {
       formLoading.value = false