feat: use TableAction
parent
0a9b2ba383
commit
b125299c38
|
@ -3,9 +3,8 @@ import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||||
import type { SystemTenantPackageApi } from '#/api/system/tenant-package';
|
import type { SystemTenantPackageApi } from '#/api/system/tenant-package';
|
||||||
|
|
||||||
import { Page, useVbenModal } from '@vben/common-ui';
|
import { Page, useVbenModal } from '@vben/common-ui';
|
||||||
import { Plus } from '@vben/icons';
|
|
||||||
|
|
||||||
import { Button, message } from 'ant-design-vue';
|
import { message } from 'ant-design-vue';
|
||||||
|
|
||||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||||
import {
|
import {
|
||||||
|
@ -13,7 +12,7 @@ import {
|
||||||
getTenantPackagePage,
|
getTenantPackagePage,
|
||||||
} from '#/api/system/tenant-package';
|
} from '#/api/system/tenant-package';
|
||||||
import { DocAlert } from '#/components/doc-alert';
|
import { DocAlert } from '#/components/doc-alert';
|
||||||
import { ACTION_KEY, TableAction } from '#/components/table-action';
|
import { ACTION_ICON, TableAction } from '#/components/table-action';
|
||||||
import { $t } from '#/locales';
|
import { $t } from '#/locales';
|
||||||
|
|
||||||
import { useGridColumns, useGridFormSchema } from './data';
|
import { useGridColumns, useGridFormSchema } from './data';
|
||||||
|
@ -43,12 +42,12 @@ function onEdit(row: SystemTenantPackageApi.TenantPackage) {
|
||||||
async function onDelete(row: SystemTenantPackageApi.TenantPackage) {
|
async function onDelete(row: SystemTenantPackageApi.TenantPackage) {
|
||||||
message.loading({
|
message.loading({
|
||||||
content: $t('ui.actionMessage.deleting', [row.name]),
|
content: $t('ui.actionMessage.deleting', [row.name]),
|
||||||
key: ACTION_KEY,
|
key: 'action_key_msg',
|
||||||
});
|
});
|
||||||
await deleteTenantPackage(row.id as number);
|
await deleteTenantPackage(row.id as number);
|
||||||
message.success({
|
message.success({
|
||||||
content: $t('ui.actionMessage.deleteSuccess', [row.name]),
|
content: $t('ui.actionMessage.deleteSuccess', [row.name]),
|
||||||
key: ACTION_KEY,
|
key: 'action_key_msg',
|
||||||
});
|
});
|
||||||
onRefresh();
|
onRefresh();
|
||||||
}
|
}
|
||||||
|
@ -93,14 +92,17 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
<FormModal @success="onRefresh" />
|
<FormModal @success="onRefresh" />
|
||||||
<Grid table-title="租户套餐列表">
|
<Grid table-title="租户套餐列表">
|
||||||
<template #toolbar-tools>
|
<template #toolbar-tools>
|
||||||
<Button
|
<TableAction
|
||||||
type="primary"
|
:actions="[
|
||||||
@click="onCreate"
|
{
|
||||||
v-access:code="['system:tenant-package:create']"
|
label: $t('ui.actionTitle.create', ['套餐']),
|
||||||
>
|
type: 'primary',
|
||||||
<Plus class="size-5" />
|
icon: ACTION_ICON.ADD,
|
||||||
{{ $t('ui.actionTitle.create', ['套餐']) }}
|
auth: ['system:tenant-package:create'],
|
||||||
</Button>
|
onClick: onCreate,
|
||||||
|
},
|
||||||
|
]"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
<template #actions="{ row }">
|
<template #actions="{ row }">
|
||||||
<TableAction
|
<TableAction
|
||||||
|
@ -108,7 +110,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
{
|
{
|
||||||
label: $t('common.edit'),
|
label: $t('common.edit'),
|
||||||
type: 'link',
|
type: 'link',
|
||||||
icon: 'ant-design:edit-outlined',
|
icon: ACTION_ICON.EDIT,
|
||||||
auth: ['system:role:update'],
|
auth: ['system:role:update'],
|
||||||
onClick: onEdit.bind(null, row),
|
onClick: onEdit.bind(null, row),
|
||||||
},
|
},
|
||||||
|
@ -116,7 +118,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
label: $t('common.delete'),
|
label: $t('common.delete'),
|
||||||
type: 'link',
|
type: 'link',
|
||||||
danger: true,
|
danger: true,
|
||||||
icon: 'ant-design:delete-outlined',
|
icon: ACTION_ICON.DELETE,
|
||||||
auth: ['system:role:delete'],
|
auth: ['system:role:delete'],
|
||||||
popConfirm: {
|
popConfirm: {
|
||||||
title: $t('ui.actionMessage.deleteConfirm', [row.name]),
|
title: $t('ui.actionMessage.deleteConfirm', [row.name]),
|
||||||
|
|
Loading…
Reference in New Issue