fix: 【antd】修复添加批量删除时产生的副作用
parent
2939c2e4f5
commit
0d411310fe
|
|
@ -61,12 +61,14 @@ function handleEdit(row: SystemDeptApi.Dept) {
|
||||||
async function handleDelete(row: SystemDeptApi.Dept) {
|
async function handleDelete(row: SystemDeptApi.Dept) {
|
||||||
const hideLoading = message.loading({
|
const hideLoading = message.loading({
|
||||||
content: $t('ui.actionMessage.deleting', [row.name]),
|
content: $t('ui.actionMessage.deleting', [row.name]),
|
||||||
duration: 0,
|
key: 'action_key_msg',
|
||||||
key: 'action_process_msg',
|
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
await deleteDept(row.id as number);
|
await deleteDept(row.id as number);
|
||||||
message.success($t('ui.actionMessage.deleteSuccess', [row.name]));
|
message.success({
|
||||||
|
content: $t('ui.actionMessage.deleteSuccess', [row.name]),
|
||||||
|
key: 'action_key_msg',
|
||||||
|
});
|
||||||
onRefresh();
|
onRefresh();
|
||||||
} finally {
|
} finally {
|
||||||
hideLoading();
|
hideLoading();
|
||||||
|
|
|
||||||
|
|
@ -58,12 +58,14 @@ function handleEdit(row: SystemDictDataApi.DictData) {
|
||||||
async function handleDelete(row: SystemDictDataApi.DictData) {
|
async function handleDelete(row: SystemDictDataApi.DictData) {
|
||||||
const hideLoading = message.loading({
|
const hideLoading = message.loading({
|
||||||
content: $t('ui.actionMessage.deleting', [row.label]),
|
content: $t('ui.actionMessage.deleting', [row.label]),
|
||||||
duration: 0,
|
key: 'action_key_msg',
|
||||||
key: 'action_process_msg',
|
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
await deleteDictData(row.id as number);
|
await deleteDictData(row.id as number);
|
||||||
message.success($t('ui.actionMessage.deleteSuccess', [row.label]));
|
message.success({
|
||||||
|
content: $t('ui.actionMessage.deleteSuccess', [row.label]),
|
||||||
|
key: 'action_key_msg',
|
||||||
|
});
|
||||||
onRefresh();
|
onRefresh();
|
||||||
} finally {
|
} finally {
|
||||||
hideLoading();
|
hideLoading();
|
||||||
|
|
|
||||||
|
|
@ -56,12 +56,14 @@ function handleEdit(row: any) {
|
||||||
async function handleDelete(row: SystemDictTypeApi.DictType) {
|
async function handleDelete(row: SystemDictTypeApi.DictType) {
|
||||||
const hideLoading = message.loading({
|
const hideLoading = message.loading({
|
||||||
content: $t('ui.actionMessage.deleting', [row.name]),
|
content: $t('ui.actionMessage.deleting', [row.name]),
|
||||||
duration: 0,
|
key: 'action_key_msg',
|
||||||
key: 'action_process_msg',
|
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
await deleteDictType(row.id as number);
|
await deleteDictType(row.id as number);
|
||||||
message.success($t('ui.actionMessage.deleteSuccess', [row.name]));
|
message.success({
|
||||||
|
content: $t('ui.actionMessage.deleteSuccess', [row.name]),
|
||||||
|
key: 'action_key_msg',
|
||||||
|
});
|
||||||
onRefresh();
|
onRefresh();
|
||||||
} finally {
|
} finally {
|
||||||
hideLoading();
|
hideLoading();
|
||||||
|
|
|
||||||
|
|
@ -44,12 +44,14 @@ function handleEdit(row: SystemMailAccountApi.MailAccount) {
|
||||||
async function handleDelete(row: SystemMailAccountApi.MailAccount) {
|
async function handleDelete(row: SystemMailAccountApi.MailAccount) {
|
||||||
const hideLoading = message.loading({
|
const hideLoading = message.loading({
|
||||||
content: $t('ui.actionMessage.deleting', [row.mail]),
|
content: $t('ui.actionMessage.deleting', [row.mail]),
|
||||||
duration: 0,
|
key: 'action_key_msg',
|
||||||
key: 'action_process_msg',
|
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
await deleteMailAccount(row.id as number);
|
await deleteMailAccount(row.id as number);
|
||||||
message.success($t('ui.actionMessage.deleteSuccess', [row.mail]));
|
message.success({
|
||||||
|
content: $t('ui.actionMessage.deleteSuccess', [row.mail]),
|
||||||
|
key: 'action_key_msg',
|
||||||
|
});
|
||||||
onRefresh();
|
onRefresh();
|
||||||
} finally {
|
} finally {
|
||||||
hideLoading();
|
hideLoading();
|
||||||
|
|
|
||||||
|
|
@ -57,18 +57,17 @@ function handleSend(row: SystemMailTemplateApi.MailTemplate) {
|
||||||
|
|
||||||
/** 删除邮件模板 */
|
/** 删除邮件模板 */
|
||||||
async function handleDelete(row: SystemMailTemplateApi.MailTemplate) {
|
async function handleDelete(row: SystemMailTemplateApi.MailTemplate) {
|
||||||
const hideLoading = message.loading({
|
message.loading({
|
||||||
content: $t('ui.actionMessage.deleting', [row.name]),
|
content: $t('ui.actionMessage.deleting', [row.name]),
|
||||||
duration: 0,
|
duration: 0,
|
||||||
key: 'action_process_msg',
|
key: 'action_process_msg',
|
||||||
});
|
});
|
||||||
try {
|
await deleteMailTemplate(row.id as number);
|
||||||
await deleteMailTemplate(row.id as number);
|
message.success({
|
||||||
message.success($t('ui.actionMessage.deleteSuccess', [row.name]));
|
content: $t('ui.actionMessage.deleteSuccess', [row.name]),
|
||||||
onRefresh();
|
key: 'action_key_msg',
|
||||||
} finally {
|
});
|
||||||
hideLoading();
|
onRefresh();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const checkedIds = ref<number[]>([]);
|
const checkedIds = ref<number[]>([]);
|
||||||
|
|
|
||||||
|
|
@ -268,7 +268,6 @@ export function useFormSchema(): VbenFormSchema[] {
|
||||||
/** 列表的字段 */
|
/** 列表的字段 */
|
||||||
export function useGridColumns(): VxeTableGridOptions<SystemMenuApi.Menu>['columns'] {
|
export function useGridColumns(): VxeTableGridOptions<SystemMenuApi.Menu>['columns'] {
|
||||||
return [
|
return [
|
||||||
{ type: 'checkbox', width: 40 },
|
|
||||||
{
|
{
|
||||||
field: 'name',
|
field: 'name',
|
||||||
title: '菜单名称',
|
title: '菜单名称',
|
||||||
|
|
|
||||||
|
|
@ -6,12 +6,11 @@ import { ref } from 'vue';
|
||||||
|
|
||||||
import { DocAlert, Page, useVbenModal } from '@vben/common-ui';
|
import { DocAlert, Page, useVbenModal } from '@vben/common-ui';
|
||||||
import { IconifyIcon } from '@vben/icons';
|
import { IconifyIcon } from '@vben/icons';
|
||||||
import { isEmpty } from '@vben/utils';
|
|
||||||
|
|
||||||
import { message } from 'ant-design-vue';
|
import { message } from 'ant-design-vue';
|
||||||
|
|
||||||
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
|
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||||
import { deleteMenu, deleteMenuList, getMenuList } from '#/api/system/menu';
|
import { deleteMenu, getMenuList } from '#/api/system/menu';
|
||||||
import { $t } from '#/locales';
|
import { $t } from '#/locales';
|
||||||
import { SystemMenuTypeEnum } from '#/utils';
|
import { SystemMenuTypeEnum } from '#/utils';
|
||||||
|
|
||||||
|
|
@ -29,8 +28,13 @@ function onRefresh() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 创建菜单 */
|
/** 创建菜单 */
|
||||||
function handleCreate(parentId?: number) {
|
function handleCreate() {
|
||||||
formModalApi.setData({ parentId: parentId || 0 }).open();
|
formModalApi.setData({}).open();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 添加下级菜单 */
|
||||||
|
function handleAppend(row: SystemMenuApi.Menu) {
|
||||||
|
formModalApi.setData({ pid: row.id }).open();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 编辑菜单 */
|
/** 编辑菜单 */
|
||||||
|
|
@ -42,74 +46,55 @@ function handleEdit(row: SystemMenuApi.Menu) {
|
||||||
async function handleDelete(row: SystemMenuApi.Menu) {
|
async function handleDelete(row: SystemMenuApi.Menu) {
|
||||||
const hideLoading = message.loading({
|
const hideLoading = message.loading({
|
||||||
content: $t('ui.actionMessage.deleting', [row.name]),
|
content: $t('ui.actionMessage.deleting', [row.name]),
|
||||||
duration: 0,
|
key: 'action_key_msg',
|
||||||
key: 'action_process_msg',
|
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
await deleteMenu(row.id);
|
await deleteMenu(row.id as number);
|
||||||
message.success($t('ui.actionMessage.deleteSuccess', [row.name]));
|
message.success({
|
||||||
|
content: $t('ui.actionMessage.deleteSuccess', [row.name]),
|
||||||
|
key: 'action_key_msg',
|
||||||
|
});
|
||||||
onRefresh();
|
onRefresh();
|
||||||
} finally {
|
} finally {
|
||||||
hideLoading();
|
hideLoading();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const checkedIds = ref<number[]>([]);
|
/** 切换树形展开/收缩状态 */
|
||||||
function handleRowCheckboxChange({
|
const isExpanded = ref(false);
|
||||||
records,
|
function toggleExpand() {
|
||||||
}: {
|
isExpanded.value = !isExpanded.value;
|
||||||
records: SystemMenuApi.Menu[];
|
gridApi.grid.setAllTreeExpand(isExpanded.value);
|
||||||
}) {
|
|
||||||
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 deleteMenuList(checkedIds.value);
|
|
||||||
message.success($t('ui.actionMessage.deleteSuccess'));
|
|
||||||
onRefresh();
|
|
||||||
} finally {
|
|
||||||
hideLoading();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const [Grid, gridApi] = useVbenVxeGrid({
|
const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
gridOptions: {
|
gridOptions: {
|
||||||
columns: useGridColumns(),
|
columns: useGridColumns(),
|
||||||
height: 'auto',
|
height: 'auto',
|
||||||
|
keepSource: true,
|
||||||
|
pagerConfig: {
|
||||||
|
enabled: false,
|
||||||
|
},
|
||||||
proxyConfig: {
|
proxyConfig: {
|
||||||
ajax: {
|
ajax: {
|
||||||
query: async () => {
|
query: async (_params) => {
|
||||||
return await getMenuList();
|
return await getMenuList();
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
treeConfig: {
|
|
||||||
transform: true,
|
|
||||||
rowField: 'id',
|
|
||||||
parentField: 'parentId',
|
|
||||||
expandAll: true,
|
|
||||||
accordion: false,
|
|
||||||
},
|
|
||||||
rowConfig: {
|
rowConfig: {
|
||||||
keyField: 'id',
|
keyField: 'id',
|
||||||
isHover: true,
|
|
||||||
},
|
},
|
||||||
toolbarConfig: {
|
toolbarConfig: {
|
||||||
refresh: { code: 'query' },
|
refresh: { code: 'query' },
|
||||||
search: true,
|
|
||||||
},
|
},
|
||||||
} as VxeTableGridOptions<SystemMenuApi.Menu>,
|
treeConfig: {
|
||||||
gridEvents: {
|
parentField: 'parentId',
|
||||||
checkboxAll: handleRowCheckboxChange,
|
rowField: 'id',
|
||||||
checkboxChange: handleRowCheckboxChange,
|
transform: true,
|
||||||
},
|
reserve: true,
|
||||||
|
},
|
||||||
|
} as VxeTableGridOptions,
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
@ -124,7 +109,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<FormModal @success="onRefresh" />
|
<FormModal @success="onRefresh" />
|
||||||
<Grid table-title="菜单列表">
|
<Grid>
|
||||||
<template #toolbar-tools>
|
<template #toolbar-tools>
|
||||||
<TableAction
|
<TableAction
|
||||||
:actions="[
|
:actions="[
|
||||||
|
|
@ -136,13 +121,9 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
onClick: handleCreate,
|
onClick: handleCreate,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '批量删除',
|
label: isExpanded ? '收缩' : '展开',
|
||||||
type: 'primary',
|
type: 'primary',
|
||||||
danger: true,
|
onClick: toggleExpand,
|
||||||
disabled: isEmpty(checkedIds),
|
|
||||||
icon: ACTION_ICON.DELETE,
|
|
||||||
auth: ['system:menu:delete'],
|
|
||||||
onClick: handleDeleteBatch,
|
|
||||||
},
|
},
|
||||||
]"
|
]"
|
||||||
/>
|
/>
|
||||||
|
|
@ -168,6 +149,13 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
<template #actions="{ row }">
|
<template #actions="{ row }">
|
||||||
<TableAction
|
<TableAction
|
||||||
:actions="[
|
:actions="[
|
||||||
|
{
|
||||||
|
label: '新增下级',
|
||||||
|
type: 'link',
|
||||||
|
icon: ACTION_ICON.ADD,
|
||||||
|
auth: ['system:menu:create'],
|
||||||
|
onClick: handleAppend.bind(null, row),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: $t('common.edit'),
|
label: $t('common.edit'),
|
||||||
type: 'link',
|
type: 'link',
|
||||||
|
|
@ -186,14 +174,6 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
confirm: handleDelete.bind(null, row),
|
confirm: handleDelete.bind(null, row),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
|
||||||
label: '添加下级',
|
|
||||||
type: 'link',
|
|
||||||
icon: ACTION_ICON.ADD,
|
|
||||||
auth: ['system:menu:create'],
|
|
||||||
onClick: handleCreate.bind(null, row.id),
|
|
||||||
ifShow: () => row.type !== 3,
|
|
||||||
},
|
|
||||||
]"
|
]"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
|
|
@ -45,12 +45,14 @@ function handleEdit(row: SystemNoticeApi.Notice) {
|
||||||
async function handleDelete(row: SystemNoticeApi.Notice) {
|
async function handleDelete(row: SystemNoticeApi.Notice) {
|
||||||
const hideLoading = message.loading({
|
const hideLoading = message.loading({
|
||||||
content: $t('ui.actionMessage.deleting', [row.title]),
|
content: $t('ui.actionMessage.deleting', [row.title]),
|
||||||
duration: 0,
|
key: 'action_key_msg',
|
||||||
key: 'action_process_msg',
|
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
await deleteNotice(row.id as number);
|
await deleteNotice(row.id as number);
|
||||||
message.success($t('ui.actionMessage.deleteSuccess', [row.title]));
|
message.success({
|
||||||
|
content: $t('ui.actionMessage.deleteSuccess', [row.title]),
|
||||||
|
key: 'action_key_msg',
|
||||||
|
});
|
||||||
onRefresh();
|
onRefresh();
|
||||||
} finally {
|
} finally {
|
||||||
hideLoading();
|
hideLoading();
|
||||||
|
|
@ -90,7 +92,10 @@ async function handlePush(row: SystemNoticeApi.Notice) {
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
await pushNotice(row.id as number);
|
await pushNotice(row.id as number);
|
||||||
message.success($t('ui.actionMessage.operationSuccess'));
|
message.success({
|
||||||
|
content: $t('ui.actionMessage.operationSuccess'),
|
||||||
|
key: 'action_key_msg',
|
||||||
|
});
|
||||||
} finally {
|
} finally {
|
||||||
hideLoading();
|
hideLoading();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -62,12 +62,14 @@ function handleSend(row: SystemNotifyTemplateApi.NotifyTemplate) {
|
||||||
async function handleDelete(row: SystemNotifyTemplateApi.NotifyTemplate) {
|
async function handleDelete(row: SystemNotifyTemplateApi.NotifyTemplate) {
|
||||||
const hideLoading = message.loading({
|
const hideLoading = message.loading({
|
||||||
content: $t('ui.actionMessage.deleting', [row.name]),
|
content: $t('ui.actionMessage.deleting', [row.name]),
|
||||||
duration: 0,
|
key: 'action_key_msg',
|
||||||
key: 'action_process_msg',
|
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
await deleteNotifyTemplate(row.id as number);
|
await deleteNotifyTemplate(row.id as number);
|
||||||
message.success($t('ui.actionMessage.deleteSuccess', [row.name]));
|
message.success({
|
||||||
|
content: $t('ui.actionMessage.deleteSuccess', [row.name]),
|
||||||
|
key: 'action_key_msg',
|
||||||
|
});
|
||||||
onRefresh();
|
onRefresh();
|
||||||
} finally {
|
} finally {
|
||||||
hideLoading();
|
hideLoading();
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,6 @@
|
||||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||||
import type { SystemOAuth2TokenApi } from '#/api/system/oauth2/token';
|
import type { SystemOAuth2TokenApi } from '#/api/system/oauth2/token';
|
||||||
|
|
||||||
import { ref } from 'vue';
|
|
||||||
|
|
||||||
import { DocAlert, Page } from '@vben/common-ui';
|
import { DocAlert, Page } from '@vben/common-ui';
|
||||||
|
|
||||||
import { message } from 'ant-design-vue';
|
import { message } from 'ant-design-vue';
|
||||||
|
|
@ -11,7 +9,6 @@ import { message } from 'ant-design-vue';
|
||||||
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
|
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||||
import {
|
import {
|
||||||
deleteOAuth2Token,
|
deleteOAuth2Token,
|
||||||
deleteOAuth2TokenList,
|
|
||||||
getOAuth2TokenPage,
|
getOAuth2TokenPage,
|
||||||
} from '#/api/system/oauth2/token';
|
} from '#/api/system/oauth2/token';
|
||||||
import { $t } from '#/locales';
|
import { $t } from '#/locales';
|
||||||
|
|
@ -41,41 +38,6 @@ async function handleDelete(row: SystemOAuth2TokenApi.OAuth2Token) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 选中的令牌ID
|
|
||||||
const checkedAccessTokens = ref<string[]>([]);
|
|
||||||
|
|
||||||
/** 处理表格选择变化 */
|
|
||||||
function handleSelectionChange({
|
|
||||||
selectRecords,
|
|
||||||
}: {
|
|
||||||
selectRecords: SystemOAuth2TokenApi.OAuth2Token[];
|
|
||||||
}) {
|
|
||||||
checkedAccessTokens.value = selectRecords.map((row) => row.accessToken);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 批量删除处理 */
|
|
||||||
async function handleDeleteBatch() {
|
|
||||||
if (checkedAccessTokens.value.length === 0) {
|
|
||||||
message.warning('请至少选择一条数据');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const hideLoading = message.loading({
|
|
||||||
content: $t('ui.actionMessage.deleting', ['令牌']),
|
|
||||||
key: 'action_key_msg',
|
|
||||||
});
|
|
||||||
try {
|
|
||||||
await deleteOAuth2TokenList(checkedAccessTokens.value);
|
|
||||||
message.success({
|
|
||||||
content: $t('ui.actionMessage.deleteSuccess', ['令牌']),
|
|
||||||
key: 'action_key_msg',
|
|
||||||
});
|
|
||||||
checkedAccessTokens.value = [];
|
|
||||||
onRefresh();
|
|
||||||
} finally {
|
|
||||||
hideLoading();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const [Grid, gridApi] = useVbenVxeGrid({
|
const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
formOptions: {
|
formOptions: {
|
||||||
schema: useGridFormSchema(),
|
schema: useGridFormSchema(),
|
||||||
|
|
@ -101,18 +63,6 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
toolbarConfig: {
|
toolbarConfig: {
|
||||||
refresh: { code: 'query' },
|
refresh: { code: 'query' },
|
||||||
search: true,
|
search: true,
|
||||||
slots: {
|
|
||||||
buttons: 'toolbar_buttons',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
checkboxConfig: {
|
|
||||||
checkField: 'checked',
|
|
||||||
trigger: 'row',
|
|
||||||
highlight: true,
|
|
||||||
range: true,
|
|
||||||
},
|
|
||||||
events: {
|
|
||||||
checkboxChange: handleSelectionChange,
|
|
||||||
},
|
},
|
||||||
} as VxeTableGridOptions<SystemOAuth2TokenApi.OAuth2Token>,
|
} as VxeTableGridOptions<SystemOAuth2TokenApi.OAuth2Token>,
|
||||||
});
|
});
|
||||||
|
|
@ -128,20 +78,6 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<Grid table-title="令牌列表">
|
<Grid table-title="令牌列表">
|
||||||
<template #toolbar_buttons>
|
|
||||||
<a-button
|
|
||||||
v-auth="['system:oauth2-token:delete']"
|
|
||||||
type="primary"
|
|
||||||
danger
|
|
||||||
:disabled="checkedAccessTokens.length === 0"
|
|
||||||
@click="handleDeleteBatch"
|
|
||||||
>
|
|
||||||
<template #icon>
|
|
||||||
<component :is="ACTION_ICON.DELETE" />
|
|
||||||
</template>
|
|
||||||
批量强退
|
|
||||||
</a-button>
|
|
||||||
</template>
|
|
||||||
<template #actions="{ row }">
|
<template #actions="{ row }">
|
||||||
<TableAction
|
<TableAction
|
||||||
:actions="[
|
:actions="[
|
||||||
|
|
|
||||||
|
|
@ -51,12 +51,14 @@ function handleEdit(row: SystemPostApi.Post) {
|
||||||
async function handleDelete(row: SystemPostApi.Post) {
|
async function handleDelete(row: SystemPostApi.Post) {
|
||||||
const hideLoading = message.loading({
|
const hideLoading = message.loading({
|
||||||
content: $t('ui.actionMessage.deleting', [row.name]),
|
content: $t('ui.actionMessage.deleting', [row.name]),
|
||||||
duration: 0,
|
key: 'action_key_msg',
|
||||||
key: 'action_process_msg',
|
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
await deletePost(row.id as number);
|
await deletePost(row.id as number);
|
||||||
message.success($t('ui.actionMessage.deleteSuccess', [row.name]));
|
message.success({
|
||||||
|
content: $t('ui.actionMessage.deleteSuccess', [row.name]),
|
||||||
|
key: 'action_key_msg',
|
||||||
|
});
|
||||||
onRefresh();
|
onRefresh();
|
||||||
} finally {
|
} finally {
|
||||||
hideLoading();
|
hideLoading();
|
||||||
|
|
|
||||||
|
|
@ -28,13 +28,14 @@ const [FormModal, formModalApi] = useVbenModal({
|
||||||
destroyOnClose: true,
|
destroyOnClose: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
const [AssignMenuModal, assignMenuModalApi] = useVbenModal({
|
const [AssignDataPermissionFormModel, assignDataPermissionFormApi] =
|
||||||
connectedComponent: AssignMenuForm,
|
useVbenModal({
|
||||||
destroyOnClose: true,
|
connectedComponent: AssignDataPermissionForm,
|
||||||
});
|
destroyOnClose: true,
|
||||||
|
});
|
||||||
|
|
||||||
const [AssignDataPermissionModal, assignDataPermissionModalApi] = useVbenModal({
|
const [AssignMenuFormModel, assignMenuFormApi] = useVbenModal({
|
||||||
connectedComponent: AssignDataPermissionForm,
|
connectedComponent: AssignMenuForm,
|
||||||
destroyOnClose: true,
|
destroyOnClose: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -46,12 +47,7 @@ function onRefresh() {
|
||||||
/** 导出表格 */
|
/** 导出表格 */
|
||||||
async function handleExport() {
|
async function handleExport() {
|
||||||
const data = await exportRole(await gridApi.formApi.getValues());
|
const data = await exportRole(await gridApi.formApi.getValues());
|
||||||
downloadFileFromBlobPart({ fileName: '角色数据.xls', source: data });
|
downloadFileFromBlobPart({ fileName: '角色.xls', source: data });
|
||||||
}
|
|
||||||
|
|
||||||
/** 创建角色 */
|
|
||||||
function handleCreate() {
|
|
||||||
formModalApi.setData(null).open();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 编辑角色 */
|
/** 编辑角色 */
|
||||||
|
|
@ -59,16 +55,23 @@ function handleEdit(row: SystemRoleApi.Role) {
|
||||||
formModalApi.setData(row).open();
|
formModalApi.setData(row).open();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 创建角色 */
|
||||||
|
function handleCreate() {
|
||||||
|
formModalApi.setData(null).open();
|
||||||
|
}
|
||||||
|
|
||||||
/** 删除角色 */
|
/** 删除角色 */
|
||||||
async function handleDelete(row: SystemRoleApi.Role) {
|
async function handleDelete(row: SystemRoleApi.Role) {
|
||||||
const hideLoading = message.loading({
|
const hideLoading = message.loading({
|
||||||
content: $t('ui.actionMessage.deleting', [row.name]),
|
content: $t('ui.actionMessage.deleting', [row.name]),
|
||||||
duration: 0,
|
key: 'action_key_msg',
|
||||||
key: 'action_process_msg',
|
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
await deleteRole(row.id as number);
|
await deleteRole(row.id as number);
|
||||||
message.success($t('ui.actionMessage.deleteSuccess', [row.name]));
|
message.success({
|
||||||
|
content: $t('ui.actionMessage.deleteSuccess', [row.name]),
|
||||||
|
key: 'action_key_msg',
|
||||||
|
});
|
||||||
onRefresh();
|
onRefresh();
|
||||||
} finally {
|
} finally {
|
||||||
hideLoading();
|
hideLoading();
|
||||||
|
|
@ -100,14 +103,14 @@ async function handleDeleteBatch() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 分配菜单 */
|
/** 分配角色的数据权限 */
|
||||||
function handleAssignMenu(row: SystemRoleApi.Role) {
|
function handleAssignDataPermission(row: SystemRoleApi.Role) {
|
||||||
assignMenuModalApi.setData(row).open();
|
assignDataPermissionFormApi.setData(row).open();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 分配数据权限 */
|
/** 分配角色的菜单权限 */
|
||||||
function handleAssignDataPermission(row: SystemRoleApi.Role) {
|
function handleAssignMenu(row: SystemRoleApi.Role) {
|
||||||
assignDataPermissionModalApi.setData(row).open();
|
assignMenuFormApi.setData(row).open();
|
||||||
}
|
}
|
||||||
|
|
||||||
const [Grid, gridApi] = useVbenVxeGrid({
|
const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
|
|
@ -117,6 +120,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
gridOptions: {
|
gridOptions: {
|
||||||
columns: useGridColumns(),
|
columns: useGridColumns(),
|
||||||
height: 'auto',
|
height: 'auto',
|
||||||
|
keepSource: true,
|
||||||
proxyConfig: {
|
proxyConfig: {
|
||||||
ajax: {
|
ajax: {
|
||||||
query: async ({ page }, formValues) => {
|
query: async ({ page }, formValues) => {
|
||||||
|
|
@ -155,8 +159,8 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<FormModal @success="onRefresh" />
|
<FormModal @success="onRefresh" />
|
||||||
<AssignMenuModal @success="onRefresh" />
|
<AssignDataPermissionFormModel @success="onRefresh" />
|
||||||
<AssignDataPermissionModal @success="onRefresh" />
|
<AssignMenuFormModel @success="onRefresh" />
|
||||||
<Grid table-title="角色列表">
|
<Grid table-title="角色列表">
|
||||||
<template #toolbar-tools>
|
<template #toolbar-tools>
|
||||||
<TableAction
|
<TableAction
|
||||||
|
|
@ -211,17 +215,17 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
]"
|
]"
|
||||||
:drop-down-actions="[
|
:drop-down-actions="[
|
||||||
{
|
{
|
||||||
label: '分配菜单',
|
label: '数据权限',
|
||||||
type: 'link',
|
|
||||||
auth: ['system:permission:assign-role-menu'],
|
|
||||||
onClick: handleAssignMenu.bind(null, row),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '分配数据权限',
|
|
||||||
type: 'link',
|
type: 'link',
|
||||||
auth: ['system:permission:assign-role-data-scope'],
|
auth: ['system:permission:assign-role-data-scope'],
|
||||||
onClick: handleAssignDataPermission.bind(null, row),
|
onClick: handleAssignDataPermission.bind(null, row),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: '菜单权限',
|
||||||
|
type: 'link',
|
||||||
|
auth: ['system:permission:assign-role-menu'],
|
||||||
|
onClick: handleAssignMenu.bind(null, row),
|
||||||
|
},
|
||||||
]"
|
]"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
|
|
@ -62,12 +62,14 @@ function handleSend(row: SystemSmsTemplateApi.SmsTemplate) {
|
||||||
async function handleDelete(row: SystemSmsTemplateApi.SmsTemplate) {
|
async function handleDelete(row: SystemSmsTemplateApi.SmsTemplate) {
|
||||||
const hideLoading = message.loading({
|
const hideLoading = message.loading({
|
||||||
content: $t('ui.actionMessage.deleting', [row.name]),
|
content: $t('ui.actionMessage.deleting', [row.name]),
|
||||||
duration: 0,
|
key: 'action_key_msg',
|
||||||
key: 'action_process_msg',
|
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
await deleteSmsTemplate(row.id as number);
|
await deleteSmsTemplate(row.id as number);
|
||||||
message.success($t('ui.actionMessage.deleteSuccess', [row.name]));
|
message.success({
|
||||||
|
content: $t('ui.actionMessage.deleteSuccess', [row.name]),
|
||||||
|
key: 'action_key_msg',
|
||||||
|
});
|
||||||
onRefresh();
|
onRefresh();
|
||||||
} finally {
|
} finally {
|
||||||
hideLoading();
|
hideLoading();
|
||||||
|
|
|
||||||
|
|
@ -63,12 +63,14 @@ function handleEdit(row: SystemTenantApi.Tenant) {
|
||||||
async function handleDelete(row: SystemTenantApi.Tenant) {
|
async function handleDelete(row: SystemTenantApi.Tenant) {
|
||||||
const hideLoading = message.loading({
|
const hideLoading = message.loading({
|
||||||
content: $t('ui.actionMessage.deleting', [row.name]),
|
content: $t('ui.actionMessage.deleting', [row.name]),
|
||||||
duration: 0,
|
key: 'action_key_msg',
|
||||||
key: 'action_process_msg',
|
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
await deleteTenant(row.id as number);
|
await deleteTenant(row.id as number);
|
||||||
message.success($t('ui.actionMessage.deleteSuccess', [row.name]));
|
message.success({
|
||||||
|
content: $t('ui.actionMessage.deleteSuccess', [row.name]),
|
||||||
|
key: 'action_key_msg',
|
||||||
|
});
|
||||||
onRefresh();
|
onRefresh();
|
||||||
} finally {
|
} finally {
|
||||||
hideLoading();
|
hideLoading();
|
||||||
|
|
|
||||||
|
|
@ -44,12 +44,14 @@ function handleEdit(row: SystemTenantPackageApi.TenantPackage) {
|
||||||
async function handleDelete(row: SystemTenantPackageApi.TenantPackage) {
|
async function handleDelete(row: SystemTenantPackageApi.TenantPackage) {
|
||||||
const hideLoading = message.loading({
|
const hideLoading = message.loading({
|
||||||
content: $t('ui.actionMessage.deleting', [row.name]),
|
content: $t('ui.actionMessage.deleting', [row.name]),
|
||||||
duration: 0,
|
key: 'action_key_msg',
|
||||||
key: 'action_process_msg',
|
|
||||||
});
|
});
|
||||||
try {
|
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_msg',
|
||||||
|
});
|
||||||
onRefresh();
|
onRefresh();
|
||||||
} finally {
|
} finally {
|
||||||
hideLoading();
|
hideLoading();
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,11 @@
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||||
|
import type { SystemDeptApi } from '#/api/system/dept';
|
||||||
import type { SystemUserApi } from '#/api/system/user';
|
import type { SystemUserApi } from '#/api/system/user';
|
||||||
|
|
||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
|
|
||||||
import { Page, useVbenModal } from '@vben/common-ui';
|
import { confirm, DocAlert, Page, useVbenModal } from '@vben/common-ui';
|
||||||
import { downloadFileFromBlobPart, isEmpty } from '@vben/utils';
|
import { downloadFileFromBlobPart, isEmpty } from '@vben/utils';
|
||||||
|
|
||||||
import { message } from 'ant-design-vue';
|
import { message } from 'ant-design-vue';
|
||||||
|
|
@ -15,14 +16,14 @@ import {
|
||||||
deleteUserList,
|
deleteUserList,
|
||||||
exportUser,
|
exportUser,
|
||||||
getUserPage,
|
getUserPage,
|
||||||
importUserTemplate,
|
|
||||||
updateUserStatus,
|
updateUserStatus,
|
||||||
} from '#/api/system/user';
|
} from '#/api/system/user';
|
||||||
import { $t } from '#/locales';
|
import { $t } from '#/locales';
|
||||||
import { CommonStatusEnum } from '#/utils';
|
import { DICT_TYPE, getDictLabel } from '#/utils';
|
||||||
|
|
||||||
import { useGridColumns, useGridFormSchema } from './data';
|
import { useGridColumns, useGridFormSchema } from './data';
|
||||||
import AssignRoleForm from './modules/assign-role-form.vue';
|
import AssignRoleForm from './modules/assign-role-form.vue';
|
||||||
|
import DeptTree from './modules/dept-tree.vue';
|
||||||
import Form from './modules/form.vue';
|
import Form from './modules/form.vue';
|
||||||
import ImportForm from './modules/import-form.vue';
|
import ImportForm from './modules/import-form.vue';
|
||||||
import ResetPasswordForm from './modules/reset-password-form.vue';
|
import ResetPasswordForm from './modules/reset-password-form.vue';
|
||||||
|
|
@ -52,11 +53,30 @@ function onRefresh() {
|
||||||
gridApi.query();
|
gridApi.query();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 导出表格 */
|
||||||
|
async function handleExport() {
|
||||||
|
const data = await exportUser(await gridApi.formApi.getValues());
|
||||||
|
downloadFileFromBlobPart({ fileName: '用户.xls', source: data });
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 选择部门 */
|
||||||
|
const searchDeptId = ref<number | undefined>(undefined);
|
||||||
|
|
||||||
|
async function handleDeptSelect(dept: SystemDeptApi.Dept) {
|
||||||
|
searchDeptId.value = dept.id;
|
||||||
|
onRefresh();
|
||||||
|
}
|
||||||
|
|
||||||
/** 创建用户 */
|
/** 创建用户 */
|
||||||
function handleCreate() {
|
function handleCreate() {
|
||||||
formModalApi.setData(null).open();
|
formModalApi.setData(null).open();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 导入用户 */
|
||||||
|
function handleImport() {
|
||||||
|
importModalApi.open();
|
||||||
|
}
|
||||||
|
|
||||||
/** 编辑用户 */
|
/** 编辑用户 */
|
||||||
function handleEdit(row: SystemUserApi.User) {
|
function handleEdit(row: SystemUserApi.User) {
|
||||||
formModalApi.setData(row).open();
|
formModalApi.setData(row).open();
|
||||||
|
|
@ -66,12 +86,14 @@ function handleEdit(row: SystemUserApi.User) {
|
||||||
async function handleDelete(row: SystemUserApi.User) {
|
async function handleDelete(row: SystemUserApi.User) {
|
||||||
const hideLoading = message.loading({
|
const hideLoading = message.loading({
|
||||||
content: $t('ui.actionMessage.deleting', [row.username]),
|
content: $t('ui.actionMessage.deleting', [row.username]),
|
||||||
duration: 0,
|
key: 'action_key_msg',
|
||||||
key: 'action_process_msg',
|
|
||||||
});
|
});
|
||||||
try {
|
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_msg',
|
||||||
|
});
|
||||||
onRefresh();
|
onRefresh();
|
||||||
} finally {
|
} finally {
|
||||||
hideLoading();
|
hideLoading();
|
||||||
|
|
@ -105,7 +127,7 @@ async function handleDeleteBatch() {
|
||||||
|
|
||||||
/** 重置密码 */
|
/** 重置密码 */
|
||||||
function handleResetPassword(row: SystemUserApi.User) {
|
function handleResetPassword(row: SystemUserApi.User) {
|
||||||
resetPasswordModalApi.setData({ id: row.id }).open();
|
resetPasswordModalApi.setData(row).open();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 分配角色 */
|
/** 分配角色 */
|
||||||
|
|
@ -113,40 +135,30 @@ function handleAssignRole(row: SystemUserApi.User) {
|
||||||
assignRoleModalApi.setData(row).open();
|
assignRoleModalApi.setData(row).open();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 导入用户 */
|
/** 更新用户状态 */
|
||||||
function handleImport() {
|
|
||||||
importModalApi.open();
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 导出用户 */
|
|
||||||
async function handleExport() {
|
|
||||||
const data = await exportUser(await gridApi.formApi.getValues());
|
|
||||||
downloadFileFromBlobPart({ fileName: '用户数据.xls', source: data });
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 下载导入模板 */
|
|
||||||
async function handleImportTemplate() {
|
|
||||||
const data = await importUserTemplate();
|
|
||||||
downloadFileFromBlobPart({ fileName: '用户导入模板.xlsx', source: data });
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 用户状态修改 */
|
|
||||||
async function handleStatusChange(
|
async function handleStatusChange(
|
||||||
newStatus: number,
|
newStatus: number,
|
||||||
row: SystemUserApi.User,
|
row: SystemUserApi.User,
|
||||||
): Promise<boolean | undefined> {
|
): Promise<boolean | undefined> {
|
||||||
try {
|
return new Promise((resolve, reject) => {
|
||||||
await updateUserStatus(row.id as number, newStatus);
|
confirm({
|
||||||
message.success(
|
content: `你要将${row.username}的状态切换为【${getDictLabel(DICT_TYPE.COMMON_STATUS, newStatus)}】吗?`,
|
||||||
$t('ui.actionMessage.updateSuccess', [
|
})
|
||||||
row.username,
|
.then(async () => {
|
||||||
newStatus === CommonStatusEnum.ENABLE ? '启用' : '停用',
|
// 更新用户状态
|
||||||
]),
|
const res = await updateUserStatus(row.id as number, newStatus);
|
||||||
);
|
if (res) {
|
||||||
return true;
|
// 提示并返回成功
|
||||||
} catch {
|
message.success($t('ui.actionMessage.operationSuccess'));
|
||||||
return false;
|
resolve(true);
|
||||||
}
|
} else {
|
||||||
|
reject(new Error('更新失败'));
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
reject(new Error('取消操作'));
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const [Grid, gridApi] = useVbenVxeGrid({
|
const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
|
|
@ -156,6 +168,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
gridOptions: {
|
gridOptions: {
|
||||||
columns: useGridColumns(handleStatusChange),
|
columns: useGridColumns(handleStatusChange),
|
||||||
height: 'auto',
|
height: 'auto',
|
||||||
|
keepSource: true,
|
||||||
proxyConfig: {
|
proxyConfig: {
|
||||||
ajax: {
|
ajax: {
|
||||||
query: async ({ page }, formValues) => {
|
query: async ({ page }, formValues) => {
|
||||||
|
|
@ -163,6 +176,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
pageNo: page.currentPage,
|
pageNo: page.currentPage,
|
||||||
pageSize: page.pageSize,
|
pageSize: page.pageSize,
|
||||||
...formValues,
|
...formValues,
|
||||||
|
deptId: searchDeptId.value,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
@ -185,93 +199,104 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<Page auto-content-height>
|
<Page auto-content-height>
|
||||||
|
<template #doc>
|
||||||
|
<DocAlert title="用户体系" url="https://doc.iocoder.cn/user-center/" />
|
||||||
|
<DocAlert title="三方登陆" url="https://doc.iocoder.cn/social-user/" />
|
||||||
|
<DocAlert
|
||||||
|
title="Excel 导入导出"
|
||||||
|
url="https://doc.iocoder.cn/excel-import-and-export/"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
|
||||||
<FormModal @success="onRefresh" />
|
<FormModal @success="onRefresh" />
|
||||||
<ResetPasswordModal @success="onRefresh" />
|
<ResetPasswordModal @success="onRefresh" />
|
||||||
<AssignRoleModal @success="onRefresh" />
|
<AssignRoleModal @success="onRefresh" />
|
||||||
<ImportModal @success="onRefresh" />
|
<ImportModal @success="onRefresh" />
|
||||||
|
|
||||||
<Grid table-title="用户列表">
|
<div class="flex h-full w-full">
|
||||||
<template #toolbar-tools>
|
<!-- 左侧部门树 -->
|
||||||
<TableAction
|
<div class="h-full w-1/6 pr-4">
|
||||||
:actions="[
|
<DeptTree @select="handleDeptSelect" />
|
||||||
{
|
</div>
|
||||||
label: $t('ui.actionTitle.create', ['用户']),
|
<!-- 右侧用户列表 -->
|
||||||
type: 'primary',
|
<div class="w-5/6">
|
||||||
icon: ACTION_ICON.ADD,
|
<Grid table-title="用户列表">
|
||||||
auth: ['system:user:create'],
|
<template #toolbar-tools>
|
||||||
onClick: handleCreate,
|
<TableAction
|
||||||
},
|
:actions="[
|
||||||
{
|
{
|
||||||
label: $t('ui.actionTitle.import'),
|
label: $t('ui.actionTitle.create', ['用户']),
|
||||||
type: 'primary',
|
type: 'primary',
|
||||||
icon: ACTION_ICON.UPLOAD,
|
icon: ACTION_ICON.ADD,
|
||||||
auth: ['system:user:import'],
|
auth: ['system:user:create'],
|
||||||
onClick: handleImport,
|
onClick: handleCreate,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: $t('ui.actionTitle.export'),
|
label: $t('ui.actionTitle.export'),
|
||||||
type: 'primary',
|
type: 'primary',
|
||||||
icon: ACTION_ICON.DOWNLOAD,
|
icon: ACTION_ICON.DOWNLOAD,
|
||||||
auth: ['system:user:export'],
|
auth: ['system:user:export'],
|
||||||
onClick: handleExport,
|
onClick: handleExport,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '下载模板',
|
label: $t('ui.actionTitle.import', ['用户']),
|
||||||
type: 'primary',
|
type: 'primary',
|
||||||
icon: ACTION_ICON.DOWNLOAD,
|
icon: ACTION_ICON.UPLOAD,
|
||||||
auth: ['system:user:import'],
|
auth: ['system:user:import'],
|
||||||
onClick: handleImportTemplate,
|
onClick: handleImport,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '批量删除',
|
label: '批量删除',
|
||||||
type: 'primary',
|
type: 'primary',
|
||||||
danger: true,
|
danger: true,
|
||||||
disabled: isEmpty(checkedIds),
|
disabled: isEmpty(checkedIds),
|
||||||
icon: ACTION_ICON.DELETE,
|
icon: ACTION_ICON.DELETE,
|
||||||
auth: ['system:user:delete'],
|
auth: ['system:user:delete'],
|
||||||
onClick: handleDeleteBatch,
|
onClick: handleDeleteBatch,
|
||||||
},
|
},
|
||||||
]"
|
]"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<template #actions="{ row }">
|
<template #actions="{ row }">
|
||||||
<TableAction
|
<TableAction
|
||||||
:actions="[
|
:actions="[
|
||||||
{
|
{
|
||||||
label: $t('common.edit'),
|
label: $t('common.edit'),
|
||||||
type: 'link',
|
type: 'link',
|
||||||
icon: ACTION_ICON.EDIT,
|
icon: ACTION_ICON.EDIT,
|
||||||
auth: ['system:user:update'],
|
auth: ['system:user:update'],
|
||||||
onClick: handleEdit.bind(null, row),
|
onClick: handleEdit.bind(null, row),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: $t('common.delete'),
|
label: $t('common.delete'),
|
||||||
type: 'link',
|
type: 'link',
|
||||||
danger: true,
|
danger: true,
|
||||||
icon: ACTION_ICON.DELETE,
|
icon: ACTION_ICON.DELETE,
|
||||||
auth: ['system:user:delete'],
|
auth: ['system:user:delete'],
|
||||||
popConfirm: {
|
popConfirm: {
|
||||||
title: $t('ui.actionMessage.deleteConfirm', [row.username]),
|
title: $t('ui.actionMessage.deleteConfirm', [row.name]),
|
||||||
confirm: handleDelete.bind(null, row),
|
confirm: handleDelete.bind(null, row),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
]"
|
]"
|
||||||
:drop-down-actions="[
|
:drop-down-actions="[
|
||||||
{
|
{
|
||||||
label: '重置密码',
|
label: '分配角色',
|
||||||
type: 'link',
|
type: 'link',
|
||||||
auth: ['system:user:update-password'],
|
auth: ['system:permission:assign-user-role'],
|
||||||
onClick: handleResetPassword.bind(null, row),
|
onClick: handleAssignRole.bind(null, row),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '分配角色',
|
label: '重置密码',
|
||||||
type: 'link',
|
type: 'link',
|
||||||
auth: ['system:permission:assign-user-role'],
|
auth: ['system:user:update-password'],
|
||||||
onClick: handleAssignRole.bind(null, row),
|
onClick: handleResetPassword.bind(null, row),
|
||||||
},
|
},
|
||||||
]"
|
]"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</Page>
|
</Page>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue