From 16f4892fac2aef856489c2d0bb65805cc7ca2ef0 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Tue, 9 Sep 2025 23:11:33 +0800 Subject: [PATCH] =?UTF-8?q?reactor=EF=BC=9A=E3=80=90infra=20=E5=9F=BA?= =?UTF-8?q?=E7=A1=80=E8=AE=BE=E6=96=BD=E3=80=91codegen=20=E8=BF=9B?= =?UTF-8?q?=E4=B8=80=E6=AD=A5=E7=BB=9F=E4=B8=80=E4=BB=A3=E7=A0=81=E9=A3=8E?= =?UTF-8?q?=E6=A0=BC=EF=BC=88100%=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/web-antd/src/views/infra/codegen/data.ts | 10 +- .../src/views/infra/codegen/index.vue | 47 +++--- apps/web-ele/src/views/infra/codegen/data.ts | 56 +----- .../web-ele/src/views/infra/codegen/index.vue | 159 +++++++++++------- 4 files changed, 135 insertions(+), 137 deletions(-) diff --git a/apps/web-antd/src/views/infra/codegen/data.ts b/apps/web-antd/src/views/infra/codegen/data.ts index 6b76521b4..cc91a1488 100644 --- a/apps/web-antd/src/views/infra/codegen/data.ts +++ b/apps/web-antd/src/views/infra/codegen/data.ts @@ -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', }, { diff --git a/apps/web-antd/src/views/infra/codegen/index.vue b/apps/web-antd/src/views/infra/codegen/index.vue index 214957bce..e7e3f4f27 100644 --- a/apps/web-antd/src/views/infra/codegen/index.vue +++ b/apps/web-antd/src/views/infra/codegen/index.vue @@ -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(); - +