cz hai 1 ano
pai
achega
0cbb58ade1
Modificáronse 1 ficheiros con 7 adicións e 18 borrados
  1. 7 18
      src/components/process/ServiceContract.vue

+ 7 - 18
src/components/process/ServiceContract.vue

@@ -80,12 +80,12 @@
       <template #file>
         <div style="width: 100%">
           <el-upload
-            v-model="formData.data.fileList"
+            v-model:fileList="formData.data.fileList"
             action="https://winfaster.obs.cn-south-1.myhuaweicloud.com"
             :data="uploadData"
             multiple
             :before-upload="uploadFile"
-            :on-success="handleSuccess2"
+            :on-success="handleSuccess"
             :on-preview="onPreviewFile"
           >
             <el-button>选择</el-button>
@@ -1074,27 +1074,16 @@ const uploadFile = async (file) => {
   return true;
 };
 
-const handleSuccess2 = (any, UploadFile) => {
-  console.log(any, UploadFile);
-  console.log(formData.data);
-  formData.data.fileList.push({
-    id: UploadFile.raw.id,
-    fileName: UploadFile.raw.fileName,
-    fileUrl: UploadFile.raw.fileUrl,
-    uploadState: UploadFile.raw.uploadState,
-  });
-};
-
 const handleSuccess = (any, UploadFile) => {
   UploadFile.raw.uploadState = false;
 };
 
-const onPreviewFile2 = (file) => {
-  window.open(file.fileUrl, "_blank");
-};
-
 const onPreviewFile = (file) => {
-  window.open(file.raw.fileUrl, "_blank");
+  if (file.fileUrl) {
+    window.open(file.fileUrl, "_blank");
+  } else {
+    window.open(file.raw.fileUrl, "_blank");
+  }
 };
 const submitHandoverForm = () => {
   formData.data.serviceContractProductList[productIndex.value].remark =