fix: delete loading
parent
8c42af49d2
commit
2ea9b4781e
|
@ -1,2 +1,4 @@
|
||||||
export { default as TableAction } from './table-action.vue';
|
export { default as TableAction } from './table-action.vue';
|
||||||
|
|
||||||
|
export const ACTION_KEY = 'action_key_msg';
|
||||||
export * from './typing';
|
export * from './typing';
|
||||||
|
|
|
@ -11,7 +11,7 @@ import { Button, message } from 'ant-design-vue';
|
||||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||||
import { deleteRole, exportRole, getRolePage } from '#/api/system/role';
|
import { deleteRole, exportRole, getRolePage } from '#/api/system/role';
|
||||||
import { DocAlert } from '#/components/doc-alert';
|
import { DocAlert } from '#/components/doc-alert';
|
||||||
import { TableAction } from '#/components/table-action';
|
import { ACTION_KEY, TableAction } from '#/components/table-action';
|
||||||
import { $t } from '#/locales';
|
import { $t } from '#/locales';
|
||||||
|
|
||||||
import { useGridColumns, useGridFormSchema } from './data';
|
import { useGridColumns, useGridFormSchema } from './data';
|
||||||
|
@ -58,20 +58,16 @@ function onCreate() {
|
||||||
|
|
||||||
/** 删除角色 */
|
/** 删除角色 */
|
||||||
async function onDelete(row: SystemRoleApi.Role) {
|
async function onDelete(row: SystemRoleApi.Role) {
|
||||||
const hideLoading = message.loading({
|
message.loading({
|
||||||
content: $t('ui.actionMessage.deleting', [row.name]),
|
content: $t('ui.actionMessage.deleting', [row.name]),
|
||||||
duration: 0,
|
key: ACTION_KEY,
|
||||||
key: 'action_process_msg',
|
|
||||||
});
|
});
|
||||||
try {
|
|
||||||
await deleteRole(row.id as number);
|
await deleteRole(row.id as number);
|
||||||
// TODO @xingyu:是不是统一 finally hideLoading 比较好?
|
message.success({
|
||||||
hideLoading();
|
content: $t('ui.actionMessage.deleteSuccess', [row.name]),
|
||||||
message.success($t('ui.actionMessage.deleteSuccess', [row.name]));
|
key: ACTION_KEY,
|
||||||
|
});
|
||||||
onRefresh();
|
onRefresh();
|
||||||
} catch {
|
|
||||||
hideLoading();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 分配角色的数据权限 */
|
/** 分配角色的数据权限 */
|
||||||
|
|
|
@ -15,6 +15,7 @@ import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||||
import { deleteTenant, exportTenant, getTenantPage } from '#/api/system/tenant';
|
import { deleteTenant, exportTenant, getTenantPage } from '#/api/system/tenant';
|
||||||
import { getTenantPackageList } from '#/api/system/tenant-package';
|
import { getTenantPackageList } from '#/api/system/tenant-package';
|
||||||
import { DocAlert } from '#/components/doc-alert';
|
import { DocAlert } from '#/components/doc-alert';
|
||||||
|
import { ACTION_KEY, TableAction } from '#/components/table-action';
|
||||||
import { $t } from '#/locales';
|
import { $t } from '#/locales';
|
||||||
|
|
||||||
import { useGridColumns, useGridFormSchema } from './data';
|
import { useGridColumns, useGridFormSchema } from './data';
|
||||||
|
@ -58,16 +59,16 @@ function onEdit(row: SystemTenantApi.Tenant) {
|
||||||
|
|
||||||
/** 删除租户 */
|
/** 删除租户 */
|
||||||
async function onDelete(row: SystemTenantApi.Tenant) {
|
async function onDelete(row: SystemTenantApi.Tenant) {
|
||||||
try {
|
|
||||||
message.loading({
|
message.loading({
|
||||||
content: $t('ui.actionMessage.deleting', [row.name]),
|
content: $t('ui.actionMessage.deleting', [row.name]),
|
||||||
duration: 2.5,
|
key: ACTION_KEY,
|
||||||
});
|
});
|
||||||
await deleteTenant(row.id as number);
|
await deleteTenant(row.id as number);
|
||||||
|
message.success({
|
||||||
|
content: $t('ui.actionMessage.deleteSuccess', [row.name]),
|
||||||
|
key: ACTION_KEY,
|
||||||
|
});
|
||||||
onRefresh();
|
onRefresh();
|
||||||
} finally {
|
|
||||||
message.error($t('ui.actionMessage.deleteFailed', [row.name]));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const [Grid, gridApi] = useVbenVxeGrid({
|
const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
|
|
|
@ -13,6 +13,7 @@ import {
|
||||||
getTenantPackagePage,
|
getTenantPackagePage,
|
||||||
} from '#/api/system/tenant-package';
|
} from '#/api/system/tenant-package';
|
||||||
import { DocAlert } from '#/components/doc-alert';
|
import { DocAlert } from '#/components/doc-alert';
|
||||||
|
import { ACTION_KEY, TableAction } from '#/components/table-action';
|
||||||
import { $t } from '#/locales';
|
import { $t } from '#/locales';
|
||||||
|
|
||||||
import { useGridColumns, useGridFormSchema } from './data';
|
import { useGridColumns, useGridFormSchema } from './data';
|
||||||
|
@ -40,18 +41,16 @@ function onEdit(row: SystemTenantPackageApi.TenantPackage) {
|
||||||
|
|
||||||
/** 删除租户套餐 */
|
/** 删除租户套餐 */
|
||||||
async function onDelete(row: SystemTenantPackageApi.TenantPackage) {
|
async function onDelete(row: SystemTenantPackageApi.TenantPackage) {
|
||||||
const hideLoading = message.loading({
|
message.loading({
|
||||||
content: $t('ui.actionMessage.deleting', [row.name]),
|
content: $t('ui.actionMessage.deleting', [row.name]),
|
||||||
duration: 0,
|
key: ACTION_KEY,
|
||||||
key: 'action_process_msg',
|
|
||||||
});
|
});
|
||||||
try {
|
|
||||||
await deleteTenantPackage(row.id as number);
|
await deleteTenantPackage(row.id as number);
|
||||||
message.success($t('ui.actionMessage.deleteSuccess', [row.name]));
|
message.success({
|
||||||
|
content: $t('ui.actionMessage.deleteSuccess', [row.name]),
|
||||||
|
key: ACTION_KEY,
|
||||||
|
});
|
||||||
onRefresh();
|
onRefresh();
|
||||||
} catch {
|
|
||||||
hideLoading();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const [Grid, gridApi] = useVbenVxeGrid({
|
const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
|
|
|
@ -19,7 +19,7 @@ import {
|
||||||
updateUserStatus,
|
updateUserStatus,
|
||||||
} from '#/api/system/user';
|
} from '#/api/system/user';
|
||||||
import { DocAlert } from '#/components/doc-alert';
|
import { DocAlert } from '#/components/doc-alert';
|
||||||
import { TableAction } from '#/components/table-action';
|
import { ACTION_KEY, TableAction } from '#/components/table-action';
|
||||||
import { $t } from '#/locales';
|
import { $t } from '#/locales';
|
||||||
import { DICT_TYPE, getDictLabel } from '#/utils';
|
import { DICT_TYPE, getDictLabel } from '#/utils';
|
||||||
|
|
||||||
|
@ -85,18 +85,16 @@ function onEdit(row: SystemUserApi.User) {
|
||||||
|
|
||||||
/** 删除用户 */
|
/** 删除用户 */
|
||||||
async function onDelete(row: SystemUserApi.User) {
|
async function onDelete(row: SystemUserApi.User) {
|
||||||
const hideLoading = message.loading({
|
message.loading({
|
||||||
content: $t('ui.actionMessage.deleting', [row.username]),
|
content: $t('ui.actionMessage.deleting', [row.username]),
|
||||||
duration: 0,
|
key: ACTION_KEY,
|
||||||
key: 'action_process_msg',
|
|
||||||
});
|
});
|
||||||
try {
|
|
||||||
await deleteUser(row.id as number);
|
await deleteUser(row.id as number);
|
||||||
message.success($t('ui.actionMessage.deleteSuccess', [row.username]));
|
message.success({
|
||||||
|
content: $t('ui.actionMessage.deleteSuccess', [row.username]),
|
||||||
|
key: ACTION_KEY,
|
||||||
|
});
|
||||||
onRefresh();
|
onRefresh();
|
||||||
} catch {
|
|
||||||
hideLoading();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 重置密码 */
|
/** 重置密码 */
|
||||||
|
|
Loading…
Reference in New Issue