Pārlūkot izejas kodu

修改发票上传

hurx 2 nedēļas atpakaļ
vecāks
revīzija
28a702ef9c
1 mainītis faili ar 12 papildinājumiem un 11 dzēšanām
  1. 12 11
      src/views/bill/statementInvoice/addInvoiceDialog.vue

+ 12 - 11
src/views/bill/statementInvoice/addInvoiceDialog.vue

@@ -173,20 +173,21 @@ const beforeUpload = (file: any) => {
 };
 
 /** 上传成功回调 */
-const handleUploadSuccess = (response: any, uploadFile: any) => {
+function handleUploadSuccess(response: any, file: any, fileListParam: any[]) {
   if (response.code === 200) {
-    uploadFile.url = response.data.url;
-    nextTick(() => {
-      form.value.invoiceAnnex = fileList.value
-        .map((f) => f.url)
-        .filter(Boolean)
-        .join(',');
-    });
-    proxy?.$modal.msgSuccess('上传成功');
+    // 更新 fileList
+    fileList.value = fileListParam;
+    // 收集所有已上传成功的文件URL
+    const urls = fileListParam
+      .filter((f: any) => f.response?.code === 200 || f.url)
+      .map((f: any) => f.response?.data?.url || f.url)
+      .filter(Boolean);
+    form.value.invoiceAnnex = urls.join(',');
+    proxy?.$modal.msgSuccess('文件上传成功');
   } else {
-    proxy?.$modal.msgError(response.msg || '上传失败');
+    proxy?.$modal.msgError(response.msg || '文件上传失败');
   }
-};
+}
 
 /** 删除文件 */
 const handleRemoveUploadFile = (uploadFile: any) => {