|
@@ -22,7 +22,7 @@
|
|
|
import { initMap2d, renderGoafMarkers } from '/@/views/system/cadFile/app';
|
|
import { initMap2d, renderGoafMarkers } from '/@/views/system/cadFile/app';
|
|
|
import { getGoafList } from '/@/views/system/cadFile/cad.api';
|
|
import { getGoafList } from '/@/views/system/cadFile/cad.api';
|
|
|
import LeafPopup from './components/LeafPopup.vue';
|
|
import LeafPopup from './components/LeafPopup.vue';
|
|
|
- import { useDeptWatch } from '/@/hooks/component/useDeptWatcher';
|
|
|
|
|
|
|
+ import { watchTriggerable } from '@vueuse/core';
|
|
|
// import { useGlobSetting } from '/@/hooks/setting';
|
|
// import { useGlobSetting } from '/@/hooks/setting';
|
|
|
|
|
|
|
|
const props = defineProps<{
|
|
const props = defineProps<{
|
|
@@ -247,23 +247,31 @@
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- function initDeptWatcher() {
|
|
|
|
|
- useDeptWatch((id) => {
|
|
|
|
|
- const { source } = map.getLayer(CIRCLE_LAYER_ID) as any;
|
|
|
|
|
- const { features } = map.getSourceData(source);
|
|
|
|
|
- const element = find(features, (e) => e.id === id)?.properties;
|
|
|
|
|
|
|
+ // 监听全局部门变化,因为部门可能是叶部门所以也负责切换地图
|
|
|
|
|
+ const { trigger } = watchTriggerable(
|
|
|
|
|
+ () => mineStore.getDepartId,
|
|
|
|
|
+ async (id) => {
|
|
|
|
|
+ if (props.slience) {
|
|
|
|
|
+ return toggleCADMap(mineStore.getRoot?.isLeaf || false);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ await toggleCADMap(mineStore.getDepart?.isLeaf || mineStore.getRoot?.isLeaf || false);
|
|
|
|
|
|
|
|
- if (!element) return;
|
|
|
|
|
- historyStack.value.push(element);
|
|
|
|
|
- markerClickHandler();
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ const { source } = map.getLayer(CIRCLE_LAYER_ID) as any;
|
|
|
|
|
+ const { features } = map.getSourceData(source);
|
|
|
|
|
+ const element = find(features, (e) => e.id === id)?.properties;
|
|
|
|
|
+
|
|
|
|
|
+ if (!element) return;
|
|
|
|
|
+ historyStack.value.push(element);
|
|
|
|
|
+ markerClickHandler();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ );
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
|
- toggleCADMap(mineStore.getRoot?.isLeaf || false).then(() => {
|
|
|
|
|
- if (props.slience) return;
|
|
|
|
|
- initDeptWatcher();
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ trigger();
|
|
|
|
|
+ // toggleCADMap(mineStore.getRoot?.isLeaf || false).then(() => {
|
|
|
|
|
+ // triggerWatch();
|
|
|
|
|
+ // });
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
onUnmounted(() => {
|
|
onUnmounted(() => {
|