@yugu-ui/flow-ui 0.1.26 → 0.1.27

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,16 @@ 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 不为 false)+ 未处理(undo_finished=0) */
6527
+ const canApprove = computed(() => props.approval !== false && props.data?.can_handle !== false && props.data?.undo_finished === 0);
6528
+ /** 是否展示撤回:审批模式 + 未关闭撤回开关 + 可撤回(can_recall 不为 false;字段缺失时回落 undo_finished=0 保持旧接入行为) */
6529
+ const canRecall = computed(() => {
6530
+ if (props.approval === false || props.showWithdraw === false || !props.data) return false;
6531
+ if (props.data.can_recall !== void 0) return props.data.can_recall === true;
6532
+ return props.data.undo_finished === 0;
6533
+ });
6534
+ /** 是否展示操作按钮组:同意/驳回或撤回任一可见即展示 */
6535
+ const visible = computed(() => canApprove.value || canRecall.value);
6528
6536
  /** 驳回弹窗候选节点链:由 data 映射所得审批时间线(不含 END 结束节点) */
6529
6537
  const timelineNodes = computed(() => mapTimelineNodes(props.data));
6530
6538
  /** 审批弹窗显示状态 */
@@ -6591,7 +6599,7 @@ var FlowActions_default = /* @__PURE__ */ defineComponent({
6591
6599
  align: "center"
6592
6600
  }, {
6593
6601
  default: withCtx(() => [
6594
- __props.showWithdraw ? (openBlock(), createBlock(unref(NButton), {
6602
+ canRecall.value ? (openBlock(), createBlock(unref(NButton), {
6595
6603
  key: 0,
6596
6604
  type: "warning",
6597
6605
  onClick: handleWithdraw
@@ -6599,23 +6607,25 @@ var FlowActions_default = /* @__PURE__ */ defineComponent({
6599
6607
  default: withCtx(() => [..._cache[3] || (_cache[3] = [createTextVNode("撤回", -1)])]),
6600
6608
  _: 1
6601
6609
  })) : createCommentVNode("", true),
6602
- createVNode(unref(NButton), {
6610
+ canApprove.value ? (openBlock(), createBlock(unref(NButton), {
6611
+ key: 1,
6603
6612
  type: "error",
6604
6613
  onClick: _cache[0] || (_cache[0] = ($event) => openApproval("reject"))
6605
6614
  }, {
6606
6615
  default: withCtx(() => [..._cache[4] || (_cache[4] = [createTextVNode("驳回", -1)])]),
6607
6616
  _: 1
6608
- }),
6609
- createVNode(unref(NButton), {
6617
+ })) : createCommentVNode("", true),
6618
+ canApprove.value ? (openBlock(), createBlock(unref(NButton), {
6619
+ key: 2,
6610
6620
  type: "primary",
6611
6621
  onClick: _cache[1] || (_cache[1] = ($event) => openApproval("approve"))
6612
6622
  }, {
6613
6623
  default: withCtx(() => [..._cache[5] || (_cache[5] = [createTextVNode("同意", -1)])]),
6614
6624
  _: 1
6615
- })
6625
+ })) : createCommentVNode("", true)
6616
6626
  ]),
6617
6627
  _: 1
6618
- })) : createCommentVNode("", true), visible.value ? (openBlock(), createBlock(ApprovalModal_default, {
6628
+ })) : createCommentVNode("", true), canApprove.value ? (openBlock(), createBlock(ApprovalModal_default, {
6619
6629
  key: 1,
6620
6630
  visible: approvalVisible.value,
6621
6631
  "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.27",
4
4
  "description": "堉古商城流程组件库:流程设计器(config)/ 审批时间线(timeline)/ 流程列表(FlowList)",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",