126 lines
2.4 KiB
TypeScript
126 lines
2.4 KiB
TypeScript
// src/pages/system/menu/config.tsx
|
|
import type {
|
|
ProColumns,
|
|
ProFormColumnsType,
|
|
} from '@ant-design/pro-components';
|
|
import { Switch } from 'antd';
|
|
import type { MenuVO } from '@/services/system/menu';
|
|
|
|
export const baseMenuColumns: ProColumns<MenuVO>[] = [
|
|
{
|
|
title: '菜单名称',
|
|
dataIndex: 'name',
|
|
width: 150,
|
|
},
|
|
{
|
|
title: '图标',
|
|
dataIndex: 'icon',
|
|
width: 60,
|
|
render: (_, record: MenuVO) => (
|
|
<span>
|
|
{record.icon ? <i className={`anticon ${record.icon}`} /> : '—'}
|
|
</span>
|
|
),
|
|
},
|
|
{
|
|
title: '排序',
|
|
dataIndex: 'sort',
|
|
width: 80,
|
|
},
|
|
{
|
|
title: '权限标识',
|
|
dataIndex: 'permission',
|
|
width: 150,
|
|
},
|
|
{
|
|
title: '组件路径',
|
|
dataIndex: 'component',
|
|
width: 150,
|
|
},
|
|
{
|
|
title: '组件名称',
|
|
dataIndex: 'componentName',
|
|
width: 150,
|
|
},
|
|
{
|
|
title: '状态',
|
|
dataIndex: 'status',
|
|
width: 80,
|
|
render: (_, record: MenuVO) => (
|
|
<Switch
|
|
checked={record.status === 1}
|
|
disabled={true} // 可后续改为可编辑
|
|
/>
|
|
),
|
|
},
|
|
];
|
|
|
|
export const formColumns = (_type: string): ProFormColumnsType[] => [
|
|
{
|
|
title: '菜单名称',
|
|
dataIndex: 'name',
|
|
formItemProps: {
|
|
rules: [
|
|
{
|
|
required: true,
|
|
message: '请输入菜单名称',
|
|
},
|
|
],
|
|
},
|
|
},
|
|
{
|
|
title: '图标',
|
|
dataIndex: 'icon',
|
|
valueType: 'select',
|
|
fieldProps: {
|
|
placeholder: '请选择图标',
|
|
options: [
|
|
{ label: '商品', value: 'icon-product' },
|
|
{ label: '系统', value: 'icon-system' },
|
|
{ label: '用户', value: 'icon-user' },
|
|
{ label: '设置', value: 'icon-setting' },
|
|
],
|
|
},
|
|
},
|
|
{
|
|
title: '排序',
|
|
dataIndex: 'sort',
|
|
valueType: 'digit',
|
|
fieldProps: {
|
|
placeholder: '请输入排序值',
|
|
},
|
|
},
|
|
{
|
|
title: '权限标识',
|
|
dataIndex: 'permission',
|
|
fieldProps: {
|
|
placeholder: '请输入权限标识',
|
|
},
|
|
},
|
|
{
|
|
title: '组件路径',
|
|
dataIndex: 'component',
|
|
fieldProps: {
|
|
placeholder: '请输入组件路径',
|
|
},
|
|
},
|
|
{
|
|
title: '组件名称',
|
|
dataIndex: 'componentName',
|
|
fieldProps: {
|
|
placeholder: '请输入组件名称',
|
|
},
|
|
},
|
|
{
|
|
title: '状态',
|
|
dataIndex: 'status',
|
|
valueType: 'select',
|
|
fieldProps: {
|
|
options: [
|
|
{ label: '启用', value: 1 },
|
|
{ label: '禁用', value: 0 },
|
|
],
|
|
},
|
|
},
|
|
];
|