perf: 方法名前缀 handle

This commit is contained in:
xingyu4j
2025-05-20 11:23:02 +08:00
parent c88bd198d4
commit 302bcc25fb
31 changed files with 422 additions and 379 deletions

View File

@@ -28,27 +28,31 @@ function onRefresh() {
}
/** 创建邮箱账号 */
function onCreate() {
function handleCreate() {
formModalApi.setData(null).open();
}
/** 编辑邮箱账号 */
function onEdit(row: SystemMailAccountApi.MailAccount) {
function handleEdit(row: SystemMailAccountApi.MailAccount) {
formModalApi.setData(row).open();
}
/** 删除邮箱账号 */
async function onDelete(row: SystemMailAccountApi.MailAccount) {
message.loading({
async function handleDelete(row: SystemMailAccountApi.MailAccount) {
const hideLoading = message.loading({
content: $t('ui.actionMessage.deleting', [row.mail]),
key: 'action_key_msg',
});
await deleteMailAccount(row.id as number);
message.success({
content: $t('ui.actionMessage.deleteSuccess', [row.mail]),
key: 'action_key_msg',
});
onRefresh();
try {
await deleteMailAccount(row.id as number);
message.success({
content: $t('ui.actionMessage.deleteSuccess', [row.mail]),
key: 'action_key_msg',
});
onRefresh();
} finally {
hideLoading();
}
}
const [Grid, gridApi] = useVbenVxeGrid({
@@ -96,7 +100,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
type: 'primary',
icon: ACTION_ICON.ADD,
auth: ['system:mail-account:create'],
onClick: onCreate,
onClick: handleCreate,
},
]"
/>
@@ -109,7 +113,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
type: 'link',
icon: ACTION_ICON.EDIT,
auth: ['system:mail-account:update'],
onClick: onEdit.bind(null, row),
onClick: handleEdit.bind(null, row),
},
{
label: $t('common.delete'),
@@ -119,7 +123,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
auth: ['system:mail-account:delete'],
popConfirm: {
title: $t('ui.actionMessage.deleteConfirm', [row.name]),
confirm: onDelete.bind(null, row),
confirm: handleDelete.bind(null, row),
},
},
]"

View File

@@ -22,7 +22,7 @@ function onRefresh() {
}
/** 查看邮件日志 */
function onDetail(row: SystemMailLogApi.MailLog) {
function handleDetail(row: SystemMailLogApi.MailLog) {
detailModalApi.setData(row).open();
}
@@ -71,7 +71,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
type: 'link',
icon: ACTION_ICON.VIEW,
auth: ['system:mail-log:query'],
onClick: onDetail.bind(null, row),
onClick: handleDetail.bind(null, row),
},
]"
/>

View File

@@ -40,22 +40,22 @@ function onRefresh() {
}
/** 创建邮件模板 */
function onCreate() {
function handleCreate() {
formModalApi.setData(null).open();
}
/** 编辑邮件模板 */
function onEdit(row: SystemMailTemplateApi.MailTemplate) {
function handleEdit(row: SystemMailTemplateApi.MailTemplate) {
formModalApi.setData(row).open();
}
/** 发送测试邮件 */
function onSend(row: SystemMailTemplateApi.MailTemplate) {
function handleSend(row: SystemMailTemplateApi.MailTemplate) {
sendModalApi.setData(row).open();
}
/** 删除邮件模板 */
async function onDelete(row: SystemMailTemplateApi.MailTemplate) {
async function handleDelete(row: SystemMailTemplateApi.MailTemplate) {
message.loading({
content: $t('ui.actionMessage.deleting', [row.name]),
duration: 0,
@@ -125,7 +125,7 @@ onMounted(async () => {
type: 'primary',
icon: ACTION_ICON.ADD,
auth: ['system:mail-template:create'],
onClick: onCreate,
onClick: handleCreate,
},
]"
/>
@@ -138,14 +138,14 @@ onMounted(async () => {
type: 'link',
icon: ACTION_ICON.EDIT,
auth: ['system:mail-template:update'],
onClick: onEdit.bind(null, row),
onClick: handleEdit.bind(null, row),
},
{
label: '测试',
type: 'link',
icon: ACTION_ICON.EDIT,
auth: ['system:mail-template:send-mail'],
onClick: onSend.bind(null, row),
onClick: handleSend.bind(null, row),
},
{
label: $t('common.delete'),
@@ -155,7 +155,7 @@ onMounted(async () => {
auth: ['system:mail-template:delete'],
popConfirm: {
title: $t('ui.actionMessage.deleteConfirm', [row.name]),
confirm: onDelete.bind(null, row),
confirm: handleDelete.bind(null, row),
},
},
]"

View File

@@ -83,7 +83,7 @@ const [Modal, modalApi] = useVbenModal({
});
/** 动态构建表单 schema */
const buildFormSchema = () => {
function buildFormSchema() {
const schema = useSendMailFormSchema();
if (formData.value?.params) {
formData.value.params?.forEach((param: string) => {
@@ -99,7 +99,7 @@ const buildFormSchema = () => {
});
}
return schema;
};
}
</script>
<template>