reactor:【infra 基础设施】config 进一步统一代码风格

This commit is contained in:
YunaiV
2025-09-09 12:20:48 +08:00
parent 8d10030185
commit 96158f22b9
4 changed files with 73 additions and 81 deletions

View File

@@ -126,26 +126,32 @@ export function useGridColumns(): VxeTableGridOptions['columns'] {
{
field: 'id',
title: '参数主键',
minWidth: 100,
},
{
field: 'category',
title: '参数分类',
minWidth: 120,
},
{
field: 'name',
title: '参数名称',
minWidth: 200,
},
{
field: 'key',
title: '参数键名',
minWidth: 200,
},
{
field: 'value',
title: '参数键值',
minWidth: 150,
},
{
field: 'visible',
title: '是否可见',
minWidth: 100,
cellRender: {
name: 'CellDict',
props: { type: DICT_TYPE.INFRA_BOOLEAN_STRING },
@@ -154,6 +160,7 @@ export function useGridColumns(): VxeTableGridOptions['columns'] {
{
field: 'type',
title: '系统内置',
minWidth: 100,
cellRender: {
name: 'CellDict',
props: { type: DICT_TYPE.INFRA_CONFIG_TYPE },
@@ -162,10 +169,12 @@ export function useGridColumns(): VxeTableGridOptions['columns'] {
{
field: 'remark',
title: '备注',
minWidth: 150,
},
{
field: 'createTime',
title: '创建时间',
minWidth: 180,
formatter: 'formatDateTime',
},
{

View File

@@ -4,7 +4,7 @@ import type { InfraConfigApi } from '#/api/infra/config';
import { ref } from 'vue';
import { Page, useVbenModal } from '@vben/common-ui';
import { confirm, Page, useVbenModal } from '@vben/common-ui';
import { downloadFileFromBlobPart, isEmpty } from '@vben/utils';
import { message } from 'ant-design-vue';
@@ -52,14 +52,10 @@ async function handleDelete(row: InfraConfigApi.Config) {
const hideLoading = message.loading({
content: $t('ui.actionMessage.deleting', [row.name]),
duration: 0,
key: 'action_key_msg',
});
try {
await deleteConfig(row.id as number);
message.success({
content: $t('ui.actionMessage.deleteSuccess', [row.name]),
key: 'action_key_msg',
});
message.success($t('ui.actionMessage.deleteSuccess', [row.name]));
onRefresh();
} finally {
hideLoading();
@@ -68,10 +64,10 @@ async function handleDelete(row: InfraConfigApi.Config) {
/** 批量删除参数 */
async function handleDeleteBatch() {
await confirm($t('ui.actionMessage.deleteBatchConfirm'));
const hideLoading = message.loading({
content: $t('ui.actionMessage.deleting'),
content: $t('ui.actionMessage.deletingBatch'),
duration: 0,
key: 'action_process_msg',
});
try {
await deleteConfigList(checkedIds.value);
@@ -135,7 +131,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
<TableAction
:actions="[
{
label: $t('ui.actionTitle.create', ['参数列表']),
label: $t('ui.actionTitle.create', ['参数']),
type: 'primary',
icon: ACTION_ICON.ADD,
auth: ['infra:config:create'],
@@ -149,11 +145,11 @@ const [Grid, gridApi] = useVbenVxeGrid({
onClick: handleExport,
},
{
label: '批量删除',
label: $t('ui.actionTitle.deleteBatch'),
type: 'primary',
danger: true,
disabled: isEmpty(checkedIds),
icon: ACTION_ICON.DELETE,
disabled: isEmpty(checkedIds),
auth: ['infra:config:delete'],
onClick: handleDeleteBatch,
},
@@ -167,7 +163,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
label: $t('common.edit'),
type: 'link',
icon: ACTION_ICON.EDIT,
auth: ['system:post:update'],
auth: ['infra:config:update'],
onClick: handleEdit.bind(null, row),
},
{
@@ -175,7 +171,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
type: 'link',
danger: true,
icon: ACTION_ICON.DELETE,
auth: ['system:post:delete'],
auth: ['infra:config:delete'],
popConfirm: {
title: $t('ui.actionMessage.deleteConfirm', [row.name]),
confirm: handleDelete.bind(null, row),