云
2 天以前 a241b66efcc41e973290a6722fb7a4d79b833ea1
src/components/table-action/table-action.vue
@@ -6,10 +6,10 @@
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,
@@ -19,6 +19,9 @@
  Space,
  Tooltip,
} from 'ant-design-vue';
import { automaticApproval } from '#/store/audit-policy';
import { auditActionMode } from '#/utils/audit-ui-policy';
const props = defineProps({
  actions: {
@@ -43,6 +46,7 @@
/** 检查是否显示 */
function isIfShow(action: ActionItem): boolean {
  if (auditActionMode(action.label, automaticApproval.value) === 'hidden') return false;
  const ifShow = action.ifShow;
  let isIfShow = true;
  if (isBoolean(ifShow)) {
@@ -61,14 +65,20 @@
/** 处理按钮 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(() => {
@@ -96,6 +106,8 @@
  if (popConfirm.cancel && isFunction(popConfirm.cancel)) {
    attrs.onCancel = popConfirm.cancel;
  }
  // 不设置 getPopupContainer,让它默认挂载到 body,避免被遮挡
  return attrs;
}
@@ -269,6 +281,12 @@
}
.ant-popconfirm {
  width: 210px;
  //.ant-popconfirm-message {
  //  white-space: nowrap;
  //}
  .ant-popconfirm-buttons {
    .ant-btn {
      margin-inline-start: 4px !important;