| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330 |
- import type { FormSchema } from '@/components/Form';
- type ButtonType =
- | 'SEARCH'
- | 'RESET'
- | 'ADD'
- | 'EDIT'
- | 'DELETE'
- | 'EXCEL_IMPORT'
- | 'EXCEL_EXPORT'
- | 'COLUMN_SETTING'
- | 'ZOOM'
- | 'REFRESH'
- | 'SHOW_SEARCH'
- | 'PRINT';
- interface Button {
- key: ButtonType;
- value: string;
- }
- const tableTypeList = [
- {
- label: 'generator.views.code.title.tableType.single',
- value: '10',
- },
- {
- label: 'generator.views.code.title.tableType.main',
- value: '20',
- },
- {
- label: 'generator.views.code.title.tableType.addendum',
- value: '30',
- },
- ];
- const yesNoList = [
- {
- label: 'Yes',
- value: true,
- },
- {
- label: 'No',
- value: false,
- },
- ];
- export const formSchemas = (t: Function): FormSchema[] => {
- return [
- {
- label: '',
- field: 'systemId',
- component: 'Input',
- show: false,
- },
- {
- label: t('generator.views.code.table.connectionName'),
- field: 'connectionId',
- slot: 'addEditForm-connectionId',
- required: true,
- },
- {
- label: t('generator.views.code.table.tableName'),
- field: 'tableName',
- component: 'Input',
- required: true,
- },
- {
- label: t('generator.views.code.table.configName'),
- field: 'configName',
- component: 'Input',
- required: true,
- },
- {
- label: t('generator.views.code.table.type'),
- field: 'type',
- component: 'Select',
- defaultValue: '10',
- componentProps: {
- options: tableTypeList.map((item) => ({ label: t(item.label), value: item.value })),
- },
- },
- // ------------ 第二行 ---------------------
- {
- label: t('generator.views.code.title.showCheckBox'),
- field: 'showCheckbox',
- component: 'RadioGroup',
- defaultValue: true,
- componentProps: {
- options: yesNoList,
- },
- },
- {
- label: t('generator.views.code.title.isPage'),
- field: 'page',
- component: 'RadioGroup',
- defaultValue: true,
- componentProps: {
- options: yesNoList,
- },
- },
- {
- label: t('generator.views.code.title.invented'),
- field: 'invented',
- component: 'RadioGroup',
- defaultValue: false,
- componentProps: {
- options: yesNoList,
- },
- },
- {
- label: t('generator.views.code.title.columnSort'),
- field: 'columnSort',
- component: 'RadioGroup',
- defaultValue: false,
- componentProps: {
- options: yesNoList,
- },
- },
- // ------------ 第三行 ---------------------
- {
- label: t('generator.views.code.title.leftButton'),
- field: 'leftButtonList',
- component: 'Select',
- defaultValue: ['ADD', 'DELETE'],
- componentProps: {
- mode: 'multiple',
- options: letButtonList.map((item) => ({
- label: item.value,
- value: item.key,
- })),
- },
- },
- {
- label: t('generator.views.code.title.rightButton'),
- field: 'rightButtonList',
- component: 'Select',
- defaultValue: ['ZOOM', 'REFRESH', 'SHOW_SEARCH', 'COLUMN_SETTING'],
- componentProps: {
- mode: 'multiple',
- options: rightButtonList.map((item) => ({
- label: item.value,
- value: item.key,
- })),
- },
- },
- {
- label: t('generator.views.code.title.rowButtonType.title'),
- field: 'rowButtonType',
- component: 'Select',
- defaultValue: 'NONE',
- componentProps: {
- options: rowButtonTypeList(t),
- },
- },
- {
- label: t('generator.views.code.title.rowButtonList'),
- field: 'rowButtonList',
- component: 'Select',
- componentProps: {
- mode: 'multiple',
- options: rowButtonList.map((item) => ({
- label: item.value,
- value: item.key,
- })),
- },
- },
- // ------------ 第四行 ---------------------
- {
- label: t('generator.views.code.title.formColNum'),
- field: 'formColNum',
- component: 'Select',
- defaultValue: 1,
- componentProps: {
- options: columnNumList(t, false),
- },
- },
- {
- label: t('generator.views.code.title.searchColNum'),
- field: 'searchColNum',
- component: 'Select',
- defaultValue: 0,
- componentProps: {
- options: columnNumList(t),
- },
- },
- {
- label: t('common.table.remark'),
- field: 'remark',
- component: 'Input',
- },
- {
- label: t('generator.views.code.title.i18nPrefix'),
- field: 'i18nPrefix',
- component: 'Input',
- },
- // ------------ 第五行 ---------------------
- {
- label: t('generator.views.code.title.relateTable'),
- field: 'addendumTableList',
- defaultValue: [],
- slot: 'addEditForm-RelateTable',
- },
- {
- label: '',
- field: 'id',
- slot: 'addEditForm-syncTable',
- },
- ];
- };
- /**
- * 左侧按钮列表
- */
- const letButtonList: Button[] = [
- {
- key: 'SEARCH',
- value: '搜索',
- },
- {
- key: 'RESET',
- value: '重置',
- },
- {
- key: 'ADD',
- value: '添加',
- },
- {
- key: 'EDIT',
- value: '修改',
- },
- {
- key: 'DELETE',
- value: '删除',
- },
- ];
- const rightButtonList: Button[] = [
- {
- key: 'EXCEL_IMPORT',
- value: 'Excel导入',
- },
- {
- key: 'EXCEL_EXPORT',
- value: 'Excel导出',
- },
- {
- key: 'COLUMN_SETTING',
- value: '列配置',
- },
- {
- key: 'ZOOM',
- value: '放大缩小',
- },
- {
- key: 'REFRESH',
- value: '刷新',
- },
- {
- key: 'SHOW_SEARCH',
- value: '显示搜索',
- },
- {
- key: 'PRINT',
- value: '打印',
- },
- ];
- /**
- * 行按钮
- */
- const rowButtonList = [
- {
- key: 'EDIT',
- value: '修改',
- },
- {
- key: 'DELETE',
- value: '删除',
- },
- ];
- const columnNumList = (t: Function, hasZeroColumn = true) => {
- const column = [
- {
- value: 1,
- label: t('generator.views.code.title.colNum.one'),
- },
- {
- value: 2,
- label: t('generator.views.code.title.colNum.two'),
- },
- {
- value: 3,
- label: t('generator.views.code.title.colNum.three'),
- },
- {
- value: 4,
- label: t('generator.views.code.title.colNum.four'),
- },
- ];
- if (hasZeroColumn) {
- return [
- {
- value: 0,
- label: t('generator.views.design.title.colNum.zero'),
- },
- ].concat(column);
- }
- return column;
- };
- const rowButtonTypeList = (t: Function) => [
- {
- label: t('generator.views.code.title.rowButtonType.none'),
- value: 'NONE',
- },
- {
- label: t('generator.views.code.title.rowButtonType.single'),
- value: 'SINGLE',
- },
- {
- label: t('generator.views.code.title.rowButtonType.more'),
- value: 'MORE',
- },
- {
- label: t('generator.views.code.title.rowButtonType.text'),
- value: 'TEXT',
- },
- ];
|