!146 新增 ele 批量删除

Merge pull request !146 from puhui999/dev-new
pull/147/head
芋道源码 2025-06-17 00:37:03 +00:00 committed by Gitee
commit fd65e03fe0
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
62 changed files with 1383 additions and 354 deletions

View File

@ -155,3 +155,10 @@ export function deleteCodegenTable(tableId: number) {
params: { tableId }, params: { tableId },
}); });
} }
/** 批量删除代码生成表定义 */
export function deleteCodegenTableList(tableIds: number[]) {
return requestClient.delete(
`/infra/codegen/delete-list?tableIds=${tableIds.join(',')}`,
);
}

View File

@ -54,6 +54,11 @@ export function deleteConfig(id: number) {
return requestClient.delete(`/infra/config/delete?id=${id}`); return requestClient.delete(`/infra/config/delete?id=${id}`);
} }
/** 批量删除参数 */
export function deleteConfigList(ids: number[]) {
return requestClient.delete(`/infra/config/delete-list?ids=${ids.join(',')}`);
}
/** 导出参数 */ /** 导出参数 */
export function exportConfig(params: any) { export function exportConfig(params: any) {
return requestClient.download('/infra/config/export', { return requestClient.download('/infra/config/export', {

View File

@ -44,3 +44,10 @@ export function updateDataSourceConfig(
export function deleteDataSourceConfig(id: number) { export function deleteDataSourceConfig(id: number) {
return requestClient.delete(`/infra/data-source-config/delete?id=${id}`); return requestClient.delete(`/infra/data-source-config/delete?id=${id}`);
} }
/** 批量删除数据源配置 */
export function deleteDataSourceConfigList(ids: number[]) {
return requestClient.delete(
`/infra/data-source-config/delete-list?ids=${ids.join(',')}`,
);
}

View File

@ -69,6 +69,13 @@ export function deleteFileConfig(id: number) {
return requestClient.delete(`/infra/file-config/delete?id=${id}`); return requestClient.delete(`/infra/file-config/delete?id=${id}`);
} }
/** 批量删除文件配置 */
export function deleteFileConfigList(ids: number[]) {
return requestClient.delete(
`/infra/file-config/delete-list?ids=${ids.join(',')}`,
);
}
/** 测试文件配置 */ /** 测试文件配置 */
export function testFileConfig(id: number) { export function testFileConfig(id: number) {
return requestClient.get(`/infra/file-config/test?id=${id}`); return requestClient.get(`/infra/file-config/test?id=${id}`);

View File

@ -45,6 +45,11 @@ export function deleteFile(id: number) {
return requestClient.delete(`/infra/file/delete?id=${id}`); return requestClient.delete(`/infra/file/delete?id=${id}`);
} }
/** 批量删除文件 */
export function deleteFileList(ids: number[]) {
return requestClient.delete(`/infra/file/delete-list?ids=${ids.join(',')}`);
}
/** 获取文件预签名地址 */ /** 获取文件预签名地址 */
export function getFilePresignedUrl(name: string, directory?: string) { export function getFilePresignedUrl(name: string, directory?: string) {
return requestClient.get<InfraFileApi.FilePresignedUrlRespVO>( return requestClient.get<InfraFileApi.FilePresignedUrlRespVO>(

View File

@ -45,6 +45,11 @@ export function deleteJob(id: number) {
return requestClient.delete(`/infra/job/delete?id=${id}`); return requestClient.delete(`/infra/job/delete?id=${id}`);
} }
/** 批量删除定时任务调度 */
export function deleteJobList(ids: number[]) {
return requestClient.delete(`/infra/job/delete-list?ids=${ids.join(',')}`);
}
/** 导出定时任务调度 */ /** 导出定时任务调度 */
export function exportJob(params: any) { export function exportJob(params: any) {
return requestClient.download('/infra/job/export-excel', { params }); return requestClient.download('/infra/job/export-excel', { params });

View File

@ -48,6 +48,13 @@ export function deleteDictData(id: number) {
return requestClient.delete(`/system/dict-data/delete?id=${id}`); return requestClient.delete(`/system/dict-data/delete?id=${id}`);
} }
// 批量删除字典数据
export function deleteDictDataList(ids: number[]) {
return requestClient.delete(
`/system/dict-data/delete-list?ids=${ids.join(',')}`,
);
}
// 导出字典类型数据 // 导出字典类型数据
export function exportDictData(params: any) { export function exportDictData(params: any) {
return requestClient.download('/system/dict-data/export', { params }); return requestClient.download('/system/dict-data/export', { params });

View File

@ -42,6 +42,13 @@ export function deleteDictType(id: number) {
return requestClient.delete(`/system/dict-type/delete?id=${id}`); return requestClient.delete(`/system/dict-type/delete?id=${id}`);
} }
// 批量删除字典
export function deleteDictTypeList(ids: number[]) {
return requestClient.delete(
`/system/dict-type/delete-list?ids=${ids.join(',')}`,
);
}
// 导出字典类型 // 导出字典类型
export function exportDictType(params: any) { export function exportDictType(params: any) {
return requestClient.download('/system/dict-type/export', { params }); return requestClient.download('/system/dict-type/export', { params });

View File

@ -49,6 +49,13 @@ export function deleteMailAccount(id: number) {
return requestClient.delete(`/system/mail-account/delete?id=${id}`); return requestClient.delete(`/system/mail-account/delete?id=${id}`);
} }
/** 批量删除邮箱账号 */
export function deleteMailAccountList(ids: number[]) {
return requestClient.delete(
`/system/mail-account/delete-list?ids=${ids.join(',')}`,
);
}
/** 获得邮箱账号精简列表 */ /** 获得邮箱账号精简列表 */
export function getSimpleMailAccountList() { export function getSimpleMailAccountList() {
return requestClient.get<SystemMailAccountApi.MailAccount[]>( return requestClient.get<SystemMailAccountApi.MailAccount[]>(

View File

@ -56,6 +56,13 @@ export function deleteMailTemplate(id: number) {
return requestClient.delete(`/system/mail-template/delete?id=${id}`); return requestClient.delete(`/system/mail-template/delete?id=${id}`);
} }
/** 批量删除邮件模版 */
export function deleteMailTemplateList(ids: number[]) {
return requestClient.delete(
`/system/mail-template/delete-list?ids=${ids.join(',')}`,
);
}
/** 发送邮件 */ /** 发送邮件 */
export function sendMail(data: SystemMailTemplateApi.MailSendReqVO) { export function sendMail(data: SystemMailTemplateApi.MailSendReqVO) {
return requestClient.post('/system/mail-template/send-mail', data); return requestClient.post('/system/mail-template/send-mail', data);

View File

@ -46,6 +46,13 @@ export function deleteNotice(id: number) {
return requestClient.delete(`/system/notice/delete?id=${id}`); return requestClient.delete(`/system/notice/delete?id=${id}`);
} }
/** 批量删除公告 */
export function deleteNoticeList(ids: number[]) {
return requestClient.delete(
`/system/notice/delete-list?ids=${ids.join(',')}`,
);
}
/** 推送公告 */ /** 推送公告 */
export function pushNotice(id: number) { export function pushNotice(id: number) {
return requestClient.post(`/system/notice/push?id=${id}`); return requestClient.post(`/system/notice/push?id=${id}`);

View File

@ -59,6 +59,13 @@ export function deleteNotifyTemplate(id: number) {
return requestClient.delete(`/system/notify-template/delete?id=${id}`); return requestClient.delete(`/system/notify-template/delete?id=${id}`);
} }
/** 批量删除站内信模板 */
export function deleteNotifyTemplateList(ids: number[]) {
return requestClient.delete(
`/system/notify-template/delete-list?ids=${ids.join(',')}`,
);
}
/** 导出站内信模板 */ /** 导出站内信模板 */
export function exportNotifyTemplate(params: any) { export function exportNotifyTemplate(params: any) {
return requestClient.download('/system/notify-template/export-excel', { return requestClient.download('/system/notify-template/export-excel', {

View File

@ -55,3 +55,10 @@ export function updateOAuth2Client(data: SystemOAuth2ClientApi.OAuth2Client) {
export function deleteOAuth2Client(id: number) { export function deleteOAuth2Client(id: number) {
return requestClient.delete(`/system/oauth2-client/delete?id=${id}`); return requestClient.delete(`/system/oauth2-client/delete?id=${id}`);
} }
/** 批量删除 OAuth2.0 客户端 */
export function deleteOAuth2ClientList(ids: number[]) {
return requestClient.delete(
`/system/oauth2-client/delete-list?ids=${ids.join(',')}`,
);
}

View File

@ -50,6 +50,11 @@ export function deletePost(id: number) {
return requestClient.delete(`/system/post/delete?id=${id}`); return requestClient.delete(`/system/post/delete?id=${id}`);
} }
/** 批量删除岗位 */
export function deletePostList(ids: number[]) {
return requestClient.delete(`/system/post/delete-list?ids=${ids.join(',')}`);
}
/** 导出岗位 */ /** 导出岗位 */
export function exportPost(params: any) { export function exportPost(params: any) {
return requestClient.download('/system/post/export', { return requestClient.download('/system/post/export', {

View File

@ -50,6 +50,11 @@ export function deleteRole(id: number) {
return requestClient.delete(`/system/role/delete?id=${id}`); return requestClient.delete(`/system/role/delete?id=${id}`);
} }
/** 批量删除角色 */
export function deleteRoleList(ids: number[]) {
return requestClient.delete(`/system/role/delete-list?ids=${ids.join(',')}`);
}
/** 导出角色 */ /** 导出角色 */
export function exportRole(params: any) { export function exportRole(params: any) {
return requestClient.download('/system/role/export-excel', { return requestClient.download('/system/role/export-excel', {

View File

@ -54,6 +54,13 @@ export function deleteSmsChannel(id: number) {
return requestClient.delete(`/system/sms-channel/delete?id=${id}`); return requestClient.delete(`/system/sms-channel/delete?id=${id}`);
} }
/** 批量删除短信渠道 */
export function deleteSmsChannelList(ids: number[]) {
return requestClient.delete(
`/system/sms-channel/delete-list?ids=${ids.join(',')}`,
);
}
/** 导出短信渠道 */ /** 导出短信渠道 */
export function exportSmsChannel(params: any) { export function exportSmsChannel(params: any) {
return requestClient.download('/system/sms-channel/export', { params }); return requestClient.download('/system/sms-channel/export', { params });

View File

@ -57,6 +57,13 @@ export function deleteSmsTemplate(id: number) {
return requestClient.delete(`/system/sms-template/delete?id=${id}`); return requestClient.delete(`/system/sms-template/delete?id=${id}`);
} }
/** 批量删除短信模板 */
export function deleteSmsTemplateList(ids: number[]) {
return requestClient.delete(
`/system/sms-template/delete-list?ids=${ids.join(',')}`,
);
}
/** 导出短信模板 */ /** 导出短信模板 */
export function exportSmsTemplate(params: any) { export function exportSmsTemplate(params: any) {
return requestClient.download('/system/sms-template/export-excel', { return requestClient.download('/system/sms-template/export-excel', {

View File

@ -46,3 +46,10 @@ export function updateSocialClient(data: SystemSocialClientApi.SocialClient) {
export function deleteSocialClient(id: number) { export function deleteSocialClient(id: number) {
return requestClient.delete(`/system/social-client/delete?id=${id}`); return requestClient.delete(`/system/social-client/delete?id=${id}`);
} }
/** 批量删除社交客户端 */
export function deleteSocialClientList(ids: number[]) {
return requestClient.delete(
`/system/social-client/delete-list?ids=${ids.join(',')}`,
);
}

View File

@ -49,6 +49,13 @@ export function deleteTenantPackage(id: number) {
return requestClient.delete(`/system/tenant-package/delete?id=${id}`); return requestClient.delete(`/system/tenant-package/delete?id=${id}`);
} }
/** 批量删除租户套餐 */
export function deleteTenantPackageList(ids: number[]) {
return requestClient.delete(
`/system/tenant-package/delete-list?ids=${ids.join(',')}`,
);
}
/** 获取租户套餐精简信息列表 */ /** 获取租户套餐精简信息列表 */
export function getTenantPackageList() { export function getTenantPackageList() {
return requestClient.get<SystemTenantPackageApi.TenantPackage[]>( return requestClient.get<SystemTenantPackageApi.TenantPackage[]>(

View File

@ -61,6 +61,13 @@ export function deleteTenant(id: number) {
return requestClient.delete(`/system/tenant/delete?id=${id}`); return requestClient.delete(`/system/tenant/delete?id=${id}`);
} }
/** 批量删除租户 */
export function deleteTenantList(ids: number[]) {
return requestClient.delete(
`/system/tenant/delete-list?ids=${ids.join(',')}`,
);
}
/** 导出租户 */ /** 导出租户 */
export function exportTenant(params: any) { export function exportTenant(params: any) {
return requestClient.download('/system/tenant/export-excel', { return requestClient.download('/system/tenant/export-excel', {

View File

@ -49,6 +49,11 @@ export function deleteUser(id: number) {
return requestClient.delete(`/system/user/delete?id=${id}`); return requestClient.delete(`/system/user/delete?id=${id}`);
} }
/** 批量删除用户 */
export function deleteUserList(ids: number[]) {
return requestClient.delete(`/system/user/delete-list?ids=${ids.join(',')}`);
}
/** 导出用户 */ /** 导出用户 */
export function exportUser(params: any) { export function exportUser(params: any) {
return requestClient.download('/system/user/export', params); return requestClient.download('/system/user/export', params);

View File

@ -398,6 +398,7 @@ export function useGridColumns<T = InfraCodegenApi.CodegenTable>(
getDataSourceConfigName?: (dataSourceConfigId: number) => string | undefined, getDataSourceConfigName?: (dataSourceConfigId: number) => string | undefined,
): VxeTableGridOptions['columns'] { ): VxeTableGridOptions['columns'] {
return [ return [
{ type: 'checkbox', width: 40 },
{ {
field: 'dataSourceConfigId', field: 'dataSourceConfigId',
title: '数据源', title: '数据源',

View File

@ -10,13 +10,14 @@ import { ref } from 'vue';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
import { DocAlert, Page, useVbenModal } from '@vben/common-ui'; import { DocAlert, Page, useVbenModal } from '@vben/common-ui';
import { Plus } from '@vben/icons'; import { isEmpty } from '@vben/utils';
import { ElButton, ElLoading, ElMessage } from 'element-plus'; import { ElLoading, ElMessage } from 'element-plus';
import { useVbenVxeGrid } from '#/adapter/vxe-table'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { import {
deleteCodegenTable, deleteCodegenTable,
deleteCodegenTableList,
downloadCodegen, downloadCodegen,
getCodegenTablePage, getCodegenTablePage,
syncCodegenFromDB, syncCodegenFromDB,
@ -85,6 +86,21 @@ async function onDelete(row: InfraCodegenApi.CodegenTable) {
} }
} }
/** 批量删除代码生成配置 */
async function onDeleteBatch() {
const loadingInstance = ElLoading.service({
text: $t('ui.actionMessage.deleting'),
fullscreen: true,
});
try {
await deleteCodegenTableList(checkedIds.value);
ElMessage.success($t('ui.actionMessage.deleteSuccess'));
onRefresh();
} finally {
loadingInstance.close();
}
}
/** 同步数据库 */ /** 同步数据库 */
async function onSync(row: InfraCodegenApi.CodegenTable) { async function onSync(row: InfraCodegenApi.CodegenTable) {
const loadingInstance = ElLoading.service({ const loadingInstance = ElLoading.service({
@ -150,6 +166,15 @@ function onActionClick({
} }
} }
const checkedIds = ref<number[]>([]);
function handleRowCheckboxChange({
records,
}: {
records: InfraCodegenApi.CodegenTable[];
}) {
checkedIds.value = records.map((item) => item.id);
}
const [Grid, gridApi] = useVbenVxeGrid({ const [Grid, gridApi] = useVbenVxeGrid({
formOptions: { formOptions: {
schema: useGridFormSchema(), schema: useGridFormSchema(),
@ -177,6 +202,10 @@ const [Grid, gridApi] = useVbenVxeGrid({
search: true, search: true,
}, },
} as VxeTableGridOptions<InfraCodegenApi.CodegenTable>, } as VxeTableGridOptions<InfraCodegenApi.CodegenTable>,
gridEvents: {
checkboxAll: handleRowCheckboxChange,
checkboxChange: handleRowCheckboxChange,
},
}); });
/** 获取数据源配置列表 */ /** 获取数据源配置列表 */
@ -213,14 +242,25 @@ initDataSourceConfig();
<PreviewModal /> <PreviewModal />
<Grid table-title=""> <Grid table-title="">
<template #toolbar-tools> <template #toolbar-tools>
<ElButton <TableAction
type="primary" :actions="[
@click="onImport" {
v-access:code="['infra:codegen:create']" label: '导入',
> type: 'primary',
<Plus class="size-5" /> icon: ACTION_ICON.ADD,
导入 auth: ['infra:codegen:create'],
</ElButton> onClick: onImport,
},
{
label: $t('ui.actionTitle.deleteBatch'),
type: 'danger',
icon: ACTION_ICON.DELETE,
disabled: isEmpty(checkedIds),
auth: ['infra:codegen:delete'],
onClick: onDeleteBatch,
},
]"
/>
</template> </template>
</Grid> </Grid>
</Page> </Page>

View File

@ -126,6 +126,7 @@ export function useGridColumns<T = InfraConfigApi.Config>(
onActionClick: OnActionClickFn<T>, onActionClick: OnActionClickFn<T>,
): VxeTableGridOptions['columns'] { ): VxeTableGridOptions['columns'] {
return [ return [
{ type: 'checkbox', width: 40 },
{ {
field: 'id', field: 'id',
title: '参数主键', title: '参数主键',

View File

@ -5,14 +5,20 @@ import type {
} from '#/adapter/vxe-table'; } from '#/adapter/vxe-table';
import type { InfraConfigApi } from '#/api/infra/config'; import type { InfraConfigApi } from '#/api/infra/config';
import { ref } from 'vue';
import { Page, useVbenModal } from '@vben/common-ui'; import { Page, useVbenModal } from '@vben/common-ui';
import { Download, Plus } from '@vben/icons'; import { downloadFileFromBlobPart, isEmpty } from '@vben/utils';
import { downloadFileFromBlobPart } from '@vben/utils';
import { ElButton, ElLoading, ElMessage } from 'element-plus'; import { ElLoading, ElMessage } from 'element-plus';
import { useVbenVxeGrid } from '#/adapter/vxe-table'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { deleteConfig, exportConfig, getConfigPage } from '#/api/infra/config'; import {
deleteConfig,
deleteConfigList,
exportConfig,
getConfigPage,
} from '#/api/infra/config';
import { $t } from '#/locales'; import { $t } from '#/locales';
import { useGridColumns, useGridFormSchema } from './data'; import { useGridColumns, useGridFormSchema } from './data';
@ -52,15 +58,39 @@ async function onDelete(row: InfraConfigApi.Config) {
}); });
try { try {
await deleteConfig(row.id as number); await deleteConfig(row.id as number);
// TODO @puhui999close finally
loadingInstance.close(); loadingInstance.close();
ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name]));
onRefresh(); onRefresh();
} catch { } finally {
loadingInstance.close(); loadingInstance.close();
} }
} }
/** 批量删除参数 */
async function onDeleteBatch() {
const loadingInstance = ElLoading.service({
text: $t('ui.actionMessage.deleting'),
fullscreen: true,
});
try {
await deleteConfigList(checkedIds.value);
loadingInstance.close();
ElMessage.success($t('ui.actionMessage.deleteSuccess'));
onRefresh();
} finally {
loadingInstance.close();
}
}
const checkedIds = ref<number[]>([]);
function handleRowCheckboxChange({
records,
}: {
records: InfraConfigApi.Config[];
}) {
checkedIds.value = records.map((item) => item.id as number);
}
/** 表格操作按钮的回调函数 */ /** 表格操作按钮的回调函数 */
function onActionClick({ function onActionClick({
code, code,
@ -105,6 +135,10 @@ const [Grid, gridApi] = useVbenVxeGrid({
search: true, search: true,
}, },
} as VxeTableGridOptions<InfraConfigApi.Config>, } as VxeTableGridOptions<InfraConfigApi.Config>,
gridEvents: {
checkboxAll: handleRowCheckboxChange,
checkboxChange: handleRowCheckboxChange,
},
}); });
</script> </script>
@ -113,23 +147,32 @@ const [Grid, gridApi] = useVbenVxeGrid({
<FormModal @success="onRefresh" /> <FormModal @success="onRefresh" />
<Grid table-title=""> <Grid table-title="">
<template #toolbar-tools> <template #toolbar-tools>
<ElButton <TableAction
type="primary" :actions="[
@click="onCreate" {
v-access:code="['infra:config:create']" label: $t('ui.actionTitle.create', ['参数']),
> type: 'primary',
<Plus class="size-5" /> icon: ACTION_ICON.ADD,
{{ $t('ui.actionTitle.create', ['参数']) }} auth: ['infra:config:create'],
</ElButton> onClick: onCreate,
<ElButton },
type="primary" {
class="ml-2" label: $t('ui.actionTitle.export'),
@click="onExport" type: 'primary',
v-access:code="['infra:config:export']" icon: ACTION_ICON.DOWNLOAD,
> auth: ['infra:config:export'],
<Download class="size-5" /> onClick: onExport,
{{ $t('ui.actionTitle.export') }} },
</ElButton> {
label: $t('ui.actionTitle.deleteBatch'),
type: 'danger',
icon: ACTION_ICON.DELETE,
disabled: isEmpty(checkedIds),
auth: ['infra:config:delete'],
onClick: onDeleteBatch,
},
]"
/>
</template> </template>
</Grid> </Grid>
</Page> </Page>

View File

@ -62,6 +62,7 @@ export function useGridColumns<T = InfraDataSourceConfigApi.DataSourceConfig>(
onActionClick: OnActionClickFn<T>, onActionClick: OnActionClickFn<T>,
): VxeTableGridOptions['columns'] { ): VxeTableGridOptions['columns'] {
return [ return [
{ type: 'checkbox', width: 40 },
{ {
field: 'id', field: 'id',
title: '主键编号', title: '主键编号',

View File

@ -5,16 +5,17 @@ import type {
} from '#/adapter/vxe-table'; } from '#/adapter/vxe-table';
import type { InfraDataSourceConfigApi } from '#/api/infra/data-source-config'; import type { InfraDataSourceConfigApi } from '#/api/infra/data-source-config';
import { onMounted } from 'vue'; import { onMounted, ref } from 'vue';
import { Page, useVbenModal } from '@vben/common-ui'; import { Page, useVbenModal } from '@vben/common-ui';
import { Plus } from '@vben/icons'; import { isEmpty } from '@vben/utils';
import { ElButton, ElLoading, ElMessage } from 'element-plus'; import { ElLoading, ElMessage } from 'element-plus';
import { useVbenVxeGrid } from '#/adapter/vxe-table'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { import {
deleteDataSourceConfig, deleteDataSourceConfig,
deleteDataSourceConfigList,
getDataSourceConfigList, getDataSourceConfigList,
} from '#/api/infra/data-source-config'; } from '#/api/infra/data-source-config';
import { $t } from '#/locales'; import { $t } from '#/locales';
@ -48,11 +49,36 @@ async function onDelete(row: InfraDataSourceConfigApi.DataSourceConfig) {
loadingInstance.close(); loadingInstance.close();
ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name]));
await handleLoadData(); await handleLoadData();
} catch { } finally {
loadingInstance.close(); loadingInstance.close();
} }
} }
/** 批量删除数据源 */
async function onDeleteBatch() {
const loadingInstance = ElLoading.service({
text: $t('ui.actionMessage.deleting'),
fullscreen: true,
});
try {
await deleteDataSourceConfigList(checkedIds.value);
loadingInstance.close();
ElMessage.success($t('ui.actionMessage.deleteSuccess'));
await handleLoadData();
} finally {
loadingInstance.close();
}
}
const checkedIds = ref<number[]>([]);
function handleRowCheckboxChange({
records,
}: {
records: InfraDataSourceConfigApi.DataSourceConfig[];
}) {
checkedIds.value = records.map((item) => item.id as number);
}
/** 表格操作按钮的回调函数 */ /** 表格操作按钮的回调函数 */
function onActionClick({ function onActionClick({
code, code,
@ -87,6 +113,10 @@ const [Grid, gridApi] = useVbenVxeGrid({
}, },
}, },
} as VxeTableGridOptions<InfraDataSourceConfigApi.DataSourceConfig>, } as VxeTableGridOptions<InfraDataSourceConfigApi.DataSourceConfig>,
gridEvents: {
checkboxAll: handleRowCheckboxChange,
checkboxChange: handleRowCheckboxChange,
},
}); });
/** 加载数据 */ /** 加载数据 */
@ -110,14 +140,25 @@ onMounted(() => {
<FormModal @success="onRefresh" /> <FormModal @success="onRefresh" />
<Grid table-title=""> <Grid table-title="">
<template #toolbar-tools> <template #toolbar-tools>
<ElButton <TableAction
type="primary" :actions="[
@click="onCreate" {
v-access:code="['infra:data-source-config:create']" label: $t('ui.actionTitle.create', ['数据源']),
> type: 'primary',
<Plus class="size-5" /> icon: ACTION_ICON.ADD,
{{ $t('ui.actionTitle.create', ['数据源']) }} auth: ['infra:data-source-config:create'],
</ElButton> onClick: onCreate,
},
{
label: $t('ui.actionTitle.deleteBatch'),
type: 'danger',
icon: ACTION_ICON.DELETE,
disabled: isEmpty(checkedIds),
auth: ['infra:data-source-config:delete'],
onClick: onDeleteBatch,
},
]"
/>
</template> </template>
</Grid> </Grid>
</Page> </Page>

View File

@ -61,6 +61,7 @@ export function useGridColumns<T = InfraFileApi.File>(
onActionClick: OnActionClickFn<T>, onActionClick: OnActionClickFn<T>,
): VxeTableGridOptions['columns'] { ): VxeTableGridOptions['columns'] {
return [ return [
{ type: 'checkbox', width: 40 },
{ {
field: 'name', field: 'name',
title: '文件名', title: '文件名',

View File

@ -5,15 +5,16 @@ import type {
} from '#/adapter/vxe-table'; } from '#/adapter/vxe-table';
import type { InfraFileApi } from '#/api/infra/file'; import type { InfraFileApi } from '#/api/infra/file';
import { ref } from 'vue';
import { Page, useVbenModal } from '@vben/common-ui'; import { Page, useVbenModal } from '@vben/common-ui';
import { Upload } from '@vben/icons'; import { isEmpty, openWindow } from '@vben/utils';
import { openWindow } from '@vben/utils';
import { useClipboard } from '@vueuse/core'; import { useClipboard } from '@vueuse/core';
import { ElButton, ElImage, ElLoading, ElMessage } from 'element-plus'; import { ElButton, ElImage, ElLoading, ElMessage } from 'element-plus';
import { useVbenVxeGrid } from '#/adapter/vxe-table'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { deleteFile, getFilePage } from '#/api/infra/file'; import { deleteFile, deleteFileList, getFilePage } from '#/api/infra/file';
import { $t } from '#/locales'; import { $t } from '#/locales';
import { useGridColumns, useGridFormSchema } from './data'; import { useGridColumns, useGridFormSchema } from './data';
@ -70,11 +71,36 @@ async function onDelete(row: InfraFileApi.File) {
$t('ui.actionMessage.deleteSuccess', [row.name || row.path]), $t('ui.actionMessage.deleteSuccess', [row.name || row.path]),
); );
onRefresh(); onRefresh();
} catch { } finally {
loadingInstance.close(); loadingInstance.close();
} }
} }
/** 批量删除文件 */
async function onDeleteBatch() {
const loadingInstance = ElLoading.service({
text: $t('ui.actionMessage.deleting'),
fullscreen: true,
});
try {
await deleteFileList(checkedIds.value);
loadingInstance.close();
ElMessage.success($t('ui.actionMessage.deleteSuccess'));
onRefresh();
} finally {
loadingInstance.close();
}
}
const checkedIds = ref<number[]>([]);
function handleRowCheckboxChange({
records,
}: {
records: InfraFileApi.File[];
}) {
checkedIds.value = records.map((item) => item.id as number);
}
/** 表格操作按钮的回调函数 */ /** 表格操作按钮的回调函数 */
function onActionClick({ code, row }: OnActionClickParams<InfraFileApi.File>) { function onActionClick({ code, row }: OnActionClickParams<InfraFileApi.File>) {
switch (code) { switch (code) {
@ -116,6 +142,10 @@ const [Grid, gridApi] = useVbenVxeGrid({
search: true, search: true,
}, },
} as VxeTableGridOptions<InfraFileApi.File>, } as VxeTableGridOptions<InfraFileApi.File>,
gridEvents: {
checkboxAll: handleRowCheckboxChange,
checkboxChange: handleRowCheckboxChange,
},
}); });
</script> </script>
@ -124,10 +154,24 @@ const [Grid, gridApi] = useVbenVxeGrid({
<FormModal @success="onRefresh" /> <FormModal @success="onRefresh" />
<Grid table-title=""> <Grid table-title="">
<template #toolbar-tools> <template #toolbar-tools>
<ElButton type="primary" @click="onUpload"> <TableAction
<Upload class="size-5" /> :actions="[
上传图片 {
</ElButton> label: '上传图片',
type: 'primary',
icon: ACTION_ICON.UPLOAD,
onClick: onUpload,
},
{
label: $t('ui.actionTitle.deleteBatch'),
type: 'danger',
icon: ACTION_ICON.DELETE,
disabled: isEmpty(checkedIds),
auth: ['infra:file:delete'],
onClick: onDeleteBatch,
},
]"
/>
</template> </template>
<template #file-content="{ row }"> <template #file-content="{ row }">
<ElImage v-if="row.type && row.type.includes('image')" :src="row.url" /> <ElImage v-if="row.type && row.type.includes('image')" :src="row.url" />

View File

@ -269,6 +269,7 @@ export function useGridColumns<T = InfraFileConfigApi.FileConfig>(
onActionClick: OnActionClickFn<T>, onActionClick: OnActionClickFn<T>,
): VxeTableGridOptions['columns'] { ): VxeTableGridOptions['columns'] {
return [ return [
{ type: 'checkbox', width: 40 },
{ {
field: 'id', field: 'id',
title: '编号', title: '编号',

View File

@ -5,15 +5,17 @@ import type {
} from '#/adapter/vxe-table'; } from '#/adapter/vxe-table';
import type { InfraFileConfigApi } from '#/api/infra/file-config'; import type { InfraFileConfigApi } from '#/api/infra/file-config';
import { ref } from 'vue';
import { confirm, Page, useVbenModal } from '@vben/common-ui'; import { confirm, Page, useVbenModal } from '@vben/common-ui';
import { Plus } from '@vben/icons'; import { isEmpty, openWindow } from '@vben/utils';
import { openWindow } from '@vben/utils';
import { ElButton, ElLoading, ElMessage } from 'element-plus'; import { ElLoading, ElMessage } from 'element-plus';
import { useVbenVxeGrid } from '#/adapter/vxe-table'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { import {
deleteFileConfig, deleteFileConfig,
deleteFileConfigList,
getFileConfigPage, getFileConfigPage,
testFileConfig, testFileConfig,
updateFileConfigMaster, updateFileConfigMaster,
@ -93,11 +95,36 @@ async function onDelete(row: InfraFileConfigApi.FileConfig) {
loadingInstance.close(); loadingInstance.close();
ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name]));
onRefresh(); onRefresh();
} catch { } finally {
loadingInstance.close(); loadingInstance.close();
} }
} }
/** 批量删除文件配置 */
async function onDeleteBatch() {
const loadingInstance = ElLoading.service({
text: $t('ui.actionMessage.deleting'),
fullscreen: true,
});
try {
await deleteFileConfigList(checkedIds.value);
loadingInstance.close();
ElMessage.success($t('ui.actionMessage.deleteSuccess'));
onRefresh();
} finally {
loadingInstance.close();
}
}
const checkedIds = ref<number[]>([]);
function handleRowCheckboxChange({
records,
}: {
records: InfraFileConfigApi.FileConfig[];
}) {
checkedIds.value = records.map((item) => item.id as number);
}
/** 表格操作按钮的回调函数 */ /** 表格操作按钮的回调函数 */
function onActionClick({ function onActionClick({
code, code,
@ -150,6 +177,10 @@ const [Grid, gridApi] = useVbenVxeGrid({
search: true, search: true,
}, },
} as VxeTableGridOptions<InfraFileConfigApi.FileConfig>, } as VxeTableGridOptions<InfraFileConfigApi.FileConfig>,
gridEvents: {
checkboxAll: handleRowCheckboxChange,
checkboxChange: handleRowCheckboxChange,
},
}); });
</script> </script>
@ -158,14 +189,25 @@ const [Grid, gridApi] = useVbenVxeGrid({
<FormModal @success="onRefresh" /> <FormModal @success="onRefresh" />
<Grid table-title=""> <Grid table-title="">
<template #toolbar-tools> <template #toolbar-tools>
<ElButton <TableAction
type="primary" :actions="[
@click="onCreate" {
v-access:code="['infra:file-config:create']" label: $t('ui.actionTitle.create', ['文件配置']),
> type: 'primary',
<Plus class="size-5" /> icon: ACTION_ICON.ADD,
{{ $t('ui.actionTitle.create', ['文件配置']) }} auth: ['infra:file-config:create'],
</ElButton> onClick: onCreate,
},
{
label: $t('ui.actionTitle.deleteBatch'),
type: 'danger',
icon: ACTION_ICON.DELETE,
disabled: isEmpty(checkedIds),
auth: ['infra:file-config:delete'],
onClick: onDeleteBatch,
},
]"
/>
</template> </template>
</Grid> </Grid>
</Page> </Page>

View File

@ -128,6 +128,7 @@ export function useGridColumns<T = InfraJobApi.Job>(
onActionClick: OnActionClickFn<T>, onActionClick: OnActionClickFn<T>,
): VxeTableGridOptions['columns'] { ): VxeTableGridOptions['columns'] {
return [ return [
{ type: 'checkbox', width: 40 },
{ {
field: 'id', field: 'id',
title: '任务编号', title: '任务编号',

View File

@ -5,17 +5,18 @@ import type {
} from '#/adapter/vxe-table'; } from '#/adapter/vxe-table';
import type { InfraJobApi } from '#/api/infra/job'; import type { InfraJobApi } from '#/api/infra/job';
import { ref } from 'vue';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
import { confirm, DocAlert, Page, useVbenModal } from '@vben/common-ui'; import { confirm, DocAlert, Page, useVbenModal } from '@vben/common-ui';
import { Download, History, Plus } from '@vben/icons'; import { downloadFileFromBlobPart, isEmpty } from '@vben/utils';
import { downloadFileFromBlobPart } from '@vben/utils';
import { ElButton, ElLoading, ElMessage } from 'element-plus'; import { ElLoading, ElMessage } from 'element-plus';
import { useVbenVxeGrid } from '#/adapter/vxe-table'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { import {
deleteJob, deleteJob,
deleteJobList,
exportJob, exportJob,
getJobPage, getJobPage,
runJob, runJob,
@ -117,6 +118,26 @@ async function onDelete(row: InfraJobApi.Job) {
} }
} }
/** 批量删除任务 */
async function onDeleteBatch() {
const loadingInstance = ElLoading.service({
text: $t('ui.actionMessage.deleting'),
fullscreen: true,
});
try {
await deleteJobList(checkedIds.value);
ElMessage.success($t('ui.actionMessage.deleteSuccess'));
onRefresh();
} finally {
loadingInstance.close();
}
}
const checkedIds = ref<number[]>([]);
function handleRowCheckboxChange({ records }: { records: InfraJobApi.Job[] }) {
checkedIds.value = records.map((item) => item.id as number);
}
/** 表格操作按钮的回调函数 */ /** 表格操作按钮的回调函数 */
function onActionClick({ code, row }: OnActionClickParams<InfraJobApi.Job>) { function onActionClick({ code, row }: OnActionClickParams<InfraJobApi.Job>) {
switch (code) { switch (code) {
@ -174,6 +195,10 @@ const [Grid, gridApi] = useVbenVxeGrid({
search: true, search: true,
}, },
} as VxeTableGridOptions<InfraJobApi.Job>, } as VxeTableGridOptions<InfraJobApi.Job>,
gridEvents: {
checkboxAll: handleRowCheckboxChange,
checkboxChange: handleRowCheckboxChange,
},
}); });
</script> </script>
@ -189,32 +214,39 @@ const [Grid, gridApi] = useVbenVxeGrid({
<DetailModal /> <DetailModal />
<Grid table-title=""> <Grid table-title="">
<template #toolbar-tools> <template #toolbar-tools>
<ElButton <TableAction
type="primary" :actions="[
@click="onCreate" {
v-access:code="['infra:job:create']" label: $t('ui.actionTitle.create', ['任务']),
> type: 'primary',
<Plus class="size-5" /> icon: ACTION_ICON.ADD,
{{ $t('ui.actionTitle.create', ['任务']) }} auth: ['infra:job:create'],
</ElButton> onClick: onCreate,
<ElButton },
type="primary" {
class="ml-2" label: $t('ui.actionTitle.export'),
@click="onExport" type: 'primary',
v-access:code="['infra:job:export']" icon: ACTION_ICON.DOWNLOAD,
> auth: ['infra:job:export'],
<Download class="size-5" /> onClick: onExport,
{{ $t('ui.actionTitle.export') }} },
</ElButton> {
<ElButton label: '执行日志',
type="primary" type: 'primary',
class="ml-2" icon: ACTION_ICON.MORE,
@click="onLog(undefined)" auth: ['infra:job:query'],
v-access:code="['infra:job:query']" onClick: () => onLog(undefined),
> },
<History class="size-5" /> {
执行日志 label: $t('ui.actionTitle.deleteBatch'),
</ElButton> type: 'danger',
icon: ACTION_ICON.DELETE,
disabled: isEmpty(checkedIds),
auth: ['infra:job:delete'],
onClick: onDeleteBatch,
},
]"
/>
</template> </template>
</Grid> </Grid>
</Page> </Page>

View File

@ -100,6 +100,7 @@ export function useTypeGridColumns<T = SystemDictTypeApi.DictType>(
onActionClick: OnActionClickFn<T>, onActionClick: OnActionClickFn<T>,
): VxeTableGridOptions['columns'] { ): VxeTableGridOptions['columns'] {
return [ return [
{ type: 'checkbox', width: 40 },
{ {
field: 'id', field: 'id',
title: '字典编号', title: '字典编号',
@ -314,6 +315,7 @@ export function useDataGridColumns<T = SystemDictDataApi.DictData>(
onActionClick: OnActionClickFn<T>, onActionClick: OnActionClickFn<T>,
): VxeTableGridOptions['columns'] { ): VxeTableGridOptions['columns'] {
return [ return [
{ type: 'checkbox', width: 40 },
{ {
field: 'id', field: 'id',
title: '字典编码', title: '字典编码',

View File

@ -5,17 +5,17 @@ import type {
} from '#/adapter/vxe-table'; } from '#/adapter/vxe-table';
import type { SystemDictDataApi } from '#/api/system/dict/data'; import type { SystemDictDataApi } from '#/api/system/dict/data';
import { watch } from 'vue'; import { ref, watch } from 'vue';
import { useVbenModal } from '@vben/common-ui'; import { useVbenModal } from '@vben/common-ui';
import { Download, Plus } from '@vben/icons'; import { downloadFileFromBlobPart, isEmpty } from '@vben/utils';
import { downloadFileFromBlobPart } from '@vben/utils';
import { ElButton, ElLoading, ElMessage } from 'element-plus'; import { ElLoading, ElMessage } from 'element-plus';
import { useVbenVxeGrid } from '#/adapter/vxe-table'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { import {
deleteDictData, deleteDictData,
deleteDictDataList,
exportDictData, exportDictData,
getDictDataPage, getDictDataPage,
} from '#/api/system/dict/data'; } from '#/api/system/dict/data';
@ -67,13 +67,35 @@ async function onDelete(row: any) {
await deleteDictData(row.id); await deleteDictData(row.id);
ElMessage.success($t('common.operationSuccess')); ElMessage.success($t('common.operationSuccess'));
onRefresh(); onRefresh();
} catch {
//
} finally { } finally {
loadingInstance.close(); loadingInstance.close();
} }
} }
/** 批量删除字典数据 */
async function onDeleteBatch() {
const loadingInstance = ElLoading.service({
text: $t('ui.actionMessage.deleting'),
fullscreen: true,
});
try {
await deleteDictDataList(checkedIds.value);
ElMessage.success($t('ui.actionMessage.deleteSuccess'));
onRefresh();
} finally {
loadingInstance.close();
}
}
const checkedIds = ref<number[]>([]);
function handleRowCheckboxChange({
records,
}: {
records: SystemDictDataApi.DictData[];
}) {
checkedIds.value = records.map((item) => item.id as number);
}
/** 表格操作按钮回调 */ /** 表格操作按钮回调 */
function onActionClick({ code, row }: OnActionClickParams) { function onActionClick({ code, row }: OnActionClickParams) {
switch (code) { switch (code) {
@ -116,6 +138,10 @@ const [Grid, gridApi] = useVbenVxeGrid({
search: true, search: true,
}, },
} as VxeTableGridOptions<SystemDictDataApi.DictData>, } as VxeTableGridOptions<SystemDictDataApi.DictData>,
gridEvents: {
checkboxAll: handleRowCheckboxChange,
checkboxChange: handleRowCheckboxChange,
},
}); });
/** 监听 dictType 变化,重新查询 */ /** 监听 dictType 变化,重新查询 */
@ -135,23 +161,32 @@ watch(
<Grid table-title=""> <Grid table-title="">
<template #toolbar-tools> <template #toolbar-tools>
<ElButton <TableAction
type="primary" :actions="[
@click="onCreate" {
v-access:code="['system:dict:create']" label: $t('ui.actionTitle.create', ['字典数据']),
> type: 'primary',
<Plus class="mr-2 size-5" /> icon: ACTION_ICON.ADD,
{{ $t('ui.actionTitle.create', ['字典数据']) }} auth: ['system:dict:create'],
</ElButton> onClick: onCreate,
<ElButton },
type="primary" {
class="ml-2" label: $t('ui.actionTitle.export'),
@click="onExport" type: 'primary',
v-access:code="['system:dict:export']" icon: ACTION_ICON.DOWNLOAD,
> auth: ['system:dict:export'],
<Download class="mr-2 size-5" /> onClick: onExport,
{{ $t('ui.actionTitle.export') }} },
</ElButton> {
label: $t('ui.actionTitle.deleteBatch'),
type: 'danger',
icon: ACTION_ICON.DELETE,
disabled: isEmpty(checkedIds),
auth: ['system:dict:delete'],
onClick: onDeleteBatch,
},
]"
/>
</template> </template>
</Grid> </Grid>
</div> </div>

View File

@ -1,20 +1,21 @@
<script lang="ts" setup> <script lang="ts" setup>
import type { import type {
OnActionClickParams, OnActionClickParams,
VxeGridListeners,
VxeTableGridOptions, VxeTableGridOptions,
} from '#/adapter/vxe-table'; } from '#/adapter/vxe-table';
import type { SystemDictTypeApi } from '#/api/system/dict/type'; import type { SystemDictTypeApi } from '#/api/system/dict/type';
import { ref } from 'vue';
import { useVbenModal } from '@vben/common-ui'; import { useVbenModal } from '@vben/common-ui';
import { Download, Plus } from '@vben/icons'; import { downloadFileFromBlobPart, isEmpty } from '@vben/utils';
import { downloadFileFromBlobPart } from '@vben/utils';
import { ElButton, ElLoading, ElMessage } from 'element-plus'; import { ElLoading, ElMessage } from 'element-plus';
import { useVbenVxeGrid } from '#/adapter/vxe-table'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { import {
deleteDictType, deleteDictType,
deleteDictTypeList,
exportDictType, exportDictType,
getDictTypePage, getDictTypePage,
} from '#/api/system/dict/type'; } from '#/api/system/dict/type';
@ -61,13 +62,35 @@ async function onDelete(row: SystemDictTypeApi.DictType) {
await deleteDictType(row.id as number); await deleteDictType(row.id as number);
ElMessage.success($t('common.operationSuccess')); ElMessage.success($t('common.operationSuccess'));
onRefresh(); onRefresh();
} catch {
//
} finally { } finally {
loadingInstance.close(); loadingInstance.close();
} }
} }
/** 批量删除字典类型 */
async function onDeleteBatch() {
const loadingInstance = ElLoading.service({
text: $t('ui.actionMessage.deleting'),
fullscreen: true,
});
try {
await deleteDictTypeList(checkedIds.value);
ElMessage.success($t('ui.actionMessage.deleteSuccess'));
onRefresh();
} finally {
loadingInstance.close();
}
}
const checkedIds = ref<number[]>([]);
function handleRowCheckboxChange({
records,
}: {
records: SystemDictTypeApi.DictType[];
}) {
checkedIds.value = records.map((item) => item.id as number);
}
/** 表格操作按钮回调 */ /** 表格操作按钮回调 */
function onActionClick({ function onActionClick({
code, code,
@ -85,13 +108,6 @@ function onActionClick({
} }
} }
/** 表格事件 */
const gridEvents: VxeGridListeners<SystemDictTypeApi.DictType> = {
cellClick: ({ row }) => {
emit('select', row.type);
},
};
const [Grid, gridApi] = useVbenVxeGrid({ const [Grid, gridApi] = useVbenVxeGrid({
formOptions: { formOptions: {
schema: useTypeGridFormSchema(), schema: useTypeGridFormSchema(),
@ -120,7 +136,13 @@ const [Grid, gridApi] = useVbenVxeGrid({
search: true, search: true,
}, },
} as VxeTableGridOptions<SystemDictTypeApi.DictType>, } as VxeTableGridOptions<SystemDictTypeApi.DictType>,
gridEvents, gridEvents: {
cellClick: ({ row }: { row: SystemDictTypeApi.DictType }) => {
emit('select', row.type);
},
checkboxAll: handleRowCheckboxChange,
checkboxChange: handleRowCheckboxChange,
},
}); });
</script> </script>
@ -130,23 +152,32 @@ const [Grid, gridApi] = useVbenVxeGrid({
<Grid table-title=""> <Grid table-title="">
<template #toolbar-tools> <template #toolbar-tools>
<ElButton <TableAction
type="primary" :actions="[
@click="onCreate" {
v-access:code="['system:dict:create']" label: $t('ui.actionTitle.create', ['字典类型']),
> type: 'primary',
<Plus class="mr-2 size-5" /> icon: ACTION_ICON.ADD,
{{ $t('ui.actionTitle.create', ['字典类型']) }} auth: ['system:dict:create'],
</ElButton> onClick: onCreate,
<ElButton },
type="primary" {
class="ml-2" label: $t('ui.actionTitle.export'),
@click="onExport" type: 'primary',
v-access:code="['system:dict:export']" icon: ACTION_ICON.DOWNLOAD,
> auth: ['system:dict:export'],
<Download class="mr-2 size-5" /> onClick: onExport,
{{ $t('ui.actionTitle.export') }} },
</ElButton> {
label: $t('ui.actionTitle.deleteBatch'),
type: 'danger',
icon: ACTION_ICON.DELETE,
disabled: isEmpty(checkedIds),
auth: ['system:dict:delete'],
onClick: onDeleteBatch,
},
]"
/>
</template> </template>
</Grid> </Grid>
</div> </div>

View File

@ -129,6 +129,10 @@ export function useGridColumns<T = SystemMailAccountApi.MailAccount>(
onActionClick: OnActionClickFn<T>, onActionClick: OnActionClickFn<T>,
): VxeTableGridOptions['columns'] { ): VxeTableGridOptions['columns'] {
return [ return [
{
type: 'checkbox',
width: 40,
},
{ {
field: 'id', field: 'id',
title: '编号', title: '编号',

View File

@ -5,14 +5,17 @@ import type {
} from '#/adapter/vxe-table'; } from '#/adapter/vxe-table';
import type { SystemMailAccountApi } from '#/api/system/mail/account'; import type { SystemMailAccountApi } from '#/api/system/mail/account';
import { ref } from 'vue';
import { DocAlert, Page, useVbenModal } from '@vben/common-ui'; import { DocAlert, Page, useVbenModal } from '@vben/common-ui';
import { Plus } from '@vben/icons'; import { isEmpty } from '@vben/utils';
import { ElButton, ElLoading, ElMessage } from 'element-plus'; import { ElLoading, ElMessage } from 'element-plus';
import { useVbenVxeGrid } from '#/adapter/vxe-table'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { import {
deleteMailAccount, deleteMailAccount,
deleteMailAccountList,
getMailAccountPage, getMailAccountPage,
} from '#/api/system/mail/account'; } from '#/api/system/mail/account';
import { $t } from '#/locales'; import { $t } from '#/locales';
@ -50,13 +53,35 @@ async function onDelete(row: SystemMailAccountApi.MailAccount) {
await deleteMailAccount(row.id as number); await deleteMailAccount(row.id as number);
ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.mail])); ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.mail]));
onRefresh(); onRefresh();
} catch {
//
} finally { } finally {
loadingInstance.close(); loadingInstance.close();
} }
} }
/** 批量删除邮箱账号 */
async function onDeleteBatch() {
const loadingInstance = ElLoading.service({
text: $t('ui.actionMessage.deleting'),
fullscreen: true,
});
try {
await deleteMailAccountList(checkedIds.value);
ElMessage.success($t('ui.actionMessage.deleteSuccess'));
onRefresh();
} finally {
loadingInstance.close();
}
}
const checkedIds = ref<number[]>([]);
function handleRowCheckboxChange({
records,
}: {
records: SystemMailAccountApi.MailAccount[];
}) {
checkedIds.value = records.map((item) => item.id as number);
}
/** 表格操作按钮的回调函数 */ /** 表格操作按钮的回调函数 */
function onActionClick({ function onActionClick({
code, code,
@ -101,6 +126,10 @@ const [Grid, gridApi] = useVbenVxeGrid({
search: true, search: true,
}, },
} as VxeTableGridOptions<SystemMailAccountApi.MailAccount>, } as VxeTableGridOptions<SystemMailAccountApi.MailAccount>,
gridEvents: {
checkboxAll: handleRowCheckboxChange,
checkboxChange: handleRowCheckboxChange,
},
}); });
</script> </script>
<template> <template>
@ -112,14 +141,25 @@ const [Grid, gridApi] = useVbenVxeGrid({
<FormModal @success="onRefresh" /> <FormModal @success="onRefresh" />
<Grid table-title=""> <Grid table-title="">
<template #toolbar-tools> <template #toolbar-tools>
<ElButton <TableAction
type="primary" :actions="[
@click="onCreate" {
v-access:code="['system:mail-account:create']" label: $t('ui.actionTitle.create', ['邮箱账号']),
> type: 'primary',
<Plus class="mr-2 size-5" /> icon: ACTION_ICON.ADD,
{{ $t('ui.actionTitle.create', ['邮箱账号']) }} auth: ['system:mail-account:create'],
</ElButton> onClick: onCreate,
},
{
label: $t('ui.actionTitle.deleteBatch'),
type: 'danger',
icon: ACTION_ICON.DELETE,
disabled: isEmpty(checkedIds),
auth: ['system:mail-account:delete'],
onClick: onDeleteBatch,
},
]"
/>
</template> </template>
</Grid> </Grid>
</Page> </Page>

View File

@ -198,6 +198,10 @@ export function useGridColumns<T = SystemMailTemplateApi.MailTemplate>(
getAccountMail?: (accountId: number) => string | undefined, getAccountMail?: (accountId: number) => string | undefined,
): VxeTableGridOptions['columns'] { ): VxeTableGridOptions['columns'] {
return [ return [
{
type: 'checkbox',
width: 40,
},
{ {
field: 'id', field: 'id',
title: '编号', title: '编号',

View File

@ -9,14 +9,15 @@ import type { SystemMailTemplateApi } from '#/api/system/mail/template';
import { onMounted, ref } from 'vue'; import { onMounted, ref } from 'vue';
import { DocAlert, Page, useVbenModal } from '@vben/common-ui'; import { DocAlert, Page, useVbenModal } from '@vben/common-ui';
import { Plus } from '@vben/icons'; import { isEmpty } from '@vben/utils';
import { ElButton, ElLoading, ElMessage } from 'element-plus'; import { ElLoading, ElMessage } from 'element-plus';
import { useVbenVxeGrid } from '#/adapter/vxe-table'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { getSimpleMailAccountList } from '#/api/system/mail/account'; import { getSimpleMailAccountList } from '#/api/system/mail/account';
import { import {
deleteMailTemplate, deleteMailTemplate,
deleteMailTemplateList,
getMailTemplatePage, getMailTemplatePage,
} from '#/api/system/mail/template'; } from '#/api/system/mail/template';
import { $t } from '#/locales'; import { $t } from '#/locales';
@ -77,6 +78,30 @@ async function onDelete(row: SystemMailTemplateApi.MailTemplate) {
} }
} }
/** 批量删除邮件模板 */
async function onDeleteBatch() {
const loadingInstance = ElLoading.service({
text: $t('ui.actionMessage.deleting'),
fullscreen: true,
});
try {
await deleteMailTemplateList(checkedIds.value);
ElMessage.success($t('ui.actionMessage.deleteSuccess'));
onRefresh();
} finally {
loadingInstance.close();
}
}
const checkedIds = ref<number[]>([]);
function handleRowCheckboxChange({
records,
}: {
records: SystemMailTemplateApi.MailTemplate[];
}) {
checkedIds.value = records.map((item) => item.id as number);
}
/** 表格操作按钮的回调函数 */ /** 表格操作按钮的回调函数 */
function onActionClick({ function onActionClick({
code, code,
@ -125,6 +150,10 @@ const [Grid, gridApi] = useVbenVxeGrid({
search: true, search: true,
}, },
} as VxeTableGridOptions<SystemMailTemplateApi.MailTemplate>, } as VxeTableGridOptions<SystemMailTemplateApi.MailTemplate>,
gridEvents: {
checkboxAll: handleRowCheckboxChange,
checkboxChange: handleRowCheckboxChange,
},
}); });
/** 初始化 */ /** 初始化 */
@ -142,14 +171,25 @@ onMounted(async () => {
<SendModal /> <SendModal />
<Grid table-title=""> <Grid table-title="">
<template #toolbar-tools> <template #toolbar-tools>
<ElButton <TableAction
type="primary" :actions="[
@click="onCreate" {
v-access:code="['system:mail-template:create']" label: $t('ui.actionTitle.create', ['邮件模板']),
> type: 'primary',
<Plus class="mr-2 size-5" /> icon: ACTION_ICON.ADD,
{{ $t('ui.actionTitle.create', ['邮件模板']) }} auth: ['system:mail-template:create'],
</ElButton> onClick: onCreate,
},
{
label: $t('ui.actionTitle.deleteBatch'),
type: 'danger',
icon: ACTION_ICON.DELETE,
disabled: isEmpty(checkedIds),
auth: ['system:mail-template:delete'],
onClick: onDeleteBatch,
},
]"
/>
</template> </template>
</Grid> </Grid>
</Page> </Page>

View File

@ -95,6 +95,10 @@ export function useGridColumns<T = SystemNoticeApi.Notice>(
onActionClick: OnActionClickFn<T>, onActionClick: OnActionClickFn<T>,
): VxeTableGridOptions['columns'] { ): VxeTableGridOptions['columns'] {
return [ return [
{
type: 'checkbox',
width: 40,
},
{ {
field: 'id', field: 'id',
title: '公告编号', title: '公告编号',

View File

@ -5,13 +5,20 @@ import type {
} from '#/adapter/vxe-table'; } from '#/adapter/vxe-table';
import type { SystemNoticeApi } from '#/api/system/notice'; import type { SystemNoticeApi } from '#/api/system/notice';
import { ref } from 'vue';
import { Page, useVbenModal } from '@vben/common-ui'; import { Page, useVbenModal } from '@vben/common-ui';
import { Plus } from '@vben/icons'; import { isEmpty } from '@vben/utils';
import { ElButton, ElMessage } from 'element-plus'; import { ElMessage } from 'element-plus';
import { useVbenVxeGrid } from '#/adapter/vxe-table'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { deleteNotice, getNoticePage, pushNotice } from '#/api/system/notice'; import {
deleteNotice,
deleteNoticeList,
getNoticePage,
pushNotice,
} from '#/api/system/notice';
import { $t } from '#/locales'; import { $t } from '#/locales';
import { useGridColumns, useGridFormSchema } from './data'; import { useGridColumns, useGridFormSchema } from './data';
@ -49,11 +56,37 @@ async function onDelete(row: SystemNoticeApi.Notice) {
loadingInstance.close(); loadingInstance.close();
ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.title])); ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.title]));
onRefresh(); onRefresh();
} catch { } finally {
loadingInstance.close(); loadingInstance.close();
} }
} }
/** 批量删除公告 */
async function onDeleteBatch() {
const loadingInstance = ElMessage({
message: $t('ui.actionMessage.deleting'),
type: 'info',
duration: 0,
});
try {
await deleteNoticeList(checkedIds.value);
loadingInstance.close();
ElMessage.success($t('ui.actionMessage.deleteSuccess'));
onRefresh();
} finally {
loadingInstance.close();
}
}
const checkedIds = ref<number[]>([]);
function handleRowCheckboxChange({
records,
}: {
records: SystemNoticeApi.Notice[];
}) {
checkedIds.value = records.map((item) => item.id as number);
}
/** 推送公告 */ /** 推送公告 */
async function onPush(row: SystemNoticeApi.Notice) { async function onPush(row: SystemNoticeApi.Notice) {
const loadingInstance = ElMessage({ const loadingInstance = ElMessage({
@ -65,7 +98,7 @@ async function onPush(row: SystemNoticeApi.Notice) {
await pushNotice(row.id as number); await pushNotice(row.id as number);
loadingInstance.close(); loadingInstance.close();
ElMessage.success($t('ui.actionMessage.operationSuccess')); ElMessage.success($t('ui.actionMessage.operationSuccess'));
} catch { } finally {
loadingInstance.close(); loadingInstance.close();
} }
} }
@ -118,6 +151,10 @@ const [Grid, gridApi] = useVbenVxeGrid({
search: true, search: true,
}, },
} as VxeTableGridOptions<SystemNoticeApi.Notice>, } as VxeTableGridOptions<SystemNoticeApi.Notice>,
gridEvents: {
checkboxAll: handleRowCheckboxChange,
checkboxChange: handleRowCheckboxChange,
},
}); });
</script> </script>
@ -126,14 +163,25 @@ const [Grid, gridApi] = useVbenVxeGrid({
<FormModal @success="onRefresh" /> <FormModal @success="onRefresh" />
<Grid table-title=""> <Grid table-title="">
<template #toolbar-tools> <template #toolbar-tools>
<ElButton <TableAction
type="primary" :actions="[
@click="onCreate" {
v-access:code="['system:notice:create']" label: $t('ui.actionTitle.create', ['公告']),
> type: 'primary',
<Plus class="mr-2 size-5" /> icon: ACTION_ICON.ADD,
{{ $t('ui.actionTitle.create', ['公告']) }} auth: ['system:notice:create'],
</ElButton> onClick: onCreate,
},
{
label: $t('ui.actionTitle.deleteBatch'),
type: 'danger',
icon: ACTION_ICON.DELETE,
disabled: isEmpty(checkedIds),
auth: ['system:notice:delete'],
onClick: onDeleteBatch,
},
]"
/>
</template> </template>
</Grid> </Grid>
</Page> </Page>

View File

@ -233,6 +233,10 @@ export function useGridColumns<T = SystemNotifyTemplateApi.NotifyTemplate>(
onActionClick: OnActionClickFn<T>, onActionClick: OnActionClickFn<T>,
): VxeTableGridOptions['columns'] { ): VxeTableGridOptions['columns'] {
return [ return [
{
type: 'checkbox',
width: 40,
},
{ {
field: 'id', field: 'id',
title: '编号', title: '编号',

View File

@ -5,15 +5,17 @@ import type {
} from '#/adapter/vxe-table'; } from '#/adapter/vxe-table';
import type { SystemNotifyTemplateApi } from '#/api/system/notify/template'; import type { SystemNotifyTemplateApi } from '#/api/system/notify/template';
import { ref } from 'vue';
import { DocAlert, Page, useVbenModal } from '@vben/common-ui'; import { DocAlert, Page, useVbenModal } from '@vben/common-ui';
import { Download, Plus } from '@vben/icons'; import { downloadFileFromBlobPart, isEmpty } from '@vben/utils';
import { downloadFileFromBlobPart } from '@vben/utils';
import { ElButton, ElMessage } from 'element-plus'; import { ElMessage } from 'element-plus';
import { useVbenVxeGrid } from '#/adapter/vxe-table'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { import {
deleteNotifyTemplate, deleteNotifyTemplate,
deleteNotifyTemplateList,
exportNotifyTemplate, exportNotifyTemplate,
getNotifyTemplatePage, getNotifyTemplatePage,
} from '#/api/system/notify/template'; } from '#/api/system/notify/template';
@ -76,6 +78,32 @@ async function onDelete(row: SystemNotifyTemplateApi.NotifyTemplate) {
} }
} }
/** 批量删除站内信模板 */
async function onDeleteBatch() {
const loadingInstance = ElMessage({
message: $t('ui.actionMessage.deleting'),
type: 'info',
duration: 0,
});
try {
await deleteNotifyTemplateList(checkedIds.value);
loadingInstance.close();
ElMessage.success($t('ui.actionMessage.deleteSuccess'));
onRefresh();
} finally {
loadingInstance.close();
}
}
const checkedIds = ref<number[]>([]);
function handleRowCheckboxChange({
records,
}: {
records: SystemNotifyTemplateApi.NotifyTemplate[];
}) {
checkedIds.value = records.map((item) => item.id as number);
}
/** 表格操作按钮的回调函数 */ /** 表格操作按钮的回调函数 */
function onActionClick({ function onActionClick({
code, code,
@ -124,6 +152,10 @@ const [Grid, gridApi] = useVbenVxeGrid({
search: true, search: true,
}, },
} as VxeTableGridOptions<SystemNotifyTemplateApi.NotifyTemplate>, } as VxeTableGridOptions<SystemNotifyTemplateApi.NotifyTemplate>,
gridEvents: {
checkboxAll: handleRowCheckboxChange,
checkboxChange: handleRowCheckboxChange,
},
}); });
</script> </script>
@ -137,23 +169,32 @@ const [Grid, gridApi] = useVbenVxeGrid({
<SendModal /> <SendModal />
<Grid table-title=""> <Grid table-title="">
<template #toolbar-tools> <template #toolbar-tools>
<ElButton <TableAction
type="primary" :actions="[
@click="onCreate" {
v-access:code="['system:notify-template:create']" label: $t('ui.actionTitle.create', ['站内信模板']),
> type: 'primary',
<Plus class="mr-2 size-5" /> icon: ACTION_ICON.ADD,
{{ $t('ui.actionTitle.create', ['站内信模板']) }} auth: ['system:notify-template:create'],
</ElButton> onClick: onCreate,
<ElButton },
type="primary" {
class="ml-2" label: $t('ui.actionTitle.export'),
@click="onExport" type: 'primary',
v-access:code="['system:notify-template:export']" icon: ACTION_ICON.DOWNLOAD,
> auth: ['system:notify-template:export'],
<Download class="mr-2 size-5" /> onClick: onExport,
{{ $t('ui.actionTitle.export') }} },
</ElButton> {
label: $t('ui.actionTitle.deleteBatch'),
type: 'danger',
icon: ACTION_ICON.DELETE,
disabled: isEmpty(checkedIds),
auth: ['system:notify-template:delete'],
onClick: onDeleteBatch,
},
]"
/>
</template> </template>
</Grid> </Grid>
</Page> </Page>

View File

@ -195,6 +195,10 @@ export function useGridColumns<T = SystemOAuth2ClientApi.OAuth2Client>(
onActionClick: OnActionClickFn<T>, onActionClick: OnActionClickFn<T>,
): VxeTableGridOptions['columns'] { ): VxeTableGridOptions['columns'] {
return [ return [
{
type: 'checkbox',
width: 40,
},
{ {
field: 'clientId', field: 'clientId',
title: '客户端编号', title: '客户端编号',

View File

@ -5,14 +5,17 @@ import type {
} from '#/adapter/vxe-table'; } from '#/adapter/vxe-table';
import type { SystemOAuth2ClientApi } from '#/api/system/oauth2/client'; import type { SystemOAuth2ClientApi } from '#/api/system/oauth2/client';
import { ref } from 'vue';
import { DocAlert, Page, useVbenModal } from '@vben/common-ui'; import { DocAlert, Page, useVbenModal } from '@vben/common-ui';
import { Plus } from '@vben/icons'; import { isEmpty } from '@vben/utils';
import { ElButton, ElLoading, ElMessage } from 'element-plus'; import { ElLoading, ElMessage } from 'element-plus';
import { useVbenVxeGrid } from '#/adapter/vxe-table'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { import {
deleteOAuth2Client, deleteOAuth2Client,
deleteOAuth2ClientList,
getOAuth2ClientPage, getOAuth2ClientPage,
} from '#/api/system/oauth2/client'; } from '#/api/system/oauth2/client';
import { $t } from '#/locales'; import { $t } from '#/locales';
@ -50,13 +53,35 @@ async function onDelete(row: SystemOAuth2ClientApi.OAuth2Client) {
await deleteOAuth2Client(row.id as number); await deleteOAuth2Client(row.id as number);
ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name]));
onRefresh(); onRefresh();
} catch {
//
} finally { } finally {
loadingInstance.close(); loadingInstance.close();
} }
} }
/** 批量删除 OAuth2 客户端 */
async function onDeleteBatch() {
const loadingInstance = ElLoading.service({
text: $t('ui.actionMessage.deleting'),
fullscreen: true,
});
try {
await deleteOAuth2ClientList(checkedIds.value);
ElMessage.success($t('ui.actionMessage.deleteSuccess'));
onRefresh();
} finally {
loadingInstance.close();
}
}
const checkedIds = ref<number[]>([]);
function handleRowCheckboxChange({
records,
}: {
records: SystemOAuth2ClientApi.OAuth2Client[];
}) {
checkedIds.value = records.map((item) => item.id as number);
}
/** 表格操作按钮的回调函数 */ /** 表格操作按钮的回调函数 */
function onActionClick({ function onActionClick({
code, code,
@ -101,6 +126,10 @@ const [Grid, gridApi] = useVbenVxeGrid({
search: true, search: true,
}, },
} as VxeTableGridOptions<SystemOAuth2ClientApi.OAuth2Client>, } as VxeTableGridOptions<SystemOAuth2ClientApi.OAuth2Client>,
gridEvents: {
checkboxAll: handleRowCheckboxChange,
checkboxChange: handleRowCheckboxChange,
},
}); });
</script> </script>
@ -116,14 +145,25 @@ const [Grid, gridApi] = useVbenVxeGrid({
<FormModal @success="onRefresh" /> <FormModal @success="onRefresh" />
<Grid table-title="OAuth2 "> <Grid table-title="OAuth2 ">
<template #toolbar-tools> <template #toolbar-tools>
<ElButton <TableAction
type="primary" :actions="[
@click="onCreate" {
v-access:code="['system:oauth2-client:create']" label: $t('ui.actionTitle.create', [' OAuth2.0 客户端']),
> type: 'primary',
<Plus class="mr-2 size-5" /> icon: ACTION_ICON.ADD,
{{ $t('ui.actionTitle.create', [' OAuth2.0 客户端']) }} auth: ['system:oauth2-client:create'],
</ElButton> onClick: onCreate,
},
{
label: $t('ui.actionTitle.deleteBatch'),
type: 'danger',
icon: ACTION_ICON.DELETE,
disabled: isEmpty(checkedIds),
auth: ['system:oauth2-client:delete'],
onClick: onDeleteBatch,
},
]"
/>
</template> </template>
</Grid> </Grid>
</Page> </Page>

View File

@ -90,6 +90,10 @@ export function useGridColumns<T = SystemPostApi.Post>(
onActionClick: OnActionClickFn<T>, onActionClick: OnActionClickFn<T>,
): VxeTableGridOptions['columns'] { ): VxeTableGridOptions['columns'] {
return [ return [
{
type: 'checkbox',
width: 40,
},
{ {
field: 'id', field: 'id',
title: '岗位编号', title: '岗位编号',

View File

@ -5,14 +5,20 @@ import type {
} from '#/adapter/vxe-table'; } from '#/adapter/vxe-table';
import type { SystemPostApi } from '#/api/system/post'; import type { SystemPostApi } from '#/api/system/post';
import { ref } from 'vue';
import { Page, useVbenModal } from '@vben/common-ui'; import { Page, useVbenModal } from '@vben/common-ui';
import { Download, Plus } from '@vben/icons'; import { downloadFileFromBlobPart, isEmpty } from '@vben/utils';
import { downloadFileFromBlobPart } from '@vben/utils';
import { ElButton, ElLoading, ElMessage } from 'element-plus'; import { ElLoading, ElMessage } from 'element-plus';
import { useVbenVxeGrid } from '#/adapter/vxe-table'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { deletePost, exportPost, getPostPage } from '#/api/system/post'; import {
deletePost,
deletePostList,
exportPost,
getPostPage,
} from '#/api/system/post';
import { $t } from '#/locales'; import { $t } from '#/locales';
import { useGridColumns, useGridFormSchema } from './data'; import { useGridColumns, useGridFormSchema } from './data';
@ -54,13 +60,35 @@ async function onDelete(row: SystemPostApi.Post) {
await deletePost(row.id as number); await deletePost(row.id as number);
ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name]));
onRefresh(); onRefresh();
} catch {
//
} finally { } finally {
loadingInstance.close(); loadingInstance.close();
} }
} }
/** 批量删除岗位 */
async function onDeleteBatch() {
const loadingInstance = ElLoading.service({
text: $t('ui.actionMessage.deleting'),
fullscreen: true,
});
try {
await deletePostList(checkedIds.value);
ElMessage.success($t('ui.actionMessage.deleteSuccess'));
onRefresh();
} finally {
loadingInstance.close();
}
}
const checkedIds = ref<number[]>([]);
function handleRowCheckboxChange({
records,
}: {
records: SystemPostApi.Post[];
}) {
checkedIds.value = records.map((item) => item.id as number);
}
/** 表格操作按钮的回调函数 */ /** 表格操作按钮的回调函数 */
function onActionClick({ code, row }: OnActionClickParams<SystemPostApi.Post>) { function onActionClick({ code, row }: OnActionClickParams<SystemPostApi.Post>) {
switch (code) { switch (code) {
@ -102,6 +130,10 @@ const [Grid, gridApi] = useVbenVxeGrid({
search: true, search: true,
}, },
} as VxeTableGridOptions<SystemPostApi.Post>, } as VxeTableGridOptions<SystemPostApi.Post>,
gridEvents: {
checkboxAll: handleRowCheckboxChange,
checkboxChange: handleRowCheckboxChange,
},
}); });
</script> </script>
@ -110,23 +142,32 @@ const [Grid, gridApi] = useVbenVxeGrid({
<FormModal @success="onRefresh" /> <FormModal @success="onRefresh" />
<Grid table-title=""> <Grid table-title="">
<template #toolbar-tools> <template #toolbar-tools>
<ElButton <TableAction
type="primary" :actions="[
@click="onCreate" {
v-access:code="['system:post:create']" label: $t('ui.actionTitle.create', ['岗位']),
> type: 'primary',
<Plus class="mr-2 size-5" /> icon: ACTION_ICON.ADD,
{{ $t('ui.actionTitle.create', ['岗位']) }} auth: ['system:post:create'],
</ElButton> onClick: onCreate,
<ElButton },
type="primary" {
class="ml-2" label: $t('ui.actionTitle.export'),
@click="onExport" type: 'primary',
v-access:code="['system:post:export']" icon: ACTION_ICON.DOWNLOAD,
> auth: ['system:post:export'],
<Download class="mr-2 size-5" /> onClick: onExport,
{{ $t('ui.actionTitle.export') }} },
</ElButton> {
label: $t('ui.actionTitle.deleteBatch'),
type: 'danger',
icon: ACTION_ICON.DELETE,
disabled: isEmpty(checkedIds),
auth: ['system:post:delete'],
onClick: onDeleteBatch,
},
]"
/>
</template> </template>
</Grid> </Grid>
</Page> </Page>

View File

@ -193,6 +193,10 @@ export function useGridColumns<T = SystemRoleApi.Role>(
onActionClick: OnActionClickFn<T>, onActionClick: OnActionClickFn<T>,
): VxeTableGridOptions['columns'] { ): VxeTableGridOptions['columns'] {
return [ return [
{
type: 'checkbox',
width: 40,
},
{ {
field: 'id', field: 'id',
title: '角色编号', title: '角色编号',

View File

@ -5,14 +5,21 @@ import type {
} from '#/adapter/vxe-table'; } from '#/adapter/vxe-table';
import type { SystemRoleApi } from '#/api/system/role'; import type { SystemRoleApi } from '#/api/system/role';
import { ref } from 'vue';
import { DocAlert, Page, useVbenModal } from '@vben/common-ui'; import { DocAlert, Page, useVbenModal } from '@vben/common-ui';
import { Download, Plus } from '@vben/icons'; import { Download, Plus } from '@vben/icons';
import { downloadFileFromBlobPart } from '@vben/utils'; import { downloadFileFromBlobPart, isEmpty } from '@vben/utils';
import { ElButton, ElLoading, ElMessage } from 'element-plus'; import { ElButton, ElLoading, ElMessage } from 'element-plus';
import { useVbenVxeGrid } from '#/adapter/vxe-table'; import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { deleteRole, exportRole, getRolePage } from '#/api/system/role'; import {
deleteRole,
deleteRoleList,
exportRole,
getRolePage,
} from '#/api/system/role';
import { $t } from '#/locales'; import { $t } from '#/locales';
import { useGridColumns, useGridFormSchema } from './data'; import { useGridColumns, useGridFormSchema } from './data';
@ -67,13 +74,35 @@ async function onDelete(row: SystemRoleApi.Role) {
await deleteRole(row.id as number); await deleteRole(row.id as number);
ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name]));
onRefresh(); onRefresh();
} catch {
//
} finally { } finally {
loadingInstance.close(); loadingInstance.close();
} }
} }
/** 批量删除角色 */
async function onDeleteBatch() {
const loadingInstance = ElLoading.service({
text: $t('ui.actionMessage.deleting'),
fullscreen: true,
});
try {
await deleteRoleList(checkedIds.value);
ElMessage.success($t('ui.actionMessage.deleteSuccess'));
onRefresh();
} finally {
loadingInstance.close();
}
}
const checkedIds = ref<number[]>([]);
function handleRowCheckboxChange({
records,
}: {
records: SystemRoleApi.Role[];
}) {
checkedIds.value = records.map((item) => item.id as number);
}
/** 分配角色的数据权限 */ /** 分配角色的数据权限 */
function onAssignDataPermission(row: SystemRoleApi.Role) { function onAssignDataPermission(row: SystemRoleApi.Role) {
assignDataPermissionFormApi.setData(row).open(); assignDataPermissionFormApi.setData(row).open();
@ -133,6 +162,10 @@ const [Grid, gridApi] = useVbenVxeGrid({
search: true, search: true,
}, },
} as VxeTableGridOptions<SystemRoleApi.Role>, } as VxeTableGridOptions<SystemRoleApi.Role>,
gridEvents: {
checkboxAll: handleRowCheckboxChange,
checkboxChange: handleRowCheckboxChange,
},
}); });
</script> </script>
@ -168,6 +201,16 @@ const [Grid, gridApi] = useVbenVxeGrid({
<Download class="mr-2 size-5" /> <Download class="mr-2 size-5" />
{{ $t('ui.actionTitle.export') }} {{ $t('ui.actionTitle.export') }}
</ElButton> </ElButton>
<ElButton
type="danger"
class="ml-2"
@click="onDeleteBatch"
v-access:code="['system:role:delete']"
:disabled="isEmpty(checkedIds)"
>
<i class="fa-solid fa-trash-can mr-2"></i>
{{ $t('ui.actionTitle.deleteBatch') }}
</ElButton>
</template> </template>
</Grid> </Grid>
</Page> </Page>

View File

@ -139,6 +139,10 @@ export function useGridColumns<T = SystemSmsChannelApi.SmsChannel>(
onActionClick: OnActionClickFn<T>, onActionClick: OnActionClickFn<T>,
): VxeTableGridOptions['columns'] { ): VxeTableGridOptions['columns'] {
return [ return [
{
type: 'checkbox',
width: 40,
},
{ {
field: 'id', field: 'id',
title: '编号', title: '编号',

View File

@ -5,15 +5,17 @@ import type {
} from '#/adapter/vxe-table'; } from '#/adapter/vxe-table';
import type { SystemSmsChannelApi } from '#/api/system/sms/channel'; import type { SystemSmsChannelApi } from '#/api/system/sms/channel';
import { ref } from 'vue';
import { DocAlert, Page, useVbenModal } from '@vben/common-ui'; import { DocAlert, Page, useVbenModal } from '@vben/common-ui';
import { Download, Plus } from '@vben/icons'; import { downloadFileFromBlobPart, isEmpty } from '@vben/utils';
import { downloadFileFromBlobPart } from '@vben/utils';
import { ElButton, ElLoading, ElMessage } from 'element-plus'; import { ElLoading, ElMessage } from 'element-plus';
import { useVbenVxeGrid } from '#/adapter/vxe-table'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { import {
deleteSmsChannel, deleteSmsChannel,
deleteSmsChannelList,
exportSmsChannel, exportSmsChannel,
getSmsChannelPage, getSmsChannelPage,
} from '#/api/system/sms/channel'; } from '#/api/system/sms/channel';
@ -58,13 +60,35 @@ async function onDelete(row: SystemSmsChannelApi.SmsChannel) {
await deleteSmsChannel(row.id as number); await deleteSmsChannel(row.id as number);
ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.signature])); ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.signature]));
onRefresh(); onRefresh();
} catch {
//
} finally { } finally {
loadingInstance.close(); loadingInstance.close();
} }
} }
/** 批量删除短信渠道 */
async function onDeleteBatch() {
const loadingInstance = ElLoading.service({
text: $t('ui.actionMessage.deleting'),
fullscreen: true,
});
try {
await deleteSmsChannelList(checkedIds.value);
ElMessage.success($t('ui.actionMessage.deleteSuccess'));
onRefresh();
} finally {
loadingInstance.close();
}
}
const checkedIds = ref<number[]>([]);
function handleRowCheckboxChange({
records,
}: {
records: SystemSmsChannelApi.SmsChannel[];
}) {
checkedIds.value = records.map((item) => item.id as number);
}
/** 表格操作按钮的回调函数 */ /** 表格操作按钮的回调函数 */
function onActionClick({ function onActionClick({
code, code,
@ -109,6 +133,10 @@ const [Grid, gridApi] = useVbenVxeGrid({
search: true, search: true,
}, },
} as VxeTableGridOptions<SystemSmsChannelApi.SmsChannel>, } as VxeTableGridOptions<SystemSmsChannelApi.SmsChannel>,
gridEvents: {
checkboxAll: handleRowCheckboxChange,
checkboxChange: handleRowCheckboxChange,
},
}); });
</script> </script>
@ -121,23 +149,32 @@ const [Grid, gridApi] = useVbenVxeGrid({
<FormModal @success="onRefresh" /> <FormModal @success="onRefresh" />
<Grid table-title=""> <Grid table-title="">
<template #toolbar-tools> <template #toolbar-tools>
<ElButton <TableAction
type="primary" :actions="[
@click="onCreate" {
v-access:code="['system:sms-channel:create']" label: $t('ui.actionTitle.create', ['短信渠道']),
> type: 'primary',
<Plus class="mr-2 size-5" /> icon: ACTION_ICON.ADD,
{{ $t('ui.actionTitle.create', ['短信渠道']) }} auth: ['system:sms-channel:create'],
</ElButton> onClick: onCreate,
<ElButton },
type="primary" {
class="ml-2" label: $t('ui.actionTitle.export'),
@click="onExport" type: 'primary',
v-access:code="['system:sms-channel:export']" icon: ACTION_ICON.DOWNLOAD,
> auth: ['system:sms-channel:export'],
<Download class="mr-2 size-5" /> onClick: onExport,
{{ $t('ui.actionTitle.export') }} },
</ElButton> {
label: $t('ui.actionTitle.deleteBatch'),
type: 'danger',
icon: ACTION_ICON.DELETE,
disabled: isEmpty(checkedIds),
auth: ['system:sms-channel:delete'],
onClick: onDeleteBatch,
},
]"
/>
</template> </template>
</Grid> </Grid>
</Page> </Page>

View File

@ -208,6 +208,10 @@ export function useGridColumns<T = SystemSmsTemplateApi.SmsTemplate>(
onActionClick: OnActionClickFn<T>, onActionClick: OnActionClickFn<T>,
): VxeTableGridOptions['columns'] { ): VxeTableGridOptions['columns'] {
return [ return [
{
type: 'checkbox',
width: 40,
},
{ {
field: 'id', field: 'id',
title: '编号', title: '编号',

View File

@ -5,15 +5,17 @@ import type {
} from '#/adapter/vxe-table'; } from '#/adapter/vxe-table';
import type { SystemSmsTemplateApi } from '#/api/system/sms/template'; import type { SystemSmsTemplateApi } from '#/api/system/sms/template';
import { ref } from 'vue';
import { DocAlert, Page, useVbenModal } from '@vben/common-ui'; import { DocAlert, Page, useVbenModal } from '@vben/common-ui';
import { Download, Plus } from '@vben/icons'; import { downloadFileFromBlobPart, isEmpty } from '@vben/utils';
import { downloadFileFromBlobPart } from '@vben/utils';
import { ElButton, ElLoading, ElMessage } from 'element-plus'; import { ElLoading, ElMessage } from 'element-plus';
import { useVbenVxeGrid } from '#/adapter/vxe-table'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { import {
deleteSmsTemplate, deleteSmsTemplate,
deleteSmsTemplateList,
exportSmsTemplate, exportSmsTemplate,
getSmsTemplatePage, getSmsTemplatePage,
} from '#/api/system/sms/template'; } from '#/api/system/sms/template';
@ -69,13 +71,35 @@ async function onDelete(row: SystemSmsTemplateApi.SmsTemplate) {
await deleteSmsTemplate(row.id as number); await deleteSmsTemplate(row.id as number);
ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name]));
onRefresh(); onRefresh();
} catch {
//
} finally { } finally {
loadingInstance.close(); loadingInstance.close();
} }
} }
/** 批量删除短信模板 */
async function onDeleteBatch() {
const loadingInstance = ElLoading.service({
text: $t('ui.actionMessage.deleting'),
fullscreen: true,
});
try {
await deleteSmsTemplateList(checkedIds.value);
ElMessage.success($t('ui.actionMessage.deleteSuccess'));
onRefresh();
} finally {
loadingInstance.close();
}
}
const checkedIds = ref<number[]>([]);
function handleRowCheckboxChange({
records,
}: {
records: SystemSmsTemplateApi.SmsTemplate[];
}) {
checkedIds.value = records.map((item) => item.id as number);
}
/** 表格操作按钮的回调函数 */ /** 表格操作按钮的回调函数 */
function onActionClick({ function onActionClick({
code, code,
@ -124,6 +148,10 @@ const [Grid, gridApi] = useVbenVxeGrid({
search: true, search: true,
}, },
} as VxeTableGridOptions<SystemSmsTemplateApi.SmsTemplate>, } as VxeTableGridOptions<SystemSmsTemplateApi.SmsTemplate>,
gridEvents: {
checkboxAll: handleRowCheckboxChange,
checkboxChange: handleRowCheckboxChange,
},
}); });
</script> </script>
@ -137,23 +165,32 @@ const [Grid, gridApi] = useVbenVxeGrid({
<SendModal /> <SendModal />
<Grid table-title=""> <Grid table-title="">
<template #toolbar-tools> <template #toolbar-tools>
<ElButton <TableAction
type="primary" :actions="[
@click="onCreate" {
v-access:code="['system:sms-template:create']" label: $t('ui.actionTitle.create', ['短信模板']),
> type: 'primary',
<Plus class="mr-2 size-5" /> icon: ACTION_ICON.ADD,
{{ $t('ui.actionTitle.create', ['短信模板']) }} auth: ['system:sms-template:create'],
</ElButton> onClick: onCreate,
<ElButton },
type="primary" {
class="ml-2" label: $t('ui.actionTitle.export'),
@click="onExport" type: 'primary',
v-access:code="['system:sms-template:export']" icon: ACTION_ICON.DOWNLOAD,
> auth: ['system:sms-template:export'],
<Download class="mr-2 size-5" /> onClick: onExport,
{{ $t('ui.actionTitle.export') }} },
</ElButton> {
label: $t('ui.actionTitle.deleteBatch'),
type: 'danger',
icon: ACTION_ICON.DELETE,
disabled: isEmpty(checkedIds),
auth: ['system:sms-template:delete'],
onClick: onDeleteBatch,
},
]"
/>
</template> </template>
</Grid> </Grid>
</Page> </Page>

View File

@ -156,6 +156,10 @@ export function useGridColumns<T = SystemSocialClientApi.SocialClient>(
onActionClick: OnActionClickFn<T>, onActionClick: OnActionClickFn<T>,
): VxeTableGridOptions['columns'] { ): VxeTableGridOptions['columns'] {
return [ return [
{
type: 'checkbox',
width: 40,
},
{ {
field: 'id', field: 'id',
title: '编号', title: '编号',

View File

@ -5,14 +5,17 @@ import type {
} from '#/adapter/vxe-table'; } from '#/adapter/vxe-table';
import type { SystemSocialClientApi } from '#/api/system/social/client'; import type { SystemSocialClientApi } from '#/api/system/social/client';
import { ref } from 'vue';
import { DocAlert, Page, useVbenModal } from '@vben/common-ui'; import { DocAlert, Page, useVbenModal } from '@vben/common-ui';
import { Plus } from '@vben/icons'; import { isEmpty } from '@vben/utils';
import { ElButton, ElLoading, ElMessage } from 'element-plus'; import { ElLoading, ElMessage } from 'element-plus';
import { useVbenVxeGrid } from '#/adapter/vxe-table'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { import {
deleteSocialClient, deleteSocialClient,
deleteSocialClientList,
getSocialClientPage, getSocialClientPage,
} from '#/api/system/social/client'; } from '#/api/system/social/client';
import { $t } from '#/locales'; import { $t } from '#/locales';
@ -50,13 +53,35 @@ async function onDelete(row: SystemSocialClientApi.SocialClient) {
await deleteSocialClient(row.id as number); await deleteSocialClient(row.id as number);
ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name]));
onRefresh(); onRefresh();
} catch {
// finallyloading
} finally { } finally {
loadingInstance.close(); loadingInstance.close();
} }
} }
/** 批量删除社交客户端 */
async function onDeleteBatch() {
const loadingInstance = ElLoading.service({
text: $t('ui.actionMessage.deleting'),
fullscreen: true,
});
try {
await deleteSocialClientList(checkedIds.value);
ElMessage.success($t('ui.actionMessage.deleteSuccess'));
onRefresh();
} finally {
loadingInstance.close();
}
}
const checkedIds = ref<number[]>([]);
function handleRowCheckboxChange({
records,
}: {
records: SystemSocialClientApi.SocialClient[];
}) {
checkedIds.value = records.map((item) => item.id as number);
}
/** 表格操作按钮的回调函数 */ /** 表格操作按钮的回调函数 */
function onActionClick({ function onActionClick({
code, code,
@ -101,6 +126,10 @@ const [Grid, gridApi] = useVbenVxeGrid({
search: true, search: true,
}, },
} as VxeTableGridOptions<SystemSocialClientApi.SocialClient>, } as VxeTableGridOptions<SystemSocialClientApi.SocialClient>,
gridEvents: {
checkboxAll: handleRowCheckboxChange,
checkboxChange: handleRowCheckboxChange,
},
}); });
</script> </script>
@ -113,14 +142,25 @@ const [Grid, gridApi] = useVbenVxeGrid({
<FormModal @success="onRefresh" /> <FormModal @success="onRefresh" />
<Grid table-title=""> <Grid table-title="">
<template #toolbar-tools> <template #toolbar-tools>
<ElButton <TableAction
type="primary" :actions="[
@click="onCreate" {
v-access:code="['system:social-client:create']" label: $t('ui.actionTitle.create', ['社交客户端']),
> type: 'primary',
<Plus class="mr-2 size-5" /> icon: ACTION_ICON.ADD,
{{ $t('ui.actionTitle.create', ['社交客户端']) }} auth: ['system:social-client:create'],
</ElButton> onClick: onCreate,
},
{
label: $t('ui.actionTitle.deleteBatch'),
type: 'danger',
icon: ACTION_ICON.DELETE,
disabled: isEmpty(checkedIds),
auth: ['system:social-client:delete'],
onClick: onDeleteBatch,
},
]"
/>
</template> </template>
</Grid> </Grid>
</Page> </Page>

View File

@ -167,6 +167,10 @@ export function useGridColumns<T = SystemTenantApi.Tenant>(
getPackageName?: (packageId: number) => string | undefined, getPackageName?: (packageId: number) => string | undefined,
): VxeTableGridOptions['columns'] { ): VxeTableGridOptions['columns'] {
return [ return [
{
type: 'checkbox',
width: 40,
},
{ {
field: 'id', field: 'id',
title: '租户编号', title: '租户编号',

View File

@ -9,13 +9,17 @@ import type { SystemTenantPackageApi } from '#/api/system/tenant-package';
import { onMounted, ref } from 'vue'; import { onMounted, ref } from 'vue';
import { DocAlert, Page, useVbenModal } from '@vben/common-ui'; import { DocAlert, Page, useVbenModal } from '@vben/common-ui';
import { Download, Plus } from '@vben/icons'; import { downloadFileFromBlobPart, isEmpty } from '@vben/utils';
import { downloadFileFromBlobPart } from '@vben/utils';
import { ElButton, ElLoading, ElMessage } from 'element-plus'; import { ElLoading, ElMessage } from 'element-plus';
import { useVbenVxeGrid } from '#/adapter/vxe-table'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { deleteTenant, exportTenant, getTenantPage } from '#/api/system/tenant'; import {
deleteTenant,
deleteTenantList,
exportTenant,
getTenantPage,
} from '#/api/system/tenant';
import { getTenantPackageList } from '#/api/system/tenant-package'; import { getTenantPackageList } from '#/api/system/tenant-package';
import { $t } from '#/locales'; import { $t } from '#/locales';
@ -69,13 +73,36 @@ async function onDelete(row: SystemTenantApi.Tenant) {
await deleteTenant(row.id as number); await deleteTenant(row.id as number);
ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name]));
onRefresh(); onRefresh();
} catch {
//
} finally { } finally {
loading.close(); loading.close();
} }
} }
/** 批量删除租户 */
async function onDeleteBatch() {
const loading = ElLoading.service({
lock: true,
text: $t('ui.actionMessage.deleting'),
background: 'rgba(0, 0, 0, 0.7)',
});
try {
await deleteTenantList(checkedIds.value);
ElMessage.success($t('ui.actionMessage.deleteSuccess'));
onRefresh();
} finally {
loading.close();
}
}
const checkedIds = ref<number[]>([]);
function handleRowCheckboxChange({
records,
}: {
records: SystemTenantApi.Tenant[];
}) {
checkedIds.value = records.map((item) => item.id as number);
}
/** 表格操作按钮的回调函数 */ /** 表格操作按钮的回调函数 */
function onActionClick({ function onActionClick({
code, code,
@ -120,6 +147,10 @@ const [Grid, gridApi] = useVbenVxeGrid({
search: true, search: true,
}, },
} as VxeTableGridOptions<SystemTenantApi.Tenant>, } as VxeTableGridOptions<SystemTenantApi.Tenant>,
gridEvents: {
checkboxAll: handleRowCheckboxChange,
checkboxChange: handleRowCheckboxChange,
},
}); });
/** 初始化 */ /** 初始化 */
@ -136,23 +167,32 @@ onMounted(async () => {
<FormModal @success="onRefresh" /> <FormModal @success="onRefresh" />
<Grid table-title=""> <Grid table-title="">
<template #toolbar-tools> <template #toolbar-tools>
<ElButton <TableAction
type="primary" :actions="[
@click="onCreate" {
v-access:code="['system:tenant:create']" label: $t('ui.actionTitle.create', ['租户']),
> type: 'primary',
<Plus class="mr-2 size-5" /> icon: ACTION_ICON.ADD,
{{ $t('ui.actionTitle.create', ['租户']) }} auth: ['system:tenant:create'],
</ElButton> onClick: onCreate,
<ElButton },
type="primary" {
class="ml-2" label: $t('ui.actionTitle.export'),
@click="onExport" type: 'primary',
v-access:code="['system:tenant:export']" icon: ACTION_ICON.DOWNLOAD,
> auth: ['system:tenant:export'],
<Download class="mr-2 size-5" /> onClick: onExport,
{{ $t('ui.actionTitle.export') }} },
</ElButton> {
label: $t('ui.actionTitle.deleteBatch'),
type: 'danger',
icon: ACTION_ICON.DELETE,
disabled: isEmpty(checkedIds),
auth: ['system:tenant:delete'],
onClick: onDeleteBatch,
},
]"
/>
</template> </template>
</Grid> </Grid>
</Page> </Page>

View File

@ -95,6 +95,10 @@ export function useGridColumns<T = SystemTenantPackageApi.TenantPackage>(
onActionClick: OnActionClickFn<T>, onActionClick: OnActionClickFn<T>,
): VxeTableGridOptions['columns'] { ): VxeTableGridOptions['columns'] {
return [ return [
{
type: 'checkbox',
width: 40,
},
{ {
field: 'id', field: 'id',
title: '套餐编号', title: '套餐编号',

View File

@ -5,14 +5,17 @@ import type {
} from '#/adapter/vxe-table'; } from '#/adapter/vxe-table';
import type { SystemTenantPackageApi } from '#/api/system/tenant-package'; import type { SystemTenantPackageApi } from '#/api/system/tenant-package';
import { ref } from 'vue';
import { DocAlert, Page, useVbenModal } from '@vben/common-ui'; import { DocAlert, Page, useVbenModal } from '@vben/common-ui';
import { Plus } from '@vben/icons'; import { isEmpty } from '@vben/utils';
import { ElButton, ElMessage } from 'element-plus'; import { ElMessage } from 'element-plus';
import { useVbenVxeGrid } from '#/adapter/vxe-table'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { import {
deleteTenantPackage, deleteTenantPackage,
deleteTenantPackageList,
getTenantPackagePage, getTenantPackagePage,
} from '#/api/system/tenant-package'; } from '#/api/system/tenant-package';
import { $t } from '#/locales'; import { $t } from '#/locales';
@ -52,11 +55,37 @@ async function onDelete(row: SystemTenantPackageApi.TenantPackage) {
loadingInstance.close(); loadingInstance.close();
ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name]));
onRefresh(); onRefresh();
} catch { } finally {
loadingInstance.close(); loadingInstance.close();
} }
} }
/** 批量删除租户套餐 */
async function onDeleteBatch() {
const loadingInstance = ElMessage({
message: $t('ui.actionMessage.deleting'),
type: 'info',
duration: 0,
});
try {
await deleteTenantPackageList(checkedIds.value);
loadingInstance.close();
ElMessage.success($t('ui.actionMessage.deleteSuccess'));
onRefresh();
} finally {
loadingInstance.close();
}
}
const checkedIds = ref<number[]>([]);
function handleRowCheckboxChange({
records,
}: {
records: SystemTenantPackageApi.TenantPackage[];
}) {
checkedIds.value = records.map((item) => item.id as number);
}
/** 表格操作按钮的回调函数 */ /** 表格操作按钮的回调函数 */
function onActionClick({ function onActionClick({
code, code,
@ -102,6 +131,10 @@ const [Grid, gridApi] = useVbenVxeGrid({
search: true, search: true,
}, },
} as VxeTableGridOptions<SystemTenantPackageApi.TenantPackage>, } as VxeTableGridOptions<SystemTenantPackageApi.TenantPackage>,
gridEvents: {
checkboxAll: handleRowCheckboxChange,
checkboxChange: handleRowCheckboxChange,
},
}); });
</script> </script>
@ -114,14 +147,25 @@ const [Grid, gridApi] = useVbenVxeGrid({
<FormModal @success="onRefresh" /> <FormModal @success="onRefresh" />
<Grid table-title=""> <Grid table-title="">
<template #toolbar-tools> <template #toolbar-tools>
<ElButton <TableAction
type="primary" :actions="[
@click="onCreate" {
v-access:code="['system:tenant-package:create']" label: $t('ui.actionTitle.create', ['套餐']),
> type: 'primary',
<Plus class="mr-2 size-5" /> icon: ACTION_ICON.ADD,
{{ $t('ui.actionTitle.create', ['套餐']) }} auth: ['system:tenant-package:create'],
</ElButton> onClick: onCreate,
},
{
label: $t('ui.actionTitle.deleteBatch'),
type: 'danger',
icon: ACTION_ICON.DELETE,
disabled: isEmpty(checkedIds),
auth: ['system:tenant-package:delete'],
onClick: onDeleteBatch,
},
]"
/>
</template> </template>
</Grid> </Grid>
</Page> </Page>

View File

@ -285,6 +285,10 @@ export function useGridColumns<T = SystemUserApi.User>(
) => PromiseLike<boolean | undefined>, ) => PromiseLike<boolean | undefined>,
): VxeTableGridOptions['columns'] { ): VxeTableGridOptions['columns'] {
return [ return [
{
type: 'checkbox',
width: 40,
},
{ {
field: 'id', field: 'id',
title: '用户编号', title: '用户编号',

View File

@ -6,13 +6,14 @@ import type { SystemUserApi } from '#/api/system/user';
import { ref } from 'vue'; import { ref } from 'vue';
import { confirm, DocAlert, Page, useVbenModal } from '@vben/common-ui'; import { confirm, DocAlert, Page, useVbenModal } from '@vben/common-ui';
import { downloadFileFromBlobPart } from '@vben/utils'; import { downloadFileFromBlobPart, isEmpty } from '@vben/utils';
import { ElLoading, ElMessage } from 'element-plus'; import { ElLoading, ElMessage } from 'element-plus';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { import {
deleteUser, deleteUser,
deleteUserList,
exportUser, exportUser,
getUserPage, getUserPage,
updateUserStatus, updateUserStatus,
@ -90,13 +91,35 @@ async function onDelete(row: SystemUserApi.User) {
await deleteUser(row.id as number); await deleteUser(row.id as number);
ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.username])); ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.username]));
onRefresh(); onRefresh();
} catch {
//
} finally { } finally {
loadingInstance.close(); loadingInstance.close();
} }
} }
/** 批量删除用户 */
async function onDeleteBatch() {
const loadingInstance = ElLoading.service({
text: $t('ui.actionMessage.deleting'),
fullscreen: true,
});
try {
await deleteUserList(checkedIds.value);
ElMessage.success($t('ui.actionMessage.deleteSuccess'));
onRefresh();
} finally {
loadingInstance.close();
}
}
const checkedIds = ref<number[]>([]);
function handleRowCheckboxChange({
records,
}: {
records: SystemUserApi.User[];
}) {
checkedIds.value = records.map((item) => item.id as number);
}
/** 重置密码 */ /** 重置密码 */
function onResetPassword(row: SystemUserApi.User) { function onResetPassword(row: SystemUserApi.User) {
resetPasswordModalApi.setData(row).open(); resetPasswordModalApi.setData(row).open();
@ -161,6 +184,10 @@ const [Grid, gridApi] = useVbenVxeGrid({
search: true, search: true,
}, },
} as VxeTableGridOptions<SystemUserApi.User>, } as VxeTableGridOptions<SystemUserApi.User>,
gridEvents: {
checkboxAll: handleRowCheckboxChange,
checkboxChange: handleRowCheckboxChange,
},
}); });
</script> </script>
@ -212,6 +239,14 @@ const [Grid, gridApi] = useVbenVxeGrid({
auth: ['system:user:import'], auth: ['system:user:import'],
onClick: onImport, onClick: onImport,
}, },
{
label: $t('ui.actionTitle.deleteBatch'),
type: 'danger',
icon: ACTION_ICON.DELETE,
disabled: isEmpty(checkedIds),
auth: ['system:user:delete'],
onClick: onDeleteBatch,
},
]" ]"
/> />
</template> </template>