@yugu-ui/flow-ui 0.1.16 → 0.1.18

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.
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { NAvatar, NButton, NCard, NCheckbox, NCheckboxGroup, NCollapse, NCollapseItem, NDrawer, NDrawerContent, NEl, NEllipsis, NEmpty, NForm, NFormItem, NImage, NInput, NInputGroup, NInputGroupLabel, NInputNumber, NModal, NPopover, NRadio, NRadioButton, NRadioGroup, NSelect, NSpace, NSpin, NSwitch, NTab, NTabs, NTag, NTooltip, useThemeVars } from "naive-ui";
2
- import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, createTextVNode, createVNode, defineComponent, guardReactiveProps, inject, markRaw, mergeModels, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onBeforeUnmount, onMounted, openBlock, provide, reactive, ref, renderList, renderSlot, resolveDynamicComponent, shallowRef, toDisplayString, toRef, unref, useModel, useSlots, vModelText, vShow, watch, withCtx, withDirectives, withModifiers } from "vue";
1
+ import { NAvatar, NButton, NCard, NCheckbox, NCheckboxGroup, NCollapse, NCollapseItem, NDrawer, NDrawerContent, NEllipsis, NEmpty, NForm, NFormItem, NImage, NInput, NInputGroup, NInputGroupLabel, NInputNumber, NModal, NPopover, NRadio, NRadioButton, NRadioGroup, NSelect, NSpace, NSpin, NSwitch, NTab, NTabs, NTag, NTooltip, useThemeVars } from "naive-ui";
2
+ import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, createTextVNode, createVNode, defineComponent, guardReactiveProps, h, inject, markRaw, mergeModels, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onBeforeUnmount, onMounted, openBlock, provide, reactive, ref, renderList, renderSlot, resolveDynamicComponent, shallowRef, toDisplayString, toRef, unref, useModel, useSlots, vModelText, vShow, watch, withCtx, withDirectives, withModifiers } from "vue";
3
3
  import { Graph } from "@antv/x6";
4
4
  import { VueShapeView, getTeleport, register } from "@antv/x6-vue-shape";
5
5
  import dayjs from "dayjs";
@@ -137,7 +137,7 @@ function useFlowUI() {
137
137
  }
138
138
  //#endregion
139
139
  //#region src/config/FlowConfigField.vue?vue&type=script&setup=true&lang.ts
140
- var _hoisted_1$17 = {
140
+ var _hoisted_1$15 = {
141
141
  key: 0,
142
142
  class: "fcc-empty"
143
143
  };
@@ -444,7 +444,7 @@ var FlowConfigField_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ *
444
444
  class: "fcc-btn fcc-btn--primary",
445
445
  onClick: addField
446
446
  }, "+ 添加字段")]),
447
- fields.value.length === 0 ? (openBlock(), createElementBlock("div", _hoisted_1$17, "暂无字段,点击右上角「添加字段」开始配置")) : createCommentVNode("", true),
447
+ fields.value.length === 0 ? (openBlock(), createElementBlock("div", _hoisted_1$15, "暂无字段,点击右上角「添加字段」开始配置")) : createCommentVNode("", true),
448
448
  createVNode(_component_NCollapse, {
449
449
  class: "fcc-fields",
450
450
  "arrow-placement": "right",
@@ -653,7 +653,7 @@ var _plugin_vue_export_helper_default = (sfc, props) => {
653
653
  var FlowConfigField_default = /* @__PURE__ */ _plugin_vue_export_helper_default(FlowConfigField_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-314ac215"]]);
654
654
  //#endregion
655
655
  //#region src/config/FlowConfigFlow/components/FlowIcon.vue?vue&type=script&setup=true&lang.ts
656
- var _hoisted_1$16 = ["width", "height"];
656
+ var _hoisted_1$14 = ["width", "height"];
657
657
  var _hoisted_2$12 = ["d"];
658
658
  var _hoisted_3$10 = [
659
659
  "cx",
@@ -776,7 +776,7 @@ var FlowIcon_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__P
776
776
  key: 4,
777
777
  points: seg.points
778
778
  }, null, 8, _hoisted_6$4)) : createCommentVNode("", true)], 64);
779
- }), 128))], 12, _hoisted_1$16);
779
+ }), 128))], 12, _hoisted_1$14);
780
780
  };
781
781
  }
782
782
  }), [["__scopeId", "data-v-65188f30"]]);
@@ -1074,14 +1074,14 @@ var centerXOf = (node) => {
1074
1074
  return node.getPosition().x + node.getSize().width / 2;
1075
1075
  };
1076
1076
  var getTypeLabel = (type) => NODE_TYPES.find((t) => t.value === type)?.label || "节点";
