|
@@ -69,8 +69,15 @@ export default {
|
|
|
floorsArr: {
|
|
|
type: Array,
|
|
|
default: () => {
|
|
|
- ;[]
|
|
|
+ return []
|
|
|
}
|
|
|
+ },
|
|
|
+ // 默认true,
|
|
|
+ // 1. 切换楼层后,是否触发 cookie,vuex数据修改,
|
|
|
+ // 2. 在fenbuPic组件中为false, 1)不触发cookie,vuex , 2) 选中的楼层ID,为楼层列表数组floorIdArr的第0个
|
|
|
+ changeDataFlag: {
|
|
|
+ type: Boolean,
|
|
|
+ default: true
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
@@ -109,9 +116,9 @@ export default {
|
|
|
})
|
|
|
this.currentFloorId = Number(this.$cookie.get('currentFloorId') || 100)
|
|
|
// bug fix 修复 fenbuPic 弹窗中,楼层不能选中的问题
|
|
|
- // 如果 floorIdArr 不在 floorIdArr数组中, 使用 floorIdArr[0], 而不使用 cookie
|
|
|
+ // 如果 floorIdArr 不在 floorIdArr数组中,或者changeDataFlag为false(弹窗组件中的楼层组件),使用 floorIdArr[0], 而不使用 cookie
|
|
|
let index = this.floorIdArr.findIndex(item => item === this.currentFloorId)
|
|
|
- if (index === -1) {
|
|
|
+ if (index === -1 || !this.changeDataFlag) {
|
|
|
this.currentFloorId = this.floorIdArr[0]
|
|
|
}
|
|
|
// 修复在设备设施页面中,楼层组件不够 8个楼层时,出现的样式问题,
|
|
@@ -148,15 +155,17 @@ export default {
|
|
|
this.handlePosition(flag, index, len)
|
|
|
},
|
|
|
handleCookie() {
|
|
|
- // return true
|
|
|
let currentFloor = this.floorsArr.filter(item => item.seq == this.currentFloorId)[0]
|
|
|
if (currentFloor) {
|
|
|
- this.$cookie.set('floorNow', currentFloor.code || '', 3)
|
|
|
- this.$cookie.set('floorMapId', currentFloor.gname, 3)
|
|
|
- this.$cookie.set('currentFloorId', currentFloor.seq, 3)
|
|
|
- this.floorId = this.$cookie.get('floorNow') || currentFloor.code
|
|
|
- this.floorMapIdName = this.$cookie.get('floorMapId') || currentFloor.gname
|
|
|
- store.commit('SETCURRENTFLOOR', currentFloor)
|
|
|
+ // 如果 changeDataFlag为true(不是在 分布图弹窗组件中的 楼层组件),设置cookie,vuex
|
|
|
+ if (this.changeDataFlag) {
|
|
|
+ this.$cookie.set('floorNow', currentFloor.code || '', 3)
|
|
|
+ this.$cookie.set('floorMapId', currentFloor.gname, 3)
|
|
|
+ this.$cookie.set('currentFloorId', currentFloor.seq, 3)
|
|
|
+ this.floorId = this.$cookie.get('floorNow') || currentFloor.code
|
|
|
+ this.floorMapIdName = this.$cookie.get('floorMapId') || currentFloor.gname
|
|
|
+ store.commit('SETCURRENTFLOOR', currentFloor)
|
|
|
+ }
|
|
|
this.$emit('emitFloor', currentFloor)
|
|
|
}
|
|
|
},
|