@yugu-ui/flow-ui 0.1.16 → 0.1.17

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
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";
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";
@@ -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;
@@ -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);
@@ -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({
@@ -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?.();
@@ -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,7 +4520,7 @@ 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
4526
  var _hoisted_1$12 = { class: "flow-config-flow" };
@@ -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
  });
@@ -4724,7 +4787,7 @@ 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
4793
  var _hoisted_1$11 = { class: "flow-config-more" };
@@ -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,7 +4980,7 @@ 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
4986
  var _hoisted_1$10 = { class: "flow-config__header" };
@@ -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
  }
@@ -5129,7 +5205,7 @@ var FlowConfig_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @_
5129
5205
  }, 8, ["style"]);
5130
5206
  };
5131
5207
  }
5132
- }), [["__scopeId", "data-v-5e56d074"]]);
5208
+ }), [["__scopeId", "data-v-a1a3b101"]]);
5133
5209
  //#endregion
5134
5210
  //#region src/utils/common.ts
5135
5211
  /** 判断是否为空(undefined/null/空字符串) */
@@ -5206,7 +5282,7 @@ var _hoisted_3$4 = {
5206
5282
  };
5207
5283
  /** 扩展名 → 预览类型映射(代码/文本类不在表内,走下载兜底) */
5208
5284
  var FILE_ORIGIN = "https://download.yugu8.com";
5209
- /** 文件同域反代前缀 */
5285
+ /** 文件同域反代前缀(仅 localhost dev) */
5210
5286
  var FILE_PROXY_PREFIX = "/download-proxy";
5211
5287
  //#endregion
5212
5288
  //#region src/file-preview/index.vue
@@ -5268,10 +5344,13 @@ var file_preview_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/*
5268
5344
  "excel",
5269
5345
  "pptx"
5270
5346
  ].includes(kind.value));
5271
- /** 文件资源域名(与 vite.config.ts 的 /download-proxy 代理目标保持一致) */
5347
+ /** 文件资源域名(vite.config.ts 的 /download-proxy 代理目标;仅 localhost dev 走该改写,线上直连) */
5348
+ const isLocalhost = ["localhost", "127.0.0.1"].includes(window.location.hostname);
5349
+ /** 文档类预览 URL:线上直连完整文件域名(CORS 已放行);仅 localhost 开发环境改写为同域反代路径 */
5272
5350
  const previewUrl = computed(() => {
5273
5351
  if (!isDocKind.value) return props.url;
5274
- return props.url.startsWith(FILE_ORIGIN) ? FILE_PROXY_PREFIX + props.url.slice(26) : props.url;
5352
+ if (isLocalhost && props.url.startsWith(FILE_ORIGIN)) return FILE_PROXY_PREFIX + props.url.slice(26);
5353
+ return props.url;
5275
5354
  });
5276
5355
  /** @vue-office 可选组件懒加载器:kind → 动态 import(未安装/加载失败时 promise reject,由加载函数降级) */
5277
5356
  const OFFICE_LOADERS = {
@@ -5448,7 +5527,7 @@ var file_preview_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/*
5448
5527
  }, 8, ["description"])]))], 4);
5449
5528
  };
5450
5529
  }
5451
- }), [["__scopeId", "data-v-e50ab833"]]);
5530
+ }), [["__scopeId", "data-v-39ebb3af"]]);
5452
5531
  //#endregion
5453
5532
  //#region src/file-preview/file-preview-modal.vue
5454
5533
  var file_preview_modal_default = /* @__PURE__ */ defineComponent({
@@ -5899,7 +5978,7 @@ var FlowNode_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__P
5899
5978
  ], 6);
5900
5979
  };
5901
5980
  }
5902
- }), [["__scopeId", "data-v-c108c6cb"]]);
5981
+ }), [["__scopeId", "data-v-c730ebf8"]]);
5903
5982
  //#endregion
5904
5983
  //#region src/timeline/ApprovalModal.vue?vue&type=script&setup=true&lang.ts
5905
5984
  var _hoisted_1$6 = { class: "reject-node-list" };
