diff --git a/web/apps/web-antd/src/adapter/vxe-table.ts b/web/apps/web-antd/src/adapter/vxe-table.ts index 71a0ecb..f1706d3 100644 --- a/web/apps/web-antd/src/adapter/vxe-table.ts +++ b/web/apps/web-antd/src/adapter/vxe-table.ts @@ -285,4 +285,5 @@ export type OnActionClickParams> = { export type OnActionClickFn> = ( params: OnActionClickParams, ) => void; +export * from '#/components/table-action'; export type * from '@vben/plugins/vxe-table'; diff --git a/web/apps/web-antd/src/components/table-action/icons.ts b/web/apps/web-antd/src/components/table-action/icons.ts new file mode 100644 index 0000000..88cda59 --- /dev/null +++ b/web/apps/web-antd/src/components/table-action/icons.ts @@ -0,0 +1,13 @@ +export const ACTION_ICON = { + DOWNLOAD: 'lucide:download', + UPLOAD: 'lucide:upload', + ADD: 'lucide:plus', + EDIT: 'lucide:edit', + DELETE: 'lucide:trash-2', + REFRESH: 'lucide:refresh-cw', + SEARCH: 'lucide:search', + FILTER: 'lucide:filter', + MORE: 'lucide:ellipsis-vertical', + VIEW: 'lucide:eye', + COPY: 'lucide:copy', +}; diff --git a/web/apps/web-antd/src/components/table-action/index.ts b/web/apps/web-antd/src/components/table-action/index.ts new file mode 100644 index 0000000..672c0a5 --- /dev/null +++ b/web/apps/web-antd/src/components/table-action/index.ts @@ -0,0 +1,4 @@ +export * from './icons'; + +export { default as TableAction } from './table-action.vue'; +export * from './typing'; diff --git a/web/apps/web-antd/src/components/table-action/table-action.vue b/web/apps/web-antd/src/components/table-action/table-action.vue new file mode 100644 index 0000000..3c29d7d --- /dev/null +++ b/web/apps/web-antd/src/components/table-action/table-action.vue @@ -0,0 +1,278 @@ + + + + + + diff --git a/web/apps/web-antd/src/components/table-action/typing.ts b/web/apps/web-antd/src/components/table-action/typing.ts new file mode 100644 index 0000000..1e44fb2 --- /dev/null +++ b/web/apps/web-antd/src/components/table-action/typing.ts @@ -0,0 +1,31 @@ +import type { + ButtonProps, + ButtonType, +} from 'ant-design-vue/es/button/buttonTypes'; +import type { TooltipProps } from 'ant-design-vue/es/tooltip/Tooltip'; + +export interface PopConfirm { + title: string; + okText?: string; + cancelText?: string; + confirm: () => void; + cancel?: () => void; + icon?: string; + disabled?: boolean; +} + +export interface ActionItem extends ButtonProps { + onClick?: () => void; + type?: ButtonType; + label?: string; + color?: 'error' | 'success' | 'warning'; + icon?: string; + popConfirm?: PopConfirm; + disabled?: boolean; + divider?: boolean; + // 权限编码控制是否显示 + auth?: string[]; + // 业务控制是否显示 + ifShow?: ((action: ActionItem) => boolean) | boolean; + tooltip?: string | TooltipProps; +} diff --git a/web/apps/web-antd/src/store/auth.ts b/web/apps/web-antd/src/store/auth.ts index 2aaa918..e55f0d8 100644 --- a/web/apps/web-antd/src/store/auth.ts +++ b/web/apps/web-antd/src/store/auth.ts @@ -49,7 +49,6 @@ export const useAuthStore = defineStore('auth', () => { ]); userInfo = fetchUserInfoResult; - userStore.setUserInfo(userInfo); accessStore.setAccessCodes(accessCodes); @@ -107,6 +106,7 @@ export const useAuthStore = defineStore('auth', () => { // 设置权限 if (userInfo && Array.isArray(userInfo.permissions)) { permissionStore.setPermissions(userInfo.permissions); + accessStore.setAccessCodes(userInfo.permissions); } return userInfo; diff --git a/web/apps/web-antd/src/views/system/config/list.vue b/web/apps/web-antd/src/views/system/config/list.vue index c20e8d2..f56de6a 100644 --- a/web/apps/web-antd/src/views/system/config/list.vue +++ b/web/apps/web-antd/src/views/system/config/list.vue @@ -1,7 +1,8 @@