| | |
| | | |
| | | const initialEntryContext = getWorkbenchEntryContext() |
| | | |
| | | function isStationHiddenEntry(tab: WorkbenchTab) { |
| | | return tab === 'station' |
| | | } |
| | | |
| | | function normalizeVisibleTab(tab: WorkbenchTab) { |
| | | return isStationHiddenEntry(tab) ? 'point' : tab |
| | | } |
| | | |
| | | // 页面级筛选与面板展示状态。 |
| | | const activeTab = ref<WorkbenchTab>(initialEntryContext.tab) |
| | | const activeTab = ref<WorkbenchTab>(normalizeVisibleTab(initialEntryContext.tab)) |
| | | const cityValue = ref<string>(initialEntryContext.cityCode) |
| | | const keyword = ref('') |
| | | const leftExpanded = ref(true) |
| | |
| | | const previewImage = ref('') |
| | | const selectShowState = reactive<Record<string, boolean>>({}) |
| | | const selectedCreateTool = ref<WorkbenchTab | ''>('') |
| | | const visibleTabOptions = computed(() => |
| | | tabOptions.filter(item => item.value !== 'station'), |
| | | ) |
| | | const visibleCreateToolOptions = computed(() => |
| | | createToolOptions.filter(item => item.value !== 'station'), |
| | | ) |
| | | |
| | | const selectedCreateToolOption = computed(() => { |
| | | return ( |
| | | createToolOptions.find(item => item.value === selectedCreateTool.value) |
| | | visibleCreateToolOptions.value.find( |
| | | item => item.value === selectedCreateTool.value, |
| | | ) |
| | | || null |
| | | ) |
| | | }) |
| | |
| | | showOperationArea: true, |
| | | showRestrictedArea: true, |
| | | showPoint: true, |
| | | showStation: true, |
| | | showStation: false, |
| | | }) |
| | | const pointDetailData = ref<Entity.Point | null>(null) |
| | | const pointEditSnapshot = ref<string>('') |
| | |
| | | }) |
| | | |
| | | const currentTabLabel = computed( |
| | | () => tabOptions.find(item => item.value === activeTab.value)?.label || '', |
| | | () => visibleTabOptions.value.find(item => item.value === activeTab.value)?.label || '', |
| | | ) |
| | | const currentCityLabel = computed( |
| | | () => |
| | |
| | | } |
| | | |
| | | async function applyWorkbenchEntryPresentation(tab: WorkbenchTab, id: string) { |
| | | if (!id) |
| | | if (!id || isStationHiddenEntry(tab)) |
| | | return |
| | | activeTab.value = tab |
| | | activeTab.value = normalizeVisibleTab(tab) |
| | | if (tab === 'point') |
| | | pointPanelClosed.value = false |
| | | if (tab === 'fence') |
| | |
| | | const entryContext = getWorkbenchEntryContext(cityOptions.value) |
| | | const routeQuery = route.query as Record<string, unknown> |
| | | const cityChanged = cityValue.value !== entryContext.cityCode |
| | | if (activeTab.value !== entryContext.tab) |
| | | activeTab.value = entryContext.tab |
| | | const nextVisibleTab = normalizeVisibleTab(entryContext.tab) |
| | | if (activeTab.value !== nextVisibleTab) |
| | | activeTab.value = nextVisibleTab |
| | | if (cityChanged) |
| | | cityValue.value = entryContext.cityCode |
| | | pendingWorkbenchType.value = entryContext.type || '' |
| | | if (entryContext.id) { |
| | | if (entryContext.id && !isStationHiddenEntry(entryContext.tab)) { |
| | | if (workbenchDataReady.value) |
| | | await applyWorkbenchEntryPresentation(entryContext.tab, entryContext.id) |
| | | else if (selectedId.value !== entryContext.id) |
| | |
| | | else if ( |
| | | !entryContext.id |
| | | && entryContext.type === 'create' |
| | | && !isStationHiddenEntry(entryContext.tab) |
| | | && !cityChanged |
| | | ) { |
| | | handleWorkbenchCreateByTab(entryContext.tab) |
| | |
| | | workbenchDataReady.value = false |
| | | await Promise.all([loadPointResources(), loadFenceData(), loadStationData()]) |
| | | workbenchDataReady.value = true |
| | | const entryContext = getWorkbenchEntryContext(cityOptions.value) |
| | | if (pendingWorkbenchType.value === 'create') { |
| | | pendingWorkbenchType.value = '' |
| | | await handleWorkbenchCreateByTab(activeTab.value) |
| | | if (!isStationHiddenEntry(entryContext.tab)) |
| | | await handleWorkbenchCreateByTab(normalizeVisibleTab(entryContext.tab)) |
| | | return |
| | | } |
| | | if (map.value) { |
| | |
| | | await nextTick() |
| | | focusSelectedEntity(false) |
| | | } |
| | | const entryContext = getWorkbenchEntryContext(cityOptions.value) |
| | | if ( |
| | | !isStationHiddenEntry(entryContext.tab) |
| | | && ( |
| | | entryContext.id |
| | | && (entryContext.type === 'detail' || entryContext.type === 'edit') |
| | | ) |
| | | ) { |
| | | await applyWorkbenchEntryPresentation(entryContext.tab, entryContext.id) |
| | | } |
| | |
| | | |
| | | <div class="left-panel-tabs"> |
| | | <button |
| | | v-for="tab in tabOptions" |
| | | v-for="tab in visibleTabOptions" |
| | | :key="tab.value" |
| | | class="tab-btn" |
| | | :class="{ active: activeTab === tab.value }" |
| | |
| | | </n-popover> |
| | | <div v-if="showCreateMenu" class="coverage-detail create-detail"> |
| | | <div |
| | | v-for="option in createToolOptions" |
| | | v-for="option in visibleCreateToolOptions" |
| | | :key="option.value" |
| | | class="create-option" |
| | | :class="{ active: selectedCreateTool === option.value }" |
| | |
| | | <div class="layer-option"> |
| | | <n-checkbox v-model:checked="layerControl.showPoint"> |
| | | 点位 |
| | | </n-checkbox> |
| | | </div> |
| | | <div class="layer-option"> |
| | | <n-checkbox v-model:checked="layerControl.showStation"> |
| | | 场站 |
| | | </n-checkbox> |
| | | </div> |
| | | </div> |