feat: update TableAction

This commit is contained in:
XIE7654
2025-10-10 20:41:12 +08:00
parent 112c0dd3bc
commit 969be9904c
14 changed files with 442 additions and 85 deletions

View File

@@ -1,7 +1,8 @@
<script lang="ts" setup>
import type {
OnActionClickParams,
VxeTableGridOptions,
import {
ACTION_ICON,
type OnActionClickParams, TableAction,
type VxeTableGridOptions,
} from '#/adapter/vxe-table';
import type { SystemConfigApi } from '#/models/system/config';
@@ -127,14 +128,17 @@ function refreshGrid() {
<FormModal @success="refreshGrid" />
<Grid table-title="参数配置">
<template #toolbar-tools>
<Button
type="primary"
@click="onCreate"
v-permission="'system:config:create'"
>
<Plus class="size-5" />
{{ $t('ui.actionTitle.create') }}
</Button>
<TableAction
:actions="[
{
label: $t('ui.actionTitle.create', [$t('system.config.name')]),
type: 'primary',
icon: ACTION_ICON.ADD,
auth: ['system:config:create'],
onClick: onCreate,
},
]"
/>
</template>
</Grid>
</Page>

View File

@@ -1,7 +1,8 @@
<script lang="ts" setup>
import type {
OnActionClickParams,
VxeTableGridOptions,
import {
ACTION_ICON,
type OnActionClickParams, TableAction,
type VxeTableGridOptions,
} from '#/adapter/vxe-table';
import type { SystemDeptApi } from '#/api/system/dept';
@@ -139,20 +140,27 @@ function refreshGrid() {
<FormModal @success="refreshGrid" />
<Grid table-title="部门列表">
<template #toolbar-tools>
<Button class="mr-2" type="primary" @click="expandAll">
展开全部
</Button>
<Button class="mr-2" type="primary" @click="collapseAll">
折叠全部
</Button>
<Button
type="primary"
@click="onCreate"
v-permission="'system:dept:create'"
>
<Plus class="size-5" />
{{ $t('ui.actionTitle.create', [$t('system.dept.name')]) }}
</Button>
<TableAction
:actions="[
{
label: $t('ui.actionTitle.create', [$t('system.dept.name')]),
type: 'primary',
icon: ACTION_ICON.ADD,
auth: ['system:dept:create'],
onClick: onCreate,
},
{
label: '展开全部',
type: 'primary',
onClick: expandAll,
},
{
label: '折叠全部',
type: 'primary',
onClick: collapseAll,
},
]"
/>
</template>
</Grid>
</Page>

View File

@@ -1,7 +1,8 @@
<script lang="ts" setup>
import type {
OnActionClickParams,
VxeTableGridOptions,
import {
ACTION_ICON,
type OnActionClickParams, TableAction,
type VxeTableGridOptions,
} from '#/adapter/vxe-table';
import type { SystemDictDataApi } from '#/api/system/dict_data';
@@ -137,14 +138,17 @@ function refreshGrid() {
<FormModal @success="refreshGrid" />
<Grid table-title="字典数据">
<template #toolbar-tools>
<Button
type="primary"
@click="onCreate"
v-permission="'system:dict_data:create'"
>
<Plus class="size-5" />
{{ $t('ui.actionTitle.create', [$t('system.dict_data.name')]) }}
</Button>
<TableAction
:actions="[
{
label: $t('ui.actionTitle.create', [$t('system.dict_data.name')]),
type: 'primary',
icon: ACTION_ICON.ADD,
auth: ['system:dict_data:create'],
onClick: onCreate,
},
]"
/>
</template>
</Grid>
</Page>

View File

@@ -1,7 +1,8 @@
<script lang="ts" setup>
import type {
OnActionClickParams,
VxeTableGridOptions,
import {
ACTION_ICON,
type OnActionClickParams, TableAction,
type VxeTableGridOptions,
} from '#/adapter/vxe-table';
import type { SystemDictTypeApi } from '#/api/system/dict_type';
@@ -145,14 +146,17 @@ function refreshGrid() {
<FormModal @success="refreshGrid" />
<Grid table-title="字典列表">
<template #toolbar-tools>
<Button
type="primary"
@click="onCreate"
v-permission="'system:dict_type:create'"
>
<Plus class="size-5" />
{{ $t('ui.actionTitle.create', [$t('system.dict_type.name')]) }}
</Button>
<TableAction
:actions="[
{
label: $t('ui.actionTitle.create', [$t('system.dict_type.name')]),
type: 'primary',
icon: ACTION_ICON.ADD,
auth: ['system:dict_type:create'],
onClick: onCreate,
},
]"
/>
</template>
</Grid>
</Page>

View File

@@ -118,7 +118,7 @@ function onDelete(row: SystemMenuApi.SystemMenu) {
<template>
<Page auto-content-height>
<FormDrawer @success="onRefresh" />
<Grid>
<Grid table-title="菜单列表">
<template #toolbar-tools>
<Button class="mr-2" type="primary" @click="expandAll">
展开全部

View File

@@ -1,7 +1,8 @@
<script lang="ts" setup>
import type {
OnActionClickParams,
VxeTableGridOptions,
import {
ACTION_ICON,
type OnActionClickParams, TableAction,
type VxeTableGridOptions,
} from '#/adapter/vxe-table';
import type { SystemPostApi } from '#/models/system/post';
@@ -127,14 +128,17 @@ function refreshGrid() {
<FormModal @success="refreshGrid" />
<Grid table-title="岗位信息表">
<template #toolbar-tools>
<Button
type="primary"
@click="onCreate"
v-permission="'system:post:create'"
>
<Plus class="size-5" />
{{ $t('ui.actionTitle.create', [$t('system.post.name')]) }}
</Button>
<TableAction
:actions="[
{
label: $t('ui.actionTitle.create', [$t('system.post.name')]),
type: 'primary',
icon: ACTION_ICON.ADD,
auth: ['system:post:create'],
onClick: onCreate,
},
]"
/>
</template>
</Grid>
</Page>

View File

@@ -8,11 +8,10 @@ import type {
import type { SystemRoleApi } from '#/api/system/role';
import { Page, useVbenDrawer } from '@vben/common-ui';
import { Plus } from '@vben/icons';
import { Button, message, Modal } from 'ant-design-vue';
import { message, Modal } from 'ant-design-vue';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { deleteRole, getRoleList, patchRole } from '#/api/system/role';
import { $t } from '#/locales';
@@ -156,14 +155,17 @@ function onCreate() {
<FormDrawer @success="onRefresh" />
<Grid :table-title="$t('system.role.list')">
<template #toolbar-tools>
<Button
type="primary"
@click="onCreate"
v-permission="'system:role:create'"
>
<Plus class="size-5" />
{{ $t('ui.actionTitle.create', [$t('system.role.name')]) }}
</Button>
<TableAction
:actions="[
{
label: $t('ui.actionTitle.create', [$t('system.role.name')]),
type: 'primary',
icon: ACTION_ICON.ADD,
auth: ['system:role:create'],
onClick: onCreate,
},
]"
/>
</template>
</Grid>
</Page>

View File

@@ -1,7 +1,8 @@
<script lang="ts" setup>
import type {
OnActionClickParams,
VxeTableGridOptions,
import {
ACTION_ICON,
type OnActionClickParams, TableAction,
type VxeTableGridOptions,
} from '#/adapter/vxe-table';
import type { SystemUserApi } from '#/models/system/user';
@@ -128,14 +129,17 @@ function refreshGrid() {
<FormModal @success="refreshGrid" />
<Grid table-title="用户数据">
<template #toolbar-tools>
<Button
type="primary"
@click="onCreate"
v-permission="'system:user:create'"
>
<Plus class="size-5" />
{{ $t('ui.actionTitle.create', [$t('system.user.name')]) }}
</Button>
<TableAction
:actions="[
{
label: $t('ui.actionTitle.create', [$t('system.user.name')]),
type: 'primary',
icon: ACTION_ICON.ADD,
auth: ['system:user:create'],
onClick: onCreate,
},
]"
/>
</template>
</Grid>
</Page>