| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291 |
- import type { SmartColumn, SmartSearchFormSchema } from '@/components/SmartTable';
- import type { FormSchema } from '@/components/Form';
- export const tableColumns: SmartColumn[] = [
- {
- type: 'checkbox',
- width: 60,
- align: 'center',
- fixed: 'left',
- },
- {
- title: '{system.views.function.table.functionName}',
- field: 'functionName',
- width: 220,
- fixed: 'left',
- treeNode: true,
- },
- {
- title: '{system.views.function.table.functionType}',
- field: 'functionType',
- width: 110,
- align: 'center',
- headerAlign: 'left',
- slots: {
- default: 'table-functionType',
- },
- },
- {
- title: '{system.views.function.table.icon}',
- field: 'icon',
- width: 80,
- align: 'center',
- headerAlign: 'left',
- slots: {
- default: 'table-icon',
- },
- },
- {
- title: 'URL',
- field: 'url',
- minWidth: 200,
- },
- {
- title: '{system.views.function.table.permission}',
- field: 'permission',
- width: 160,
- },
- {
- title: '{system.views.function.table.httpMethod}',
- field: 'httpMethod',
- width: 120,
- },
- {
- title: '{common.table.seq}',
- field: 'seq',
- width: 100,
- sortable: true,
- },
- {
- title: '{common.table.createTime}',
- field: 'createTime',
- width: 165,
- sortable: true,
- },
- {
- title: '{common.table.createUser}',
- field: 'createBy',
- width: 120,
- },
- {
- title: '{common.table.updateTime}',
- field: 'updateTime',
- width: 165,
- sortable: true,
- },
- {
- title: '{common.table.updateUser}',
- field: 'updateBy',
- width: 120,
- },
- {
- title: '{common.table.operation}',
- field: 'operation',
- width: 200,
- fixed: 'right',
- slots: {
- default: 'table-operation',
- },
- },
- ];
- export const getAddEditForm = (t: Function): FormSchema[] => {
- return [
- {
- field: 'functionId',
- label: '',
- component: 'Input',
- show: false,
- },
- {
- field: 'parentName',
- label: '上级',
- component: 'Input',
- componentProps: {
- disabled: true,
- },
- },
- {
- field: 'parentId',
- label: '',
- component: 'Input',
- show: false,
- },
- {
- field: 'functionName',
- label: t('system.views.function.table.functionName'),
- component: 'Input',
- required: true,
- },
- {
- field: 'functionType',
- label: t('system.views.function.table.functionType'),
- slot: 'addEditForm-functionType',
- required: true,
- },
- {
- field: 'i18nCode',
- label: t('system.views.function.table.i18nCode'),
- component: 'Input',
- },
- {
- field: 'icon',
- label: t('system.views.function.table.icon'),
- component: 'IconPicker',
- },
- {
- field: 'seq',
- required: true,
- label: t('common.table.seq'),
- component: 'InputNumber',
- defaultValue: 1,
- },
- {
- field: 'componentName',
- label: t('system.views.function.table.componentName'),
- component: 'Input',
- dynamicRules: ({ model }) => {
- return [
- {
- required: model.functionType === 'MENU',
- trigger: 'blur',
- message: t('system.views.function.validate.componentName'),
- },
- ];
- },
- show: ({ model }) => {
- return model.functionType !== 'FUNCTION';
- },
- },
- {
- field: 'component',
- label: t('system.views.function.table.component'),
- component: 'Input',
- dynamicRules: ({ model }) => {
- return [
- {
- required: model.functionType === 'MENU',
- trigger: 'blur',
- message: t('system.views.function.validate.component'),
- },
- ];
- },
- show: ({ model }) => {
- return model.functionType !== 'FUNCTION';
- },
- },
- {
- field: 'url',
- label: 'URL',
- component: 'Input',
- dynamicRules: ({ model }) => {
- return [
- {
- required: model.functionType === 'MENU',
- trigger: 'blur',
- message: t('system.views.function.validate.url'),
- },
- ];
- },
- },
- {
- field: 'redirect',
- label: 'Redirect',
- component: 'Input',
- show: ({ model }) => {
- return model.functionType !== 'FUNCTION';
- },
- },
- {
- field: 'httpMethod',
- label: t('system.views.function.table.httpMethod'),
- component: 'Select',
- componentProps: {
- options: ['GET', 'POST', 'PUT', 'DELETE'].map((item) => ({ label: item, value: item })),
- },
- show: ({ model }) => {
- return model.functionType === 'FUNCTION';
- },
- },
- {
- field: 'permission',
- label: t('system.views.function.table.permission'),
- component: 'Input',
- dynamicRules: ({ model }) => {
- return [
- {
- required: model.functionType === 'FUNCTION',
- message: t('system.views.function.validate.permission'),
- trigger: 'blur',
- },
- ];
- },
- show: ({ model }) => {
- return model.functionType === 'FUNCTION';
- },
- },
- {
- field: 'isMenu',
- label: t('system.views.function.table.menuIs'),
- component: 'Switch',
- defaultValue: true,
- show: ({ model }) => {
- return model.functionType !== 'FUNCTION';
- },
- },
- {
- field: 'internalOrExternal',
- label: t('system.views.function.table.internalOrExternal'),
- component: 'Switch',
- defaultValue: false,
- show: ({ model }) => {
- return model.functionType === 'MENU';
- },
- },
- {
- field: 'dataRule',
- label: t('system.views.function.table.dataRule'),
- component: 'Switch',
- defaultValue: false,
- show: ({ model }) => {
- return model.functionType === 'FUNCTION';
- },
- },
- {
- field: 'cached',
- label: t('system.views.function.title.cached'),
- component: 'Switch',
- defaultValue: true,
- show: ({ model }) => {
- return model.functionType === 'MENU';
- },
- },
- ];
- };
- export const getSearchSchemas = (t: Function): SmartSearchFormSchema[] => {
- return [
- {
- label: t('common.title.useYn'),
- field: 'useYn',
- component: 'Select',
- defaultValue: 1,
- searchSymbol: '=',
- componentProps: {
- style: {
- width: '100px',
- },
- options: [
- {
- label: t('common.form.use'),
- value: 1,
- },
- {
- label: t('common.form.noUse'),
- value: 0,
- },
- ],
- },
- },
- ];
- };
|