2 Commity ac8023142e ... 462a28f30f

Autor SHA1 Wiadomość Data
  houzekong 462a28f30f [Pref 0000] 优化各个页面的历史数据请求逻辑 1 miesiąc temu
  houzekong 0b6997b338 [Feat 0000] 地图添加CAD图纸选择器 1 miesiąc temu

+ 3 - 3
src/api/sys/map.ts

@@ -24,7 +24,7 @@ export function getShanxiGeoJSON() {
   return fetch('/js/shanxi.geo.json').then((r) => r.json());
 }
 
-export function getGeoJSON(params: any) {
+export function getMarkerCollection(params: any) {
   // const getFeatColor = (gb) => {
   //   const colorMap = {
   //     // 邮编前7位:颜色
@@ -157,7 +157,7 @@ export function getGeoJSON(params: any) {
   //   return false;
   // };
 
-  return Promise.all([getShanxiGeoJSON(), getMarkers(params)]).then(([geojson, { records }]) => {
+  return getMarkers(params).then(({ records }) => {
     const mineStore = useMineDepartmentStore();
 
     const map = new Map<string, any>();
@@ -244,6 +244,6 @@ export function getGeoJSON(params: any) {
       })),
     };
 
-    return [geojson, records, markers];
+    return [records, markers];
   });
 }

+ 1 - 1
src/components/Table/src/props.ts

@@ -55,7 +55,7 @@ export const basicProps = {
     },
   },
   // 立即请求接口
