Bläddra i källkod

1. floor-list组件修改:
弹窗组件中的楼层组件,不触发cookie,vuex数据修改
2. 关闭弹窗组件时,该为--> 不重新渲染楼层组件

yx 4 år sedan
förälder
incheckning
639ae965d9
3 ändrade filer med 21 tillägg och 12 borttagningar
  1. 19 10
      src/components/floorList.vue
  2. 1 1
      src/views/equipment/fenbuPic.vue
  3. 1 1
      src/views/equipment/index.vue

+ 19 - 10
src/components/floorList.vue

@@ -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)
             }
         },

+ 1 - 1
src/views/equipment/fenbuPic.vue

@@ -4,7 +4,7 @@
         <div class='legend-boxs'>
             <Legend :innerLeng='1' :floors='floors' type='0' :categoryId='`${typecode=="FBT1"?"FZQZL":"XFBFYCFL"}`'></Legend>
         </div>
-        <floor-list v-if='floors.length>0' :floorsArr='floors' @emitFloor='emitFloor' :id='"floor"'></floor-list>
+        <floor-list v-if='floors.length>0' :changeDataFlag='false' :floorsArr='floors' @emitFloor='emitFloor' :id='"floor"'></floor-list>
         <div v-show='floors.length>0' class='canvas-box'>
             <floorMap ref='floorMap' :modalHeight='modalHeight' :loadName='""' :categoryId='`${typecode=="FBT1"?"FZQZL":"XFBFYCFL"}`' :type='"floor"'></floorMap>
         </div>

+ 1 - 1
src/views/equipment/index.vue

@@ -182,7 +182,7 @@ export default {
          */
         closeModal(flag) {
             this.ShowDialog = false
-            this.keyFL = 'keyFL' + new Date().getTime()
+            // this.keyFL = 'keyFL' + new Date().getTime()
             this.keyLd = 'keyLd' + new Date().getTime()
         },
         //附加数据图片查看 showView为3展示状态