shaun-sheep 5 年 前
コミット
0e594e990b

+ 9 - 17
src/components/business_space/lib/uploadFiles.vue

@@ -22,7 +22,7 @@
             type="primary"
             v-if="!readOnly"
         >点击上传</el-button>
-        <span v-if="!isShow">
+        <span v-if="isShow !== 1 || isShow == undefined">
           <div
             slot="tip"
             class="el-upload__tip"
@@ -71,7 +71,7 @@
         default: 6
       },
       isShow: {
-        type: Boolean
+        type: Number
       },
       contextKey: {
         type: [String, Object]
@@ -179,21 +179,13 @@
                   }
                   vm.filesArr.push(fileObject);
 
-                  // if(this.isShow) {
-                  //   let oFile = {}
-                  //   oFile[vm.contextKey] = vm.filesArr
-                  //   debugger
-                  //   vm.$emit("change", oFile, vm.defined);
-                  //   debugger
-                  // } else {
-                  //   vm.$emit("change", vm.filesArr, vm.defined);
-                  //
-                  // }
-                  let oFile = {};
-                  oFile[vm.contextKey] = vm.filesArr;
-
-                  console.log('oFile-',oFile)
-                  vm.$emit("change", oFile, vm.defined);
+                  if(vm.isShow === 1) {
+                    let oFile = {}
+                    oFile[vm.contextKey] = vm.filesArr
+                    vm.$emit("change", oFile, vm.defined);
+                  } else {
+                    vm.$emit("change", vm.filesArr, vm.defined);
+                  }
                 } else {
                   this.$message.error(res.data.ResultMsg)
                 }

+ 76 - 53
src/components/business_space/lib/uploadImgsName.vue

@@ -47,63 +47,78 @@
   </div>
 </template>
 <script>
-import tools from "@/utils/scan/tools";
-import formInput from "@/components/business_space/lib/formInput"
-import detailsDialog from "@/components/business_space/lib/detailsDia"
+  import tools from "@/utils/scan/tools";
+  import formInput from "@/components/business_space/lib/formInput"
+  import detailsDialog from "@/components/business_space/lib/detailsDia"
 
