Parcourir la source

[Pref 0000] 优化默认通风系统图显示效果

houzekong il y a 11 heures
Parent
commit
3e48d7e051
2 fichiers modifiés avec 10 ajouts et 5 suppressions
  1. 7 2
      src/layouts/default/feature/SimpleMap.vue
  2. 3 3
      src/views/system/cadFile/app.ts

+ 7 - 2
src/layouts/default/feature/SimpleMap.vue

@@ -310,8 +310,13 @@
         // 矿端需要先初始化图纸下拉框,下拉框触发一次change事件调用toggleCADMap,
         // 如果当前选项下没有已选中的地图,那么意味着需要新获取选项,否则无需发请求
         const { records } = await getMineFileList({ deptId: mineStore.getDepartId, pageSize: 999 });
-        fileOptions.value = records;
-        fileId.value = get(records, '[0].wjId');
+
+        if (records.length) {
+          fileOptions.value = records;
+        } else {
+          fileOptions.value = [{ fileName: '默认系统图', wjId: 'c96e7423dab1' }];
+        }
+        fileId.value = get(fileOptions.value, '[0].wjId');
       }
 
       await toggleCADMap(mineStore.getDepart?.isLeaf || false);

+ 3 - 3
src/views/system/cadFile/app.ts

@@ -71,15 +71,15 @@ export function useMap2D(): UseMap2DReturn {
     destroyMap();
 
     const appStore = useAppStore();
-    const { style = vjmap.openMapLightStyle(), wjId } = config;
+    const { style = vjmap.openMapLightStyle(), wjId = 'c96e7423dab1' } = config;
 
     container.style.background = 'transparent';
     container.style.width = `${get(container, 'parentElement.clientWidth', 0) / appStore.widthScale}px`;
     container.style.height = `${get(container, 'parentElement.clientHeight', 0) / appStore.heightScale}px`;
 
     const res = await svc.openMap({
-      mapid: wjId || 'c96e7423dab1',
-      fileid: wjId || 'c96e7423dab1',
+      mapid: wjId,
+      fileid: wjId,
       mapopenway: vjmap.MapOpenWay.GeomRender,
       style,
     });