修改bug,给地图的新建加权限:在未给角色勾选“新增场站”权限的情况下,该角色仍可创建场站
| | |
| | | watch, |
| | | } from 'vue' |
| | | import { onBeforeRouteLeave, useRoute, useRouter } from 'vue-router' |
| | | import { usePermission } from '@/hooks/usePermission' |
| | | import { |
| | | checkPointNameDuplicate, |
| | | createPoint, |
| | |
| | | const router = useRouter() |
| | | const route = useRoute() |
| | | const workbenchStore = useWorkbenchStore() |
| | | const { hasPermission } = usePermission() |
| | | const { VITE_MAP_KEY, VITE_MAP_SECURITY } = import.meta.env; |
| | | |
| | | (window as any)._AMapSecurityConfig = { |
| | |
| | | |
| | | // 正式工作台当前只保留场站新增入口,点位和围栏创建能力先关闭。 |
| | | const availableCreateToolOptions = computed(() => |
| | | createToolOptions.filter(item => item.value === 'station'), |
| | | createToolOptions.filter((item) => { |
| | | if (item.value !== 'station') |
| | | return false |
| | | return !item.permissionCode || hasPermission(item.permissionCode) |
| | | }), |
| | | ) |
| | | const shouldShowCreateTool = computed(() => availableCreateToolOptions.value.length > 0) |
| | | |
| | | const selectedCreateToolOption = computed(() => { |
| | | return ( |
| | |
| | | } |
| | | |
| | | async function toggleCreateMenu() { |
| | | if (!shouldShowCreateTool.value) { |
| | | showCreateMenu.value = false |
| | | return |
| | | } |
| | | if (createToolDisabledReason.value) { |
| | | if (isCreateWorkflowActive.value) { |
| | | await handleDisabledCreateToolTrigger() |
| | |
| | | } |
| | | |
| | | async function handleCreateByType(type: WorkbenchTab) { |
| | | if (!availableCreateToolOptions.value.some(item => item.value === type)) { |
| | | showCreateMenu.value = false |
| | | return |
| | | } |
| | | if (createToolDisabledReason.value) { |
| | | showCreateMenu.value = false |
| | | return |
| | |
| | | }}</span> |
| | | </div> |
| | | |
| | | <div class="tool-menu-wrapper coverage"> |
| | | <div v-if="shouldShowCreateTool" class="tool-menu-wrapper coverage"> |
| | | <div |
| | | class="operate-item" |
| | | :class="{ active: showLayerMenu }" |
| | |
| | | value: WorkbenchTab; |
| | | icon: string; |
| | | activeIcon: string; |
| | | permissionCode?: string | number; |
| | | }; |
| | | |
| | | // 左侧 tab 切换按钮配置。 |
| | |
| | | value: "station", |
| | | icon: createStationDefaultIcon, |
| | | activeIcon: createPointActiveIcon, |
| | | permissionCode: 202642929, |
| | | }, |
| | | ]; |
| | | |
| | |
| | | watch, |
| | | } from 'vue' |
| | | import { onBeforeRouteLeave, useRoute, useRouter } from 'vue-router' |
| | | import { usePermission } from '@/hooks/usePermission' |
| | | import { |
| | | addFence, |
| | | addStation, |
| | |
| | | const router = useRouter() |
| | | const route = useRoute() |
| | | const workbenchStore = useWorkbenchStore() |
| | | const { hasPermission } = usePermission() |
| | | const { VITE_MAP_KEY, VITE_MAP_SECURITY } = import.meta.env; |
| | | |
| | | (window as any)._AMapSecurityConfig = { |
| | |
| | | // 恢复左侧场站 tab 展示;新建场站入口仍通过 createToolOptions 过滤,暂不开放。 |
| | | const visibleTabOptions = computed(() => tabOptions) |
| | | const visibleCreateToolOptions = computed(() => |
| | | createToolOptions.filter(item => item.value !== 'station'), |
| | | createToolOptions.filter((item) => { |
| | | if (item.value === 'station') |
| | | return false |
| | | return !item.permissionCode || hasPermission(item.permissionCode) |
| | | }), |
| | | ) |
| | | const shouldShowCreateTool = computed(() => visibleCreateToolOptions.value.length > 0) |
| | | |
| | | const selectedCreateToolOption = computed(() => { |
| | | return ( |
| | |
| | | } |
| | | |
| | | async function toggleCreateMenu() { |
| | | if (!shouldShowCreateTool.value) { |
| | | showCreateMenu.value = false |
| | | return |
| | | } |
| | | if (createToolDisabledReason.value) { |
| | | if (pointCreateMode.value || fenceCreateMode.value || stationCreateMode.value) { |
| | | await handleDisabledCreateToolTrigger() |
| | |
| | | } |
| | | |
| | | async function handleCreateByType(type: WorkbenchTab) { |
| | | if (!visibleCreateToolOptions.value.some(item => item.value === type)) { |
| | | showCreateMenu.value = false |
| | | return |
| | | } |
| | | if (createToolDisabledReason.value) { |
| | | showCreateMenu.value = false |
| | | return |
| | |
| | | }}</span> |
| | | </div> |
| | | |
| | | <div class="tool-menu-wrapper coverage"> |
| | | <div v-if="shouldShowCreateTool" class="tool-menu-wrapper coverage"> |
| | | <div |
| | | class="operate-item" |
| | | :class="{ active: showLayerMenu }" |
| | |
| | | value: WorkbenchTab; |
| | | icon: string; |
| | | activeIcon: string; |
| | | permissionCode?: string | number; |
| | | }; |
| | | |
| | | // 左侧 tab 切换按钮配置。 |
| | |
| | | value: "point", |
| | | icon: createPointDefaultIcon, |
| | | activeIcon: createPointActiveIcon, |
| | | permissionCode: 2026061507, |
| | | }, |
| | | { |
| | | label: "新建围栏", |
| | | value: "fence", |
| | | icon: createFenceDefaultIcon, |
| | | activeIcon: createPointActiveIcon, |
| | | permissionCode: 2026061504, |
| | | }, |
| | | { |
| | | label: "新建场站", |