浏览代码

任务管理

ZaiZai 1 年之前
父节点
当前提交
41fe13cc52

+ 8 - 0
src/api/modules/tasks/hc-data.js

@@ -65,4 +65,12 @@ export default {
             data: form,
         }, false)
     },
+    //附件文件上传
+    async taskUploadFile(form) {
+        return HcApi({
+            url: '/api/blade-meter/task/data/uploadFile',
+            method: 'post',
+            data: form,
+        }, false)
+    },
 }

+ 38 - 15
src/views/tasks/components/hc-data/middlepay-form.vue

@@ -53,8 +53,8 @@
                     </el-col>
                     <el-col :span="16">
                         <el-form-item label="草图文件:">
-                            <div class="form-item-div">暂无文件</div>
-                            <!-- hc-form-upload :src="baseForm.pictureUrl" @upload="formUpload" @change="formUploadChange" / -->
+                            <hc-form-upload v-if="baseForm.pictureUrl" :src="baseForm.pictureUrl" />
+                            <div v-else class="form-item-div">暂无文件</div>
                         </el-form-item>
                     </el-col>
                     <el-col :span="24">
@@ -115,7 +115,7 @@
         <!-- 添加分解清单 -->
         <HcBillBase v-model="addBillBaseShow" :info="taskInfo" :table="tableInfo" :ids="billBaseIds" :contract-id="contractId" @finish="finishChange" />
         <!-- 文件上传组件 -->
-        <hc-upload-file ref="uploadFileRef" :echo-params="uploadFileParams" :options="uploadFileOptions" @success="uploadFileSuccess" />
+        <hc-upload-file ref="uploadFileRef" :options="uploadFileOptions" @success="uploadFileSuccess" />
     </div>
 </template>
 
@@ -324,23 +324,46 @@ const finishChange = () => {
 
 }
 
-
-const uploadFormProps = ref({})
+//文件上传
+const uploadFileRef = ref(null)
+const uploadFileOptions = ref({
+    headers: getHeader(),
+    multiple: false,
+})
+const uploadFormProps = {
+    url: 'fileUrl',
+    name: 'fileName',
+}
 
 const attachmentUpload = () => {
-
+    uploadFileRef.value?.selectFile()
 }
-
-const attachmentUploadChange = () => {
-
+const attachmentUploadChange = (a, b, fileList) => {
+    baseForm.value.fileList = getArrValue(fileList)
 }
 
-//文件上传
-const uploadFileRef = ref(null)
-const uploadFileParams = ref({})
-const uploadFileOptions = ref({})
-const uploadFileSuccess = () => {
-
+// 文件上传成功的回调
+const uploadFileSuccess = async ({ resData }) => {
+    baseForm.value.fileList.push({
+        contractId: contractId.value,
+        fileName: resData.originalName ?? '',
+        filePdfUrl: resData.pdfUrl ?? '',
+        fileUrl: resData.link ?? '',
+    })
+    uploadFileRef.value?.setModalShow(false)
+    //发起请求
+    const dataId = tableInfo.value.id
+    const { error, code, msg } = await mainApi.taskUploadFile({
+        projectId: projectId.value,
+        contractId: contractId.value,
+        fileList: baseForm.value.fileList,
+        dataId,
+    })
+    if (!error && code === 200) {
+        window.$message.success('上传成功')
+    } else {
+        window.$message.error(msg ?? '上传失败')
+    }
 }
 </script>
 

+ 0 - 2
src/views/tasks/components/hc-data/task-review.vue

@@ -156,7 +156,6 @@ const getTableDetail = async () => {
     const { taskProcessInfo, taskCenterDataInfo } = getObjValue(data)
     tableData.value = getArrValue(taskCenterDataInfo)
     flowList.value = getArrValue(taskProcessInfo)
-
     //默认选中第一行
     let info = {}
     if (tableData.value.length > 0) {
@@ -166,7 +165,6 @@ const getTableDetail = async () => {
         tableInfo.value = info
         tableRef.value?.tableRef?.setCurrentRow(info)
     })
-
     //关闭加载状态
     isLoading.value = false
     rejectionLoading.value = false