@yugu-ui/flow-ui 0.1.26 → 0.1.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -217,6 +217,8 @@ export interface WflowTodoDetail {
217
217
  nodes?: WflowTodoNode[];
218
218
  /** 当前用户能否处理 */
219
219
  can_handle?: boolean;
220
+ /** 当前用户能否撤回(false 无撤回权限) */
221
+ can_recall?: boolean;
220
222
  /** 当前用户是否发起人 */
221
223
  is_initor?: boolean;
222
224
  /** 当前用户在本实例当前任务上的待办审批记录 ID(同意/驳回接口入参,非处理人时为 null) */
package/dist/index.js CHANGED
@@ -6523,8 +6523,20 @@ var FlowActions_default = /* @__PURE__ */ defineComponent({
6523
6523
  const props = __props;
6524
6524
  /** 审批处理成功(同意/驳回接口调用成功) */
6525
6525
  const emit = __emit;
6526
- /** 是否展示操作按钮:审批模式且 undo_finished=0(未处理)才展示 */
6527
- const visible = computed(() => props.approval !== false && props.data?.undo_finished === 0);
6526
+ /** 是否展示同意/驳回:审批模式 + 可处理(can_handle 已由接口按当前用户计算,存在即采信;缺失时回落 undo_finished=0 保持旧接入行为) */
6527
+ const canApprove = computed(() => {
6528
+ if (props.approval === false || !props.data) return false;
6529
+ if (props.data.can_handle !== void 0) return props.data.can_handle === true;
6530
+ return props.data.undo_finished === 0;
6531
+ });
6532
+ /** 是否展示撤回:审批模式 + 未关闭撤回开关 + 可撤回(can_recall 不为 false;字段缺失时回落 undo_finished=0 保持旧接入行为) */
6533
+ const canRecall = computed(() => {
6534
+ if (props.approval === false || props.showWithdraw === false || !props.data) return false;
6535
+ if (props.data.can_recall !== void 0) return props.data.can_recall === true;
6536
+ return props.data.undo_finished === 0;
6537
+ });
6538
+ /** 是否展示操作按钮组:同意/驳回或撤回任一可见即展示 */
6539
+ const visible = computed(() => canApprove.value || canRecall.value);
6528
6540
  /** 驳回弹窗候选节点链:由 data 映射所得审批时间线(不含 END 结束节点) */
6529
6541
  const timelineNodes = computed(() => mapTimelineNodes(props.data));
6530
6542
  /** 审批弹窗显示状态 */
@@ -6591,7 +6603,7 @@ var FlowActions_default = /* @__PURE__ */ defineComponent({
6591
6603
  align: "center"
6592
6604
  }, {
6593
6605
  default: withCtx(() => [
6594
- __props.showWithdraw ? (openBlock(), createBlock(unref(NButton), {
6606
+ canRecall.value ? (openBlock(), createBlock(unref(NButton), {
6595
6607
  key: 0,
6596
6608
  type: "warning",
6597
6609
  onClick: handleWithdraw
@@ -6599,23 +6611,25 @@ var FlowActions_default = /* @__PURE__ */ defineComponent({
6599
6611
  default: withCtx(() => [..._cache[3] || (_cache[3] = [createTextVNode("撤回", -1)])]),
6600
6612
  _: 1
6601
6613
  })) : createCommentVNode("", true),
6602
- createVNode(unref(NButton), {
6614
+ canApprove.value ? (openBlock(), createBlock(unref(NButton), {
6615
+ key: 1,
6603
6616
  type: "error",
6604
6617
  onClick: _cache[0] || (_cache[0] = ($event) => openApproval("reject"))
6605
6618
  }, {
6606
6619
  default: withCtx(() => [..._cache[4] || (_cache[4] = [createTextVNode("驳回", -1)])]),
6607
6620
  _: 1
6608
- }),
6609
- createVNode(unref(NButton), {
6621
+ })) : createCommentVNode("", true),
6622
+ canApprove.value ? (openBlock(), createBlock(unref(NButton), {
6623
+ key: 2,
6610
6624
  type: "primary",
6611
6625
  onClick: _cache[1] || (_cache[1] = ($event) => openApproval("approve"))
6612
6626
  }, {
6613
6627
  default: withCtx(() => [..._cache[5] || (_cache[5] = [createTextVNode("同意", -1)])]),
6614
6628
  _: 1
6615
- })
6629
+ })) : createCommentVNode("", true)
6616
6630
  ]),
6617
6631
  _: 1
6618
- })) : createCommentVNode("", true), visible.value ? (openBlock(), createBlock(ApprovalModal_default, {
6632
+ })) : createCommentVNode("", true), canApprove.value ? (openBlock(), createBlock(ApprovalModal_default, {
6619
6633
  key: 1,
6620
6634
  visible: approvalVisible.value,
6621
6635
  "onUpdate:visible": _cache[2] || (_cache[2] = ($event) => approvalVisible.value = $event),
@@ -3,7 +3,7 @@ import { WflowTodoDetail, WflowTodoRecord } from '../adapter/wflow';
3
3
  /** display 模式原始详情数据:节点快照自带任务状态与每人处理结果 + status/finished 实例状态 */
4
4
  export type FlowTimelineData = Pick<WflowTodoDetail, 'nodes' | 'finished' | 'status'>;
5
5
  /** FlowActions 审批操作数据:FlowTimelineData 基础上补充 undo_id(同意/驳回接口入参)与 undo_finished(操作按钮显隐)——待办详情接口整份数据可直接传入 */
6
- export type FlowApprovalData = FlowTimelineData & Pick<WflowTodoDetail, 'undo_id' | 'undo_finished'>;
6
+ export type FlowApprovalData = FlowTimelineData & Pick<WflowTodoDetail, 'undo_id' | 'undo_finished' | 'can_handle' | 'can_recall'>;
7
7
  /** 流程状态枚举(接口 status:-1 已驳回 / 0 已撤销 / 1 审批中 / 2 已通过) */
8
8
  export declare enum FlowStatus {
9
9
  Rejected = -1,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yugu-ui/flow-ui",
3
- "version": "0.1.26",
3
+ "version": "0.1.28",
4
4
  "description": "堉古商城流程组件库:流程设计器(config)/ 审批时间线(timeline)/ 流程列表(FlowList)",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",