From ab882e085b5cb3ca5b15cc482eec194166ab7b37 Mon Sep 17 00:00:00 2001 From: caozehui <2427765068@qq.com> Date: Fri, 22 May 2026 10:46:46 +0800 Subject: [PATCH] =?UTF-8?q?feat(personal-center):=20=E9=87=8D=E6=9E=84?= =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E4=BA=8B=E9=A1=B9=E8=AF=A6=E6=83=85=E5=B9=B6?= =?UTF-8?q?=E5=A4=8D=E7=94=A8=E4=BB=BB=E5=8A=A1=E5=B7=A5=E4=BD=9C=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../custom/business-table-action-cell.tsx | 134 +++- src/components/custom/dict-select.vue | 19 +- src/constants/dict.ts | 8 +- src/store/modules/dict/index.ts | 61 +- src/styles/scss/element-plus.scss | 27 + src/typings/api/project.d.ts | 4 +- src/views/infra/state-machine/index.vue | 8 +- src/views/personal-center/my-item/index.vue | 40 +- .../modules/personal-item-detail-dialog.vue | 228 +++++- .../personal-item-worklog-form-dialog.vue | 409 ---------- .../modules/personal-item-worklog-panel.vue | 708 ------------------ .../modules/task-worklog-form-dialog.vue | 7 +- .../execution/modules/task-worklog-panel.vue | 101 ++- 13 files changed, 547 insertions(+), 1207 deletions(-) delete mode 100644 src/views/personal-center/my-item/modules/personal-item-worklog-form-dialog.vue delete mode 100644 src/views/personal-center/my-item/modules/personal-item-worklog-panel.vue diff --git a/src/components/custom/business-table-action-cell.tsx b/src/components/custom/business-table-action-cell.tsx index 7fadb6d..fab7b36 100644 --- a/src/components/custom/business-table-action-cell.tsx +++ b/src/components/custom/business-table-action-cell.tsx @@ -1,12 +1,13 @@ -import { computed, defineComponent, ref } from 'vue'; -import type { PropType } from 'vue'; -import { ElButton, ElPopover } from 'element-plus'; +import { computed, defineComponent, h, ref } from 'vue'; +import type { Component, PropType } from 'vue'; +import { ElButton, ElPopover, ElTooltip } from 'element-plus'; import { $t } from '@/locales'; export type BusinessTableAction = { key: string; label: string; buttonType?: 'primary' | 'success' | 'warning' | 'danger' | 'info'; + icon?: Component; disabled?: boolean; onClick: () => void | Promise; }; @@ -17,12 +18,20 @@ export default defineComponent({ actions: { type: Array as PropType, required: true + }, + variant: { + type: String as PropType<'button' | 'icon'>, + default: 'button' } }, setup(props) { const popoverVisible = ref(false); const directActions = computed(() => { + if (props.variant === 'icon') { + return props.actions; + } + if (props.actions.length <= 2) { return props.actions; } @@ -31,6 +40,10 @@ export default defineComponent({ }); const moreActions = computed(() => { + if (props.variant === 'icon') { + return []; + } + if (props.actions.length <= 2) { return []; } @@ -47,21 +60,86 @@ export default defineComponent({ await action.onClick(); } - return () => ( -
event.stopPropagation()}> - {directActions.value.map(action => ( + function renderIcon(action: BusinessTableAction) { + if (!action.icon) return null; + + return h(action.icon, { class: 'business-table-action-icon' }); + } + + function renderButtonAction(action: BusinessTableAction) { + return ( + handleAction(action)} + > + {action.label} + + ); + } + + function renderIconAction(action: BusinessTableAction) { + return ( + handleAction(action)} > - {action.label} + {renderIcon(action)} - ))} + + ); + } + + function renderMenuButton(action: BusinessTableAction) { + if (props.variant === 'icon') { + return ( + handleAction(action)} + > + + {renderIcon(action)} + {action.label} + + + ); + } + + return ( + handleAction(action)} + > + {action.label} + + ); + } + + return () => ( +
event.stopPropagation()}> + {directActions.value.map(action => + props.variant === 'icon' ? renderIconAction(action) : renderButtonAction(action) + )} {moreActions.value.length > 0 && ( ( event.stopPropagation()} > - - {$t('common.more')} - - + {props.variant === 'icon' ? ( + + ) : ( + + {$t('common.more')} + + + )} ), default: () => (
- {moreActions.value.map(action => ( - handleAction(action)} - > - {action.label} - - ))} + {moreActions.value.map(action => renderMenuButton(action))}
) }} diff --git a/src/components/custom/dict-select.vue b/src/components/custom/dict-select.vue index 7892093..68f8b92 100644 --- a/src/components/custom/dict-select.vue +++ b/src/components/custom/dict-select.vue @@ -1,9 +1,12 @@