@yugu-ui/flow-ui 0.1.17 → 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.d.ts +2 -2
- package/dist/index.js +282 -689
- package/dist/style.css +2 -54
- package/dist/timeline/FlowActions.d.ts +17 -0
- package/dist/timeline/timeline-mapping.d.ts +2 -0
- package/package.json +1 -1
- package/dist/timeline/FlowLayout.d.ts +0 -48
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NAvatar, NButton, NCard, NCheckbox, NCheckboxGroup, NCollapse, NCollapseItem, NDrawer, NDrawerContent,
|
|
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
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";
|
|
@@ -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$
|
|
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$
|
|
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$
|
|
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$
|
|
779
|
+
}), 128))], 12, _hoisted_1$14);
|
|
780
780
|
};
|
|
781
781
|
}
|
|
782
782
|
}), [["__scopeId", "data-v-65188f30"]]);
|
|
@@ -2918,7 +2918,7 @@ function useOverflowTags(options) {
|
|
|
2918
2918
|
}
|
|
2919
2919
|
//#endregion
|
|
2920
2920
|
//#region src/person-selector/index.vue?vue&type=script&setup=true&lang.ts
|
|
2921
|
-
var _hoisted_1$
|
|
2921
|
+
var _hoisted_1$13 = { class: "person-selector" };
|
|
2922
2922
|
var _hoisted_2$11 = { class: "person-selector__tag-name" };
|
|
2923
2923
|
var _hoisted_3$9 = ["onClick"];
|
|
2924
2924
|
var _hoisted_4$6 = {
|
|
@@ -3236,7 +3236,7 @@ var person_selector_default = /* @__PURE__ */ _plugin_vue_export_helper_default(
|
|
|
3236
3236
|
ensureData().catch(() => {});
|
|
3237
3237
|
});
|
|
3238
3238
|
return (_ctx, _cache) => {
|
|
3239
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
3239
|
+
return openBlock(), createElementBlock("div", _hoisted_1$13, [createElementVNode("div", {
|
|
3240
3240
|
ref_key: "triggerRef",
|
|
3241
3241
|
ref: triggerRef,
|
|
3242
3242
|
class: "person-selector__trigger",
|
|
@@ -3785,7 +3785,7 @@ var getRemoteOptions = (field) => {
|
|
|
3785
3785
|
};
|
|
3786
3786
|
//#endregion
|
|
3787
3787
|
//#region src/config/FlowConfigFlow/components/NodeConfigDrawer/modules/ConditionConfig.vue?vue&type=script&setup=true&lang.ts
|
|
3788
|
-
var _hoisted_1$
|
|
3788
|
+
var _hoisted_1$12 = { class: "cond" };
|
|
3789
3789
|
var _hoisted_2$10 = {
|
|
3790
3790
|
key: 0,
|
|
3791
3791
|
class: "cond__empty"
|
|
@@ -3885,7 +3885,7 @@ var ConditionConfig_default = /* @__PURE__ */ _plugin_vue_export_helper_default(
|
|
|
3885
3885
|
const _component_NInput = NInput;
|
|
3886
3886
|
const _component_NFormItem = NFormItem;
|
|
3887
3887
|
return openBlock(), createBlock(_component_NFormItem, { "show-label": false }, {
|
|
3888
|
-
default: withCtx(() => [createElementVNode("div", _hoisted_1$
|
|
3888
|
+
default: withCtx(() => [createElementVNode("div", _hoisted_1$12, [
|
|
3889
3889
|
_cache[5] || (_cache[5] = createElementVNode("div", { class: "cond__tip" }, "满足以下条件时进入当前分支", -1)),
|
|
3890
3890
|
!__props.config.conditionGroups?.length ? (openBlock(), createElementBlock("div", _hoisted_2$10, [_cache[0] || (_cache[0] = createElementVNode("span", { class: "cond__empty-text" }, "请添加条件", -1)), createElementVNode("button", {
|
|
3891
3891
|
type: "button",
|
|
@@ -4256,7 +4256,7 @@ var resolveNames = (list) => {
|
|
|
4256
4256
|
};
|
|
4257
4257
|
//#endregion
|
|
4258
4258
|
//#region src/config/FlowConfigFlow/components/FlowNodeCard.vue?vue&type=script&setup=true&lang.ts
|
|
4259
|
-
var _hoisted_1$
|
|
4259
|
+
var _hoisted_1$11 = {
|
|
4260
4260
|
key: 0,
|
|
4261
4261
|
class: "fnode fnode--add-condition"
|
|
4262
4262
|
};
|
|
@@ -4438,7 +4438,7 @@ var FlowNodeCard_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/*
|
|
|
4438
4438
|
};
|
|
4439
4439
|
return (_ctx, _cache) => {
|
|
4440
4440
|
const _component_NTooltip = NTooltip;
|
|
4441
|
-
return data.type === "add-condition" ? (openBlock(), createElementBlock("div", _hoisted_1$
|
|
4441
|
+
return data.type === "add-condition" ? (openBlock(), createElementBlock("div", _hoisted_1$11, [createVNode(FlowIcon_default, {
|
|
4442
4442
|
name: "plus",
|
|
4443
4443
|
size: 11,
|
|
4444
4444
|
color: "#fff"
|
|
@@ -4523,7 +4523,7 @@ var FlowNodeCard_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/*
|
|
|
4523
4523
|
}), [["__scopeId", "data-v-eda68330"]]);
|
|
4524
4524
|
//#endregion
|
|
4525
4525
|
//#region src/config/FlowConfigFlow/index.vue?vue&type=script&setup=true&lang.ts
|
|
4526
|
-
var _hoisted_1$
|
|
4526
|
+
var _hoisted_1$10 = { class: "flow-config-flow" };
|
|
4527
4527
|
var _hoisted_2$8 = {
|
|
4528
4528
|
key: 0,
|
|
4529
4529
|
class: "flow-config-flow__hint"
|
|
@@ -4735,7 +4735,7 @@ var FlowConfigFlow_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/
|
|
|
4735
4735
|
graph = null;
|
|
4736
4736
|
});
|
|
4737
4737
|
return (_ctx, _cache) => {
|
|
4738
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
4738
|
+
return openBlock(), createElementBlock("div", _hoisted_1$10, [
|
|
4739
4739
|
createElementVNode("div", {
|
|
4740
4740
|
ref_key: "containerRef",
|
|
4741
4741
|
ref: containerRef,
|
|
@@ -4790,7 +4790,7 @@ var FlowConfigFlow_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/
|
|
|
4790
4790
|
}), [["__scopeId", "data-v-edefe008"]]);
|
|
4791
4791
|
//#endregion
|
|
4792
4792
|
//#region src/config/FlowConfigMore.vue?vue&type=script&setup=true&lang.ts
|
|
4793
|
-
var _hoisted_1$
|
|
4793
|
+
var _hoisted_1$9 = { class: "flow-config-more" };
|
|
4794
4794
|
//#endregion
|
|
4795
4795
|
//#region src/config/FlowConfigMore.vue
|
|
4796
4796
|
var FlowConfigMore_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
|
|
@@ -4854,7 +4854,7 @@ var FlowConfigMore_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/
|
|
|
4854
4854
|
const _component_NCheckboxGroup = NCheckboxGroup;
|
|
4855
4855
|
const _component_NInput = NInput;
|
|
4856
4856
|
const _component_NForm = NForm;
|
|
4857
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
4857
|
+
return openBlock(), createElementBlock("div", _hoisted_1$9, [createVNode(_component_NForm, {
|
|
4858
4858
|
ref_key: "formRef",
|
|
4859
4859
|
ref: formRef,
|
|
4860
4860
|
"label-placement": "left",
|
|
@@ -4983,7 +4983,7 @@ var FlowConfigMore_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/
|
|
|
4983
4983
|
}), [["__scopeId", "data-v-fde6bc00"]]);
|
|
4984
4984
|
//#endregion
|
|
4985
4985
|
//#region src/config/FlowConfig.vue?vue&type=script&setup=true&lang.ts
|
|
4986
|
-
var _hoisted_1$
|
|
4986
|
+
var _hoisted_1$8 = { class: "flow-config__header" };
|
|
4987
4987
|
var _hoisted_2$7 = { class: "flow-config__title" };
|
|
4988
4988
|
var _hoisted_3$5 = { class: "flow-config__body" };
|
|
4989
4989
|
//#endregion
|
|
@@ -5140,7 +5140,7 @@ var FlowConfig_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @_
|
|
|
5140
5140
|
"header-style": "padding: 0;",
|
|
5141
5141
|
"content-style": "padding: 0; flex: 1; min-height: 0; display: flex; flex-direction: column;"
|
|
5142
5142
|
}, {
|
|
5143
|
-
header: withCtx(() => [createElementVNode("div", _hoisted_1$
|
|
5143
|
+
header: withCtx(() => [createElementVNode("div", _hoisted_1$8, [
|
|
5144
5144
|
createElementVNode("span", _hoisted_2$7, toDisplayString(__props.flowName || "流程配置"), 1),
|
|
5145
5145
|
createVNode(_component_NTabs, {
|
|
5146
5146
|
value: currentStep.value,
|
|
@@ -5207,71 +5207,8 @@ var FlowConfig_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @_
|
|
|
5207
5207
|
}
|
|
5208
5208
|
}), [["__scopeId", "data-v-a1a3b101"]]);
|
|
5209
5209
|
//#endregion
|
|
5210
|
-
//#region src/utils/common.ts
|
|
5211
|
-
/** 判断是否为空(undefined/null/空字符串) */
|
|
5212
|
-
function isNull(value) {
|
|
5213
|
-
return value === void 0 || value === null || value === "";
|
|
5214
|
-
}
|
|
5215
|
-
/** 时间格式化:兼容 10/13 位时间戳、字符串与 Date,空值返回 '--' */
|
|
5216
|
-
function formatTime(value, format = "YYYY-MM-DD HH:mm:ss") {
|
|
5217
|
-
if (value === null || value === void 0 || value === "" || value === 0) return "--";
|
|
5218
|
-
let timestamp = value;
|
|
5219
|
-
if (typeof value === "string") {
|
|
5220
|
-
const trimmed = value.trim();
|
|
5221
|
-
if (/^\d+$/.test(trimmed)) {
|
|
5222
|
-
const numValue = parseInt(trimmed, 10);
|
|
5223
|
-
if (trimmed.length === 10) timestamp = numValue * 1e3;
|
|
5224
|
-
else if (trimmed.length === 13) timestamp = numValue;
|
|
5225
|
-
else return dayjs(value).format(format);
|
|
5226
|
-
} else return dayjs(value).format(format);
|
|
5227
|
-
} else if (typeof value === "number") {
|
|
5228
|
-
if (value.toString().length === 10) timestamp = value * 1e3;
|
|
5229
|
-
}
|
|
5230
|
-
return dayjs(timestamp).format(format);
|
|
5231
|
-
}
|
|
5232
|
-
//#endregion
|
|
5233
|
-
//#region src/composables/form.ts
|
|
5234
|
-
var invalidLiterals = [
|
|
5235
|
-
"null",
|
|
5236
|
-
"undefined",
|
|
5237
|
-
"nan",
|
|
5238
|
-
"nil",
|
|
5239
|
-
"none"
|
|
5240
|
-
];
|
|
5241
|
-
function useFormRules() {
|
|
5242
|
-
function createRequiredRule(message) {
|
|
5243
|
-
return {
|
|
5244
|
-
required: true,
|
|
5245
|
-
trigger: ["input", "blur"],
|
|
5246
|
-
validator: (_rule, value) => {
|
|
5247
|
-
if (isNull(value) || typeof value === "string" && value.trim() === "" || Array.isArray(value) && value.length === 0) return new Error(message);
|
|
5248
|
-
if (typeof value === "string") {
|
|
5249
|
-
const trimmed = value.trim().toLowerCase();
|
|
5250
|
-
if (invalidLiterals.includes(trimmed)) return /* @__PURE__ */ new Error(`内容不可为 ${trimmed}`);
|
|
5251
|
-
}
|
|
5252
|
-
return true;
|
|
5253
|
-
}
|
|
5254
|
-
};
|
|
5255
|
-
}
|
|
5256
|
-
return { createRequiredRule };
|
|
5257
|
-
}
|
|
5258
|
-
function useNaiveForm() {
|
|
5259
|
-
const formRef = ref(null);
|
|
5260
|
-
async function validate() {
|
|
5261
|
-
await formRef.value?.validate();
|
|
5262
|
-
}
|
|
5263
|
-
async function restoreValidation() {
|
|
5264
|
-
formRef.value?.restoreValidation();
|
|
5265
|
-
}
|
|
5266
|
-
return {
|
|
5267
|
-
formRef,
|
|
5268
|
-
validate,
|
|
5269
|
-
restoreValidation
|
|
5270
|
-
};
|
|
5271
|
-
}
|
|
5272
|
-
//#endregion
|
|
5273
5210
|
//#region src/file-preview/index.vue?vue&type=script&setup=true&lang.ts
|
|
5274
|
-
var _hoisted_1$
|
|
5211
|
+
var _hoisted_1$7 = ["src"];
|
|
5275
5212
|
var _hoisted_2$6 = {
|
|
5276
5213
|
key: 0,
|
|
5277
5214
|
class: "preview-fail-overlay"
|
|
@@ -5475,7 +5412,7 @@ var file_preview_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/*
|
|
|
5475
5412
|
src: __props.url,
|
|
5476
5413
|
controls: "",
|
|
5477
5414
|
class: "h-full w-full bg-black rounded"
|
|
5478
|
-
}, null, 8, _hoisted_1$
|
|
5415
|
+
}, null, 8, _hoisted_1$7)) : isDocKind.value && !officeUnavailable.value ? (openBlock(), createBlock(unref(NSpin), {
|
|
5479
5416
|
key: 2,
|
|
5480
5417
|
show: loading.value,
|
|
5481
5418
|
description: "文件资源加载中...",
|
|
@@ -5587,7 +5524,7 @@ var file_preview_modal_default = /* @__PURE__ */ defineComponent({
|
|
|
5587
5524
|
});
|
|
5588
5525
|
//#endregion
|
|
5589
5526
|
//#region src/timeline/FlowAvatar.vue?vue&type=script&setup=true&lang.ts
|
|
5590
|
-
var _hoisted_1$
|
|
5527
|
+
var _hoisted_1$6 = ["src", "alt"];
|
|
5591
5528
|
//#endregion
|
|
5592
5529
|
//#region src/timeline/FlowAvatar.vue
|
|
5593
5530
|
var FlowAvatar_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
|
|
@@ -5618,7 +5555,7 @@ var FlowAvatar_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @_
|
|
|
5618
5555
|
class: "flow-avatar",
|
|
5619
5556
|
src: __props.avatar,
|
|
5620
5557
|
alt: __props.name
|
|
5621
|
-
}, null, 8, _hoisted_1$
|
|
5558
|
+
}, null, 8, _hoisted_1$6)) : (openBlock(), createElementBlock("span", {
|
|
5622
5559
|
key: 1,
|
|
5623
5560
|
class: "flow-avatar",
|
|
5624
5561
|
style: normalizeStyle({ background: getAvatarColor(__props.name) })
|
|
@@ -5628,7 +5565,7 @@ var FlowAvatar_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @_
|
|
|
5628
5565
|
}), [["__scopeId", "data-v-197c08a1"]]);
|
|
5629
5566
|
//#endregion
|
|
5630
5567
|
//#region src/timeline/FlowNode.vue?vue&type=script&setup=true&lang.ts
|
|
5631
|
-
var _hoisted_1$
|
|
5568
|
+
var _hoisted_1$5 = {
|
|
5632
5569
|
key: 1,
|
|
5633
5570
|
class: "flow-node__time"
|
|
5634
5571
|
};
|
|
@@ -5846,7 +5783,7 @@ var FlowNode_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__P
|
|
|
5846
5783
|
key: 0,
|
|
5847
5784
|
class: normalizeClass(["flow-node__radio", { "flow-node__radio--checked": isNodeSelected.value }])
|
|
5848
5785
|
}, null, 2)) : createCommentVNode("", true),
|
|
5849
|
-
__props.mode === "display" ? (openBlock(), createElementBlock("div", _hoisted_1$
|
|
5786
|
+
__props.mode === "display" ? (openBlock(), createElementBlock("div", _hoisted_1$5, [(openBlock(true), createElementBlock(Fragment, null, renderList(timeParts.value, (part, i) => {
|
|
5850
5787
|
return openBlock(), createElementBlock("span", { key: i }, toDisplayString(part), 1);
|
|
5851
5788
|
}), 128))])) : createCommentVNode("", true),
|
|
5852
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, {
|
|
@@ -5980,181 +5917,9 @@ var FlowNode_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__P
|
|
|
5980
5917
|
}
|
|
5981
5918
|
}), [["__scopeId", "data-v-c730ebf8"]]);
|
|
5982
5919
|
//#endregion
|
|
5983
|
-
//#region src/timeline/ApprovalModal.vue?vue&type=script&setup=true&lang.ts
|
|
5984
|
-
var _hoisted_1$6 = { class: "reject-node-list" };
|
|
5985
|
-
var _hoisted_2$4 = {
|
|
5986
|
-
key: 1,
|
|
5987
|
-
style: { "opacity": "0.6" }
|
|
5988
|
-
};
|
|
5989
|
-
//#endregion
|
|
5990
|
-
//#region src/timeline/ApprovalModal.vue
|
|
5991
|
-
var ApprovalModal_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
|
|
5992
|
-
name: "ApprovalModal",
|
|
5993
|
-
__name: "ApprovalModal",
|
|
5994
|
-
props: /* @__PURE__ */ mergeModels({
|
|
5995
|
-
type: { default: "approve" },
|
|
5996
|
-
nodes: { default: () => [] }
|
|
5997
|
-
}, {
|
|
5998
|
-
"visible": {
|
|
5999
|
-
type: Boolean,
|
|
6000
|
-
default: false
|
|
6001
|
-
},
|
|
6002
|
-
"visibleModifiers": {}
|
|
6003
|
-
}),
|
|
6004
|
-
emits: /* @__PURE__ */ mergeModels(["submitted"], ["update:visible"]),
|
|
6005
|
-
setup(__props, { emit: __emit }) {
|
|
6006
|
-
const props = __props;
|
|
6007
|
-
/** 弹窗标题:按审批类型区分;附件类型复用 file-upload 导出的 UploadResource */
|
|
6008
|
-
const title = computed(() => props.type === "reject" ? "驳回意见" : "审批意见");
|
|
6009
|
-
const emit = __emit;
|
|
6010
|
-
const visible = useModel(__props, "visible");
|
|
6011
|
-
const { formRef, validate, restoreValidation } = useNaiveForm();
|
|
6012
|
-
const { createRequiredRule } = useFormRules();
|
|
6013
|
-
const { components } = useFlowUI();
|
|
6014
|
-
const model = reactive(createDefaultModel());
|
|
6015
|
-
function createDefaultModel() {
|
|
6016
|
-
return {
|
|
6017
|
-
opinion: "",
|
|
6018
|
-
attachments: [],
|
|
6019
|
-
rejectTarget: null
|
|
6020
|
-
};
|
|
6021
|
-
}
|
|
6022
|
-
/** 表单校验规则(驳回时:意见必填+需选择驳回节点;同意时:意见非必填) */
|
|
6023
|
-
const rules = computed(() => {
|
|
6024
|
-
const base = {};
|
|
6025
|
-
if (props.type === "reject") {
|
|
6026
|
-
base.opinion = createRequiredRule("请输入审批意见");
|
|
6027
|
-
base.rejectTarget = createRequiredRule("请选择驳回节点");
|
|
6028
|
-
}
|
|
6029
|
-
return base;
|
|
6030
|
-
});
|
|
6031
|
-
/**
|
|
6032
|
-
* 驳回可选节点(仅驳回时计算,整节点重置只选节点):
|
|
6033
|
-
* - 发起节点始终保留(驳回到发起人=拒绝整个申请)
|
|
6034
|
-
* - 过滤未开始的节点
|
|
6035
|
-
* - 过滤进行中且无「已完成本轮审批」人员的节点(节点下无历史审批记录则不可作驳回目标)
|
|
6036
|
-
*/
|
|
6037
|
-
const filterNodes = computed(() => {
|
|
6038
|
-
if (props.type !== "reject") return [];
|
|
6039
|
-
return props.nodes.filter((node) => {
|
|
6040
|
-
if (node.type === "end") return false;
|
|
6041
|
-
if (node.type === "cc") return false;
|
|
6042
|
-
if (node.type === "start") return true;
|
|
6043
|
-
if (node.status === "pending") return false;
|
|
6044
|
-
if (node.status === "doing") return node.users.some((user) => user.status === "done" && !user.pendingTask);
|
|
6045
|
-
return true;
|
|
6046
|
-
});
|
|
6047
|
-
});
|
|
6048
|
-
/** 选择驳回目标:再次点击已选中项取消选择 */
|
|
6049
|
-
function handleSelectTarget(key) {
|
|
6050
|
-
model.rejectTarget = model.rejectTarget === key ? null : key;
|
|
6051
|
-
}
|
|
6052
|
-
/** 确认提交:校验通过后带出表单值并 emit submitted(携带 done 关闭回调,成功 done() 关闭 / 失败 done(false) 保持打开,由父组件决定);校验失败仅清空确认按钮 loading,弹窗保持打开 */
|
|
6053
|
-
async function handleSubmit(close) {
|
|
6054
|
-
try {
|
|
6055
|
-
await validate();
|
|
6056
|
-
} catch {
|
|
6057
|
-
close(false);
|
|
6058
|
-
return;
|
|
6059
|
-
}
|
|
6060
|
-
const payload = {
|
|
6061
|
-
opinion: model.opinion,
|
|
6062
|
-
attachments: [...model.attachments]
|
|
6063
|
-
};
|
|
6064
|
-
if (props.type === "reject" && model.rejectTarget) {
|
|
6065
|
-
const targetNode = props.nodes.find((item) => (item.id ?? item.name) === model.rejectTarget);
|
|
6066
|
-
payload.rejectNode = targetNode?.name;
|
|
6067
|
-
payload.rejectNodeId = targetNode?.id;
|
|
6068
|
-
}
|
|
6069
|
-
emit("submitted", payload, close);
|
|
6070
|
-
}
|
|
6071
|
-
watch(visible, () => {
|
|
6072
|
-
if (visible.value) {
|
|
6073
|
-
Object.assign(model, createDefaultModel());
|
|
6074
|
-
restoreValidation();
|
|
6075
|
-
}
|
|
6076
|
-
});
|
|
6077
|
-
return (_ctx, _cache) => {
|
|
6078
|
-
const _component_NFormItem = NFormItem;
|
|
6079
|
-
const _component_NInput = NInput;
|
|
6080
|
-
const _component_NForm = NForm;
|
|
6081
|
-
return openBlock(), createBlock(base_modal_default, {
|
|
6082
|
-
show: visible.value,
|
|
6083
|
-
"onUpdate:show": _cache[2] || (_cache[2] = ($event) => visible.value = $event),
|
|
6084
|
-
title: title.value,
|
|
6085
|
-
preset: "card",
|
|
6086
|
-
bordered: false,
|
|
6087
|
-
"display-directive": "show",
|
|
6088
|
-
"cancel-text": "取消",
|
|
6089
|
-
class: "max-w-90% w-600px",
|
|
6090
|
-
"on-before-confirm": handleSubmit
|
|
6091
|
-
}, {
|
|
6092
|
-
default: withCtx(() => [createVNode(_component_NForm, {
|
|
6093
|
-
ref_key: "formRef",
|
|
6094
|
-
ref: formRef,
|
|
6095
|
-
model,
|
|
6096
|
-
rules: rules.value,
|
|
6097
|
-
"label-placement": "left",
|
|
6098
|
-
"label-width": 80
|
|
6099
|
-
}, {
|
|
6100
|
-
default: withCtx(() => [
|
|
6101
|
-
__props.type === "reject" ? (openBlock(), createBlock(_component_NFormItem, {
|
|
6102
|
-
key: 0,
|
|
6103
|
-
label: "驳回节点",
|
|
6104
|
-
path: "rejectTarget"
|
|
6105
|
-
}, {
|
|
6106
|
-
default: withCtx(() => [createElementVNode("div", _hoisted_1$6, [(openBlock(true), createElementBlock(Fragment, null, renderList(filterNodes.value, (node) => {
|
|
6107
|
-
return openBlock(), createBlock(FlowNode_default, {
|
|
6108
|
-
key: node.id ?? node.name,
|
|
6109
|
-
node,
|
|
6110
|
-
mode: "select",
|
|
6111
|
-
"selected-key": model.rejectTarget,
|
|
6112
|
-
onSelect: handleSelectTarget
|
|
6113
|
-
}, null, 8, ["node", "selected-key"]);
|
|
6114
|
-
}), 128))])]),
|
|
6115
|
-
_: 1
|
|
6116
|
-
})) : createCommentVNode("", true),
|
|
6117
|
-
createVNode(_component_NFormItem, {
|
|
6118
|
-
label: "审批意见",
|
|
6119
|
-
path: "opinion"
|
|
6120
|
-
}, {
|
|
6121
|
-
default: withCtx(() => [createVNode(_component_NInput, {
|
|
6122
|
-
value: model.opinion,
|
|
6123
|
-
"onUpdate:value": _cache[0] || (_cache[0] = ($event) => model.opinion = $event),
|
|
6124
|
-
type: "textarea",
|
|
6125
|
-
placeholder: "请输入审批意见",
|
|
6126
|
-
maxlength: 200,
|
|
6127
|
-
"show-count": "",
|
|
6128
|
-
rows: 4
|
|
6129
|
-
}, null, 8, ["value"])]),
|
|
6130
|
-
_: 1
|
|
6131
|
-
}),
|
|
6132
|
-
createVNode(_component_NFormItem, {
|
|
6133
|
-
label: "附件",
|
|
6134
|
-
path: "attachments"
|
|
6135
|
-
}, {
|
|
6136
|
-
default: withCtx(() => [unref(components).FileUpload ? (openBlock(), createBlock(resolveDynamicComponent(unref(components).FileUpload), {
|
|
6137
|
-
key: 0,
|
|
6138
|
-
modelValue: model.attachments,
|
|
6139
|
-
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => model.attachments = $event),
|
|
6140
|
-
"upload-type": "file",
|
|
6141
|
-
drag: false,
|
|
6142
|
-
accept: ".doc,.docx,.xls,.xlsx,.ppt,.pptx,.txt,.pdf,.zip,.rar,.7z,.jpg,.jpeg,.png,.gif,.bmp,.webp"
|
|
6143
|
-
}, null, 8, ["modelValue"])) : (openBlock(), createElementBlock("div", _hoisted_2$4, "未注入附件上传组件(components.FileUpload),附件上传不可用"))]),
|
|
6144
|
-
_: 1
|
|
6145
|
-
})
|
|
6146
|
-
]),
|
|
6147
|
-
_: 1
|
|
6148
|
-
}, 8, ["model", "rules"])]),
|
|
6149
|
-
_: 1
|
|
6150
|
-
}, 8, ["show", "title"]);
|
|
6151
|
-
};
|
|
6152
|
-
}
|
|
6153
|
-
}), [["__scopeId", "data-v-4d9540ab"]]);
|
|
6154
|
-
//#endregion
|
|
6155
5920
|
//#region src/base-ui/base-card-item.vue?vue&type=script&setup=true&lang.ts
|
|
6156
|
-
var _hoisted_1$
|
|
6157
|
-
var _hoisted_2$
|
|
5921
|
+
var _hoisted_1$4 = { class: "header" };
|
|
5922
|
+
var _hoisted_2$4 = { class: "header-left" };
|
|
6158
5923
|
var _hoisted_3$2 = { class: "title" };
|
|
6159
5924
|
var _hoisted_4$2 = {
|
|
6160
5925
|
key: 0,
|
|
@@ -6190,13 +5955,36 @@ var base_card_item_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/
|
|
|
6190
5955
|
_: 2
|
|
6191
5956
|
}, [showHeader.value ? {
|
|
6192
5957
|
name: "header",
|
|
6193
|
-
fn: withCtx(() => [createElementVNode("div", _hoisted_1$
|
|
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)])])]),
|
|
6194
5959
|
key: "0"
|
|
6195
5960
|
} : void 0]), 1040, ["content-style"]);
|
|
6196
5961
|
};
|
|
6197
5962
|
}
|
|
6198
5963
|
}), [["__scopeId", "data-v-e9115957"]]);
|
|
6199
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
|
|
6200
5988
|
//#region src/timeline/timeline-mapping.ts
|
|
6201
5989
|
/** 固定尾节点:节点有数据时渲染追加(display 下状态按流程是否走完覆盖),接口返回与提交数据均不包含 */
|
|
6202
5990
|
var END_NODE = {
|
|
@@ -6312,8 +6100,8 @@ function getFlowStatusTag(mode, data) {
|
|
|
6312
6100
|
}
|
|
6313
6101
|
//#endregion
|
|
6314
6102
|
//#region src/timeline/FlowNodesPanel.vue?vue&type=script&setup=true&lang.ts
|
|
6315
|
-
var _hoisted_1$
|
|
6316
|
-
var _hoisted_2$
|
|
6103
|
+
var _hoisted_1$3 = { class: "flow-node__title" };
|
|
6104
|
+
var _hoisted_2$3 = { class: "flow-node__list" };
|
|
6317
6105
|
//#endregion
|
|
6318
6106
|
//#region src/timeline/FlowNodesPanel.vue
|
|
6319
6107
|
var FlowNodesPanel_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
|
|
@@ -6358,7 +6146,7 @@ var FlowNodesPanel_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/
|
|
|
6358
6146
|
"default-expanded-names": ["flow"]
|
|
6359
6147
|
}, {
|
|
6360
6148
|
default: withCtx(() => [createVNode(_component_NCollapseItem, { name: "flow" }, {
|
|
6361
|
-
header: withCtx(() => [createElementVNode("span", _hoisted_1$
|
|
6149
|
+
header: withCtx(() => [createElementVNode("span", _hoisted_1$3, [createTextVNode(toDisplayString(__props.title) + " ", 1), panelStatusTag.value ? (openBlock(), createBlock(_component_NTag, {
|
|
6362
6150
|
key: 0,
|
|
6363
6151
|
type: panelStatusTag.value.type,
|
|
6364
6152
|
size: "small"
|
|
@@ -6370,7 +6158,7 @@ var FlowNodesPanel_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/
|
|
|
6370
6158
|
show: __props.loading,
|
|
6371
6159
|
class: "w-full"
|
|
6372
6160
|
}, {
|
|
6373
|
-
default: withCtx(() => [createElementVNode("div", _hoisted_2$
|
|
6161
|
+
default: withCtx(() => [createElementVNode("div", _hoisted_2$3, [(openBlock(true), createElementBlock(Fragment, null, renderList(panelNodes.value, (node) => {
|
|
6374
6162
|
return openBlock(), createBlock(FlowNode_default, {
|
|
6375
6163
|
key: node.id ?? node.name,
|
|
6376
6164
|
"selected-users": selectedUsersMap.value[node.name],
|
|
@@ -6399,267 +6187,217 @@ var FlowNodesPanel_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/
|
|
|
6399
6187
|
}
|
|
6400
6188
|
}), [["__scopeId", "data-v-25e5146e"]]);
|
|
6401
6189
|
//#endregion
|
|
6402
|
-
//#region src/
|
|
6403
|
-
var
|
|
6404
|
-
|
|
6405
|
-
|
|
6406
|
-
|
|
6407
|
-
|
|
6408
|
-
|
|
6409
|
-
|
|
6410
|
-
|
|
6411
|
-
|
|
6412
|
-
|
|
6413
|
-
|
|
6414
|
-
|
|
6415
|
-
|
|
6416
|
-
|
|
6417
|
-
|
|
6418
|
-
|
|
6419
|
-
|
|
6420
|
-
type: Boolean,
|
|
6421
|
-
default: false
|
|
6422
|
-
}
|
|
6423
|
-
},
|
|
6424
|
-
emits: [
|
|
6425
|
-
"update:modelValue",
|
|
6426
|
-
"confirm",
|
|
6427
|
-
"cancel"
|
|
6428
|
-
],
|
|
6429
|
-
setup(__props, { expose: __expose, emit: __emit }) {
|
|
6430
|
-
const props = __props;
|
|
6431
|
-
const emit = __emit;
|
|
6432
|
-
const modalVisible = ref(false);
|
|
6433
|
-
const loading = ref(false);
|
|
6434
|
-
const pendingSwitchValue = ref(null);
|
|
6435
|
-
const switchValue = computed({
|
|
6436
|
-
get: () => props.modelValue,
|
|
6437
|
-
set: (value) => emit("update:modelValue", value)
|
|
6438
|
-
});
|
|
6439
|
-
const buttonProps = computed(() => ({
|
|
6440
|
-
...props.buttonConfig,
|
|
6441
|
-
disabled: props.buttonConfig.disabled || loading.value && modalVisible.value
|
|
6442
|
-
}));
|
|
6443
|
-
const switchProps = computed(() => props.switchConfig);
|
|
6444
|
-
watch(modalVisible, (val) => {
|
|
6445
|
-
if (!val) loading.value = false;
|
|
6446
|
-
});
|
|
6447
|
-
function handleOpen() {
|
|
6448
|
-
if (!loading.value) modalVisible.value = true;
|
|
6449
|
-
}
|
|
6450
|
-
function handleSwitchClick(value) {
|
|
6451
|
-
if (loading.value) return;
|
|
6452
|
-
pendingSwitchValue.value = value;
|
|
6453
|
-
modalVisible.value = true;
|
|
6454
|
-
}
|
|
6455
|
-
function handleConfirm() {
|
|
6456
|
-
if (loading.value) return false;
|
|
6457
|
-
if (props.sync) {
|
|
6458
|
-
const confirmValue = pendingSwitchValue.value;
|
|
6459
|
-
if (props.triggerType === "switch" && pendingSwitchValue.value !== null) {
|
|
6460
|
-
switchValue.value = pendingSwitchValue.value;
|
|
6461
|
-
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}`);
|
|
6462
6208
|
}
|
|
6463
|
-
emit("confirm", confirmValue, () => {});
|
|
6464
6209
|
return true;
|
|
6465
6210
|
}
|
|
6466
|
-
loading.value = true;
|
|
6467
|
-
const done = (shouldClose = true) => {
|
|
6468
|
-
loading.value = false;
|
|
6469
|
-
if (shouldClose) {
|
|
6470
|
-
modalVisible.value = false;
|
|
6471
|
-
if (props.triggerType === "switch" && pendingSwitchValue.value !== null) {
|
|
6472
|
-
switchValue.value = pendingSwitchValue.value;
|
|
6473
|
-
pendingSwitchValue.value = null;
|
|
6474
|
-
}
|
|
6475
|
-
}
|
|
6476
|
-
};
|
|
6477
|
-
emit("confirm", pendingSwitchValue.value, done);
|
|
6478
|
-
return false;
|
|
6479
|
-
}
|
|
6480
|
-
function handleCancel() {
|
|
6481
|
-
pendingSwitchValue.value = null;
|
|
6482
|
-
emit("cancel");
|
|
6483
|
-
}
|
|
6484
|
-
__expose({
|
|
6485
|
-
open: handleOpen,
|
|
6486
|
-
close: () => {
|
|
6487
|
-
modalVisible.value = false;
|
|
6488
|
-
}
|
|
6489
|
-
});
|
|
6490
|
-
return (_ctx, _cache) => {
|
|
6491
|
-
return openBlock(), createElementBlock("div", _hoisted_1$3, [__props.triggerType === "button" ? (openBlock(), createBlock(unref(NButton), mergeProps({ key: 0 }, buttonProps.value, { onClick: handleOpen }), createSlots({
|
|
6492
|
-
default: withCtx(() => [renderSlot(_ctx.$slots, "default", {}, void 0, true)]),
|
|
6493
|
-
_: 2
|
|
6494
|
-
}, [_ctx.$slots.icon ? {
|
|
6495
|
-
name: "icon",
|
|
6496
|
-
fn: withCtx(() => [renderSlot(_ctx.$slots, "icon", {}, void 0, true)]),
|
|
6497
|
-
key: "0"
|
|
6498
|
-
} : void 0]), 1040)) : __props.triggerType === "switch" ? (openBlock(), createBlock(unref(NSwitch), mergeProps({
|
|
6499
|
-
key: 1,
|
|
6500
|
-
value: switchValue.value,
|
|
6501
|
-
loading: loading.value
|
|
6502
|
-
}, switchProps.value, { "onUpdate:value": handleSwitchClick }), null, 16, ["value", "loading"])) : __props.triggerType === "custom" ? renderSlot(_ctx.$slots, "trigger", {
|
|
6503
|
-
key: 2,
|
|
6504
|
-
loading: loading.value,
|
|
6505
|
-
open: handleOpen
|
|
6506
|
-
}, void 0, true) : createCommentVNode("", true), createVNode(unref(NModal), mergeProps({
|
|
6507
|
-
show: modalVisible.value,
|
|
6508
|
-
"onUpdate:show": _cache[0] || (_cache[0] = ($event) => modalVisible.value = $event),
|
|
6509
|
-
preset: "dialog",
|
|
6510
|
-
type: "warning",
|
|
6511
|
-
title: __props.title,
|
|
6512
|
-
"positive-text": __props.positiveText,
|
|
6513
|
-
"negative-text": __props.negativeText,
|
|
6514
|
-
"positive-button-props": { loading: loading.value }
|
|
6515
|
-
}, __props.modalProps, {
|
|
6516
|
-
"checked-value": "0",
|
|
6517
|
-
"unchecked-value": "1",
|
|
6518
|
-
onPositiveClick: handleConfirm,
|
|
6519
|
-
onNegativeClick: handleCancel
|
|
6520
|
-
}), {
|
|
6521
|
-
default: withCtx(() => [createTextVNode(toDisplayString(__props.content) + " ", 1), renderSlot(_ctx.$slots, "content", {}, void 0, true)]),
|
|
6522
|
-
_: 3
|
|
6523
|
-
}, 16, [
|
|
6524
|
-
"show",
|
|
6525
|
-
"title",
|
|
6526
|
-
"positive-text",
|
|
6527
|
-
"negative-text",
|
|
6528
|
-
"positive-button-props"
|
|
6529
|
-
])]);
|
|
6530
6211
|
};
|
|
6531
6212
|
}
|
|
6532
|
-
|
|
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
|
+
}
|
|
6533
6229
|
//#endregion
|
|
6534
|
-
//#region src/
|
|
6535
|
-
var _hoisted_1$2 = {
|
|
6536
|
-
|
|
6537
|
-
|
|
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" }
|
|
6538
6235
|
};
|
|
6539
6236
|
//#endregion
|
|
6540
|
-
//#region src/
|
|
6541
|
-
var
|
|
6542
|
-
name: "
|
|
6543
|
-
|
|
6544
|
-
|
|
6545
|
-
|
|
6546
|
-
|
|
6547
|
-
|
|
6548
|
-
|
|
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": {
|
|
6549
6246
|
type: Boolean,
|
|
6550
6247
|
default: false
|
|
6551
6248
|
},
|
|
6552
|
-
|
|
6553
|
-
|
|
6554
|
-
|
|
6555
|
-
props: {},
|
|
6556
|
-
doubleConfirm: false,
|
|
6557
|
-
doubleConfirmTitle: "确认取消",
|
|
6558
|
-
doubleConfirmContent: "确定要取消吗?"
|
|
6559
|
-
}) },
|
|
6560
|
-
confirmConfig: { default: () => ({
|
|
6561
|
-
show: true,
|
|
6562
|
-
text: "确认",
|
|
6563
|
-
props: { type: "primary" },
|
|
6564
|
-
doubleConfirm: false,
|
|
6565
|
-
doubleConfirmTitle: "确认操作",
|
|
6566
|
-
doubleConfirmContent: "确定要执行此操作吗?"
|
|
6567
|
-
}) },
|
|
6568
|
-
onBeforeCancel: {
|
|
6569
|
-
type: Function,
|
|
6570
|
-
default: void 0
|
|
6571
|
-
},
|
|
6572
|
-
onBeforeConfirm: {
|
|
6573
|
-
type: Function,
|
|
6574
|
-
default: void 0
|
|
6575
|
-
}
|
|
6576
|
-
},
|
|
6577
|
-
emits: ["cancel", "confirm"],
|
|
6249
|
+
"visibleModifiers": {}
|
|
6250
|
+
}),
|
|
6251
|
+
emits: /* @__PURE__ */ mergeModels(["submitted"], ["update:visible"]),
|
|
6578
6252
|
setup(__props, { emit: __emit }) {
|
|
6579
6253
|
const props = __props;
|
|
6580
|
-
|
|
6581
|
-
props.
|
|
6254
|
+
/** 弹窗标题:按审批类型区分;附件类型复用 file-upload 导出的 UploadResource */
|
|
6255
|
+
const title = computed(() => props.type === "reject" ? "驳回意见" : "审批意见");
|
|
6582
6256
|
const emit = __emit;
|
|
6583
|
-
const
|
|
6584
|
-
|
|
6585
|
-
|
|
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
|
+
};
|
|
6586
6268
|
}
|
|
6587
|
-
|
|
6588
|
-
|
|
6589
|
-
|
|
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;
|
|
6590
6298
|
}
|
|
6591
|
-
|
|
6592
|
-
|
|
6593
|
-
|
|
6594
|
-
|
|
6595
|
-
}
|
|
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);
|
|
6596
6317
|
}
|
|
6597
|
-
|
|
6598
|
-
|
|
6318
|
+
watch(visible, () => {
|
|
6319
|
+
if (visible.value) {
|
|
6320
|
+
Object.assign(model, createDefaultModel());
|
|
6321
|
+
restoreValidation();
|
|
6322
|
+
}
|
|
6323
|
+
});
|
|
6599
6324
|
return (_ctx, _cache) => {
|
|
6600
|
-
|
|
6601
|
-
|
|
6602
|
-
|
|
6603
|
-
|
|
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
|
|
6604
6346
|
}, {
|
|
6605
|
-
default: withCtx(() => [renderSlot(_ctx.$slots, "default", {}, void 0, true)]),
|
|
6606
|
-
_: 3
|
|
6607
|
-
}, 8, ["show"]), showFooter.value ? (openBlock(), createElementBlock("div", _hoisted_1$2, [renderSlot(_ctx.$slots, "footer", {}, () => [createVNode(unref(NSpace), { size: 12 }, {
|
|
6608
6347
|
default: withCtx(() => [
|
|
6609
|
-
|
|
6610
|
-
__props.cancelConfig?.show && __props.cancelConfig?.doubleConfirm ? (openBlock(), createBlock(yg_confirm_default, {
|
|
6348
|
+
__props.type === "reject" ? (openBlock(), createBlock(_component_NFormItem, {
|
|
6611
6349
|
key: 0,
|
|
6612
|
-
|
|
6613
|
-
|
|
6614
|
-
"positive-text": __props.cancelConfig.text,
|
|
6615
|
-
"button-config": __props.cancelConfig.props,
|
|
6616
|
-
onConfirm: handleCancel
|
|
6350
|
+
label: "驳回节点",
|
|
6351
|
+
path: "rejectTarget"
|
|
6617
6352
|
}, {
|
|
6618
|
-
default: withCtx(() => [
|
|
6619
|
-
|
|
6620
|
-
|
|
6621
|
-
|
|
6622
|
-
|
|
6623
|
-
|
|
6624
|
-
|
|
6625
|
-
|
|
6626
|
-
|
|
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))])]),
|
|
6627
6362
|
_: 1
|
|
6628
|
-
}
|
|
6629
|
-
|
|
6630
|
-
|
|
6631
|
-
|
|
6632
|
-
title: __props.confirmConfig.doubleConfirmTitle,
|
|
6633
|
-
content: __props.confirmConfig.doubleConfirmContent,
|
|
6634
|
-
"positive-text": __props.confirmConfig.text,
|
|
6635
|
-
"button-config": {
|
|
6636
|
-
...__props.confirmConfig.props,
|
|
6637
|
-
loading: confirmLoading.value
|
|
6638
|
-
},
|
|
6639
|
-
onConfirm: handleConfirm
|
|
6363
|
+
})) : createCommentVNode("", true),
|
|
6364
|
+
createVNode(_component_NFormItem, {
|
|
6365
|
+
label: "审批意见",
|
|
6366
|
+
path: "opinion"
|
|
6640
6367
|
}, {
|
|
6641
|
-
default: withCtx(() => [
|
|
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"])]),
|
|
6642
6377
|
_: 1
|
|
6643
|
-
},
|
|
6644
|
-
|
|
6645
|
-
"
|
|
6646
|
-
"
|
|
6647
|
-
|
|
6648
|
-
|
|
6649
|
-
|
|
6650
|
-
|
|
6651
|
-
|
|
6652
|
-
|
|
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),附件上传不可用"))]),
|
|
6653
6391
|
_: 1
|
|
6654
|
-
}
|
|
6392
|
+
})
|
|
6655
6393
|
]),
|
|
6656
|
-
_:
|
|
6657
|
-
}
|
|
6658
|
-
_:
|
|
6659
|
-
});
|
|
6394
|
+
_: 1
|
|
6395
|
+
}, 8, ["model", "rules"])]),
|
|
6396
|
+
_: 1
|
|
6397
|
+
}, 8, ["show", "title"]);
|
|
6660
6398
|
};
|
|
6661
6399
|
}
|
|
6662
|
-
}), [["__scopeId", "data-v-
|
|
6400
|
+
}), [["__scopeId", "data-v-4d9540ab"]]);
|
|
6663
6401
|
//#endregion
|
|
6664
6402
|
//#region src/adapter/wflow.ts
|
|
6665
6403
|
/** 获取流程配置详情(GET /wflow/config/{config_id}) */
|
|
@@ -6702,42 +6440,27 @@ function fetchWflowUndoReject(data) {
|
|
|
6702
6440
|
});
|
|
6703
6441
|
}
|
|
6704
6442
|
//#endregion
|
|
6705
|
-
//#region src/timeline/
|
|
6706
|
-
var
|
|
6707
|
-
name: "
|
|
6708
|
-
__name: "
|
|
6443
|
+
//#region src/timeline/FlowActions.vue
|
|
6444
|
+
var FlowActions_default = /* @__PURE__ */ defineComponent({
|
|
6445
|
+
name: "FlowActions",
|
|
6446
|
+
__name: "FlowActions",
|
|
6709
6447
|
props: {
|
|
6710
|
-
|
|
6711
|
-
flowId: {},
|
|
6712
|
-
mode: {},
|
|
6713
|
-
beforeSubmit: {},
|
|
6714
|
-
getFormData: {},
|
|
6715
|
-
timelineData: {},
|
|
6448
|
+
data: {},
|
|
6716
6449
|
approval: {
|
|
6717
6450
|
type: Boolean,
|
|
6718
6451
|
default: true
|
|
6719
6452
|
}
|
|
6720
6453
|
},
|
|
6721
|
-
emits: [
|
|
6722
|
-
|
|
6723
|
-
|
|
6724
|
-
|
|
6725
|
-
],
|
|
6726
|
-
setup(__props, { expose: __expose, emit: __emit }) {
|
|
6454
|
+
emits: ["success"],
|
|
6455
|
+
setup(__props, { emit: __emit }) {
|
|
6456
|
+
/** 操作按钮组件 props */
|
|
6457
|
+
const props = __props;
|
|
6727
6458
|
/** 审批处理成功(同意/驳回接口调用成功) */
|
|
6728
6459
|
const emit = __emit;
|
|
6729
|
-
/**
|
|
6730
|
-
const
|
|
6731
|
-
/**
|
|
6732
|
-
const
|
|
6733
|
-
/** 是否展示驳回操作:仅 display 模式审批模式(approval 未传或 true)且 undo_finished=0(未处理);form 发起模式/纯查看无驳回 */
|
|
6734
|
-
const canReject = computed(() => props.mode !== "form" && props.approval !== false && props.timelineData?.undo_finished === 0);
|
|
6735
|
-
/** 折叠面板标题流程状态标签:仅 display 模式展示,颜色映射 已同意=success / 已拒绝=error / 进行中=warning */
|
|
6736
|
-
const flowStatusTag = computed(() => getFlowStatusTag(props.mode, props.timelineData));
|
|
6737
|
-
/** 关闭:通知消费页(display=关闭详情页,form=取消发起);页签关闭逻辑由消费页承担 */
|
|
6738
|
-
function handleClose() {
|
|
6739
|
-
emit("close");
|
|
6740
|
-
}
|
|
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));
|
|
6741
6464
|
/** 审批弹窗显示状态 */
|
|
6742
6465
|
const approvalVisible = ref(false);
|
|
6743
6466
|
/** 当前审批类型:approve=同意 / reject=驳回 */
|
|
@@ -6747,56 +6470,6 @@ var FlowLayout_default = /* @__PURE__ */ defineComponent({
|
|
|
6747
6470
|
approvalType.value = type;
|
|
6748
6471
|
approvalVisible.value = true;
|
|
6749
6472
|
}
|
|
6750
|
-
/** 自选审批人节点已选人员(key=节点名,由 FlowNode 经 v-model:selected-users 回写,提交时校验至少 1 人) */
|
|
6751
|
-
const selfSelectedUsersMap = ref({});
|
|
6752
|
-
/** 确认:display=同意(打开审批弹窗);form=提交流程(校验全部通过后调用发起接口创建流程实例,成功后关闭当前页);done 结束 BaseCard 确认按钮 loading(校验失败或请求完成后调用) */
|
|
6753
|
-
async function handleConfirm(done) {
|
|
6754
|
-
if (props.mode !== "form") {
|
|
6755
|
-
openApproval("approve");
|
|
6756
|
-
done();
|
|
6757
|
-
return;
|
|
6758
|
-
}
|
|
6759
|
-
if (props.beforeSubmit && !await props.beforeSubmit()) {
|
|
6760
|
-
window.$message?.warning("请将表单填写完整");
|
|
6761
|
-
done();
|
|
6762
|
-
return;
|
|
6763
|
-
}
|
|
6764
|
-
if (!formNodes.value.length) {
|
|
6765
|
-
window.$message?.warning("流程节点未加载,请将必填字段填写完整");
|
|
6766
|
-
done();
|
|
6767
|
-
return;
|
|
6768
|
-
}
|
|
6769
|
-
const emptySelfSelectNode = formNodes.value.find((node) => node.type === "approver" && node.selfSelect && !selfSelectedUsersMap.value[node.name]?.length);
|
|
6770
|
-
if (emptySelfSelectNode) {
|
|
6771
|
-
window.$message?.warning(`请为「${emptySelfSelectNode.name}」选择至少 1 名审批人`);
|
|
6772
|
-
done();
|
|
6773
|
-
return;
|
|
6774
|
-
}
|
|
6775
|
-
const nodes = formNodes.value.filter((node) => node.type !== "end").map((node) => ({
|
|
6776
|
-
type: node.type,
|
|
6777
|
-
name: node.name,
|
|
6778
|
-
desc: node.desc,
|
|
6779
|
-
mode: node.mode,
|
|
6780
|
-
selfSelect: node.selfSelect,
|
|
6781
|
-
users: node.selfSelect ? selfSelectedUsersMap.value[node.name] ?? [] : node.users.map((user) => ({
|
|
6782
|
-
id: user.id,
|
|
6783
|
-
name: user.name
|
|
6784
|
-
}))
|
|
6785
|
-
}));
|
|
6786
|
-
const { error } = await fetchLaunchWflowFlow({
|
|
6787
|
-
flow_id: Number(props.flowId),
|
|
6788
|
-
form: props.getFormData?.() ?? {},
|
|
6789
|
-
nodes
|
|
6790
|
-
});
|
|
6791
|
-
done();
|
|
6792
|
-
if (error) return;
|
|
6793
|
-
window.$message?.success("流程提交成功");
|
|
6794
|
-
emit("submitted");
|
|
6795
|
-
}
|
|
6796
|
-
/** 驳回:打开审批弹窗 */
|
|
6797
|
-
function handleReject() {
|
|
6798
|
-
openApproval("reject");
|
|
6799
|
-
}
|
|
6800
6473
|
/** 撤回:二次确认(window.$dialog 由宿主 app-provider 注入);撤回接口待接入,确认后暂仅提示成功 */
|
|
6801
6474
|
function handleWithdraw() {
|
|
6802
6475
|
window.$dialog?.warning({
|
|
@@ -6811,7 +6484,7 @@ var FlowLayout_default = /* @__PURE__ */ defineComponent({
|
|
|
6811
6484
|
}
|
|
6812
6485
|
/** 审批弹窗提交:approve 调 /wflow/undo/approve(意见附件可空)、reject 调 /wflow/undo/reject(意见与目标节点 ID 必传,整节点重置);成功 done() 关闭弹窗并 emit success 通知页面刷新详情,失败 done(false) 保持弹窗打开并结束确认按钮 loading */
|
|
6813
6486
|
async function handleApprovalSubmit(value, done) {
|
|
6814
|
-
const undoId = props.
|
|
6487
|
+
const undoId = props.data?.undo_id;
|
|
6815
6488
|
if (!undoId) {
|
|
6816
6489
|
window.$message?.error("未获取到待办审批记录ID,无法处理");
|
|
6817
6490
|
done(false);
|
|
@@ -6845,128 +6518,48 @@ var FlowLayout_default = /* @__PURE__ */ defineComponent({
|
|
|
6845
6518
|
}
|
|
6846
6519
|
emit("success");
|
|
6847
6520
|
}
|
|
6848
|
-
/** form 模式节点链:条件字段全部填写后经 fetchFlowNodes 请求所得(不同条件值得到不同节点),为空时节点区展示空态提示;不含 end 结束节点 */
|
|
6849
|
-
const formNodes = ref([]);
|
|
6850
|
-
/** form 模式节点请求中:节点区 NSpin loading(仅节点接口请求期间为 true,display 模式恒为 false) */
|
|
6851
|
-
const flowNodesLoading = ref(false);
|
|
6852
|
-
/** 流程条件字段 key 列表(拉取流程配置后提取,不在页面渲染;条件值取自父组件 getFormData 返回的表单数据) */
|
|
6853
|
-
const conditionKeys = ref([]);
|
|
6854
|
-
/** 流程配置请求 Promise:fetchFlowNodes 先等待其完成再校验条件字段,避免初始化时配置未返回、条件字段列表为空被误判为「无条件字段」直接请求节点 */
|
|
6855
|
-
let flowConfigReady = Promise.resolve();
|
|
6856
|
-
/** 进页面获取流程配置:字段配置 fields 中「是否参与条件」condition=true 的字段即条件字段(仅 form 模式需要) */
|
|
6857
|
-
async function initFlowConfig() {
|
|
6858
|
-
if (props.mode !== "form" || !props.flowId) return;
|
|
6859
|
-
const { data, error } = await fetchGetWflowConfigDetail(Number(props.flowId));
|
|
6860
|
-
if (error || !data?.config) return;
|
|
6861
|
-
conditionKeys.value = (data.config.fields ?? []).filter((field) => field.condition && field.key).map((field) => field.key);
|
|
6862
|
-
}
|
|
6863
|
-
/** 条件字段是否全部填写完成:条件字段值取自父组件表单数据(数组非空 / 非 null / 非空串;流程无条件字段时视为填齐),暴露给父组件提交校验调用 */
|
|
6864
|
-
function isConditionsFilled() {
|
|
6865
|
-
if (!conditionKeys.value.length) return true;
|
|
6866
|
-
const formData = props.getFormData?.() ?? {};
|
|
6867
|
-
return conditionKeys.value.every((key) => {
|
|
6868
|
-
const value = formData[key];
|
|
6869
|
-
if (Array.isArray(value)) return value.length > 0;
|
|
6870
|
-
return value !== "" && value !== null && value !== void 0;
|
|
6871
|
-
});
|
|
6872
|
-
}
|
|
6873
|
-
/** 请求流程节点(暴露给父组件在表单变化防抖后调用):先等待流程配置就绪(条件字段提取完成)再校验条件字段填齐,随后携带整份表单数据 + 流程 ID 请求,后端按表单值匹配条件分支;条件字段未填齐/请求失败/返回为空时节点链保持不变(节点区空态提示) */
|
|
6874
|
-
async function fetchFlowNodes() {
|
|
6875
|
-
if (props.mode !== "form" || !props.flowId) return;
|
|
6876
|
-
await flowConfigReady;
|
|
6877
|
-
if (!isConditionsFilled()) return;
|
|
6878
|
-
flowNodesLoading.value = true;
|
|
6879
|
-
try {
|
|
6880
|
-
const { data, error } = await fetchGetWflowFlowNodes({
|
|
6881
|
-
flow_id: Number(props.flowId),
|
|
6882
|
-
form: props.getFormData?.() ?? {}
|
|
6883
|
-
});
|
|
6884
|
-
if (error || !data?.nodes?.length) return;
|
|
6885
|
-
formNodes.value = data.nodes;
|
|
6886
|
-
} finally {
|
|
6887
|
-
flowNodesLoading.value = false;
|
|
6888
|
-
}
|
|
6889
|
-
}
|
|
6890
|
-
__expose({
|
|
6891
|
-
fetchFlowNodes,
|
|
6892
|
-
isConditionsFilled
|
|
6893
|
-
});
|
|
6894
|
-
onMounted(() => {
|
|
6895
|
-
flowConfigReady = initFlowConfig();
|
|
6896
|
-
});
|
|
6897
|
-
/** display 模式审批时间线:节点快照直接映射 FlowNodeItem(映射规则详见 timeline-mapping.mapTimelineNodes) */
|
|
6898
|
-
const displayNodes = computed(() => mapTimelineNodes(props.timelineData));
|
|
6899
|
-
/** 按渲染模式取节点链:form=发起节点链、display=审批时间线(均为组件内部处理所得),有数据时统一追加 END 结束节点,无数据为空数组走空态 */
|
|
6900
|
-
const flowNodes = computed(() => withEndNode(props.mode === "form" ? formNodes.value : displayNodes.value, props.mode));
|
|
6901
6521
|
return (_ctx, _cache) => {
|
|
6902
|
-
|
|
6903
|
-
|
|
6904
|
-
|
|
6905
|
-
"
|
|
6906
|
-
|
|
6907
|
-
text: "关闭"
|
|
6908
|
-
},
|
|
6909
|
-
"confirm-config": {
|
|
6910
|
-
show: canOperate.value,
|
|
6911
|
-
text: __props.mode === "form" ? "提交" : "同意",
|
|
6912
|
-
props: { type: "primary" }
|
|
6913
|
-
},
|
|
6914
|
-
"on-before-confirm": handleConfirm,
|
|
6915
|
-
onCancel: handleClose
|
|
6916
|
-
}, createSlots({
|
|
6522
|
+
return openBlock(), createElementBlock(Fragment, null, [visible.value ? (openBlock(), createBlock(unref(NSpace), {
|
|
6523
|
+
key: 0,
|
|
6524
|
+
size: 12,
|
|
6525
|
+
align: "center"
|
|
6526
|
+
}, {
|
|
6917
6527
|
default: withCtx(() => [
|
|
6918
|
-
|
|
6919
|
-
createVNode(FlowNodesPanel_default, {
|
|
6920
|
-
"selected-users-map": selfSelectedUsersMap.value,
|
|
6921
|
-
"onUpdate:selectedUsersMap": _cache[0] || (_cache[0] = ($event) => selfSelectedUsersMap.value = $event),
|
|
6922
|
-
nodes: flowNodes.value,
|
|
6923
|
-
mode: __props.mode,
|
|
6924
|
-
loading: flowNodesLoading.value,
|
|
6925
|
-
"status-tag": flowStatusTag.value
|
|
6926
|
-
}, null, 8, [
|
|
6927
|
-
"selected-users-map",
|
|
6928
|
-
"nodes",
|
|
6929
|
-
"mode",
|
|
6930
|
-
"loading",
|
|
6931
|
-
"status-tag"
|
|
6932
|
-
]),
|
|
6933
|
-
canReject.value ? (openBlock(), createBlock(ApprovalModal_default, {
|
|
6934
|
-
key: 0,
|
|
6935
|
-
visible: approvalVisible.value,
|
|
6936
|
-
"onUpdate:visible": _cache[1] || (_cache[1] = ($event) => approvalVisible.value = $event),
|
|
6937
|
-
type: approvalType.value,
|
|
6938
|
-
nodes: flowNodes.value,
|
|
6939
|
-
onSubmitted: handleApprovalSubmit
|
|
6940
|
-
}, null, 8, [
|
|
6941
|
-
"visible",
|
|
6942
|
-
"type",
|
|
6943
|
-
"nodes"
|
|
6944
|
-
])) : createCommentVNode("", true)
|
|
6945
|
-
]),
|
|
6946
|
-
_: 2
|
|
6947
|
-
}, [canReject.value || _ctx.$slots["footer-center"] ? {
|
|
6948
|
-
name: "footer-center",
|
|
6949
|
-
fn: withCtx(() => [
|
|
6950
|
-
canReject.value ? (openBlock(), createBlock(_component_NButton, {
|
|
6951
|
-
key: 0,
|
|
6528
|
+
createVNode(unref(NButton), {
|
|
6952
6529
|
type: "warning",
|
|
6953
6530
|
onClick: handleWithdraw
|
|
6954
6531
|
}, {
|
|
6955
|
-
default: withCtx(() => [..._cache[
|
|
6532
|
+
default: withCtx(() => [..._cache[3] || (_cache[3] = [createTextVNode("撤回", -1)])]),
|
|
6956
6533
|
_: 1
|
|
6957
|
-
})
|
|
6958
|
-
|
|
6959
|
-
key: 1,
|
|
6534
|
+
}),
|
|
6535
|
+
createVNode(unref(NButton), {
|
|
6960
6536
|
type: "error",
|
|
6961
|
-
onClick:
|
|
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"))
|
|
6962
6545
|
}, {
|
|
6963
|
-
default: withCtx(() => [..._cache[
|
|
6546
|
+
default: withCtx(() => [..._cache[5] || (_cache[5] = [createTextVNode("同意", -1)])]),
|
|
6964
6547
|
_: 1
|
|
6965
|
-
})
|
|
6966
|
-
renderSlot(_ctx.$slots, "footer-center")
|
|
6548
|
+
})
|
|
6967
6549
|
]),
|
|
6968
|
-
|
|
6969
|
-
} :
|
|
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);
|
|
6970
6563
|
};
|
|
6971
6564
|
}
|
|
6972
6565
|
});
|
|
@@ -7205,4 +6798,4 @@ var flow_list_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__
|
|
|
7205
6798
|
}
|
|
7206
6799
|
}), [["__scopeId", "data-v-56ed3cd3"]]);
|
|
7207
6800
|
//#endregion
|
|
7208
|
-
export { ApprovalModal_default as ApprovalModal, FLOW_UI_KEY, FlowAvatar_default as FlowAvatar, FlowConfig_default as FlowConfig, FlowConfigField_default as FlowConfigField, FlowConfigMore_default as FlowConfigMore,
|
|
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 };
|