diff --git a/apps/web-antd/src/components/action-buttons/action-buttons.vue b/apps/web-antd/src/components/action-buttons/action-buttons.vue index e9063692..04ae1b93 100644 --- a/apps/web-antd/src/components/action-buttons/action-buttons.vue +++ b/apps/web-antd/src/components/action-buttons/action-buttons.vue @@ -1,74 +1,215 @@ + - diff --git a/apps/web-antd/src/components/action-buttons/types.d.ts b/apps/web-antd/src/components/action-buttons/types.d.ts index ad901758..1cdde01b 100644 --- a/apps/web-antd/src/components/action-buttons/types.d.ts +++ b/apps/web-antd/src/components/action-buttons/types.d.ts @@ -1,11 +1,27 @@ -import type { ButtonProps, TooltipProps } from 'ant-design-vue'; +import { ButtonProps } from 'ant-design-vue/es/button/buttonTypes'; +import { TooltipProps } from 'ant-design-vue/es/tooltip/Tooltip'; -export interface ActionItem extends ButtonProps { - color?: 'error' | 'success' | 'warning'; - preIcon?: string; - postIcon?: string; - label: string; - auth?: string | string[]; - tooltip?: string | TooltipProps; - ifShow?: ((...args: any[]) => boolean) | boolean; +export interface PopConfirm { + title: string; + okText?: string; + cancelText?: string; + confirm: (...args: any[]) => void; + cancel?: (...args: any[]) => void; + icon?: string; +} +export interface ActionItem extends ButtonProps { + onClick?: (...args: any[]) => void; + class?: string; + // 16进制颜色 + color?: string; + label?: string; + icon?: string; + popConfirm?: PopConfirm; + disabled?: boolean; + divider?: boolean; + // 权限编码控制是否显示 + auth?: string[]; + // 业务控制是否显示 + ifShow?: ((action: ActionItem) => boolean) | boolean; + tooltip?: string | TooltipProps; } diff --git a/apps/web-antd/src/views/system/post/index.vue b/apps/web-antd/src/views/system/post/index.vue index b892aacf..e0e29ab6 100644 --- a/apps/web-antd/src/views/system/post/index.vue +++ b/apps/web-antd/src/views/system/post/index.vue @@ -81,16 +81,26 @@ async function handleExport() { { type: 'primary', label: $t('page.action.add'), - preIcon: IconEnum.ADD, + icon: IconEnum.ADD, auth: ['system:post:create'], onClick: handleCreate.bind(null), }, { label: $t('page.action.export'), - preIcon: IconEnum.EXPORT, + class: + 'bg-green-500 text-white border-green-400 hover:bg-green-400 hover:!text-white hover:!border-green-400 active:!bg-green-600 active:!text-white active:!border-green-600', + icon: IconEnum.EXPORT, auth: ['system:post:export'], onClick: handleExport.bind(null), }, + { + label: $t('page.action.delete'), + icon: IconEnum.DELETE, + class: + 'bg-red-500 text-white border-red-400 hover:bg-red-400 hover:!text-white hover:!border-red-400 active:!bg-red-600 active:!text-white active:!border-red-600', + auth: ['system:post:delete'], + onClick: handleDelete.bind(null, 1), + }, ]" /> @@ -100,7 +110,7 @@ async function handleExport() { { type: 'link', label: $t('page.action.edit'), - preIcon: IconEnum.EDIT, + icon: IconEnum.EDIT, auth: ['system:post:update'], onClick: handleEdit.bind(null, row.id), }, @@ -108,11 +118,17 @@ async function handleExport() { type: 'link', danger: true, label: $t('page.action.delete'), - preIcon: IconEnum.DELETE, + icon: IconEnum.DELETE, auth: ['system:post:delete'], onClick: handleDelete.bind(null, row.id), }, ]" + :drop-down-actions="[ + { + type: 'link', + label: $t('page.action.edit'), + }, + ]" />