mirror of
https://github.com/continew-org/continew-admin.git
synced 2025-09-09 20:57:21 +08:00
feat: 新增保存代码生成配置信息接口
This commit is contained in:
@@ -30,14 +30,12 @@ export function listTable(params: TableParam) {
|
||||
}
|
||||
|
||||
export interface ColumnMappingRecord {
|
||||
id: string;
|
||||
tableName: string;
|
||||
columnName: string;
|
||||
columnType: string;
|
||||
fieldName: string;
|
||||
fieldType: string;
|
||||
comment: string;
|
||||
sort: number;
|
||||
isRequired: boolean;
|
||||
showInList: boolean;
|
||||
showInForm: boolean;
|
||||
@@ -53,7 +51,6 @@ export function listColumnMapping(tableName: string) {
|
||||
}
|
||||
|
||||
export interface GenConfigRecord {
|
||||
id: string;
|
||||
tableName: string;
|
||||
moduleName: string;
|
||||
packageName: string;
|
||||
@@ -69,3 +66,12 @@ export interface GenConfigRecord {
|
||||
export function getGenConfig(tableName: string) {
|
||||
return axios.get<GenConfigRecord>(`${BASE_URL}/table/${tableName}`);
|
||||
}
|
||||
|
||||
export interface GeneratorConfigRecord {
|
||||
genConfig: GenConfigRecord;
|
||||
columnMappings: ColumnMappingRecord[];
|
||||
}
|
||||
|
||||
export function saveConfig(tableName: string, req: GeneratorConfigRecord) {
|
||||
return axios.post(`${BASE_URL}/table/${tableName}`, req);
|
||||
}
|
||||
|
@@ -153,14 +153,14 @@
|
||||
<a-table-column
|
||||
title="名称"
|
||||
data-index="fieldName"
|
||||
:width="130"
|
||||
:width="125"
|
||||
ellipsis
|
||||
tooltip
|
||||
/>
|
||||
<a-table-column
|
||||
title="类型"
|
||||
data-index="fieldType"
|
||||
:width="90"
|
||||
:width="95"
|
||||
ellipsis
|
||||
tooltip
|
||||
/>
|
||||
@@ -303,6 +303,8 @@
|
||||
listTable,
|
||||
listColumnMapping,
|
||||
getGenConfig,
|
||||
GeneratorConfigRecord,
|
||||
saveConfig,
|
||||
} from '@/api/tool/generator';
|
||||
|
||||
const { proxy } = getCurrentInstance() as any;
|
||||
@@ -333,15 +335,16 @@
|
||||
},
|
||||
// 表单数据
|
||||
form: {} as GenConfigRecord,
|
||||
config: {} as GeneratorConfigRecord,
|
||||
// 表单验证规则
|
||||
rules: {
|
||||
author: [{ required: true, message: '请输入作者名称' }],
|
||||
moduleName: [{ required: true, message: '请输入模块名称' }],
|
||||
packageName: [{ required: true, message: '请输入包名称' }],
|
||||
moduleName: [{ required: true, message: '请输入所属模块' }],
|
||||
packageName: [{ required: true, message: '请输入模块包名' }],
|
||||
businessName: [{ required: true, message: '请输入业务名称' }],
|
||||
},
|
||||
});
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
const { queryParams, form, rules, config } = toRefs(data);
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
@@ -393,8 +396,17 @@
|
||||
* 确定
|
||||
*/
|
||||
const handleOk = () => {
|
||||
visible.value = false;
|
||||
proxy.$message.info('功能尚在开发中');
|
||||
proxy.$refs.formRef.validate((valid: any) => {
|
||||
if (!valid) {
|
||||
config.value.columnMappings = columnMappingList.value;
|
||||
config.value.genConfig = form.value;
|
||||
saveConfig(form.value.tableName, config.value).then((res) => {
|
||||
handleCancel();
|
||||
getList();
|
||||
proxy.$message.success(res.msg);
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -402,6 +414,8 @@
|
||||
*/
|
||||
const handleCancel = () => {
|
||||
visible.value = false;
|
||||
proxy.$refs.formRef?.resetFields();
|
||||
columnMappingList.value = [];
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -410,7 +424,7 @@
|
||||
* @param tableName 表名称
|
||||
*/
|
||||
const toGenerate = (tableName: string) => {
|
||||
proxy.$message.info(tableName);
|
||||
proxy.$message.info('功能尚在开发中');
|
||||
};
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user