refactor: (web-ele)优化多个组件的删除操作和确认逻辑

- 将 ElMessageBox 替换为自定义 confirm 函数- 添加全局 loading 功能
- 优化错误处理和消息提示- 调整部分组件属性和样式
This commit is contained in:
lrl
2025-08-01 13:56:55 +08:00
parent c447145d62
commit 38daaa2934
63 changed files with 674 additions and 662 deletions

View File

@@ -3,10 +3,10 @@ import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { MallBrokerageUserApi } from '#/api/mall/trade/brokerage/user';
import { useAccess } from '@vben/access';
import { DocAlert, Page, useVbenModal } from '@vben/common-ui';
import { confirm, DocAlert, Page, useVbenModal } from '@vben/common-ui';
import { $t } from '@vben/locales';
import { ElLoading, ElMessage, ElMessageBox, ElSwitch } from 'element-plus';
import { ElLoading, ElMessage, ElSwitch } from 'element-plus';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import {
@@ -68,11 +68,7 @@ function openCreateUserForm() {
/** 清除上级推广人 */
async function handleClearBindUser(row: MallBrokerageUserApi.BrokerageUser) {
await ElMessageBox.confirm(`确定清除"${row.nickname}"的上级推广人吗?`, {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
});
await confirm(`确定清除"${row.nickname}"的上级推广人吗?`);
await clearBindUser({ id: row.id as number });
ElMessage.success('清除成功');
onRefresh();

View File

@@ -4,10 +4,10 @@ import type { MallBrokerageWithdrawApi } from '#/api/mall/trade/brokerage/withdr
import { h } from 'vue';
import { Page, prompt } from '@vben/common-ui';
import { confirm, Page, prompt } from '@vben/common-ui';
import { formatDateTime } from '@vben/utils';
import { ElInput, ElMessage, ElMessageBox } from 'element-plus';
import { ElInput, ElMessage } from 'element-plus';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import {
@@ -35,11 +35,7 @@ function onRefresh() {
/** 审核通过 */
async function handleApprove(row: MallBrokerageWithdrawApi.BrokerageWithdraw) {
await ElMessageBox.confirm('确定要审核通过吗?', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
});
await confirm('确定要审核通过吗?');
await approveBrokerageWithdraw(row.id);
ElMessage.success($t('ui.actionMessage.operationSuccess'));
onRefresh();
@@ -73,11 +69,7 @@ function handleReject(row: MallBrokerageWithdrawApi.BrokerageWithdraw) {
async function handleRetryTransfer(
row: MallBrokerageWithdrawApi.BrokerageWithdraw,
) {
await ElMessageBox.confirm('确定要重新转账吗?', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
});
await confirm('确定要重新转账吗?');
await approveBrokerageWithdraw(row.id);
ElMessage.success($t('ui.actionMessage.operationSuccess'));
onRefresh();