reactor:【infra 基础设施】fileConfig 进一步统一代码风格
parent
b52f7803ad
commit
cdc350cef9
|
@ -28,7 +28,7 @@ const [FormModal, formModalApi] = useVbenModal({
|
||||||
});
|
});
|
||||||
|
|
||||||
/** 刷新表格 */
|
/** 刷新表格 */
|
||||||
function onRefresh() {
|
function handleRefresh() {
|
||||||
gridApi.query();
|
gridApi.query();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,12 +47,11 @@ async function handleMaster(row: InfraFileConfigApi.FileConfig) {
|
||||||
const hideLoading = message.loading({
|
const hideLoading = message.loading({
|
||||||
content: $t('ui.actionMessage.updating', [row.name]),
|
content: $t('ui.actionMessage.updating', [row.name]),
|
||||||
duration: 0,
|
duration: 0,
|
||||||
key: 'action_process_msg',
|
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
await updateFileConfigMaster(row.id as number);
|
await updateFileConfigMaster(row.id!);
|
||||||
message.success($t('ui.actionMessage.updateSuccess', [row.name]));
|
message.success($t('ui.actionMessage.updateSuccess', [row.name]));
|
||||||
onRefresh();
|
handleRefresh();
|
||||||
} finally {
|
} finally {
|
||||||
hideLoading();
|
hideLoading();
|
||||||
}
|
}
|
||||||
|
@ -63,11 +62,9 @@ async function handleTest(row: InfraFileConfigApi.FileConfig) {
|
||||||
const hideLoading = message.loading({
|
const hideLoading = message.loading({
|
||||||
content: '测试上传中...',
|
content: '测试上传中...',
|
||||||
duration: 0,
|
duration: 0,
|
||||||
key: 'action_process_msg',
|
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
const response = await testFileConfig(row.id as number);
|
const response = await testFileConfig(row.id!);
|
||||||
hideLoading();
|
|
||||||
// 确认是否访问该文件
|
// 确认是否访问该文件
|
||||||
confirm({
|
confirm({
|
||||||
title: '测试上传成功',
|
title: '测试上传成功',
|
||||||
|
@ -86,15 +83,28 @@ async function handleTest(row: InfraFileConfigApi.FileConfig) {
|
||||||
async function handleDelete(row: InfraFileConfigApi.FileConfig) {
|
async function handleDelete(row: InfraFileConfigApi.FileConfig) {
|
||||||
const hideLoading = message.loading({
|
const hideLoading = message.loading({
|
||||||
content: $t('ui.actionMessage.deleting', [row.name]),
|
content: $t('ui.actionMessage.deleting', [row.name]),
|
||||||
key: 'action_key_msg',
|
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
await deleteFileConfig(row.id as number);
|
await deleteFileConfig(row.id as number);
|
||||||
message.success({
|
message.success($t('ui.actionMessage.deleteSuccess', [row.name]));
|
||||||
content: $t('ui.actionMessage.deleteSuccess', [row.name]),
|
handleRefresh();
|
||||||
key: 'action_key_msg',
|
} finally {
|
||||||
|
hideLoading();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 批量删除文件配置 */
|
||||||
|
async function handleDeleteBatch() {
|
||||||
|
await confirm($t('ui.actionMessage.deleteBatchConfirm'));
|
||||||
|
const hideLoading = message.loading({
|
||||||
|
content: $t('ui.actionMessage.deletingBatch'),
|
||||||
|
duration: 0,
|
||||||
});
|
});
|
||||||
onRefresh();
|
try {
|
||||||
|
await deleteFileConfigList(checkedIds.value);
|
||||||
|
checkedIds.value = [];
|
||||||
|
message.success($t('ui.actionMessage.deleteSuccess'));
|
||||||
|
handleRefresh();
|
||||||
} finally {
|
} finally {
|
||||||
hideLoading();
|
hideLoading();
|
||||||
}
|
}
|
||||||
|
@ -109,23 +119,6 @@ function handleRowCheckboxChange({
|
||||||
checkedIds.value = records.map((item) => item.id!);
|
checkedIds.value = records.map((item) => item.id!);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 批量删除文件配置 */
|
|
||||||
async function handleDeleteBatch() {
|
|
||||||
const hideLoading = message.loading({
|
|
||||||
content: $t('ui.actionMessage.deleting'),
|
|
||||||
duration: 0,
|
|
||||||
key: 'action_process_msg',
|
|
||||||
});
|
|
||||||
try {
|
|
||||||
await deleteFileConfigList(checkedIds.value);
|
|
||||||
checkedIds.value = [];
|
|
||||||
message.success($t('ui.actionMessage.deleteSuccess'));
|
|
||||||
onRefresh();
|
|
||||||
} finally {
|
|
||||||
hideLoading();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const [Grid, gridApi] = useVbenVxeGrid({
|
const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
formOptions: {
|
formOptions: {
|
||||||
schema: useGridFormSchema(),
|
schema: useGridFormSchema(),
|
||||||
|
@ -163,7 +156,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<Page auto-content-height>
|
<Page auto-content-height>
|
||||||
<FormModal @success="onRefresh" />
|
<FormModal @success="handleRefresh" />
|
||||||
<Grid table-title="文件配置列表">
|
<Grid table-title="文件配置列表">
|
||||||
<template #toolbar-tools>
|
<template #toolbar-tools>
|
||||||
<TableAction
|
<TableAction
|
||||||
|
@ -176,11 +169,11 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
onClick: handleCreate,
|
onClick: handleCreate,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '批量删除',
|
label: $t('ui.actionTitle.deleteBatch'),
|
||||||
type: 'primary',
|
type: 'primary',
|
||||||
danger: true,
|
danger: true,
|
||||||
disabled: isEmpty(checkedIds),
|
|
||||||
icon: ACTION_ICON.DELETE,
|
icon: ACTION_ICON.DELETE,
|
||||||
|
disabled: isEmpty(checkedIds),
|
||||||
auth: ['infra:file-config:delete'],
|
auth: ['infra:file-config:delete'],
|
||||||
onClick: handleDeleteBatch,
|
onClick: handleDeleteBatch,
|
||||||
},
|
},
|
||||||
|
@ -204,12 +197,12 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
auth: ['infra:file-config:update'],
|
auth: ['infra:file-config:update'],
|
||||||
onClick: handleTest.bind(null, row),
|
onClick: handleTest.bind(null, row),
|
||||||
},
|
},
|
||||||
]"
|
|
||||||
:drop-down-actions="[
|
|
||||||
{
|
{
|
||||||
label: '主配置',
|
label: '主配置',
|
||||||
type: 'link',
|
type: 'link',
|
||||||
|
icon: ACTION_ICON.ADD,
|
||||||
auth: ['infra:file-config:update'],
|
auth: ['infra:file-config:update'],
|
||||||
|
disabled: row.master,
|
||||||
popConfirm: {
|
popConfirm: {
|
||||||
title: `是否要将${row.name}设为主配置?`,
|
title: `是否要将${row.name}设为主配置?`,
|
||||||
confirm: handleMaster.bind(null, row),
|
confirm: handleMaster.bind(null, row),
|
||||||
|
@ -219,6 +212,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
label: $t('common.delete'),
|
label: $t('common.delete'),
|
||||||
type: 'link',
|
type: 'link',
|
||||||
danger: true,
|
danger: true,
|
||||||
|
icon: ACTION_ICON.DELETE,
|
||||||
auth: ['infra:file-config:delete'],
|
auth: ['infra:file-config:delete'],
|
||||||
popConfirm: {
|
popConfirm: {
|
||||||
title: $t('ui.actionMessage.deleteConfirm', [row.name]),
|
title: $t('ui.actionMessage.deleteConfirm', [row.name]),
|
||||||
|
|
Loading…
Reference in New Issue