Selaa lähdekoodia

fix: 修复 全局搜索-->电井间商铺控制范围 时,平面图不显示绘制内容的问题

yunxing 4 vuotta sitten
vanhempi
commit
2ffe09ef90
1 muutettua tiedostoa jossa 17 lisäystä ja 3 poistoa
  1. 17 3
      src/views/GlobalSearch.vue

+ 17 - 3
src/views/GlobalSearch.vue

@@ -31,7 +31,7 @@
 </template>
 <script>
 import Vue from 'vue'
-import { mapGetters } from 'vuex'
+import { mapGetters, mapMutations } from 'vuex'
 import { Search, List, Cell } from 'vant'
 import { queryEquipmentList } from '@/api/equipmentList.js'
 Vue.use(Search).use(List).use(Cell);
@@ -40,7 +40,7 @@ export default {
   props: {},
   components: {},
   computed: {
-    ...mapGetters(['plazaId']),
+    ...mapGetters(['plazaId', 'smsxt', 'categoryId']),
   },
   data() {
     return {
@@ -52,14 +52,18 @@ export default {
       equipList: [], //设备列表
       page: 1, //当前页码
       size: 10, //每页条数
+      oldSmsxt: '', //保存进入页面时的smsxt(点击电井间商铺控制范围,会更改此值)
+      oldCategoryId:'', //保存进入页面时的categoryId(点击电井间商铺控制范围,会更改此值)
     }
   },
   props: {},
   beforeMount() { },
   mounted() {
-
+    this.oldSmsxt = this.smsxt
+    this.oldCategoryId = this.categoryId
   },
   methods: {
+    ...mapMutations(['SETCATEGORYID','SETSMSXT']),
     // 跳转机房平面布置图
     handleClickEngineRoomPicture() {
       this.$router.push({ name: 'EngineRoomPicture', params: {type: "all"} })
@@ -70,6 +74,8 @@ export default {
     },
     // 跳转电井间控制商铺范围
     handleClickElectricWell() {
+      this.SETCATEGORYID('GDXT')
+      this.SETSMSXT('1001')
       this.$router.push({ name: 'ElectricWell', params: { type: "all"} })
     },
     // 跳转更多设备
@@ -117,6 +123,14 @@ export default {
     },
     // 取消搜索
     onCancel() {
+      // 修改smsxt为初始值
+      if(this.smsxt !== this.oldSmsxt){
+        this.SETSMSXT(this.oldSmsxt)
+      }
+      // 修改categoryId为初始值
+      if(this.oldCategoryId !== this.categoryId){
+        this.SETCATEGORYID(this.oldCategoryId)
+      }
       this.$router.go(-1)
     },
     onLoad() {