Browse Source

feat:修改材料提交任务

DESKTOP-USV654P\pc 4 months ago
parent
commit
b5d04ba391
1 changed files with 35 additions and 35 deletions
  1. 35 35
      src/views/materialManager/taskTodoList/components/viewModal.vue

+ 35 - 35
src/views/materialManager/taskTodoList/components/viewModal.vue

@@ -7,7 +7,7 @@
     postMaterialtaskDownloadFileExportQuery,
     getMaterialtaskInfo,
   } from '/@/services/apis/MaterialTaskController';
-  import { nextTick, ref, reactive } from 'vue';
+  import { nextTick, ref } from 'vue';
   import { Radio } from 'ant-design-vue';
   import { useTable, BasicTable, TableAction } from '/@/components/Table';
   import auditModal from './auditModal.vue';
@@ -22,15 +22,12 @@
   import { getFileList } from '/@/api/system/file';
   import FormTemplate from '/@/views/form/preview/index.vue';
   import { formatToDateTime } from '/@/utils/dateUtil';
-  import { useLoading } from '/@/components/Loading';
   const RadioGroup = Radio.Group;
   const RadioButton = Radio.Button;
   const emit = defineEmits(['success', 'register']);
   const taskDataInfo = ref();
-  const state = reactive({
-    downloadLoading: false,
-  });
-  const [register, {}] = useModalInner(async (data) => {
+
+  const [register, { setModalProps }] = useModalInner(async (data) => {
     taskDataInfo.value = await getMaterialtaskInfo({ id: data.id });
     taskDataInfo.value.isUpdate = data.isUpdate;
     await nextTick(() => {
@@ -74,15 +71,21 @@
   };
   const selectRowKeys = ref([]);
   const handleCurrentView = async (record) => {
-    const fileList = await getFileList({ folderId: record.folderId });
-    await Promise.all(
-      fileList.map((item) => {
-        downloadByUrl({
-          url: item.fileUrl,
-          fileName: item.fileName + item.fileType,
-        });
-      }),
-    );
+    try {
+      setModalProps({ loading: true });
+
+      const fileList = await getFileList({ folderId: record.folderId });
+      await Promise.all(
+        fileList.map((item) => {
+          downloadByUrl({
+            url: item.fileUrl,
+            fileName: item.fileName + item.fileType,
+          });
+        }),
+      );
+    } finally {
+      setModalProps({ loading: false });
+    }
   };
   const handleAudit = () => {
     openModal(true, { ids: selectRowKeys.value, taskDataInfo: taskDataInfo.value });
@@ -92,10 +95,6 @@
     reload();
   };
 
-  const [openFullLoading, closeFullLoading] = useLoading({
-    tip: '处理中...',
-  });
-
   const handleClose = () => {
     status.value = 1;
     emit('success');
@@ -134,25 +133,29 @@
     openFormTemplage(true, {
       id: taskDataInfo.value.formReleaseId,
       isView: item ? true : false,
-      formReleaseId: item?.formDataId,
+      formReleaseId: item?.folderId, //.formDataId,
     });
   };
 
   const handelExport = async () => {
-    const postData = {
-      materialTaskId: taskDataInfo.value.id,
-      state: status.value,
-      limit: 1,
-      size: 10,
-    };
-    const data = await postMaterialtaskExportQuery(postData);
-    downloadByData(data.data, `材料列表${formatToDateTime(new Date(), 'YYYYMMDDHHmmss')}.xlsx`);
+    try {
+      setModalProps({ loading: true });
+      const postData = {
+        materialTaskId: taskDataInfo.value.id,
+        state: status.value,
+        limit: 1,
+        size: 10,
+      };
+      const data = await postMaterialtaskExportQuery(postData);
+      downloadByData(data.data, `材料列表${formatToDateTime(new Date(), 'YYYYMMDDHHmmss')}.xlsx`);
+    } finally {
+      setModalProps({ loading: false });
+    }
   };
 
   const handelDownload = async () => {
     try {
-      openFullLoading();
-      state.downloadLoading = true;
+      setModalProps({ loading: true });
       const postData = {
         materialTaskId: taskDataInfo.value.id,
         state: status.value,
@@ -163,8 +166,7 @@
         `${taskDataInfo.value.name}${formatToDateTime(new Date(), 'YYYYMMDDHHmmss')}.zip`,
       );
     } finally {
-      closeFullLoading();
-      state.downloadLoading = false;
+      setModalProps({ loading: false });
     }
   };
 </script>
@@ -258,9 +260,7 @@
             >
               审核
             </a-button>
-            <a-button type="primary" @click="handelDownload" :loading="state.downloadLoading">
-              下载
-            </a-button>
+            <a-button type="primary" @click="handelDownload"> 下载 </a-button>
             <a-button type="primary" @click="handelExport">导出</a-button>
           </template>
           <template #action="{ record }">