Browse Source

fix :
1.切换楼层 接口不重新调用bug修复
2.小圆点样式修改
3.使用vuex保存选中楼层的信息

yunxing 4 years ago
parent
commit
ff6d6e9dcf
3 changed files with 36 additions and 7 deletions
  1. 30 7
      src/components/Legend/src/legend.vue
  2. 2 0
      src/components/floorList.vue
  3. 4 0
      src/store/index.js

+ 30 - 7
src/components/Legend/src/legend.vue

@@ -67,7 +67,8 @@
                 <span class='edit-icon corner-con' @click='goToEditer'>
                     <img src='@/assets/imgs/bjs.png' alt />
                     <!-- 角标 -->
-                    <span v-if='draftNum' class='corner' :style='{lineHeight : draftNum > 99 ?"10px":"18px"}'>{{draftNum > 99 ? '...' : draftNum}}</span>
+                    <!-- <span v-if='draftNum' class='corner' :style='{lineHeight : draftNum > 99 ?"10px":"18px"}'>{{draftNum > 99 ? '...' : draftNum}}</span> -->
+                    <span v-if='draftNum' class='corner'></span>
                 </span>
             </el-tooltip>
 
@@ -75,7 +76,8 @@
             <span v-else class='edit-icon2 corner-con'>
                 <img src='@/assets/imgs/bjs.png' alt />
                 <!-- 角标 -->
-                <span v-if='draftNum' class='corner' :style='{lineHeight : draftNum > 99 ?"10px":"18px"}'>{{draftNum > 99 ? '...' : draftNum}}</span>
+                <!-- <span v-if='draftNum' class='corner' :style='{lineHeight : draftNum > 99 ?"10px":"18px"}'>{{draftNum > 99 ? '...' : draftNum}}</span> -->
+                <span v-if='draftNum' class='corner'></span>
             </span>
         </div>
         <div class='select-floor' v-if='isFloor'>
@@ -161,6 +163,21 @@ export default {
         }
     },
     components: { lengendView, legendRemarks, lengendEdit },
+    watch: {
+        // 监听 vuex 中currentFloor的变化,切换楼层后,调用接口查询,显示右下角小红点
+        '$store.state.currentFloor': {
+            handler(newV, oldV) {
+                if (newV.gname !== oldV.gname) {
+                    clearInterval(this.timer)
+                    this.getDraftNum()
+                    this.timer = setInterval(() => {
+                        this.getDraftNum()
+                    }, this.interval)
+                }
+            },
+            deep: true
+        }
+    },
     methods: {
         /**
          * @name getDraftNum
@@ -168,7 +185,8 @@ export default {
          */
         async getDraftNum() {
             let res = null,
-                floorId = this.$cookie.get('floorMapId'),
+                // floorId = this.$cookie.get('floorMapId'),
+                floorId = this.$store.state.currentFloor.gname,
                 data = {
                     Distinct: true,
                     Filters: `projectId='${this.plazaId}';isPub=false;floorId='${floorId}'`,
@@ -519,11 +537,16 @@ export default {
         position: relative;
         .corner {
             position: absolute;
-            right: -8px;
-            top: 0;
+            // right: -8px;
+            // top: 0;
+            // display: inline-block;
+            // width: 18px;
+            // height: 18px;
+            right: 3px;
+            top: 3px;
             display: inline-block;
-            width: 18px;
-            height: 18px;
+            width: 8px;
+            height: 8px;
             background: @red;
             border-radius: 90px;
             font-size: 12px;

+ 2 - 0
src/components/floorList.vue

@@ -44,6 +44,7 @@
     </div>
 </template>
 <script>
+import store from '../store'
 export default {
     data() {
         return {
@@ -162,6 +163,7 @@ export default {
                 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)
             }
         },

+ 4 - 0
src/store/index.js

@@ -25,6 +25,7 @@ export default new Vuex.Store({
         legendTable: [], //除土建系统图例展示
         remarksText: '', //备注
         bunkObj: {}, // 铺位名称
+        currentFloor: {}, //当前选中的楼层信息
     },
     getters: {
         floorsArr: (state) => state.floorsArr,
@@ -86,6 +87,9 @@ export default new Vuex.Store({
         SETBUNKOBJ(state, data) {
             state.bunkObj = data
         },
+        SETCURRENTFLOOR(state, data) {
+            state.currentFloor = data
+        },
     },
     actions: {
         // 获取项目列表、userId