reactor:【infra 基础设施】codegen 进一步统一代码风格(50%)

This commit is contained in:
YunaiV
2025-09-09 22:58:58 +08:00
parent 08b4176fb3
commit 044db12224
12 changed files with 91 additions and 86 deletions

View File

@@ -25,6 +25,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
keepSource: true,
rowConfig: {
keyField: 'id',
isHover: true,
},
pagerConfig: {
enabled: false,

View File

@@ -21,7 +21,7 @@ const emit = defineEmits<{
(e: 'success'): void;
}>();
const formData = reactive<InfraCodegenApi.CodegenCreateListReq>({
const formData = reactive<InfraCodegenApi.CodegenCreateListReqVO>({
dataSourceConfigId: 0,
tableNames: [], // 已选择的表列表
});
@@ -53,6 +53,7 @@ const [Grid] = useVbenVxeGrid({
},
rowConfig: {
keyField: 'name',
isHover: true,
},
toolbarConfig: {
enabled: false,
@@ -96,17 +97,14 @@ const [Modal, modalApi] = useVbenModal({
// 2. 提交请求
const hideLoading = message.loading({
content: '导入中...',
key: 'action_key_msg',
duration: 0,
});
try {
await createCodegenList(formData);
// 关闭并提示
await modalApi.close();
emit('success');
message.success({
content: $t('ui.actionMessage.operationSuccess'),
key: 'action_key_msg',
});
message.success($t('ui.actionMessage.operationSuccess'));
} finally {
hideLoading();
modalApi.unlock();

View File

@@ -86,19 +86,23 @@ async function copyCode() {
/** 文件节点点击事件 */
function handleNodeClick(_: any[], e: any) {
if (!e.node.isLeaf) return;
if (!e.node.isLeaf) {
return;
}
activeKey.value = e.node.key;
const file = previewFiles.value.find((item) => {
const list = activeKey.value.split('.');
// 特殊处理-包合并
// 特殊处理 - 包合并
if (list.length > 2) {
const lang = list.pop();
return item.filePath === `${list.join('/')}.${lang}`;
}
return item.filePath === activeKey.value;
});
if (!file) return;
if (!file) {
return;
}
const lang = file.filePath.split('.').pop() || '';
setCodeMap(activeKey.value, lang, file.code);
@@ -119,7 +123,7 @@ function handleFiles(data: InfraCodegenApi.CodegenPreview[]): FileNode[] {
const path = paths[cursor] || '';
const oldFullPath = fullPath;
// 处理Java包路径特殊情况
// 处理 Java 包路径特殊情况
if (path === 'java' && cursor + 1 < paths.length) {
fullPath = fullPath ? `${fullPath}/${path}` : path;
cursor++;
@@ -202,7 +206,9 @@ const [Modal, modalApi] = useVbenModal({
}
const row = modalApi.getData<InfraCodegenApi.CodegenTable>();
if (!row) return;
if (!row) {
return;
}
// 加载预览数据
loading.value = true;