-  immediate: propTypes.bool.def(true),
+  immediate: propTypes.bool.def(false),
   emptyDataIsShowTable: propTypes.bool.def(true),
   // 额外的请求参数
   searchInfo: {

+ 47 - 23
src/layouts/default/feature/SimpleMap.vue

@@ -3,6 +3,14 @@
   <div v-if="!isTopLevel" class="map-reset-btn">
     <Button :loading="mapLoading" type="primary" @click="revertStack">返回上级</Button>
   </div>
+  <div v-if="cadOpened" class="map-cad-btn">
+    <a-select
+      v-model:value="fileId"
+      :options="fileOptions"
+      :fieldNames="{ label: 'fileName', value: 'wjId' }"
+      @change="toggleCADMap(true)"
+    ></a-select>
+  </div>
 </template>
 
 <script lang="ts" setup>
@@ -13,14 +21,14 @@
   // import { useRoute } from 'vue-router';
   import vjmap from 'vjmap';
   // import type vjmap3d from 'vjmap3d';
-  import { getGeoJSON, getShanxiGeoJSON } from '/@/api/sys/map';
+  import { getMarkerCollection, getShanxiGeoJSON } from '/@/api/sys/map';
   import { useMineDepartmentStore } from '/@/store/modules/mine';
   import { get, last } from 'lodash-es';
   // import { env } from '/@/views/system/cadFile/env';
   import { StatusColorEnum } from '/@/enums/jeecgEnum';
   import { generateSimplePopup } from './hooks/popup';
   import { initMap2d, renderGoafMarkers } from '/@/views/system/cadFile/app';
-  import { getGoafList } from '/@/views/system/cadFile/cad.api';
+  import { getGoafList, getMineFileList } from '/@/views/system/cadFile/cad.api';
   import LeafPopup from './components/LeafPopup.vue';
   import { watchTriggerable } from '@vueuse/core';
   import { findPath, listToTree } from '/@/utils/helper/treeHelper';
@@ -67,6 +75,8 @@
   // 用于存储历史节点的栈,实现返回上一级功能
   const historyStack = ref([DEFAULT_NODE]);
   const isTopLevel = computed(() => get(historyStack.value, 'length', 1) === 1);
+  const fileOptions = ref<any[]>([]);
+  const fileId = ref();
 
   /** 根据GeoJSON文件绘制省市边界和填充色到地图上,其将作为一个新图层 */
   function initMapGeoJSON(map: vjmap.Map, geojson) {
@@ -229,7 +239,7 @@
   }
 
   /** 切换CAD底图和瓦片地图底图的显示,通过重新初始化进行切换,避免出现动画异常和多个DOM节点 */
-  async function toggleCADMap(visiable: boolean, data?: any) {
+  async function toggleCADMap(visiable: boolean) {
     // CAD底图不显示的时候无需再次初始化地图,显示时需要根据data来切换不同图纸
     if (cadOpened === visiable && visiable === false) return;
 
@@ -238,18 +248,33 @@
     map?.destory();
 
     try {
-      if (visiable) {
+      let markers;
+
+      // 当不是静默状态时,需要标记点位信息来计算历史栈
+      if (!props.slience) {
+        const [records, mks] = await getMarkerCollection({
+          deptId: mineStore.getRootId,
+          pageSize: 9999,
+        });
+        markerCollection = listToTree(records, DEFAULT_TREE_CONFIG);
+        markers = mks;
+      }
+
+      if (cadOpened) {
+        // 如果当前选项下没有已选中的地图,那么意味着需要新获取选项,否则无需发请求
+        if (!fileOptions.value.some((e) => e.wjId === fileId.value)) {
+          const { records } = await getMineFileList({ deptId: mineStore.getDepartId, pageSize: 999 });
+          fileOptions.value = records;
+          fileId.value = get(records, '[0].wjId');
+        }
+
         const [m, res] = await Promise.all([
-          initMap2d(mapContainer.value!, {
-            // fileUrl: node.url
-            // fileUrl: `${globSetting.apiUrl}/sys/common/static/webfile/hongliulin_default.dwg`,
-            style: { backcolor: 0xe6f3ff },
-          }),
+          initMap2d(mapContainer.value!, { vjId: fileId.value, style: { backcolor: 0xe6f3ff } }),
           props.slience
             ? Promise.resolve([])
             : getGoafList({
-                mineCode: data ? data.mineCode : mineStore.getRoot?.fax,
-                deptId: data ? data.id : mineStore.getRootId,
+                mineCode: mineStore.getDepartId,
+                deptId: mineStore.getDepartId,
               }),
         ]);
         map = m;
@@ -257,21 +282,11 @@
         renderGoafMarkers(res); // 渲染标记
       } else {
         // const hide = message.loading('地图加载中...', 0);
-        const [m, res] = await Promise.all([
-          initMap(mapContainer.value!),
-          props.slience
-            ? getShanxiGeoJSON().then((r) => [r, [], []])
-            : getGeoJSON({
-                deptId: mineStore.getRootId,
-                pageSize: 9999,
-              }),
-        ]);
-        const [geojson, records, markers] = res;
+        const [m, res] = await Promise.all([initMap(mapContainer.value!), getShanxiGeoJSON()]);
         // hide();
-        markerCollection = listToTree(records, DEFAULT_TREE_CONFIG);
         map = m;
 
-        initMapGeoJSON(map, geojson);
+        initMapGeoJSON(map, res);
         initMapMarker(map, markers);
       }
     } catch (e) {
@@ -299,6 +314,7 @@
 
       // 不论是不是矿端,历史记录都是一样的,用户点击返回上一级都能正常返回
       historyStack.value = findPath(markerCollection, (n) => n.id === id) as any[];
+      console.log('debug findpath', markerCollection, historyStack.value);
 
       // 此外如果是非矿端那么模拟触发地图点击事件
       markerClickHandler();
@@ -379,4 +395,12 @@
     // padding: 10px 15px;
     margin: 10px 0;
   }
+  .map-cad-btn {
+    position: absolute;
+    left: 30%; /* 距离右边 20px */
+    z-index: 2; /* 确保在地图控件之上 */
+    top: @header-height;
+    // padding: 10px 15px;
+    margin: 10px 0;
+  }
 </style>

+ 1 - 1
src/views/analysis/common/analysis.ts

@@ -24,7 +24,7 @@ export function useInitForm(ctx?: TableActionType) {
   function initGoafOptions(deptId) {
     return getGoafSelectOption({ deptId }).then(({ options, defaultValue }) => {
       goafOptions.value = options;
-      if (options.some((e) => e.id === goafId.value)) return;
+      if (options.some((e) => e.value === goafId.value)) return;
       goafId.value = defaultValue;
     });
   }

+ 10 - 9
src/views/analysis/warningAnalysis/airLeakStatus/index.vue

@@ -45,7 +45,7 @@
           <a-button type="default" class="ml-8px" preIcon="mdi:download" @click="onExportXls"> 导出 </a-button>
         </template>
         <template #form-goaf-select>
-          <a-select v-model:value="goafId" :options="goafOptions" placeholder="请选择" />
+          <a-select v-model:value="goafId" :options="goafOptions" placeholder="请选择" @change="historyTable.reload" />
         </template>
       </BasicTable>
     </TabPane>
@@ -132,8 +132,9 @@
     tableProps: {
       columns,
       api: async (params) => {
+        await initGoafOptions(params.deptId);
         if (!goafId.value) {
-          await initGoafOptions(params.deptId);
+          return Promise.resolve([]);
         }
         params.goafId = goafId.value;
         return getProvinceAlarmHistory(params);
@@ -173,15 +174,15 @@
             field: 'deptId',
             component: 'MineCascader', // 自定义组件名
             componentProps: {
-              initFromStore: true,
+              initFromStore: false,
               syncToStore: false,
               changeOnSelect: false,
-              onChange: (e) => {
-                historyTable.setLoading(true);
-                initGoafOptions(e).finally(() => {
-                  historyTable.setLoading(false);
-                });
-              },
+              // onChange: (e) => {
+              //   historyTable.setLoading(true);
+              //   initGoafOptions(e).finally(() => {
+              //     historyTable.setLoading(false);
+              //   });
+              // },
             },
             colProps: { span: 6 },
             rules: [],

+ 10 - 9
src/views/analysis/warningAnalysis/autoFireAnalysis/index.vue

@@ -48,7 +48,7 @@
             <a-button type="default" class="ml-8px" preIcon="mdi:download" @click="onExportXls"> 导出 </a-button>
           </template>
           <template #form-goaf-select>
-            <a-select v-model:value="goafId" :options="goafOptions" placeholder="请选择" />
+            <a-select v-model:value="goafId" :options="goafOptions" placeholder="请选择" @change="historyTable.reload" />
           </template>
         </BasicTable>
       </TabPane>
@@ -155,8 +155,9 @@
       columns,
       // columns: historyColumns,
       api: async (params) => {
+        await initGoafOptions(params.deptId);
         if (!goafId.value) {
-          await initGoafOptions(params.deptId);
+          return Promise.resolve([]);
         }
         params.goafId = goafId.value;
         return getProvinceAlarmHistory(params);
@@ -196,15 +197,15 @@
             field: 'deptId',
             component: 'MineCascader', // 自定义组件名
             componentProps: {
-              initFromStore: true,
+              initFromStore: false,
               syncToStore: false,
               changeOnSelect: false,
-              onChange: (e) => {
-                historyTable.setLoading(true);
-                initGoafOptions(e).finally(() => {
-                  historyTable.setLoading(false);
-                });
-              },
+              // onChange: (e) => {
+              //   historyTable.setLoading(true);
+              //   initGoafOptions(e).finally(() => {
+              //     historyTable.setLoading(false);
+              //   });
+              // },
             },
             colProps: { span: 6 },
             rules: [],

+ 10 - 9
src/views/analysis/warningAnalysis/autoFireOutAnalysis/index.vue

@@ -48,7 +48,7 @@
             <a-button type="default" class="ml-8px" preIcon="mdi:download" @click="onExportXls"> 导出 </a-button>
           </template>
           <template #form-goaf-select>
-            <a-select v-model:value="goafId" :options="goafOptions" placeholder="请选择" />
+            <a-select v-model:value="goafId" :options="goafOptions" placeholder="请选择" @change="historyTable.reload" />
           </template>
         </BasicTable>
       </TabPane>
@@ -155,8 +155,9 @@
       columns,
       // columns: historyColumns,
       api: async (params) => {
+        await initGoafOptions(params.deptId);
         if (!goafId.value) {
-          await initGoafOptions(params.deptId);
+          return Promise.resolve([]);
         }
         params.goafId = goafId.value;
         return getProvinceAlarmHistory(params);
@@ -196,15 +197,15 @@
             field: 'deptId',
             component: 'MineCascader', // 自定义组件名
             componentProps: {
-              initFromStore: true,
+              initFromStore: false,
               syncToStore: false,
               changeOnSelect: false,
-              onChange: (e) => {
-                historyTable.setLoading(true);
-                initGoafOptions(e).finally(() => {
-                  historyTable.setLoading(false);
-                });
-              },
+              // onChange: (e) => {
+              //   historyTable.setLoading(true);
+              //   initGoafOptions(e).finally(() => {
+              //     historyTable.setLoading(false);
+              //   });
+              // },
             },
             colProps: { span: 6 },
             rules: [],

+ 1 - 1
src/views/analysis/warningAnalysis/connectAnalysis/hooks/form.ts

@@ -38,7 +38,7 @@ export function useInitForm({ unlink }: { unlink?: boolean } = {}) {
       .then(({ options, defaultValue }) => {
         goafOptions.value = options;
         if (unlink) return;
-        if (options.some((e) => e.id === goafId.value)) return;
+        if (options.some((e) => e.value === goafId.value)) return;
 
         goafId.value = defaultValue;
       })

+ 10 - 9
src/views/analysis/warningAnalysis/fireAreaJudgeAnalysis/index.vue

@@ -47,7 +47,7 @@
           <a-button type="default" class="ml-8px" preIcon="mdi:download" @click="onExportXls"> 导出 </a-button>
         </template>
         <template #form-goaf-select>
-          <a-select v-model:value="goafId" :options="goafOptions" placeholder="请选择" />
+          <a-select v-model:value="goafId" :options="goafOptions" placeholder="请选择" @change="historyTable.reload" />
         </template>
       </BasicTable>
     </TabPane>
@@ -146,8 +146,9 @@
       columns,
       // columns: historyColumns,
       api: async (params) => {
+        await initGoafOptions(params.deptId);
         if (!goafId.value) {
-          await initGoafOptions(params.deptId);
+          return Promise.resolve([]);
         }
         params.goafId = goafId.value;
         return getProvinceAlarmHistory(params);
@@ -187,15 +188,15 @@
             field: 'deptId',
             component: 'MineCascader', // 自定义组件名
             componentProps: {
-              initFromStore: true,
+              initFromStore: false,
               syncToStore: false,
               changeOnSelect: false,
-              onChange: (e) => {
-                historyTable.setLoading(true);
-                initGoafOptions(e).finally(() => {
-                  historyTable.setLoading(false);
-                });
-              },
+              // onChange: (e) => {
+              //   historyTable.setLoading(true);
+              //   initGoafOptions(e).finally(() => {
+              //     historyTable.setLoading(false);
+              //   });
+              // },
             },
             colProps: { span: 6 },
             rules: [],

+ 10 - 9
src/views/analysis/warningAnalysis/overlimitAlarm/index.vue

@@ -47,7 +47,7 @@
           <a-button type="default" class="ml-8px" preIcon="mdi:download" @click="onExportXls"> 导出 </a-button>
         </template>
         <template #form-goaf-select>
-          <a-select v-model:value="goafId" :options="goafOptions" placeholder="请选择" />
+          <a-select v-model:value="goafId" :options="goafOptions" placeholder="请选择" @change="historyTable.reload" />
         </template>
       </BasicTable>
     </TabPane>
@@ -149,8 +149,9 @@
       columns,
       // columns: historyColumns,
       api: async (params) => {
+        await initGoafOptions(params.deptId);
         if (!goafId.value) {
-          await initGoafOptions(params.deptId);
+          return Promise.resolve([]);
         }
         params.goafId = goafId.value;
         return getProvinceAlarmHistory(params);
@@ -190,15 +191,15 @@
             field: 'deptId',
             component: 'MineCascader', // 自定义组件名
             componentProps: {
-              initFromStore: true,
+              initFromStore: false,
               syncToStore: false,
               changeOnSelect: false,
-              onChange: (e) => {
-                historyTable.setLoading(true);
-                initGoafOptions(e).finally(() => {
-                  historyTable.setLoading(false);
-                });
-              },
+              // onChange: (e) => {
+              //   historyTable.setLoading(true);
+              //   initGoafOptions(e).finally(() => {
+              //     historyTable.setLoading(false);
+              //   });
+              // },
             },
             colProps: { span: 6 },
             rules: [],

+ 10 - 9
src/views/analysis/warningAnalysis/overlimitAlarmOut/index.vue

@@ -47,7 +47,7 @@
           <a-button type="default" class="ml-8px" preIcon="mdi:download" @click="onExportXls"> 导出 </a-button>
         </template>
         <template #form-goaf-select>
-          <a-select v-model:value="goafId" :options="goafOptions" placeholder="请选择" />
+          <a-select v-model:value="goafId" :options="goafOptions" placeholder="请选择" @change="historyTable.reload" />
         </template>
       </BasicTable>
     </TabPane>
@@ -146,8 +146,9 @@
       columns,
       // columns: historyColumns,
       api: async (params) => {
+        await initGoafOptions(params.deptId);
         if (!goafId.value) {
-          await initGoafOptions(params.deptId);
+          return Promise.resolve([]);
         }
         params.goafId = goafId.value;
         return getProvinceAlarmHistory(params);
@@ -187,15 +188,15 @@
             field: 'deptId',
             component: 'MineCascader', // 自定义组件名
             componentProps: {
-              initFromStore: true,
+              initFromStore: false,
               syncToStore: false,
               changeOnSelect: false,
-              onChange: (e) => {
-                historyTable.setLoading(true);
-                initGoafOptions(e).finally(() => {
-                  historyTable.setLoading(false);
-                });
-              },
+              // onChange: (e) => {
+              //   historyTable.setLoading(true);
+              //   initGoafOptions(e).finally(() => {
+              //     historyTable.setLoading(false);
+              //   });
+              // },
             },
             colProps: { span: 6 },
             rules: [],

+ 10 - 9
src/views/analysis/warningAnalysis/pressureDiffAnalysis/index.vue

@@ -51,7 +51,7 @@
           <a-button type="default" class="ml-8px" preIcon="mdi:download" @click="onExportXls"> 导出 </a-button>
         </template>
         <template #form-goaf-select>
-          <a-select v-model:value="goafId" :options="goafOptions" placeholder="请选择" />
+          <a-select v-model:value="goafId" :options="goafOptions" placeholder="请选择" @change="historyTable.reload" />
         </template>
       </BasicTable>
     </TabPane>
@@ -169,8 +169,9 @@
       columns,
       // columns: historyColumns,
       api: async (params) => {
+        await initGoafOptions(params.deptId);
         if (!goafId.value) {
-          await initGoafOptions(params.deptId);
+          return Promise.resolve([]);
         }
         params.goafId = goafId.value;
         return getProvinceAlarmHistory(params);
@@ -210,15 +211,15 @@
             field: 'deptId',
             component: 'MineCascader', // 自定义组件名
             componentProps: {
-              initFromStore: true,
+              initFromStore: false,
               syncToStore: false,
               changeOnSelect: false,
-              onChange: (e) => {
-                historyTable.setLoading(true);
-                initGoafOptions(e).finally(() => {
-                  historyTable.setLoading(false);
-                });
-              },
+              // onChange: (e) => {
+              //   historyTable.setLoading(true);
+              //   initGoafOptions(e).finally(() => {
+              //     historyTable.setLoading(false);
+              //   });
+              // },
             },
             colProps: { span: 6 },
             rules: [],

+ 10 - 9
src/views/analysis/warningAnalysis/sealRiskJudgeAnalysis/index.vue

@@ -48,7 +48,7 @@
           <a-button type="default" class="ml-8px" preIcon="mdi:download" @click="onExportXls"> 导出 </a-button>
         </template>
         <template #form-goaf-select>
-          <a-select v-model:value="goafId" :options="goafOptions" placeholder="请选择" />
+          <a-select v-model:value="goafId" :options="goafOptions" placeholder="请选择" @change="historyTable.reload" />
         </template>
       </BasicTable>
     </TabPane>
@@ -145,8 +145,9 @@
       columns,
       // columns: historyColumns,
       api: async (params) => {
+        await initGoafOptions(params.deptId);
         if (!goafId.value) {
-          await initGoafOptions(params.deptId);
+          return Promise.resolve([]);
         }
         params.goafId = goafId.value;
         return getProvinceAlarmHistory(params);
@@ -186,15 +187,15 @@
             field: 'deptId',
             component: 'MineCascader', // 自定义组件名
             componentProps: {
-              initFromStore: true,
+              initFromStore: false,
               syncToStore: false,
               changeOnSelect: false,
-              onChange: (e) => {
-                historyTable.setLoading(true);
-                initGoafOptions(e).finally(() => {
-                  historyTable.setLoading(false);
-                });
-              },
+              // onChange: (e) => {
+              //   historyTable.setLoading(true);
+              //   initGoafOptions(e).finally(() => {
+              //     historyTable.setLoading(false);
+              //   });
+              // },
             },
             colProps: { span: 6 },
             rules: [],

+ 4 - 6
src/views/dashboard/basicInfo/accessStatistics/index.vue

@@ -20,7 +20,8 @@
   import { useMineDepartmentStore } from '/@/store/modules/mine';
   import { advancedRoutePush } from '/@/utils';
 
-  const deptId = ref();
+  const mineStore = useMineDepartmentStore();
+  const deptId = ref(mineStore.getDepartId);
 
   // 封装接口调用,获取数据后手动添加「总计」行
   const fetchTableData = async (params: any) => {
@@ -95,6 +96,7 @@
       slots: { customRender: 'action' },
     },
     scroll: { x: 'max-content' },
+    immediate: true,
   });
 
   /**
@@ -109,15 +111,11 @@
     });
   }
 
-  const mineStore = useMineDepartmentStore();
   watch(
     () => mineStore.getDepartId,
     (v) => {
-      deptId.value = v || mineStore.getRootId;
+      deptId.value = v;
       reload();
-    },
-    {
-      immediate: true,
     }
   );
 </script>

+ 2 - 4
src/views/dashboard/basicInfo/closedStatistics/index.vue

@@ -22,7 +22,7 @@
 
   // 路由实例
   const mineStore = useMineDepartmentStore();
-  const deptId = ref();
+  const deptId = ref(mineStore.getDepartId);
 
   // 注册表格并获取相关方法
   const [registerTable, { reload, setLoading }] = useTable({
@@ -46,6 +46,7 @@
       dataIndex: 'action',
       slots: { customRender: 'action' },
     },
+    immediate: true,
   });
 
   /**
@@ -69,9 +70,6 @@
     (v) => {
       deptId.value = v || mineStore.getRootId;
       reload();
-    },
-    {
-      immediate: true,
     }
   );
 </script>

+ 1 - 1
src/views/monitor/sealedMonitor/hooks/form.ts

@@ -29,7 +29,7 @@ export function useInitForm() {
   function initGoafOptions(deptId) {
     return getGoafSelectOption({ deptId }).then(({ options, defaultValue }) => {
       goafOptions.value = options;
-      if (options.some((e) => e.id === goafId.value)) return;
+      if (options.some((e) => e.value === goafId.value)) return;
       goafId.value = defaultValue;
     });
   }

+ 10 - 9
src/views/monitor/sealedMonitor/index.vue

@@ -28,7 +28,7 @@
           <a-button type="default" class="ml-8px" preIcon="mdi:download" @click="onExportXls"> 导出 </a-button>
         </template>
         <template #form-goaf-select>
-          <a-select v-model:value="goafId" :options="goafOptions" placeholder="请选择" />
+          <a-select v-model:value="goafId" :options="goafOptions" placeholder="请选择" @change="reloadHistory" />
         </template>
         <template #action="{ record }">
           <div class="action-buttons">
@@ -120,8 +120,9 @@
   const { tableContext: ctxHistory, onExportXls } = useListPage({
     tableProps: {
       api: async (params) => {
+        await initGoafOptions(params.deptId);
         if (!goafId.value) {
-          await initGoafOptions(departId);
+          return Promise.resolve([]);
         }
         params.goafId = goafId.value;
         return getGoafHistory(params);
@@ -142,12 +143,12 @@
               initFromStore: false,
               syncToStore: false,
               rootId: departId,
-              onChange(v) {
-                historyTable.setLoading(true);
-                initGoafOptions(v).finally(() => {
-                  historyTable.setLoading(false);
-                });
-              },
+              // onChange(v) {
+              //   historyTable.setLoading(true);
+              //   initGoafOptions(v).finally(() => {
+              //     historyTable.setLoading(false);
+              //   });
+              // },
             },
           },
           ...historicalFormSchema,
@@ -169,7 +170,7 @@
     },
     pagination: true,
   });
-  const [registerHistoryTable, historyTable] = ctxHistory;
+  const [registerHistoryTable, { reload: reloadHistory }] = ctxHistory;
 
   // 弹窗引用
   const [registerRealtimeModal, { openModal: openRealtimeModal }] = useModal();

+ 8 - 6
src/views/system/cadFile/app.ts

@@ -24,15 +24,19 @@ let currentPopup: any = null;
 
 // ===================== 地图初始化部分 =====================
 // 初始化地图
-export const initMap2d = async (container: HTMLElement, config: { fileUrl?: string; style?: vjmap.IMapStyleParam } = {}) => {
+export const initMap2d = async (container: HTMLElement, config: { fileUrl?: string; style?: vjmap.IMapStyleParam; vjId?: string } = {}) => {
   if (!container) {
     message.error('地图容器不存在!');
     throw new Error('地图容器不存在!');
   }
+
   const appStore = useAppStore();
   // const httpDwgUrl = '/resource/test.dwg';
-  const { fileUrl = 'https://vjmap.com/static/assets/data/gym.dwg', style = env.darkTheme ? vjmap.openMapDarkStyle() : vjmap.openMapLightStyle() } =
-    config;
+  const {
+    fileUrl = 'https://vjmap.com/static/assets/data/gym.dwg',
+    style = env.darkTheme ? vjmap.openMapDarkStyle() : vjmap.openMapLightStyle(),
+    vjId,
+  } = config;
 
   container.style.background = 'transparent';
   container.style.width = `${get(container, 'parentElement.clientWidth', 0) / appStore.widthScale}px`;
@@ -41,10 +45,8 @@ export const initMap2d = async (container: HTMLElement, config: { fileUrl?: stri
   svc = new vjmap.Service(env.serviceUrl, env.accessToken);
   if (env.workspace) svc.switchWorkspace(env.workspace);
 
-  style.clipbounds = Math.pow(2, 6);
-
   const res = await svc.openMap({
-    mapid: 'c56c59154345', // 地图ID,上传文件后获得的mapid
+    mapid: vjId || 'c56c59154345', // 地图ID,上传文件后获得的mapid
     version: env.version,
     cbInputPassword: () => {
       return Promise.resolve('hllcad');