mirror of
https://gitee.com/JavaLionLi/plus-ui.git
synced 2026-09-15 08:25:10 +08:00
update 优化 代码生成 增加多前端模板选择
This commit is contained in:
parent
74bfd8848d
commit
5b7df709f1
@ -55,6 +55,7 @@ export interface DbTableVO extends Omit<TableVO, 'tableId'> {
|
|||||||
uniqueFields?: string[];
|
uniqueFields?: string[];
|
||||||
enableSort?: boolean;
|
enableSort?: boolean;
|
||||||
sortField?: string;
|
sortField?: string;
|
||||||
|
frontendType?: string;
|
||||||
treeRootValue?: string;
|
treeRootValue?: string;
|
||||||
treeAncestorsField?: string;
|
treeAncestorsField?: string;
|
||||||
treeOrderField?: string;
|
treeOrderField?: string;
|
||||||
@ -79,6 +80,7 @@ export interface TableVO extends BaseEntity {
|
|||||||
tableComment?: string;
|
tableComment?: string;
|
||||||
className?: string;
|
className?: string;
|
||||||
tplCategory?: string;
|
tplCategory?: string;
|
||||||
|
frontendType?: string;
|
||||||
packageName?: string;
|
packageName?: string;
|
||||||
moduleName?: string;
|
moduleName?: string;
|
||||||
businessName?: string;
|
businessName?: string;
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import type { FormInstance } from 'antd';
|
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 { useMemo } from 'react';
|
||||||
import type { MenuVO } from '@/api/system/menu/types';
|
import type { MenuVO } from '@/api/system/menu/types';
|
||||||
import type { DbColumnVO, DbTableVO } from '@/api/tool/gen/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 || ''}`,
|
label: `${column.columnName}:${column.columnComment || ''}`,
|
||||||
value: column.columnName
|
value: column.columnName
|
||||||
}));
|
}));
|
||||||
|
const frontendTypeOptions = [
|
||||||
|
{ label: 'Vue', value: 'vue' },
|
||||||
|
{ label: 'React', value: 'react' }
|
||||||
|
];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@ -42,6 +47,25 @@ export default function GenInfoForm({ form, columns, menuOptions }: GenInfoFormP
|
|||||||
/>
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</Col>
|
</Col>
|
||||||
|
<Col xs={24} md={12}>
|
||||||
|
<Form.Item
|
||||||
|
name="frontendType"
|
||||||
|
label={
|
||||||
|
<span>
|
||||||
|
前端模板{' '}
|
||||||
|
<Tooltip title="对应后端 resources/vm 下的模板目录,例如 vue、react">
|
||||||
|
<QuestionCircleOutlined />
|
||||||
|
</Tooltip>
|
||||||
|
</span>
|
||||||
|
}
|
||||||
|
rules={[
|
||||||
|
{ required: true, message: '请选择前端模板' },
|
||||||
|
{ pattern: /^[A-Za-z0-9_-]+$/, message: '仅支持字母、数字、下划线和中划线' }
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<Radio.Group options={frontendTypeOptions} />
|
||||||
|
</Form.Item>
|
||||||
|
</Col>
|
||||||
<Col xs={24} md={12}>
|
<Col xs={24} md={12}>
|
||||||
<Form.Item name="packageName" label="生成包路径" rules={[{ required: true, message: '请输入生成包路径' }]}>
|
<Form.Item name="packageName" label="生成包路径" rules={[{ required: true, message: '请输入生成包路径' }]}>
|
||||||
<Input />
|
<Input />
|
||||||
|
|||||||
@ -30,6 +30,7 @@ function withDefaults(info: DbTableVO): DbTableVO {
|
|||||||
uniqueFields: normalizeStringArray(info.uniqueFields),
|
uniqueFields: normalizeStringArray(info.uniqueFields),
|
||||||
enableSort: info.enableSort ?? false,
|
enableSort: info.enableSort ?? false,
|
||||||
sortField: info.sortField ?? '',
|
sortField: info.sortField ?? '',
|
||||||
|
frontendType: info.frontendType || 'react',
|
||||||
treeRootValue: info.treeRootValue ?? '0',
|
treeRootValue: info.treeRootValue ?? '0',
|
||||||
treeAncestorsField: info.treeAncestorsField ?? '',
|
treeAncestorsField: info.treeAncestorsField ?? '',
|
||||||
treeOrderField: info.treeOrderField ?? ''
|
treeOrderField: info.treeOrderField ?? ''
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user