瀏覽代碼

打款bug

cz 1 年之前
父節點
當前提交
e3be3fa06d
共有 1 個文件被更改,包括 59 次插入23 次删除
  1. 59 23
      src/views/finance/fundManage/accountPayment/index.vue

+ 59 - 23
src/views/finance/fundManage/accountPayment/index.vue

@@ -827,6 +827,8 @@ const submitForm = () => {
 
 const getDtl = (row) => {
   proxy.post("/accountPayment/detail", { id: row.id }).then((res) => {
+    formData.data.fileList = [];
+    fileList.value = [];
     formData.data = res;
     if (submitType.value === "add") {
       formData.data.expensesTime = moment().format("yyyy-MM-DD HH:mm:ss");
@@ -837,22 +839,40 @@ const getDtl = (row) => {
     } else {
       formData.data.expensesTime = formData.data.updateTime;
     }
-    proxy
-      .post("/fileInfo/getList", { businessIdList: [row.id] })
-      .then((fileObj) => {
-        formData.data.fileList = fileObj[row.id] || [];
-        if (formData.data.fileList && formData.data.fileList.length > 0) {
-          fileList.value = formData.data.fileList.map((item) => {
-            return {
-              raw: item,
-              name: item.fileName,
-              url: item.fileUrl,
-            };
-          });
-        } else {
-          fileList.value = [];
-        }
-      });
+    if (submitType.value !== "add") {
+      let ids = [];
+      if (
+        res.accountPaymentRecordsList &&
+        res.accountPaymentRecordsList.length > 0
+      ) {
+        ids = res.accountPaymentRecordsList.map((x) => x.id);
+      }
+      proxy
+        .post("/fileInfo/getList", { businessIdList: [row.id, ...ids] })
+        .then((fileObj) => {
+          if (fileObj) {
+            let arr = [];
+            for (const key in fileObj) {
+              if (fileObj[key]) {
+                arr = [...arr, ...fileObj[key]];
+              }
+            }
+            formData.data.fileList = arr;
+            if (formData.data.fileList && formData.data.fileList.length > 0) {
+              fileList.value = formData.data.fileList.map((item) => {
+                return {
+                  raw: item,
+                  name: item.fileName,
+                  url: item.fileUrl,
+                };
+              });
+            } else {
+              fileList.value = [];
+            }
+          }
+        });
+    }
+
     dialogVisible.value = true;
   });
 };
@@ -1063,6 +1083,28 @@ const handleOpenFile = (row) => {
     fileList: [],
     fileListOne: [],
   };
+  proxy.post("/accountPayment/detail", { id: row.id }).then((res) => {
+    let ids = [];
+    if (
+      res.accountPaymentRecordsList &&
+      res.accountPaymentRecordsList.length > 0
+    ) {
+      ids = res.accountPaymentRecordsList.map((x) => x.id);
+    }
+    proxy
+      .post("/fileInfo/getList", { businessIdList: [row.id, ...ids] })
+      .then((fileObj) => {
+        if (fileObj) {
+          let arr = [];
+          for (const key in fileObj) {
+            if (fileObj[key]) {
+              arr = [...arr, ...fileObj[key]];
+            }
+          }
+          fileData.data.fileListOne = arr;
+        }
+      });
+  });
   proxy
     .post("/fileInfo/getList", { businessIdList: [row.businessId] })
     .then((fileObj) => {
@@ -1070,13 +1112,7 @@ const handleOpenFile = (row) => {
         fileData.data.fileList = fileObj[row.businessId];
       }
     });
-  proxy
-    .post("/fileInfo/getList", { businessIdList: [row.id] })
-    .then((fileObj) => {
-      if (fileObj[row.id] && fileObj[row.id].length > 0) {
-        fileData.data.fileListOne = fileObj[row.id];
-      }
-    });
+
   openFileDialog.value = true;
 };
 const openFile = (item) => {