|
@@ -3,7 +3,8 @@ import { FormSchema } from '/@/components/Table';
|
|
import { h } from 'vue';
|
|
import { h } from 'vue';
|
|
import { Tag } from 'ant-design-vue';
|
|
import { Tag } from 'ant-design-vue';
|
|
import { Icon } from '/@/components/Icon';
|
|
import { Icon } from '/@/components/Icon';
|
|
-
|
|
|
|
|
|
+import { useI18n } from '/@/hooks/web/useI18n';
|
|
|
|
+const { t } = useI18n();
|
|
// const label =[]
|
|
// const label =[]
|
|
|
|
|
|
export const columns: BasicColumn[] = [
|
|
export const columns: BasicColumn[] = [
|
|
@@ -13,24 +14,24 @@ export const columns: BasicColumn[] = [
|
|
width: 80,
|
|
width: 80,
|
|
},
|
|
},
|
|
{
|
|
{
|
|
- title: '组件路径',
|
|
|
|
|
|
+ title: t('routes.system.component'),
|
|
dataIndex: 'component',
|
|
dataIndex: 'component',
|
|
width: 80,
|
|
width: 80,
|
|
},
|
|
},
|
|
{
|
|
{
|
|
- title: '菜单名称',
|
|
|
|
|
|
+ title: t('routes.system.menuName'),
|
|
dataIndex: 'name',
|
|
dataIndex: 'name',
|
|
width: 200,
|
|
width: 200,
|
|
align: 'left',
|
|
align: 'left',
|
|
fixed: 'left',
|
|
fixed: 'left',
|
|
},
|
|
},
|
|
{
|
|
{
|
|
- title: '上级菜单',
|
|
|
|
|
|
+ title: t('routes.system.menuParentName'),
|
|
dataIndex: 'parentName',
|
|
dataIndex: 'parentName',
|
|
width: 100,
|
|
width: 100,
|
|
},
|
|
},
|
|
{
|
|
{
|
|
- title: '图标',
|
|
|
|
|
|
+ title: t('routes.system.icon'),
|
|
dataIndex: 'icon',
|
|
dataIndex: 'icon',
|
|
width: 50,
|
|
width: 50,
|
|
customRender: ({ record }) => {
|
|
customRender: ({ record }) => {
|
|
@@ -39,12 +40,12 @@ export const columns: BasicColumn[] = [
|
|
},
|
|
},
|
|
// permission
|
|
// permission
|
|
{
|
|
{
|
|
- title: '权限标识',
|
|
|
|
|
|
+ title: t('routes.system.perms'),
|
|
dataIndex: 'perms',
|
|
dataIndex: 'perms',
|
|
width: 250,
|
|
width: 250,
|
|
},
|
|
},
|
|
{
|
|
{
|
|
- title: '类型',
|
|
|
|
|
|
+ title: t('routes.system.type.title'),
|
|
dataIndex: 'type',
|
|
dataIndex: 'type',
|
|
width: 100,
|
|
width: 100,
|
|
customRender: ({ record }) => {
|
|
customRender: ({ record }) => {
|
|
@@ -54,19 +55,19 @@ export const columns: BasicColumn[] = [
|
|
switch (type) {
|
|
switch (type) {
|
|
case 0:
|
|
case 0:
|
|
color = 'processing';
|
|
color = 'processing';
|
|
- label = '目录';
|
|
|
|
|
|
+ label = t('routes.system.type.0');
|
|
break;
|
|
break;
|
|
case 1:
|
|
case 1:
|
|
color = 'warning';
|
|
color = 'warning';
|
|
- label = '菜单';
|
|
|
|
|
|
+ label = t('routes.system.type.1');
|
|
break;
|
|
break;
|
|
case 2:
|
|
case 2:
|
|
color = 'error';
|
|
color = 'error';
|
|
- label = '按钮';
|
|
|
|
|
|
+ label = t('routes.system.type.2');
|
|
break;
|
|
break;
|
|
default:
|
|
default:
|
|
color = 'green';
|
|
color = 'green';
|
|
- label = '目录';
|
|
|
|
|
|
+ label = t('routes.system.type.0');
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -74,30 +75,30 @@ export const columns: BasicColumn[] = [
|
|
},
|
|
},
|
|
},
|
|
},
|
|
{
|
|
{
|
|
- title: '排序',
|
|
|
|
|
|
+ title: t('routes.scenes.sortOrder'),
|
|
dataIndex: 'orderNum',
|
|
dataIndex: 'orderNum',
|
|
width: 50,
|
|
width: 50,
|
|
},
|
|
},
|
|
|
|
|
|
{
|
|
{
|
|
- title: '状态',
|
|
|
|
|
|
+ title: t('routes.scenes.status'),
|
|
dataIndex: 'status',
|
|
dataIndex: 'status',
|
|
width: 80,
|
|
width: 80,
|
|
customRender: ({ record }) => {
|
|
customRender: ({ record }) => {
|
|
const status = record.status;
|
|
const status = record.status;
|
|
const enable = ~~status === 0;
|
|
const enable = ~~status === 0;
|
|
const color = enable ? 'green' : 'red';
|
|
const color = enable ? 'green' : 'red';
|
|
- const text = enable ? '启用' : '停用';
|
|
|
|
|
|
+ const text = enable ? t('routes.system.enable') : t('routes.system.stopUsing');
|
|
return h(Tag, { color: color }, () => text);
|
|
return h(Tag, { color: color }, () => text);
|
|
},
|
|
},
|
|
},
|
|
},
|
|
{
|
|
{
|
|
- title: '菜单路径',
|
|
|
|
|
|
+ title: t('routes.system.menuPath'),
|
|
dataIndex: 'path',
|
|
dataIndex: 'path',
|
|
width: 180,
|
|
width: 180,
|
|
},
|
|
},
|
|
{
|
|
{
|
|
- title: '外链地址',
|
|
|
|
|
|
+ title: t('routes.system.menuUrl'),
|
|
dataIndex: 'url',
|
|
dataIndex: 'url',
|
|
width: 180,
|
|
width: 180,
|
|
},
|
|
},
|
|
@@ -111,7 +112,7 @@ const idShowExt = (isExt: number) => isExt === 1;
|
|
export const searchFormSchema: FormSchema[] = [
|
|
export const searchFormSchema: FormSchema[] = [
|
|
{
|
|
{
|
|
field: 'name',
|
|
field: 'name',
|
|
- label: '菜单名称',
|
|
|
|
|
|
+ label: t('routes.system.menuName'),
|
|
component: 'Input',
|
|
component: 'Input',
|
|
componentProps: {
|
|
componentProps: {
|
|
maxLength: 100,
|
|
maxLength: 100,
|
|
@@ -120,12 +121,12 @@ export const searchFormSchema: FormSchema[] = [
|
|
},
|
|
},
|
|
{
|
|
{
|
|
field: 'status',
|
|
field: 'status',
|
|
- label: '状态',
|
|
|
|
|
|
+ label: t('routes.scenes.status'),
|
|
component: 'Select',
|
|
component: 'Select',
|
|
componentProps: {
|
|
componentProps: {
|
|
options: [
|
|
options: [
|
|
- { label: '启用', value: 0 },
|
|
|
|
- { label: '停用', value: 1 },
|
|
|
|
|
|
+ { label: t('routes.system.enable'), value: 0 },
|
|
|
|
+ { label: t('routes.system.stopUsing'), value: 1 },
|
|
],
|
|
],
|
|
},
|
|
},
|
|
colProps: { span: 8 },
|
|
colProps: { span: 8 },
|
|
@@ -135,22 +136,22 @@ export const searchFormSchema: FormSchema[] = [
|
|
export const formSchema: FormSchema[] = [
|
|
export const formSchema: FormSchema[] = [
|
|
{
|
|
{
|
|
field: 'type',
|
|
field: 'type',
|
|
- label: '菜单类型',
|
|
|
|
|
|
+ label: t('routes.system.menuType'),
|
|
component: 'RadioButtonGroup',
|
|
component: 'RadioButtonGroup',
|
|
defaultValue: 0,
|
|
defaultValue: 0,
|
|
|
|
|
|
componentProps: {
|
|
componentProps: {
|
|
options: [
|
|
options: [
|
|
- { label: '目录', value: 0 },
|
|
|
|
- { label: '菜单', value: 1 },
|
|
|
|
- { label: '按钮', value: 2 },
|
|
|
|
|
|
+ { label: t('routes.system.type.0'), value: 0 },
|
|
|
|
+ { label: t('routes.system.type.1'), value: 1 },
|
|
|
|
+ { label: t('routes.system.type.2'), value: 2 },
|
|
],
|
|
],
|
|
},
|
|
},
|
|
colProps: { lg: 24, md: 24 },
|
|
colProps: { lg: 24, md: 24 },
|
|
},
|
|
},
|
|
{
|
|
{
|
|
field: 'name',
|
|
field: 'name',
|
|
- label: '菜单名称',
|
|
|
|
|
|
+ label: t('routes.system.menuName'),
|
|
component: 'Input',
|
|
component: 'Input',
|
|
componentProps: {
|
|
componentProps: {
|
|
maxLength: 15,
|
|
maxLength: 15,
|
|
@@ -163,11 +164,11 @@ export const formSchema: FormSchema[] = [
|
|
const reg_tel = /^[a-zA-Z0-9\u4e00-\u9fa5()]+$/;
|
|
const reg_tel = /^[a-zA-Z0-9\u4e00-\u9fa5()]+$/;
|
|
// var reg = /\S+@\S+\.\S+/;
|
|
// var reg = /\S+@\S+\.\S+/;
|
|
if (!value) {
|
|
if (!value) {
|
|
- return Promise.reject('请输入菜单名称');
|
|
|
|
|
|
+ return Promise.reject(t('routes.system.menuName1'));
|
|
}
|
|
}
|
|
if (!reg_tel.test(value)) {
|
|
if (!reg_tel.test(value)) {
|
|
/* eslint-disable-next-line */
|
|
/* eslint-disable-next-line */
|
|
- return Promise.reject('请输入正确的菜单名称');
|
|
|
|
|
|
+ return Promise.reject(t('routes.system.menuName2'));
|
|
}
|
|
}
|
|
return Promise.resolve();
|
|
return Promise.resolve();
|
|
},
|
|
},
|
|
@@ -178,7 +179,7 @@ export const formSchema: FormSchema[] = [
|
|
|
|
|
|
{
|
|
{
|
|
field: 'parentId',
|
|
field: 'parentId',
|
|
- label: '上级菜单',
|
|
|
|
|
|
+ label: t('routes.system.menuParentName'),
|
|
component: 'TreeSelect',
|
|
component: 'TreeSelect',
|
|
componentProps: {
|
|
componentProps: {
|
|
fieldNames: {
|
|
fieldNames: {
|
|
@@ -192,14 +193,14 @@ export const formSchema: FormSchema[] = [
|
|
|
|
|
|
{
|
|
{
|
|
field: 'orderNum',
|
|
field: 'orderNum',
|
|
- label: '排序',
|
|
|
|
|
|
+ label: t('routes.scenes.sortOrder'),
|
|
defaultValue: 0,
|
|
defaultValue: 0,
|
|
component: 'InputNumber',
|
|
component: 'InputNumber',
|
|
required: true,
|
|
required: true,
|
|
},
|
|
},
|
|
{
|
|
{
|
|
field: 'icon',
|
|
field: 'icon',
|
|
- label: '图标',
|
|
|
|
|
|
+ label: t('routes.system.icon'),
|
|
component: 'IconPicker',
|
|
component: 'IconPicker',
|
|
required: true,
|
|
required: true,
|
|
ifShow: ({ values }) => !isButton(values.type),
|
|
ifShow: ({ values }) => !isButton(values.type),
|
|
@@ -207,45 +208,45 @@ export const formSchema: FormSchema[] = [
|
|
|
|
|
|
{
|
|
{
|
|
field: 'path',
|
|
field: 'path',
|
|
- label: '路由地址',
|
|
|
|
|
|
+ label: t('routes.system.routerPath'),
|
|
component: 'Input',
|
|
component: 'Input',
|
|
required: true,
|
|
required: true,
|
|
ifShow: ({ values }) => !isButton(values.type),
|
|
ifShow: ({ values }) => !isButton(values.type),
|
|
},
|
|
},
|
|
{
|
|
{
|
|
field: 'component',
|
|
field: 'component',
|
|
- label: '组件路径',
|
|
|
|
|
|
+ label: t('routes.system.component'),
|
|
component: 'Input',
|
|
component: 'Input',
|
|
ifShow: ({ values }) => isMenu(values.type),
|
|
ifShow: ({ values }) => isMenu(values.type),
|
|
},
|
|
},
|
|
{
|
|
{
|
|
field: 'perms',
|
|
field: 'perms',
|
|
- label: '权限标识',
|
|
|
|
|
|
+ label: t('routes.system.perms'),
|
|
defaultValue: '',
|
|
defaultValue: '',
|
|
component: 'Input',
|
|
component: 'Input',
|
|
ifShow: ({ values }) => !isDir(values.type),
|
|
ifShow: ({ values }) => !isDir(values.type),
|
|
},
|
|
},
|
|
{
|
|
{
|
|
field: 'status',
|
|
field: 'status',
|
|
- label: '状态',
|
|
|
|
|
|
+ label: t('routes.scenes.status'),
|
|
component: 'RadioButtonGroup',
|
|
component: 'RadioButtonGroup',
|
|
defaultValue: 0,
|
|
defaultValue: 0,
|
|
componentProps: {
|
|
componentProps: {
|
|
options: [
|
|
options: [
|
|
- { label: '启用', value: 0 },
|
|
|
|
- { label: '禁用', value: 1 },
|
|
|
|
|
|
+ { label: t('routes.system.enable'), value: 0 },
|
|
|
|
+ { label: t('routes.system.stopUsing'), value: 1 },
|
|
],
|
|
],
|
|
},
|
|
},
|
|
},
|
|
},
|
|
{
|
|
{
|
|
field: 'isExt',
|
|
field: 'isExt',
|
|
- label: '是否外链',
|
|
|
|
|
|
+ label: t('routes.system.isExt.title'),
|
|
component: 'RadioButtonGroup',
|
|
component: 'RadioButtonGroup',
|
|
defaultValue: 0,
|
|
defaultValue: 0,
|
|
componentProps: {
|
|
componentProps: {
|
|
options: [
|
|
options: [
|
|
- { label: '是', value: 1 },
|
|
|
|
- { label: '否', value: 0 },
|
|
|
|
|
|
+ { label: t('routes.system.isExt.1'), value: 1 },
|
|
|
|
+ { label: t('routes.system.isExt.0'), value: 0 },
|
|
],
|
|
],
|
|
},
|
|
},
|
|
ifShow: ({ values }) => !isButton(values.type),
|
|
ifShow: ({ values }) => !isButton(values.type),
|
|
@@ -253,20 +254,20 @@ export const formSchema: FormSchema[] = [
|
|
|
|
|
|
{
|
|
{
|
|
field: 'url',
|
|
field: 'url',
|
|
- label: '外链地址',
|
|
|
|
|
|
+ label: t('routes.system.menuUrl'),
|
|
component: 'Input',
|
|
component: 'Input',
|
|
ifShow: ({ values }) => idShowExt(values.isExt),
|
|
ifShow: ({ values }) => idShowExt(values.isExt),
|
|
},
|
|
},
|
|
|
|
|
|
{
|
|
{
|
|
field: 'hideMenu',
|
|
field: 'hideMenu',
|
|
- label: '是否显示',
|
|
|
|
|
|
+ label: t('routes.scenes.isShow'),
|
|
component: 'RadioButtonGroup',
|
|
component: 'RadioButtonGroup',
|
|
defaultValue: 0,
|
|
defaultValue: 0,
|
|
componentProps: {
|
|
componentProps: {
|
|
options: [
|
|
options: [
|
|
- { label: '是', value: 0 },
|
|
|
|
- { label: '否', value: 1 },
|
|
|
|
|
|
+ { label: t('routes.system.isExt.1'), value: 0 },
|
|
|
|
+ { label: t('routes.system.isExt.0'), value: 1 },
|
|
],
|
|
],
|
|
},
|
|
},
|
|
ifShow: ({ values }) => !isButton(values.type),
|
|
ifShow: ({ values }) => !isButton(values.type),
|