瀏覽代碼

主管任务照片批量上传

zhujindu 5 月之前
父節點
當前提交
96d946d952
共有 2 個文件被更改,包括 32 次插入8 次删除
  1. 31 8
      src/components/uploadVTask.vue
  2. 1 0
      src/views/week/VisitSummaryAdd.vue

+ 31 - 8
src/components/uploadVTask.vue

@@ -56,6 +56,10 @@ export default {
       type: Boolean,
       default: false,
     },
+    item: {
+      type: Object,
+      default: {},
+    },
   },
   data() {
     return {
@@ -193,17 +197,36 @@ export default {
       }
       addPhotov(form).then((res) => {
         if (res.code == 200) {
-          that.imgArr = res.data.url;
+          // that.imgArr = res.data.url;
           loind1.clear();
           that.$toast('上传成功!');
-          that.$emit('newimgarr', {
-            fileUrl: res.data.url,
-            id: res.data.fileId,
-            fileType: res.fileType,
-            fileName: res.fileName,
-            type: that.type,
-            index: that.indexImg,
+          let urlArr = [];
+          let idArr = [];
+          res.data.forEach((val) => {
+            urlArr.push({
+              fileUrl: val.url,
+              id: val.fileId,
+              fileType: val.fileType,
+              fileName: val.fileName,
+              type: that.type,
+              index: that.indexImg,
+            });
+            idArr.push(val.id);
           });
+          if (this.item.fileInfoList == null || this.item.fileInfoList == undefined) {
+            this.item.fileInfoList = [];
+            this.item.fileIdList = [];
+          }
+          this.item.fileInfoList.concat(urlArr);
+          this.item.fileIdList.concat(idArr);
+          // that.$emit('newimgarr', {
+          //   fileUrl: res.data.url,
+          //   id: res.data.fileId,
+          //   fileType: res.fileType,
+          //   fileName: res.fileName,
+          //   type: that.type,
+          //   index: that.indexImg,
+          // });
         } else {
           that.$toast('上传失败!');
         }

+ 1 - 0
src/views/week/VisitSummaryAdd.vue

@@ -66,6 +66,7 @@
                 :indexImg="index"
                 :customId="item.customId"
                 :summaryId="item.summaryId"
+                :item="item"
                 @click="imgClick(item, index)"></upload-img>
             </van-row>
           </div>