Browse Source

设备档案编辑保存联调、签名保存联调、报告审核审批的预览

yangguanjin 1 month ago
parent
commit
429405f151

+ 2 - 2
src/api/ApiRouter/equipment.ts

@@ -51,7 +51,7 @@ const map = {
   },
 }
 
-export const requestFunc = (funcName: IndexFuncName, equipType: EquipmentType, params: any) => {
+export const requestFunc = (funcName: EquipFuncName, equipType: EquipmentType, params: any) => {
   const funMap = map[funcName]
   const adapter = funMap[equipType]
   // 1. input adapter
@@ -63,7 +63,7 @@ export const requestFunc = (funcName: IndexFuncName, equipType: EquipmentType, p
     throw new Error('api for send is not exists')
   }
   // 2. send req
-  const respData = adapter.reqFunction(params)
+  const respData = adapter.reqFunction(reqParams)
   // 3. output adapter
   let adaptedRespData = respData
   if (adapter.outputAdapter) {

+ 55 - 0
src/api/ApiRouter/sign.ts

@@ -0,0 +1,55 @@
+import { EquipmentType } from '@/utils/dictMap'
+import { submitBoilerSign } from '@/api/boiler/boilerSign'
+import { submitPipeSign } from '@/api/pipe/pipeSign'
+import { signConfirm } from '@/api/sign'
+
+type Adapter = {
+  inputAdapter: (data: any) => any
+  reqFunction: (params: any) => any
+  outputAdapter: (data: any) => any
+}
+
+export enum SignFuncName {
+  SubmitSign,
+}
+
+const map = {
+  [SignFuncName.SubmitSign]: {
+    [EquipmentType.BOILER]: {
+      inputAdapter: null,
+      reqFunction: submitBoilerSign,
+      outputAdapter: null,
+    },
+    [EquipmentType.PIPE]: {
+      inputAdapter: null,
+      reqFunction: submitPipeSign,
+      outputAdapter: null,
+    },
+    [EquipmentType.CONTAINER]: {
+      inputAdapter: null,
+      reqFunction: signConfirm,
+      outputAdapter: null,
+    },
+  },
+}
+
+export const requestFunc = (funcName: SignFuncName, equipType: EquipmentType, params: any) => {
+  const funMap = map[funcName]
+  const adapter = funMap[equipType]
+  // 1. input adapter
+  let reqParams = params
+  if (adapter.inputAdapter != null) {
+    reqParams = adapter.inputAdapter(params)
+  }
+  if (!adapter.reqFunction) {
+    throw new Error('api for send is not exists')
+  }
+  // 2. send req
+  const respData = adapter.reqFunction(reqParams)
+  // 3. output adapter
+  let adaptedRespData = respData
+  if (adapter.outputAdapter) {
+    adaptedRespData = adaptedRespData = adapter.outputAdapter(respData)
+  }
+  return adaptedRespData
+}

+ 6 - 4
src/api/ApiRouter/taskOrder.ts

@@ -5,6 +5,7 @@ import {
   getCheckerEquipmentDetailById,
   confirmTaskOrder,
   confirmTaskClaim,
+  getOrderDetail,
   cancelClaim,
   getUserGroupUserList,
   recheckApi,
@@ -21,6 +22,7 @@ import {
   confirmPipeTaskOrder,
   confirmPipeEquipmentClaim,
   cancelPipeEquipmentClaim,
+  getPipeTaskItemListByOrderId,
   getPipeRecheckUserPage,
   submitPipeRecheck,
   getPipePendingVerificationListApi,
@@ -53,7 +55,7 @@ export enum TaskOrderFuncName {
   TaskEquipList,
   CheckEquipTaskList,
   TaskConfirm,
-  TaskOrderzTaskItemList,
+  TaskOrderDetail,
   EquipmentConfirmClaim,
   EquipmentCancelClaim,
   RecheckUserList,
@@ -169,7 +171,7 @@ const map = {
       outputAdapter: null,
     },
   },
-  [TaskOrderFuncName.TaskOrderzTaskItemList]: {
+  [TaskOrderFuncName.TaskOrderDetail]: {
     [EquipmentType.BOILER]: {
       inputAdapter: null,
       reqFunction: getBoilerTaskItemListByOrderId,
@@ -177,12 +179,12 @@ const map = {
     },
     [EquipmentType.PIPE]: {
       inputAdapter: null,
-      reqFunction: getBoilerTaskItemListByOrderId,
+      reqFunction: getPipeTaskItemListByOrderId,
       outputAdapter: null,
     },
     [EquipmentType.CONTAINER]: {
       inputAdapter: null,
-      reqFunction: getBoilerTaskItemListByOrderId,
+      reqFunction: getOrderDetail,
       outputAdapter: null,
     },
   },

+ 1 - 1
src/api/ApiRouter/taskOrderItemReport.ts

@@ -44,7 +44,7 @@ export const requestFunc = (funcName: TaskOrderItemReportFuncName, equipType: Eq
     throw new Error('api for send is not exists')
   }
   // 2. send req
-  const respData = adapter.reqFunction(params)
+  const respData = adapter.reqFunction(reqParams)
   // 3. output adapter
   let adaptedRespData = respData
   if (adapter.outputAdapter) {

+ 47 - 3
src/api/ApiRouter/taskOrderSecurityCheck.ts

@@ -1,12 +1,20 @@
 import { EquipmentType } from '@/utils/dictMap'
-import { getSafetyCheckRecordPage, deleteSafetyCheckRecord } from '@/api/task'
+import {
+  getSafetyCheckRecordPage,
+  getSafetyCheckRecordTemplate,
+  deleteSafetyCheckRecord,
+} from '@/api/task'
 import {
   getBoilerSecurityCheckPage,
+  getBoilerSecurityCheckTemplate,
   delBoilerSecurityCheck,
+  createBoilerSecurityCheck,
 } from '@/api/boiler/boilerTaskOrderSecurityCheck'
 import {
   getPipeSecurityCheckPage,
+  getPipeSecurityCheckTemplate,
   delPipeSecurityCheck,
+  createPipeSecurityCheck,
 } from '@/api/pipe/pipeTaskOrderSecurityCheck'
 
 type Adapter = {
@@ -17,7 +25,9 @@ type Adapter = {
 
 export enum SecurityCheckFuncName {
   getPage,
+  getTemplate,
   delSecurityCheckItem,
+  createSecurityCheckItem,
 }
 
 const map = {
@@ -55,9 +65,43 @@ const map = {
       outputAdapter: null,
     },
   },
+  [SecurityCheckFuncName.getTemplate]: {
+    [EquipmentType.BOILER]: {
+      inputAdapter: null,
+      reqFunction: getBoilerSecurityCheckTemplate,
+      outputAdapter: null,
+    },
+    [EquipmentType.PIPE]: {
+      inputAdapter: null,
+      reqFunction: getPipeSecurityCheckTemplate,
+      outputAdapter: null,
+    },
+    [EquipmentType.CONTAINER]: {
+      inputAdapter: null,
+      reqFunction: getSafetyCheckRecordTemplate,
+      outputAdapter: null,
+    },
+  },
+  [SecurityCheckFuncName.createSecurityCheckItem]: {
+    [EquipmentType.BOILER]: {
+      inputAdapter: null,
+      reqFunction: createBoilerSecurityCheck,
+      outputAdapter: null,
+    },
+    [EquipmentType.PIPE]: {
+      inputAdapter: null,
+      reqFunction: createPipeSecurityCheck,
+      outputAdapter: null,
+    },
+    [EquipmentType.CONTAINER]: {
+      inputAdapter: null,
+      reqFunction: createBoilerSecurityCheck,
+      outputAdapter: null,
+    },
+  },
 }
 
-export const requestFunc = (funcName: IndexFuncName, equipType: EquipmentType, params: any) => {
+export const requestFunc = (funcName: SecurityCheckFuncName, equipType: EquipmentType, params: any) => {
   const funMap = map[funcName]
   const adapter = funMap[equipType]
   // 1. input adapter
@@ -69,7 +113,7 @@ export const requestFunc = (funcName: IndexFuncName, equipType: EquipmentType, p
     throw new Error('api for send is not exists')
   }
   // 2. send req
-  const respData = adapter.reqFunction(params)
+  const respData = adapter.reqFunction(reqParams)
   // 3. output adapter
   let adaptedRespData = respData
   if (adapter.outputAdapter) {

+ 5 - 1
src/api/boiler/boilerEquip.ts

@@ -1,4 +1,4 @@
-import { httpGet } from '@/utils/http'
+import { httpGet, httpPUT } from '@/utils/http'
 
 /**
  * 设备查询:列表
@@ -10,3 +10,7 @@ export const getEquipBoilerList = (params: any) => {
 export const getEquipBoilerById = (params: any) => {
   return httpGet('/pressure2/equip-boiler/get', params)
 }
+
+export const updateEquipBoiler = (body: any) => {
+  return httpPUT('/pressure2/equip-boiler/update', body)
+}

+ 8 - 0
src/api/boiler/boilerSign.ts

@@ -0,0 +1,8 @@
+import { httpGet, httpPUT } from '@/utils/http'
+
+/**
+ * 提交签名
+ */
+export const submitBoilerSign = (params: any) => {
+  return httpGet('/pressure2/boiler-task-order/order-sign/submit', params)
+}

+ 1 - 1
src/api/boiler/boilerTaskOrder.ts

@@ -20,7 +20,7 @@ export const confirmBoilerTaskOrder = (data: any) => {
   return httpPost('/pressure2/boiler-task-order/confirm', data)
 }
 
-// 任务单认领
+// 任务单详情
 export const getBoilerTaskItemListByOrderId = (params: any) => {
   return httpGet('/pressure2/boiler-task-order/get', params)
 }

+ 2 - 2
src/api/boiler/boilerTaskOrderSecurityCheck.ts

@@ -1,7 +1,7 @@
 import { httpGet, httpPost, httpPUT, httpDelete } from '@/utils/http'
 
 // 安全检查记录默认模板
-export const getSecurityCheckTemplate = (params: any) => {
+export const getBoilerSecurityCheckTemplate = (params: any) => {
   return httpGet('/pressure2/boiler-task-order-security-check/default-template', params)
 }
 
@@ -11,7 +11,7 @@ export const getBoilerSecurityCheckPage = (params: any) => {
 }
 
 // 创建安全检查记录
-export const createSecurityCheck = (data: any) => {
+export const createBoilerSecurityCheck = (data: any) => {
   return httpPost('/pressure2/boiler-task-order-security-check/create', data)
 }
 

+ 5 - 1
src/api/pipe/pipeEquip.ts

@@ -1,4 +1,4 @@
-import { httpGet } from '@/utils/http'
+import { httpGet, httpPUT } from '@/utils/http'
 
 /**
  * 设备查询:列表
@@ -10,3 +10,7 @@ export const getEquipPipeList = (params: any) => {
 export const getEquipPipeById = (params: any) => {
   return httpGet('/pressure2/equip-pipe/get', params)
 }
+
+export const updateEquipPipe = (body: any) => {
+  return httpPUT('/pressure2/equip-pipe/update', body)
+}

+ 8 - 0
src/api/pipe/pipeSign.ts

@@ -0,0 +1,8 @@
+import { httpGet, httpPUT } from '@/utils/http'
+
+/**
+ * 提交签名
+ */
+export const submitPipeSign = (params: any) => {
+  return httpGet('/pressure2/pipe-task-order/order-sign/submit', params)
+}

+ 5 - 0
src/api/pipe/pipeTaskOrder.ts

@@ -20,6 +20,11 @@ export const confirmPipeTaskOrder = (data: any) => {
   return httpPost('/pressure2/pipe-task-order/confirm', data)
 }
 
+// 任务单详情
+export const getPipeTaskItemListByOrderId = (params: any) => {
+  return httpGet('/pressure2/pipe-task-order/get', params)
+}
+
 // 设备认领
 export const confirmPipeEquipmentClaim = (data: { id: string }) => {
   return httpPost('/pressure2/pipe-task-order/order-item/claim', data)

+ 6 - 1
src/api/pipe/pipeTaskOrderSecurityCheck.ts

@@ -1,7 +1,7 @@
 import { httpGet, httpPost, httpPUT, httpDelete } from '@/utils/http'
 
 // 任务确认分页列表
-export const getSecurityCheckTemplate = (params: any) => {
+export const getPipeSecurityCheckTemplate = (params: any) => {
   return httpGet('/pressure2/pipe-task-order-security-check/default-template', params)
 }
 
@@ -10,6 +10,11 @@ export const getPipeSecurityCheckPage = (params: any) => {
   return httpGet('/pressure2/pipe-task-order-security-check/page', params)
 }
 
+// 创建安全检查记录
+export const createPipeSecurityCheck = (data: any) => {
+  return httpPost('/pressure2/pipe-task-order-security-check/create', data)
+}
+
 // 删除安全检查记录
 export const delPipeSecurityCheck = (params: any) => {
   return httpDelete('/pressure2/pipe-task-order-security-check/delete', params)

+ 1 - 1
src/api/sign.ts

@@ -48,7 +48,7 @@ export const getTaskOrderImg = (data: any) => {
  * 确认签名
  */
 export const signConfirm = (params: any) => {
-  return httpGet('/pressure/task-order/order-sign/submit', params)
+  return httpGet('/pressure2/boiler-task-order/order-sign/submit', params)
 }
 
 /**

+ 73 - 55
src/pages/equipment/detail/components/BoilerBaseInfo.vue

@@ -26,7 +26,7 @@
               class="edit-input-text"
               placeholder="请输入"
             />
-            <text v-else class="cell-text">{{ equipment.unitName || '--' }}</text>
+            <text v-else class="cell-text">{{ equipment.unitName }}</text>
           </view>
         </view>
 
@@ -42,7 +42,7 @@
               class="edit-input-text"
               placeholder="请输入"
             />
-            <text v-else class="cell-text">{{ equipment.unitCode || '--' }}</text>
+            <text v-else class="cell-text">{{ equipment.unitCode }}</text>
           </view>
         </view>
 
@@ -59,7 +59,7 @@
               placeholder="请输入"
               maxlength="6"
             />
-            <text v-else class="cell-text">{{ equipment.zipCode || '--' }}</text>
+            <text v-else class="cell-text">{{ equipment.zipCode }}</text>
           </view>
         </view>
 
@@ -75,7 +75,7 @@
               class="edit-textarea"
               placeholder="请输入"
             />
-            <text v-else class="cell-text">{{ equipment.unitAddress || '--' }}</text>
+            <text v-else class="cell-text">{{ equipment.unitAddress }}</text>
           </view>
         </view>
 
@@ -91,7 +91,7 @@
               class="edit-input-text"
               placeholder="请输入"
             />
-            <text v-else class="cell-text">{{ equipment.contact || '--' }}</text>
+            <text v-else class="cell-text">{{ equipment.contact }}</text>
           </view>
         </view>
 
@@ -108,7 +108,7 @@
               placeholder="请输入"
               maxlength="11"
             />
-            <text v-else class="cell-text">{{ equipment.contactPhone || '--' }}</text>
+            <text v-else class="cell-text">{{ equipment.contactPhone }}</text>
           </view>
         </view>
 
@@ -124,7 +124,7 @@
               class="edit-input-text"
               placeholder="请输入"
             />
-            <text v-else class="cell-text">{{ equipment.contactEmail || '--' }}</text>
+            <text v-else class="cell-text">{{ equipment.contactEmail }}</text>
           </view>
         </view>
 
@@ -140,7 +140,7 @@
               class="edit-input-text"
               placeholder="请输入"
             />
-            <text v-else class="cell-text">{{ equipment.productCheckUnit || '--' }}</text>
+            <text v-else class="cell-text">{{ equipment.productCheckUnit }}</text>
           </view>
         </view>
 
@@ -156,7 +156,7 @@
               class="edit-input-text"
               placeholder="请输入"
             />
-            <text v-else class="cell-text">{{ equipment.checkUnitCode || '--' }}</text>
+            <text v-else class="cell-text">{{ equipment.checkUnitCode }}</text>
           </view>
         </view>
 
@@ -172,7 +172,7 @@
               class="edit-input-text"
               placeholder="请输入"
             />
-            <text v-else class="cell-text">{{ equipment.installUnit || '--' }}</text>
+            <text v-else class="cell-text">{{ equipment.installUnit }}</text>
           </view>
         </view>
 
@@ -188,7 +188,7 @@
               class="edit-input-text"
               placeholder="请输入"
             />
-            <text v-else class="cell-text">{{ equipment.installUnitCode || '--' }}</text>
+            <text v-else class="cell-text">{{ equipment.installUnitCode }}</text>
           </view>
         </view>
 
@@ -204,7 +204,7 @@
               class="edit-input-text"
               placeholder="请输入"
             />
-            <text v-else class="cell-text">{{ equipment.madeUnit || '--' }}</text>
+            <text v-else class="cell-text">{{ equipment.madeUnit }}</text>
           </view>
         </view>
 
@@ -220,7 +220,7 @@
               class="edit-input-text"
               placeholder="请输入"
             />
-            <text v-else class="cell-text">{{ equipment.madeUnitCode || '--' }}</text>
+            <text v-else class="cell-text">{{ equipment.madeUnitCode }}</text>
           </view>
         </view>
 
@@ -241,7 +241,7 @@
                 <image class="arrow-icon" src="/static/images/arrow-right.png" />
               </view>
             </picker>
-            <text v-else class="cell-text">{{ formatDate(equipment.madeTime) || '--' }}</text>
+            <text v-else class="cell-text">{{ formatDate(equipment.madeTime) }}</text>
           </view>
         </view>
 
@@ -257,7 +257,7 @@
               class="edit-input-text"
               placeholder="请输入"
             />
-            <text v-else class="cell-text">{{ equipment.madeCountry || '--' }}</text>
+            <text v-else class="cell-text">{{ equipment.madeCountry }}</text>
           </view>
         </view>
 
@@ -273,7 +273,7 @@
               class="edit-input-text"
               placeholder="请输入"
             />
-            <text v-else class="cell-text">{{ equipment.recipient || '--' }}</text>
+            <text v-else class="cell-text">{{ equipment.recipient }}</text>
           </view>
         </view>
 
@@ -290,7 +290,7 @@
               placeholder="请输入"
               maxlength="11"
             />
-            <text v-else class="cell-text">{{ equipment.recipientPhone || '--' }}</text>
+            <text v-else class="cell-text">{{ equipment.recipientPhone }}</text>
           </view>
         </view>
 
@@ -306,7 +306,7 @@
               class="edit-input-text"
               placeholder="请输入"
             />
-            <text v-else class="cell-text">{{ equipment.recipientEmail || '--' }}</text>
+            <text v-else class="cell-text">{{ equipment.recipientEmail }}</text>
           </view>
         </view>
 
@@ -322,7 +322,7 @@
               class="edit-input-text"
               placeholder="请输入"
             />
-            <text v-else class="cell-text">{{ equipment.payment || '--' }}</text>
+            <text v-else class="cell-text">{{ equipment.payment }}</text>
           </view>
         </view>
 
@@ -339,7 +339,7 @@
               placeholder="请输入"
               maxlength="11"
             />
-            <text v-else class="cell-text">{{ equipment.paymentPhone || '--' }}</text>
+            <text v-else class="cell-text">{{ equipment.paymentPhone }}</text>
           </view>
         </view>
 
@@ -355,7 +355,7 @@
               class="edit-input-text"
               placeholder="请输入"
             />
-            <text v-else class="cell-text">{{ equipment.paymentEmail || '--' }}</text>
+            <text v-else class="cell-text">{{ equipment.paymentEmail }}</text>
           </view>
         </view>
 
@@ -371,7 +371,7 @@
               class="edit-input-text"
               placeholder="请输入"
             />
-            <text v-else class="cell-text">{{ equipment.safebm || '--' }}</text>
+            <text v-else class="cell-text">{{ equipment.safebm }}</text>
           </view>
         </view>
 
@@ -387,7 +387,7 @@
               class="edit-input-text"
               placeholder="请输入"
             />
-            <text v-else class="cell-text">{{ equipment.safery || '--' }}</text>
+            <text v-else class="cell-text">{{ equipment.safery }}</text>
           </view>
         </view>
 
@@ -404,7 +404,7 @@
               placeholder="请输入"
               maxlength="11"
             />
-            <text v-else class="cell-text">{{ equipment.saferydh || '--' }}</text>
+            <text v-else class="cell-text">{{ equipment.saferydh }}</text>
           </view>
         </view>
       </view>
@@ -428,7 +428,7 @@
               class="edit-input-text"
               placeholder="请输入"
             />
-            <text v-else class="cell-text">{{ equipment.lastInCheckReportNo || '--' }}</text>
+            <text v-else class="cell-text">{{ equipment.lastInCheckReportNo }}</text>
           </view>
         </view>
 
@@ -449,7 +449,7 @@
                 <image class="arrow-icon" src="/static/images/arrow-right.png" />
               </view>
             </picker>
-            <text v-else class="cell-text">{{ formatDate(equipment.lastAllDate) || '--' }}</text>
+            <text v-else class="cell-text">{{ formatDate(equipment.lastAllDate) }}</text>
           </view>
         </view>
 
@@ -470,7 +470,7 @@
                 <image class="arrow-icon" src="/static/images/arrow-right.png" />
               </view>
             </picker>
-            <text v-else class="cell-text">{{ formatDate(equipment.nextInCheckDate) || '--' }}</text>
+            <text v-else class="cell-text">{{ formatDate(equipment.nextInCheckDate) }}</text>
           </view>
         </view>
 
@@ -486,7 +486,7 @@
               class="edit-textarea"
               placeholder="请输入"
             />
-            <text v-else class="cell-text">{{ equipment.lastInCheckConclusion || '--' }}</text>
+            <text v-else class="cell-text">{{ equipment.lastInCheckConclusion }}</text>
           </view>
         </view>
 
@@ -502,7 +502,7 @@
               class="edit-textarea"
               placeholder="请输入"
             />
-            <text v-else class="cell-text">{{ equipment.lastInCheckProblem || '--' }}</text>
+            <text v-else class="cell-text">{{ equipment.lastInCheckProblem }}</text>
           </view>
         </view>
       </view>
@@ -526,7 +526,7 @@
               class="edit-input-text"
               placeholder="请输入"
             />
-            <text v-else class="cell-text">{{ equipment.lastOutCheckReportNo || '--' }}</text>
+            <text v-else class="cell-text">{{ equipment.lastOutCheckReportNo }}</text>
           </view>
         </view>
 
@@ -547,7 +547,7 @@
                 <image class="arrow-icon" src="/static/images/arrow-right.png" />
               </view>
             </picker>
-            <text v-else class="cell-text">{{ formatDate(equipment.lastYearDate) || '--' }}</text>
+            <text v-else class="cell-text">{{ formatDate(equipment.lastYearDate) }}</text>
           </view>
         </view>
 
@@ -568,7 +568,7 @@
                 <image class="arrow-icon" src="/static/images/arrow-right.png" />
               </view>
             </picker>
-            <text v-else class="cell-text">{{ formatDate(equipment.nextOutCheckDate) || '--' }}</text>
+            <text v-else class="cell-text">{{ formatDate(equipment.nextOutCheckDate) }}</text>
           </view>
         </view>
 
@@ -584,7 +584,7 @@
               class="edit-textarea"
               placeholder="请输入"
             />
-            <text v-else class="cell-text">{{ equipment.lastOutCheckConclusion || '--' }}</text>
+            <text v-else class="cell-text">{{ equipment.lastOutCheckConclusion }}</text>
           </view>
         </view>
 
@@ -600,7 +600,7 @@
               class="edit-textarea"
               placeholder="请输入"
             />
-            <text v-else class="cell-text">{{ equipment.lastOutCheckProblem || '--' }}</text>
+            <text v-else class="cell-text">{{ equipment.lastOutCheckProblem }}</text>
           </view>
         </view>
       </view>
@@ -624,7 +624,7 @@
               class="edit-input-text"
               placeholder="请输入"
             />
-            <text v-else class="cell-text">{{ equipment.lastPressureCheckReportNo || '--' }}</text>
+            <text v-else class="cell-text">{{ equipment.lastPressureCheckReportNo }}</text>
           </view>
         </view>
 
@@ -645,7 +645,7 @@
                 <image class="arrow-icon" src="/static/images/arrow-right.png" />
               </view>
             </picker>
-            <text v-else class="cell-text">{{ formatDate(equipment.lastPressureDate) || '--' }}</text>
+            <text v-else class="cell-text">{{ formatDate(equipment.lastPressureDate) }}</text>
           </view>
         </view>
 
@@ -666,7 +666,7 @@
                 <image class="arrow-icon" src="/static/images/arrow-right.png" />
               </view>
             </picker>
-            <text v-else class="cell-text">{{ formatDate(equipment.nextPressureCheckDate) || '--' }}</text>
+            <text v-else class="cell-text">{{ formatDate(equipment.nextPressureCheckDate) }}</text>
           </view>
         </view>
 
@@ -682,7 +682,7 @@
               class="edit-textarea"
               placeholder="请输入"
             />
-            <text v-else class="cell-text">{{ equipment.lastPressureCheckConclusion || '--' }}</text>
+            <text v-else class="cell-text">{{ equipment.lastPressureCheckConclusion }}</text>
           </view>
         </view>
 
@@ -698,7 +698,7 @@
               class="edit-textarea"
               placeholder="请输入"
             />
-            <text v-else class="cell-text">{{ equipment.lastPressureCheckProblem || '--' }}</text>
+            <text v-else class="cell-text">{{ equipment.lastPressureCheckProblem }}</text>
           </view>
         </view>
       </view>
@@ -722,7 +722,7 @@
               class="edit-input-text"
               placeholder="请输入"
             />
-            <text v-else class="cell-text">{{ equipment.lastEnergyEffciencyCheckReportNo || '--' }}</text>
+            <text v-else class="cell-text">{{ equipment.lastEnergyEffciencyCheckReportNo }}</text>
           </view>
         </view>
 
@@ -743,7 +743,7 @@
                 <image class="arrow-icon" src="/static/images/arrow-right.png" />
               </view>
             </picker>
-            <text v-else class="cell-text">{{ formatDate(equipment.lastenergydate) || '--' }}</text>
+            <text v-else class="cell-text">{{ formatDate(equipment.lastenergydate) }}</text>
           </view>
         </view>
 
@@ -764,7 +764,7 @@
                 <image class="arrow-icon" src="/static/images/arrow-right.png" />
               </view>
             </picker>
-            <text v-else class="cell-text">{{ formatDate(equipment.nextEnergyEffciencyCheckDate) || '--' }}</text>
+            <text v-else class="cell-text">{{ formatDate(equipment.nextEnergyEffciencyCheckDate) }}</text>
           </view>
         </view>
       </view>
@@ -793,7 +793,7 @@
                 <image class="arrow-icon" src="/static/images/arrow-right.png" />
               </view>
             </picker>
-            <text v-else class="cell-text">{{ formatDate(equipment.nextEnergySaveCheckDate) || '--' }}</text>
+            <text v-else class="cell-text">{{ formatDate(equipment.nextEnergySaveCheckDate) }}</text>
           </view>
         </view>
       </view>
@@ -817,7 +817,7 @@
               class="edit-input-text"
               placeholder="请输入"
             />
-            <text v-else class="cell-text">{{ equipment.installCheckReportNo || '--' }}</text>
+            <text v-else class="cell-text">{{ equipment.installCheckReportNo }}</text>
           </view>
         </view>
       </view>
@@ -841,7 +841,7 @@
               class="edit-input-text"
               placeholder="请输入"
             />
-            <text v-else class="cell-text">{{ equipment.lastRepairCheckReportNo || '--' }}</text>
+            <text v-else class="cell-text">{{ equipment.lastRepairCheckReportNo }}</text>
           </view>
         </view>
 
@@ -862,7 +862,7 @@
                 <image class="arrow-icon" src="/static/images/arrow-right.png" />
               </view>
             </picker>
-            <text v-else class="cell-text">{{ formatDate(equipment.overseeCheckBeginDate) || '--' }}</text>
+            <text v-else class="cell-text">{{ formatDate(equipment.overseeCheckBeginDate) }}</text>
           </view>
         </view>
 
@@ -883,7 +883,7 @@
                 <image class="arrow-icon" src="/static/images/arrow-right.png" />
               </view>
             </picker>
-            <text v-else class="cell-text">{{ formatDate(equipment.overseeCheckEndDate) || '--' }}</text>
+            <text v-else class="cell-text">{{ formatDate(equipment.overseeCheckEndDate) }}</text>
           </view>
         </view>
 
@@ -899,7 +899,7 @@
               class="edit-textarea"
               placeholder="请输入"
             />
-            <text v-else class="cell-text">{{ equipment.lastRepairReformContent || '--' }}</text>
+            <text v-else class="cell-text">{{ equipment.lastRepairReformContent }}</text>
           </view>
         </view>
       </view>
@@ -909,6 +909,7 @@
 
 <script lang="ts" setup>
 import { ref, reactive, onMounted } from 'vue'
+import { updateEquipBoiler } from '@/api/boiler/boilerEquip'
 
 interface Props {
   dataSource: any
@@ -932,6 +933,7 @@ const isEdit = ref(false)
 const originalData = ref<any>(null)
 
 const equipment = reactive<any>({
+  id: '',
   unitName: '',
   unitCode: '',
   zipCode: '',
@@ -1019,13 +1021,7 @@ const handleCancel = () => {
 const handleSave = async () => {
   try {
     if (props.useOnline === '1') {
-      uni.showLoading({ title: '保存中...' })
-      setTimeout(() => {
-        uni.hideLoading()
-        uni.showToast({ title: '保存成功', icon: 'success' })
-        isEdit.value = false
-        emit('update', equipment)
-      }, 1000)
+      await saveToApi()
     } else {
       await saveToLocal()
     }
@@ -1035,6 +1031,28 @@ const handleSave = async () => {
   }
 }
 
+const saveToApi = async () => {
+  uni.showLoading({ title: '保存中...' })
+  try {
+    const saveData = {
+      ...equipment,
+    }
+    const result: any = await updateEquipBoiler(saveData)
+    uni.hideLoading()
+    if (result?.code === 0) {
+      uni.showToast({ title: '保存成功', icon: 'success' })
+      isEdit.value = false
+      emit('update', equipment)
+    } else {
+      uni.showToast({ title: result?.msg || '保存失败', icon: 'error' })
+    }
+  } catch (error) {
+    uni.hideLoading()
+    console.error('保存失败:', error)
+    uni.showToast({ title: '保存失败', icon: 'error' })
+  }
+}
+
 const saveToLocal = async () => {
   try {
     await uni.setStorage({

File diff suppressed because it is too large
+ 262 - 112
src/pages/equipment/detail/components/BoilerEquipmentInfo.vue


+ 59 - 39
src/pages/equipment/detail/components/PipeBaseInfo.vue

@@ -26,7 +26,7 @@
               class="edit-input-text"
               placeholder="请输入"
             />
-            <text v-else class="cell-text">{{ equipment.unitName || '--' }}</text>
+            <text v-else class="cell-text">{{ equipment.unitName }}</text>
           </view>
         </view>
 
@@ -42,7 +42,7 @@
               class="edit-input-text"
               placeholder="请输入"
             />
-            <text v-else class="cell-text">{{ equipment.unitCode || '--' }}</text>
+            <text v-else class="cell-text">{{ equipment.unitCode }}</text>
           </view>
         </view>
 
@@ -59,7 +59,7 @@
               placeholder="请输入"
               maxlength="6"
             />
-            <text v-else class="cell-text">{{ equipment.postalCode || '--' }}</text>
+            <text v-else class="cell-text">{{ equipment.postalCode }}</text>
           </view>
         </view>
 
@@ -75,7 +75,7 @@
               class="edit-input-text"
               placeholder="请输入"
             />
-            <text v-else class="cell-text">{{ equipment.unitNature || '--' }}</text>
+            <text v-else class="cell-text">{{ equipment.unitNature }}</text>
           </view>
         </view>
 
@@ -91,7 +91,7 @@
               class="edit-textarea"
               placeholder="请输入"
             />
-            <text v-else class="cell-text">{{ equipment.unitAddress || '--' }}</text>
+            <text v-else class="cell-text">{{ equipment.unitAddress }}</text>
           </view>
         </view>
 
@@ -107,7 +107,7 @@
               class="edit-input-text"
               placeholder="请输入"
             />
-            <text v-else class="cell-text">{{ equipment.securityMan || '--' }}</text>
+            <text v-else class="cell-text">{{ equipment.securityMan }}</text>
           </view>
         </view>
 
@@ -124,7 +124,7 @@
               placeholder="请输入"
               maxlength="11"
             />
-            <text v-else class="cell-text">{{ equipment.securityManPhone || '--' }}</text>
+            <text v-else class="cell-text">{{ equipment.securityManPhone }}</text>
           </view>
         </view>
 
@@ -140,7 +140,7 @@
               class="edit-input-text"
               placeholder="请输入"
             />
-            <text v-else class="cell-text">{{ equipment.securityDept || '--' }}</text>
+            <text v-else class="cell-text">{{ equipment.securityDept }}</text>
           </view>
         </view>
 
@@ -156,7 +156,7 @@
               class="edit-input-text"
               placeholder="请输入"
             />
-            <text v-else class="cell-text">{{ equipment.contact || '--' }}</text>
+            <text v-else class="cell-text">{{ equipment.contact }}</text>
           </view>
         </view>
 
@@ -173,7 +173,7 @@
               placeholder="请输入"
               maxlength="11"
             />
-            <text v-else class="cell-text">{{ equipment.contactPhone || '--' }}</text>
+            <text v-else class="cell-text">{{ equipment.contactPhone }}</text>
           </view>
         </view>
 
@@ -189,7 +189,7 @@
               class="edit-input-text"
               placeholder="请输入"
             />
-            <text v-else class="cell-text">{{ equipment.contactEmail || '--' }}</text>
+            <text v-else class="cell-text">{{ equipment.contactEmail }}</text>
           </view>
         </view>
 
@@ -205,7 +205,7 @@
               class="edit-input-text"
               placeholder="请输入"
             />
-            <text v-else class="cell-text">{{ equipment.recipient || '--' }}</text>
+            <text v-else class="cell-text">{{ equipment.recipient }}</text>
           </view>
         </view>
 
@@ -222,7 +222,7 @@
               placeholder="请输入"
               maxlength="11"
             />
-            <text v-else class="cell-text">{{ equipment.recipientPhone || '--' }}</text>
+            <text v-else class="cell-text">{{ equipment.recipientPhone }}</text>
           </view>
         </view>
 
@@ -238,7 +238,7 @@
               class="edit-input-text"
               placeholder="请输入"
             />
-            <text v-else class="cell-text">{{ equipment.recipientEmail || '--' }}</text>
+            <text v-else class="cell-text">{{ equipment.recipientEmail }}</text>
           </view>
         </view>
 
@@ -254,7 +254,7 @@
               class="edit-input-text"
               placeholder="请输入"
             />
-            <text v-else class="cell-text">{{ equipment.payment || '--' }}</text>
+            <text v-else class="cell-text">{{ equipment.payment }}</text>
           </view>
         </view>
 
@@ -271,7 +271,7 @@
               placeholder="请输入"
               maxlength="11"
             />
-            <text v-else class="cell-text">{{ equipment.paymentPhone || '--' }}</text>
+            <text v-else class="cell-text">{{ equipment.paymentPhone }}</text>
           </view>
         </view>
 
@@ -287,7 +287,7 @@
               class="edit-input-text"
               placeholder="请输入"
             />
-            <text v-else class="cell-text">{{ equipment.paymentEmail || '--' }}</text>
+            <text v-else class="cell-text">{{ equipment.paymentEmail }}</text>
           </view>
         </view>
       </view>
@@ -311,7 +311,7 @@
               class="edit-input-text"
               placeholder="请输入"
             />
-            <text v-else class="cell-text">{{ equipment.installCheckReportNo || '--' }}</text>
+            <text v-else class="cell-text">{{ equipment.installCheckReportNo }}</text>
           </view>
         </view>
       </view>
@@ -335,7 +335,9 @@
               class="edit-input-text"
               placeholder="请输入"
             />
-            <text v-else class="cell-text">{{ equipment.lastLegalPeriodicalInspectionReportNo || '--' }}</text>
+            <text v-else class="cell-text">
+              {{ equipment.lastLegalPeriodicalInspectionReportNo }}
+            </text>
           </view>
         </view>
 
@@ -356,7 +358,7 @@
                 <image class="arrow-icon" src="/static/images/arrow-right.png" />
               </view>
             </picker>
-            <text v-else class="cell-text">{{ formatDate(equipment.nextLegalCheckDate) || '--' }}</text>
+            <text v-else class="cell-text">{{ formatDate(equipment.nextLegalCheckDate) }}</text>
           </view>
         </view>
 
@@ -372,7 +374,7 @@
               class="edit-input-text"
               placeholder="请输入"
             />
-            <text v-else class="cell-text">{{ equipment.minSafetyStatusReg || '--' }}</text>
+            <text v-else class="cell-text">{{ equipment.minSafetyStatusReg }}</text>
           </view>
         </view>
 
@@ -388,7 +390,7 @@
               class="edit-textarea"
               placeholder="请输入"
             />
-            <text v-else class="cell-text">{{ equipment.lastLegalConclusion || '--' }}</text>
+            <text v-else class="cell-text">{{ equipment.lastLegalConclusion }}</text>
           </view>
         </view>
 
@@ -404,7 +406,7 @@
               class="edit-textarea"
               placeholder="请输入"
             />
-            <text v-else class="cell-text">{{ equipment.lastLegalIssues || '--' }}</text>
+            <text v-else class="cell-text">{{ equipment.lastLegalIssues }}</text>
           </view>
         </view>
       </view>
@@ -428,7 +430,7 @@
               class="edit-input-text"
               placeholder="请输入"
             />
-            <text v-else class="cell-text">{{ equipment.lastYearReportNo || '--' }}</text>
+            <text v-else class="cell-text">{{ equipment.lastYearReportNo }}</text>
           </view>
         </view>
 
@@ -449,7 +451,7 @@
                 <image class="arrow-icon" src="/static/images/arrow-right.png" />
               </view>
             </picker>
-            <text v-else class="cell-text">{{ formatDate(equipment.nextYearCheckDate) || '--' }}</text>
+            <text v-else class="cell-text">{{ formatDate(equipment.nextYearCheckDate) }}</text>
           </view>
         </view>
 
@@ -465,7 +467,7 @@
               class="edit-input-text"
               placeholder="请输入"
             />
-            <text v-else class="cell-text">{{ equipment.installationStatusReg || '--' }}</text>
+            <text v-else class="cell-text">{{ equipment.installationStatusReg }}</text>
           </view>
         </view>
 
@@ -481,7 +483,7 @@
               class="edit-textarea"
               placeholder="请输入"
             />
-            <text v-else class="cell-text">{{ equipment.lastYearConclusion || '--' }}</text>
+            <text v-else class="cell-text">{{ equipment.lastYearConclusion }}</text>
           </view>
         </view>
 
@@ -497,7 +499,7 @@
               class="edit-textarea"
               placeholder="请输入"
             />
-            <text v-else class="cell-text">{{ equipment.lastYearIssues || '--' }}</text>
+            <text v-else class="cell-text">{{ equipment.lastYearIssues }}</text>
           </view>
         </view>
       </view>
@@ -521,7 +523,7 @@
               class="edit-input-text"
               placeholder="请输入"
             />
-            <text v-else class="cell-text">{{ equipment.lastMaintenanceReportNo || '--' }}</text>
+            <text v-else class="cell-text">{{ equipment.lastMaintenanceReportNo }}</text>
           </view>
         </view>
 
@@ -542,7 +544,7 @@
                 <image class="arrow-icon" src="/static/images/arrow-right.png" />
               </view>
             </picker>
-            <text v-else class="cell-text">{{ formatDate(equipment.supervisionStartDate) || '--' }}</text>
+            <text v-else class="cell-text">{{ formatDate(equipment.supervisionStartDate) }}</text>
           </view>
         </view>
 
@@ -563,7 +565,7 @@
                 <image class="arrow-icon" src="/static/images/arrow-right.png" />
               </view>
             </picker>
-            <text v-else class="cell-text">{{ formatDate(equipment.supervisionEndDate) || '--' }}</text>
+            <text v-else class="cell-text">{{ formatDate(equipment.supervisionEndDate) }}</text>
           </view>
         </view>
 
@@ -579,7 +581,7 @@
               class="edit-textarea"
               placeholder="请输入"
             />
-            <text v-else class="cell-text">{{ equipment.lastMaintenanceContent || '--' }}</text>
+            <text v-else class="cell-text">{{ equipment.lastMaintenanceContent }}</text>
           </view>
         </view>
       </view>
@@ -589,6 +591,7 @@
 
 <script lang="ts" setup>
 import { ref, reactive, onMounted } from 'vue'
+import { updateEquipPipe } from '@/api/pipe/pipeEquip'
 
 interface Props {
   dataSource: any
@@ -612,6 +615,7 @@ const isEdit = ref(false)
 const originalData = ref<any>(null)
 
 const equipment = reactive<any>({
+  id: '',
   unitName: '',
   unitCode: '',
   postalCode: '',
@@ -683,13 +687,7 @@ const handleCancel = () => {
 const handleSave = async () => {
   try {
     if (props.useOnline === '1') {
-      uni.showLoading({ title: '保存中...' })
-      setTimeout(() => {
-        uni.hideLoading()
-        uni.showToast({ title: '保存成功', icon: 'success' })
-        isEdit.value = false
-        emit('update', equipment)
-      }, 1000)
+      await saveToApi()
     } else {
       await saveToLocal()
     }
@@ -699,6 +697,28 @@ const handleSave = async () => {
   }
 }
 
+const saveToApi = async () => {
+  uni.showLoading({ title: '保存中...' })
+  try {
+    const saveData = {
+      ...equipment,
+    }
+    const result: any = await updateEquipPipe(saveData)
+    uni.hideLoading()
+    if (result?.code === 0) {
+      uni.showToast({ title: '保存成功', icon: 'success' })
+      isEdit.value = false
+      emit('update', equipment)
+    } else {
+      uni.showToast({ title: result?.msg || '保存失败', icon: 'error' })
+    }
+  } catch (error) {
+    uni.hideLoading()
+    console.error('保存失败:', error)
+    uni.showToast({ title: '保存失败', icon: 'error' })
+  }
+}
+
 const saveToLocal = async () => {
   try {
     await uni.setStorage({

File diff suppressed because it is too large
+ 381 - 140
src/pages/equipment/detail/components/PipeEquipmentInfo.vue


+ 6 - 3
src/pages/equipment/detail/equipmentDetail.vue

@@ -321,11 +321,13 @@ const fetchGetOnlineEquipmentDetail = async () => {
       const equipment = result.data.taskOrderItem
       const isMain = isMainChecker(equipment, userInfo.value)
       // 过滤检验项目
+      const equip = result.data.taskOrderItem
+
       const filteredReportList = reportDic?.reportList
         ?.map((item: any) => ({
           ...item,
-          equipId: result.data.taskOrderItem.equipId,
-          equipCode: result.data.taskOrderItem.equipCode,
+          equipId: equip.equipId,
+          equipCode: equip.equipCode,
         }))
         .filter((item: any) =>
           [
@@ -340,9 +342,10 @@ const fetchGetOnlineEquipmentDetail = async () => {
         )
         .filter((item: any) => canViewCheckItem(item, userInfo.value, equipment))
 
+      const equipResp: any = await equipRequestFunc(EquipFuncName.EquipDetail, equipType, { id: equip.equipId })
       const taskInfo = {
         ...result.data,
-        equipment: result.data.taskOrderItem,
+        equipment: equipResp.data,
         reportList: filteredReportList,
         otherReportList: reportDic.otherReportList,
         isMainChecker: isMain,

+ 27 - 26
src/pages/pendingApproval/list/PendingApprovalList.vue

@@ -22,12 +22,12 @@
 
     <!-- 列表 -->
     <scroll-view class="list-scroll" scroll-y @scrolltolower="loadMore">
-      <view v-for="item in listData" :key="item.reportId" class="item-box">
+      <view v-for="item in listData" :key="item.id" class="item-box">
         <Item
           :item="item"
-          :report-do-list="reportDOList(item)"
+          :reportDOList="item.reportDOList || []"
           :operate-text="'审核'"
-          @handle-operation="pushAction"
+          @handle-operation="handleOperation"
         />
       </view>
 
@@ -48,6 +48,7 @@ import QueryView from '@/pages/pendingVerification/components/query/QueryView.vu
 import Item from '@/pages/pendingVerification/list/Item.vue'
 import NavBar from '@/components/NavBar/NavBar.vue'
 import { requestFunc, TaskOrderFuncName } from '@/api/ApiRouter/taskOrder'
+import { PressureCheckerMyTaskStatus, PressureReportType } from '@/utils/dictMap'
 
 defineOptions({
   name: 'PendingApprovalList',
@@ -72,21 +73,6 @@ params.approveStrIds = userInfo.value?.id || ''
 
 const queryType = { value: '审核人', id: 'approveStrIds' }
 
-// 生成报告列表
-const reportDOList = (item: any) => {
-  return [
-    {
-      id: item.id,
-      reportId: item.reportId,
-      reportType: Number(item.reportType),
-      reportName: item.reportName,
-      image: item.image,
-      video: item.video,
-      attachment: item.attachment,
-    },
-  ]
-}
-
 // 获取列表数据
 const fetchList = async (refresh = false) => {
   if (loading.value) return
@@ -137,17 +123,32 @@ const queryAction = (exParams: Record<string, any>) => {
   refreshList()
 }
 
-// 跳转操作
-const pushAction = (item: any, reportDOList: any) => {
-  if (!item.reportId) {
+// 审核报告
+const handleOperation = (item: any, reportDOList: any) => {
+  if (!item.reportDOList?.length) {
     return uni.showToast({ title: '没有报告', icon: 'error' })
   }
-
-  const checkType = Number(item.checkType)
-  const reportType = Number(item.reportType)
-
+  const approvalReport = reportDOList
+    .filter(
+      (report) =>
+        report.taskStatus >= PressureCheckerMyTaskStatus.REPORT_AUDIT &&
+        report.taskStatus !== PressureCheckerMyTaskStatus.REPORT_CONFIRMATION &&
+        [PressureReportType.MAIN, PressureReportType.SUB, PressureReportType.SINGLE].includes(
+          report.reportType,
+        )
+    )
+    .map((report) => ({
+      id: report.id,
+      name: report.reportName,
+      reportTemplateId: report.reportTemplateId,
+      templateId: report.templateId,
+      reportType: report.reportType,
+    }))
+  if (approvalReport.length === 0) {
+    return uni.showToast({ title: '没有可审核的报告', icon: 'error' })
+  }
   uni.navigateTo({
-    url: `/pages/pendingApproval/preViewReport/index?id=${item.id}&orderId=${item.orderId}&checkType=${checkType}&reportType=${reportType}&reportDOList=${encodeURIComponent(JSON.stringify(reportDOList))}&equipCode=${item.equipCode}`,
+    url: `/pages/pendingApproval/preViewReport/index?id=${item.id}&orderId=${item.orderId}&reportDOList=${encodeURIComponent(JSON.stringify(approvalReport))}&equipCode=${item.equipCode}`,
   })
 }
 

+ 166 - 106
src/pages/pendingApproval/preViewReport/index.vue

@@ -11,100 +11,150 @@
 <template>
   <view class="preview-container">
     <!-- 导航栏 -->
-    <NavBar title="报告审核预览" />
-
-    <!-- 头部视图 -->
-    <HeadView
-      v-if="reportList.length > 0"
-      :report-list="reportList"
-      :select-report="selectReport"
-      @update:select-report="handleReportSelect"
-    />
+    <ReportNavBar>
+      <template #right>
+        <picker
+          class="report-picker"
+          @change="handleReportChange"
+          :value="selectedReportIndex"
+          :range="reportDOList"
+          range-key="name"
+        >
+          <view class="picker-content">
+            <text class="picker-text">{{ reportDOList[selectedReportIndex]?.name || '选择报告' }}</text>
+            <text class="picker-arrow">▼</text>
+          </view>
+        </picker>
+        <button class="nav-btn btn-grey">查看附件</button>
+        <button class="nav-btn btn-grey">查看档案</button>
+        <button class="nav-btn btn-orange">查看记录</button>
+        <button class="nav-btn btn-red">退回</button>
+        <button class="nav-btn btn-blue" @click="handleApprove">通过</button>
+      </template>
+    </ReportNavBar>
 
     <!-- PDF 预览区域 -->
-    <view class="pdf-container">
-      <text class="preview-tip">报告预览功能待完善</text>
-      <text class="preview-info">当前报告:{{ selectReport?.reportName || '-' }}</text>
-      <text class="preview-info">报告类型:{{ getReportTypeName(selectReport?.reportType) }}</text>
-      <text class="preview-info">检验性质:{{ getCheckTypeName(checkType) }}</text>
-    </view>
-
-    <!-- 操作按钮 -->
-    <view class="action-buttons">
-      <view class="button-row">
-        <button class="action-btn reject-btn" @click="handleReject">
-          <text class="action-btn-text">退回</text>
-        </button>
-        <button class="action-btn approve-btn" @click="handleApprove">
-          <text class="action-btn-text">通过审核</text>
-        </button>
-      </view>
-    </view>
+    <SpreadPDFViewer
+      ref="spreadPdfViewerRef"
+      :businessConfig="businessConfig"
+      :templateData="templateData"
+      :templateBlob="templateBlob"
+    />
   </view>
 </template>
 
 <script lang="ts" setup>
-import { ref, onMounted } from 'vue'
+import { ref, watch } from 'vue'
+import { onLoad } from '@dcloudio/uni-app'
 import { submitApi, rollbackApi } from '@/api/pendingApproval'
-import HeadView from '@/pages/pendingVerification/preViewReport/HeadView.vue'
-import NavBar from '@/components/NavBar/NavBar.vue'
+import ReportNavBar from '@/components/NavBar/ReportNavBar.vue'
+import SpreadPDFViewer from '@/components/SpreadDesigner/SpreadPDFViewer.vue'
+import { buildFileUrl } from '@/utils/index'
+import { getDynamicTbVal } from '@/api/task'
+import { getStandardTemplate } from '@/api/index'
 
 defineOptions({
   name: 'PendingApprovalPreview',
 })
 
-// 从路由参数获取数据
-const pages = getCurrentPages()
-const currentPage = pages[pages.length - 1] as any
-const options = currentPage.options || {}
-
-const id = ref(options.id || '')
-const orderId = ref(options.orderId || '')
-const checkType = ref(options.checkType || '')
-const reportType = ref(options.reportType || '')
+const id = ref('')
+const orderId = ref('')
+const equipCode = ref('')
 const reportDOList = ref<any[]>([])
-const equipCode = ref(options.equipCode || '')
 
-// 解析报告列表
-try {
-  if (options.reportDOList) {
-    reportDOList.value = JSON.parse(decodeURIComponent(options.reportDOList))
+const reportList = ref<any[]>([])
+
+const selectedReport = ref<any>(null)
+watch(selectedReport, (newVal) => {
+  if (newVal) {
+    previewReport(newVal)
   }
-} catch (error) {
-  console.error('解析报告列表失败:', error)
-}
+})
 
-const reportList = ref<any[]>(reportDOList.value)
-const selectReport = ref<any>(reportList.value?.[0] || null)
+onLoad((options) => {
+  id.value = options?.id || ''
+  orderId.value = options?.orderId || ''
+  equipCode.value = options?.equipCode || ''
+
+  try {
+    if (options?.reportDOList) {
+      reportDOList.value = JSON.parse(decodeURIComponent(options.reportDOList)) || []
+      console.log('报告列表:', reportDOList.value)
+    }
+  } catch (error) {
+    console.error('解析报告列表失败:', error)
+  }
+
+  reportList.value = reportDOList.value
+  selectedReport.value = reportList.value?.[0] || null
+})
+
+const spreadPdfViewerRef = ref<any>(null)
+const templateBlob = ref<any>(null)
+const businessConfig = ref<any>({
+  businessType: 'JLJH',
+  title: '记录审批',
+  disableNavigate: true,
+
+  ui: {
+    title: '记录审批',
+    saveButtonText: '保存',
+    cancelButtonText: '取消',
+    showAdditionalToolbar: true,
+    customButtons: [],
+  },
+})
+const templateData = ref<any>({})
+const selectedReportIndex = ref(0)
 
 // 处理报告选择
-const handleReportSelect = (report: any) => {
-  selectReport.value = report
-  console.log('选择报告:', report)
+const handleReportChange = (e) => {
+  const index = e.detail.value
+  selectedReportIndex.value = index
+  selectedReport.value = reportList.value?.[index] || null
 }
 
-// 获取报告类型名称
-const getReportTypeName = (reportType: string) => {
-  const typeMap: Record<string, string> = {
-    '100': '主报告',
-    '200': '附件报告',
+const previewReport = async (selectedReport: any) => {
+  if (!selectedReport) {
+    return uni.showToast({ title: '请选择报告', icon: 'error' })
   }
-  return typeMap[reportType] || reportType
-}
-
-// 获取检验性质名称
-const getCheckTypeName = (checkType: string) => {
-  const typeMap: Record<string, string> = {
-    '100': '定期检验',
-    '200': '年度检查',
-    '300': '超年限检验',
+  const refId = selectedReport.id
+  const reportTemplateId = selectedReport.reportTemplateId
+  const inputRecordTemplateId = selectedReport.templateId
+
+  const res = await getStandardTemplate({ id: reportTemplateId })
+  const resData = (res as any).data
+  const dataMap: any = {}
+  const dynamicTbResp = await getDynamicTbVal({
+    refId,
+  })
+  const dynamicTb: any = dynamicTbResp.data
+  for (let i = 0; i < dynamicTb.dynamicTbValRespVOList.length; i++) {
+    const item = dynamicTb.dynamicTbValRespVOList[i]
+    dataMap[item.colCode] = item.valValue
   }
-  return typeMap[checkType] || checkType
+  templateData.value = {
+    schema: resData.bindingPathSchema ? JSON.parse(resData.bindingPathSchema) : {},
+    data: {
+      ...dataMap,
+      reportTemplateId,
+      templateUrl: resData.fileUrl,
+    },
+    pathNameMapping: JSON.parse(resData.bindingPathNameJson),
+    template: reportTemplateId,
+    templateUrl: resData.fileUrl,
+  }
+
+  console.log(templateData.value)
+  const fileUri = resData.fileUrl
+  const fileUrl = buildFileUrl(fileUri)
+  const fileBase64 = await spreadPdfViewerRef.value.downloadFileAsBase64(fileUrl)
+  templateBlob.value = fileBase64
 }
 
 // 退回
 const handleReject = async () => {
-  if (!selectReport.value) {
+  if (!selectedReport.value) {
     return uni.showToast({ title: '请选择报告', icon: 'error' })
   }
 
@@ -117,7 +167,7 @@ const handleReject = async () => {
 
         try {
           const result: any = await rollbackApi({
-            id: selectReport.value.reportId,
+            id: selectedReport.value.id,
             reason: '审核退回',
           })
 
@@ -144,7 +194,7 @@ const handleReject = async () => {
 
 // 通过审核
 const handleApprove = async () => {
-  if (!selectReport.value) {
+  if (!selectedReport.value) {
     return uni.showToast({ title: '请选择报告', icon: 'error' })
   }
 
@@ -157,7 +207,7 @@ const handleApprove = async () => {
 
         try {
           const result: any = await submitApi({
-            id: selectReport.value.reportId,
+            id: selectedReport.value.id,
           })
 
           uni.hideLoading()
@@ -180,11 +230,6 @@ const handleApprove = async () => {
     },
   })
 }
-
-onMounted(() => {
-  console.log('报告列表:', reportList.value)
-  console.log('当前选择:', selectReport.value)
-})
 </script>
 
 <style lang="scss" scoped>
@@ -210,28 +255,56 @@ onMounted(() => {
   color: #333;
 }
 
-.pdf-container {
-  flex: 1;
+.report-picker {
   display: flex;
-  flex-direction: column;
-  justify-content: center;
   align-items: center;
-  padding: 20px;
-  background-color: #fff;
-  margin: 10px;
-  border-radius: 5px;
+  margin-right: 4px;
 }
 
-.preview-tip {
-  font-size: 18px;
-  color: #666;
-  margin-bottom: 20px;
+.picker-content {
+  display: flex;
+  align-items: center;
+  padding: 4px 8px;
+  background-color: #c3c2c2;
+  border-radius: 3px;
 }
 
-.preview-info {
-  font-size: 14px;
-  color: #999;
-  margin: 5px 0;
+.picker-text {
+  font-size: 12px;
+  color: #fff;
+  white-space: nowrap;
+}
+
+.picker-arrow {
+  margin-left: 4px;
+  font-size: 10px;
+  color: #fff;
+}
+
+.nav-btn {
+  padding: 4px 8px;
+  margin: 0 0 0 4px !important;
+  font-size: 12px;
+  line-height: 1.4;
+  color: #fff;
+  border: none;
+  border-radius: 3px;
+}
+
+.btn-grey {
+  background-color: #999;
+}
+
+.btn-orange {
+  background-color: #f5a623;
+}
+
+.btn-red {
+  background-color: #ff4d4f;
+}
+
+.btn-blue {
+  background-color: #2f8eff;
 }
 
 .action-buttons {
@@ -239,15 +312,7 @@ onMounted(() => {
   background-color: #fff;
 }
 
-.button-row {
-  display: flex;
-  flex-direction: row;
-  justify-content: space-between;
-  gap: 15px;
-}
-
 .action-btn {
-  flex: 1;
   height: 44px;
   border-radius: 5px;
   display: flex;
@@ -257,12 +322,7 @@ onMounted(() => {
   font-size: 16px;
 }
 
-.reject-btn {
-  background-color: #FF4445;
-  color: #fff;
-}
-
-.approve-btn {
+.submit-btn {
   background-color: #2f8eff;
   color: #fff;
 }

+ 37 - 24
src/pages/pendingRatify/list/PendingRatifyList.vue

@@ -25,9 +25,9 @@
       <view v-for="item in listData" :key="item.id" class="item-box">
         <Item
           :item="item"
-          :report-do-list="reportDOList(item)"
+          :reportDOList="item.reportDOList || []"
           :operate-text="'审批'"
-          @handle-operation="pushAction"
+          @handle-operation="handleOperation"
         />
       </view>
 
@@ -41,14 +41,14 @@
 </template>
 
 <script lang="ts" setup>
-import { ref, reactive, computed, onMounted } from 'vue'
+import { ref, reactive, computed, onMounted, onUnmounted } from 'vue'
 import { useUserStore } from '@/store/user'
 import { useConfigStore } from '@/store/config'
-import { getRatifyListApi } from '@/api/pendingRatify'
 import QueryView from '@/pages/pendingVerification/components/query/QueryView.vue'
 import Item from '@/pages/pendingVerification/list/Item.vue'
 import NavBar from '@/components/NavBar/NavBar.vue'
 import { requestFunc, TaskOrderFuncName } from '@/api/ApiRouter/taskOrder'
+import { PressureCheckerMyTaskStatus, PressureReportType } from '@/utils/dictMap'
 
 defineOptions({
   name: 'PendingRatifyList',
@@ -73,21 +73,6 @@ params.ratifyStrIds = userInfo.value?.id || ''
 
 const queryType = { value: '审批人', id: 'ratifyStrIds' }
 
-// 生成报告列表
-const reportDOList = (item: any) => {
-  return [
-    {
-      id: item.id,
-      reportId: item.reportId,
-      reportName: item.reportName,
-      reportType: Number(item.reportType),
-      image: item.image,
-      video: item.video,
-      attachment: item.attachment,
-    },
-  ]
-}
-
 // 获取列表数据
 const fetchList = async (refresh = false) => {
   if (loading.value) return
@@ -138,19 +123,47 @@ const queryAction = (exParams: Record<string, any>) => {
   refreshList()
 }
 
-// 跳转操作
-const pushAction = (item: any, reportDOList: any) => {
-  if (!item.reportId) {
+// 审批报告
+const handleOperation = (item: any, reportDOList: any) => {
+  if (!item.reportDOList?.length) {
     return uni.showToast({ title: '没有报告', icon: 'error' })
   }
-
+  const ratifyReport = reportDOList
+    .filter(
+      (report) =>
+        report.taskStatus >= PressureCheckerMyTaskStatus.REPORT_APPROVE &&
+        report.taskStatus !== PressureCheckerMyTaskStatus.REPORT_CONFIRMATION &&
+        [PressureReportType.MAIN, PressureReportType.SUB, PressureReportType.SINGLE].includes(
+          report.reportType,
+        )
+    )
+    .map((report) => ({
+      id: report.id,
+      name: report.reportName,
+      reportTemplateId: report.reportTemplateId,
+      templateId: report.templateId,
+      reportType: report.reportType,
+    }))
+  if (ratifyReport.length === 0) {
+    return uni.showToast({ title: '没有可审批的报告', icon: 'error' })
+  }
   uni.navigateTo({
-    url: `/pages/pendingRatify/preViewReport/index?id=${item.id}&orderId=${item.orderId}&reportDOList=${encodeURIComponent(JSON.stringify(reportDOList))}&equipCode=${item.equipCode}`,
+    url: `/pages/pendingRatify/preViewReport/index?id=${item.id}&orderId=${item.orderId}&reportDOList=${encodeURIComponent(JSON.stringify(ratifyReport))}&equipCode=${item.equipCode}`,
   })
 }
 
+// 监听刷新事件
+const refreshListener = () => {
+  refreshList()
+}
+
 onMounted(() => {
   refreshList()
+  uni.$on('RefreshRatifyListApi', refreshListener)
+})
+
+onUnmounted(() => {
+  uni.$off('RefreshRatifyListApi', refreshListener)
 })
 </script>
 

+ 169 - 94
src/pages/pendingRatify/preViewReport/index.vue

@@ -11,87 +11,150 @@
 <template>
   <view class="preview-container">
     <!-- 导航栏 -->
-    <NavBar title="报告审批预览" />
-
-    <!-- 头部视图 -->
-    <HeadView
-      v-if="reportList.length > 0"
-      :report-list="reportList"
-      :select-report="selectReport"
-      @update:select-report="handleReportSelect"
-    />
+    <ReportNavBar>
+      <template #right>
+        <picker
+          class="report-picker"
+          @change="handleReportChange"
+          :value="selectedReportIndex"
+          :range="reportDOList"
+          range-key="name"
+        >
+          <view class="picker-content">
+            <text class="picker-text">{{ reportDOList[selectedReportIndex]?.name || '选择报告' }}</text>
+            <text class="picker-arrow">▼</text>
+          </view>
+        </picker>
+        <button class="nav-btn btn-grey">查看附件</button>
+        <button class="nav-btn btn-grey">查看档案</button>
+        <button class="nav-btn btn-orange">查看记录</button>
+        <button class="nav-btn btn-red">退回</button>
+        <button class="nav-btn btn-blue" @click="handleApprove">通过</button>
+      </template>
+    </ReportNavBar>
 
     <!-- PDF 预览区域 -->
-    <view class="pdf-container">
-      <text class="preview-tip">报告预览功能待完善</text>
-      <text class="preview-info">当前报告:{{ selectReport?.reportName || '-' }}</text>
-      <text class="preview-info">报告类型:{{ getReportTypeName(selectReport?.reportType) }}</text>
-    </view>
-
-    <!-- 操作按钮 -->
-    <view class="action-buttons">
-      <view class="button-row">
-        <button class="action-btn reject-btn" @click="handleReject">
-          <text class="action-btn-text">退回</text>
-        </button>
-        <button class="action-btn approve-btn" @click="handleApprove">
-          <text class="action-btn-text">通过审批</text>
-        </button>
-      </view>
-    </view>
+    <SpreadPDFViewer
+      ref="spreadPdfViewerRef"
+      :businessConfig="businessConfig"
+      :templateData="templateData"
+      :templateBlob="templateBlob"
+    />
   </view>
 </template>
 
 <script lang="ts" setup>
-import { ref, onMounted } from 'vue'
+import { ref, watch } from 'vue'
+import { onLoad } from '@dcloudio/uni-app'
 import { finishApi, rollbackApi } from '@/api/pendingRatify'
-import HeadView from '@/pages/pendingVerification/preViewReport/HeadView.vue'
-import NavBar from '@/components/NavBar/NavBar.vue'
+import ReportNavBar from '@/components/NavBar/ReportNavBar.vue'
+import SpreadPDFViewer from '@/components/SpreadDesigner/SpreadPDFViewer.vue'
+import { buildFileUrl } from '@/utils/index'
+import { getDynamicTbVal } from '@/api/task'
+import { getStandardTemplate } from '@/api/index'
 
 defineOptions({
   name: 'PendingRatifyPreview',
 })
 
-// 从路由参数获取数据
-const pages = getCurrentPages()
-const currentPage = pages[pages.length - 1] as any
-const options = currentPage.options || {}
-
-const id = ref(options.id || '')
-const orderId = ref(options.orderId || '')
+const id = ref('')
+const orderId = ref('')
+const equipCode = ref('')
 const reportDOList = ref<any[]>([])
-const equipCode = ref(options.equipCode || '')
 
-// 解析报告列表
-try {
-  if (options.reportDOList) {
-    reportDOList.value = JSON.parse(decodeURIComponent(options.reportDOList))
+const reportList = ref<any[]>([])
+
+const selectedReport = ref<any>(null)
+watch(selectedReport, (newVal) => {
+  if (newVal) {
+    previewReport(newVal)
   }
-} catch (error) {
-  console.error('解析报告列表失败:', error)
-}
+})
 
-const reportList = ref<any[]>(reportDOList.value)
-const selectReport = ref<any>(reportList.value?.[0] || null)
+onLoad((options) => {
+  id.value = options?.id || ''
+  orderId.value = options?.orderId || ''
+  equipCode.value = options?.equipCode || ''
+
+  try {
+    if (options?.reportDOList) {
+      reportDOList.value = JSON.parse(decodeURIComponent(options.reportDOList)) || []
+      console.log('报告列表:', reportDOList.value)
+    }
+  } catch (error) {
+    console.error('解析报告列表失败:', error)
+  }
+
+  reportList.value = reportDOList.value
+  selectedReport.value = reportList.value?.[0] || null
+})
+
+const spreadPdfViewerRef = ref<any>(null)
+const templateBlob = ref<any>(null)
+const businessConfig = ref<any>({
+  businessType: 'JLJH',
+  title: '记录审批',
+  disableNavigate: true,
+
+  ui: {
+    title: '记录审批',
+    saveButtonText: '保存',
+    cancelButtonText: '取消',
+    showAdditionalToolbar: true,
+    customButtons: [],
+  },
+})
+const templateData = ref<any>({})
+const selectedReportIndex = ref(0)
 
 // 处理报告选择
-const handleReportSelect = (report: any) => {
-  selectReport.value = report
-  console.log('选择报告:', report)
+const handleReportChange = (e) => {
+  const index = e.detail.value
+  selectedReportIndex.value = index
+  selectedReport.value = reportList.value?.[index] || null
 }
 
-// 获取报告类型名称
-const getReportTypeName = (reportType: string) => {
-  const typeMap: Record<string, string> = {
-    '100': '主报告',
-    '200': '附件报告',
+const previewReport = async (selectedReport: any) => {
+  if (!selectedReport) {
+    return uni.showToast({ title: '请选择报告', icon: 'error' })
   }
-  return typeMap[reportType] || reportType
+  const refId = selectedReport.id
+  const reportTemplateId = selectedReport.reportTemplateId
+  const inputRecordTemplateId = selectedReport.templateId
+
+  const res = await getStandardTemplate({ id: reportTemplateId })
+  const resData = (res as any).data
+  const dataMap: any = {}
+  const dynamicTbResp = await getDynamicTbVal({
+    refId,
+  })
+  const dynamicTb: any = dynamicTbResp.data
+  for (let i = 0; i < dynamicTb.dynamicTbValRespVOList.length; i++) {
+    const item = dynamicTb.dynamicTbValRespVOList[i]
+    dataMap[item.colCode] = item.valValue
+  }
+  templateData.value = {
+    schema: resData.bindingPathSchema ? JSON.parse(resData.bindingPathSchema) : {},
+    data: {
+      ...dataMap,
+      reportTemplateId,
+      templateUrl: resData.fileUrl,
+    },
+    pathNameMapping: JSON.parse(resData.bindingPathNameJson),
+    template: reportTemplateId,
+    templateUrl: resData.fileUrl,
+  }
+
+  console.log(templateData.value)
+  const fileUri = resData.fileUrl
+  const fileUrl = buildFileUrl(fileUri)
+  const fileBase64 = await spreadPdfViewerRef.value.downloadFileAsBase64(fileUrl)
+  templateBlob.value = fileBase64
 }
 
 // 退回
 const handleReject = async () => {
-  if (!selectReport.value) {
+  if (!selectedReport.value) {
     return uni.showToast({ title: '请选择报告', icon: 'error' })
   }
 
@@ -104,7 +167,7 @@ const handleReject = async () => {
 
         try {
           const result: any = await rollbackApi({
-            id: selectReport.value.reportId,
+            id: selectedReport.value.id,
             reason: '审批退回',
           })
 
@@ -112,6 +175,7 @@ const handleReject = async () => {
 
           if (result?.code === 0) {
             uni.showToast({ title: '退回成功', icon: 'success' })
+            uni.$emit('RefreshRatifyListApi')
             setTimeout(() => {
               uni.navigateBack()
             }, 1000)
@@ -130,7 +194,7 @@ const handleReject = async () => {
 
 // 通过审批
 const handleApprove = async () => {
-  if (!selectReport.value) {
+  if (!selectedReport.value) {
     return uni.showToast({ title: '请选择报告', icon: 'error' })
   }
 
@@ -143,13 +207,14 @@ const handleApprove = async () => {
 
         try {
           const result: any = await finishApi({
-            id: selectReport.value.reportId,
+            id: selectedReport.value.id,
           })
 
           uni.hideLoading()
 
           if (result?.code === 0) {
             uni.showToast({ title: '审批通过', icon: 'success' })
+            uni.$emit('RefreshRatifyListApi')
             setTimeout(() => {
               uni.navigateBack()
             }, 1000)
@@ -165,11 +230,6 @@ const handleApprove = async () => {
     },
   })
 }
-
-onMounted(() => {
-  console.log('报告列表:', reportList.value)
-  console.log('当前选择:', selectReport.value)
-})
 </script>
 
 <style lang="scss" scoped>
@@ -195,28 +255,56 @@ onMounted(() => {
   color: #333;
 }
 
-.pdf-container {
-  flex: 1;
+.report-picker {
   display: flex;
-  flex-direction: column;
-  justify-content: center;
   align-items: center;
-  padding: 20px;
-  background-color: #fff;
-  margin: 10px;
-  border-radius: 5px;
+  margin-right: 4px;
 }
 
-.preview-tip {
-  font-size: 18px;
-  color: #666;
-  margin-bottom: 20px;
+.picker-content {
+  display: flex;
+  align-items: center;
+  padding: 4px 8px;
+  background-color: #c3c2c2;
+  border-radius: 3px;
 }
 
-.preview-info {
-  font-size: 14px;
-  color: #999;
-  margin: 5px 0;
+.picker-text {
+  font-size: 12px;
+  color: #fff;
+  white-space: nowrap;
+}
+
+.picker-arrow {
+  margin-left: 4px;
+  font-size: 10px;
+  color: #fff;
+}
+
+.nav-btn {
+  padding: 4px 8px;
+  margin: 0 0 0 4px !important;
+  font-size: 12px;
+  line-height: 1.4;
+  color: #fff;
+  border: none;
+  border-radius: 3px;
+}
+
+.btn-grey {
+  background-color: #999;
+}
+
+.btn-orange {
+  background-color: #f5a623;
+}
+
+.btn-red {
+  background-color: #ff4d4f;
+}
+
+.btn-blue {
+  background-color: #2f8eff;
 }
 
 .action-buttons {
@@ -224,15 +312,7 @@ onMounted(() => {
   background-color: #fff;
 }
 
-.button-row {
-  display: flex;
-  flex-direction: row;
-  justify-content: space-between;
-  gap: 15px;
-}
-
 .action-btn {
-  flex: 1;
   height: 44px;
   border-radius: 5px;
   display: flex;
@@ -242,12 +322,7 @@ onMounted(() => {
   font-size: 16px;
 }
 
-.reject-btn {
-  background-color: #FF4445;
-  color: #fff;
-}
-
-.approve-btn {
+.submit-btn {
   background-color: #2f8eff;
   color: #fff;
 }

+ 21 - 11
src/pages/securityCheck/securityCheckEditor.vue

@@ -25,12 +25,18 @@
 import { ref } from 'vue'
 import SpreadDesignerGeneric from '@/components/SpreadDesigner/spreadDesignerGeneric.vue'
 import { onLoad } from '@dcloudio/uni-app'
-
-import { getStandardTemplate } from '@/api/index'
 import { buildFileUrl } from '@/utils/index'
-import { createSecurityCheck } from '@/api/boiler/boilerTaskOrderSecurityCheck'
+import { useConfigStore } from '@/store/config'
+import {
+  SecurityCheckFuncName,
+  requestFunc as securityCheckRequestFunc,
+} from '@/api/ApiRouter/taskOrderSecurityCheck'
+import { getStandardTemplate } from '@/api/index'
 import { getDynamicTbVal, saveDynamicTbVal } from '@/api/task'
 
+const configStore = useConfigStore()
+const equipType = configStore.getEquipType()
+
 const businessConfig = ref({
   businessType: 'AQJC',
   title: '安全检查记录编辑',
@@ -61,14 +67,18 @@ const init = async () => {
   if (!templateId) {
     return
   }
-  const createResp = await createSecurityCheck({
-    businessType: 300,
-    conclusion: '',
-    date: null,
-    name: '进入现场(设备)前安全检查记录',
-    orderId,
-    templateId,
-  })
+  const createResp = await securityCheckRequestFunc(
+    SecurityCheckFuncName.createSecurityCheckItem,
+    equipType,
+    {
+      businessType: 300,
+      conclusion: '',
+      date: null,
+      name: '进入现场(设备)前安全检查记录',
+      orderId,
+      templateId,
+    },
+  )
   const refId = createResp.data
 
   const res = await getStandardTemplate({ id: templateId })

+ 94 - 87
src/pages/sign/index.vue

@@ -152,23 +152,21 @@
 <script lang="ts" setup>
 import { ref, computed, onMounted, nextTick } from 'vue'
 import { onLoad } from '@dcloudio/uni-app'
-import {
-  getGcConfig,
-  getTaskOrderImg,
-  signConfirm,
-  pushTaskOrder,
-  createSafetyCheckRecord,
-  uploadSignImage,
-} from '@/api/sign'
+import SignatureCanvas from '@/components/Signature/SignatureCanvas.vue'
+import SpreadPDFViewer from '@/components/SpreadDesigner/SpreadPDFViewer.vue'
+import NavBar from '@/components/NavBar/NavBar.vue'
+
+import { useUserStore } from '@/store/user'
+import { useConfigStore } from '@/store/config'
+
+import { getGcConfig, getTaskOrderImg, pushTaskOrder, uploadSignImage } from '@/api/sign'
 import { getDynamicTbVal } from '@/api/task'
 import { getStandardTemplate } from '@/api/index'
 import { getTaskOrderReport } from '@/api/orderReport'
 import { buildFileUrl } from '@/utils/index'
-import { useUserStore } from '@/store/user'
-import SignatureCanvas from '@/components/Signature/SignatureCanvas.vue'
-import SpreadPDFViewer from '@/components/SpreadDesigner/SpreadPDFViewer.vue'
-import NavBar from '@/components/NavBar/NavBar.vue'
+import { SignFuncName, requestFunc } from '@/api/ApiRouter/sign'
 
+const equipType = useConfigStore().getEquipType()
 const title = ref('')
 const routeType = ref<'FWD' | 'JYRS' | 'AQJC' | 'ZXXX'>()
 const orderId = ref('')
@@ -276,71 +274,71 @@ onLoad((options) => {
 })
 
 // 获取任务单配置
-const getTaskOrderGcConfig = async () => {
-  try {
-    const result: any = await getGcConfig(
-      {
-        orderId: orderId.value,
-        businessType: routeType.value ? businessTypeMap[routeType.value] : '',
-        orderItemId: orderItemId.value || undefined,
-        templateId: templateId.value || undefined,
-      },
-      userInfo.value,
-    )
-
-    const res = result?.data
-    gcConfig.value = res
-
-    if (res) {
-      fetchTaskOrderImg(res)
-    } else {
-      uni.showToast({ title: '获取配置信息失败', icon: 'error' })
-    }
-  } catch (error) {
-    console.error('获取配置失败:', error)
-    uni.showToast({ title: '获取配置失败', icon: 'error' })
-  }
-}
+// const getTaskOrderGcConfig = async () => {
+//   try {
+//     const result: any = await getGcConfig(
+//       {
+//         orderId: orderId.value,
+//         businessType: routeType.value ? businessTypeMap[routeType.value] : '',
+//         orderItemId: orderItemId.value || undefined,
+//         templateId: templateId.value || undefined,
+//       },
+//       userInfo.value,
+//     )
+
+//     const res = result?.data
+//     gcConfig.value = res
+
+//     if (res) {
+//       fetchTaskOrderImg(res)
+//     } else {
+//       uni.showToast({ title: '获取配置信息失败', icon: 'error' })
+//     }
+//   } catch (error) {
+//     console.error('获取配置失败:', error)
+//     uni.showToast({ title: '获取配置失败', icon: 'error' })
+//   }
+// }
 
 // 获取任务单图片
-const fetchTaskOrderImg = async (res: any) => {
-  const { dataStr, templateUrl, templateId, fileVersionId } = res
-
-  if (!orderId.value) return
-
-  if (orderId.value && dataStr && templateUrl) {
-    const params: any = {
-      dataStr,
-      templateUrl,
-      orderId: orderId.value,
-      businessType: routeType.value ? businessTypeMap[routeType.value] : '',
-      fileType: 100,
-      orderItemId: orderItemId.value || undefined,
-      templateId,
-    }
-
-    if (routeType.value === 'ZXXX' && fileVersionId) {
-      params.fileVersionId = fileVersionId
-    }
-
-    try {
-      const result: any = await getTaskOrderImg(params)
-      if (result) {
-        pdfImg.value = result
-        uni.getImageInfo({
-          src: result,
-          success: (imageInfo) => {
-            const screenWidth = uni.getSystemInfoSync().windowWidth - 32
-            pdfWidth.value = screenWidth
-            pdfHeight.value = (screenWidth * imageInfo.height) / imageInfo.width
-          },
-        })
-      }
-    } catch (error) {
-      console.error('获取图片失败:', error)
-    }
-  }
-}
+// const fetchTaskOrderImg = async (res: any) => {
+//   const { dataStr, templateUrl, templateId, fileVersionId } = res
+
+//   if (!orderId.value) return
+
+//   if (orderId.value && dataStr && templateUrl) {
+//     const params: any = {
+//       dataStr,
+//       templateUrl,
+//       orderId: orderId.value,
+//       businessType: routeType.value ? businessTypeMap[routeType.value] : '',
+//       fileType: 100,
+//       orderItemId: orderItemId.value || undefined,
+//       templateId,
+//     }
+
+//     if (routeType.value === 'ZXXX' && fileVersionId) {
+//       params.fileVersionId = fileVersionId
+//     }
+
+//     try {
+//       const result: any = await getTaskOrderImg(params)
+//       if (result) {
+//         pdfImg.value = result
+//         uni.getImageInfo({
+//           src: result,
+//           success: (imageInfo) => {
+//             const screenWidth = uni.getSystemInfoSync().windowWidth - 32
+//             pdfWidth.value = screenWidth
+//             pdfHeight.value = (screenWidth * imageInfo.height) / imageInfo.width
+//           },
+//         })
+//       }
+//     } catch (error) {
+//       console.error('获取图片失败:', error)
+//     }
+//   }
+// }
 
 const getPreviewData = async () => {
   // orderId --> templateId + refId --> templateBlob 和 templateData
@@ -366,12 +364,14 @@ const getPreviewData = async () => {
       templateId = orderReport?.templateId
       refId = orderReport?.acceptOrderId
       break
+    case 'JYRS':
+      uni.showToast({ title: '检验结果告知报表暂未开发', icon: 'error' })
+      break
     default:
       uni.showToast({ title: '请选择正确的签字文件类型', icon: 'error' })
       break
   }
-  
-  
+
   // 获取templateSchema
   const res = await getStandardTemplate({ id: templateId })
   const resData = (res as any).data
@@ -577,9 +577,9 @@ const signSubmit = () => {
       return
     }
     showFwdPopup.value = true
-  } else {
-    submitConfirm()
+    return
   }
+  submitConfirm()
 }
 
 // 确认提交
@@ -588,26 +588,33 @@ const submitConfirm = async () => {
     const params: any = {
       id: orderId.value,
       signUrl: uploadedSignUrl.value || signImg.value,
+      // signTime: ,
       businessType: routeType.value ? businessTypeMap[routeType.value] : '',
-      orderItemId: orderItemId.value || undefined,
+      // orderItemId: orderItemId.value || undefined,
+      // securityCheckId: ,
     }
 
     if (routeType.value === 'FWD') {
       params.receiverPhone = fwdInputPhone.value
     }
 
-    const result: any = await signConfirm(params)
+    // if(true) {
+    //   console.log('params........', params)
+    //   return
+    // }
+
+    const result: any = await requestFunc(SignFuncName.SubmitSign, equipType, params)
 
     if (result?.code === 0) {
       uni.showToast({
         title: routeType.value === 'ZXXX' ? '已自动提交审核' : '签名成功',
         icon: 'success',
       })
-      setTimeout(() => {
-        uni.redirectTo({
-          url: `/pages/orderDetail/detail?orderId=${orderId.value}&type=${routeType.value}`,
-        })
-      }, 1500)
+      // setTimeout(() => {
+      //   uni.redirectTo({
+      //     url: `/pages/orderDetail/detail?orderId=${orderId.value}&type=${routeType.value}`,
+      //   })
+      // }, 1500)
     } else {
       uni.showToast({ title: result?.msg || '签名失败', icon: 'error' })
     }
@@ -697,7 +704,7 @@ const handlePushOrderSubmit = () => {
       if (res?.code === 0) {
         uni.showToast({ title: '推送成功', icon: 'success' })
         showInputPopup.value = false
-        getTaskOrderGcConfig()
+        // getTaskOrderGcConfig()
       } else {
         uni.showToast({ title: res?.msg || '推送失败', icon: 'none' })
       }

+ 29 - 90
src/pages/unClaim/unClaimList.vue

@@ -102,12 +102,6 @@
 
 <script lang="ts" setup>
 import { ref, reactive, onMounted, onUnmounted } from 'vue'
-import { getOrderDetail, updateTaskOrder } from '@/api/task'
-import { getSecurityCheckTemplate } from '@/api/boiler/boilerTaskOrderSecurityCheck'
-import * as signApis from '@/api/sign'
-import { createBusinessConfig } from '@/pages/webview/common/config/businessEditorConfig'
-import { setSpreadsheetEditParams } from '@/common/global'
-import { useUserStore } from '@/store/user'
 import iconMap from '@/utils/imagesMap'
 import dayjs from 'dayjs'
 import QueryView from './components/query/QueryView.vue'
@@ -115,8 +109,11 @@ import TaskItem from './components/TaskItem.vue'
 import UpdateContactPopup from './components/UpdateContactPopup.vue'
 import TipsPopup from '@/components/popup/components/TipsPopup.vue'
 import { useConfigStore } from '@/store/config'
-import { EquipmentType } from '@/utils/dictMap'
 import { TaskOrderFuncName, requestFunc } from '@/api/ApiRouter/taskOrder'
+import {
+  SecurityCheckFuncName,
+  requestFunc as securityCheckRequestFunc,
+} from '@/api/ApiRouter/taskOrderSecurityCheck'
 import NavBar from '@/components/NavBar/NavBar.vue'
 
 defineOptions({
@@ -150,7 +147,6 @@ const currentOrderInfo = ref<any>({})
 const showTipsPopup = ref(false)
 const tipsPopupData = ref<any>({})
 
-const userStore = useUserStore()
 const configStore = useConfigStore()
 const equipType = configStore.getEquipType()
 
@@ -257,8 +253,9 @@ const handleClaimTask = async (id: string, isClaim: boolean) => {
   }
 }
 
+const businessTypeMap: Record<string, number> = { FWD: 100, JYRS: 200 }
 // 按钮点击(服务单/受理单/检验结果告知)
-const handleBtnTap = async (type: 'FWD' | 'JYRS', item: any) => {
+const handleBtnTap = async (type: 'FWD' | 'JYRS', taskOrder: any) => {
   // 检查网络状态
   const networkType = uni.getNetworkType()
   if (networkType === 'none') {
@@ -266,106 +263,48 @@ const handleBtnTap = async (type: 'FWD' | 'JYRS', item: any) => {
   }
 
   try {
-    const res = await getOrderDetail({ id: item.id })
-    if (res?.data) {
-      const signFileRespVOList = res.data.signFileRespVOList || []
-      const businessTypeMap: Record<string, number> = { FWD: 100, JYRS: 200 }
-      const targetBusinessType = businessTypeMap[type]
-      const currentBusinessType =
-        signFileRespVOList.find((row: any) => row.businessType === targetBusinessType) || {}
-
-      const isSigned = currentBusinessType.isSignature === '1'
-      const url = isSigned ? '/pages/sign-detail/index' : '/pages/sign/index'
-      const { unitContact, unitPhone, receiverEmail } = item
+    const res = await requestFunc(TaskOrderFuncName.TaskOrderDetail, equipType, {
+      id: taskOrder.id,
+    })
+    if (!res?.data) {
+      uni.showToast({ title: res?.msg || '获取详情失败', icon: 'error' })
+      return
+    }
+    const signFileRespVOList = res.data.signFileRespVOList || []
+    const targetBusinessType = businessTypeMap[type]
+    const currentBusinessType =
+      signFileRespVOList.find((row: any) => row.businessType === targetBusinessType) || {}
+    const { unitContact, unitPhone, receiverEmail } = taskOrder
 
+    if (currentBusinessType.isSignature === '1') {
       uni.navigateTo({
-        url: `${url}?orderId=${item.id}&type=${type}&unitContact=${unitContact || ''}&unitPhone=${unitPhone || ''}&receiverEmail=${receiverEmail || ''}`,
+        url: `/pages/sign-detail/index?orderId=${taskOrder.id}&type=${type}&unitContact=${unitContact || ''}&unitPhone=${unitPhone || ''}&receiverEmail=${receiverEmail || ''}`,
       })
-    } else {
-      uni.showToast({ title: res?.msg || '获取详情失败', icon: 'error' })
+      return
     }
+    uni.navigateTo({
+      url: `/pages/sign/index?orderId=${taskOrder.id}&type=${type}&unitContact=${unitContact || ''}&unitPhone=${unitPhone || ''}&receiverEmail=${receiverEmail || ''}`,
+    })
   } catch (error) {
     console.error('获取详情失败:', error)
   }
 }
 
 // 安全检查记录
-const handleSafetyCheck = async (item: any) => {
+const handleSafetyCheck = async (taskOrder: any) => {
   // 检查网络状态
   const networkType = uni.getNetworkType()
   if (networkType === 'none') {
     return uni.showToast({ title: '无网络连接,请联网重试', icon: 'error' })
   }
 
-  const { unitContact, unitPhone, receiverEmail } = item
-
-  // 获取用户信息 - 修复:直接从 store 获取最新状态
-  const userStore = useUserStore()
-  // 优先使用 userInfo,如果为空则尝试调用 getUserInfo 方法
-  let userInfo = userStore.userInfo
-  if (!userInfo && typeof userStore.getUserInfo === 'function') {
-    userInfo = userStore.getUserInfo()
-  }
-
-  // 如果没有用户信息,提示登录
-  if (!userInfo || !userInfo.id) {
-    console.warn('用户未登录,userInfo:', userInfo)
-    uni.showModal({
-      title: '提示',
-      content: '请先登录',
-      success: (res) => {
-        if (res.confirm) {
-          uni.navigateTo({
-            url: '/pages/login/login',
-          })
-        }
-      },
-    })
-    return
-  }
-
   try {
-    console.log('用户信息:', userInfo)
-    // 获取葡萄城配置信息
-    // const configRes = await signApis.getGcConfig(
-    //   {
-    //     orderId: item.id,
-    //     businessType: 300, // AQJC 对应的业务类型
-    //     new: true,
-    //   },
-    //   {
-    //     id: userInfo.id || userInfo.userid,
-    //     nickname: userInfo.nickname || userInfo.realname,
-    //     mobile: userInfo.mobile || userInfo.phone,
-    //   },
-    // )
-
-    // console.log('获取葡萄城配置信息:', JSON.stringify(configRes))
-
-    // 创建业务配置
-    const businessConfig = createBusinessConfig('AQJC')
-
-    // 设置全局编辑参数
-    const editParams = {
-      routeType: 'AQJC',
-      orderId: item.id,
-      gcConfig: {
-        unitContact: unitContact || '',
-        unitPhone: unitPhone || '',
-        receiverEmail: receiverEmail || '',
-      },
-      businessConfig,
-    }
-
-    // 使用统一的 global 工具函数设置
-    setSpreadsheetEditParams(editParams)
-
-    console.log('设置全局编辑参数:', editParams)
-
-    const res = await getSecurityCheckTemplate({ orderId: item.id })
+    const res = await securityCheckRequestFunc(SecurityCheckFuncName.getTemplate, equipType, {
+      orderId: taskOrder.id,
+    })
     // 跳转到 WebView 编辑器
     uni.navigateTo({
-      url: `/pages/securityCheck/securityCheckEditor?businessType=AQJC&orderId=${item.id}&templateId=${res.data.templateId}&useOnline=1`,
+      url: `/pages/securityCheck/securityCheckEditor?businessType=AQJC&orderId=${taskOrder.id}&templateId=${res.data.templateId}&useOnline=1`,
     })
   } catch (configError) {
     console.error('获取葡萄城配置信息失败:', configError)