diff --git a/src/api/tool/gen/types.ts b/src/api/tool/gen/types.ts index 8abca9ed..1df3215b 100644 --- a/src/api/tool/gen/types.ts +++ b/src/api/tool/gen/types.ts @@ -55,6 +55,7 @@ export interface DbTableVO extends Omit { uniqueFields?: string[]; enableSort?: boolean; sortField?: string; + frontendType?: string; treeRootValue?: string; treeAncestorsField?: string; treeOrderField?: string; @@ -79,6 +80,7 @@ export interface TableVO extends BaseEntity { tableComment?: string; className?: string; tplCategory?: string; + frontendType?: string; packageName?: string; moduleName?: string; businessName?: string; diff --git a/src/pages/tool/gen/components/GenInfoForm.tsx b/src/pages/tool/gen/components/GenInfoForm.tsx index 437a9ac7..45469c4f 100644 --- a/src/pages/tool/gen/components/GenInfoForm.tsx +++ b/src/pages/tool/gen/components/GenInfoForm.tsx @@ -1,5 +1,6 @@ import type { FormInstance } from 'antd'; -import { Col, Form, Input, Row, Select, Switch, TreeSelect } from 'antd'; +import { QuestionCircleOutlined } from '@ant-design/icons'; +import { Col, Form, Input, Radio, Row, Select, Switch, Tooltip, TreeSelect } from 'antd'; import { useMemo } from 'react'; import type { MenuVO } from '@/api/system/menu/types'; import type { DbColumnVO, DbTableVO } from '@/api/tool/gen/types'; @@ -28,6 +29,10 @@ export default function GenInfoForm({ form, columns, menuOptions }: GenInfoFormP label: `${column.columnName}:${column.columnComment || ''}`, value: column.columnName })); + const frontendTypeOptions = [ + { label: 'Vue', value: 'vue' }, + { label: 'React', value: 'react' } + ]; return ( <> @@ -42,6 +47,25 @@ export default function GenInfoForm({ form, columns, menuOptions }: GenInfoFormP /> + + + 前端模板{' '} + + + + + } + rules={[ + { required: true, message: '请选择前端模板' }, + { pattern: /^[A-Za-z0-9_-]+$/, message: '仅支持字母、数字、下划线和中划线' } + ]} + > + + + diff --git a/src/pages/tool/gen/edit.tsx b/src/pages/tool/gen/edit.tsx index d6c6d311..6abbe3f4 100644 --- a/src/pages/tool/gen/edit.tsx +++ b/src/pages/tool/gen/edit.tsx @@ -30,6 +30,7 @@ function withDefaults(info: DbTableVO): DbTableVO { uniqueFields: normalizeStringArray(info.uniqueFields), enableSort: info.enableSort ?? false, sortField: info.sortField ?? '', + frontendType: info.frontendType || 'react', treeRootValue: info.treeRootValue ?? '0', treeAncestorsField: info.treeAncestorsField ?? '', treeOrderField: info.treeOrderField ?? ''