|
@@ -8,10 +8,21 @@ import { Icon } from '/@/components/Icon';
|
|
|
|
|
|
export const columns: BasicColumn[] = [
|
|
|
{
|
|
|
+ title: 'ID',
|
|
|
+ dataIndex: 'menuId',
|
|
|
+ width: 80,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: 'parentId(debug)',
|
|
|
+ dataIndex: 'parentId',
|
|
|
+ width: 80,
|
|
|
+ },
|
|
|
+ {
|
|
|
title: '菜单名称',
|
|
|
dataIndex: 'name',
|
|
|
width: 200,
|
|
|
align: 'left',
|
|
|
+ fixed: 'left',
|
|
|
},
|
|
|
{
|
|
|
title: '上级菜单',
|
|
@@ -37,10 +48,29 @@ export const columns: BasicColumn[] = [
|
|
|
dataIndex: 'type',
|
|
|
width: 100,
|
|
|
customRender: ({ record }) => {
|
|
|
- const color = 'green';
|
|
|
- const type = record.type;
|
|
|
+ let color: string;
|
|
|
+ let label: string;
|
|
|
+ const type: number = record.type;
|
|
|
+ switch (type) {
|
|
|
+ case 0:
|
|
|
+ color = 'processing';
|
|
|
+ label = '目录';
|
|
|
+ break;
|
|
|
+ case 1:
|
|
|
+ color = 'warning';
|
|
|
+ label = '菜单';
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ color = 'error';
|
|
|
+ label = '按钮';
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ color = 'green';
|
|
|
+ label = '目录';
|
|
|
+ break;
|
|
|
+ }
|
|
|
|
|
|
- return h(Tag, { color: color }, () => `目录${type}`);
|
|
|
+ return h(Tag, { color: color }, () => label);
|
|
|
},
|
|
|
},
|
|
|
{
|
|
@@ -56,7 +86,7 @@ export const columns: BasicColumn[] = [
|
|
|
customRender: ({ record }) => {
|
|
|
const status = record.status;
|
|
|
const enable = ~~status === 0;
|
|
|
- const color = enable ? 'warning' : 'red';
|
|
|
+ const color = enable ? 'green' : 'red';
|
|
|
const text = enable ? '启用' : '停用';
|
|
|
return h(Tag, { color: color }, () => text);
|
|
|
},
|
|
@@ -68,9 +98,9 @@ export const columns: BasicColumn[] = [
|
|
|
},
|
|
|
];
|
|
|
|
|
|
-const isDir = (type: string) => type === '0';
|
|
|
-const isMenu = (type: string) => type === '1';
|
|
|
-const isButton = (type: string) => type === '2';
|
|
|
+const isDir = (type: number) => type === 0;
|
|
|
+const isMenu = (type: number) => type === 1;
|
|
|
+const isButton = (type: number) => type === 2;
|
|
|
|
|
|
export const searchFormSchema: FormSchema[] = [
|
|
|
{
|
|
@@ -85,8 +115,8 @@ export const searchFormSchema: FormSchema[] = [
|
|
|
component: 'Select',
|
|
|
componentProps: {
|
|
|
options: [
|
|
|
- { label: '启用', value: '0' },
|
|
|
- { label: '停用', value: '1' },
|
|
|
+ { label: '启用', value: 0 },
|
|
|
+ { label: '停用', value: 1 },
|
|
|
],
|
|
|
},
|
|
|
colProps: { span: 8 },
|
|
@@ -98,13 +128,13 @@ export const formSchema: FormSchema[] = [
|
|
|
field: 'type',
|
|
|
label: '菜单类型',
|
|
|
component: 'RadioButtonGroup',
|
|
|
- defaultValue: '0',
|
|
|
+ defaultValue: 0,
|
|
|
|
|
|
componentProps: {
|
|
|
options: [
|
|
|
- { label: '目录', value: '0' },
|
|
|
- { label: '菜单', value: '1' },
|
|
|
- { label: '按钮', value: '2' },
|
|
|
+ { label: '目录', value: 0 },
|
|
|
+ { label: '菜单', value: 1 },
|
|
|
+ { label: '按钮', value: 2 },
|
|
|
],
|
|
|
},
|
|
|
colProps: { lg: 24, md: 24 },
|
|
@@ -117,7 +147,7 @@ export const formSchema: FormSchema[] = [
|
|
|
},
|
|
|
|
|
|
{
|
|
|
- field: 'parentMenu',
|
|
|
+ field: 'parentId',
|
|
|
label: '上级菜单',
|
|
|
component: 'TreeSelect',
|
|
|
componentProps: {
|
|
@@ -158,7 +188,7 @@ export const formSchema: FormSchema[] = [
|
|
|
ifShow: ({ values }) => isMenu(values.type),
|
|
|
},
|
|
|
{
|
|
|
- field: 'permission',
|
|
|
+ field: 'perms',
|
|
|
label: '权限标识',
|
|
|
component: 'Input',
|
|
|
ifShow: ({ values }) => !isDir(values.type),
|
|
@@ -167,11 +197,11 @@ export const formSchema: FormSchema[] = [
|
|
|
field: 'status',
|
|
|
label: '状态',
|
|
|
component: 'RadioButtonGroup',
|
|
|
- defaultValue: '0',
|
|
|
+ defaultValue: 0,
|
|
|
componentProps: {
|
|
|
options: [
|
|
|
- { label: '启用', value: '0' },
|
|
|
- { label: '禁用', value: '1' },
|
|
|
+ { label: '启用', value: 0 },
|
|
|
+ { label: '禁用', value: 1 },
|
|
|
],
|
|
|
},
|
|
|
},
|
|
@@ -207,11 +237,11 @@ export const formSchema: FormSchema[] = [
|
|
|
field: 'show',
|
|
|
label: '是否显示',
|
|
|
component: 'RadioButtonGroup',
|
|
|
- defaultValue: '0',
|
|
|
+ defaultValue: 0,
|
|
|
componentProps: {
|
|
|
options: [
|
|
|
- { label: '是', value: '0' },
|
|
|
- { label: '否', value: '1' },
|
|
|
+ { label: '是', value: 0 },
|
|
|
+ { label: '否', value: 1 },
|
|
|
],
|
|
|
},
|
|
|
ifShow: ({ values }) => !isButton(values.type),
|