-export default {
-  components: {
-    formInput,
-    detailsDialog
-  },
-  props: {
-    keysArr: {
-      type: [Array, String]
-    },
-    readOnly: {
-      type: Boolean,
-      default: false
-    },
-    max: {
-      type: [Number, String],
-      default: 6
+  export default {
+    components: {
+      formInput,
+      detailsDialog
     },
-    accept: {
-      type: String,
-      default: "image/*"
+    props: {
+      keysArr: {
+        type: [Array, String]
+      },
+      readOnly: {
+        type: Boolean,
+        default: false
+      },
+      max: {
+        type: [Number, String],
+        default: 6
+      },
+      accept: {
+        type: String,
+        default: "image/*"
+      },
+      type: {
+        type: String,
+        default: "image"
+      },
+      contextKey: {
+        type: [String, Object]
+      },
+      isShow: {
+        type: [Number, String]
+      },
+      defined: null,
+      videoPicArr: {
+        type: Array,
+        default: function () {
+          return []
+        }
+      }
     },
-    type: {
-      type: String,
-      default: "image"
+    data() {
+      return {
+        baseUrl: "",
+        imageGetUrl: "/image-service/common/image_get?systemId=dataPlatform",
+        imageUploadUrl: "/image-service/common/image_upload?systemId=dataPlatform&secret=9e0891a7a8c8e885&overwrite=true",
+        imagesArr: [],
+        iframeSrc: "",
+        dialog: {
+          details: false
+        }
+      };
     },
-    defined: null,
-    videoPicArr: {
-      type: Array,
-      default: function () {
-        return []
-      }
-    }
-  },
-  data() {
-    return {
-      baseUrl: "",
-      imageGetUrl: "/image-service/common/image_get?systemId=dataPlatform",
-      imageUploadUrl: "/image-service/common/image_upload?systemId=dataPlatform&secret=9e0891a7a8c8e885&overwrite=true",
-      imagesArr: [],
-      iframeSrc: "",
-      dialog: {
-        details: false
-      }
-    };
-  },
-  created() {
-    this.imageFalg();
-  },
-  methods: {
-    getName(name, index) {
-      this.imagesArr[index].Name = name
-      this.$emit("change", this.imagesArr, this.defined, this.videoPicArr);
+    created() {
+      this.imageFalg();
     },
+    methods: {
+      getName(name, index) {
+
+        this.imagesArr[index].Name = name
+        if (this.isShow === 1) {
+          let oFile = {}
+          oFile[this.contextKey] = this.imagesArr
+          this.$emit("change", oFile, this.defined, this.videoPicArr);
+
+        } else {
+          this.$emit("change", this.imagesArr, this.defined, this.videoPicArr);
+
+        }
+      },
     //判断是否为空
     imageFalg() {
       let type = typeof this.keysArr;
@@ -220,7 +235,15 @@ export default {
                     CreateTime
                   })
                 }
-                vm.$emit("change", vm.imagesArr, vm.defined, vm.videoPicArr);
+                if (vm.isShow === 1) {
+                  let oFile = {}
+                  oFile[vm.contextKey] = vm.imagesArr
+                  vm.$emit("change", oFile, vm.defined, vm.videoPicArr);
+                  console.log('oFile-',oFile)
+                } else {
+                  vm.$emit("change", vm.imagesArr, vm.defined, vm.videoPicArr);
+
+                }
               }
             }
           };

+ 30 - 23
src/components/ready/buildfloor/addBuild.vue

@@ -66,27 +66,28 @@
             value-format="yyyy-MM-dd"
             type="date" v-else-if="item.InputMode == 'C5'" v-model="form[item.Path]">
           </el-date-picker>
-          <el-upload
+
+          <uploadImgs
+            :readOnly="false"
             v-else-if="item.InputMode == 'F2'&& item.Path === 'BuildingInfo.BuildingType.Pic'"
             v-model="form[item.Path]"
-            action="https://jsonplaceholder.typicode.com/posts/"
-            list-type="picture-card"
-          >
-
-         <i class="el-icon-plus"></i>
-        </el-upload>
+            :keysArr="Array.isArray(buildData[item.Path]) ? buildData[item.Path]:[]"
+            :context-key="item.Path"
+            :isShow="1"
+            @change="changeItem"
+          />
 
-           <upload-files
-             v-model="form[item.Path]"
-             v-else-if="item.InputMode == 'F2'"
-             :readOnly="false"
-             :isShow="true"
-             :keys-arr="(Array.isArray(item.Path) && item.Path.length)? item.Path:[]"
-             :show-file-list="false"
-             :context-key="item.Path"
-             @change="changeItem"
-             max="2"
-           />
+             <upload-files
+               v-model="form[item.Path]"
+               v-else-if="item.InputMode == 'F2'"
+               :readOnly="false"
+               :isShow="1"
+               :keys-arr="Array.isArray(buildData[item.Path]) ? buildData[item.Path]:[] "
+               :show-file-list="false"
+               :context-key="item.Path"
+               @change="changeItem"
+             />
+          <!--          <span v-else-if="item.InputMode == 'F2'">{{buildData[item.Path]}}</span>-->
           <el-input disabled title="暂不支持" v-else v-model="form[item.Path]"></el-input>
         </el-form-item>
       </span>
@@ -107,6 +108,7 @@
 </template>
 <script>
   import uploadFiles from "@/components/business_space/lib/uploadFiles";
+  import uploadImgs from "@/components/business_space/lib/uploadImgsName";
 
   function flattenKeys(obj) {
     let res = {}
@@ -135,7 +137,6 @@
     data() {
       return {
         buildName: '',
-        // keysArr: [{Name: 'food.jpeg', Key: 'https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100'}, {Name: 'food2.jpeg', Key: 'https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100'}],
         keysArr: [], //保存临时的文件key
         buildDialogVis: false,
         form: {},
@@ -153,7 +154,7 @@
         buildData: {},
       }
     },
-    components: {uploadFiles},
+    components: {uploadFiles, uploadImgs},
     props: ['buildTitle', 'buildMessage', 'currentBuild'],
     computed: {},
     mounted() {
@@ -161,10 +162,14 @@
 
     },
     methods: {
-
+      deepCopy(obj) {
+        return JSON.parse(JSON.stringify(obj))
+      },
       showDialog(data) {
+        //获取信息
         this.buildData = data || {};
         this.buildData = flattenKeys(this.buildData)
+        // this.keysArr = this.buildData[]
         this.timeoutSetVal()
         this.buildDialogVis = true
       },
@@ -191,10 +196,12 @@
         });
       },
       changeItem(val) {
-        let _key = Object.keys(val)[0]+'';
+        console.log(val)
+        let _key = Object.keys(val)[0] + '';
         this.form[_key] = val[_key];
 
-      }
+      },
+
     }
   }
 </script>

+ 1 - 6
src/views/ready/buildfloor/index.vue

@@ -206,7 +206,6 @@
         // this.$message.warning("开发中...");
         // return;
         this.buildTitle = '添加建筑';
-
         this.$refs.addBuildDialog.showDialog();
         this.handleSearchBuildKey()
       },
@@ -257,8 +256,7 @@
       delBuild() {
         // this.$message.warning("开发中...");
         // return;
-        // this.delText = "建筑";
-        // this.delDialogVis = true;
+
         let param = [{BuildId: this.curBuildId}];
         objectDeleteBuild(param, res => {
           setTimeout(() => {
@@ -273,7 +271,6 @@
       editBuild() {
         this.buildTitle = '编辑建筑';
         this.handleSearchBuildKey()
-
         let list = this.currentBuildList.filter(i => i.BuildID === this.curBuildId)
         let obj = {}
         for (let i = 0; i < list.length; i++) {
@@ -286,9 +283,7 @@
       },
       // handleBuild 获取建筑信息
       handleBuild(val) {
-
         let newform = tools.formatData(val)
-
         let Param = {
           Content: [newform]
         }