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

This commit is contained in:
YunaiV
2025-09-09 23:11:33 +08:00
parent 044db12224
commit 16f4892fac
4 changed files with 135 additions and 137 deletions

View File

@@ -366,8 +366,8 @@ export function useGridFormSchema(): VbenFormSchema[] {
label: '表名称',
component: 'Input',
componentProps: {
allowClear: true,
placeholder: '请输入表名称',
allowClear: true,
},
},
{
@@ -375,8 +375,8 @@ export function useGridFormSchema(): VbenFormSchema[] {
label: '表描述',
component: 'Input',
componentProps: {
allowClear: true,
placeholder: '请输入表描述',
allowClear: true,
},
},
{
@@ -400,28 +400,34 @@ export function useGridColumns(
{
field: 'dataSourceConfigId',
title: '数据源',
minWidth: 120,
formatter: ({ cellValue }) => getDataSourceConfigName?.(cellValue) || '-',
},
{
field: 'tableName',
title: '表名称',
minWidth: 200,
},
{
field: 'tableComment',
title: '表描述',
minWidth: 200,
},
{
field: 'className',
title: '实体',
minWidth: 200,
},
{
field: 'createTime',
title: '创建时间',
minWidth: 180,
formatter: 'formatDateTime',
},
{
field: 'updateTime',
title: '更新时间',
minWidth: 180,
formatter: 'formatDateTime',
},
{

View File

@@ -6,7 +6,7 @@ import type { InfraDataSourceConfigApi } from '#/api/infra/data-source-config';
import { ref } from 'vue';
import { useRouter } from 'vue-router';
import { DocAlert, Page, useVbenModal } from '@vben/common-ui';
import { confirm, DocAlert, Page, useVbenModal } from '@vben/common-ui';
import { isEmpty } from '@vben/utils';
import { message } from 'ant-design-vue';
@@ -49,7 +49,7 @@ const [PreviewModal, previewModalApi] = useVbenModal({
});
/** 刷新表格 */
function onRefresh() {
function handleRefresh() {
gridApi.query();
}
@@ -77,7 +77,24 @@ async function handleDelete(row: InfraCodegenApi.CodegenTable) {
try {
await deleteCodegenTable(row.id);
message.success($t('ui.actionMessage.deleteSuccess', [row.tableName]));
onRefresh();
handleRefresh();
} finally {
hideLoading();
}
}
/** 批量删除代码生成配置 */
async function handleDeleteBatch() {
await confirm($t('ui.actionMessage.deleteBatchConfirm'));
const hideLoading = message.loading({
content: $t('ui.actionMessage.deletingBatch'),
duration: 0,
});
try {
await deleteCodegenTableList(checkedIds.value);
checkedIds.value = [];
message.success($t('ui.actionMessage.deleteSuccess'));
handleRefresh();
} finally {
hideLoading();
}
@@ -92,22 +109,6 @@ function handleRowCheckboxChange({
checkedIds.value = records.map((item) => item.id!);
}
/** 批量删除代码生成配置 */
async function handleDeleteBatch() {
const hideLoading = message.loading({
content: $t('ui.actionMessage.deleting'),
duration: 0,
});
try {
await deleteCodegenTableList(checkedIds.value);
checkedIds.value = [];
message.success($t('ui.actionMessage.deleteSuccess'));
onRefresh();
} finally {
hideLoading();
}
}
/** 同步数据库 */
async function handleSync(row: InfraCodegenApi.CodegenTable) {
const hideLoading = message.loading({
@@ -117,7 +118,7 @@ async function handleSync(row: InfraCodegenApi.CodegenTable) {
try {
await syncCodegenFromDB(row.id);
message.success($t('ui.actionMessage.updateSuccess', [row.tableName]));
onRefresh();
handleRefresh();
} finally {
hideLoading();
}
@@ -209,7 +210,7 @@ initDataSourceConfig();
<DocAlert title="单元测试" url="https://doc.iocoder.cn/unit-test/" />
</template>
<ImportModal @success="onRefresh" />
<ImportModal @success="handleRefresh" />
<PreviewModal />
<Grid table-title="代码生成列表">
<template #toolbar-tools>
@@ -223,11 +224,11 @@ initDataSourceConfig();
onClick: handleImport,
},
{
label: '批量删除',
label: $t('ui.actionTitle.deleteBatch'),
type: 'primary',
danger: true,
disabled: isEmpty(checkedIds),
icon: ACTION_ICON.DELETE,
disabled: isEmpty(checkedIds),
auth: ['infra:codegen:delete'],
onClick: handleDeleteBatch,
},