Browse Source

修改bug6662

haojianlong 4 years ago
parent
commit
535a9b82d6
2 changed files with 41 additions and 38 deletions
  1. 40 37
      src/components/ledger/lib/editSysFloor.vue
  2. 1 1
      src/views/ledger/system/addsystem.vue

+ 40 - 37
src/components/ledger/lib/editSysFloor.vue

@@ -7,7 +7,6 @@
       </div>
     </div>
 
-
     <span slot="footer" class="dialog-footer">
       <el-button size="small" @click="connectDialogVis=false">取消</el-button>
       <el-button size="small" type="primary" @click="save">确认</el-button>
@@ -15,45 +14,45 @@
   </el-dialog>
 </template>
 <script>
-  import bfCascader from './buildfloorCascader'
-  import {sysRelateBuild, sysRelateFloor} from "@/api/scan/request";
+import bfCascader from './buildfloorCascader'
+import { sysRelateBuild, sysRelateFloor } from "@/api/scan/request";
 
-  export default {
-    data() {
-      return {
-        buildName: '',
-        connectDialogVis: false,
-        system: {}
-      }
-    },
-    components: {
-      bfCascader
-    },
-    props: {
-      isCreate: {
-        default: false
-      }
-    },
-    methods: {
-      showDialog(system) {
-        this.system = system;
-        this.connectDialogVis = true;
-        this.$nextTick(() => {
+export default {
+  data() {
+    return {
+      buildName: '',
+      connectDialogVis: false,
+      system: {}
+    }
+  },
+  components: {
+    bfCascader
+  },
+  props: {
+    isCreate: {
+      default: false
+    }
+  },
+  methods: {
+    showDialog(system) {
+      this.system = system;
+      this.connectDialogVis = true;
+      this.$nextTick(() => {
         this.$refs.bfCascader.getCascader()
         let arr = this.system.BuildingFloorInfoList || [];
         let value = []
-          if (arr.length) {
-            arr.map(t => {
-              if (t.FloorID) {
-                value.push([t.BuildID, t.FloorID]);
-              } else {
-                value.push([t.BuildID])
-              }
-            })
-          }
-          this.$refs.bfCascader.value = value
-          console.log(value)
-        })
+        if (arr.length) {
+          arr.map(t => {
+            if (t.FloorID) {
+              value.push([t.BuildID, t.FloorID]);
+            } else {
+              value.push([t.BuildID])
+            }
+          })
+        }
+        this.$refs.bfCascader.value = value
+        console.log(value)
+      })
     },
     save() {
       // 如果是创建
@@ -94,7 +93,11 @@
       let buildFloor = this.$refs.bfCascader.getSelectedNodes();
       Promise.all([promise1, primise2]).then(res => {
         this.connectDialogVis = false;
-        this.$message.success("关联成功");
+        if (buildIds.length || floorIds.length) {
+          this.$message.success("关联成功");
+        } else {
+          this.$message.success('清除关联成功');
+        }
         this.$emit('relateSuccess', buildFloor);
       })
     }

+ 1 - 1
src/views/ledger/system/addsystem.vue

@@ -379,7 +379,7 @@ export default {
     },
     //建筑楼层
     relateSuccess(data) {
-      this.tableData[this.row].BuildingFloorInfoList = data
+      this.tableData[this.row].BuildingFloorInfoList = data.length?data:undefined;
       this.tableExample.render()
     }
   }