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