| | |
| | | |
| | | import { computed, unref, watch } from 'vue'; |
| | | |
| | | import { useAccess } from '../../packages/effects/access/src'; |
| | | import { IconifyIcon } from '../../packages/icons/src'; |
| | | import { $t } from '../../packages/locales/src'; |
| | | import { isBoolean, isFunction } from '../../packages/utils/src'; |
| | | import { useAccess } from '@vben/access'; |
| | | import { IconifyIcon } from '@vben/icons'; |
| | | import { $t } from '@vben/locales'; |
| | | import { isBoolean, isFunction } from '@vben/utils'; |
| | | |
| | | import { |
| | | Button, |
| | |
| | | Space, |
| | | Tooltip, |
| | | } from 'ant-design-vue'; |
| | | |
| | | import { automaticApproval } from '#/store/audit-policy'; |
| | | import { auditActionMode } from '#/utils/audit-ui-policy'; |
| | | |
| | | const props = defineProps({ |
| | | actions: { |
| | |
| | | |
| | | /** 检查是否显示 */ |
| | | function isIfShow(action: ActionItem): boolean { |
| | | if (auditActionMode(action.label, automaticApproval.value) === 'hidden') return false; |
| | | const ifShow = action.ifShow; |
| | | let isIfShow = true; |
| | | if (isBoolean(ifShow)) { |
| | |
| | | /** 处理按钮 actions */ |
| | | const getActions = computed(() => { |
| | | const actions = props.actions || []; |
| | | return actions.filter((action: ActionItem) => isIfShow(action)); |
| | | return actions.filter((action: ActionItem) => isIfShow(action)).map(displayAction); |
| | | }); |
| | | |
| | | /** 处理下拉菜单 actions */ |
| | | const getDropdownList = computed(() => { |
| | | const dropDownActions = props.dropDownActions || []; |
| | | return dropDownActions.filter((action: ActionItem) => isIfShow(action)); |
| | | return dropDownActions.filter((action: ActionItem) => isIfShow(action)).map(displayAction); |
| | | }); |
| | | |
| | | function displayAction(action: ActionItem): ActionItem { |
| | | return auditActionMode(action.label, automaticApproval.value) === 'activate' |
| | | ? { ...action, label: '生效', tooltip: '提交后自动生效' } |
| | | : action; |
| | | } |
| | | |
| | | /** Space 组件的 size */ |
| | | const spaceSize = computed(() => { |
| | |
| | | if (popConfirm.cancel && isFunction(popConfirm.cancel)) { |
| | | attrs.onCancel = popConfirm.cancel; |
| | | } |
| | | |
| | | // 不设置 getPopupContainer,让它默认挂载到 body,避免被遮挡 |
| | | |
| | | return attrs; |
| | | } |
| | |
| | | } |
| | | |
| | | .ant-popconfirm { |
| | | width: 210px; |
| | | |
| | | //.ant-popconfirm-message { |
| | | // white-space: nowrap; |
| | | //} |
| | | |
| | | .ant-popconfirm-buttons { |
| | | .ant-btn { |
| | | margin-inline-start: 4px !important; |