| | |
| | | Tooltip, |
| | | } from 'ant-design-vue'; |
| | | |
| | | import { automaticApproval } from '#/store/audit-policy'; |
| | | import { auditActionMode } from '#/utils/audit-ui-policy'; |
| | | |
| | | const props = defineProps({ |
| | | actions: { |
| | | type: Array as PropType<ActionItem[]>, |
| | |
| | | |
| | | /** 检查是否显示 */ |
| | | 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(() => { |
| | | const actions = unref(getActions); |