guoxiaohuan преди 4 години
родител
ревизия
9be6e97022
променени са 3 файла, в които са добавени 51 реда и са изтрити 44 реда
  1. 19 17
      src/components/floorList.vue
  2. 26 23
      src/views/equipment/index.vue
  3. 6 4
      src/views/floorFunc/index.vue

+ 19 - 17
src/components/floorList.vue

@@ -38,7 +38,7 @@ import RepeatClick from '@/directives/repeat-click'
 
 export default {
     directives: {
-        repeatClick: RepeatClick
+        repeatClick: RepeatClick,
     },
     data() {
         return {
@@ -47,17 +47,17 @@ export default {
             showB: true,
             num: 0,
             floorMapIdName: '',
-            floor: {
-            },
+            floor: {},
             currentFloorId: null,
             marginTop: 0,
             marginTopMax: 0,
             startTime: '',
             endTime: '',
+            floorObj2: {},
             showNumber: 8, //需要展示的楼层数   //TODO:
             height: 39, //一个楼层的高度
             currIndex: 0, //当前楼层在 楼层数组中的下标,上下箭头使用
-            conHeight: 0 // floor-out 的高度
+            conHeight: 0, // floor-out 的高度
         }
     },
     props: {
@@ -65,23 +65,20 @@ export default {
             type: Array,
             default: () => {
                 return []
-            }
+            },
         },
         // 默认true,
         // 1. 切换楼层后,是否触发 cookie,vuex数据修改,
         // 2. 在fenbuPic组件中为false, 1)不触发cookie,vuex , 2) 选中的楼层ID,为楼层列表数组floorIdArr的第0个
         changeDataFlag: {
             type: Boolean,
-            default: true
-        }
+            default: true,
+        },
     },
     computed: {
-        ...mapGetters(['legendTable','floorObj'])
+        ...mapGetters(['legendTable', 'floorObj']),
     },
     mounted() {
-        if (Object.keys(this.floorObj).length > 0) {
-            this.floor = this.floorObj 
-        }
         this.init()
     },
     methods: {
@@ -105,13 +102,18 @@ export default {
                 return false
             }
             this.floorIdArr = []
-            this.floorsArr.map(item => {
+            this.floorsArr.map((item) => {
                 this.floorIdArr.push(item.seq)
+                if (item.seq == this.$cookie.get('currentFloorId')) {
+                    this.floor = item
+                } else {
+                    this.floor = this.floorObj
+                }
             })
-            this.currentFloorId = Number(this.$cookie.get('currentFloorId') || this.floorObj.seq)
+            this.currentFloorId = Number(this.$cookie.get('currentFloorId') || this.floor.seq)
             // bug fix 修复 fenbuPic 弹窗中,楼层不能选中的问题
             // 如果 floorIdArr 不在 floorIdArr数组中,或者changeDataFlag为false(弹窗组件中的楼层组件),使用 floorIdArr[0], 而不使用 cookie
-            let index = this.floorIdArr.findIndex(item => item === this.currentFloorId)
+            let index = this.floorIdArr.findIndex((item) => item === this.currentFloorId)
             if (index === -1 || !this.changeDataFlag) {
                 this.currentFloorId = this.floorIdArr[0]
             }
@@ -148,7 +150,7 @@ export default {
             this.handlePosition(flag, index, len)
         },
         handleCookie() {
-            let currentFloor = this.floorsArr.filter(item => item.seq == this.currentFloorId)[0]
+            let currentFloor = this.floorsArr.filter((item) => item.seq == this.currentFloorId)[0]
             if (currentFloor) {
                 // 如果 changeDataFlag为true(不是在 分布图弹窗组件中的 楼层组件),设置cookie,vuex
                 if (this.changeDataFlag) {
@@ -219,8 +221,8 @@ export default {
                 default:
                     break
             }
-        }
-    }
+        },
+    },
 }
 </script>
 <style lang="less" scoped>

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

@@ -89,8 +89,7 @@ export default {
             systemId: 1,
             categoryId: 'GDXT',
             systemName: '供电系统',
-            floorInfo: {
-            },
+            floorInfo: {},
             smsxt: '1001',
             dialogInfo: {},
             brand: [], //品牌
@@ -102,7 +101,7 @@ export default {
             bottomOffset: 0,
             keyFL: 'keyFL' + new Date().getTime(),
             keyLd: 'keyLd_' + new Date().getTime(),
-            ShowDialog: false //是否显示弹窗
+            ShowDialog: false, //是否显示弹窗
         }
     },
     components: { floorList, eqDialog, floorMap, editList },
@@ -131,18 +130,18 @@ export default {
             this.viewLengend()
             // 发送pvUv
             const data = {
-                plazaId: this.plazaId
+                plazaId: this.plazaId,
             }
             let postParams = {
                 type: 'equipmentRouter',
                 target: item.name,
-                parameter: item.categoryId
+                parameter: item.categoryId,
             }
             getPvUv(data, postParams)
-                .then(res => {
+                .then((res) => {
                     console.log('pvuv', res)
                 })
-                .catch(res => {
+                .catch((res) => {
                     console.log('error', res)
                 })
         },
@@ -158,7 +157,6 @@ export default {
         },
         emitFloor(item) {
             this.floorInfo = item
-            console.log(item)
             this.$refs.floorMap.init(this.floorInfo.gname)
             this.init()
             this.querySmsxt()
@@ -175,19 +173,19 @@ export default {
                 // pvuv接口记录
                 // 发送pvUv
                 const data = {
-                    plazaId: this.plazaId
+                    plazaId: this.plazaId,
                 }
 
                 let postParams = {
                     type: 'modal',
                     target: eve.id,
-                    parameter: eve.label
+                    parameter: eve.label,
                 }
                 getPvUv(data, postParams)
-                    .then(res => {
+                    .then((res) => {
                         console.log('pvuv', res)
                     })
-                    .catch(res => {
+                    .catch((res) => {
                         console.log('error', res)
                     })
             }
@@ -228,15 +226,20 @@ export default {
                 module: '1003',
                 floor: picFloor,
                 system: system,
-                plazaId: this.plazaId
+                plazaId: this.plazaId,
             }
-            queryPic({ getParams }).then(res => {
+            queryPic({ getParams }).then((res) => {
                 // console.log('附加数据', res)
                 this.fqPic = res.data ? res.data : []
             })
         },
         init() {
             this.loadName = `设备设施-${this.systemName}-${this.floorInfo.code}`
+            if (this.floorsArr.length > 0 && this.$cookie.get('currentFloorId')) {
+                this.floorInfo = this.floorsArr.find((item) => {
+                    return this.$cookie.get('currentFloorId') == item.seq
+                })
+            }
         },
         // 从设备设施进入的机房
         queryType(val) {
@@ -267,19 +270,19 @@ export default {
             } else {
                 this.$cookie.set('categoryId', 'SCPZ')
             }
-        }
+        },
     },
     mounted() {
         window._vm = this
-        if (Object.keys(this.floorObj).length > 0) {
-            this.floorInfo = this.floorObj 
-            this.$refs.floorMap.init(this.floorInfo.gname)
-        }
+        // 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
             this.smsxtQuery()
-            this.system.forEach(el => {
+            this.system.forEach((el) => {
                 if (el.smsxt == this.smsxt) {
                     this.everySystem = el.children
                     this.systemName = el.name
@@ -290,7 +293,7 @@ export default {
         this.everySystem = this.system[0].children
         // 刷新时,store中有categoryId时,选中子系统状态
         if (this.$store.state.categoryId) {
-            let item = this.system.filter(item => item.categoryId === this.$store.state.categoryId)[0]
+            let item = this.system.filter((item) => item.categoryId === this.$store.state.categoryId)[0]
             this.systemId = item.id
             this.everySystem = item.children
             this.systemName = item.name
@@ -301,8 +304,8 @@ export default {
         this.init()
     },
     computed: {
-        ...mapGetters(['floorsArr', 'plazaId', 'showView', 'legendTable','floorObj'])
-    }
+        ...mapGetters(['floorsArr', 'plazaId', 'showView', 'legendTable', 'floorObj']),
+    },
 }
 </script>
 <style lang="less" scoped>

+ 6 - 4
src/views/floorFunc/index.vue

@@ -31,6 +31,7 @@ export default {
     },
     methods: {
         emitFloor(item) {
+            console.log(item)
             this.floorInfo = item
             this.$refs.floorMap.init(this.floorInfo.gname)
             this.init()
@@ -40,13 +41,14 @@ export default {
         },
         init() {
             this.loadName = `楼层功能-${this.floorInfo.code}`
+            if (this.floorsArr.length > 0 && this.$cookie.get('currentFloorId')) {
+                this.floorInfo = this.floorsArr.find((item) => {
+                    return this.$cookie.get('currentFloorId') == item.seq
+                })
+            }
         },
     },
     mounted() {
-        if (Object.keys(this.floorObj).length > 0) {
-            this.floorInfo = this.floorObj
-        }
-        console.log('floorObj', this.floorObj)
         this.init()
         this.$refs.floorMap.init(this.floorInfo.gname)
     },