Bläddra i källkod

检验方案添加附件能拼接预览

xy 6 dagar sedan
förälder
incheckning
1dceb56106

+ 5 - 0
yudao-ui-admin-vue3/src/api/pressure2/boilertaskorder/index.ts

@@ -914,4 +914,9 @@ export const BoilerTaskOrderApi = {
     return await request.post({ url: '/pressure2/boiler-task-order/order-item/major-issues/recovery', data })
   },
 
+  // 关联检验方案文件
+  releaseManualReport: async (data: any) => {
+    return await request.put({ url: '/pressure2/boiler-task-order-report/update', data })
+  },
+
 }

+ 6 - 1
yudao-ui-admin-vue3/src/api/pressure2/pipetaskorder/index.ts

@@ -848,5 +848,10 @@ export const PipeTaskOrderApi = {
   /** 校验检验方案是否已完成审核审批 */
   checkSchemeStatus: async (orderId: string) => {
     return await request.get({ url: '/pressure2/pipe-task-order/inspection-opinion/check-scheme-status', params: { orderId } })
-  }
+  },
+
+  // 关联检验方案文件
+  releaseManualReport: async (data: any) => {
+    return await request.put({ url: '/pressure2/pipe-task-order-item-report/update', data })
+  },
 }

+ 21 - 2
yudao-ui-admin-vue3/src/views/pressure2/boilertaskorder/components/AddInspectionplanDetail.vue

@@ -37,7 +37,7 @@
             action="#"
             v-model:file-list="fileList"
             :http-request="handlePostFile"
-            :auto-upload="false"
+            :auto-upload="true"
             :disabled="isEdit === 'view'"
             :limit="1"
             :on-change="handleChange"
@@ -232,6 +232,7 @@ const uploadRef = ref()
 const fileList = ref<UploadFile[]>([]) // 文件列表
 const accept = '.doc,.docx,.pdf'
 const fileLoading = ref(false) // 表单的加载中
+const isSubmit = ref(false) // 是否提交审核(区分仅上传关联 vs 上传后提交审核)
 
 // 获取文件类型
 const getFileExtension = (fileName: string) => {
@@ -293,7 +294,11 @@ const handlePostFile = async (options: UploadRequestOptions) => {
       }
     ]
     onSuccess(manualUrl)
-    handleSubmitOperationReport(manualUrl)
+    if (isSubmit.value) {
+      handleSubmitOperationReport(manualUrl)
+    } else {
+      relaseReport(manualUrl)
+    }
   } catch (error: any) {
     onError(error)
     ElMessage.error('上传失败,请您重新上传!')
@@ -301,6 +306,19 @@ const handlePostFile = async (options: UploadRequestOptions) => {
     fileLoading.value = false
   }
 }
+// 关联文件到任务单(仅关联不提交审核)
+const relaseReport = (manualUrl: string) => {
+  const { reportId, templateId } = props.editInspectionplanParams
+  const params = {
+    id: reportId,
+    manualUrl,
+    templateId
+  }
+  BoilerTaskOrderApi.releaseManualReport(params).then(() => {
+    ElMessage.success('关联文件成功')
+    editData.value.manualUrl = manualUrl
+  })
+}
 // 提交审核
 const handleSubmitOperationReport = async (manualUrl = '') => {
   // 弹窗选择审批人
@@ -357,6 +375,7 @@ const handleSubmitBefore = async () => {
   // console.log(props.editInspectionplanParams, 'props.editInspectionplanParams')
   // if (props.isEdit === 'add' && !fileList.value.length) return ElMessage.error('请先上传方案文件')
   if (!fileList.value.length) return ElMessage.error('请先上传方案文件')
+  isSubmit.value = true
   getSchemeReviewerList()
 }
 

+ 22 - 3
yudao-ui-admin-vue3/src/views/pressure2/pipetaskorder/components/AddInspectionplanDetail.vue

@@ -37,7 +37,7 @@
             action="#"
             v-model:file-list="fileList"
             :http-request="handlePostFile"
-            :auto-upload="false"
+            :auto-upload="true"
             :disabled="isEdit === 'view'"
             :limit="1"
             :on-change="handleChange"
@@ -223,6 +223,7 @@ const uploadRef = ref()
 const fileList = ref<UploadFile[]>([]) // 文件列表
 const accept = '.doc,.docx,.pdf'
 const fileLoading = ref(false) // 表单的加载中
+const isSubmit = ref(false) // 是否提交审核(区分仅上传关联 vs 上传后提交审核)
 
 const showFileUrl = computed(() => {
   return fileList.value.length > 0
@@ -291,7 +292,12 @@ const handlePostFile = async (options: UploadRequestOptions) => {
       }
     ]
     onSuccess(manualUrl)
-    handleSubmitOperationReport(manualUrl)
+
+    if (isSubmit.value) {
+      handleSubmitOperationReport(manualUrl)
+    } else {
+      relaseReport(manualUrl)
+    }
   } catch (error: any) {
     onError(error)
     ElMessage.error('上传失败,请您重新上传!')
@@ -299,7 +305,19 @@ const handlePostFile = async (options: UploadRequestOptions) => {
     fileLoading.value = false
   }
 }
-
+// 关联文件到任务单(仅关联不提交审核)
+const relaseReport = (manualUrl: string) => {
+  const { reportId, templateId } = props.editInspectionplanParams
+  const params = {
+    id: reportId,
+    manualUrl,
+    templateId
+  }
+  PipeTaskOrderApi.releaseManualReport(params).then(() => {
+    ElMessage.success('关联文件成功')
+    editData.value.manualUrl = manualUrl
+  })
+}
 // 提交审核
 const handleSubmitOperationReport = async (manualUrl = '') => {
   // 弹窗选择审批人
@@ -358,6 +376,7 @@ const handleSubmitBefore = async () => {
   // console.log(props.editInspectionplanParams, 'props.editInspectionplanParams')
   // if (props.isEdit === 'add' && !fileList.value.length) return ElMessage.error('请先上传方案文件')
   if (!fileList.value.length) return ElMessage.error('请先上传方案文件')
+  isSubmit.value = true
   getSchemeReviewerList()
 }