1077
- var getDefaultConfig = (type) => {
1077
+ var getDefaultConfig = (type, isExternal) => {
1078
1078
  switch (type) {
1079
1079
  case NODE_TYPE.START: return {
1080
1080
  range: "all",
1081
1081
  members: []
1082
1082
  };
1083
1083
  case NODE_TYPE.APPROVER: return {
1084
- assigneeType: "selfSelect",
1084
+ assigneeType: isExternal === 0 ? "selfSelect" : "specified",
1085
1085
  approvers: [],
1086
1086
  mode: "and",
1087
1087
  empty: "pass"
@@ -1200,30 +1200,66 @@ var getConditionBranchSubtree = (graph, condId, convergeId) => {
1200
1200
  return ids;
1201
1201
  };
1202
1202
  /**
1203
- * 发布校验:仅校验条件分支完整性(审批 / 抄送 / 开始节点均有默认值,无需校验),返回具体错误明细
1203
+ * 发布校验:校验审批人(指定审批人但人员为空)与条件分支完整性,返回错误明细与失败节点 id
1204
1204
  * @param {Graph} graph 图实例
1205
- * @returns {string[]} 错误明细列表
1205
+ * @returns {{ errors: string[], errorNodeIds: string[] }} 错误明细列表与失败节点 id 列表
1206
1206
  */
1207
- var validateFlow = (graph) => {
1207
+ var validateFlowDetails = (graph) => {
1208
1208
  const errors = [];
1209
- if (!graph) return errors;
1209
+ const errorNodeIds = [];
1210
+ if (!graph) return {
1211
+ errors,
1212
+ errorNodeIds
1213
+ };
1210
1214
  graph.getNodes().forEach((n) => {
1211
1215
  const d = n.getData() || {};
1216
+ if (d.type === NODE_TYPE.APPROVER) {
1217
+ const cfg = d.config || {};
1218
+ const approvers = Array.isArray(cfg.approvers) ? cfg.approvers : [];
1219
+ if (cfg.assigneeType === "specified" && !approvers.length) {
1220
+ errors.push(`审批节点「${d.name || "审批人"}」尚未选择审批人`);
1221
+ if (!errorNodeIds.includes(n.id)) errorNodeIds.push(n.id);
1222
+ }
1223
+ return;
1224
+ }
1212
1225
  if (d.type !== NODE_TYPE.CONDITION || d.isDefault) return;
1213
1226
  const name = d.name || "条件分支";
1214
1227
  const groups = d.config?.conditionGroups;
1228
+ const markNode = () => {
1229
+ if (!errorNodeIds.includes(n.id)) errorNodeIds.push(n.id);
1230
+ };
1215
1231
  if (!Array.isArray(groups) || groups.length === 0) {
1216
1232
  errors.push(`条件分支「${name}」尚未配置条件`);
1233
+ markNode();
1217
1234
  return;
1218
1235
  }
1219
1236
  groups.forEach((g, gi) => {
1220
1237
  (Array.isArray(g?.rules) ? g.rules : []).forEach((r, ri) => {
1221
- if (!r.field) errors.push(`条件分支「${name}」第 ${gi + 1} 组第 ${ri + 1} 条规则未选择字段`);
1222
- if (Array.isArray(r.value) ? r.value.length === 0 : r.value === void 0 || r.value === null || String(r.value).trim() === "") errors.push(`条件分支「${name}」第 ${gi + 1} 组第 ${ri + 1} 条规则未填写条件值`);
1238
+ if (!r.field) {
1239
+ errors.push(`条件分支「${name}」第 ${gi + 1} 组第 ${ri + 1} 条规则未选择字段`);
1240
+ markNode();
1241
+ }
1242
+ if (Array.isArray(r.value) ? r.value.length === 0 : r.value === void 0 || r.value === null || String(r.value).trim() === "") {
1243
+ errors.push(`条件分支「${name}」第 ${gi + 1} 组第 ${ri + 1} 条规则未填写条件值`);
1244
+ markNode();
1245
+ }
1223
1246
  });
1224
1247
  });
1225
1248
  });
1226
- return errors;
1249
+ return {
1250
+ errors,
1251
+ errorNodeIds
1252
+ };
1253
+ };
1254
+ /**
1255
+ * 校验结果标红:失败节点 data.invalid = true 驱动卡片红边框,其余节点清除标记;
1256
+ * 仅在标记变化时 setData,避免无谓触发 change:data 重渲染
1257
+ */
1258
+ var markInvalidNodes = (graph, errorNodeIds = []) => {
1259
+ graph?.getNodes().forEach((n) => {
1260
+ const shouldMark = errorNodeIds.includes(n.id);
1261
+ if (!!n.getData()?.invalid !== shouldMark) n.setData({ invalid: shouldMark });
1262
+ });
1227
1263
  };
1228
1264
  //#endregion
1229
1265
  //#region src/config/FlowConfigFlow/graph/layout.js
@@ -1672,7 +1708,7 @@ var insertConditionGroup = (graph, upstreamIds, downstreamIds) => {
1672
1708
  });
1673
1709
  };
1674
1710
  /** 插入普通节点(附带默认 config):上游 ids → 新节点 → 下游 ids */
1675
- var insertPlainNode = (graph, type, upstreamIds, downstreamIds) => {
1711
+ var insertPlainNode = (graph, type, upstreamIds, downstreamIds, isExternal) => {
1676
1712
  const nodeId = genId();
1677
1713
  graph.addNode(nodeOptions({
1678
1714
  id: nodeId,
@@ -1680,7 +1716,7 @@ var insertPlainNode = (graph, type, upstreamIds, downstreamIds) => {
1680
1716
  type,
1681
1717
  x: 0,
1682
1718
  y: 0,
1683
- config: getDefaultConfig(type)
1719
+ config: getDefaultConfig(type, isExternal)
1684
1720
  }));
1685
1721
  upstreamIds.forEach((uid) => graph.addEdge(edgeOptions(uid, nodeId)));
1686
1722
  downstreamIds.forEach((did) => graph.addEdge(edgeOptions(nodeId, did)));
@@ -1701,7 +1737,7 @@ var insertPlainNode = (graph, type, upstreamIds, downstreamIds) => {
1701
1737
  * @param {string} sourceId 源节点 id
1702
1738
  * @param {string} targetId 目标节点 id
1703
1739
  * @param {string} type 要插入的节点类型(NODE_TYPE 中的值)
1704
- * @param {{afterGroup?: boolean}} [options] afterGroup:是否在整组之后插入(组出口按钮专用)
1740
+ * @param {{afterGroup?: boolean, isExternal?: number}} [options] afterGroup:是否在整组之后插入(组出口按钮专用);isExternal:外部流程标识(透传 getDefaultConfig,外部流程下审批人节点默认指定审批人)
1705
1741
  */
1706
1742
  var insertNodeBetween = (graph, sourceId, targetId, type, options = {}) => {
1707
1743
  if (!graph) return;
@@ -1715,7 +1751,7 @@ var insertNodeBetween = (graph, sourceId, targetId, type, options = {}) => {
1715
1751
  graph.getEdges().filter((e) => e.getSourceCellId() === sourceId && e.getTargetCellId() === cid).forEach((e) => graph.removeEdge(e));
1716
1752
  });
1717
1753
  if (type === NODE_TYPE.CONDITION) insertConditionGroup(graph, [sourceId], siblingConds);
1718
- else insertPlainNode(graph, type, [sourceId], siblingConds);
1754
+ else insertPlainNode(graph, type, [sourceId], siblingConds, options.isExternal);
1719
1755
  autoLayout(graph);
1720
1756
  return;
1721
1757
  }
@@ -1725,14 +1761,14 @@ var insertNodeBetween = (graph, sourceId, targetId, type, options = {}) => {
1725
1761
  const tailIds = [...new Set(oldExitEdges.map((e) => e.getSourceCellId()))];
1726
1762
  oldExitEdges.forEach((e) => graph.removeEdge(e));
1727
1763
  if (type === NODE_TYPE.CONDITION) insertConditionGroup(graph, tailIds, [convergeId]);
1728
- else insertPlainNode(graph, type, tailIds, [convergeId]);
1764
+ else insertPlainNode(graph, type, tailIds, [convergeId], options.isExternal);
1729
1765
  autoLayout(graph);
1730
1766
  return;
1731
1767
  }
1732
1768
  const oldEdge = graph.getEdges().find((e) => e.getSourceCellId() === sourceId && e.getTargetCellId() === targetId);
1733
1769
  if (oldEdge) graph.removeEdge(oldEdge);
1734
1770
  if (type === NODE_TYPE.CONDITION) insertConditionGroup(graph, [sourceId], [targetId]);
1735
- else insertPlainNode(graph, type, [sourceId], [targetId]);
1771
+ else insertPlainNode(graph, type, [sourceId], [targetId], options.isExternal);
1736
1772
  autoLayout(graph);
1737
1773
  };
1738
1774
  //#endregion
@@ -2675,7 +2711,7 @@ function usePersonData() {
2675
2711
  //#endregion
2676
2712
  //#region src/person-selector/composables/useSelection.ts
2677
2713
  function useSelection(options) {
2678
- const { modelValue, depts, roles, people, paused, onChange } = options;
2714
+ const { modelValue, depts, roles, people, paused, multiple = true, onChange } = options;
2679
2715
  const modelValueArray = computed(() => Array.isArray(modelValue()) ? modelValue() : []);
2680
2716
  const localSelected = ref([...modelValueArray.value]);
2681
2717
  watch(modelValueArray, (v) => {
@@ -2767,7 +2803,7 @@ function useSelection(options) {
2767
2803
  if (it.type === "person" && covered.has(key)) return false;
2768
2804
  return !isItemStopDisabled(it);
2769
2805
  });
2770
- localSelected.value = [...kept, ...fresh];
2806
+ localSelected.value = multiple === false ? fresh.slice(-1) : [...kept, ...fresh];
2771
2807
  };
2772
2808
  const removeMany = (items) => {
2773
2809
  if (!items.length) return;
@@ -2882,7 +2918,7 @@ function useOverflowTags(options) {
2882
2918
  }
2883
2919
  //#endregion
2884
2920
  //#region src/person-selector/index.vue?vue&type=script&setup=true&lang.ts
2885
- var _hoisted_1$15 = { class: "person-selector" };
2921
+ var _hoisted_1$13 = { class: "person-selector" };
2886
2922
  var _hoisted_2$11 = { class: "person-selector__tag-name" };
2887
2923
  var _hoisted_3$9 = ["onClick"];
2888
2924
  var _hoisted_4$6 = {
@@ -2970,7 +3006,11 @@ var person_selector_default = /* @__PURE__ */ _plugin_vue_export_helper_default(
2970
3006
  modelValue: { default: () => [] },
2971
3007
  selectableTypes: { default: () => ["person"] },
2972
3008
  placeholder: { default: "请选择" },
2973
- displayMode: { default: "overflow" }
3009
+ displayMode: { default: "overflow" },
3010
+ multiple: {
3011
+ type: Boolean,
3012
+ default: true
3013
+ }
2974
3014
  },
2975
3015
  emits: ["update:modelValue", "change"],
2976
3016
  setup(__props, { emit: __emit }) {
@@ -3009,6 +3049,7 @@ var person_selector_default = /* @__PURE__ */ _plugin_vue_export_helper_default(
3009
3049
  depts,
3010
3050
  roles,
3011
3051
  people,
3052
+ multiple: props.multiple,
3012
3053
  paused: () => dialogVisible.value,
3013
3054
  onChange: (value) => {
3014
3055
  emit("update:modelValue", value);
@@ -3195,7 +3236,7 @@ var person_selector_default = /* @__PURE__ */ _plugin_vue_export_helper_default(
3195
3236
  ensureData().catch(() => {});
3196
3237
  });
3197
3238
  return (_ctx, _cache) => {
3198
- return openBlock(), createElementBlock("div", _hoisted_1$15, [createElementVNode("div", {
3239
+ return openBlock(), createElementBlock("div", _hoisted_1$13, [createElementVNode("div", {
3199
3240
  ref_key: "triggerRef",
3200
3241
  ref: triggerRef,
3201
3242
  class: "person-selector__trigger",
@@ -3315,7 +3356,7 @@ var person_selector_default = /* @__PURE__ */ _plugin_vue_export_helper_default(
3315
3356
  _: 1
3316
3357
  }, 8, ["value"])) : createCommentVNode("", true),
3317
3358
  showDeptNav.value ? withDirectives((openBlock(), createElementBlock("div", _hoisted_12$3, [
3318
- canSelectDept.value ? (openBlock(), createBlock(unref(NCheckbox), {
3359
+ canSelectDept.value && __props.multiple ? (openBlock(), createBlock(unref(NCheckbox), {
3319
3360
  key: 0,
3320
3361
  checked: allDeptsChecked.value,
3321
3362
  indeterminate: allDeptsIndeterminate.value,
@@ -3333,7 +3374,7 @@ var person_selector_default = /* @__PURE__ */ _plugin_vue_export_helper_default(
3333
3374
  }]),
3334
3375
  onClick: ($event) => activeDept.value = dept.id
3335
3376
  }, [
3336
- canSelectDept.value ? (openBlock(), createBlock(unref(NCheckbox), {
3377
+ canSelectDept.value && __props.multiple ? (openBlock(), createBlock(unref(NCheckbox), {
3337
3378
  key: 0,
3338
3379
  checked: unref(isSelected)("dept", dept.id),
3339
3380
  disabled: unref(isDeptDisabled)(dept.id) && !unref(isSelected)("dept", dept.id),
@@ -3363,11 +3404,12 @@ var person_selector_default = /* @__PURE__ */ _plugin_vue_export_helper_default(
3363
3404
  ], 10, _hoisted_16$1);
3364
3405
  }), 128))])], 512)), [[vShow, !showNavTabs.value || navTab.value === "dept"]]) : createCommentVNode("", true),
3365
3406
  canSelectRole.value ? withDirectives((openBlock(), createElementBlock("div", _hoisted_18$1, [
3366
- createVNode(unref(NCheckbox), {
3407
+ __props.multiple ? (openBlock(), createBlock(unref(NCheckbox), {
3408
+ key: 0,
3367
3409
  checked: allRolesChecked.value,
3368
3410
  indeterminate: allRolesIndeterminate.value,
3369
3411
  "onUpdate:checked": toggleAllRoles
3370
- }, null, 8, ["checked", "indeterminate"]),
3412
+ }, null, 8, ["checked", "indeterminate"])) : createCommentVNode("", true),
3371
3413
  _cache[12] || (_cache[12] = createTextVNode(" 角色 ", -1)),
3372
3414
  _cache[13] || (_cache[13] = createElementVNode("span", { class: "person-selector__panel-hint" }, "(点击选择)", -1))
3373
3415
  ], 512)), [[vShow, !showNavTabs.value || navTab.value === "role"]]) : createCommentVNode("", true),
@@ -3380,7 +3422,7 @@ var person_selector_default = /* @__PURE__ */ _plugin_vue_export_helper_default(
3380
3422
  }]),
3381
3423
  onClick: ($event) => activeRole.value = role.id
3382
3424
  }, [
3383
- canSelectRole.value ? (openBlock(), createBlock(unref(NCheckbox), {
3425
+ canSelectRole.value && __props.multiple ? (openBlock(), createBlock(unref(NCheckbox), {
3384
3426
  key: 0,
3385
3427
  checked: unref(isSelected)("role", role.id),
3386
3428
  disabled: unref(isRoleDisabled)(role.id) && !unref(isSelected)("role", role.id),
@@ -3410,7 +3452,8 @@ var person_selector_default = /* @__PURE__ */ _plugin_vue_export_helper_default(
3410
3452
  ], 10, _hoisted_21$1);
3411
3453
  }), 128))])], 512)), [[vShow, !showNavTabs.value || navTab.value === "role"]]) : createCommentVNode("", true)
3412
3454
  ]), canSelectPerson.value ? (openBlock(), createElementBlock("div", _hoisted_23$1, [createElementVNode("div", _hoisted_24$1, [
3413
- createVNode(unref(NCheckbox), {
3455
+ __props.multiple ? (openBlock(), createBlock(unref(NCheckbox), {
3456
+ key: 0,
3414
3457
  checked: allPeopleChecked.value,
3415
3458
  indeterminate: allPeopleIndeterminate.value,
3416
3459
  disabled: allPeopleDisabled.value,
@@ -3419,7 +3462,7 @@ var person_selector_default = /* @__PURE__ */ _plugin_vue_export_helper_default(
3419
3462
  "checked",
3420
3463
  "indeterminate",
3421
3464
  "disabled"
3422
- ]),
3465
+ ])) : createCommentVNode("", true),
3423
3466
  _cache[15] || (_cache[15] = createTextVNode(" 人员 ", -1)),
3424
3467
  createElementVNode("span", _hoisted_25$1, toDisplayString(allPeopleDisabled.value ? `(${peopleDisabledReason.value})` : "(点击选择)"), 1)
3425
3468
  ]), createElementVNode("div", _hoisted_26$1, [createElementVNode("div", _hoisted_27, [(openBlock(true), createElementBlock(Fragment, null, renderList(displayPeople.value, (p) => {
@@ -3471,11 +3514,12 @@ var person_selector_default = /* @__PURE__ */ _plugin_vue_export_helper_default(
3471
3514
  createElementVNode("path", { d: "M21 21l-4.35-4.35" }),
3472
3515
  createElementVNode("path", { d: "M8 11h6" })
3473
3516
  ], -1), createElementVNode("span", null, "暂无人员", -1)])])) : createCommentVNode("", true)])])])) : createCommentVNode("", true)], 2),
3474
- unref(localSelected).length ? (openBlock(), createElementBlock("div", _hoisted_31, [createElementVNode("div", _hoisted_32, [createElementVNode("span", _hoisted_33, [createVNode(unref(NCheckbox), {
3517
+ unref(localSelected).length ? (openBlock(), createElementBlock("div", _hoisted_31, [createElementVNode("div", _hoisted_32, [createElementVNode("span", _hoisted_33, [__props.multiple ? (openBlock(), createBlock(unref(NCheckbox), {
3518
+ key: 0,
3475
3519
  checked: allGlobalChecked.value,
3476
3520
  indeterminate: allGlobalIndeterminate.value,
3477
3521
  "onUpdate:checked": toggleAllGlobal
3478
- }, null, 8, ["checked", "indeterminate"]), createElementVNode("span", null, [
3522
+ }, null, 8, ["checked", "indeterminate"])) : createCommentVNode("", true), createElementVNode("span", null, [
3479
3523
  _cache[18] || (_cache[18] = createTextVNode(" 已选 ", -1)),
3480
3524
  createElementVNode("strong", null, toDisplayString(unref(localSelected).length), 1),
3481
3525
  _cache[19] || (_cache[19] = createTextVNode(" 项 ", -1))
@@ -3513,7 +3557,7 @@ var person_selector_default = /* @__PURE__ */ _plugin_vue_export_helper_default(
3513
3557
  ])]);
3514
3558
  };
3515
3559
  }
3516
- }), [["__scopeId", "data-v-fe31f4e2"]]);
3560
+ }), [["__scopeId", "data-v-94c096c2"]]);
3517
3561
  //#endregion
3518
3562
  //#region src/person-selector/PersonSelectorSlot.vue
3519
3563
  var PersonSelectorSlot_default = /* @__PURE__ */ defineComponent({
@@ -3741,7 +3785,7 @@ var getRemoteOptions = (field) => {
3741
3785
  };
3742
3786
  //#endregion
3743
3787
  //#region src/config/FlowConfigFlow/components/NodeConfigDrawer/modules/ConditionConfig.vue?vue&type=script&setup=true&lang.ts
3744
- var _hoisted_1$14 = { class: "cond" };
3788
+ var _hoisted_1$12 = { class: "cond" };
3745
3789
  var _hoisted_2$10 = {
3746
3790
  key: 0,
3747
3791
  class: "cond__empty"
@@ -3841,7 +3885,7 @@ var ConditionConfig_default = /* @__PURE__ */ _plugin_vue_export_helper_default(
3841
3885
  const _component_NInput = NInput;
3842
3886
  const _component_NFormItem = NFormItem;
3843
3887
  return openBlock(), createBlock(_component_NFormItem, { "show-label": false }, {
3844
- default: withCtx(() => [createElementVNode("div", _hoisted_1$14, [
3888
+ default: withCtx(() => [createElementVNode("div", _hoisted_1$12, [
3845
3889
  _cache[5] || (_cache[5] = createElementVNode("div", { class: "cond__tip" }, "满足以下条件时进入当前分支", -1)),
3846
3890
  !__props.config.conditionGroups?.length ? (openBlock(), createElementBlock("div", _hoisted_2$10, [_cache[0] || (_cache[0] = createElementVNode("span", { class: "cond__empty-text" }, "请添加条件", -1)), createElementVNode("button", {
3847
3891
  type: "button",
@@ -4025,8 +4069,15 @@ var NodeConfigDrawer_default = /* @__PURE__ */ _plugin_vue_export_helper_default
4025
4069
  watch(() => props.visible, (v) => {
4026
4070
  if (v) initForm();
4027
4071
  });
4028
- /** 确认:条件类型先校验完整性(未配置 / 条件值未填写),不通过则提示且不关闭抽屉 */
4072
+ /** 确认:审批人类型(指定审批人但人员为空)/ 条件类型(未配置 / 条件值未填写)先校验完整性,不通过则提示且不关闭抽屉 */
4029
4073
  const handleConfirm = (close) => {
4074
+ if (nodeType.value === NODE_TYPE.APPROVER && form.config.assigneeType === "specified") {
4075
+ if (!(Array.isArray(form.config.approvers) ? form.config.approvers : []).length) {
4076
+ window.$message?.warning("请选择审批人");
4077
+ close(false);
4078
+ return;
4079
+ }
4080
+ }
4030
4081
  if (nodeType.value === NODE_TYPE.CONDITION) {
4031
4082
  const groups = form.config.conditionGroups || [];
4032
4083
  if (!groups.some((g) => g.rules?.some((r) => r.field))) {
@@ -4093,7 +4144,7 @@ var NodeConfigDrawer_default = /* @__PURE__ */ _plugin_vue_export_helper_default
4093
4144
  }, 8, ["show", "title"]);
4094
4145
  };
4095
4146
  }
4096
- }), [["__scopeId", "data-v-3485c546"]]);
4147
+ }), [["__scopeId", "data-v-1d8631e0"]]);
4097
4148
  //#endregion
4098
4149
  //#region src/config/FlowConfigFlow/composables/useNodeDrawer.ts
4099
4150
  /**
@@ -4146,7 +4197,8 @@ function useNodeDrawer(getGraph, onConfirm) {
4146
4197
  const d = cell.getData() || {};
4147
4198
  cell.setData({
4148
4199
  ...d,
4149
- config
4200
+ config,
4201
+ invalid: false
4150
4202
  }, { overwrite: true });
4151
4203
  }
4152
4204
  onConfirm?.();
@@ -4204,7 +4256,7 @@ var resolveNames = (list) => {
4204
4256
  };
4205
4257
  //#endregion
4206
4258
  //#region src/config/FlowConfigFlow/components/FlowNodeCard.vue?vue&type=script&setup=true&lang.ts
4207
- var _hoisted_1$13 = {
4259
+ var _hoisted_1$11 = {
4208
4260
  key: 0,
4209
4261
  class: "fnode fnode--add-condition"
4210
4262
  };
@@ -4386,7 +4438,7 @@ var FlowNodeCard_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/*
4386
4438
  };
4387
4439
  return (_ctx, _cache) => {
4388
4440
  const _component_NTooltip = NTooltip;
4389
- return data.type === "add-condition" ? (openBlock(), createElementBlock("div", _hoisted_1$13, [createVNode(FlowIcon_default, {
4441
+ return data.type === "add-condition" ? (openBlock(), createElementBlock("div", _hoisted_1$11, [createVNode(FlowIcon_default, {
4390
4442
  name: "plus",
4391
4443
  size: 11,
4392
4444
  color: "#fff"
@@ -4394,7 +4446,8 @@ var FlowNodeCard_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/*
4394
4446
  key: 1,
4395
4447
  class: normalizeClass(["fnode", [`fnode--${data.type}`, {
4396
4448
  "fnode--active": data.active,
4397
- "fnode--default-condition": isDefaultCondition.value
4449
+ "fnode--default-condition": isDefaultCondition.value,
4450
+ "fnode--invalid": data.invalid
4398
4451
  }]])
4399
4452
  }, [
4400
4453
  createElementVNode("div", _hoisted_2$9, [createVNode(FlowIcon_default, {
@@ -4467,10 +4520,10 @@ var FlowNodeCard_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/*
4467
4520
  ], 2));
4468
4521
  };
4469
4522
  }
4470
- }), [["__scopeId", "data-v-626844a8"]]);
4523
+ }), [["__scopeId", "data-v-eda68330"]]);
4471
4524
  //#endregion
4472
4525
  //#region src/config/FlowConfigFlow/index.vue?vue&type=script&setup=true&lang.ts
4473
- var _hoisted_1$12 = { class: "flow-config-flow" };
4526
+ var _hoisted_1$10 = { class: "flow-config-flow" };
4474
4527
  var _hoisted_2$8 = {
4475
4528
  key: 0,
4476
4529
  class: "flow-config-flow__hint"
@@ -4621,16 +4674,23 @@ var FlowConfigFlow_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/
4621
4674
  closeMenu();
4622
4675
  return;
4623
4676
  }
4624
- insertNodeBetween(graph, pendingInsert.sourceId, pendingInsert.targetId, type, { afterGroup: pendingInsert.afterGroup });
4677
+ insertNodeBetween(graph, pendingInsert.sourceId, pendingInsert.targetId, type, {
4678
+ afterGroup: pendingInsert.afterGroup,
4679
+ isExternal: props.isExternal
4680
+ });
4625
4681
  closeMenu();
4626
4682
  refreshAllButtons();
4627
4683
  emitGraphChange();
4628
4684
  };
4629
- const validateFlow$1 = () => validateFlow(graph);
4685
+ const validateFlow = () => {
4686
+ const { errors, errorNodeIds } = validateFlowDetails(graph);
4687
+ markInvalidNodes(graph, errorNodeIds);
4688
+ return errors;
4689
+ };
4630
4690
  /** 导出嵌套子节点链(链首 start 节点本体,不含画布元素):供父组件保存时打印 / 提交 */
4631
4691
  const getProcessData = () => graphToProcessData(graph);
4632
4692
  __expose({
4633
- validateFlow: validateFlow$1,
4693
+ validateFlow,
4634
4694
  getProcessData
4635
4695
  });
4636
4696
  onMounted(() => {
@@ -4656,7 +4716,10 @@ var FlowConfigFlow_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/
4656
4716
  return;
4657
4717
  }
4658
4718
  if (data?.type === NODE_TYPE.END) return;
4659
- if (data?.type === NODE_TYPE.START && props.isExternal !== 0) return;
4719
+ if (data?.type === NODE_TYPE.START && props.isExternal !== 0) {
4720
+ window.$message?.warning("外部流程由外部系统发起,发起人无需配置");
4721
+ return;
4722
+ }
4660
4723
  if (data?.isDefault) return;
4661
4724
  openNodeDrawer(node);
4662
4725
  });
@@ -4672,7 +4735,7 @@ var FlowConfigFlow_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/
4672
4735
  graph = null;
4673
4736
  });
4674
4737
  return (_ctx, _cache) => {
4675
- return openBlock(), createElementBlock("div", _hoisted_1$12, [
4738
+ return openBlock(), createElementBlock("div", _hoisted_1$10, [
4676
4739
  createElementVNode("div", {
4677
4740
  ref_key: "containerRef",
4678
4741
  ref: containerRef,
@@ -4724,10 +4787,10 @@ var FlowConfigFlow_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/
4724
4787
  ]);
4725
4788
  };
4726
4789
  }
4727
- }), [["__scopeId", "data-v-c3fa1fc2"]]);
4790
+ }), [["__scopeId", "data-v-edefe008"]]);
4728
4791
  //#endregion
4729
4792
  //#region src/config/FlowConfigMore.vue?vue&type=script&setup=true&lang.ts
4730
- var _hoisted_1$11 = { class: "flow-config-more" };
4793
+ var _hoisted_1$9 = { class: "flow-config-more" };
4731
4794
  //#endregion
4732
4795
  //#region src/config/FlowConfigMore.vue
4733
4796
  var FlowConfigMore_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
@@ -4791,7 +4854,7 @@ var FlowConfigMore_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/
4791
4854
  const _component_NCheckboxGroup = NCheckboxGroup;
4792
4855
  const _component_NInput = NInput;
4793
4856
  const _component_NForm = NForm;
4794
- return openBlock(), createElementBlock("div", _hoisted_1$11, [createVNode(_component_NForm, {
4857
+ return openBlock(), createElementBlock("div", _hoisted_1$9, [createVNode(_component_NForm, {
4795
4858
  ref_key: "formRef",
4796
4859
  ref: formRef,
4797
4860
  "label-placement": "left",
@@ -4807,7 +4870,8 @@ var FlowConfigMore_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/
4807
4870
  default: withCtx(() => [createVNode(PersonSelectorSlot_default, {
4808
4871
  modelValue: settings.value.manager,
4809
4872
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => settings.value.manager = $event),
4810
- placeholder: "请选择流程管理员"
4873
+ placeholder: "请选择流程管理员",
4874
+ multiple: false
4811
4875
  }, null, 8, ["modelValue"])]),
4812
4876
  _: 1
4813
4877
  }),
@@ -4916,10 +4980,10 @@ var FlowConfigMore_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/
4916
4980
  }, 8, ["model"])]);
4917
4981
  };
4918
4982
  }
4919
- }), [["__scopeId", "data-v-5850f6ef"]]);
4983
+ }), [["__scopeId", "data-v-fde6bc00"]]);
4920
4984
  //#endregion
4921
4985
  //#region src/config/FlowConfig.vue?vue&type=script&setup=true&lang.ts
4922
- var _hoisted_1$10 = { class: "flow-config__header" };
4986
+ var _hoisted_1$8 = { class: "flow-config__header" };
4923
4987
  var _hoisted_2$7 = { class: "flow-config__title" };
4924
4988
  var _hoisted_3$5 = { class: "flow-config__body" };
4925
4989
  //#endregion
@@ -5005,9 +5069,21 @@ var FlowConfig_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @_
5005
5069
  const fieldRef = ref();
5006
5070
  const flowRef = ref();
5007
5071
  const moreRef = ref();
5008
- /** 校验失败提示:每个模块仅弹一条 message,只展示精简标题文案 */
5009
- const notifyErrors = (tip) => {
5010
- window.$message?.error(tip);
5072
+ /** 校验失败提示:每个模块弹一条 message,标题下列具体错误明细(含节点名),便于直接定位无需逐个排查 */
5073
+ const notifyErrors = (tip, errors = []) => {
5074
+ if (!errors.length) {
5075
+ window.$message?.error(tip);
5076
+ return;
5077
+ }
5078
+ const shown = errors.slice(0, 5);
5079
+ window.$message?.error(() => h("div", { style: "max-width:420px" }, [
5080
+ h("div", { style: "font-weight:600" }, tip),
5081
+ ...shown.map((e) => h("div", { style: "font-size:12px;opacity:.85;margin-top:4px;line-height:1.5" }, `· ${e}`)),
5082
+ ...errors.length > shown.length ? [h("div", { style: "font-size:12px;opacity:.85;margin-top:4px" }, `…等共 ${errors.length} 项问题`)] : []
5083
+ ]), {
5084
+ duration: 5e3,
5085
+ closable: true
5086
+ });
5011
5087
  };
5012
5088
  /** 保存前校验:字段配置(添加了字段则各项配置必填)→ 流程设计(条件完整性)→ 更多设置(流程管理员必填)。
5013
5089
  * 校验失败时切换到首个出错页签;多个模块出错时逐条弹出对应提示;全部通过才向上抛出 publish。
@@ -5024,7 +5100,7 @@ var FlowConfig_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @_
5024
5100
  }],
5025
5101
  {
5026
5102
  step: 2,
5027
- tip: "【流程设计】条件未配置完整",
5103
+ tip: "【流程设计】流程配置不完整",
5028
5104
  errors: flowRef.value?.validateFlow?.() || []
5029
5105
  },
5030
5106
  {
@@ -5047,7 +5123,7 @@ var FlowConfig_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @_
5047
5123
  return;
5048
5124
  }
5049
5125
  currentStep.value = failed[0].step;
5050
- failed.forEach((c) => notifyErrors(c.tip));
5126
+ failed.forEach((c) => notifyErrors(c.tip, c.errors));
5051
5127
  } finally {
5052
5128
  validating.value = false;
5053
5129
  }
@@ -5064,7 +5140,7 @@ var FlowConfig_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @_
5064
5140
  "header-style": "padding: 0;",
5065
5141
  "content-style": "padding: 0; flex: 1; min-height: 0; display: flex; flex-direction: column;"
5066
5142
  }, {
5067
- header: withCtx(() => [createElementVNode("div", _hoisted_1$10, [
5143
+ header: withCtx(() => [createElementVNode("div", _hoisted_1$8, [
5068
5144
  createElementVNode("span", _hoisted_2$7, toDisplayString(__props.flowName || "流程配置"), 1),
5069
5145
  createVNode(_component_NTabs, {
5070
5146
  value: currentStep.value,
@@ -5129,73 +5205,10 @@ var FlowConfig_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @_
5129
5205
  }, 8, ["style"]);
5130
5206
  };
5131
5207
  }
5132
- }), [["__scopeId", "data-v-5e56d074"]]);
5133
- //#endregion
5134
- //#region src/utils/common.ts
5135
- /** 判断是否为空(undefined/null/空字符串) */
5136
- function isNull(value) {
5137
- return value === void 0 || value === null || value === "";
5138
- }
5139
- /** 时间格式化:兼容 10/13 位时间戳、字符串与 Date,空值返回 '--' */
5140
- function formatTime(value, format = "YYYY-MM-DD HH:mm:ss") {
5141
- if (value === null || value === void 0 || value === "" || value === 0) return "--";
5142
- let timestamp = value;
5143
- if (typeof value === "string") {
5144
- const trimmed = value.trim();
5145
- if (/^\d+$/.test(trimmed)) {
5146
- const numValue = parseInt(trimmed, 10);
5147
- if (trimmed.length === 10) timestamp = numValue * 1e3;
5148
- else if (trimmed.length === 13) timestamp = numValue;
5149
- else return dayjs(value).format(format);
5150
- } else return dayjs(value).format(format);
5151
- } else if (typeof value === "number") {
5152
- if (value.toString().length === 10) timestamp = value * 1e3;
5153
- }
5154
- return dayjs(timestamp).format(format);
5155
- }
5156
- //#endregion
5157
- //#region src/composables/form.ts
5158
- var invalidLiterals = [
5159
- "null",
5160
- "undefined",
5161
- "nan",
5162
- "nil",
5163
- "none"
5164
- ];
5165
- function useFormRules() {
5166
- function createRequiredRule(message) {
5167
- return {
5168
- required: true,
5169
- trigger: ["input", "blur"],
5170
- validator: (_rule, value) => {
5171
- if (isNull(value) || typeof value === "string" && value.trim() === "" || Array.isArray(value) && value.length === 0) return new Error(message);
5172
- if (typeof value === "string") {
5173
- const trimmed = value.trim().toLowerCase();
5174
- if (invalidLiterals.includes(trimmed)) return /* @__PURE__ */ new Error(`内容不可为 ${trimmed}`);
5175
- }
5176
- return true;
5177
- }
5178
- };
5179
- }
5180
- return { createRequiredRule };
5181
- }
5182
- function useNaiveForm() {
5183
- const formRef = ref(null);
5184
- async function validate() {
5185
- await formRef.value?.validate();
5186
- }
5187
- async function restoreValidation() {
5188
- formRef.value?.restoreValidation();
5189
- }
5190
- return {
5191
- formRef,
5192
- validate,
5193
- restoreValidation
5194
- };
5195
- }
5208
+ }), [["__scopeId", "data-v-a1a3b101"]]);
5196
5209
  //#endregion
5197
5210
  //#region src/file-preview/index.vue?vue&type=script&setup=true&lang.ts
5198
- var _hoisted_1$9 = ["src"];
5211
+ var _hoisted_1$7 = ["src"];
5199
5212
  var _hoisted_2$6 = {
5200
5213
  key: 0,
5201
5214
  class: "preview-fail-overlay"
@@ -5206,7 +5219,7 @@ var _hoisted_3$4 = {
5206
5219
  };
5207
5220
  /** 扩展名 → 预览类型映射(代码/文本类不在表内,走下载兜底) */
5208
5221
  var FILE_ORIGIN = "https://download.yugu8.com";
5209
- /** 文件同域反代前缀 */
5222
+ /** 文件同域反代前缀(仅 localhost dev) */
5210
5223
  var FILE_PROXY_PREFIX = "/download-proxy";
5211
5224
  //#endregion
5212
5225
  //#region src/file-preview/index.vue
@@ -5268,10 +5281,13 @@ var file_preview_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/*
5268
5281
  "excel",
5269
5282
  "pptx"
5270
5283
  ].includes(kind.value));
5271
- /** 文件资源域名(与 vite.config.ts 的 /download-proxy 代理目标保持一致) */
5284
+ /** 文件资源域名(vite.config.ts 的 /download-proxy 代理目标;仅 localhost dev 走该改写,线上直连) */
5285
+ const isLocalhost = ["localhost", "127.0.0.1"].includes(window.location.hostname);
5286
+ /** 文档类预览 URL:线上直连完整文件域名(CORS 已放行);仅 localhost 开发环境改写为同域反代路径 */
5272
5287
  const previewUrl = computed(() => {
5273
5288
  if (!isDocKind.value) return props.url;
5274
- return props.url.startsWith(FILE_ORIGIN) ? FILE_PROXY_PREFIX + props.url.slice(26) : props.url;
5289
+ if (isLocalhost && props.url.startsWith(FILE_ORIGIN)) return FILE_PROXY_PREFIX + props.url.slice(26);
5290
+ return props.url;
5275
5291
  });
5276
5292
  /** @vue-office 可选组件懒加载器:kind → 动态 import(未安装/加载失败时 promise reject,由加载函数降级) */
5277
5293
  const OFFICE_LOADERS = {
@@ -5396,7 +5412,7 @@ var file_preview_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/*
5396
5412
  src: __props.url,
5397
5413
  controls: "",
5398
5414
  class: "h-full w-full bg-black rounded"
5399
- }, null, 8, _hoisted_1$9)) : isDocKind.value && !officeUnavailable.value ? (openBlock(), createBlock(unref(NSpin), {
5415
+ }, null, 8, _hoisted_1$7)) : isDocKind.value && !officeUnavailable.value ? (openBlock(), createBlock(unref(NSpin), {
5400
5416
  key: 2,
5401
5417
  show: loading.value,
5402
5418
  description: "文件资源加载中...",
@@ -5448,7 +5464,7 @@ var file_preview_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/*
5448
5464
  }, 8, ["description"])]))], 4);
5449
5465
  };
5450
5466
  }
5451
- }), [["__scopeId", "data-v-e50ab833"]]);
5467
+ }), [["__scopeId", "data-v-39ebb3af"]]);
5452
5468
  //#endregion
5453
5469
  //#region src/file-preview/file-preview-modal.vue
5454
5470
  var file_preview_modal_default = /* @__PURE__ */ defineComponent({
@@ -5508,7 +5524,7 @@ var file_preview_modal_default = /* @__PURE__ */ defineComponent({
5508
5524
  });
5509
5525
  //#endregion
5510
5526
  //#region src/timeline/FlowAvatar.vue?vue&type=script&setup=true&lang.ts
5511
- var _hoisted_1$8 = ["src", "alt"];
5527
+ var _hoisted_1$6 = ["src", "alt"];
5512
5528
  //#endregion
5513
5529
  //#region src/timeline/FlowAvatar.vue
5514
5530
  var FlowAvatar_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
@@ -5539,7 +5555,7 @@ var FlowAvatar_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @_
5539
5555
  class: "flow-avatar",
5540
5556
  src: __props.avatar,
5541
5557
  alt: __props.name
5542
- }, null, 8, _hoisted_1$8)) : (openBlock(), createElementBlock("span", {
5558
+ }, null, 8, _hoisted_1$6)) : (openBlock(), createElementBlock("span", {
5543
5559
  key: 1,
5544
5560
  class: "flow-avatar",
5545
5561
  style: normalizeStyle({ background: getAvatarColor(__props.name) })
@@ -5549,7 +5565,7 @@ var FlowAvatar_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @_
5549
5565
  }), [["__scopeId", "data-v-197c08a1"]]);
5550
5566
  //#endregion
5551
5567
  //#region src/timeline/FlowNode.vue?vue&type=script&setup=true&lang.ts
5552
- var _hoisted_1$7 = {
5568
+ var _hoisted_1$5 = {
5553
5569
  key: 1,
5554
5570
  class: "flow-node__time"
5555
5571
  };
@@ -5767,7 +5783,7 @@ var FlowNode_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__P
5767
5783
  key: 0,
5768
5784
  class: normalizeClass(["flow-node__radio", { "flow-node__radio--checked": isNodeSelected.value }])
5769
5785
  }, null, 2)) : createCommentVNode("", true),
5770
- __props.mode === "display" ? (openBlock(), createElementBlock("div", _hoisted_1$7, [(openBlock(true), createElementBlock(Fragment, null, renderList(timeParts.value, (part, i) => {
5786
+ __props.mode === "display" ? (openBlock(), createElementBlock("div", _hoisted_1$5, [(openBlock(true), createElementBlock(Fragment, null, renderList(timeParts.value, (part, i) => {
5771
5787
  return openBlock(), createElementBlock("span", { key: i }, toDisplayString(part), 1);
5772
5788
  }), 128))])) : createCommentVNode("", true),
5773
5789
  createElementVNode("div", { class: normalizeClass(["flow-node__badge", __props.mode === "display" ? `flow-node__badge--${__props.node.status}` : `flow-node__badge--form-${__props.node.type}`]) }, [__props.node.type === "end" ? (openBlock(), createElementBlock("div", _hoisted_2$5)) : __props.mode === "display" && __props.node.status === "done" && __props.node.users.length ? (openBlock(), createBlock(FlowAvatar_default, {
@@ -5899,257 +5915,108 @@ var FlowNode_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__P
5899
5915
  ], 6);
5900
5916
  };
5901
5917
  }
5902
- }), [["__scopeId", "data-v-c108c6cb"]]);
5918
+ }), [["__scopeId", "data-v-c730ebf8"]]);
5903
5919
  //#endregion
5904
- //#region src/timeline/ApprovalModal.vue?vue&type=script&setup=true&lang.ts
5905
- var _hoisted_1$6 = { class: "reject-node-list" };
5906
- var _hoisted_2$4 = {
5907
- key: 1,
5908
- style: { "opacity": "0.6" }
5920
+ //#region src/base-ui/base-card-item.vue?vue&type=script&setup=true&lang.ts
5921
+ var _hoisted_1$4 = { class: "header" };
5922
+ var _hoisted_2$4 = { class: "header-left" };
5923
+ var _hoisted_3$2 = { class: "title" };
5924
+ var _hoisted_4$2 = {
5925
+ key: 0,
5926
+ class: "subtitle"
5909
5927
  };
5928
+ var _hoisted_5$1 = { class: "header-right" };
5910
5929
  //#endregion
5911
- //#region src/timeline/ApprovalModal.vue
5912
- var ApprovalModal_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
5913
- name: "ApprovalModal",
5914
- __name: "ApprovalModal",
5915
- props: /* @__PURE__ */ mergeModels({
5916
- type: { default: "approve" },
5917
- nodes: { default: () => [] }
5918
- }, {
5919
- "visible": {
5920
- type: Boolean,
5921
- default: false
5922
- },
5923
- "visibleModifiers": {}
5924
- }),
5925
- emits: /* @__PURE__ */ mergeModels(["submitted"], ["update:visible"]),
5926
- setup(__props, { emit: __emit }) {
5930
+ //#region src/base-ui/base-card-item.vue
5931
+ var base_card_item_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
5932
+ name: "BaseCardItem",
5933
+ inheritAttrs: false,
5934
+ __name: "base-card-item",
5935
+ props: {
5936
+ title: { default: "" },
5937
+ subtitle: { default: "" },
5938
+ contentPadding: { default: 16 }
5939
+ },
5940
+ setup(__props) {
5927
5941
  const props = __props;
5928
- /** 弹窗标题:按审批类型区分;附件类型复用 file-upload 导出的 UploadResource */
5929
- const title = computed(() => props.type === "reject" ? "驳回意见" : "审批意见");
5930
- const emit = __emit;
5931
- const visible = useModel(__props, "visible");
5932
- const { formRef, validate, restoreValidation } = useNaiveForm();
5933
- const { createRequiredRule } = useFormRules();
5934
- const { components } = useFlowUI();
5935
- const model = reactive(createDefaultModel());
5936
- function createDefaultModel() {
5937
- return {
5938
- opinion: "",
5939
- attachments: [],
5940
- rejectTarget: null
5941
- };
5942
- }
5943
- /** 表单校验规则(驳回时:意见必填+需选择驳回节点;同意时:意见非必填) */
5944
- const rules = computed(() => {
5945
- const base = {};
5946
- if (props.type === "reject") {
5947
- base.opinion = createRequiredRule("请输入审批意见");
5948
- base.rejectTarget = createRequiredRule("请选择驳回节点");
5949
- }
5950
- return base;
5942
+ const slots = useSlots();
5943
+ const contentStyle = computed(() => ({ padding: typeof props.contentPadding === "number" ? `${props.contentPadding}px` : props.contentPadding }));
5944
+ const showHeader = computed(() => {
5945
+ return !!props.title || !!props.subtitle || !!slots["subtitle"] || !!slots["header-extra"];
5951
5946
  });
5952
- /**
5953
- * 驳回可选节点(仅驳回时计算,整节点重置只选节点):
5954
- * - 发起节点始终保留(驳回到发起人=拒绝整个申请)
5955
- * - 过滤未开始的节点
5956
- * - 过滤进行中且无「已完成本轮审批」人员的节点(节点下无历史审批记录则不可作驳回目标)
5957
- */
5958
- const filterNodes = computed(() => {
5959
- if (props.type !== "reject") return [];
5960
- return props.nodes.filter((node) => {
5961
- if (node.type === "end") return false;
5962
- if (node.type === "cc") return false;
5963
- if (node.type === "start") return true;
5964
- if (node.status === "pending") return false;
5965
- if (node.status === "doing") return node.users.some((user) => user.status === "done" && !user.pendingTask);
5966
- return true;
5947
+ return (_ctx, _cache) => {
5948
+ return openBlock(), createBlock(unref(NCard), mergeProps({
5949
+ class: "base-card-item base-card-item-spacing",
5950
+ "content-class": "base-card-item-content",
5951
+ "header-class": "base-card-item-header",
5952
+ "content-style": contentStyle.value
5953
+ }, _ctx.$attrs), createSlots({
5954
+ default: withCtx(() => [renderSlot(_ctx.$slots, "default", {}, void 0, true)]),
5955
+ _: 2
5956
+ }, [showHeader.value ? {
5957
+ name: "header",
5958
+ fn: withCtx(() => [createElementVNode("div", _hoisted_1$4, [createElementVNode("div", _hoisted_2$4, [createElementVNode("span", _hoisted_3$2, toDisplayString(__props.title), 1), renderSlot(_ctx.$slots, "subtitle", {}, () => [__props.subtitle ? (openBlock(), createElementBlock("span", _hoisted_4$2, toDisplayString(__props.subtitle), 1)) : createCommentVNode("", true)], true)]), createElementVNode("div", _hoisted_5$1, [renderSlot(_ctx.$slots, "header-extra", {}, void 0, true)])])]),
5959
+ key: "0"
5960
+ } : void 0]), 1040, ["content-style"]);
5961
+ };
5962
+ }
5963
+ }), [["__scopeId", "data-v-e9115957"]]);
5964
+ //#endregion
5965
+ //#region src/utils/common.ts
5966
+ /** 判断是否为空(undefined/null/空字符串) */
5967
+ function isNull(value) {
5968
+ return value === void 0 || value === null || value === "";
5969
+ }
5970
+ /** 时间格式化:兼容 10/13 位时间戳、字符串与 Date,空值返回 '--' */
5971
+ function formatTime(value, format = "YYYY-MM-DD HH:mm:ss") {
5972
+ if (value === null || value === void 0 || value === "" || value === 0) return "--";
5973
+ let timestamp = value;
5974
+ if (typeof value === "string") {
5975
+ const trimmed = value.trim();
5976
+ if (/^\d+$/.test(trimmed)) {
5977
+ const numValue = parseInt(trimmed, 10);
5978
+ if (trimmed.length === 10) timestamp = numValue * 1e3;
5979
+ else if (trimmed.length === 13) timestamp = numValue;
5980
+ else return dayjs(value).format(format);
5981
+ } else return dayjs(value).format(format);
5982
+ } else if (typeof value === "number") {
5983
+ if (value.toString().length === 10) timestamp = value * 1e3;
5984
+ }
5985
+ return dayjs(timestamp).format(format);
5986
+ }
5987
+ //#endregion
5988
+ //#region src/timeline/timeline-mapping.ts
5989
+ /** 固定尾节点:节点有数据时渲染追加(display 下状态按流程是否走完覆盖),接口返回与提交数据均不包含 */
5990
+ var END_NODE = {
5991
+ type: "end",
5992
+ name: "结束",
5993
+ desc: "流程结束",
5994
+ status: "pending",
5995
+ users: []
5996
+ };
5997
+ /** 人员处理记录映射:一行 records 对应一条展示记录(finished=0 未完成行过滤)——result 优先:result=2 同意;result=3 或 is_reject=1 驳回行按记录操作人判定方向(record.user_id=挂载人员 id 主动驳回「驳回到 rejecters.name」、否则被驳回「被 user_name 驳回」、名字均缺且 flowRejected=true 展示「驳回到 发起人」、否则「驳回」);result=0 不展示 */
5998
+ function toUserRecords(user, flowRejected) {
5999
+ const toFiles = (files) => files?.length ? files.map((file) => ({
6000
+ name: file.original_filename || file.file_name || "附件",
6001
+ url: file.url
6002
+ })) : void 0;
6003
+ const rows = [];
6004
+ (Array.isArray(user.records) ? user.records : []).forEach((record) => {
6005
+ if (record.finished === 0) return;
6006
+ const isSelf = record.user_id != null && String(record.user_id) === String(user.id);
6007
+ const rejectTo = isSelf ? record.rejecters?.name : void 0;
6008
+ const rejectBy = isSelf ? void 0 : record.user_name;
6009
+ const base = {
6010
+ time: record.assertion_time ? formatTime(record.assertion_time, "YYYY-MM-DD HH:mm") : void 0,
6011
+ opinion: record.suggest || void 0,
6012
+ attachments: toFiles(record.attachments)
6013
+ };
6014
+ if (record.result === 2) {
6015
+ rows.push({
6016
+ type: "approve",
6017
+ ...base
5967
6018
  });
5968
- });
5969
- /** 选择驳回目标:再次点击已选中项取消选择 */
5970
- function handleSelectTarget(key) {
5971
- model.rejectTarget = model.rejectTarget === key ? null : key;
5972
- }
5973
- /** 确认提交:校验通过后带出表单值并 emit submitted(携带 done 关闭回调,成功 done() 关闭 / 失败 done(false) 保持打开,由父组件决定);校验失败仅清空确认按钮 loading,弹窗保持打开 */
5974
- async function handleSubmit(close) {
5975
- try {
5976
- await validate();
5977
- } catch {
5978
- close(false);
5979
- return;
5980
- }
5981
- const payload = {
5982
- opinion: model.opinion,
5983
- attachments: [...model.attachments]
5984
- };
5985
- if (props.type === "reject" && model.rejectTarget) {
5986
- const targetNode = props.nodes.find((item) => (item.id ?? item.name) === model.rejectTarget);
5987
- payload.rejectNode = targetNode?.name;
5988
- payload.rejectNodeId = targetNode?.id;
5989
- }
5990
- emit("submitted", payload, close);
5991
- }
5992
- watch(visible, () => {
5993
- if (visible.value) {
5994
- Object.assign(model, createDefaultModel());
5995
- restoreValidation();
5996
- }
5997
- });
5998
- return (_ctx, _cache) => {
5999
- const _component_NFormItem = NFormItem;
6000
- const _component_NInput = NInput;
6001
- const _component_NForm = NForm;
6002
- return openBlock(), createBlock(base_modal_default, {
6003
- show: visible.value,
6004
- "onUpdate:show": _cache[2] || (_cache[2] = ($event) => visible.value = $event),
6005
- title: title.value,
6006
- preset: "card",
6007
- bordered: false,
6008
- "display-directive": "show",
6009
- "cancel-text": "取消",
6010
- class: "max-w-90% w-600px",
6011
- "on-before-confirm": handleSubmit
6012
- }, {
6013
- default: withCtx(() => [createVNode(_component_NForm, {
6014
- ref_key: "formRef",
6015
- ref: formRef,
6016
- model,
6017
- rules: rules.value,
6018
- "label-placement": "left",
6019
- "label-width": 80
6020
- }, {
6021
- default: withCtx(() => [
6022
- __props.type === "reject" ? (openBlock(), createBlock(_component_NFormItem, {
6023
- key: 0,
6024
- label: "驳回节点",
6025
- path: "rejectTarget"
6026
- }, {
6027
- default: withCtx(() => [createElementVNode("div", _hoisted_1$6, [(openBlock(true), createElementBlock(Fragment, null, renderList(filterNodes.value, (node) => {
6028
- return openBlock(), createBlock(FlowNode_default, {
6029
- key: node.id ?? node.name,
6030
- node,
6031
- mode: "select",
6032
- "selected-key": model.rejectTarget,
6033
- onSelect: handleSelectTarget
6034
- }, null, 8, ["node", "selected-key"]);
6035
- }), 128))])]),
6036
- _: 1
6037
- })) : createCommentVNode("", true),
6038
- createVNode(_component_NFormItem, {
6039
- label: "审批意见",
6040
- path: "opinion"
6041
- }, {
6042
- default: withCtx(() => [createVNode(_component_NInput, {
6043
- value: model.opinion,
6044
- "onUpdate:value": _cache[0] || (_cache[0] = ($event) => model.opinion = $event),
6045
- type: "textarea",
6046
- placeholder: "请输入审批意见",
6047
- maxlength: 200,
6048
- "show-count": "",
6049
- rows: 4
6050
- }, null, 8, ["value"])]),
6051
- _: 1
6052
- }),
6053
- createVNode(_component_NFormItem, {
6054
- label: "附件",
6055
- path: "attachments"
6056
- }, {
6057
- default: withCtx(() => [unref(components).FileUpload ? (openBlock(), createBlock(resolveDynamicComponent(unref(components).FileUpload), {
6058
- key: 0,
6059
- modelValue: model.attachments,
6060
- "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => model.attachments = $event),
6061
- "upload-type": "file",
6062
- drag: false,
6063
- accept: ".doc,.docx,.xls,.xlsx,.ppt,.pptx,.txt,.pdf,.zip,.rar,.7z,.jpg,.jpeg,.png,.gif,.bmp,.webp"
6064
- }, null, 8, ["modelValue"])) : (openBlock(), createElementBlock("div", _hoisted_2$4, "未注入附件上传组件(components.FileUpload),附件上传不可用"))]),
6065
- _: 1
6066
- })
6067
- ]),
6068
- _: 1
6069
- }, 8, ["model", "rules"])]),
6070
- _: 1
6071
- }, 8, ["show", "title"]);
6072
- };
6073
- }
6074
- }), [["__scopeId", "data-v-4d9540ab"]]);
6075
- //#endregion
6076
- //#region src/base-ui/base-card-item.vue?vue&type=script&setup=true&lang.ts
6077
- var _hoisted_1$5 = { class: "header" };
6078
- var _hoisted_2$3 = { class: "header-left" };
6079
- var _hoisted_3$2 = { class: "title" };
6080
- var _hoisted_4$2 = {
6081
- key: 0,
6082
- class: "subtitle"
6083
- };
6084
- var _hoisted_5$1 = { class: "header-right" };
6085
- //#endregion
6086
- //#region src/base-ui/base-card-item.vue
6087
- var base_card_item_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
6088
- name: "BaseCardItem",
6089
- inheritAttrs: false,
6090
- __name: "base-card-item",
6091
- props: {
6092
- title: { default: "" },
6093
- subtitle: { default: "" },
6094
- contentPadding: { default: 16 }
6095
- },
6096
- setup(__props) {
6097
- const props = __props;
6098
- const slots = useSlots();
6099
- const contentStyle = computed(() => ({ padding: typeof props.contentPadding === "number" ? `${props.contentPadding}px` : props.contentPadding }));
6100
- const showHeader = computed(() => {
6101
- return !!props.title || !!props.subtitle || !!slots["subtitle"] || !!slots["header-extra"];
6102
- });
6103
- return (_ctx, _cache) => {
6104
- return openBlock(), createBlock(unref(NCard), mergeProps({
6105
- class: "base-card-item base-card-item-spacing",
6106
- "content-class": "base-card-item-content",
6107
- "header-class": "base-card-item-header",
6108
- "content-style": contentStyle.value
6109
- }, _ctx.$attrs), createSlots({
6110
- default: withCtx(() => [renderSlot(_ctx.$slots, "default", {}, void 0, true)]),
6111
- _: 2
6112
- }, [showHeader.value ? {
6113
- name: "header",
6114
- fn: withCtx(() => [createElementVNode("div", _hoisted_1$5, [createElementVNode("div", _hoisted_2$3, [createElementVNode("span", _hoisted_3$2, toDisplayString(__props.title), 1), renderSlot(_ctx.$slots, "subtitle", {}, () => [__props.subtitle ? (openBlock(), createElementBlock("span", _hoisted_4$2, toDisplayString(__props.subtitle), 1)) : createCommentVNode("", true)], true)]), createElementVNode("div", _hoisted_5$1, [renderSlot(_ctx.$slots, "header-extra", {}, void 0, true)])])]),
6115
- key: "0"
6116
- } : void 0]), 1040, ["content-style"]);
6117
- };
6118
- }
6119
- }), [["__scopeId", "data-v-e9115957"]]);
6120
- //#endregion
6121
- //#region src/timeline/timeline-mapping.ts
6122
- /** 固定尾节点:节点有数据时渲染追加(display 下状态按流程是否走完覆盖),接口返回与提交数据均不包含 */
6123
- var END_NODE = {
6124
- type: "end",
6125
- name: "结束",
6126
- desc: "流程结束",
6127
- status: "pending",
6128
- users: []
6129
- };
6130
- /** 人员处理记录映射:一行 records 对应一条展示记录(finished=0 未完成行过滤)——result 优先:result=2 同意;result=3 或 is_reject=1 驳回行按记录操作人判定方向(record.user_id=挂载人员 id 主动驳回「驳回到 rejecters.name」、否则被驳回「被 user_name 驳回」、名字均缺且 flowRejected=true 展示「驳回到 发起人」、否则「驳回」);result=0 不展示 */
6131
- function toUserRecords(user, flowRejected) {
6132
- const toFiles = (files) => files?.length ? files.map((file) => ({
6133
- name: file.original_filename || file.file_name || "附件",
6134
- url: file.url
6135
- })) : void 0;
6136
- const rows = [];
6137
- (Array.isArray(user.records) ? user.records : []).forEach((record) => {
6138
- if (record.finished === 0) return;
6139
- const isSelf = record.user_id != null && String(record.user_id) === String(user.id);
6140
- const rejectTo = isSelf ? record.rejecters?.name : void 0;
6141
- const rejectBy = isSelf ? void 0 : record.user_name;
6142
- const base = {
6143
- time: record.assertion_time ? formatTime(record.assertion_time, "YYYY-MM-DD HH:mm") : void 0,
6144
- opinion: record.suggest || void 0,
6145
- attachments: toFiles(record.attachments)
6146
- };
6147
- if (record.result === 2) {
6148
- rows.push({
6149
- type: "approve",
6150
- ...base
6151
- });
6152
- return;
6019
+ return;
6153
6020
  }
6154
6021
  if (record.is_reject !== 1 && record.result !== 3) return;
6155
6022
  rows.push({
@@ -6167,7 +6034,7 @@ function isLatestRowsReject(rows) {
6167
6034
  const latest = rows.reduce((acc, cur) => (cur.assertion_time ?? 0) >= (acc.assertion_time ?? 0) ? cur : acc, rows[0]);
6168
6035
  return latest.result === 3 || latest.is_reject === 1;
6169
6036
  }
6170
- /** display 模式审批时间线映射:节点快照直接映射 FlowNodeItem——发起人节点独立判定:流程被驳回到发起人(finished=1 且 status=-1)标红、其余一律完成绿色;其余节点按实例 finished、节点自带 finished(1=已完成)推导:进行中节点优先取第一个「未完成且 status=1 待处理」的节点,无激活节点时兜底认第一个存在待处理任务行(users.records 中 result=0 且 finished=0)的节点为当前节点,仍无则回退第一个未完成节点,有激活/兜底节点时其后节点一律待开始(剥离上一轮残留),流程被驳回终止时其余节点一律灰色待开始;人员状态按本人最新一条操作记录展示(已处理记录 result=2/3 或 is_reject=1 中 assertion_time 最新一条:驳回标红、同意标绿),无操作记录随节点状态(进行中节点淡黄、其余灰色未处理) */
6037
+ /** display 模式审批时间线映射:节点快照直接映射 FlowNodeItem——发起人节点独立判定:一律完成绿色(不随流程被驳回到发起人变化,驳回到发起人(finished=1 且 status=-1)也不再标红);其余节点按实例 finished、节点自带 finished(1=已完成)推导:进行中节点优先取第一个「未完成且 status=1 待处理」的节点,无激活节点时兜底认第一个存在待处理任务行(users.records 中 result=0 且 finished=0)的节点为当前节点,仍无则回退第一个未完成节点,有激活/兜底节点时其后节点一律待开始(剥离上一轮残留),流程被驳回终止时其余节点一律灰色待开始;人员状态按本人最新一条操作记录展示(已处理记录 result=2/3 或 is_reject=1 中 assertion_time 最新一条:驳回标红、同意标绿;发起人节点人员固定成功绿色),无操作记录随节点状态(进行中节点淡黄、其余灰色未处理) */
6171
6038
  function mapTimelineNodes(data) {
6172
6039
  const d = data;
6173
6040
  if (!d?.nodes?.length) return [];
@@ -6178,13 +6045,13 @@ function mapTimelineNodes(data) {
6178
6045
  const currentIndex = activeIndex > -1 ? activeIndex : pendingIndex > -1 ? pendingIndex : instanceFinished ? -1 : d.nodes.findIndex((item) => item.finished !== 1);
6179
6046
  return d.nodes.map((node, index) => {
6180
6047
  const forcePending = !instanceFinished && (activeIndex > -1 || pendingIndex > -1) && index > currentIndex;
6181
- const nodeStatus = node.type === "start" ? instanceRejected ? "rejected" : "done" : instanceRejected ? "pending" : forcePending ? "pending" : !instanceFinished && index === currentIndex ? "doing" : instanceFinished || node.finished === 1 || currentIndex > -1 && index < currentIndex ? "done" : "pending";
6048
+ const nodeStatus = node.type === "start" ? "done" : instanceRejected ? "pending" : forcePending ? "pending" : !instanceFinished && index === currentIndex ? "doing" : instanceFinished || node.finished === 1 || currentIndex > -1 && index < currentIndex ? "done" : "pending";
6182
6049
  const users = node.users.map((user) => {
6183
6050
  const records = toUserRecords(user, instanceRejected);
6184
6051
  const rawRows = Array.isArray(user.records) ? user.records : [];
6185
6052
  const hasPendingRow = rawRows.some((record) => record.result === 0 && record.finished === 0);
6186
6053
  const processedRows = rawRows.filter((record) => record.result === 2 || record.result === 3 || record.is_reject === 1);
6187
- const status = hasPendingRow ? nodeStatus === "doing" ? "doing" : "pending" : processedRows.length ? isLatestRowsReject(processedRows) ? "rejected" : "done" : nodeStatus === "doing" ? "doing" : nodeStatus === "done" && node.mode === "orsign" ? "pending" : nodeStatus;
6054
+ const status = node.type === "start" ? "done" : hasPendingRow ? nodeStatus === "doing" ? "doing" : "pending" : processedRows.length ? isLatestRowsReject(processedRows) ? "rejected" : "done" : nodeStatus === "doing" ? "doing" : nodeStatus === "done" && node.mode === "orsign" ? "pending" : nodeStatus;
6188
6055
  return {
6189
6056
  id: user.id,
6190
6057
  name: user.name,
@@ -6199,7 +6066,7 @@ function mapTimelineNodes(data) {
6199
6066
  status: nodeStatus,
6200
6067
  name: node.name,
6201
6068
  desc: node.desc ?? void 0,
6202
- time: node.created_time && (node.finished === 1 || nodeStatus === "done" || nodeStatus === "rejected") ? formatTime(node.created_time, "YYYY-MM-DD HH:mm") : void 0,
6069
+ time: node.created_time && (node.finished === 1 || nodeStatus === "done") ? formatTime(node.created_time, "YYYY-MM-DD HH:mm") : void 0,
6203
6070
  mode: node.mode,
6204
6071
  selfSelect: node.selfSelect,
6205
6072
  users
@@ -6233,8 +6100,8 @@ function getFlowStatusTag(mode, data) {
6233
6100
  }
6234
6101
  //#endregion
6235
6102
  //#region src/timeline/FlowNodesPanel.vue?vue&type=script&setup=true&lang.ts
6236
- var _hoisted_1$4 = { class: "flow-node__title" };
6237
- var _hoisted_2$2 = { class: "flow-node__list" };
6103
+ var _hoisted_1$3 = { class: "flow-node__title" };
6104
+ var _hoisted_2$3 = { class: "flow-node__list" };
6238
6105
  //#endregion
6239
6106
  //#region src/timeline/FlowNodesPanel.vue
6240
6107
  var FlowNodesPanel_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
@@ -6279,7 +6146,7 @@ var FlowNodesPanel_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/
6279
6146
  "default-expanded-names": ["flow"]
6280
6147
  }, {
6281
6148
  default: withCtx(() => [createVNode(_component_NCollapseItem, { name: "flow" }, {
6282
- header: withCtx(() => [createElementVNode("span", _hoisted_1$4, [createTextVNode(toDisplayString(__props.title) + " ", 1), panelStatusTag.value ? (openBlock(), createBlock(_component_NTag, {
6149
+ header: withCtx(() => [createElementVNode("span", _hoisted_1$3, [createTextVNode(toDisplayString(__props.title) + " ", 1), panelStatusTag.value ? (openBlock(), createBlock(_component_NTag, {
6283
6150
  key: 0,
6284
6151
  type: panelStatusTag.value.type,
6285
6152
  size: "small"
@@ -6291,7 +6158,7 @@ var FlowNodesPanel_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/
6291
6158
  show: __props.loading,
6292
6159
  class: "w-full"
6293
6160
  }, {
6294
- default: withCtx(() => [createElementVNode("div", _hoisted_2$2, [(openBlock(true), createElementBlock(Fragment, null, renderList(panelNodes.value, (node) => {
6161
+ default: withCtx(() => [createElementVNode("div", _hoisted_2$3, [(openBlock(true), createElementBlock(Fragment, null, renderList(panelNodes.value, (node) => {
6295
6162
  return openBlock(), createBlock(FlowNode_default, {
6296
6163
  key: node.id ?? node.name,
6297
6164
  "selected-users": selectedUsersMap.value[node.name],
@@ -6320,267 +6187,217 @@ var FlowNodesPanel_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/
6320
6187
  }
6321
6188
  }), [["__scopeId", "data-v-25e5146e"]]);
6322
6189
  //#endregion
6323
- //#region src/base-ui/yg-confirm.vue?vue&type=script&setup=true&lang.ts
6324
- var _hoisted_1$3 = { class: "yg-confirm" };
6325
- //#endregion
6326
- //#region src/base-ui/yg-confirm.vue
6327
- var yg_confirm_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
6328
- name: "YgConfirm",
6329
- __name: "yg-confirm",
6330
- props: {
6331
- triggerType: { default: "button" },
6332
- title: { default: "提示" },
6333
- content: { default: "确定要执行此操作吗?" },
6334
- positiveText: { default: "确定" },
6335
- negativeText: { default: "取消" },
6336
- buttonConfig: { default: () => ({}) },
6337
- switchConfig: { default: () => ({}) },
6338
- modelValue: { default: false },
6339
- modalProps: { default: () => ({}) },
6340
- sync: {
6341
- type: Boolean,
6342
- default: false
6343
- }
6344
- },
6345
- emits: [
6346
- "update:modelValue",
6347
- "confirm",
6348
- "cancel"
6349
- ],
6350
- setup(__props, { expose: __expose, emit: __emit }) {
6351
- const props = __props;
6352
- const emit = __emit;
6353
- const modalVisible = ref(false);
6354
- const loading = ref(false);
6355
- const pendingSwitchValue = ref(null);
6356
- const switchValue = computed({
6357
- get: () => props.modelValue,
6358
- set: (value) => emit("update:modelValue", value)
6359
- });
6360
- const buttonProps = computed(() => ({
6361
- ...props.buttonConfig,
6362
- disabled: props.buttonConfig.disabled || loading.value && modalVisible.value
6363
- }));
6364
- const switchProps = computed(() => props.switchConfig);
6365
- watch(modalVisible, (val) => {
6366
- if (!val) loading.value = false;
6367
- });
6368
- function handleOpen() {
6369
- if (!loading.value) modalVisible.value = true;
6370
- }
6371
- function handleSwitchClick(value) {
6372
- if (loading.value) return;
6373
- pendingSwitchValue.value = value;
6374
- modalVisible.value = true;
6375
- }
6376
- function handleConfirm() {
6377
- if (loading.value) return false;
6378
- if (props.sync) {
6379
- const confirmValue = pendingSwitchValue.value;
6380
- if (props.triggerType === "switch" && pendingSwitchValue.value !== null) {
6381
- switchValue.value = pendingSwitchValue.value;
6382
- pendingSwitchValue.value = null;
6190
+ //#region src/composables/form.ts
6191
+ var invalidLiterals = [
6192
+ "null",
6193
+ "undefined",
6194
+ "nan",
6195
+ "nil",
6196
+ "none"
6197
+ ];
6198
+ function useFormRules() {
6199
+ function createRequiredRule(message) {
6200
+ return {
6201
+ required: true,
6202
+ trigger: ["input", "blur"],
6203
+ validator: (_rule, value) => {
6204
+ if (isNull(value) || typeof value === "string" && value.trim() === "" || Array.isArray(value) && value.length === 0) return new Error(message);
6205
+ if (typeof value === "string") {
6206
+ const trimmed = value.trim().toLowerCase();
6207
+ if (invalidLiterals.includes(trimmed)) return /* @__PURE__ */ new Error(`内容不可为 ${trimmed}`);
6383
6208
  }
6384
- emit("confirm", confirmValue, () => {});
6385
6209
  return true;
6386
6210
  }
6387
- loading.value = true;
6388
- const done = (shouldClose = true) => {
6389
- loading.value = false;
6390
- if (shouldClose) {
6391
- modalVisible.value = false;
6392
- if (props.triggerType === "switch" && pendingSwitchValue.value !== null) {
6393
- switchValue.value = pendingSwitchValue.value;
6394
- pendingSwitchValue.value = null;
6395
- }
6396
- }
6397
- };
6398
- emit("confirm", pendingSwitchValue.value, done);
6399
- return false;
6400
- }
6401
- function handleCancel() {
6402
- pendingSwitchValue.value = null;
6403
- emit("cancel");
6404
- }
6405
- __expose({
6406
- open: handleOpen,
6407
- close: () => {
6408
- modalVisible.value = false;
6409
- }
6410
- });
6411
- return (_ctx, _cache) => {
6412
- return openBlock(), createElementBlock("div", _hoisted_1$3, [__props.triggerType === "button" ? (openBlock(), createBlock(unref(NButton), mergeProps({ key: 0 }, buttonProps.value, { onClick: handleOpen }), createSlots({
6413
- default: withCtx(() => [renderSlot(_ctx.$slots, "default", {}, void 0, true)]),
6414
- _: 2
6415
- }, [_ctx.$slots.icon ? {
6416
- name: "icon",
6417
- fn: withCtx(() => [renderSlot(_ctx.$slots, "icon", {}, void 0, true)]),
6418
- key: "0"
6419
- } : void 0]), 1040)) : __props.triggerType === "switch" ? (openBlock(), createBlock(unref(NSwitch), mergeProps({
6420
- key: 1,
6421
- value: switchValue.value,
6422
- loading: loading.value
6423
- }, switchProps.value, { "onUpdate:value": handleSwitchClick }), null, 16, ["value", "loading"])) : __props.triggerType === "custom" ? renderSlot(_ctx.$slots, "trigger", {
6424
- key: 2,
6425
- loading: loading.value,
6426
- open: handleOpen
6427
- }, void 0, true) : createCommentVNode("", true), createVNode(unref(NModal), mergeProps({
6428
- show: modalVisible.value,
6429
- "onUpdate:show": _cache[0] || (_cache[0] = ($event) => modalVisible.value = $event),
6430
- preset: "dialog",
6431
- type: "warning",
6432
- title: __props.title,
6433
- "positive-text": __props.positiveText,
6434
- "negative-text": __props.negativeText,
6435
- "positive-button-props": { loading: loading.value }
6436
- }, __props.modalProps, {
6437
- "checked-value": "0",
6438
- "unchecked-value": "1",
6439
- onPositiveClick: handleConfirm,
6440
- onNegativeClick: handleCancel
6441
- }), {
6442
- default: withCtx(() => [createTextVNode(toDisplayString(__props.content) + " ", 1), renderSlot(_ctx.$slots, "content", {}, void 0, true)]),
6443
- _: 3
6444
- }, 16, [
6445
- "show",
6446
- "title",
6447
- "positive-text",
6448
- "negative-text",
6449
- "positive-button-props"
6450
- ])]);
6451
6211
  };
6452
6212
  }
6453
- }), [["__scopeId", "data-v-a65cb6d5"]]);
6213
+ return { createRequiredRule };
6214
+ }
6215
+ function useNaiveForm() {
6216
+ const formRef = ref(null);
6217
+ async function validate() {
6218
+ await formRef.value?.validate();
6219
+ }
6220
+ async function restoreValidation() {
6221
+ formRef.value?.restoreValidation();
6222
+ }
6223
+ return {
6224
+ formRef,
6225
+ validate,
6226
+ restoreValidation
6227
+ };
6228
+ }
6454
6229
  //#endregion
6455
- //#region src/base-ui/base-card.vue?vue&type=script&setup=true&lang.ts
6456
- var _hoisted_1$2 = {
6457
- key: 0,
6458
- class: "base-card-footer"
6230
+ //#region src/timeline/ApprovalModal.vue?vue&type=script&setup=true&lang.ts
6231
+ var _hoisted_1$2 = { class: "reject-node-list" };
6232
+ var _hoisted_2$2 = {
6233
+ key: 1,
6234
+ style: { "opacity": "0.6" }
6459
6235
  };
6460
6236
  //#endregion
6461
- //#region src/base-ui/base-card.vue
6462
- var base_card_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
6463
- name: "BaseCard",
6464
- inheritAttrs: false,
6465
- __name: "base-card",
6466
- props: {
6467
- title: { default: "" },
6468
- subtitle: { default: "" },
6469
- loading: {
6237
+ //#region src/timeline/ApprovalModal.vue
6238
+ var ApprovalModal_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
6239
+ name: "ApprovalModal",
6240
+ __name: "ApprovalModal",
6241
+ props: /* @__PURE__ */ mergeModels({
6242
+ type: { default: "approve" },
6243
+ nodes: { default: () => [] }
6244
+ }, {
6245
+ "visible": {
6470
6246
  type: Boolean,
6471
6247
  default: false
6472
6248
  },
6473
- cancelConfig: { default: () => ({
6474
- show: true,
6475
- text: "取消",
6476
- props: {},
6477
- doubleConfirm: false,
6478
- doubleConfirmTitle: "确认取消",
6479
- doubleConfirmContent: "确定要取消吗?"
6480
- }) },
6481
- confirmConfig: { default: () => ({
6482
- show: true,
6483
- text: "确认",
6484
- props: { type: "primary" },
6485
- doubleConfirm: false,
6486
- doubleConfirmTitle: "确认操作",
6487
- doubleConfirmContent: "确定要执行此操作吗?"
6488
- }) },
6489
- onBeforeCancel: {
6490
- type: Function,
6491
- default: void 0
6492
- },
6493
- onBeforeConfirm: {
6494
- type: Function,
6495
- default: void 0
6496
- }
6497
- },
6498
- emits: ["cancel", "confirm"],
6249
+ "visibleModifiers": {}
6250
+ }),
6251
+ emits: /* @__PURE__ */ mergeModels(["submitted"], ["update:visible"]),
6499
6252
  setup(__props, { emit: __emit }) {
6500
6253
  const props = __props;
6501
- props.title;
6502
- props.subtitle;
6254
+ /** 弹窗标题:按审批类型区分;附件类型复用 file-upload 导出的 UploadResource */
6255
+ const title = computed(() => props.type === "reject" ? "驳回意见" : "审批意见");
6503
6256
  const emit = __emit;
6504
- const confirmLoading = ref(false);
6505
- function done() {
6506
- confirmLoading.value = false;
6257
+ const visible = useModel(__props, "visible");
6258
+ const { formRef, validate, restoreValidation } = useNaiveForm();
6259
+ const { createRequiredRule } = useFormRules();
6260
+ const { components } = useFlowUI();
6261
+ const model = reactive(createDefaultModel());
6262
+ function createDefaultModel() {
6263
+ return {
6264
+ opinion: "",
6265
+ attachments: [],
6266
+ rejectTarget: null
6267
+ };
6507
6268
  }
6508
- function handleCancel() {
6509
- if (props.onBeforeCancel) props.onBeforeCancel();
6510
- else emit("cancel");
6269
+ /** 表单校验规则(驳回时:意见必填+需选择驳回节点;同意时:意见非必填) */
6270
+ const rules = computed(() => {
6271
+ const base = {};
6272
+ if (props.type === "reject") {
6273
+ base.opinion = createRequiredRule("请输入审批意见");
6274
+ base.rejectTarget = createRequiredRule("请选择驳回节点");
6275
+ }
6276
+ return base;
6277
+ });
6278
+ /**
6279
+ * 驳回可选节点(仅驳回时计算,整节点重置只选节点):
6280
+ * - 发起节点始终保留(驳回到发起人=拒绝整个申请)
6281
+ * - 过滤未开始的节点
6282
+ * - 过滤进行中且无「已完成本轮审批」人员的节点(节点下无历史审批记录则不可作驳回目标)
6283
+ */
6284
+ const filterNodes = computed(() => {
6285
+ if (props.type !== "reject") return [];
6286
+ return props.nodes.filter((node) => {
6287
+ if (node.type === "end") return false;
6288
+ if (node.type === "cc") return false;
6289
+ if (node.type === "start") return true;
6290
+ if (node.status === "pending") return false;
6291
+ if (node.status === "doing") return node.users.some((user) => user.status === "done" && !user.pendingTask);
6292
+ return true;
6293
+ });
6294
+ });
6295
+ /** 选择驳回目标:再次点击已选中项取消选择 */
6296
+ function handleSelectTarget(key) {
6297
+ model.rejectTarget = model.rejectTarget === key ? null : key;
6511
6298
  }
6512
- function handleConfirm() {
6513
- if (props.onBeforeConfirm) {
6514
- confirmLoading.value = true;
6515
- props.onBeforeConfirm(done);
6516
- } else emit("confirm");
6299
+ /** 确认提交:校验通过后带出表单值并 emit submitted(携带 done 关闭回调,成功 done() 关闭 / 失败 done(false) 保持打开,由父组件决定);校验失败仅清空确认按钮 loading,弹窗保持打开 */
6300
+ async function handleSubmit(close) {
6301
+ try {
6302
+ await validate();
6303
+ } catch {
6304
+ close(false);
6305
+ return;
6306
+ }
6307
+ const payload = {
6308
+ opinion: model.opinion,
6309
+ attachments: [...model.attachments]
6310
+ };
6311
+ if (props.type === "reject" && model.rejectTarget) {
6312
+ const targetNode = props.nodes.find((item) => (item.id ?? item.name) === model.rejectTarget);
6313
+ payload.rejectNode = targetNode?.name;
6314
+ payload.rejectNodeId = targetNode?.id;
6315
+ }
6316
+ emit("submitted", payload, close);
6517
6317
  }
6518
- const slots = useSlots();
6519
- const showFooter = computed(() => !!slots.footer || !!slots["footer-extra"] || !!slots["footer-center"] || props.cancelConfig?.show || props.confirmConfig?.show);
6318
+ watch(visible, () => {
6319
+ if (visible.value) {
6320
+ Object.assign(model, createDefaultModel());
6321
+ restoreValidation();
6322
+ }
6323
+ });
6520
6324
  return (_ctx, _cache) => {
6521
- return openBlock(), createBlock(unref(NEl), { class: "base-card-wrapper" }, {
6522
- default: withCtx(() => [createVNode(unref(NSpin), {
6523
- show: __props.loading,
6524
- class: "base-card-content"
6325
+ const _component_NFormItem = NFormItem;
6326
+ const _component_NInput = NInput;
6327
+ const _component_NForm = NForm;
6328
+ return openBlock(), createBlock(base_modal_default, {
6329
+ show: visible.value,
6330
+ "onUpdate:show": _cache[2] || (_cache[2] = ($event) => visible.value = $event),
6331
+ title: title.value,
6332
+ preset: "card",
6333
+ bordered: false,
6334
+ "display-directive": "show",
6335
+ "cancel-text": "取消",
6336
+ class: "max-w-90% w-600px",
6337
+ "on-before-confirm": handleSubmit
6338
+ }, {
6339
+ default: withCtx(() => [createVNode(_component_NForm, {
6340
+ ref_key: "formRef",
6341
+ ref: formRef,
6342
+ model,
6343
+ rules: rules.value,
6344
+ "label-placement": "left",
6345
+ "label-width": 80
6525
6346
  }, {
6526
- default: withCtx(() => [renderSlot(_ctx.$slots, "default", {}, void 0, true)]),
6527
- _: 3
6528
- }, 8, ["show"]), showFooter.value ? (openBlock(), createElementBlock("div", _hoisted_1$2, [renderSlot(_ctx.$slots, "footer", {}, () => [createVNode(unref(NSpace), { size: 12 }, {
6529
6347
  default: withCtx(() => [
6530
- renderSlot(_ctx.$slots, "footer-extra", {}, void 0, true),
6531
- __props.cancelConfig?.show && __props.cancelConfig?.doubleConfirm ? (openBlock(), createBlock(yg_confirm_default, {
6348
+ __props.type === "reject" ? (openBlock(), createBlock(_component_NFormItem, {
6532
6349
  key: 0,
6533
- title: __props.cancelConfig.doubleConfirmTitle,
6534
- content: __props.cancelConfig.doubleConfirmContent,
6535
- "positive-text": __props.cancelConfig.text,
6536
- "button-config": __props.cancelConfig.props,
6537
- onConfirm: handleCancel
6350
+ label: "驳回节点",
6351
+ path: "rejectTarget"
6538
6352
  }, {
6539
- default: withCtx(() => [createTextVNode(toDisplayString(__props.cancelConfig.text), 1)]),
6540
- _: 1
6541
- }, 8, [
6542
- "title",
6543
- "content",
6544
- "positive-text",
6545
- "button-config"
6546
- ])) : __props.cancelConfig?.show ? (openBlock(), createBlock(unref(NButton), mergeProps({ key: 1 }, __props.cancelConfig.props, { onClick: handleCancel }), {
6547
- default: withCtx(() => [createTextVNode(toDisplayString(__props.cancelConfig.text), 1)]),
6353
+ default: withCtx(() => [createElementVNode("div", _hoisted_1$2, [(openBlock(true), createElementBlock(Fragment, null, renderList(filterNodes.value, (node) => {
6354
+ return openBlock(), createBlock(FlowNode_default, {
6355
+ key: node.id ?? node.name,
6356
+ node,
6357
+ mode: "select",
6358
+ "selected-key": model.rejectTarget,
6359
+ onSelect: handleSelectTarget
6360
+ }, null, 8, ["node", "selected-key"]);
6361
+ }), 128))])]),
6548
6362
  _: 1
6549
- }, 16)) : createCommentVNode("", true),
6550
- renderSlot(_ctx.$slots, "footer-center", {}, void 0, true),
6551
- __props.confirmConfig?.show && __props.confirmConfig?.doubleConfirm ? (openBlock(), createBlock(yg_confirm_default, {
6552
- key: 2,
6553
- title: __props.confirmConfig.doubleConfirmTitle,
6554
- content: __props.confirmConfig.doubleConfirmContent,
6555
- "positive-text": __props.confirmConfig.text,
6556
- "button-config": {
6557
- ...__props.confirmConfig.props,
6558
- loading: confirmLoading.value
6559
- },
6560
- onConfirm: handleConfirm
6363
+ })) : createCommentVNode("", true),
6364
+ createVNode(_component_NFormItem, {
6365
+ label: "审批意见",
6366
+ path: "opinion"
6561
6367
  }, {
6562
- default: withCtx(() => [createTextVNode(toDisplayString(__props.confirmConfig.text), 1)]),
6368
+ default: withCtx(() => [createVNode(_component_NInput, {
6369
+ value: model.opinion,
6370
+ "onUpdate:value": _cache[0] || (_cache[0] = ($event) => model.opinion = $event),
6371
+ type: "textarea",
6372
+ placeholder: "请输入审批意见",
6373
+ maxlength: 200,
6374
+ "show-count": "",
6375
+ rows: 4
6376
+ }, null, 8, ["value"])]),
6563
6377
  _: 1
6564
- }, 8, [
6565
- "title",
6566
- "content",
6567
- "positive-text",
6568
- "button-config"
6569
- ])) : __props.confirmConfig?.show ? (openBlock(), createBlock(unref(NButton), mergeProps({
6570
- key: 3,
6571
- loading: confirmLoading.value
6572
- }, __props.confirmConfig.props, { onClick: handleConfirm }), {
6573
- default: withCtx(() => [createTextVNode(toDisplayString(__props.confirmConfig.text), 1)]),
6378
+ }),
6379
+ createVNode(_component_NFormItem, {
6380
+ label: "附件",
6381
+ path: "attachments"
6382
+ }, {
6383
+ default: withCtx(() => [unref(components).FileUpload ? (openBlock(), createBlock(resolveDynamicComponent(unref(components).FileUpload), {
6384
+ key: 0,
6385
+ modelValue: model.attachments,
6386
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => model.attachments = $event),
6387
+ "upload-type": "file",
6388
+ drag: false,
6389
+ accept: ".doc,.docx,.xls,.xlsx,.ppt,.pptx,.txt,.pdf,.zip,.rar,.7z,.jpg,.jpeg,.png,.gif,.bmp,.webp"
6390
+ }, null, 8, ["modelValue"])) : (openBlock(), createElementBlock("div", _hoisted_2$2, "未注入附件上传组件(components.FileUpload),附件上传不可用"))]),
6574
6391
  _: 1
6575
- }, 16, ["loading"])) : createCommentVNode("", true)
6392
+ })
6576
6393
  ]),
6577
- _: 3
6578
- })], true)])) : createCommentVNode("", true)]),
6579
- _: 3
6580
- });
6394
+ _: 1
6395
+ }, 8, ["model", "rules"])]),
6396
+ _: 1
6397
+ }, 8, ["show", "title"]);
6581
6398
  };
6582
6399
  }
6583
- }), [["__scopeId", "data-v-956107d8"]]);
6400
+ }), [["__scopeId", "data-v-4d9540ab"]]);
6584
6401
  //#endregion
6585
6402
  //#region src/adapter/wflow.ts
6586
6403
  /** 获取流程配置详情(GET /wflow/config/{config_id}) */
@@ -6623,42 +6440,27 @@ function fetchWflowUndoReject(data) {
6623
6440
  });
6624
6441
  }
6625
6442
  //#endregion
6626
- //#region src/timeline/FlowLayout.vue
6627
- var FlowLayout_default = /* @__PURE__ */ defineComponent({
6628
- name: "FlowLayout",
6629
- __name: "FlowLayout",
6443
+ //#region src/timeline/FlowActions.vue
6444
+ var FlowActions_default = /* @__PURE__ */ defineComponent({
6445
+ name: "FlowActions",
6446
+ __name: "FlowActions",
6630
6447
  props: {
6631
- loading: { type: Boolean },
6632
- flowId: {},
6633
- mode: {},
6634
- beforeSubmit: {},
6635
- getFormData: {},
6636
- timelineData: {},
6448
+ data: {},
6637
6449
  approval: {
6638
6450
  type: Boolean,
6639
6451
  default: true
6640
6452
  }
6641
6453
  },
6642
- emits: [
6643
- "success",
6644
- "close",
6645
- "submitted"
6646
- ],
6647
- setup(__props, { expose: __expose, emit: __emit }) {
6454
+ emits: ["success"],
6455
+ setup(__props, { emit: __emit }) {
6456
+ /** 操作按钮组件 props */
6457
+ const props = __props;
6648
6458
  /** 审批处理成功(同意/驳回接口调用成功) */
6649
6459
  const emit = __emit;
6650
- /** 页面加载状态(透传给 BaseCard,控制内容区 loading 遮罩);flowId=流程 ID(display 模式传流程实例 ID 仅作标识,同意/驳回接口入参为详情返回的 undo_id;form 模式作为提交数据 flow_id) */
6651
- const props = __props;
6652
- /** 是否展示操作按钮:form 模式恒展示;display 模式审批模式且 undo_finished=0(未处理)才展示,详情未加载/已处理/纯查看均隐藏 */
6653
- const canOperate = computed(() => props.mode === "form" || props.approval !== false && props.timelineData?.undo_finished === 0);
6654
- /** 是否展示驳回操作:仅 display 模式审批模式(approval 未传或 true)且 undo_finished=0(未处理);form 发起模式/纯查看无驳回 */
6655
- const canReject = computed(() => props.mode !== "form" && props.approval !== false && props.timelineData?.undo_finished === 0);
6656
- /** 折叠面板标题流程状态标签:仅 display 模式展示,颜色映射 已同意=success / 已拒绝=error / 进行中=warning */
6657
- const flowStatusTag = computed(() => getFlowStatusTag(props.mode, props.timelineData));
6658
- /** 关闭:通知消费页(display=关闭详情页,form=取消发起);页签关闭逻辑由消费页承担 */
6659
- function handleClose() {
6660
- emit("close");
6661
- }
6460
+ /** 是否展示操作按钮:审批模式且 undo_finished=0(未处理)才展示 */
6461
+ const visible = computed(() => props.approval !== false && props.data?.undo_finished === 0);
6462
+ /** 驳回弹窗候选节点链:由 data 映射所得审批时间线(不含 END 结束节点) */
6463
+ const timelineNodes = computed(() => mapTimelineNodes(props.data));
6662
6464
  /** 审批弹窗显示状态 */
6663
6465
  const approvalVisible = ref(false);
6664
6466
  /** 当前审批类型:approve=同意 / reject=驳回 */
@@ -6668,59 +6470,21 @@ var FlowLayout_default = /* @__PURE__ */ defineComponent({
6668
6470
  approvalType.value = type;
6669
6471
  approvalVisible.value = true;
6670
6472
  }
6671
- /** 自选审批人节点已选人员(key=节点名,由 FlowNode 经 v-model:selected-users 回写,提交时校验至少 1 人) */
6672
- const selfSelectedUsersMap = ref({});
6673
- /** 确认:display=同意(打开审批弹窗);form=提交流程(校验全部通过后调用发起接口创建流程实例,成功后关闭当前页);done 结束 BaseCard 确认按钮 loading(校验失败或请求完成后调用) */
6674
- async function handleConfirm(done) {
6675
- if (props.mode !== "form") {
6676
- openApproval("approve");
6677
- done();
6678
- return;
6679
- }
6680
- if (props.beforeSubmit && !await props.beforeSubmit()) {
6681
- window.$message?.warning("请将表单填写完整");
6682
- done();
6683
- return;
6684
- }
6685
- if (!formNodes.value.length) {
6686
- window.$message?.warning("流程节点未加载,请将必填字段填写完整");
6687
- done();
6688
- return;
6689
- }
6690
- const emptySelfSelectNode = formNodes.value.find((node) => node.type === "approver" && node.selfSelect && !selfSelectedUsersMap.value[node.name]?.length);
6691
- if (emptySelfSelectNode) {
6692
- window.$message?.warning(`请为「${emptySelfSelectNode.name}」选择至少 1 名审批人`);
6693
- done();
6694
- return;
6695
- }
6696
- const nodes = formNodes.value.filter((node) => node.type !== "end").map((node) => ({
6697
- type: node.type,
6698
- name: node.name,
6699
- desc: node.desc,
6700
- mode: node.mode,
6701
- selfSelect: node.selfSelect,
6702
- users: node.selfSelect ? selfSelectedUsersMap.value[node.name] ?? [] : node.users.map((user) => ({
6703
- id: user.id,
6704
- name: user.name
6705
- }))
6706
- }));
6707
- const { error } = await fetchLaunchWflowFlow({
6708
- flow_id: Number(props.flowId),
6709
- form: props.getFormData?.() ?? {},
6710
- nodes
6473
+ /** 撤回:二次确认(window.$dialog 由宿主 app-provider 注入);撤回接口待接入,确认后暂仅提示成功 */
6474
+ function handleWithdraw() {
6475
+ window.$dialog?.warning({
6476
+ title: "撤回确认",
6477
+ content: "确定撤回当前流程吗?",
6478
+ positiveText: "确定",
6479
+ negativeText: "取消",
6480
+ onPositiveClick: () => {
6481
+ window.$message?.success("流程已撤回");
6482
+ }
6711
6483
  });
6712
- done();
6713
- if (error) return;
6714
- window.$message?.success("流程提交成功");
6715
- emit("submitted");
6716
- }
6717
- /** 驳回:打开审批弹窗 */
6718
- function handleReject() {
6719
- openApproval("reject");
6720
6484
  }
6721
6485
  /** 审批弹窗提交:approve 调 /wflow/undo/approve(意见附件可空)、reject 调 /wflow/undo/reject(意见与目标节点 ID 必传,整节点重置);成功 done() 关闭弹窗并 emit success 通知页面刷新详情,失败 done(false) 保持弹窗打开并结束确认按钮 loading */
6722
6486
  async function handleApprovalSubmit(value, done) {
6723
- const undoId = props.timelineData?.undo_id;
6487
+ const undoId = props.data?.undo_id;
6724
6488
  if (!undoId) {
6725
6489
  window.$message?.error("未获取到待办审批记录ID,无法处理");
6726
6490
  done(false);
@@ -6754,117 +6518,48 @@ var FlowLayout_default = /* @__PURE__ */ defineComponent({
6754
6518
  }
6755
6519
  emit("success");
6756
6520
  }
6757
- /** form 模式节点链:条件字段全部填写后经 fetchFlowNodes 请求所得(不同条件值得到不同节点),为空时节点区展示空态提示;不含 end 结束节点 */
6758
- const formNodes = ref([]);
6759
- /** form 模式节点请求中:节点区 NSpin loading(仅节点接口请求期间为 true,display 模式恒为 false) */
6760
- const flowNodesLoading = ref(false);
6761
- /** 流程条件字段 key 列表(拉取流程配置后提取,不在页面渲染;条件值取自父组件 getFormData 返回的表单数据) */
6762
- const conditionKeys = ref([]);
6763
- /** 流程配置请求 Promise:fetchFlowNodes 先等待其完成再校验条件字段,避免初始化时配置未返回、条件字段列表为空被误判为「无条件字段」直接请求节点 */
6764
- let flowConfigReady = Promise.resolve();
6765
- /** 进页面获取流程配置:字段配置 fields 中「是否参与条件」condition=true 的字段即条件字段(仅 form 模式需要) */
6766
- async function initFlowConfig() {
6767
- if (props.mode !== "form" || !props.flowId) return;
6768
- const { data, error } = await fetchGetWflowConfigDetail(Number(props.flowId));
6769
- if (error || !data?.config) return;
6770
- conditionKeys.value = (data.config.fields ?? []).filter((field) => field.condition && field.key).map((field) => field.key);
6771
- }
6772
- /** 条件字段是否全部填写完成:条件字段值取自父组件表单数据(数组非空 / 非 null / 非空串;流程无条件字段时视为填齐),暴露给父组件提交校验调用 */
6773
- function isConditionsFilled() {
6774
- if (!conditionKeys.value.length) return true;
6775
- const formData = props.getFormData?.() ?? {};
6776
- return conditionKeys.value.every((key) => {
6777
- const value = formData[key];
6778
- if (Array.isArray(value)) return value.length > 0;
6779
- return value !== "" && value !== null && value !== void 0;
6780
- });
6781
- }
6782
- /** 请求流程节点(暴露给父组件在表单变化防抖后调用):先等待流程配置就绪(条件字段提取完成)再校验条件字段填齐,随后携带整份表单数据 + 流程 ID 请求,后端按表单值匹配条件分支;条件字段未填齐/请求失败/返回为空时节点链保持不变(节点区空态提示) */
6783
- async function fetchFlowNodes() {
6784
- if (props.mode !== "form" || !props.flowId) return;
6785
- await flowConfigReady;
6786
- if (!isConditionsFilled()) return;
6787
- flowNodesLoading.value = true;
6788
- try {
6789
- const { data, error } = await fetchGetWflowFlowNodes({
6790
- flow_id: Number(props.flowId),
6791
- form: props.getFormData?.() ?? {}
6792
- });
6793
- if (error || !data?.nodes?.length) return;
6794
- formNodes.value = data.nodes;
6795
- } finally {
6796
- flowNodesLoading.value = false;
6797
- }
6798
- }
6799
- __expose({
6800
- fetchFlowNodes,
6801
- isConditionsFilled
6802
- });
6803
- onMounted(() => {
6804
- flowConfigReady = initFlowConfig();
6805
- });
6806
- /** display 模式审批时间线:节点快照直接映射 FlowNodeItem(映射规则详见 timeline-mapping.mapTimelineNodes) */
6807
- const displayNodes = computed(() => mapTimelineNodes(props.timelineData));
6808
- /** 按渲染模式取节点链:form=发起节点链、display=审批时间线(均为组件内部处理所得),有数据时统一追加 END 结束节点,无数据为空数组走空态 */
6809
- const flowNodes = computed(() => withEndNode(props.mode === "form" ? formNodes.value : displayNodes.value, props.mode));
6810
6521
  return (_ctx, _cache) => {
6811
- const _component_NButton = NButton;
6812
- return openBlock(), createBlock(base_card_default, {
6813
- loading: __props.loading,
6814
- "cancel-config": {
6815
- show: true,
6816
- text: "关闭"
6817
- },
6818
- "confirm-config": {
6819
- show: canOperate.value,
6820
- text: __props.mode === "form" ? "提交" : "同意",
6821
- props: { type: "primary" }
6822
- },
6823
- "on-before-confirm": handleConfirm,
6824
- onCancel: handleClose
6825
- }, createSlots({
6522
+ return openBlock(), createElementBlock(Fragment, null, [visible.value ? (openBlock(), createBlock(unref(NSpace), {
6523
+ key: 0,
6524
+ size: 12,
6525
+ align: "center"
6526
+ }, {
6826
6527
  default: withCtx(() => [
6827
- renderSlot(_ctx.$slots, "default"),
6828
- createVNode(FlowNodesPanel_default, {
6829
- "selected-users-map": selfSelectedUsersMap.value,
6830
- "onUpdate:selectedUsersMap": _cache[0] || (_cache[0] = ($event) => selfSelectedUsersMap.value = $event),
6831
- nodes: flowNodes.value,
6832
- mode: __props.mode,
6833
- loading: flowNodesLoading.value,
6834
- "status-tag": flowStatusTag.value
6835
- }, null, 8, [
6836
- "selected-users-map",
6837
- "nodes",
6838
- "mode",
6839
- "loading",
6840
- "status-tag"
6841
- ]),
6842
- canReject.value ? (openBlock(), createBlock(ApprovalModal_default, {
6843
- key: 0,
6844
- visible: approvalVisible.value,
6845
- "onUpdate:visible": _cache[1] || (_cache[1] = ($event) => approvalVisible.value = $event),
6846
- type: approvalType.value,
6847
- nodes: flowNodes.value,
6848
- onSubmitted: handleApprovalSubmit
6849
- }, null, 8, [
6850
- "visible",
6851
- "type",
6852
- "nodes"
6853
- ])) : createCommentVNode("", true)
6528
+ createVNode(unref(NButton), {
6529
+ type: "warning",
6530
+ onClick: handleWithdraw
6531
+ }, {
6532
+ default: withCtx(() => [..._cache[3] || (_cache[3] = [createTextVNode("撤回", -1)])]),
6533
+ _: 1
6534
+ }),
6535
+ createVNode(unref(NButton), {
6536
+ type: "error",
6537
+ onClick: _cache[0] || (_cache[0] = ($event) => openApproval("reject"))
6538
+ }, {
6539
+ default: withCtx(() => [..._cache[4] || (_cache[4] = [createTextVNode("驳回", -1)])]),
6540
+ _: 1
6541
+ }),
6542
+ createVNode(unref(NButton), {
6543
+ type: "primary",
6544
+ onClick: _cache[1] || (_cache[1] = ($event) => openApproval("approve"))
6545
+ }, {
6546
+ default: withCtx(() => [..._cache[5] || (_cache[5] = [createTextVNode("同意", -1)])]),
6547
+ _: 1
6548
+ })
6854
6549
  ]),
6855
- _: 2
6856
- }, [canReject.value || _ctx.$slots["footer-center"] ? {
6857
- name: "footer-center",
6858
- fn: withCtx(() => [canReject.value ? (openBlock(), createBlock(_component_NButton, {
6859
- key: 0,
6860
- type: "error",
6861
- onClick: handleReject
6862
- }, {
6863
- default: withCtx(() => [..._cache[2] || (_cache[2] = [createTextVNode("驳回", -1)])]),
6864
- _: 1
6865
- })) : createCommentVNode("", true), renderSlot(_ctx.$slots, "footer-center")]),
6866
- key: "0"
6867
- } : void 0]), 1032, ["loading", "confirm-config"]);
6550
+ _: 1
6551
+ })) : createCommentVNode("", true), visible.value ? (openBlock(), createBlock(ApprovalModal_default, {
6552
+ key: 1,
6553
+ visible: approvalVisible.value,
6554
+ "onUpdate:visible": _cache[2] || (_cache[2] = ($event) => approvalVisible.value = $event),
6555
+ type: approvalType.value,
6556
+ nodes: timelineNodes.value,
6557
+ onSubmitted: handleApprovalSubmit
6558
+ }, null, 8, [
6559
+ "visible",
6560
+ "type",
6561
+ "nodes"
6562
+ ])) : createCommentVNode("", true)], 64);
6868
6563
  };
6869
6564
  }
6870
6565
  });
@@ -7103,4 +6798,4 @@ var flow_list_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__
7103
6798
  }
7104
6799
  }), [["__scopeId", "data-v-56ed3cd3"]]);
7105
6800
  //#endregion
7106
- export { ApprovalModal_default as ApprovalModal, FLOW_UI_KEY, FlowAvatar_default as FlowAvatar, FlowConfig_default as FlowConfig, FlowConfigField_default as FlowConfigField, FlowConfigMore_default as FlowConfigMore, FlowLayout_default as FlowLayout, flow_list_default as FlowList, FlowNode_default as FlowNode, FlowNodesPanel_default as FlowNodesPanel, person_selector_default as PersonSelector, createFlowUI, fetchGetWflowConfigDetail, fetchGetWflowFlowNodes, fetchLaunchWflowFlow, fetchWflowUndoApprove, fetchWflowUndoReject, getRemoteOptions, isRemoteField, useFlowUI };
6801
+ export { ApprovalModal_default as ApprovalModal, FLOW_UI_KEY, FlowActions_default as FlowActions, FlowAvatar_default as FlowAvatar, FlowConfig_default as FlowConfig, FlowConfigField_default as FlowConfigField, FlowConfigMore_default as FlowConfigMore, flow_list_default as FlowList, FlowNode_default as FlowNode, FlowNodesPanel_default as FlowNodesPanel, person_selector_default as PersonSelector, createFlowUI, fetchGetWflowConfigDetail, fetchGetWflowFlowNodes, fetchLaunchWflowFlow, fetchWflowUndoApprove, fetchWflowUndoReject, getRemoteOptions, isRemoteField, useFlowUI };