mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-25 09:49:20 +08:00
wip: 岗位权限
This commit is contained in:
+7
-7
@@ -7,7 +7,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
import top.xyquan.ecomdmbbackend.common.response.ApiResponse;
|
import top.xyquan.ecomdmbbackend.common.response.ApiResponse;
|
||||||
import top.xyquan.ecomdmbbackend.modules.org.service.CompanyMenuService;
|
import top.xyquan.ecomdmbbackend.modules.org.service.CompanyMenuService;
|
||||||
import top.xyquan.ecomdmbbackend.common.annotation.RequireRole;
|
import top.xyquan.ecomdmbbackend.common.annotation.RequireRole;
|
||||||
import top.xyquan.ecomdmbbackend.modules.sys.model.vo.MenuVO;
|
import top.xyquan.ecomdmbbackend.modules.org.model.vo.CompanyMenuVO;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -44,19 +44,19 @@ public class CompanyMenuController {
|
|||||||
return ApiResponse.success();
|
return ApiResponse.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "获取公司所有菜单列表", description = "获取当前用户公司的所有菜单列表,中间表只作为过滤条件,不覆盖系统菜单字段")
|
@Operation(summary = "获取公司所有菜单列表", description = "获取当前用户公司的所有菜单列表,包含公司菜单中间表ID,中间表只作为过滤条件,不覆盖系统菜单字段")
|
||||||
@GetMapping("/menus")
|
@GetMapping("/menus")
|
||||||
@RequireRole(description = "获取公司菜单列表", allowUser = false)
|
@RequireRole(description = "获取公司菜单列表", allowUser = false)
|
||||||
public ApiResponse<List<MenuVO>> getCompanyMenus() {
|
public ApiResponse<List<CompanyMenuVO>> getCompanyMenus() {
|
||||||
List<MenuVO> menus = companyMenuService.getCompanyMenus();
|
List<CompanyMenuVO> menus = companyMenuService.getCompanyMenus();
|
||||||
return ApiResponse.success(menus);
|
return ApiResponse.success(menus);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "获取公司完整菜单树", description = "获取当前用户公司的完整菜单树结构,中间表只作为过滤条件,不覆盖系统菜单字段")
|
@Operation(summary = "获取公司完整菜单树", description = "获取当前用户公司的完整菜单树结构,包含公司菜单中间表ID,中间表只作为过滤条件,不覆盖系统菜单字段")
|
||||||
@GetMapping("/menu-tree")
|
@GetMapping("/menu-tree")
|
||||||
@RequireRole(description = "获取公司菜单树", allowUser = false)
|
@RequireRole(description = "获取公司菜单树", allowUser = false)
|
||||||
public ApiResponse<List<MenuVO>> getCompanyMenuTree() {
|
public ApiResponse<List<CompanyMenuVO>> getCompanyMenuTree() {
|
||||||
List<MenuVO> menuTree = companyMenuService.getCompanyMenuTree();
|
List<CompanyMenuVO> menuTree = companyMenuService.getCompanyMenuTree();
|
||||||
return ApiResponse.success(menuTree);
|
return ApiResponse.success(menuTree);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+7
-57
@@ -1,69 +1,19 @@
|
|||||||
package top.xyquan.ecomdmbbackend.modules.org.model.vo;
|
package top.xyquan.ecomdmbbackend.modules.org.model.vo;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
import top.xyquan.ecomdmbbackend.modules.sys.model.vo.MenuVO;
|
import top.xyquan.ecomdmbbackend.modules.sys.model.vo.MenuVO;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 公司菜单VO
|
* 公司菜单VO
|
||||||
|
* 继承MenuVO,添加公司菜单中间表ID字段
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@Schema(description = "公司菜单VO")
|
@EqualsAndHashCode(callSuper = true)
|
||||||
public class CompanyMenuVO {
|
public class CompanyMenuVO extends MenuVO {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 公司ID
|
* 公司菜单中间表ID
|
||||||
*/
|
*/
|
||||||
@Schema(description = "公司ID", example = "1")
|
private Long companyMenuId;
|
||||||
private Long id;
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 公司名称
|
|
||||||
*/
|
|
||||||
@Schema(description = "公司名称", example = "某某科技有限公司")
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 公司地址
|
|
||||||
*/
|
|
||||||
@Schema(description = "公司地址", example = "北京市朝阳区xxx街道xxx号")
|
|
||||||
private String address;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 联系人
|
|
||||||
*/
|
|
||||||
@Schema(description = "联系人", example = "张三")
|
|
||||||
private String contactPerson;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 联系电话
|
|
||||||
*/
|
|
||||||
@Schema(description = "联系电话", example = "13800138000")
|
|
||||||
private String contactPhone;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 邮箱
|
|
||||||
*/
|
|
||||||
@Schema(description = "邮箱", example = "contact@company.com")
|
|
||||||
private String email;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* logo
|
|
||||||
*/
|
|
||||||
@Schema(description = "公司logo", example = "https://example.com/logo.png")
|
|
||||||
private String logo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 状态 (0-禁用 1-正常)
|
|
||||||
*/
|
|
||||||
@Schema(description = "公司状态", example = "1", allowableValues = { "0", "1" })
|
|
||||||
private Integer status;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 菜单列表
|
|
||||||
*/
|
|
||||||
@Schema(description = "菜单列表")
|
|
||||||
private List<MenuVO> menus;
|
|
||||||
}
|
|
||||||
+2
-2
@@ -50,13 +50,13 @@ public interface CompanyMenuService extends IService<CompanyMenuPO> {
|
|||||||
*
|
*
|
||||||
* @return 菜单列表
|
* @return 菜单列表
|
||||||
*/
|
*/
|
||||||
List<MenuVO> getCompanyMenus();
|
List<CompanyMenuVO> getCompanyMenus();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取公司完整菜单树
|
* 获取公司完整菜单树
|
||||||
*
|
*
|
||||||
* @return 菜单树列表
|
* @return 菜单树列表
|
||||||
*/
|
*/
|
||||||
List<MenuVO> getCompanyMenuTree();
|
List<CompanyMenuVO> getCompanyMenuTree();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+75
-7
@@ -214,7 +214,7 @@ public class CompanyMenuServiceImpl extends ServiceImpl<CompanyMenuMapper, Compa
|
|||||||
* @return 菜单列表
|
* @return 菜单列表
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<MenuVO> getCompanyMenus() {
|
public List<CompanyMenuVO> getCompanyMenus() {
|
||||||
// 从用户上下文获取公司ID
|
// 从用户上下文获取公司ID
|
||||||
Long companyId = currentUserContext.getCurrentCompanyId();
|
Long companyId = currentUserContext.getCurrentCompanyId();
|
||||||
if (companyId == null) {
|
if (companyId == null) {
|
||||||
@@ -244,9 +244,13 @@ public class CompanyMenuServiceImpl extends ServiceImpl<CompanyMenuMapper, Compa
|
|||||||
|
|
||||||
List<MenuPO> menus = menuService.list(menuWrapper);
|
List<MenuPO> menus = menuService.list(menuWrapper);
|
||||||
|
|
||||||
// 转换为MenuVO,不覆盖自定义字段
|
// 构建公司菜单ID到CompanyMenuPO的映射
|
||||||
|
Map<Long, CompanyMenuPO> companyMenuMap = companyMenus.stream()
|
||||||
|
.collect(Collectors.toMap(CompanyMenuPO::getMenuId, cm -> cm));
|
||||||
|
|
||||||
|
// 转换为CompanyMenuVO,包含companyMenuId
|
||||||
return menus.stream()
|
return menus.stream()
|
||||||
.map(this::convertMenuToVO)
|
.map(menu -> convertToCompanyMenuVO(menu, companyMenuMap.get(menu.getId())))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -255,16 +259,28 @@ public class CompanyMenuServiceImpl extends ServiceImpl<CompanyMenuMapper, Compa
|
|||||||
* @return 菜单树列表
|
* @return 菜单树列表
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<MenuVO> getCompanyMenuTree() {
|
public List<CompanyMenuVO> getCompanyMenuTree() {
|
||||||
// 获取公司所有菜单列表
|
// 获取公司所有菜单列表
|
||||||
List<MenuVO> menuList = getCompanyMenus();
|
List<CompanyMenuVO> menuList = getCompanyMenus();
|
||||||
|
|
||||||
// 构建树形结构
|
// 构建树形结构
|
||||||
return buildMenuTree(menuList);
|
return buildCompanyMenuTree(menuList);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 构建菜单树
|
* 构建公司菜单树
|
||||||
|
*/
|
||||||
|
private List<CompanyMenuVO> buildCompanyMenuTree(List<CompanyMenuVO> menuList) {
|
||||||
|
// 按父ID分组
|
||||||
|
Map<Long, List<CompanyMenuVO>> parentMap = menuList.stream()
|
||||||
|
.collect(Collectors.groupingBy(menu -> menu.getParentId() != null ? menu.getParentId() : 0L));
|
||||||
|
|
||||||
|
// 递归构建树
|
||||||
|
return buildCompanyMenuTreeRecursive(parentMap, 0L, new ArrayList<>(), 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 构建菜单树(保留原方法用于其他用途)
|
||||||
*/
|
*/
|
||||||
private List<MenuVO> buildMenuTree(List<MenuVO> menuList) {
|
private List<MenuVO> buildMenuTree(List<MenuVO> menuList) {
|
||||||
// 按父ID分组
|
// 按父ID分组
|
||||||
@@ -308,6 +324,58 @@ public class CompanyMenuServiceImpl extends ServiceImpl<CompanyMenuMapper, Compa
|
|||||||
return children;
|
return children;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 递归构建公司菜单树形结构(带循环引用检测)
|
||||||
|
*/
|
||||||
|
private List<CompanyMenuVO> buildCompanyMenuTreeRecursive(Map<Long, List<CompanyMenuVO>> parentMap, Long parentId,
|
||||||
|
List<Long> visitedIds, int depth) {
|
||||||
|
// 防止无限递归,设置最大深度限制
|
||||||
|
if (depth > 100) {
|
||||||
|
throw new BusinessException("菜单层级过深,可能存在循环引用");
|
||||||
|
}
|
||||||
|
|
||||||
|
List<CompanyMenuVO> children = parentMap.get(parentId);
|
||||||
|
if (children == null) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
for (CompanyMenuVO menu : children) {
|
||||||
|
// 检查是否已经访问过该节点,防止循环引用
|
||||||
|
if (visitedIds.contains(menu.getId())) {
|
||||||
|
throw new BusinessException("检测到菜单循环引用,菜单ID: " + menu.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
// 创建新访问路径,包含当前节点
|
||||||
|
List<Long> newVisitedIds = new ArrayList<>(visitedIds);
|
||||||
|
newVisitedIds.add(menu.getId());
|
||||||
|
|
||||||
|
// 递归构建子菜单
|
||||||
|
List<CompanyMenuVO> childList = buildCompanyMenuTreeRecursive(parentMap, menu.getId(), newVisitedIds, depth + 1);
|
||||||
|
menu.setChildren((List<MenuVO>) (List<?>) childList);
|
||||||
|
}
|
||||||
|
|
||||||
|
return children;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转换MenuPO为CompanyMenuVO(包含权限信息和公司菜单ID)
|
||||||
|
*/
|
||||||
|
private CompanyMenuVO convertToCompanyMenuVO(MenuPO menu, CompanyMenuPO companyMenu) {
|
||||||
|
CompanyMenuVO companyMenuVO = new CompanyMenuVO();
|
||||||
|
BeanUtils.copyProperties(menu, companyMenuVO);
|
||||||
|
|
||||||
|
// 设置公司菜单ID
|
||||||
|
if (companyMenu != null) {
|
||||||
|
companyMenuVO.setCompanyMenuId(companyMenu.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询菜单关联的权限
|
||||||
|
List<PermissionVO> permissions = menuMapper.selectPermissionsByMenuId(menu.getId());
|
||||||
|
companyMenuVO.setPermissions(permissions);
|
||||||
|
|
||||||
|
return companyMenuVO;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 转换MenuPO为MenuVO(包含权限信息)
|
* 转换MenuPO为MenuVO(包含权限信息)
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { requestClient } from '#/api/request';
|
import { requestClient } from '#/api/request';
|
||||||
|
import type { CompanyMenuVO } from './types';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 公司菜单管理API
|
* 公司菜单管理API
|
||||||
@@ -17,3 +18,17 @@ export async function getCompanyMenuIdsApi(id: number) {
|
|||||||
export async function batchUpdateCompanyMenusApi(id: number, menuIds: number[]) {
|
export async function batchUpdateCompanyMenusApi(id: number, menuIds: number[]) {
|
||||||
return requestClient.post<void>(`/company-menu/batch-update/${id}`, menuIds);
|
return requestClient.post<void>(`/company-menu/batch-update/${id}`, menuIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取公司所有菜单列表
|
||||||
|
*/
|
||||||
|
export async function getCompanyMenusApi() {
|
||||||
|
return requestClient.get<CompanyMenuVO.CompanyMenuInfo[]>(`/company-menu/menus`);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取公司完整菜单树
|
||||||
|
*/
|
||||||
|
export async function getCompanyMenuTreeApi() {
|
||||||
|
return requestClient.get<CompanyMenuVO.CompanyMenuInfo[]>(`/company-menu/menu-tree`);
|
||||||
|
}
|
||||||
|
|||||||
@@ -1 +1,2 @@
|
|||||||
export * from './apis';
|
export * from './apis';
|
||||||
|
export * from './types';
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
/**
|
||||||
|
* 公司菜单模块类型定义导出
|
||||||
|
*/
|
||||||
|
|
||||||
|
export * from './types.vo';
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
/**
|
||||||
|
* 公司菜单模块VO类型定义
|
||||||
|
*/
|
||||||
|
import type { MenuVO } from '#/api/system/menu/types';
|
||||||
|
|
||||||
|
export namespace CompanyMenuVO {
|
||||||
|
/** 公司菜单信息 */
|
||||||
|
export interface CompanyMenuInfo extends MenuVO.MenuInfo {
|
||||||
|
/** 公司菜单中间表ID */
|
||||||
|
companyMenuId?: number;
|
||||||
|
/** 子菜单列表 */
|
||||||
|
children?: CompanyMenuInfo[];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,824 @@
|
|||||||
|
<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>
|
||||||
Reference in New Issue
Block a user