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