Hwf 1 hete
szülő
commit
70034b31a1
2 módosított fájl, 8 hozzáadás és 7 törlés
  1. 2 2
      src/store/modules/map.ts
  2. 6 5
      src/views/globalMap/SwitchMapTool.vue

+ 2 - 2
src/store/modules/map.ts

@@ -1,5 +1,5 @@
 import { PointType } from '@/api/globalMap/type';
-import { listMenu } from '@/api/system/menu';
+import { listMenu2 } from '@/api/system/menu';
 
 export const useMapStore = defineStore('map', () => {
   const mapState = reactive({
@@ -143,7 +143,7 @@ export const useMapStore = defineStore('map', () => {
   };
   // 初始化左侧菜单数据
   const initMenuData = () => {
-    listMenu().then((res: any) => {
+    listMenu2().then((res: any) => {
       const data = res.data ? res.data : [];
       data.forEach((item: any) => {
         item.show = true;

+ 6 - 5
src/views/globalMap/SwitchMapTool.vue

@@ -6,12 +6,12 @@
         <div
           v-for="(item, index) in mapData"
           :key="index"
-          v-show="open || (!open && mapStore.activeMap === item.key)"
+          v-show="open || (!open && mapStore.activeMap === item.value)"
           class="switch-item"
-          @click="selectItem(item.key)"
+          @click="selectItem(item.value)"
         >
-          <div :class="'item-bg1 ' + item.key">
-            <div :class="mapStore.activeMap === item.key ? 'item-text bg-active' : 'item-text'">{{ item.name }}</div>
+          <div :class="'item-bg1 ' + item.value">
+            <div :class="mapStore.activeMap === item.value ? 'item-text bg-active' : 'item-text'">{{ item.label }}</div>
           </div>
         </div>
       </div>
@@ -28,7 +28,7 @@ const mapStore = useMapStore();
 const route = useRoute();
 const emits = defineEmits(['switchMap']);
 const mapData = computed(() => {
-  if (zt_dt.value && mapStore.ztMapList.length > 0) {
+  if (zt_dt.value && zt_dt.value.length > 0 && mapStore.ztMapList && mapStore.ztMapList.length > 0) {
     const path = route.path;
     let zt = '';
     if (path === '/globalMap' || path === '/globalMap2') {
@@ -36,6 +36,7 @@ const mapData = computed(() => {
     } else if (['/index', '/index2', '/emergencyCommandMap', '/emergencyCommandMap2'].includes(path)) {
       zt = '一图作战';
     }
+    debugger
     let res = [];
     for (let i = 0; i < mapStore.ztMapList.length; i++) {
       if (mapStore.ztMapList[i].zt === zt) {