Преглед на файлове

Merge branch 'zdsz3.0' of http://192.168.10.18:3000/sunwei/zdsz_vue into zdsz3.0

付宇航 преди 1 година
родител
ревизия
47315452f2
променени са 2 файла, в които са добавени 46 реда и са изтрити 25 реда
  1. 44 23
      src/components/ObsImageUpload/indexFile.vue
  2. 2 2
      src/views/zdsz/engineeringDangerous/index.vue

+ 44 - 23
src/components/ObsImageUpload/indexFile.vue

@@ -66,6 +66,10 @@ export default {
       type: Array,
       default: () => ['dwg', 'dwt', 'doc', 'docx', 'xls', 'xlsx', 'png', 'jpg', 'jpeg','mp4'],
     },
+    fileList: {
+      type: Array,
+      default: () => [],
+    },
     // 是否显示提示
     isShowTip: {
       type: Boolean,
@@ -83,36 +87,53 @@ export default {
       headers: {
         Authorization: "Bearer " + getToken(),
       },
-      fileList: []
+      // fileList: []
     };
   },
-  watch: {
-    // value: {
-    //   handler(val) {
-    //     if (val) {
-    //       // 首先将值转为数组
-    //       const list = Array.isArray(val) ? val : this.value.split(',');
-    //       // 然后将数组转为对象数组
-    //       this.fileList = list.map(item => {
-    //         if (typeof item === "object") {
-    //           item = {name: item.fileName, url: item.picUrl};
-    //         }
-    //         return item;
-    //       });
-    //     } else {
-    //       this.fileList = [];
-    //       return [];
-    //     }
-    //   },
-    //   deep: true,
-    //   immediate: true
-    // }
-  },
+  // watch: {
+  //   value: {
+  //     handler(val) {
+  //       if (val) {
+  //         // 首先将值转为数组
+  //         const list = Array.isArray(val) ? val : this.value.split(',');
+  //         // 然后将数组转为对象数组
+  //         this.fileList = list.map(item => {
+  //           if (typeof item === "object") {
+  //             item = {name: item.fileName, url: item.picUrl};
+  //           }
+  //           return item;
+  //         });
+  //       } else {
+  //         this.fileList = [];
+  //         return [];
+  //       }
+  //     },
+  //     deep: true,
+  //     immediate: true
+  //   }
+  // },
   computed: {
     // 是否显示提示
     showTip() {
       return this.isShowTip && (this.fileType || this.fileSize);
     },
+      fileList() {
+      console.log('qqqqqqqqqqqq')
+        const val = this.value;
+        if (val) {
+          // 首先将值转为数组
+          const list = Array.isArray(val) ? val : val.split(',');
+          // 然后将数组转为对象数组
+          return list.map(item => {
+            if (typeof item == "object") {
+              item = { name: item.fileName, url: item.picUrl };
+            }
+            return item;
+          });
+        } else {
+          return [];
+        }
+      }
   },
   methods: {
     handlePreview(file) {

+ 2 - 2
src/views/zdsz/engineeringDangerous/index.vue

@@ -594,14 +594,13 @@ export default {
     submitForm() {
       this.$refs["form"].validate(valid => {
         if (valid) {
-          this.buttonLoading = true;
           if (this.form.id != null) {
             this.form.files = this.$refs.obsFileUpload.fileList;
             if (this.form.files.length === 0) {
               this.$message.warning('必须上传附件!')
               return
             }
-
+            this.buttonLoading = true;
             updateEngineeringDangerous(this.form).then(response => {
               this.$modal.msgSuccess("修改成功");
               this.open = false;
@@ -615,6 +614,7 @@ export default {
               this.$message.warning('必须上传附件!')
               return
             }
+            this.buttonLoading = true;
             addEngineeringDangerous(this.form).then(response => {
               this.$modal.msgSuccess("新增成功");
               this.open = false;