@@ -6167,7 +6246,7 @@ function isLatestRowsReject(rows) {
6167
6246
  const latest = rows.reduce((acc, cur) => (cur.assertion_time ?? 0) >= (acc.assertion_time ?? 0) ? cur : acc, rows[0]);
6168
6247
  return latest.result === 3 || latest.is_reject === 1;
6169
6248
  }
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 最新一条:驳回标红、同意标绿),无操作记录随节点状态(进行中节点淡黄、其余灰色未处理) */
6249
+ /** 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
6250
  function mapTimelineNodes(data) {
6172
6251
  const d = data;
6173
6252
  if (!d?.nodes?.length) return [];
@@ -6178,13 +6257,13 @@ function mapTimelineNodes(data) {
6178
6257
  const currentIndex = activeIndex > -1 ? activeIndex : pendingIndex > -1 ? pendingIndex : instanceFinished ? -1 : d.nodes.findIndex((item) => item.finished !== 1);
6179
6258
  return d.nodes.map((node, index) => {
6180
6259
  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";
6260
+ 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
6261
  const users = node.users.map((user) => {
6183
6262
  const records = toUserRecords(user, instanceRejected);
6184
6263
  const rawRows = Array.isArray(user.records) ? user.records : [];
6185
6264
  const hasPendingRow = rawRows.some((record) => record.result === 0 && record.finished === 0);
6186
6265
  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;
6266
+ 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
6267
  return {
6189
6268
  id: user.id,
6190
6269
  name: user.name,
@@ -6199,7 +6278,7 @@ function mapTimelineNodes(data) {
6199
6278
  status: nodeStatus,
6200
6279
  name: node.name,
6201
6280
  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,
6281
+ time: node.created_time && (node.finished === 1 || nodeStatus === "done") ? formatTime(node.created_time, "YYYY-MM-DD HH:mm") : void 0,
6203
6282
  mode: node.mode,
6204
6283
  selfSelect: node.selfSelect,
6205
6284
  users
@@ -6718,6 +6797,18 @@ var FlowLayout_default = /* @__PURE__ */ defineComponent({
6718
6797
  function handleReject() {
6719
6798
  openApproval("reject");
6720
6799
  }
6800
+ /** 撤回:二次确认(window.$dialog 由宿主 app-provider 注入);撤回接口待接入,确认后暂仅提示成功 */
6801
+ function handleWithdraw() {
6802
+ window.$dialog?.warning({
6803
+ title: "撤回确认",
6804
+ content: "确定撤回当前流程吗?",
6805
+ positiveText: "确定",
6806
+ negativeText: "取消",
6807
+ onPositiveClick: () => {
6808
+ window.$message?.success("流程已撤回");
6809
+ }
6810
+ });
6811
+ }
6721
6812
  /** 审批弹窗提交:approve 调 /wflow/undo/approve(意见附件可空)、reject 调 /wflow/undo/reject(意见与目标节点 ID 必传,整节点重置);成功 done() 关闭弹窗并 emit success 通知页面刷新详情,失败 done(false) 保持弹窗打开并结束确认按钮 loading */
6722
6813
  async function handleApprovalSubmit(value, done) {
6723
6814
  const undoId = props.timelineData?.undo_id;
@@ -6855,14 +6946,25 @@ var FlowLayout_default = /* @__PURE__ */ defineComponent({
6855
6946
  _: 2
6856
6947
  }, [canReject.value || _ctx.$slots["footer-center"] ? {
6857
6948
  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")]),
6949
+ fn: withCtx(() => [
6950
+ canReject.value ? (openBlock(), createBlock(_component_NButton, {
6951
+ key: 0,
6952
+ type: "warning",
6953
+ onClick: handleWithdraw
6954
+ }, {
6955
+ default: withCtx(() => [..._cache[2] || (_cache[2] = [createTextVNode("撤回", -1)])]),
6956
+ _: 1
6957
+ })) : createCommentVNode("", true),
6958
+ canReject.value ? (openBlock(), createBlock(_component_NButton, {
6959
+ key: 1,
6960
+ type: "error",
6961
+ onClick: handleReject
6962
+ }, {
6963
+ default: withCtx(() => [..._cache[3] || (_cache[3] = [createTextVNode("驳回", -1)])]),
6964
+ _: 1
6965
+ })) : createCommentVNode("", true),
6966
+ renderSlot(_ctx.$slots, "footer-center")
6967
+ ]),
6866
6968
  key: "0"
6867
6969
  } : void 0]), 1032, ["loading", "confirm-config"]);
6868
6970
  };
@@ -7,6 +7,8 @@ interface UseSelectionOptions {
7
7
  people: Ref<PersonItem[]>;
8
8
  /** 弹窗打开期间暂停外部 modelValue 同步,避免用户编辑被外部变化覆盖 */
9
9
  paused?: () => boolean;
10
+ /** 单选模式:false 时新增项替换草稿(最多 1 项),默认多选保持既有行为 */
11
+ multiple?: boolean;
10
12
  /** 确认提交回调(组件内在此触发 update:modelValue / change) */
11
13
  onChange: (value: SelectedItem[]) => void;
12
14
  }
@@ -4,6 +4,7 @@ type __VLS_Props = {
4
4
  selectableTypes?: SelectableType[];
5
5
  placeholder?: string;
6
6
  displayMode?: 'wrap' | 'overflow';
7
+ multiple?: boolean;
7
8
  };
8
9
  declare const __VLS_export: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
9
10
  "update:modelValue": (value: SelectedItem[]) => any;
@@ -14,6 +15,7 @@ declare const __VLS_export: import('vue').DefineComponent<__VLS_Props, {}, {}, {
14
15
  }>, {
15
16
  modelValue: SelectedItem[];
16
17
  placeholder: string;
18
+ multiple: boolean;
17
19
  selectableTypes: SelectableType[];
18
20
  displayMode: "wrap" | "overflow";
19
21
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;