refactor(components): 重命名 GhostButton 为 ActionButton 以更准确描述用途

This commit is contained in:
dap
2026-01-20 12:00:59 +08:00
parent c1b886e77f
commit f0253f6971
26 changed files with 100 additions and 100 deletions

View File

@@ -6,8 +6,8 @@ import { omit } from 'lodash-es';
/**
* 表格操作列按钮专用
*/
export const GhostButton = defineComponent({
name: 'GhostButton',
export const ActionButton = defineComponent({
name: 'ActionButton',
props: omit({}, ['type', 'ghost', 'size']),
setup(props, { attrs, slots }) {
return () =>

View File

@@ -2,7 +2,7 @@ import type { App } from 'vue';
import { Button as AButton } from 'antdv-next';
import { GhostButton } from './button';
import { ActionButton } from './button';
/**
* 全局组件注册
@@ -10,7 +10,7 @@ import { GhostButton } from './button';
export function setupGlobalComponent(app: App) {
app.component('AButton', AButton);
// 表格操作列专用按钮
app.component('GhostButton', GhostButton);
app.component('ActionButton', ActionButton);
}
export { default as ApiSwitch } from './api-switch.vue';

View File

@@ -137,25 +137,25 @@ function handleMultiDelete() {
</template>
<template #action="{ row }">
<Space>
<ghost-button
<action-button
v-access:code="['system:demo:edit']"
@click.stop="handleEdit(row)"
>
{{ $t('pages.common.edit') }}
</ghost-button>
</action-button>
<Popconfirm
:get-popup-container="getPopupContainer"
placement="left"
title="确认删除?"
@confirm="handleDelete(row)"
>
<ghost-button
<action-button
danger
v-access:code="['system:demo:remove']"
@click.stop=""
>
{{ $t('pages.common.delete') }}
</ghost-button>
</action-button>
</Popconfirm>
</Space>
</template>

View File

@@ -118,25 +118,25 @@ function collapseAll() {
</template>
<template #action="{ row }">
<Space>
<ghost-button
<action-button
v-access:code="['system:tree:edit']"
@click.stop="handleEdit(row)"
>
{{ $t('pages.common.edit') }}
</ghost-button>
</action-button>
<Popconfirm
:get-popup-container="getPopupContainer"
placement="left"
title="确认删除?"
@confirm="handleDelete(row)"
>
<ghost-button
<action-button
danger
v-access:code="['system:tree:remove']"
@click.stop=""
>
{{ $t('pages.common.delete') }}
</ghost-button>
</action-button>
</Popconfirm>
</Space>
</template>

View File

@@ -184,21 +184,21 @@ function handleDownloadExcel() {
</template>
<template #action="{ row }">
<Space>
<ghost-button @click.stop="handlePreview(row)">
<action-button @click.stop="handlePreview(row)">
{{ $t('pages.common.info') }}
</ghost-button>
</action-button>
<Popconfirm
placement="left"
title="确认删除?"
@confirm="() => handleDelete(row)"
>
<ghost-button
<action-button
danger
v-access:code="['monitor:logininfor:remove']"
@click.stop=""
>
{{ $t('pages.common.delete') }}
</ghost-button>
</action-button>
</Popconfirm>
</Space>
</template>

View File

@@ -92,7 +92,7 @@ async function handleForceOffline(row: OnlineUser) {
placement="left"
@confirm="handleForceOffline(row)"
>
<ghost-button danger>强制下线</ghost-button>
<action-button danger>强制下线</action-button>
</Popconfirm>
</template>
</BasicTable>

View File

@@ -171,12 +171,12 @@ function handleDownloadExcel() {
</Space>
</template>
<template #action="{ row }">
<ghost-button
<action-button
v-access:code="['monitor:operlog:list']"
@click.stop="handlePreview(row)"
>
{{ $t('pages.common.preview') }}
</ghost-button>
</action-button>
</template>
</BasicTable>
<OperationPreviewDrawer />

View File

@@ -161,26 +161,26 @@ async function handleChangeStatus(checked: boolean, row: Client) {
</template>
<template #action="{ row }">
<Space>
<ghost-button
<action-button
v-access:code="['system:client:edit']"
@click.stop="handleEdit(row)"
>
{{ $t('pages.common.edit') }}
</ghost-button>
</action-button>
<Popconfirm
:disabled="row.id === 1"
placement="left"
title="确认删除?"
@confirm="handleDelete(row)"
>
<ghost-button
<action-button
:disabled="row.id === 1"
danger
v-access:code="['system:client:remove']"
@click.stop=""
>
{{ $t('pages.common.delete') }}
</ghost-button>
</action-button>
</Popconfirm>
</Space>
</template>

View File

@@ -148,24 +148,24 @@ async function handleRefreshCache() {
</template>
<template #action="{ row }">
<Space>
<ghost-button
<action-button
v-access:code="['system:config:edit']"
@click.stop="handleEdit(row)"
>
{{ $t('pages.common.edit') }}
</ghost-button>
</action-button>
<Popconfirm
placement="left"
title="确认删除?"
@confirm="handleDelete(row)"
>
<ghost-button
<action-button
danger
v-access:code="['system:config:remove']"
@click.stop=""
>
{{ $t('pages.common.delete') }}
</ghost-button>
</action-button>
</Popconfirm>
</Space>
</template>

View File

@@ -148,32 +148,32 @@ function setExpandOrCollapse(expand: boolean) {
</template>
<template #action="{ row }">
<Space>
<ghost-button
<action-button
v-access:code="['system:dept:edit']"
@click="handleEdit(row)"
>
{{ $t('pages.common.edit') }}
</ghost-button>
<ghost-button
</action-button>
<action-button
variant="link"
color="green"
v-access:code="['system:dept:add']"
@click="handleSubAdd(row)"
>
{{ $t('pages.common.add') }}
</ghost-button>
</action-button>
<Popconfirm
placement="left"
title="确认删除?"
@confirm="handleDelete(row)"
>
<ghost-button
<action-button
danger
v-access:code="['system:dept:remove']"
@click.stop=""
>
{{ $t('pages.common.delete') }}
</ghost-button>
</action-button>
</Popconfirm>
</Space>
</template>

View File

@@ -154,24 +154,24 @@ emitter.on('rowClick', async (value) => {
</template>
<template #action="{ row }">
<Space>
<ghost-button
<action-button
v-access:code="['system:dict:edit']"
@click="handleEdit(row)"
>
{{ $t('pages.common.edit') }}
</ghost-button>
</action-button>
<Popconfirm
placement="left"
title="确认删除?"
@confirm="handleDelete(row)"
>
<ghost-button
<action-button
danger
v-access:code="['system:dict:remove']"
@click.stop=""
>
{{ $t('pages.common.delete') }}
</ghost-button>
</action-button>
</Popconfirm>
</Space>
</template>

View File

@@ -167,24 +167,24 @@ function handleDownloadExcel() {
</template>
<template #action="{ row }">
<Space>
<ghost-button
<action-button
v-access:code="['system:dict:edit']"
@click.stop="handleEdit(row)"
>
{{ $t('pages.common.edit') }}
</ghost-button>
</action-button>
<Popconfirm
placement="left"
title="确认删除?"
@confirm="handleDelete(row)"
>
<ghost-button
<action-button
danger
v-access:code="['system:dict:remove']"
@click.stop=""
>
{{ $t('pages.common.delete') }}
</ghost-button>
</action-button>
</Popconfirm>
</Space>
</template>

View File

@@ -221,15 +221,15 @@ const isAdmin = computed(() => {
</template>
<template #action="{ row }">
<Space>
<ghost-button
<action-button
v-access:code="['system:menu:edit']"
v-access:role="['superadmin']"
@click="handleEdit(row)"
>
{{ $t('pages.common.edit') }}
</ghost-button>
</action-button>
<!-- '按钮类型'无法再添加子菜单 -->
<ghost-button
<action-button
v-if="row.menuType !== 'F'"
variant="link"
color="green"
@@ -238,20 +238,20 @@ const isAdmin = computed(() => {
@click="handleSubAdd(row)"
>
{{ $t('pages.common.add') }}
</ghost-button>
</action-button>
<Popconfirm
placement="left"
:title="removeConfirmTitle(row)"
@confirm="handleDelete(row)"
>
<ghost-button
<action-button
danger
v-access:code="['system:menu:remove']"
v-access:role="['superadmin']"
@click.stop=""
>
{{ $t('pages.common.delete') }}
</ghost-button>
</action-button>
</Popconfirm>
</Space>
</template>

View File

@@ -119,24 +119,24 @@ function handleMultiDelete() {
</template>
<template #action="{ row }">
<Space>
<ghost-button
<action-button
v-access:code="['system:notice:edit']"
@click="handleEdit(row)"
>
{{ $t('pages.common.edit') }}
</ghost-button>
</action-button>
<Popconfirm
placement="left"
title="确认删除?"
@confirm="handleDelete(row)"
>
<ghost-button
<action-button
danger
v-access:code="['system:notice:remove']"
@click.stop=""
>
{{ $t('pages.common.delete') }}
</ghost-button>
</action-button>
</Popconfirm>
</Space>
</template>

View File

@@ -145,24 +145,24 @@ async function handleChangeStatus(checked: boolean, row: OssConfig) {
</template>
<template #action="{ row }">
<Space>
<ghost-button
<action-button
v-access:code="['system:ossConfig:edit']"
@click="handleEdit(row)"
>
{{ $t('pages.common.edit') }}
</ghost-button>
</action-button>
<Popconfirm
placement="left"
title="确认删除?"
@confirm="handleDelete(row)"
>
<ghost-button
<action-button
danger
v-access:code="['system:ossConfig:remove']"
@click.stop=""
>
{{ $t('pages.common.delete') }}
</ghost-button>
</action-button>
</Popconfirm>
</Space>
</template>

View File

@@ -289,24 +289,24 @@ const [UploadTestModal, uploadTestApi] = useVbenModal({
</template>
<template #action="{ row }">
<Space>
<ghost-button
<action-button
v-access:code="['system:oss:download']"
@click="handleDownload(row)"
>
{{ $t('pages.common.download') }}
</ghost-button>
</action-button>
<Popconfirm
placement="left"
title="确认删除?"
@confirm="handleDelete(row)"
>
<ghost-button
<action-button
danger
v-access:code="['system:oss:remove']"
@click.stop=""
>
{{ $t('pages.common.delete') }}
</ghost-button>
</action-button>
</Popconfirm>
</Space>
</template>

View File

@@ -161,24 +161,24 @@ function handleDownloadExcel() {
</template>
<template #action="{ row }">
<Space>
<GhostButton
<action-button
v-access:code="['system:post:edit']"
@click="handleEdit(row)"
>
{{ $t('pages.common.edit') }}
</GhostButton>
</action-button>
<Popconfirm
placement="left"
title="确认删除?"
@confirm="handleDelete(row)"
>
<GhostButton
<action-button
danger
v-access:code="['system:post:remove']"
@click.stop=""
>
{{ $t('pages.common.delete') }}
</GhostButton>
</action-button>
</Popconfirm>
</Space>
</template>

View File

@@ -135,13 +135,13 @@ function handleMultipleAuthCancel() {
placement="left"
@confirm="handleAuthCancel(row)"
>
<ghost-button
<action-button
danger
v-access:code="['system:role:remove']"
@click.stop=""
>
取消授权
</ghost-button>
</action-button>
</Popconfirm>
</template>
</BasicTable>

View File

@@ -201,36 +201,36 @@ async function handleChangeStatus(checked: boolean, row: Role) {
"
>
<Space>
<ghost-button
<action-button
v-access:code="['system:role:edit']"
@click.stop="handleEdit(row)"
>
{{ $t('pages.common.edit') }}
</ghost-button>
<ghost-button
</action-button>
<action-button
v-access:code="['system:role:edit']"
@click.stop="handleAuthEdit(row)"
>
权限
</ghost-button>
<ghost-button
</action-button>
<action-button
v-access:code="['system:role:edit']"
@click.stop="handleAssignRole(row)"
>
分配
</ghost-button>
</action-button>
<Popconfirm
placement="left"
title="确认删除?"
@confirm="handleDelete(row)"
>
<ghost-button
<action-button
danger
v-access:code="['system:role:remove']"
@click.stop=""
>
{{ $t('pages.common.delete') }}
</ghost-button>
</action-button>
</Popconfirm>
</Space>
</template>

View File

@@ -217,37 +217,37 @@ async function handleChangeStatus(checked: boolean, row: Tenant) {
</template>
<template #action="{ row }">
<Space v-if="row.id !== 1">
<ghost-button
<action-button
v-access:code="['system:tenant:edit']"
@click="handleEdit(row)"
>
{{ $t('pages.common.edit') }}
</ghost-button>
</action-button>
<Popconfirm
:title="`确认同步[${row.companyName}]的套餐吗?`"
placement="left"
@confirm="handleSync(row)"
>
<ghost-button
<action-button
variant="link"
color="green"
v-access:code="['system:tenant:edit']"
>
{{ $t('pages.common.sync') }}
</ghost-button>
</action-button>
</Popconfirm>
<Popconfirm
placement="left"
title="确认删除?"
@confirm="handleDelete(row)"
>
<ghost-button
<action-button
danger
v-access:code="['system:tenant:remove']"
@click.stop=""
>
{{ $t('pages.common.delete') }}
</ghost-button>
</action-button>
</Popconfirm>
</Space>
</template>

View File

@@ -169,24 +169,24 @@ async function handleChangeStatus(checked: boolean, row: TenantPackage) {
</template>
<template #action="{ row }">
<Space>
<ghost-button
<action-button
v-access:code="['system:tenantPackage:edit']"
@click="handleEdit(row)"
>
{{ $t('pages.common.edit') }}
</ghost-button>
</action-button>
<Popconfirm
placement="left"
title="确认删除?"
@confirm="handleDelete(row)"
>
<ghost-button
<action-button
danger
v-access:code="['system:tenantPackage:remove']"
@click.stop=""
>
{{ $t('pages.common.delete') }}
</ghost-button>
</action-button>
</Popconfirm>
</Space>
</template>

View File

@@ -271,24 +271,24 @@ async function handleChangeStatus(checked: boolean, row: User) {
<template #action="{ row }">
<template v-if="row.userId !== SUPERADMIN_USER_ID">
<Space>
<ghost-button
<action-button
v-access:code="['system:user:edit']"
@click.stop="handleEdit(row)"
>
{{ $t('pages.common.edit') }}
</ghost-button>
</action-button>
<Popconfirm
placement="left"
title="确认删除?"
@confirm="handleDelete(row)"
>
<ghost-button
<action-button
danger
v-access:code="['system:user:remove']"
@click.stop=""
>
{{ $t('pages.common.delete') }}
</ghost-button>
</action-button>
</Popconfirm>
</Space>
<Dropdown

View File

@@ -120,32 +120,32 @@ function collapseAll() {
</template>
<template #action="{ row }">
<Space>
<ghost-button
<action-button
v-access:code="['workflow:category:edit']"
@click.stop="handleEdit(row)"
>
{{ $t('pages.common.edit') }}
</ghost-button>
<ghost-button
</action-button>
<action-button
variant="link"
color="green"
v-access:code="['workflow:category:edit']"
@click.stop="handleAdd(row)"
>
{{ $t('pages.common.add') }}
</ghost-button>
</action-button>
<Popconfirm
placement="left"
title="确认删除?"
@confirm="handleDelete(row)"
>
<ghost-button
<action-button
danger
v-access:code="['workflow:category:remove']"
@click.stop=""
>
{{ $t('pages.common.delete') }}
</ghost-button>
</action-button>
</Popconfirm>
</Space>
</template>

View File

@@ -117,24 +117,24 @@ function handleMultiDelete() {
</template>
<template #action="{ row }">
<Space>
<ghost-button
<action-button
v-access:code="['system:config:edit']"
@click.stop="handleEdit(row)"
>
{{ $t('pages.common.edit') }}
</ghost-button>
</action-button>
<Popconfirm
placement="left"
title="确认删除?"
@confirm="handleDelete(row)"
>
<ghost-button
<action-button
danger
v-access:code="['system:config:remove']"
@click.stop=""
>
{{ $t('pages.common.delete') }}
</ghost-button>
</action-button>
</Popconfirm>
</Space>
</template>

View File

@@ -93,9 +93,9 @@ function handleSendSingle(userId: string) {
</Space>
</template>
<template #action="{ row }">
<ghost-button @click="handleSendSingle(row.userId)">
<action-button @click="handleSendSingle(row.userId)">
发送消息
</ghost-button>
</action-button>
</template>
</BasicTable>
<SendMsgModal />

View File

@@ -5,7 +5,7 @@ import { Button } from 'antdv-next/dist/button/Button';
declare module 'vue' {
export interface GlobalComponents {
AButton: typeof Button;
GhostButton: typeof Button;
ActionButton: typeof Button;
}
}