mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-25 15:49:20 +08:00
825 lines
23 KiB
Vue
825 lines
23 KiB
Vue
<script setup lang="ts">
|
||
import { computed, onMounted, ref } from 'vue'
|
||
import { Button, Card, Input, message, Pagination, Select, Spin, Tree } from 'ant-design-vue'
|
||
import { Page } from '@vben/common-ui'
|
||
import { getPositionPageApi } from '#/api/organization/position'
|
||
import { getCompanyMenuTreeApi } from '#/api/organization/company-menu'
|
||
import { getPositionCompanyMenuIdsApi, batchUpdatePositionCompanyMenusApi } from '#/api/organization/position-permission'
|
||
import type { PositionVO } from '#/api/organization/position/types'
|
||
import type { CompanyMenuVO } from '#/api/organization/company-menu/types'
|
||
|
||
defineOptions({
|
||
name: 'PositionPermissionPage',
|
||
})
|
||
|
||
// 搜索表单
|
||
const searchForm = ref({
|
||
name: '',
|
||
status: undefined as number | undefined,
|
||
})
|
||
|
||
// 岗位列表
|
||
const positionList = ref<PositionVO.PositionInfoVO[]>([])
|
||
const positionLoading = ref(false)
|
||
const positionPagination = ref({
|
||
current: 1,
|
||
pageSize: 10,
|
||
total: 0,
|
||
})
|
||
|
||
// 当前选中的岗位
|
||
const currentPosition = ref<PositionVO.PositionInfoVO | null>(null)
|
||
|
||
// 公司菜单树数据
|
||
const companyMenuTree = ref<CompanyMenuVO.CompanyMenuInfo[]>([])
|
||
const menuTreeLoading = ref(false)
|
||
|
||
// 岗位权限菜单ID列表
|
||
const positionMenuIds = ref<number[]>([])
|
||
const permissionLoading = ref(false)
|
||
|
||
// 选中的菜单ID(用于树形控件)
|
||
const checkedKeys = ref<number[]>([])
|
||
const expandedKeys = ref<number[]>([])
|
||
|
||
// 分组选择
|
||
const selectedGroup = ref<'super' | 'normal' | undefined>(undefined)
|
||
|
||
// 分组选项
|
||
const groupOptions = [
|
||
{ label: '超管菜单', value: 'super' as const },
|
||
{ label: '普通菜单', value: 'normal' as const },
|
||
]
|
||
|
||
// 搜索岗位列表
|
||
async function searchPositions() {
|
||
positionLoading.value = true
|
||
try {
|
||
const params = {
|
||
page: positionPagination.value.current,
|
||
pageSize: positionPagination.value.pageSize,
|
||
filters: {
|
||
name: searchForm.value.name || undefined,
|
||
status: searchForm.value.status,
|
||
},
|
||
}
|
||
|
||
const result = await getPositionPageApi(params)
|
||
positionList.value = result.records
|
||
positionPagination.value.total = result.total
|
||
} catch (error: any) {
|
||
message.error(error?.message || '获取岗位列表失败')
|
||
} finally {
|
||
positionLoading.value = false
|
||
}
|
||
}
|
||
|
||
// 加载公司菜单树
|
||
async function loadCompanyMenuTree() {
|
||
menuTreeLoading.value = true
|
||
try {
|
||
const result = await getCompanyMenuTreeApi()
|
||
companyMenuTree.value = result
|
||
// 自动展开所有节点
|
||
expandedKeys.value = getAllMenuIds(result)
|
||
} catch (error: any) {
|
||
message.error(error?.message || '获取菜单树失败')
|
||
} finally {
|
||
menuTreeLoading.value = false
|
||
}
|
||
}
|
||
|
||
// 获取所有菜单ID(递归)
|
||
function getAllMenuIds(menus: CompanyMenuVO.CompanyMenuInfo[]): number[] {
|
||
const ids: number[] = []
|
||
function traverse(menuList: CompanyMenuVO.CompanyMenuInfo[]) {
|
||
menuList.forEach(menu => {
|
||
ids.push(menu.id)
|
||
if (menu.children && menu.children.length > 0) {
|
||
traverse(menu.children)
|
||
}
|
||
})
|
||
}
|
||
traverse(menus)
|
||
return ids
|
||
}
|
||
|
||
// 将菜单数据转换为Tree组件需要的格式
|
||
function convertToTreeData(menus: CompanyMenuVO.CompanyMenuInfo[]): any[] {
|
||
return menus.map(menu => ({
|
||
key: menu.id,
|
||
title: menu.name,
|
||
type: menu.type,
|
||
superMenu: menu.superMenu,
|
||
status: menu.status,
|
||
disabled: menu.status === 0,
|
||
children: menu.children && menu.children.length > 0 ? convertToTreeData(menu.children) : undefined,
|
||
}))
|
||
}
|
||
|
||
// 选择岗位
|
||
async function selectPosition(position: PositionVO.PositionInfoVO) {
|
||
currentPosition.value = position
|
||
await loadPositionPermissions()
|
||
}
|
||
|
||
// 加载岗位权限
|
||
async function loadPositionPermissions() {
|
||
if (!currentPosition.value?.id) return
|
||
|
||
permissionLoading.value = true
|
||
try {
|
||
const result = await getPositionCompanyMenuIdsApi(currentPosition.value.id)
|
||
positionMenuIds.value = result
|
||
|
||
// 清理根节点,只保留叶子节点
|
||
const leafMenuIds = cleanRootNodes(result)
|
||
checkedKeys.value = leafMenuIds
|
||
} catch (error: any) {
|
||
message.error(error?.message || '获取岗位权限失败')
|
||
} finally {
|
||
permissionLoading.value = false
|
||
}
|
||
}
|
||
|
||
// 清理根节点,只保留叶子节点
|
||
function cleanRootNodes(menuIds: number[]): number[] {
|
||
return menuIds.filter((menuId) => {
|
||
const menu = findMenuById(menuId)
|
||
if (!menu) return false
|
||
|
||
// 检查是否有其他菜单将此菜单作为父菜单
|
||
const hasChildren = hasMenuChildren(menuId)
|
||
|
||
// 只保留叶子节点(没有子节点的菜单)
|
||
return !hasChildren
|
||
})
|
||
}
|
||
|
||
// 根据ID查找菜单
|
||
function findMenuById(menuId: number): CompanyMenuVO.CompanyMenuInfo | null {
|
||
function search(menus: CompanyMenuVO.CompanyMenuInfo[]): CompanyMenuVO.CompanyMenuInfo | null {
|
||
for (const menu of menus) {
|
||
if (menu.id === menuId) return menu
|
||
if (menu.children && menu.children.length > 0) {
|
||
const found = search(menu.children)
|
||
if (found) return found
|
||
}
|
||
}
|
||
return null
|
||
}
|
||
return search(companyMenuTree.value)
|
||
}
|
||
|
||
// 检查菜单是否有子菜单
|
||
function hasMenuChildren(menuId: number): boolean {
|
||
function search(menus: CompanyMenuVO.CompanyMenuInfo[]): boolean {
|
||
for (const menu of menus) {
|
||
if (menu.children && menu.children.length > 0) {
|
||
if (menu.children.some(child => child.id === menuId)) return true
|
||
if (search(menu.children)) return true
|
||
}
|
||
}
|
||
return false
|
||
}
|
||
return search(companyMenuTree.value)
|
||
}
|
||
|
||
// 确保提交时包含必要的父菜单ID(递归添加所有层级的父菜单)
|
||
function ensureParentMenuIds(menuIds: number[]): number[] {
|
||
const result = new Set(menuIds)
|
||
|
||
// 递归添加所有父菜单ID
|
||
function addAllParentIds(menuId: number) {
|
||
const menu = findMenuById(menuId)
|
||
if (menu && menu.parentId) {
|
||
result.add(menu.parentId)
|
||
// 递归添加父菜单的父菜单
|
||
addAllParentIds(menu.parentId)
|
||
}
|
||
}
|
||
|
||
// 为每个选中的菜单添加其所有父菜单ID
|
||
menuIds.forEach((menuId) => {
|
||
addAllParentIds(menuId)
|
||
})
|
||
|
||
return [...result]
|
||
}
|
||
|
||
// 保存岗位权限
|
||
async function savePositionPermissions() {
|
||
if (!currentPosition.value?.id) return
|
||
|
||
try {
|
||
// 确保提交时包含必要的父菜单ID
|
||
const finalMenuIds = ensureParentMenuIds(checkedKeys.value)
|
||
await batchUpdatePositionCompanyMenusApi(currentPosition.value.id, finalMenuIds)
|
||
message.success('权限配置保存成功')
|
||
|
||
// 重新加载权限数据
|
||
await loadPositionPermissions()
|
||
} catch (error: any) {
|
||
message.error(error?.message || '保存失败')
|
||
}
|
||
}
|
||
|
||
// 一键全选
|
||
function handleSelectAll() {
|
||
// 获取所有可选择的菜单ID(排除禁用的)
|
||
let selectableMenus = getAllSelectableMenus()
|
||
|
||
// 如果选择了分组,则只选择该分组的菜单
|
||
if (selectedGroup.value) {
|
||
if (selectedGroup.value === 'super') {
|
||
selectableMenus = selectableMenus.filter((menu) => menu.superMenu === 1)
|
||
} else if (selectedGroup.value === 'normal') {
|
||
selectableMenus = selectableMenus.filter((menu) => menu.superMenu !== 1)
|
||
}
|
||
}
|
||
|
||
// 只选择叶子节点(没有子节点的菜单)
|
||
const leafMenus = selectableMenus.filter((menu) => {
|
||
return !hasMenuChildren(menu.id)
|
||
})
|
||
|
||
if (selectedGroup.value) {
|
||
// 保留其他分组的选中状态,只替换当前分组的选中状态
|
||
const otherGroupCheckedKeys = checkedKeys.value.filter((id) => {
|
||
const menu = findMenuById(id)
|
||
if (!menu) return false
|
||
|
||
if (selectedGroup.value === 'super') {
|
||
return menu.superMenu !== 1
|
||
} else if (selectedGroup.value === 'normal') {
|
||
return menu.superMenu === 1
|
||
}
|
||
return false
|
||
})
|
||
checkedKeys.value = [...otherGroupCheckedKeys, ...leafMenus.map((menu) => menu.id)]
|
||
} else {
|
||
// 如果没有选择分组,全选所有叶子节点
|
||
checkedKeys.value = leafMenus.map((menu) => menu.id)
|
||
}
|
||
}
|
||
|
||
// 取消全选
|
||
function handleSelectNone() {
|
||
if (selectedGroup.value) {
|
||
// 如果选择了分组,只取消该分组的叶子节点选中状态
|
||
const leafMenuIds = getAllSelectableMenus()
|
||
.filter((menu) => {
|
||
// 只处理叶子节点
|
||
if (hasMenuChildren(menu.id)) return false
|
||
|
||
// 根据分组过滤
|
||
if (selectedGroup.value === 'super') {
|
||
return menu.superMenu === 1
|
||
} else if (selectedGroup.value === 'normal') {
|
||
return menu.superMenu !== 1
|
||
}
|
||
return false
|
||
})
|
||
.map((menu) => menu.id)
|
||
|
||
checkedKeys.value = checkedKeys.value.filter((id) => !leafMenuIds.includes(id))
|
||
} else {
|
||
// 如果没有选择分组,取消所有叶子节点的选中状态
|
||
const allLeafMenuIds = getAllSelectableMenus()
|
||
.filter((menu) => !hasMenuChildren(menu.id))
|
||
.map((menu) => menu.id)
|
||
|
||
checkedKeys.value = checkedKeys.value.filter((id) => !allLeafMenuIds.includes(id))
|
||
}
|
||
}
|
||
|
||
// 获取所有可选择的菜单
|
||
function getAllSelectableMenus(): CompanyMenuVO.CompanyMenuInfo[] {
|
||
const result: CompanyMenuVO.CompanyMenuInfo[] = []
|
||
|
||
function traverse(menus: CompanyMenuVO.CompanyMenuInfo[]) {
|
||
menus.forEach(menu => {
|
||
if (menu.status === 1) { // 只包含启用的菜单
|
||
result.push(menu)
|
||
}
|
||
if (menu.children && menu.children.length > 0) {
|
||
traverse(menu.children)
|
||
}
|
||
})
|
||
}
|
||
|
||
traverse(companyMenuTree.value)
|
||
return result
|
||
}
|
||
|
||
// 处理树形控件的选中变化
|
||
function handleTreeCheckChange(checkedKeysValue: any) {
|
||
checkedKeys.value = checkedKeysValue
|
||
}
|
||
|
||
// 计算统计信息
|
||
const stats = computed(() => {
|
||
const totalMenus = getAllSelectableMenus().length
|
||
const positionMenus = positionMenuIds.value.length
|
||
const selectedMenus = ensureParentMenuIds(checkedKeys.value).length
|
||
return {
|
||
total: totalMenus,
|
||
position: positionMenus,
|
||
selected: selectedMenus,
|
||
}
|
||
})
|
||
|
||
// 重置搜索
|
||
function resetSearch() {
|
||
searchForm.value = {
|
||
name: '',
|
||
status: undefined,
|
||
}
|
||
positionPagination.value.current = 1
|
||
searchPositions()
|
||
}
|
||
|
||
// 分页变化
|
||
function handlePageChange(page: number, pageSize: number) {
|
||
positionPagination.value.current = page
|
||
positionPagination.value.pageSize = pageSize
|
||
searchPositions()
|
||
}
|
||
|
||
// 初始化
|
||
onMounted(() => {
|
||
searchPositions()
|
||
loadCompanyMenuTree()
|
||
})
|
||
</script>
|
||
|
||
<template>
|
||
<Page
|
||
title="岗位权限管理"
|
||
description="管理岗位的菜单权限配置"
|
||
:auto-content-height="false"
|
||
>
|
||
<div class="position-permission-container">
|
||
<!-- 左栏:岗位列表 -->
|
||
<div class="left-panel">
|
||
<Card title="岗位列表" class="position-card">
|
||
<!-- 搜索区域 -->
|
||
<div class="search-section">
|
||
<div class="search-form">
|
||
<Input
|
||
v-model:value="searchForm.name"
|
||
placeholder="请输入岗位名称"
|
||
allow-clear
|
||
style="width: 200px; margin-right: 8px"
|
||
/>
|
||
<Select
|
||
v-model:value="searchForm.status"
|
||
placeholder="请选择状态"
|
||
allow-clear
|
||
style="width: 120px; margin-right: 8px"
|
||
>
|
||
<Select.Option :value="1">启用</Select.Option>
|
||
<Select.Option :value="0">禁用</Select.Option>
|
||
</Select>
|
||
<Button type="primary" @click="searchPositions">
|
||
搜索
|
||
</Button>
|
||
<Button @click="resetSearch">
|
||
重置
|
||
</Button>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- 岗位列表 -->
|
||
<div class="position-list">
|
||
<Spin :spinning="positionLoading">
|
||
<div class="position-items">
|
||
<div
|
||
v-for="position in positionList"
|
||
:key="position.id"
|
||
class="position-item"
|
||
:class="{ active: currentPosition?.id === position.id }"
|
||
@click="selectPosition(position)"
|
||
>
|
||
<div class="position-info">
|
||
<div class="position-name">{{ position.name }}</div>
|
||
<div class="position-meta">
|
||
<Tag :color="position.status === 1 ? 'green' : 'red'">
|
||
{{ position.status === 1 ? '启用' : '禁用' }}
|
||
</Tag>
|
||
<span class="position-code">{{ position.code }}</span>
|
||
</div>
|
||
<div class="position-remark" v-if="position.remark">
|
||
{{ position.remark }}
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</Spin>
|
||
|
||
<!-- 分页 -->
|
||
<div class="pagination-wrapper">
|
||
<Pagination
|
||
v-model:current="positionPagination.current"
|
||
v-model:page-size="positionPagination.pageSize"
|
||
:total="positionPagination.total"
|
||
:show-size-changer="true"
|
||
:show-quick-jumper="true"
|
||
:show-total="(total) => `共 ${total} 条`"
|
||
@change="handlePageChange"
|
||
/>
|
||
</div>
|
||
</div>
|
||
</Card>
|
||
</div>
|
||
|
||
<!-- 右栏:权限管理 -->
|
||
<div class="right-panel">
|
||
<Card title="权限管理" class="permission-card">
|
||
<template v-if="currentPosition">
|
||
<!-- 当前岗位信息 -->
|
||
<div class="current-position">
|
||
<div class="position-header">
|
||
<span class="position-name">{{ currentPosition.name }}</span>
|
||
<Tag :color="currentPosition.status === 1 ? 'green' : 'red'">
|
||
{{ currentPosition.status === 1 ? '启用' : '禁用' }}
|
||
</Tag>
|
||
</div>
|
||
<div class="position-details">
|
||
<span class="position-code">编码:{{ currentPosition.code }}</span>
|
||
<span class="position-company">公司ID:{{ currentPosition.companyId }}</span>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- 统计信息 -->
|
||
<div class="stats-section">
|
||
<div class="stats-left">
|
||
<div class="stat-item">
|
||
<span class="label">系统菜单:</span>
|
||
<span class="value">{{ stats.total }}</span>
|
||
</div>
|
||
<div class="stat-item">
|
||
<span class="label">已配置:</span>
|
||
<span class="value success">{{ stats.position }}</span>
|
||
</div>
|
||
<div class="stat-item">
|
||
<span class="label">当前选择:</span>
|
||
<span class="value primary">{{ stats.selected }}</span>
|
||
</div>
|
||
</div>
|
||
<div class="stats-right">
|
||
<Select
|
||
v-model:value="selectedGroup"
|
||
placeholder="选择分组"
|
||
allow-clear
|
||
style="width: 120px; margin-right: 8px"
|
||
>
|
||
<Select.Option
|
||
v-for="option in groupOptions"
|
||
:key="option.value || 'all'"
|
||
:value="option.value"
|
||
>
|
||
{{ option.label }}
|
||
</Select.Option>
|
||
</Select>
|
||
<Button type="primary" @click="handleSelectAll">
|
||
一键全选
|
||
</Button>
|
||
<Button @click="handleSelectNone">
|
||
取消全选
|
||
</Button>
|
||
<Button type="primary" @click="savePositionPermissions">
|
||
保存权限
|
||
</Button>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- 菜单树 -->
|
||
<div class="menu-tree-container">
|
||
<Spin :spinning="permissionLoading">
|
||
<Tree
|
||
v-model:checked-keys="checkedKeys"
|
||
v-model:expanded-keys="expandedKeys"
|
||
:tree-data="convertToTreeData(companyMenuTree)"
|
||
checkable
|
||
class="menu-tree"
|
||
@check="handleTreeCheckChange"
|
||
>
|
||
<template #title="{ title, status, disabled, superMenu }">
|
||
<div class="menu-item">
|
||
<span class="menu-name">{{ title }}</span>
|
||
<span v-if="superMenu === 1" class="menu-tag super">
|
||
超管
|
||
</span>
|
||
<span v-if="status === 0" class="menu-status disabled">
|
||
已禁用
|
||
</span>
|
||
<span v-if="disabled" class="menu-status disabled">
|
||
不可选择
|
||
</span>
|
||
</div>
|
||
</template>
|
||
</Tree>
|
||
</Spin>
|
||
</div>
|
||
</template>
|
||
|
||
<div v-else class="no-selection">
|
||
<div class="no-selection-content">
|
||
<div class="no-selection-icon">👈</div>
|
||
<div class="no-selection-text">请先选择一个岗位</div>
|
||
</div>
|
||
</div>
|
||
</Card>
|
||
</div>
|
||
</div>
|
||
</Page>
|
||
</template>
|
||
|
||
<style lang="scss" scoped>
|
||
.position-permission-container {
|
||
display: flex;
|
||
height: 100%;
|
||
gap: 16px;
|
||
|
||
.left-panel {
|
||
width: 400px;
|
||
flex-shrink: 0;
|
||
|
||
.position-card {
|
||
height: 100%;
|
||
display: flex;
|
||
flex-direction: column;
|
||
|
||
:deep(.ant-card-body) {
|
||
flex: 1;
|
||
display: flex;
|
||
flex-direction: column;
|
||
padding: 16px;
|
||
}
|
||
|
||
.search-section {
|
||
margin-bottom: 16px;
|
||
flex-shrink: 0;
|
||
|
||
.search-form {
|
||
display: flex;
|
||
flex-wrap: wrap;
|
||
gap: 8px;
|
||
align-items: center;
|
||
}
|
||
}
|
||
|
||
.position-list {
|
||
flex: 1;
|
||
display: flex;
|
||
flex-direction: column;
|
||
min-height: 0;
|
||
|
||
.position-items {
|
||
flex: 1;
|
||
overflow-y: auto;
|
||
margin-bottom: 16px;
|
||
|
||
.position-item {
|
||
padding: 12px;
|
||
margin-bottom: 8px;
|
||
border: 1px solid var(--border);
|
||
border-radius: 6px;
|
||
cursor: pointer;
|
||
transition: all 0.2s;
|
||
background-color: var(--background-color);
|
||
|
||
&:hover {
|
||
border-color: var(--primary);
|
||
background-color: var(--primary-light);
|
||
}
|
||
|
||
&.active {
|
||
border-color: var(--primary);
|
||
background-color: var(--primary-light);
|
||
box-shadow: 0 2px 8px rgba(24, 144, 255, 0.2);
|
||
}
|
||
|
||
.position-info {
|
||
.position-name {
|
||
font-size: 14px;
|
||
font-weight: 600;
|
||
color: var(--text-primary);
|
||
margin-bottom: 4px;
|
||
}
|
||
|
||
.position-meta {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 8px;
|
||
margin-bottom: 4px;
|
||
|
||
.position-code {
|
||
font-size: 12px;
|
||
color: var(--text-secondary);
|
||
}
|
||
}
|
||
|
||
.position-remark {
|
||
font-size: 12px;
|
||
color: var(--text-secondary);
|
||
line-height: 1.4;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
.pagination-wrapper {
|
||
flex-shrink: 0;
|
||
display: flex;
|
||
justify-content: center;
|
||
padding-top: 16px;
|
||
border-top: 1px solid var(--border);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
.right-panel {
|
||
flex: 1;
|
||
min-width: 0;
|
||
|
||
.permission-card {
|
||
height: 100%;
|
||
display: flex;
|
||
flex-direction: column;
|
||
|
||
:deep(.ant-card-body) {
|
||
flex: 1;
|
||
display: flex;
|
||
flex-direction: column;
|
||
padding: 16px;
|
||
}
|
||
|
||
.current-position {
|
||
padding: 16px;
|
||
background-color: var(--background-secondary);
|
||
border-radius: 6px;
|
||
margin-bottom: 16px;
|
||
flex-shrink: 0;
|
||
|
||
.position-header {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 8px;
|
||
margin-bottom: 8px;
|
||
|
||
.position-name {
|
||
font-size: 16px;
|
||
font-weight: 600;
|
||
color: var(--text-primary);
|
||
}
|
||
}
|
||
|
||
.position-details {
|
||
display: flex;
|
||
gap: 16px;
|
||
font-size: 12px;
|
||
color: var(--text-secondary);
|
||
|
||
.position-code,
|
||
.position-company {
|
||
display: flex;
|
||
align-items: center;
|
||
}
|
||
}
|
||
}
|
||
|
||
.stats-section {
|
||
display: flex;
|
||
justify-content: space-between;
|
||
align-items: center;
|
||
gap: 16px;
|
||
padding: 12px 16px;
|
||
background-color: var(--background-secondary);
|
||
border-radius: 6px;
|
||
margin-bottom: 16px;
|
||
flex-shrink: 0;
|
||
|
||
.stats-left {
|
||
display: flex;
|
||
gap: 16px;
|
||
}
|
||
|
||
.stats-right {
|
||
display: flex;
|
||
gap: 8px;
|
||
}
|
||
|
||
.stat-item {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 4px;
|
||
|
||
.label {
|
||
font-size: 12px;
|
||
color: var(--text-secondary);
|
||
}
|
||
|
||
.value {
|
||
font-weight: 600;
|
||
font-size: 14px;
|
||
|
||
&.success {
|
||
color: var(--success);
|
||
}
|
||
|
||
&.primary {
|
||
color: var(--primary);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
.menu-tree-container {
|
||
flex: 1;
|
||
overflow-y: auto;
|
||
min-height: 0;
|
||
|
||
.menu-tree {
|
||
padding: 12px;
|
||
border: 1px solid var(--border);
|
||
border-radius: 6px;
|
||
|
||
.menu-item {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 8px;
|
||
|
||
.menu-name {
|
||
font-weight: 500;
|
||
color: var(--text-primary);
|
||
}
|
||
|
||
.menu-tag {
|
||
font-size: 12px;
|
||
padding: 2px 6px;
|
||
border-radius: 3px;
|
||
|
||
&.super {
|
||
color: var(--warning);
|
||
background-color: var(--warning-light);
|
||
}
|
||
}
|
||
|
||
.menu-status {
|
||
font-size: 12px;
|
||
padding: 2px 6px;
|
||
border-radius: 3px;
|
||
|
||
&.disabled {
|
||
color: var(--error);
|
||
background-color: var(--error-light);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
.no-selection {
|
||
flex: 1;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
|
||
.no-selection-content {
|
||
text-align: center;
|
||
color: var(--text-secondary);
|
||
|
||
.no-selection-icon {
|
||
font-size: 48px;
|
||
margin-bottom: 16px;
|
||
}
|
||
|
||
.no-selection-text {
|
||
font-size: 16px;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
// 响应式设计
|
||
@media (max-width: 1200px) {
|
||
.position-permission-container {
|
||
flex-direction: column;
|
||
|
||
.left-panel {
|
||
width: 100%;
|
||
height: 300px;
|
||
}
|
||
|
||
.right-panel {
|
||
height: calc(100vh - 300px - 32px);
|
||
}
|
||
}
|
||
}
|
||
</style>
|