@qfei-design/make-app-approval 0.2.1 → 0.2.2
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/PUBLIC_API.md +24 -11
- package/README.md +5 -5
- package/dist/detail/task-policy.d.ts +3 -2
- package/dist/detail/types.d.ts +10 -3
- package/dist/detail.cjs +1 -1
- package/dist/detail.mjs +274 -315
- package/dist/list/index.d.ts +1 -1
- package/dist/list/types.d.ts +9 -2
- package/dist/list/ui-components.d.ts +4 -2
- package/dist/list.cjs +1 -1
- package/dist/list.mjs +143 -145
- package/dist/styles.css +2 -9
- package/dist/withdrawal.d.ts +0 -1
- package/docs/host-integration.md +34 -29
- package/docs/implementation-plan.md +11 -9
- package/docs/publishing.md +1 -1
- package/examples/detail-integration.tsx +4 -1
- package/examples/host-integration.tsx +5 -4
- package/package.ai.json +6 -3
- package/package.json +1 -1
- package/recipes.json +6 -6
package/dist/detail.mjs
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { ApprovalStatus as
|
|
4
|
-
import { isApprovalSystemField as
|
|
5
|
-
const
|
|
1
|
+
import { jsx as c, jsxs as m, Fragment as Ee } from "react/jsx-runtime";
|
|
2
|
+
import { useState as f, useRef as V, useEffect as M, useId as Ae } from "react";
|
|
3
|
+
import { ApprovalStatus as Ne } from "./react.mjs";
|
|
4
|
+
import { isApprovalSystemField as Oe } from "./index.mjs";
|
|
5
|
+
const v = (e) => !!e && typeof e == "object" && !Array.isArray(e), g = (e) => typeof e == "string" && e.trim().length > 0, Te = ["APPROVE", "REJECT", "RETURN", "SUBMIT"], F = (e) => {
|
|
6
6
|
if (e === void 0) return [];
|
|
7
|
-
if (!
|
|
7
|
+
if (!v(e)) throw new Error("审批字段权限格式无效");
|
|
8
8
|
if (e.scope === "NONE" && e.fields === void 0) return [];
|
|
9
|
-
if (e.scope !== "FIELDS" || !Array.isArray(e.fields) || !e.fields.every(
|
|
9
|
+
if (e.scope !== "FIELDS" || !Array.isArray(e.fields) || !e.fields.every(g) || new Set(e.fields).size !== e.fields.length)
|
|
10
10
|
throw new Error("审批字段权限范围无效");
|
|
11
11
|
return e.fields;
|
|
12
|
-
}, Ie = (e) =>
|
|
13
|
-
if (!
|
|
12
|
+
}, Ie = (e) => v(e) && g(e.key) && g(e.label) && (e.required === void 0 || typeof e.required == "boolean") && (e.fullWidth === void 0 || typeof e.fullWidth == "boolean") && (e.schema === void 0 || v(e.schema)), Se = (e) => {
|
|
13
|
+
if (!v(e) || !Te.some((s) => s === e.actionType) || e.commentPolicy !== "REQUIRED" && e.commentPolicy !== "OPTIONAL")
|
|
14
14
|
return !1;
|
|
15
|
-
const
|
|
16
|
-
return
|
|
15
|
+
const r = e.returnTargets;
|
|
16
|
+
return r === void 0 || Array.isArray(r) && r.every((s) => v(s) && g(s.nodeKey) && g(s.nodeName)) && new Set(r.map((s) => s.nodeKey)).size === r.length;
|
|
17
17
|
}, pe = (e) => {
|
|
18
|
-
if (!
|
|
18
|
+
if (!v(e) || !g(e.taskId) || !g(e.processInstanceId) || !g(e.taskName) || !g(e.processStatus) || !Array.isArray(e.fields) || !e.fields.every(Ie) || !v(e.formData))
|
|
19
19
|
throw new Error("审批详情数据不完整");
|
|
20
|
-
const
|
|
21
|
-
if (new Set(
|
|
22
|
-
if (e.fieldPermission !== void 0 && !
|
|
20
|
+
const r = e.fields.map((p) => p.key);
|
|
21
|
+
if (new Set(r).size !== r.length) throw new Error("审批字段标识重复");
|
|
22
|
+
if (e.fieldPermission !== void 0 && !v(e.fieldPermission))
|
|
23
23
|
throw new Error("审批字段权限格式无效");
|
|
24
|
-
const
|
|
25
|
-
if (
|
|
24
|
+
const s = e.fieldPermission, a = F(s?.viewPermission), d = F(s?.editPermission);
|
|
25
|
+
if (a.some((p) => !r.includes(p)) || d.some((p) => !a.includes(p)))
|
|
26
26
|
throw new Error("审批字段元数据或权限不一致");
|
|
27
|
-
const
|
|
28
|
-
if (!Array.isArray(
|
|
27
|
+
const n = e.actions ?? [];
|
|
28
|
+
if (!Array.isArray(n) || !n.every(Se) || new Set(n.map((p) => p.actionType)).size !== n.length)
|
|
29
29
|
throw new Error("审批操作配置无效");
|
|
30
30
|
return {
|
|
31
31
|
taskId: e.taskId,
|
|
@@ -34,298 +34,315 @@ const N = (e) => !!e && typeof e == "object" && !Array.isArray(e), b = (e) => ty
|
|
|
34
34
|
processStatus: e.processStatus,
|
|
35
35
|
fields: e.fields,
|
|
36
36
|
formData: e.formData,
|
|
37
|
-
actions:
|
|
37
|
+
actions: n,
|
|
38
38
|
fieldPermission: {
|
|
39
|
-
viewPermission: { scope: "FIELDS", fields:
|
|
40
|
-
editPermission: { scope: "FIELDS", fields:
|
|
39
|
+
viewPermission: { scope: "FIELDS", fields: a },
|
|
40
|
+
editPermission: { scope: "FIELDS", fields: d }
|
|
41
41
|
}
|
|
42
42
|
};
|
|
43
|
-
},
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
),
|
|
47
|
-
|
|
43
|
+
}, D = (e) => {
|
|
44
|
+
const r = new Set(
|
|
45
|
+
F(e.fieldPermission?.viewPermission)
|
|
46
|
+
), s = new Set(
|
|
47
|
+
F(e.fieldPermission?.editPermission)
|
|
48
48
|
);
|
|
49
|
-
return e.fields.filter((
|
|
50
|
-
...
|
|
51
|
-
editable:
|
|
49
|
+
return e.fields.filter((a) => r.has(a.key)).map((a) => ({
|
|
50
|
+
...a,
|
|
51
|
+
editable: s.has(a.key) && !Oe(a.key)
|
|
52
52
|
}));
|
|
53
53
|
};
|
|
54
|
-
class
|
|
55
|
-
constructor(
|
|
56
|
-
super(
|
|
54
|
+
class b extends Error {
|
|
55
|
+
constructor(r, s = {}, a) {
|
|
56
|
+
super(r), this.fieldErrors = s, this.control = a, this.name = "ApprovalTaskValidationError";
|
|
57
57
|
}
|
|
58
58
|
fieldErrors;
|
|
59
|
+
control;
|
|
59
60
|
}
|
|
60
|
-
const
|
|
61
|
-
e.filter((
|
|
62
|
-
const
|
|
63
|
-
return
|
|
64
|
-
}).map((
|
|
65
|
-
), le = (e,
|
|
66
|
-
const
|
|
67
|
-
if (!
|
|
68
|
-
throw new
|
|
69
|
-
const
|
|
70
|
-
|
|
61
|
+
const z = (e) => e.actionType === "RETURN" || e.actionType === "REJECT" || e.actionType === "SUBMIT" && e.commentPolicy === "REQUIRED", Re = (e, r) => Object.fromEntries(
|
|
62
|
+
e.filter((s) => {
|
|
63
|
+
const a = r[s.key];
|
|
64
|
+
return a == null || typeof a == "string" && !a.trim() || Array.isArray(a) && a.length === 0;
|
|
65
|
+
}).map((s) => [s.key, `请填写${s.label}`])
|
|
66
|
+
), le = (e, r, s, a, d = "") => {
|
|
67
|
+
const n = e.actions.find((l) => l.actionType === r);
|
|
68
|
+
if (!n)
|
|
69
|
+
throw new b("当前节点不允许此操作,请刷新详情");
|
|
70
|
+
const p = r === "RETURN" ? {} : s, y = new Set(
|
|
71
|
+
D(e).filter((l) => l.editable).map((l) => l.key)
|
|
71
72
|
);
|
|
72
|
-
if (Object.keys(
|
|
73
|
-
throw new
|
|
74
|
-
if (
|
|
75
|
-
throw new
|
|
76
|
-
if (
|
|
77
|
-
throw new
|
|
78
|
-
|
|
79
|
-
|
|
73
|
+
if (Object.keys(p).some((l) => !y.has(l)))
|
|
74
|
+
throw new b("字段权限已变化,请重新加载详情");
|
|
75
|
+
if (z(n) && !a.trim())
|
|
76
|
+
throw new b("请填写审批意见", {}, "comment");
|
|
77
|
+
if (a.length > 1024)
|
|
78
|
+
throw new b("审批意见不能超过 1024 个字符", {}, "comment");
|
|
79
|
+
const o = r === "RETURN" && n.returnTargets?.length === 1 ? n.returnTargets[0] : void 0;
|
|
80
|
+
if (r === "RETURN" && !o)
|
|
81
|
+
throw new b(
|
|
82
|
+
n.returnTargets?.length ? "退回目标配置不唯一,请联系管理员检查流程配置" : "退回目标配置缺失,请联系管理员检查流程配置"
|
|
83
|
+
);
|
|
84
|
+
if (o && d && d !== o.nodeKey)
|
|
85
|
+
throw new b("退回目标与当前节点配置不一致,请重新加载详情");
|
|
80
86
|
return {
|
|
81
87
|
taskId: e.taskId,
|
|
82
88
|
processInstanceId: e.processInstanceId,
|
|
83
|
-
actionType:
|
|
84
|
-
comment:
|
|
85
|
-
recordPatch: { ...
|
|
86
|
-
...
|
|
89
|
+
actionType: r,
|
|
90
|
+
comment: a.trim(),
|
|
91
|
+
recordPatch: { ...p },
|
|
92
|
+
...o ? { targetNodeKey: o.nodeKey } : {}
|
|
87
93
|
};
|
|
88
|
-
},
|
|
94
|
+
}, u = (e, r) => {
|
|
89
95
|
try {
|
|
90
|
-
e ? e(
|
|
96
|
+
e ? e(r) : r.phase === "error" ? console.warn("[make-app-approval]", r) : console.info("[make-app-approval]", r);
|
|
91
97
|
} catch {
|
|
92
98
|
console.warn("[make-app-approval] diagnostic sink failed");
|
|
93
99
|
}
|
|
94
|
-
},
|
|
95
|
-
if (Object.is(e,
|
|
96
|
-
if (e instanceof Date &&
|
|
97
|
-
return Object.is(e.getTime(),
|
|
98
|
-
if (Array.isArray(e) || Array.isArray(
|
|
99
|
-
return Array.isArray(e) && Array.isArray(
|
|
100
|
-
if (!e || !
|
|
101
|
-
const
|
|
102
|
-
return Object.keys(
|
|
103
|
-
},
|
|
100
|
+
}, W = (e, r) => {
|
|
101
|
+
if (Object.is(e, r)) return !0;
|
|
102
|
+
if (e instanceof Date && r instanceof Date)
|
|
103
|
+
return Object.is(e.getTime(), r.getTime());
|
|
104
|
+
if (Array.isArray(e) || Array.isArray(r))
|
|
105
|
+
return Array.isArray(e) && Array.isArray(r) && e.length === r.length && e.every((d, n) => W(d, r[n]));
|
|
106
|
+
if (!e || !r || typeof e != "object" || typeof r != "object" || ![Object.prototype, null].includes(Object.getPrototypeOf(e)) || ![Object.prototype, null].includes(Object.getPrototypeOf(r))) return !1;
|
|
107
|
+
const s = e, a = r;
|
|
108
|
+
return Object.keys(s).length === Object.keys(a).length && Object.keys(s).every((d) => Object.hasOwn(a, d) && W(s[d], a[d]));
|
|
109
|
+
}, de = {
|
|
104
110
|
APPROVE: "同意",
|
|
105
111
|
REJECT: "拒绝",
|
|
106
112
|
RETURN: "退回修改",
|
|
107
113
|
SUBMIT: "提交"
|
|
108
|
-
},
|
|
114
|
+
}, Q = (e, r) => e.taskId === r.reference.taskId && e.processInstanceId === r.reference.processInstanceId, je = ({
|
|
109
115
|
title: e,
|
|
110
|
-
actions:
|
|
111
|
-
content:
|
|
112
|
-
footer:
|
|
113
|
-
}) => /* @__PURE__ */
|
|
114
|
-
/* @__PURE__ */
|
|
116
|
+
actions: r,
|
|
117
|
+
content: s,
|
|
118
|
+
footer: a
|
|
119
|
+
}) => /* @__PURE__ */ m("section", { className: "make-app-approval-detail", "aria-label": "审批详情", children: [
|
|
120
|
+
/* @__PURE__ */ m("header", { className: "make-app-approval-detail-header", children: [
|
|
115
121
|
e,
|
|
116
|
-
|
|
122
|
+
r
|
|
117
123
|
] }),
|
|
118
|
-
/* @__PURE__ */
|
|
119
|
-
|
|
120
|
-
] }),
|
|
121
|
-
/* @__PURE__ */
|
|
122
|
-
e && /* @__PURE__ */
|
|
123
|
-
] }),
|
|
124
|
-
const [
|
|
125
|
-
|
|
126
|
-
const
|
|
127
|
-
return
|
|
124
|
+
/* @__PURE__ */ c("div", { className: "make-app-approval-detail-content", children: s }),
|
|
125
|
+
a && /* @__PURE__ */ c("footer", { className: "make-app-approval-detail-footer", children: a })
|
|
126
|
+
] }), me = (e) => /* @__PURE__ */ m("div", { className: "make-app-approval-detail-title", children: [
|
|
127
|
+
/* @__PURE__ */ c("h2", { children: "审批详情" }),
|
|
128
|
+
e && /* @__PURE__ */ c(Ne, { value: e })
|
|
129
|
+
] }), Pe = (e) => {
|
|
130
|
+
const [r, s] = f(0), [a, d] = f(), n = V(e);
|
|
131
|
+
n.current = e, M(() => {
|
|
132
|
+
const y = new AbortController(), o = n.current;
|
|
133
|
+
return u(o.logger, { operation: "detail", phase: "start" }), (async () => {
|
|
128
134
|
try {
|
|
129
|
-
if (await Promise.resolve(),
|
|
130
|
-
const
|
|
131
|
-
await
|
|
132
|
-
signal:
|
|
135
|
+
if (await Promise.resolve(), y.signal.aborted) return;
|
|
136
|
+
const l = pe(
|
|
137
|
+
await o.provider.loadDetail(o.reference, {
|
|
138
|
+
signal: y.signal
|
|
133
139
|
})
|
|
134
140
|
);
|
|
135
|
-
if (
|
|
136
|
-
if (!
|
|
141
|
+
if (y.signal.aborted) return;
|
|
142
|
+
if (!Q(l, o))
|
|
137
143
|
throw new Error("Task identity mismatch");
|
|
138
|
-
|
|
144
|
+
d({ revision: r, detail: l }), u(o.logger, { operation: "detail", phase: "success" });
|
|
139
145
|
} catch {
|
|
140
|
-
if (
|
|
141
|
-
|
|
146
|
+
if (y.signal.aborted) return;
|
|
147
|
+
d({ revision: r, error: !0 }), u(o.logger, { operation: "detail", phase: "error" });
|
|
142
148
|
}
|
|
143
149
|
})(), () => {
|
|
144
|
-
|
|
150
|
+
y.abort(), u(o.logger, { operation: "detail", phase: "cancel" });
|
|
145
151
|
};
|
|
146
|
-
}, [
|
|
147
|
-
const
|
|
148
|
-
return /* @__PURE__ */
|
|
149
|
-
|
|
152
|
+
}, [r]);
|
|
153
|
+
const p = a?.revision === r ? a : void 0;
|
|
154
|
+
return /* @__PURE__ */ c(
|
|
155
|
+
De,
|
|
150
156
|
{
|
|
151
157
|
...e,
|
|
152
|
-
data:
|
|
153
|
-
loadError:
|
|
154
|
-
reload: () =>
|
|
158
|
+
data: p?.detail,
|
|
159
|
+
loadError: p?.error === !0,
|
|
160
|
+
reload: () => s((y) => y + 1)
|
|
155
161
|
},
|
|
156
|
-
|
|
162
|
+
r
|
|
157
163
|
);
|
|
158
|
-
},
|
|
164
|
+
}, De = (e) => {
|
|
159
165
|
const {
|
|
160
|
-
components: { Button:
|
|
161
|
-
renderField:
|
|
166
|
+
components: { Button: r, TextArea: s },
|
|
167
|
+
renderField: a,
|
|
162
168
|
reload: d
|
|
163
|
-
} = e,
|
|
164
|
-
|
|
165
|
-
const _ =
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
169
|
+
} = e, n = Ae(), [p, y] = f(), o = p ?? e.data, [l, C] = f({}), [G, T] = f(), [q, H] = f(""), [j, B] = f({}), [X, E] = f(""), [Y, U] = f(""), [$, he] = f(), [I, Z] = f(!1), [S, ye] = f(!1), [O, fe] = f(!1), K = V(!1), L = V(new AbortController());
|
|
170
|
+
M(() => (L.current = new AbortController(), () => L.current.abort()), []);
|
|
171
|
+
const _ = o ? D(o) : [], ee = o?.actions.find((t) => t.actionType === G), re = ee ? z(ee) : !1, te = o?.actions.filter(z) ?? [], ae = I || S || O, se = e.renderLayout ?? je;
|
|
172
|
+
M(() => {
|
|
173
|
+
$ && document.getElementById(`${n}-${$.key}`)?.focus();
|
|
174
|
+
}, [$, n]);
|
|
175
|
+
const ue = async (t) => {
|
|
176
|
+
if (!o || K.current || S || O) return;
|
|
177
|
+
T(t), U(""), K.current = !0, Z(!0), E(""), B({});
|
|
178
|
+
const k = L.current.signal;
|
|
179
|
+
let A = !1;
|
|
180
|
+
u(e.logger, {
|
|
171
181
|
operation: "action",
|
|
172
182
|
phase: "start",
|
|
173
|
-
actionType:
|
|
183
|
+
actionType: t
|
|
174
184
|
});
|
|
175
185
|
try {
|
|
176
|
-
le(
|
|
177
|
-
const
|
|
178
|
-
await e.provider.loadDetail(e.reference, { signal:
|
|
186
|
+
le(o, t, l, q);
|
|
187
|
+
const i = pe(
|
|
188
|
+
await e.provider.loadDetail(e.reference, { signal: k })
|
|
179
189
|
);
|
|
180
|
-
if (
|
|
181
|
-
if (!
|
|
182
|
-
const
|
|
183
|
-
if (JSON.stringify(
|
|
184
|
-
|
|
190
|
+
if (k.aborted) return;
|
|
191
|
+
if (!Q(i, e)) throw new Error("Task identity mismatch");
|
|
192
|
+
const P = D(o), x = D(i);
|
|
193
|
+
if (JSON.stringify(P) !== JSON.stringify(x) || JSON.stringify(o.actions) !== JSON.stringify(i.actions)) {
|
|
194
|
+
y(i), C({}), T(void 0), H(""), E("当前节点的字段或操作权限已变化,请核对后重新操作"), u(e.logger, {
|
|
185
195
|
operation: "action",
|
|
186
196
|
phase: "skip",
|
|
187
|
-
actionType:
|
|
197
|
+
actionType: t
|
|
188
198
|
});
|
|
189
199
|
return;
|
|
190
200
|
}
|
|
191
|
-
const oe =
|
|
192
|
-
(h) => !
|
|
201
|
+
const oe = x.filter(
|
|
202
|
+
(h) => !W(o.formData[h.key], i.formData[h.key])
|
|
193
203
|
);
|
|
194
204
|
if (oe.length) {
|
|
195
|
-
const h = new Set(oe.map((
|
|
196
|
-
|
|
205
|
+
const h = new Set(oe.map((N) => N.key)), J = Object.keys(l).some((N) => h.has(N));
|
|
206
|
+
y(i), C(Object.fromEntries(Object.entries(l).filter(([N]) => !h.has(N)))), T(void 0), E(J ? "申请内容已更新,冲突字段的本地修改已清除,其他修改已保留,请核对后重新操作" : "申请内容已更新,您的修改已保留,请核对后重新操作"), u(e.logger, { operation: "action", phase: "skip", actionType: t });
|
|
197
207
|
return;
|
|
198
208
|
}
|
|
199
|
-
const
|
|
209
|
+
const R = t === "RETURN" ? [] : x.filter(
|
|
200
210
|
(h) => h.editable && h.required === !0
|
|
201
211
|
), ne = Object.fromEntries(
|
|
202
|
-
|
|
212
|
+
R.map((h) => [
|
|
203
213
|
h.key,
|
|
204
|
-
Object.hasOwn(
|
|
214
|
+
Object.hasOwn(l, h.key) ? l[h.key] : i.formData[h.key]
|
|
205
215
|
])
|
|
206
|
-
),
|
|
207
|
-
|
|
216
|
+
), ie = Re(
|
|
217
|
+
R,
|
|
208
218
|
ne
|
|
209
219
|
);
|
|
210
|
-
if (Object.keys(
|
|
211
|
-
throw new
|
|
220
|
+
if (Object.keys(ie).length)
|
|
221
|
+
throw new b(
|
|
212
222
|
"请检查表单中标红的字段",
|
|
213
|
-
|
|
223
|
+
ie
|
|
214
224
|
);
|
|
215
|
-
const
|
|
216
|
-
fields:
|
|
225
|
+
const we = R.length ? await e.validateFields({
|
|
226
|
+
fields: R,
|
|
217
227
|
values: ne,
|
|
218
|
-
actionType:
|
|
219
|
-
signal:
|
|
228
|
+
actionType: t,
|
|
229
|
+
signal: k
|
|
220
230
|
}) : {};
|
|
221
|
-
if (
|
|
222
|
-
const
|
|
223
|
-
Object.entries(
|
|
224
|
-
([h,
|
|
231
|
+
if (k.aborted) return;
|
|
232
|
+
const ce = Object.fromEntries(
|
|
233
|
+
Object.entries(we).filter(
|
|
234
|
+
([h, J]) => R.some((N) => N.key === h) && !!J
|
|
225
235
|
)
|
|
226
236
|
);
|
|
227
|
-
if (Object.keys(
|
|
228
|
-
throw new
|
|
237
|
+
if (Object.keys(ce).length)
|
|
238
|
+
throw new b(
|
|
229
239
|
"请检查表单中标红的字段",
|
|
230
|
-
|
|
240
|
+
ce
|
|
231
241
|
);
|
|
232
242
|
const ve = le(
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
x
|
|
243
|
+
i,
|
|
244
|
+
t,
|
|
245
|
+
l,
|
|
246
|
+
q
|
|
238
247
|
);
|
|
239
|
-
|
|
240
|
-
const
|
|
241
|
-
if (
|
|
242
|
-
if (!
|
|
248
|
+
A = !0;
|
|
249
|
+
const w = await e.provider.submitAction(ve, { signal: k });
|
|
250
|
+
if (k.aborted) return;
|
|
251
|
+
if (!w || !Q(w, e) || w.actionType !== t || typeof w.processEnded != "boolean" || typeof w.processStatus != "string" || !w.processStatus.trim())
|
|
243
252
|
throw new Error("Action result mismatch");
|
|
244
|
-
|
|
253
|
+
fe(!0), T(void 0), y({ ...i, processStatus: w.processStatus }), E("处理成功"), u(e.logger, {
|
|
245
254
|
operation: "action",
|
|
246
255
|
phase: "success",
|
|
247
|
-
actionType:
|
|
248
|
-
}),
|
|
256
|
+
actionType: t
|
|
257
|
+
}), u(e.logger, {
|
|
249
258
|
operation: "notify",
|
|
250
259
|
phase: "start",
|
|
251
|
-
actionType:
|
|
260
|
+
actionType: t
|
|
252
261
|
});
|
|
253
262
|
try {
|
|
254
|
-
await e.onActionSuccess(
|
|
263
|
+
await e.onActionSuccess(w), u(e.logger, {
|
|
255
264
|
operation: "notify",
|
|
256
265
|
phase: "success",
|
|
257
|
-
actionType:
|
|
266
|
+
actionType: t
|
|
258
267
|
});
|
|
259
268
|
} catch {
|
|
260
|
-
|
|
269
|
+
k.aborted || E("处理已成功,但页面刷新未完成,请刷新列表确认"), u(e.logger, {
|
|
261
270
|
operation: "notify",
|
|
262
271
|
phase: "error",
|
|
263
|
-
actionType:
|
|
272
|
+
actionType: t
|
|
264
273
|
});
|
|
265
274
|
}
|
|
266
|
-
} catch (
|
|
267
|
-
if (
|
|
268
|
-
!
|
|
269
|
-
|
|
270
|
-
|
|
275
|
+
} catch (i) {
|
|
276
|
+
if (k.aborted) return;
|
|
277
|
+
if (!A && i instanceof b) {
|
|
278
|
+
B(i.fieldErrors);
|
|
279
|
+
const P = i.control === "comment" ? "comment" : Object.keys(i.fieldErrors)[0];
|
|
280
|
+
P && he({ key: P }), i.control === "comment" ? U(i.message) : Object.keys(i.fieldErrors).length || E(i.message);
|
|
281
|
+
} else
|
|
282
|
+
ye(!0), T(void 0), E(
|
|
283
|
+
A ? "操作结果尚未确认,请重新加载详情核查,勿重复提交" : "审批权限或字段校验暂不可用,请重新加载详情"
|
|
284
|
+
);
|
|
285
|
+
u(e.logger, {
|
|
271
286
|
operation: "action",
|
|
272
287
|
phase: "error",
|
|
273
|
-
actionType:
|
|
288
|
+
actionType: t
|
|
274
289
|
});
|
|
275
290
|
} finally {
|
|
276
|
-
K.current = !1,
|
|
291
|
+
K.current = !1, k.aborted ? u(e.logger, {
|
|
277
292
|
operation: "action",
|
|
278
293
|
phase: "cancel",
|
|
279
|
-
actionType:
|
|
294
|
+
actionType: t
|
|
280
295
|
}) : Z(!1);
|
|
281
296
|
}
|
|
282
297
|
};
|
|
283
|
-
if (!
|
|
284
|
-
return
|
|
285
|
-
title:
|
|
298
|
+
if (!o)
|
|
299
|
+
return se({
|
|
300
|
+
title: me(),
|
|
286
301
|
actions: null,
|
|
287
302
|
footer: null,
|
|
288
|
-
content: e.loadError ? /* @__PURE__ */
|
|
303
|
+
content: e.loadError ? /* @__PURE__ */ m("div", { className: "make-app-approval-detail-section", role: "alert", children: [
|
|
289
304
|
"审批详情加载失败,请重试",
|
|
290
|
-
/* @__PURE__ */
|
|
291
|
-
] }) : /* @__PURE__ */
|
|
292
|
-
/* @__PURE__ */
|
|
293
|
-
/* @__PURE__ */
|
|
305
|
+
/* @__PURE__ */ c(r, { htmlType: "button", variant: "default", onClick: d, children: "重新加载详情" })
|
|
306
|
+
] }) : /* @__PURE__ */ m("div", { className: "make-app-approval-detail-loading", role: "status", children: [
|
|
307
|
+
/* @__PURE__ */ c("span", { className: "make-app-approval-loading-spinner", "aria-hidden": "true" }),
|
|
308
|
+
/* @__PURE__ */ c("span", { children: "正在加载审批详情…" })
|
|
294
309
|
] })
|
|
295
310
|
});
|
|
296
|
-
const
|
|
297
|
-
|
|
311
|
+
const ke = !S && !O && o.actions.length > 0 ? /* @__PURE__ */ c("div", { className: "make-app-approval-detail-actions", "aria-label": "审批操作", children: o.actions.map((t) => /* @__PURE__ */ c(
|
|
312
|
+
r,
|
|
298
313
|
{
|
|
314
|
+
actionType: t.actionType,
|
|
299
315
|
htmlType: "button",
|
|
300
|
-
variant:
|
|
301
|
-
disabled:
|
|
316
|
+
variant: t.actionType === "APPROVE" || t.actionType === "SUBMIT" ? "primary" : "default",
|
|
317
|
+
disabled: I,
|
|
318
|
+
loading: I && G === t.actionType,
|
|
302
319
|
onClick: () => {
|
|
303
|
-
|
|
320
|
+
ue(t.actionType);
|
|
304
321
|
},
|
|
305
|
-
children:
|
|
322
|
+
children: de[t.actionType]
|
|
306
323
|
},
|
|
307
|
-
|
|
308
|
-
)) }) : null,
|
|
309
|
-
/* @__PURE__ */
|
|
324
|
+
t.actionType
|
|
325
|
+
)) }) : null, be = /* @__PURE__ */ m("div", { className: "make-app-approval-detail-content", "aria-busy": I, children: [
|
|
326
|
+
/* @__PURE__ */ m(
|
|
310
327
|
"section",
|
|
311
328
|
{
|
|
312
329
|
className: "make-app-approval-detail-section",
|
|
313
330
|
"aria-label": "申请信息",
|
|
314
331
|
children: [
|
|
315
|
-
/* @__PURE__ */
|
|
316
|
-
/* @__PURE__ */
|
|
317
|
-
_.length === 0 && /* @__PURE__ */
|
|
318
|
-
_.map((
|
|
332
|
+
/* @__PURE__ */ c("h3", { children: "申请信息" }),
|
|
333
|
+
/* @__PURE__ */ m("div", { className: "make-app-approval-detail-fields", children: [
|
|
334
|
+
_.length === 0 && /* @__PURE__ */ c("p", { children: "当前节点未配置可见字段" }),
|
|
335
|
+
_.map((t) => /* @__PURE__ */ m(
|
|
319
336
|
"div",
|
|
320
337
|
{
|
|
321
338
|
className: "make-app-approval-detail-field",
|
|
322
|
-
"data-invalid": !!
|
|
323
|
-
"data-readonly": !
|
|
324
|
-
"data-full-width": !!
|
|
339
|
+
"data-invalid": !!j[t.key],
|
|
340
|
+
"data-readonly": !t.editable,
|
|
341
|
+
"data-full-width": !!t.fullWidth,
|
|
325
342
|
children: [
|
|
326
|
-
/* @__PURE__ */
|
|
327
|
-
e.renderFieldLabel?.(
|
|
328
|
-
|
|
343
|
+
/* @__PURE__ */ m("label", { htmlFor: `${n}-${t.key}`, children: [
|
|
344
|
+
e.renderFieldLabel?.(t) ?? t.label,
|
|
345
|
+
t.required && t.editable ? /* @__PURE__ */ m(
|
|
329
346
|
"span",
|
|
330
347
|
{
|
|
331
348
|
className: "make-app-approval-required",
|
|
@@ -337,156 +354,98 @@ const Q = (e) => e.actionType === "RETURN" || e.actionType === "REJECT" || e.act
|
|
|
337
354
|
}
|
|
338
355
|
) : null
|
|
339
356
|
] }),
|
|
340
|
-
/* @__PURE__ */
|
|
341
|
-
|
|
342
|
-
field:
|
|
343
|
-
id: `${
|
|
344
|
-
value: Object.hasOwn(
|
|
345
|
-
readOnly: !
|
|
357
|
+
/* @__PURE__ */ m("div", { className: "make-app-approval-detail-value", children: [
|
|
358
|
+
a({
|
|
359
|
+
field: t,
|
|
360
|
+
id: `${n}-${t.key}`,
|
|
361
|
+
value: Object.hasOwn(l, t.key) ? l[t.key] : o.formData[t.key],
|
|
362
|
+
readOnly: !t.editable,
|
|
346
363
|
disabled: ae,
|
|
347
|
-
error:
|
|
348
|
-
...
|
|
349
|
-
onChange: (
|
|
350
|
-
|
|
351
|
-
...
|
|
352
|
-
[
|
|
353
|
-
})),
|
|
354
|
-
const
|
|
355
|
-
return delete
|
|
364
|
+
error: j[t.key],
|
|
365
|
+
...t.editable && !ae ? {
|
|
366
|
+
onChange: (k) => {
|
|
367
|
+
C((A) => ({
|
|
368
|
+
...A,
|
|
369
|
+
[t.key]: k
|
|
370
|
+
})), B((A) => {
|
|
371
|
+
const i = { ...A };
|
|
372
|
+
return delete i[t.key], i;
|
|
356
373
|
});
|
|
357
374
|
}
|
|
358
375
|
} : {}
|
|
359
376
|
}),
|
|
360
|
-
|
|
377
|
+
j[t.key] && /* @__PURE__ */ c("p", { role: "alert", className: "make-app-approval-detail-error", children: j[t.key] })
|
|
361
378
|
] })
|
|
362
379
|
]
|
|
363
380
|
},
|
|
364
|
-
|
|
381
|
+
t.key
|
|
365
382
|
))
|
|
366
383
|
] })
|
|
367
384
|
]
|
|
368
385
|
}
|
|
369
386
|
),
|
|
370
|
-
|
|
387
|
+
X && /* @__PURE__ */ c(
|
|
388
|
+
"p",
|
|
389
|
+
{
|
|
390
|
+
role: O ? "status" : "alert",
|
|
391
|
+
className: `make-app-approval-detail-message${O ? "" : " make-app-approval-detail-error"}`,
|
|
392
|
+
children: X
|
|
393
|
+
}
|
|
394
|
+
),
|
|
395
|
+
S && /* @__PURE__ */ c("div", { className: "make-app-approval-detail-message", children: /* @__PURE__ */ c(r, { htmlType: "button", variant: "default", onClick: d, children: "重新加载详情" }) }),
|
|
396
|
+
e.history != null && /* @__PURE__ */ m(
|
|
371
397
|
"section",
|
|
372
398
|
{
|
|
373
399
|
className: "make-app-approval-detail-section make-app-approval-detail-history",
|
|
374
400
|
"aria-label": "审批流程",
|
|
375
401
|
children: [
|
|
376
|
-
/* @__PURE__ */
|
|
402
|
+
/* @__PURE__ */ c("h3", { children: "审批流程" }),
|
|
377
403
|
e.history
|
|
378
404
|
]
|
|
379
405
|
}
|
|
380
|
-
)
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
{
|
|
384
|
-
role: j ? "status" : "alert",
|
|
385
|
-
className: `make-app-approval-detail-message${j ? "" : " make-app-approval-detail-error"}`,
|
|
386
|
-
children: Y
|
|
387
|
-
}
|
|
388
|
-
),
|
|
389
|
-
R && /* @__PURE__ */ s("div", { className: "make-app-approval-detail-message", children: /* @__PURE__ */ s(t, { htmlType: "button", variant: "default", onClick: d, children: "重新加载详情" }) })
|
|
390
|
-
] }), ke = !R && !j && c.actions.length > 0 ? /* @__PURE__ */ n("div", { className: "make-app-approval-detail-section make-app-approval-detail-opinion", children: [
|
|
391
|
-
/* @__PURE__ */ n("label", { htmlFor: `${i}-comment`, children: [
|
|
406
|
+
)
|
|
407
|
+
] }), ge = !S && !O && o.actions.length > 0 ? /* @__PURE__ */ m("div", { className: "make-app-approval-detail-section make-app-approval-detail-opinion", children: [
|
|
408
|
+
/* @__PURE__ */ m("label", { htmlFor: `${n}-comment`, children: [
|
|
392
409
|
"审批意见",
|
|
393
|
-
|
|
410
|
+
re && /* @__PURE__ */ m("span", { className: "make-app-approval-required", "aria-label": "必填", children: [
|
|
394
411
|
" ",
|
|
395
412
|
"*"
|
|
396
413
|
] })
|
|
397
414
|
] }),
|
|
398
|
-
/* @__PURE__ */
|
|
399
|
-
|
|
415
|
+
/* @__PURE__ */ c(
|
|
416
|
+
s,
|
|
400
417
|
{
|
|
401
|
-
id: `${
|
|
418
|
+
id: `${n}-comment`,
|
|
402
419
|
ariaLabel: "审批意见",
|
|
403
|
-
value:
|
|
404
|
-
onChange:
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
420
|
+
value: q,
|
|
421
|
+
onChange: (t) => {
|
|
422
|
+
H(t), U("");
|
|
423
|
+
},
|
|
424
|
+
placeholder: te.length ? `请输入审批意见,${te.map((t) => de[t.actionType]).join("、")}时必填` : "请输入审批意见",
|
|
425
|
+
disabled: I,
|
|
426
|
+
required: re,
|
|
408
427
|
maxLength: 1024
|
|
409
428
|
}
|
|
410
429
|
),
|
|
411
|
-
|
|
412
|
-
"section",
|
|
413
|
-
{
|
|
414
|
-
className: "make-app-approval-action-confirm",
|
|
415
|
-
"aria-label": `确认${D[T.actionType]}`,
|
|
416
|
-
children: [
|
|
417
|
-
/* @__PURE__ */ n("h3", { children: [
|
|
418
|
-
"确认",
|
|
419
|
-
D[T.actionType]
|
|
420
|
-
] }),
|
|
421
|
-
T.actionType === "RETURN" && /* @__PURE__ */ n("div", { className: "make-app-approval-detail-target", children: [
|
|
422
|
-
/* @__PURE__ */ s("label", { htmlFor: `${i}-target`, children: "退回节点" }),
|
|
423
|
-
/* @__PURE__ */ s(
|
|
424
|
-
r,
|
|
425
|
-
{
|
|
426
|
-
id: `${i}-target`,
|
|
427
|
-
ariaLabel: "退回节点",
|
|
428
|
-
value: x,
|
|
429
|
-
onChange: F,
|
|
430
|
-
disabled: w,
|
|
431
|
-
options: [
|
|
432
|
-
{ value: "", label: "请选择退回节点" },
|
|
433
|
-
...(T.returnTargets ?? []).map((a) => ({
|
|
434
|
-
value: a.nodeKey,
|
|
435
|
-
label: a.nodeName
|
|
436
|
-
}))
|
|
437
|
-
]
|
|
438
|
-
}
|
|
439
|
-
)
|
|
440
|
-
] }),
|
|
441
|
-
/* @__PURE__ */ n("div", { className: "make-app-approval-detail-actions", children: [
|
|
442
|
-
/* @__PURE__ */ n(
|
|
443
|
-
t,
|
|
444
|
-
{
|
|
445
|
-
htmlType: "button",
|
|
446
|
-
variant: "primary",
|
|
447
|
-
disabled: w,
|
|
448
|
-
loading: w,
|
|
449
|
-
onClick: () => {
|
|
450
|
-
he();
|
|
451
|
-
},
|
|
452
|
-
children: [
|
|
453
|
-
"确认",
|
|
454
|
-
D[T.actionType]
|
|
455
|
-
]
|
|
456
|
-
}
|
|
457
|
-
),
|
|
458
|
-
/* @__PURE__ */ s(
|
|
459
|
-
t,
|
|
460
|
-
{
|
|
461
|
-
htmlType: "button",
|
|
462
|
-
variant: "default",
|
|
463
|
-
disabled: w,
|
|
464
|
-
onClick: () => S(void 0),
|
|
465
|
-
children: "取消"
|
|
466
|
-
}
|
|
467
|
-
)
|
|
468
|
-
] })
|
|
469
|
-
]
|
|
470
|
-
}
|
|
471
|
-
)
|
|
430
|
+
Y && /* @__PURE__ */ c("p", { role: "alert", className: "make-app-approval-detail-error", children: Y })
|
|
472
431
|
] }) : null;
|
|
473
|
-
return
|
|
474
|
-
title:
|
|
475
|
-
actions:
|
|
476
|
-
content: /* @__PURE__ */
|
|
477
|
-
|
|
478
|
-
|
|
432
|
+
return se({
|
|
433
|
+
title: me(o.processStatus),
|
|
434
|
+
actions: ke,
|
|
435
|
+
content: /* @__PURE__ */ m(Ee, { children: [
|
|
436
|
+
be,
|
|
437
|
+
ge
|
|
479
438
|
] }),
|
|
480
439
|
footer: null
|
|
481
440
|
});
|
|
482
|
-
},
|
|
441
|
+
}, Ue = (e) => {
|
|
483
442
|
if (!e.scopeKey.trim() || !e.reference.taskId.trim() || !e.reference.processInstanceId.trim())
|
|
484
443
|
throw new Error("ApprovalTaskDetail requires scopeKey and task reference");
|
|
485
|
-
for (const
|
|
486
|
-
if (!e.components?.[
|
|
487
|
-
throw new Error(`ApprovalTaskDetail requires components.${
|
|
488
|
-
return /* @__PURE__ */
|
|
489
|
-
|
|
444
|
+
for (const r of ["Button", "TextArea"])
|
|
445
|
+
if (!e.components?.[r])
|
|
446
|
+
throw new Error(`ApprovalTaskDetail requires components.${r}`);
|
|
447
|
+
return /* @__PURE__ */ c(
|
|
448
|
+
Pe,
|
|
490
449
|
{
|
|
491
450
|
...e
|
|
492
451
|
},
|
|
@@ -498,9 +457,9 @@ const Q = (e) => e.actionType === "RETURN" || e.actionType === "REJECT" || e.act
|
|
|
498
457
|
);
|
|
499
458
|
};
|
|
500
459
|
export {
|
|
501
|
-
|
|
502
|
-
|
|
460
|
+
Ue as ApprovalTaskDetail,
|
|
461
|
+
b as ApprovalTaskValidationError,
|
|
503
462
|
le as buildApprovalTaskAction,
|
|
504
|
-
|
|
463
|
+
D as getApprovalTaskFields,
|
|
505
464
|
pe as readApprovalTaskDetail
|
|
506
465
|
};
|