瀏覽代碼

floor默认选中处理

zhulizhen1111 4 年之前
父節點
當前提交
596ecf55b5
共有 2 個文件被更改,包括 10 次插入31 次删除
  1. 5 8
      src/components/floorList.vue
  2. 5 23
      src/views/equipment/index.vue

+ 5 - 8
src/components/floorList.vue

@@ -48,11 +48,6 @@ export default {
             num: 0,
             floorMapIdName: '',
             floor: {
-                code: 'F1',
-                gcode: '1F',
-                gname: 'f1',
-                name: '第1层',
-                seq: 100
             },
             currentFloorId: null,
             marginTop: 0,
@@ -81,10 +76,12 @@ export default {
         }
     },
     computed: {
-        ...mapGetters(['legendTable'])
+        ...mapGetters(['legendTable','floorObj'])
     },
     mounted() {
-        window.vm = this
+        if (Object.keys(this.floorObj).length > 0) {
+            this.floor = this.floorObj 
+        }
         this.init()
     },
     methods: {
@@ -111,7 +108,7 @@ export default {
             this.floorsArr.map(item => {
                 this.floorIdArr.push(item.seq)
             })
-            this.currentFloorId = Number(this.$cookie.get('currentFloorId') || 100)
+            this.currentFloorId = Number(this.$cookie.get('currentFloorId') || this.floorObj.seq)
             // bug fix 修复 fenbuPic 弹窗中,楼层不能选中的问题
             // 如果 floorIdArr 不在 floorIdArr数组中,或者changeDataFlag为false(弹窗组件中的楼层组件),使用 floorIdArr[0], 而不使用 cookie
             let index = this.floorIdArr.findIndex(item => item === this.currentFloorId)

+ 5 - 23
src/views/equipment/index.vue

@@ -90,10 +90,6 @@ export default {
             categoryId: 'GDXT',
             systemName: '供电系统',
             floorInfo: {
-                code: 'F1',
-                gcode: '1F',
-                gname: 'f1',
-                seq: 100
             },
             smsxt: '1001',
             dialogInfo: {},
@@ -273,23 +269,12 @@ export default {
             }
         }
     },
-    /* mounted() {
-        if (this.$route.query.smsxt) {
-            this.smsxt = this.$route.query.smsxt
-            this.system.forEach(el => {
-                if (el.smsxt == this.smsxt) {
-                    this.everySystem = el.children
-                    this.systemName = el.name
-                    this.systemId = el.id
-                }
-            })``
-        }
-        this.everySystem = this.system[0].children
-        this.init()
-        this.$refs.floorMap.init(this.floorInfo.gname)
-    }, */
     mounted() {
         window._vm = this
+        if (Object.keys(this.floorObj).length > 0) {
+            this.floorInfo = this.floorObj 
+            this.$refs.floorMap.init(this.floorInfo.gname)
+        }
         if (this.$route.query.smsxt) {
             console.log(this.$route.query.smsxt)
             this.smsxt = this.$route.query.smsxt
@@ -310,16 +295,13 @@ export default {
             this.everySystem = item.children
             this.systemName = item.name
             this.smsxt = item.smsxt
-            // this.$refs.floorMap.init(this.floorInfo.gname)
             this.querySmsxt()
             this.viewLengend()
         }
         this.init()
-        console.log(this.floorInfo.gname)
-        this.$refs.floorMap.init(this.floorInfo.gname)
     },
     computed: {
-        ...mapGetters(['floorsArr', 'plazaId', 'showView', 'legendTable'])
+        ...mapGetters(['floorsArr', 'plazaId', 'showView', 'legendTable','floorObj'])
     }
 }
 </script>