Browse Source

暂存,切换分支改bug

shaun-sheep 5 years ago
parent
commit
d760787a0d

+ 7 - 4
src/components/ready/buildfloor/addBuild.vue

@@ -41,7 +41,7 @@
             type="date" v-else-if="item.InputMode == 'C5'" v-model="form[item.Path]">
           </el-date-picker>
           <el-input disabled title="暂不支持" v-else v-model="form[item.Path]"></el-input>
-          <!--          {{item.InputMode}}-->
+                    {{item.InputMode}}
         </el-form-item>
       </span>
       </template>
@@ -119,13 +119,16 @@
         this.buildDialogVis = true
       },
       timeoutSetVal() {
+        let that = this
         setTimeout(() => {
-          if (this.form) {
-            this.form = this.floorData
+          if (that.form) {
+
+            that.form = that.floorData
+
           } else {
             this.timeoutSetVal()
           }
-        }, 500)
+        })
       },
       closeDialog() {
         this.buildDialogVis = false

+ 23 - 5
src/utils/buildfloor/tools.js

@@ -2,7 +2,7 @@ const tools = {}
 
 /**
  * @param arr [a,b,c]
- * 
+ *
  * val value
  */
 function returnNewObj(data, arr, val) {
@@ -50,9 +50,9 @@ tools.formatData = (data) => {
 
 /**
  * @param data {a:{b:{c:{}}}}
- * 
+ *
  * @returns a.b.c
- * 
+ *
  */
 tools.desFormatData = (data) => {
   let newData = {}
@@ -68,5 +68,23 @@ tools.desFormatData = (data) => {
   }
   return newData
 }
-
-export default tools
+//
+// tools.test = (data) => {
+//   let newData = {}
+//   for (let key in data) {
+//     let test = key
+//     var arr = test.split(".");
+//     var i = arr.length;
+//     var ret = (function merge(val){
+//       if (i--) {
+//         var obj = {};
+//         obj[arr[i]] = val;
+//         val = obj;
+//         return merge(val);
+//       } else return val;
+//     })("test");
+//     console.log(ret);
+//     debugger
+//   }
+// }
+export default tools

+ 21 - 10
src/views/ready/buildfloor/index.vue

@@ -165,7 +165,6 @@
         // currentType: 'add'
         buildMessage: {},
         visible: false,
-        currentBuild: {},//当前建筑
       };
     },
     computed: {
@@ -175,6 +174,7 @@
     },
     created() {
       this.init();
+      this.handleBuildQuery()
     },
     methods: {
       init() {
@@ -198,7 +198,6 @@
         });
         this.buildList[index].active = true;
         this.curBuildId = this.buildList[index].BuildID;
-        this.currentBuild = this.buildList[index]
         this.getFloorTableData();
         this.$forceUpdate();
       },
@@ -207,6 +206,11 @@
         // this.$message.warning("开发中...");
         // return;
         this.buildTitle = '添加建筑';
+
+        this.$refs.addBuildDialog.showDialog();
+        this.handleSearchBuildKey()
+      },
+      handleSearchBuildKey() {
         let params = {
           projectId: this.projectId,
           data: {
@@ -248,7 +252,6 @@
           this.buildMessage = first
 
         })
-        this.$refs.addBuildDialog.showDialog();
       },
       //delete build ,根据id删除建筑信息
       delBuild() {
@@ -268,18 +271,24 @@
       },
       //edit build
       editBuild() {
-        // this.currentType = 'edit';
         this.buildTitle = '编辑建筑';
-        this.$refs.addBuildDialog.showDialog(this.currentBuild);
+        this.handleSearchBuildKey()
+
+        let list = this.currentBuildList.filter(i => i.BuildID === this.curBuildId)
+        let obj = {}
+        for (let i = 0; i < list.length; i++) {
+          obj = list[i]
+        }
+        this.$refs.addBuildDialog.showDialog(obj);
+
       },
       // handleBuild 获取建筑信息
       handleBuild(val) {
         let newform = tools.formatData(val)
-        newform.BuildID = this.curBuildId || ''
         let Param = {
           Content: [newform]
         }
-        if (newform.curBuildId) {
+        if (newform.BuildID) {
           objectUpdateBuild(Param, res => {
             this.$message.success('更新成功')
             this.$refs.addBuildDialog.closeDialog()
@@ -366,11 +375,13 @@
       },
       //  查询建筑信息
       handleBuildQuery() {
-        let floorParam = {
-          projectId: this.projectId
+        let param = {
+          projectId: this.projectId,
+          Orders: "BuildLocalName asc"
         };
-        objectQueryBuild(floorParam, res => {
+        objectQueryBuild(param, res => {
 
+          this.currentBuildList = res.Content
         });
       },