在菜单管理中,角色管理问题修改

This commit is contained in:
刘倡
2025-08-04 17:05:22 +08:00
parent d9de84968f
commit 004eeaed7d
4 changed files with 9 additions and 55 deletions

View File

@ -1,35 +0,0 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
**/node_modules
/src/utils/request-temp.js
# production
/.vscode
# misc
.DS_Store
npm-debug.log*
yarn-error.log
/coverage
.idea
yarn.lock
package-lock.json
*bak
.vscode
# visual studio code
.history
*.log
functions/mock
.temp/**
# umi
.umi
.umi-production
# screenshot
screenshot
.firebase

View File

@ -26,15 +26,6 @@ type MenuItem = MenuData & {
children?: MenuItem[]; // 用于处理树结构
};
// 工具函数:将平铺数组转为树形结构
function listToTree<T extends { menuId: string; parentId?: string; children?: T[] }>(list: T[], parentId: string = '0'): T[] {
return list
.filter(item => (item.parentId ?? '0') === parentId)
.map(item => ({
...item,
children: listToTree(list, item.menuId)
}));
}
// 菜单管理组件
@ -89,10 +80,9 @@ const MenuManagement: React.FC = () => {
// 处理编辑
const handleEdit = (item: MenuItem) => {
debugger;
setEditingItem(item);
form.setFieldsValue({
id: item.menuId,
menuId: item.menuId,
parentId: item.parentId,
// parentName: item.parentName,
menuName: item.menuName,
@ -141,7 +131,7 @@ const MenuManagement: React.FC = () => {
menuId: '-1', // 临时标识新增项
});
form.setFieldsValue({
id: null,
menuId: null,
menuName: '',
menuOrder: 0,
menuUrl: '',
@ -255,6 +245,7 @@ const MenuManagement: React.FC = () => {
// 模态框确定按钮处理
const handleOk = async () => {
try {
debugger
const values = await form.validateFields();
if (!values.parentId) values.parentId = '0';
if (editingItem && editingItem.menuId !== '-1') {
@ -337,7 +328,7 @@ const MenuManagement: React.FC = () => {
>
<Form form={form} {...layout}>
<Form.Item
name="id"
name="menuId"
hidden={true}
>
<Input />

View File

@ -5,7 +5,7 @@ import { getPage, getDataById, deleteRole, addRole, updateRole, getMenuTreeAll }
// import './styles.less';
import { getDicData } from '@/utils/session';
import TextArea from 'antd/lib/input/TextArea';
import { proTableValueEnum } from '@/utils/CommonUtils';
import { proTableValueEnum, returnDictVal } from '@/utils/CommonUtils';
import tableProps from '@/utils/tableProps';
// 处理树形选择的级联逻辑
@ -222,11 +222,7 @@ function createSelect(data: any) {
title: '角色范围', dataIndex: 'roleScope',
valueEnum: proTableValueEnum(dictData['role_scope=system']),
render: (_, record) => {
if (record.roleScope === 'EBTP') {
return (<></>)
} else {
return (<></>)
}
return <>{returnDictVal(dictData['role_scope=system'], record.roleScope)}</>
}
},
{ title: '创建时间', dataIndex: 'createDate', width: '10%', valueType: 'dateTime', search: false },
@ -348,6 +344,8 @@ function createSelect(data: any) {
closeModal();
} catch (error) {
console.error(error);
} finally {
actionRef.current?.reload()
}
};
const checkSupModal = (

View File

@ -40,7 +40,7 @@ const entrust: React.FC<{}> = () => {
getDepartmentList();
}, []);
//委托列表
//用户信息列表
const columns: ProColumns<any>[] = [
{ title: '序号', valueType: 'index', width: 50, },
{ title: '用户名', dataIndex: 'name', },