浏览代码

更新 船舶图片上传

王智慧 3 年之前
父节点
当前提交
4f616b7691
共有 2 个文件被更改,包括 21 次插入11 次删除
  1. 9 11
      src/components/ShipInfo.vue
  2. 12 0
      src/components/Uploader.vue

+ 9 - 11
src/components/ShipInfo.vue

@@ -164,7 +164,7 @@
         style="background: #fff"
         class="pt20"
       >
-        <div v-if="index == 4" class="container-title fs18 pt10 pb10">
+        <div v-if="item.type == 5" class="container-title fs18 pt10 pb10">
           船舶保险
         </div>
         <div class="df aic pl40 pb20">
@@ -277,18 +277,16 @@ async function removeSuccess({ file, fileIndex }, index) {
         message: "删除成功!",
         type: "success",
       });
+      props.shipInfos[currentIndex.value].shipCerts[index].certs.splice(
+        fileIndex,
+        1
+      );
     }
   } else {
-    let dataList = [];
-    for (let i of list) {
-      dataList.push({
-        fileKey: i.response.result.key,
-        downloadUrl: i.response.result.downloadUrl,
-        viewUrl: i.response.result.viewUrl,
-        url: i.response.result.viewUrl,
-      });
-    }
-    props.shipInfos[currentIndex.value].shipCerts[index].certs = dataList;
+    props.shipInfos[currentIndex.value].shipCerts[index].certs.splice(
+      fileIndex,
+      1
+    );
   }
 }
 

+ 12 - 0
src/components/Uploader.vue

@@ -63,7 +63,10 @@
       :show-file-list="false"
       :data="params"
       :on-success="uploadSuccess"
+      :on-change="onChange"
       :disabled="disabled"
+      :before-upload="beforeUpload"
+      v-loading="isLoading"
     >
       <div :class="['upload-plus-icon']">+</div>
       <div :class="['upload-text']">{{ uploadText }}</div>
@@ -124,6 +127,15 @@ function remove(file, fileIndex) {
 function uploadSuccess(response, file, list) {
   emit("onUploadFileList", { response, file, list });
 }
+
+function onChange() {
+  isLoading.value = false;
+}
+let isLoading = ref(false);
+function beforeUpload() {
+  isLoading.value = true;
+  return true;
+}
 function previewPdf(url) {
   window.open(url);
 }