@qfei-design/make-app-approval 0.2.14 → 0.2.16
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 +56 -1
- package/README.md +3 -0
- package/capabilities.json +14 -0
- package/dist/list/types.d.ts +2 -0
- package/dist/list/ui-components.d.ts +5 -1
- package/dist/list.cjs +1 -1
- package/dist/list.mjs +328 -323
- package/dist/mobile/index.d.ts +2 -0
- package/dist/mobile/mobile-components.d.ts +4 -0
- package/dist/mobile/types.d.ts +67 -0
- package/dist/mobile.cjs +1 -0
- package/dist/mobile.mjs +111 -0
- package/dist/styles.css +17 -3
- package/docs/host-integration.md +2 -0
- package/examples/antd-components.tsx +4 -2
- package/package.ai.json +7 -1
- package/package.json +6 -1
- package/recipes.json +8 -0
package/dist/list.mjs
CHANGED
|
@@ -1,368 +1,370 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { getApprovalStatusDisplay as
|
|
4
|
-
const
|
|
5
|
-
if (!
|
|
1
|
+
import { jsxs as y, jsx as o, Fragment as we } from "react/jsx-runtime";
|
|
2
|
+
import { useState as V, useRef as $, useEffect as q, useMemo as ke, useId as ye } from "react";
|
|
3
|
+
import { getApprovalStatusDisplay as Se } from "./index.mjs";
|
|
4
|
+
const fe = (e) => typeof e == "object" && e !== null, Ne = (e) => fe(e) ? ["id", "entityKey", "recordId"].every((t) => typeof e[t] == "string" && e[t].trim().length > 0) && ["applicationNo", "applicationType", "applicantName", "applicationTime"].every((t) => typeof e[t] == "string") && ["taskId", "processInstanceId"].every((t) => e[t] === void 0 || typeof e[t] == "string" && e[t].trim().length > 0) && ["completionTime", "completionResult"].every((t) => e[t] === void 0 || typeof e[t] == "string") && (e.referenceType === void 0 || e.referenceType === "task" || e.referenceType === "instance") && (e.referenceType !== "instance" || typeof e.processInstanceId == "string" && e.processInstanceId.trim().length > 0) && (typeof e.processStatus == "string" || e.processStatus === null) : !1, re = (e, t) => {
|
|
5
|
+
if (!fe(e) || !Array.isArray(e.rows) || !e.rows.every(Ne) || typeof e.total != "number" || !Number.isSafeInteger(e.total) || e.total < 0 || e.rows.length > t || e.rows.length > e.total || new Set(e.rows.map((s) => s.id)).size !== e.rows.length)
|
|
6
6
|
throw new Error("Invalid approval page contract");
|
|
7
7
|
return { rows: e.rows, total: e.total };
|
|
8
|
-
},
|
|
8
|
+
}, E = (e, t) => {
|
|
9
9
|
try {
|
|
10
10
|
e ? e(t) : t.phase === "error" ? console.warn("[make-app-approval]", t) : console.info("[make-app-approval]", t);
|
|
11
11
|
} catch {
|
|
12
12
|
console.warn("[make-app-approval] diagnostic sink failed");
|
|
13
13
|
}
|
|
14
|
-
},
|
|
15
|
-
const [
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
}, le = (e) => e == null || e === "UNSUBMITTED" ? "状态未知" : Se(e).label, Te = ({ initialPage: e, query: t, provider: s, components: R, onOpen: F, onReload: P, logger: L }) => {
|
|
15
|
+
const [f, k] = V(e), [b, I] = V(2), [l, S] = V("idle"), h = $(void 0), [x, C] = V(!1), M = $(void 0);
|
|
16
|
+
q(() => () => {
|
|
17
|
+
M.current?.abort();
|
|
18
18
|
}, []);
|
|
19
|
-
const
|
|
20
|
-
if (
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
const
|
|
24
|
-
|
|
19
|
+
const N = async () => {
|
|
20
|
+
if (M.current || f.rows.length >= f.total) return;
|
|
21
|
+
const n = new AbortController();
|
|
22
|
+
M.current = n, S("loading");
|
|
23
|
+
const p = { operation: "list", tab: t.tab, page: b, pageSize: t.pageSize };
|
|
24
|
+
E(L, { ...p, phase: "start" });
|
|
25
25
|
try {
|
|
26
|
-
const
|
|
27
|
-
if (
|
|
28
|
-
if (
|
|
29
|
-
|
|
26
|
+
const T = re(await s.loadPage({ ...t, page: b }, { signal: n.signal }), t.pageSize);
|
|
27
|
+
if (n.signal.aborted) return;
|
|
28
|
+
if (T.total < f.total) {
|
|
29
|
+
E(L, { ...p, phase: "skip", rowCount: T.rows.length }), P();
|
|
30
30
|
return;
|
|
31
31
|
}
|
|
32
|
-
const m = new Set(
|
|
33
|
-
if (!
|
|
34
|
-
|
|
32
|
+
const m = new Set(f.rows.map((A) => A.id));
|
|
33
|
+
if (!T.rows.length || T.rows.some((A) => m.has(A.id))) throw new Error("Invalid append page");
|
|
34
|
+
k({ rows: [...f.rows, ...T.rows], total: T.total }), I((A) => A + 1), S("idle"), E(L, { ...p, phase: "success", rowCount: T.rows.length });
|
|
35
35
|
} catch {
|
|
36
|
-
|
|
36
|
+
n.signal.aborted || (S("error"), E(L, { ...p, phase: "error" }));
|
|
37
37
|
} finally {
|
|
38
|
-
|
|
38
|
+
M.current === n && (M.current = void 0);
|
|
39
39
|
}
|
|
40
|
-
},
|
|
41
|
-
const { scrollHeight:
|
|
42
|
-
|
|
43
|
-
}, { Button:
|
|
44
|
-
return /* @__PURE__ */
|
|
40
|
+
}, c = (n) => {
|
|
41
|
+
const { scrollHeight: p, scrollTop: T, clientHeight: m } = n.currentTarget;
|
|
42
|
+
l === "idle" && p - T - m < 120 && N();
|
|
43
|
+
}, { Button: B } = R;
|
|
44
|
+
return /* @__PURE__ */ y(
|
|
45
45
|
"div",
|
|
46
46
|
{
|
|
47
47
|
className: "make-app-approval-mobile-list",
|
|
48
|
-
onScroll:
|
|
49
|
-
onTouchStart: (
|
|
50
|
-
h.current =
|
|
48
|
+
onScroll: c,
|
|
49
|
+
onTouchStart: (n) => {
|
|
50
|
+
h.current = n.currentTarget.scrollTop <= 0 && n.touches.length === 1 && l !== "loading" ? { start: n.touches[0].clientY, distance: 0 } : void 0;
|
|
51
51
|
},
|
|
52
|
-
onTouchMove: (
|
|
53
|
-
!h.current ||
|
|
52
|
+
onTouchMove: (n) => {
|
|
53
|
+
!h.current || n.touches.length !== 1 || (h.current.distance = n.touches[0].clientY - h.current.start, C(h.current.distance >= 60));
|
|
54
54
|
},
|
|
55
55
|
onTouchEnd: () => {
|
|
56
|
-
const
|
|
57
|
-
h.current = void 0,
|
|
56
|
+
const n = (h.current?.distance ?? 0) >= 60;
|
|
57
|
+
h.current = void 0, C(!1), n && P();
|
|
58
58
|
},
|
|
59
59
|
onTouchCancel: () => {
|
|
60
|
-
h.current = void 0,
|
|
60
|
+
h.current = void 0, C(!1);
|
|
61
61
|
},
|
|
62
62
|
"aria-label": "审批卡片列表",
|
|
63
|
-
"aria-busy":
|
|
63
|
+
"aria-busy": l === "loading",
|
|
64
64
|
children: [
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
/* @__PURE__ */
|
|
68
|
-
/* @__PURE__ */
|
|
69
|
-
/* @__PURE__ */
|
|
70
|
-
/* @__PURE__ */
|
|
65
|
+
x && /* @__PURE__ */ o("p", { role: "status", className: "make-app-approval-mobile-feedback", children: "松开刷新" }),
|
|
66
|
+
f.rows.map((n) => /* @__PURE__ */ y("button", { type: "button", className: "make-app-approval-mobile-card", onClick: () => F(n), "aria-label": `打开 ${n.applicationNo} 的审批详情`, children: [
|
|
67
|
+
/* @__PURE__ */ o("strong", { children: n.applicationType || "审批申请" }),
|
|
68
|
+
/* @__PURE__ */ y("span", { className: "make-app-approval-mobile-card-line", children: [
|
|
69
|
+
/* @__PURE__ */ o("span", { children: "申请单ID:" }),
|
|
70
|
+
/* @__PURE__ */ o("span", { children: n.applicationNo })
|
|
71
71
|
] }),
|
|
72
|
-
t.tab === "approved" && /* @__PURE__ */
|
|
73
|
-
/* @__PURE__ */
|
|
74
|
-
/* @__PURE__ */
|
|
72
|
+
t.tab === "approved" && /* @__PURE__ */ y("span", { className: "make-app-approval-mobile-card-line", children: [
|
|
73
|
+
/* @__PURE__ */ o("span", { children: "审批结果:" }),
|
|
74
|
+
/* @__PURE__ */ o("span", { children: n.completionResult || "—" })
|
|
75
75
|
] }),
|
|
76
|
-
t.tab === "initiated" && /* @__PURE__ */
|
|
77
|
-
/* @__PURE__ */
|
|
78
|
-
/* @__PURE__ */
|
|
76
|
+
t.tab === "initiated" && /* @__PURE__ */ y("span", { className: "make-app-approval-mobile-card-line", children: [
|
|
77
|
+
/* @__PURE__ */ o("span", { children: "流程状态:" }),
|
|
78
|
+
/* @__PURE__ */ o("span", { children: le(n.processStatus) })
|
|
79
79
|
] }),
|
|
80
|
-
/* @__PURE__ */
|
|
81
|
-
/* @__PURE__ */
|
|
82
|
-
/* @__PURE__ */
|
|
83
|
-
/* @__PURE__ */
|
|
80
|
+
/* @__PURE__ */ y("span", { className: "make-app-approval-mobile-card-footer", children: [
|
|
81
|
+
/* @__PURE__ */ y("span", { className: "make-app-approval-mobile-person", children: [
|
|
82
|
+
/* @__PURE__ */ o("span", { className: "make-app-approval-mobile-avatar", "aria-hidden": "true", children: n.applicantName.slice(-2) }),
|
|
83
|
+
/* @__PURE__ */ o("span", { children: n.applicantName || "—" })
|
|
84
84
|
] }),
|
|
85
|
-
/* @__PURE__ */
|
|
85
|
+
/* @__PURE__ */ o("span", { children: t.tab === "approved" ? `完成于 ${n.completionTime || "—"}` : `申请于 ${n.applicationTime || "—"}` })
|
|
86
86
|
] })
|
|
87
|
-
] },
|
|
88
|
-
!
|
|
89
|
-
|
|
87
|
+
] }, n.id)),
|
|
88
|
+
!f.rows.length && /* @__PURE__ */ o("p", { className: "make-app-approval-mobile-feedback", children: "暂无审批记录" }),
|
|
89
|
+
l === "error" ? /* @__PURE__ */ y("div", { role: "alert", className: "make-app-approval-mobile-feedback", children: [
|
|
90
90
|
"部分审批记录加载失败",
|
|
91
|
-
/* @__PURE__ */
|
|
92
|
-
|
|
91
|
+
/* @__PURE__ */ o(B, { htmlType: "button", variant: "text", onClick: () => {
|
|
92
|
+
N();
|
|
93
93
|
}, children: "重试加载" })
|
|
94
|
-
] }) :
|
|
95
|
-
|
|
96
|
-
}, children: "加载更多" }) :
|
|
94
|
+
] }) : l === "loading" ? /* @__PURE__ */ o("p", { role: "status", className: "make-app-approval-mobile-feedback", children: "加载中" }) : f.rows.length < f.total ? /* @__PURE__ */ o(B, { htmlType: "button", variant: "text", onClick: () => {
|
|
95
|
+
N();
|
|
96
|
+
}, children: "加载更多" }) : f.rows.length > 0 && /* @__PURE__ */ o("p", { className: "make-app-approval-mobile-feedback", children: "没有更多了" })
|
|
97
97
|
]
|
|
98
98
|
}
|
|
99
99
|
);
|
|
100
|
-
},
|
|
100
|
+
}, Ce = {
|
|
101
101
|
applicationNo: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#1d212a" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-fingerprint-pattern" aria-hidden="true"><path d="M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4"></path><path d="M14 13.12c0 2.38 0 6.38-1 8.88"></path><path d="M17.29 21.02c.12-.6.43-2.3.5-3.02"></path><path d="M2 12a10 10 0 0 1 18-6"></path><path d="M2 16h.01"></path><path d="M21.8 16c.2-2 .131-5.354 0-6"></path><path d="M5 19.5C5.5 18 6 15 6 12a6 6 0 0 1 .34-2"></path><path d="M8.65 22c.21-.66.45-1.32.57-2"></path><path d="M9 6.8a6 6 0 0 1 9 5.2v2"></path></svg>',
|
|
102
102
|
applicationType: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#1d212a" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-type" aria-hidden="true"><path d="M12 4v16"></path><path d="M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2"></path><path d="M9 20h6"></path></svg>',
|
|
103
103
|
applicantName: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#1d212a" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-user-round" aria-hidden="true"><circle cx="12" cy="8" r="5"></circle><path d="M20 21a8 8 0 0 0-16 0"></path></svg>',
|
|
104
104
|
applicationTime: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#1d212a" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-calendar-clock" aria-hidden="true"><path d="M16 14v2.2l1.6 1"></path><path d="M16 2v3"></path><path d="M21 7.338V5a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2h2.338"></path><path d="M3 9h5.859"></path><path d="M8 2v3"></path><circle cx="16" cy="16" r="6"></circle></svg>'
|
|
105
|
-
},
|
|
106
|
-
Object.entries(
|
|
107
|
-
),
|
|
105
|
+
}, pe = Object.fromEntries(
|
|
106
|
+
Object.entries(Ce).map(([e, t]) => [e, `data:image/svg+xml;charset=utf-8,${encodeURIComponent(t)}`])
|
|
107
|
+
), se = 64, de = [
|
|
108
108
|
{ key: "applicationNo", title: "申请单ID", width: 260 },
|
|
109
109
|
{ key: "applicationType", title: "业务表单", width: 180 },
|
|
110
110
|
{ key: "applicantName", title: "申请人", width: 170 },
|
|
111
111
|
{ key: "applicationTime", title: "申请时间", width: 220 }
|
|
112
|
-
],
|
|
113
|
-
const
|
|
114
|
-
return
|
|
115
|
-
...
|
|
116
|
-
width:
|
|
112
|
+
], he = (e, t) => {
|
|
113
|
+
const s = t === "initiated" ? [...de, { key: "statusLabel", title: "流程状态", width: 140 }] : de, R = s.reduce((P, L) => P + L.width, se), F = Math.max(0, e - R) / s.length;
|
|
114
|
+
return s.map((P) => ({
|
|
115
|
+
...P,
|
|
116
|
+
width: P.width + F,
|
|
117
117
|
showEllipsis: !0,
|
|
118
118
|
sortable: !1,
|
|
119
|
-
prefixRender: () => ({ icon:
|
|
119
|
+
prefixRender: () => ({ icon: pe[P.key] ?? pe.applicationType })
|
|
120
120
|
}));
|
|
121
|
-
},
|
|
122
|
-
const
|
|
123
|
-
let
|
|
124
|
-
const
|
|
125
|
-
let h =
|
|
126
|
-
const
|
|
127
|
-
|
|
128
|
-
},
|
|
129
|
-
r.finished || (r.finished = !0, r.removeAbort(),
|
|
121
|
+
}, Me = ({ table: e, query: t, initialPage: s, loadPage: R, onChange: F, retryViewport: P, onReload: L, logger: f }) => {
|
|
122
|
+
const k = /* @__PURE__ */ new Map(), b = /* @__PURE__ */ new Set();
|
|
123
|
+
let I = [];
|
|
124
|
+
const l = /* @__PURE__ */ new WeakMap(), S = /* @__PURE__ */ new Set();
|
|
125
|
+
let h = s, x = s.total, C = 0, M = !1, N = !1, c;
|
|
126
|
+
const B = (r) => Number.isSafeInteger(r) && r >= 0 && r * t.pageSize < x, n = (r, a, d) => E(f, { operation: "list", phase: a, tab: t.tab, page: r + 1, pageSize: t.pageSize, rowCount: d }), p = () => {
|
|
127
|
+
M || F({ total: x, rows: I, failed: N || S.size > 0, loading: k.size > 0 });
|
|
128
|
+
}, T = (r) => {
|
|
129
|
+
r.finished || (r.finished = !0, r.removeAbort(), k.get(r.page) === r && k.delete(r.page), e.markPageLoadFailed(r.page, r.request), r.controller.abort(), n(r.page, "cancel"));
|
|
130
130
|
}, m = (r) => {
|
|
131
|
-
|
|
132
|
-
const a = e.getPagesInView() ?? [],
|
|
133
|
-
for (const
|
|
134
|
-
for (const
|
|
135
|
-
},
|
|
136
|
-
const
|
|
137
|
-
const W = { ...v, statusLabel:
|
|
138
|
-
return
|
|
131
|
+
C = r;
|
|
132
|
+
const a = e.getPagesInView() ?? [], d = new Set([C, ...a].flatMap((g) => [g - 1, g, g + 1]).filter(B));
|
|
133
|
+
for (const g of k.values()) d.has(g.page) || T(g);
|
|
134
|
+
for (const g of S) d.has(g) || S.delete(g);
|
|
135
|
+
}, A = (r, a, d) => {
|
|
136
|
+
const g = a.rows.map((v) => {
|
|
137
|
+
const W = { ...v, statusLabel: le(v.processStatus) };
|
|
138
|
+
return l.set(W, v), W;
|
|
139
139
|
});
|
|
140
|
-
if (!e.setVirtualPageData(
|
|
141
|
-
|
|
140
|
+
if (!e.setVirtualPageData(g, r, a.total, d)) {
|
|
141
|
+
n(r, "skip");
|
|
142
142
|
return;
|
|
143
143
|
}
|
|
144
|
-
|
|
144
|
+
x = a.total;
|
|
145
145
|
try {
|
|
146
|
-
|
|
146
|
+
I = re({ rows: e.getTableData() ?? [], total: x }, Number.MAX_SAFE_INTEGER).rows.map((v) => l.get(v) ?? v);
|
|
147
147
|
} catch (v) {
|
|
148
|
-
|
|
149
|
-
for (const W of
|
|
148
|
+
N = !0, I = [], h = void 0, c && clearTimeout(c), c = void 0;
|
|
149
|
+
for (const W of k.values()) T(W);
|
|
150
150
|
throw v;
|
|
151
151
|
}
|
|
152
|
-
h && h.total !==
|
|
153
|
-
for (const v of
|
|
154
|
-
!
|
|
155
|
-
},
|
|
156
|
-
if (
|
|
157
|
-
const r = [...
|
|
152
|
+
h && h.total !== x && (h = void 0), S.delete(r);
|
|
153
|
+
for (const v of k.values()) B(v.page) || T(v);
|
|
154
|
+
!B(r) && r > 0 && e.scrollToRow(Math.max(0, x - 1)), n(r, "success", a.rows.length);
|
|
155
|
+
}, D = () => {
|
|
156
|
+
if (M || c) return;
|
|
157
|
+
const r = [...k.values()].filter((a) => !a.running && !a.finished).sort((a, d) => Math.abs(a.page - C) - Math.abs(d.page - C) || a.page - d.page);
|
|
158
158
|
for (const a of r) {
|
|
159
159
|
if (b.size >= 2) break;
|
|
160
|
-
a.running = !0, b.add(a),
|
|
160
|
+
a.running = !0, b.add(a), n(a.page, "start"), (async () => {
|
|
161
161
|
try {
|
|
162
|
-
const
|
|
163
|
-
if (
|
|
164
|
-
const
|
|
165
|
-
a.finished = !0, a.removeAbort(),
|
|
162
|
+
const d = await R({ ...t, page: a.page + 1 }, { signal: a.controller.signal });
|
|
163
|
+
if (M || a.finished || a.controller.signal.aborted) return;
|
|
164
|
+
const g = re(d, t.pageSize);
|
|
165
|
+
a.finished = !0, a.removeAbort(), k.delete(a.page), A(a.page, g, a.request);
|
|
166
166
|
} catch {
|
|
167
|
-
!
|
|
167
|
+
!M && !a.controller.signal.aborted && (S.add(a.page), n(a.page, "error"), e.markPageLoadFailed(a.page, a.request));
|
|
168
168
|
} finally {
|
|
169
|
-
a.finished || (a.finished = !0, a.removeAbort(),
|
|
169
|
+
a.finished || (a.finished = !0, a.removeAbort(), k.get(a.page) === a && k.delete(a.page)), b.delete(a), p(), D();
|
|
170
170
|
}
|
|
171
171
|
})();
|
|
172
172
|
}
|
|
173
|
-
|
|
174
|
-
},
|
|
175
|
-
|
|
176
|
-
|
|
173
|
+
p();
|
|
174
|
+
}, Y = () => {
|
|
175
|
+
c && clearTimeout(c), c = setTimeout(() => {
|
|
176
|
+
c = void 0, D();
|
|
177
177
|
}, 120);
|
|
178
178
|
};
|
|
179
179
|
return {
|
|
180
180
|
load(r, a) {
|
|
181
|
-
if (a.useRequestIdentity(),
|
|
182
|
-
e.markPageLoadFailed(r, a),
|
|
181
|
+
if (a.useRequestIdentity(), M || N || a.signal.aborted || !B(r)) {
|
|
182
|
+
e.markPageLoadFailed(r, a), n(r, "skip");
|
|
183
183
|
return;
|
|
184
184
|
}
|
|
185
|
-
const
|
|
186
|
-
if (
|
|
187
|
-
if (
|
|
185
|
+
const d = k.get(r);
|
|
186
|
+
if (d?.request === a && !d.finished) return;
|
|
187
|
+
if (d && T(d), m(r), r === 0 && h) {
|
|
188
188
|
const v = h;
|
|
189
189
|
h = void 0;
|
|
190
190
|
try {
|
|
191
|
-
|
|
191
|
+
A(0, v, a);
|
|
192
192
|
} catch {
|
|
193
|
-
|
|
193
|
+
S.add(r), e.markPageLoadFailed(r, a), n(r, "error");
|
|
194
194
|
}
|
|
195
|
-
|
|
195
|
+
p();
|
|
196
196
|
return;
|
|
197
197
|
}
|
|
198
|
-
const
|
|
199
|
-
} },
|
|
200
|
-
|
|
198
|
+
const g = { page: r, request: a, controller: new AbortController(), running: !1, finished: !1, removeAbort: () => {
|
|
199
|
+
} }, K = () => {
|
|
200
|
+
T(g), p();
|
|
201
201
|
};
|
|
202
|
-
a.signal.addEventListener("abort",
|
|
202
|
+
a.signal.addEventListener("abort", K, { once: !0 }), g.removeAbort = () => a.signal.removeEventListener("abort", K), k.set(r, g), Y(), p();
|
|
203
203
|
},
|
|
204
204
|
viewportChanged() {
|
|
205
|
-
if (
|
|
205
|
+
if (M) return;
|
|
206
206
|
const r = e.getPagesInView();
|
|
207
|
-
r?.length && (m(r[0]),
|
|
207
|
+
r?.length && (m(r[0]), k.size && Y(), p());
|
|
208
208
|
},
|
|
209
209
|
retry() {
|
|
210
|
-
if (!
|
|
211
|
-
if (
|
|
212
|
-
|
|
210
|
+
if (!M) {
|
|
211
|
+
if (N) {
|
|
212
|
+
L();
|
|
213
213
|
return;
|
|
214
214
|
}
|
|
215
|
-
|
|
215
|
+
S.size !== 0 && (S.clear(), P(), p());
|
|
216
216
|
}
|
|
217
217
|
},
|
|
218
218
|
dispose() {
|
|
219
|
-
|
|
220
|
-
for (const r of
|
|
221
|
-
|
|
219
|
+
M = !0, c && clearTimeout(c), c = void 0;
|
|
220
|
+
for (const r of k.values()) T(r);
|
|
221
|
+
I = [], S.clear(), h = void 0;
|
|
222
222
|
}
|
|
223
223
|
};
|
|
224
|
-
},
|
|
225
|
-
const t =
|
|
226
|
-
return e.initialPage ? /* @__PURE__ */
|
|
227
|
-
|
|
224
|
+
}, ue = 40, Re = (e) => {
|
|
225
|
+
const t = $(void 0);
|
|
226
|
+
return e.initialPage ? /* @__PURE__ */ o(
|
|
227
|
+
Pe,
|
|
228
228
|
{
|
|
229
229
|
...e,
|
|
230
230
|
initialPage: e.initialPage,
|
|
231
231
|
restoreScroll: t.current?.query === e.query ? t.current.position : void 0,
|
|
232
|
-
rememberScroll: (
|
|
233
|
-
t.current = { query: e.query, position:
|
|
232
|
+
rememberScroll: (s) => {
|
|
233
|
+
t.current = { query: e.query, position: s };
|
|
234
234
|
}
|
|
235
235
|
}
|
|
236
|
-
) : /* @__PURE__ */
|
|
237
|
-
},
|
|
238
|
-
const
|
|
239
|
-
|
|
240
|
-
const
|
|
236
|
+
) : /* @__PURE__ */ o("div", { className: "make-app-approval-canvas", role: "group", "aria-label": "审批记录表格" });
|
|
237
|
+
}, Pe = ({ components: { Button: e }, initialPage: t, query: s, provider: R, themeKey: F, onOpen: P, onReload: L, logger: f, restoreScroll: k, rememberScroll: b }) => {
|
|
238
|
+
const I = $(null), l = $(null), S = $(null), [h, x] = V(!1), [C, M] = V(0), [N, c] = V({ ...t, failed: !1, loading: !1 }), B = $(t.rows), n = $(k), p = $({ provider: R, onOpen: P, onReload: L, logger: f, rememberScroll: b });
|
|
239
|
+
p.current = { provider: R, onOpen: P, onReload: L, logger: f, rememberScroll: b };
|
|
240
|
+
const T = $(() => {
|
|
241
241
|
});
|
|
242
|
-
return
|
|
243
|
-
const m =
|
|
242
|
+
return q(() => {
|
|
243
|
+
const m = I.current;
|
|
244
244
|
if (!m) return;
|
|
245
|
-
let
|
|
246
|
-
|
|
247
|
-
const
|
|
248
|
-
|
|
245
|
+
let A = !1, D, Y, r, a, d, g = t.total;
|
|
246
|
+
E(p.current.logger, { operation: "table", phase: "start" });
|
|
247
|
+
const K = () => {
|
|
248
|
+
A || (x(!0), E(p.current.logger, { operation: "table", phase: "error" }));
|
|
249
249
|
};
|
|
250
250
|
return import("@qfei-design/canvas-table").then((v) => {
|
|
251
|
-
if (
|
|
251
|
+
if (A) return;
|
|
252
252
|
const W = () => {
|
|
253
|
-
const
|
|
254
|
-
|
|
255
|
-
},
|
|
256
|
-
if (!
|
|
253
|
+
const X = l.current, O = X?.getScrollState();
|
|
254
|
+
X && O && v.globalEventBus.emitWithNamespace("scroll:change", X.tableId, O);
|
|
255
|
+
}, _ = (X = !1) => {
|
|
256
|
+
if (!A)
|
|
257
257
|
try {
|
|
258
|
-
const { width:
|
|
259
|
-
if (
|
|
260
|
-
const
|
|
261
|
-
rowHeight:
|
|
258
|
+
const { width: O, height: j } = m.getBoundingClientRect();
|
|
259
|
+
if (O <= 0 || j <= 0 || !X && d?.width === O && d.height === j) return;
|
|
260
|
+
const H = getComputedStyle(m), i = {
|
|
261
|
+
rowHeight: ue,
|
|
262
262
|
headerHeight: 40,
|
|
263
263
|
fontSize: 14,
|
|
264
|
-
fontFamily:
|
|
265
|
-
...
|
|
266
|
-
...
|
|
267
|
-
...
|
|
268
|
-
...
|
|
269
|
-
},
|
|
270
|
-
if (
|
|
271
|
-
const
|
|
272
|
-
if (
|
|
273
|
-
canvasWidth:
|
|
274
|
-
canvasHeight:
|
|
275
|
-
style:
|
|
276
|
-
virtualOptions:
|
|
277
|
-
...
|
|
278
|
-
}),
|
|
279
|
-
const z =
|
|
280
|
-
z && z.scrollX >
|
|
264
|
+
fontFamily: H.fontFamily || "Arial, sans-serif",
|
|
265
|
+
...H.color ? { textColor: H.color } : {},
|
|
266
|
+
...H.getPropertyValue("--make-approval-bg").trim() ? { rowBgColor: H.getPropertyValue("--make-approval-bg").trim() } : {},
|
|
267
|
+
...H.getPropertyValue("--make-approval-header").trim() ? { headerBgColor: H.getPropertyValue("--make-approval-header").trim() } : {},
|
|
268
|
+
...H.getPropertyValue("--make-approval-border").trim() ? { borderColor: H.getPropertyValue("--make-approval-border").trim() } : {}
|
|
269
|
+
}, u = Math.max(Math.ceil(300 / s.pageSize), Math.ceil(j * 3 / ue / s.pageSize) + 2) * s.pageSize, J = { enabled: !0, totalRowCount: g, pageSize: s.pageSize, maxCachedRows: u };
|
|
270
|
+
if (l.current) {
|
|
271
|
+
const w = d?.width !== O ? he(O, s.tab) : void 0;
|
|
272
|
+
if (l.current.updateProps({
|
|
273
|
+
canvasWidth: O,
|
|
274
|
+
canvasHeight: j,
|
|
275
|
+
style: i,
|
|
276
|
+
virtualOptions: J,
|
|
277
|
+
...w ? { columns: w } : {}
|
|
278
|
+
}), w) {
|
|
279
|
+
const z = l.current.getScrollState(), Q = Math.max(0, w.reduce((Z, ne) => Z + ne.width, se) - O);
|
|
280
|
+
z && z.scrollX > Q && l.current.scrollTo(Q, z.scrollY, !1);
|
|
281
281
|
}
|
|
282
|
-
|
|
282
|
+
d = { width: O, height: j }, W();
|
|
283
283
|
return;
|
|
284
284
|
}
|
|
285
|
-
|
|
286
|
-
columns:
|
|
287
|
-
canvasWidth:
|
|
288
|
-
canvasHeight:
|
|
289
|
-
style:
|
|
285
|
+
l.current = new v.CanvasTableComponent(m, {
|
|
286
|
+
columns: he(O, s.tab),
|
|
287
|
+
canvasWidth: O,
|
|
288
|
+
canvasHeight: j,
|
|
289
|
+
style: i,
|
|
290
290
|
rowKey: "id",
|
|
291
|
-
|
|
292
|
-
|
|
291
|
+
minCanvasWidth: 0,
|
|
292
|
+
minCanvasHeight: 0,
|
|
293
|
+
showSN: { enabled: !0, width: se, formatter: (w, z) => z + 1 },
|
|
294
|
+
virtualOptions: J,
|
|
293
295
|
selectable: { enabled: !1 },
|
|
294
296
|
rowSortable: { enabled: !1 },
|
|
295
297
|
editApplyMode: "controlled",
|
|
296
|
-
customEdit: (
|
|
297
|
-
|
|
298
|
+
customEdit: (w) => {
|
|
299
|
+
w.cancel();
|
|
298
300
|
},
|
|
299
301
|
emptyStateOptions: { text: "暂无审批记录" },
|
|
300
302
|
bodyRowHeadSuffixOptions: {
|
|
301
303
|
enabled: !0,
|
|
302
304
|
width: 20,
|
|
303
|
-
render: ({ group:
|
|
304
|
-
const
|
|
305
|
-
|
|
305
|
+
render: ({ group: w, x: z, height: Q, rowData: Z }) => {
|
|
306
|
+
const ne = Z?.id, ee = new v.RectShape({ name: "approval-open", x: z, y: Q / 2 - 10, cursor: "pointer", tooltip: "查看审批详情", attrs: { width: 20, height: 20, fill: "transparent", stroke: "transparent" } });
|
|
307
|
+
ee.addChild(new v.ImgShape({ name: "approval-open-icon", x: 3, y: 3, attrs: {
|
|
306
308
|
width: 14,
|
|
307
309
|
height: 14,
|
|
308
|
-
img: "data:image/svg+xml;charset=utf-8," + encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="${
|
|
309
|
-
} })),
|
|
310
|
-
|
|
311
|
-
const
|
|
312
|
-
|
|
313
|
-
}),
|
|
310
|
+
img: "data:image/svg+xml;charset=utf-8," + encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="${H.color || "#64748b"}" stroke-width="1.8"><path d="M8 3H3v5m13-5h5v5M3 16v5h5m13-5v5h-5"/></svg>`)
|
|
311
|
+
} })), ee.on("mousedown", (ie) => ie.stopPropagation?.()), ee.on("click", (ie) => {
|
|
312
|
+
ie.stopPropagation?.();
|
|
313
|
+
const ce = B.current.find((be) => be.id === ne);
|
|
314
|
+
ce && p.current.onOpen(ce);
|
|
315
|
+
}), w.addChild(ee);
|
|
314
316
|
}
|
|
315
317
|
}
|
|
316
318
|
});
|
|
317
|
-
const G =
|
|
318
|
-
|
|
319
|
-
const
|
|
319
|
+
const G = l.current;
|
|
320
|
+
d = { width: O, height: j };
|
|
321
|
+
const oe = Me({
|
|
320
322
|
table: G,
|
|
321
|
-
query:
|
|
323
|
+
query: s,
|
|
322
324
|
initialPage: t,
|
|
323
325
|
// 公开滚动同步事件会重新检测缺页,不移动视口,也不复用失败身份。
|
|
324
326
|
retryViewport: W,
|
|
325
|
-
onReload: () =>
|
|
326
|
-
loadPage: (
|
|
327
|
-
logger: (
|
|
328
|
-
onChange: (
|
|
329
|
-
|
|
327
|
+
onReload: () => p.current.onReload(),
|
|
328
|
+
loadPage: (w, z) => p.current.provider.loadPage(w, z),
|
|
329
|
+
logger: (w) => E(p.current.logger, w),
|
|
330
|
+
onChange: (w) => {
|
|
331
|
+
A || (g = w.total, B.current = w.rows, c((z) => z.total === w.total && z.failed === w.failed && z.loading === w.loading && z.rows.length === w.rows.length && z.rows.every((Q, Z) => Q === w.rows[Z]) ? z : w));
|
|
330
332
|
}
|
|
331
333
|
});
|
|
332
|
-
|
|
334
|
+
S.current = oe, Y = v.globalEventBus.onWithNamespace("data:load", G.tableId, (w, z) => oe.load(w, z)), r = v.globalEventBus.onWithNamespace("scroll:change", G.tableId, () => oe.viewportChanged()), n.current && G.scrollTo(n.current.scrollX, n.current.scrollY), x(!1), E(p.current.logger, { operation: "table", phase: "success" });
|
|
333
335
|
} catch {
|
|
334
|
-
|
|
336
|
+
K();
|
|
335
337
|
}
|
|
336
338
|
};
|
|
337
|
-
|
|
338
|
-
const
|
|
339
|
-
|
|
340
|
-
}).catch(
|
|
341
|
-
|
|
342
|
-
},
|
|
339
|
+
T.current = () => _(!0);
|
|
340
|
+
const U = () => _();
|
|
341
|
+
D = new ResizeObserver(U), D.observe(m), window.addEventListener("resize", U), a = () => window.removeEventListener("resize", U), _();
|
|
342
|
+
}).catch(K), () => {
|
|
343
|
+
A = !0, D?.disconnect(), a?.(), T.current = () => {
|
|
344
|
+
}, l.current && (n.current = l.current.getScrollState(), n.current && p.current.rememberScroll(n.current)), Y?.(), r?.(), S.current?.dispose(), S.current = null, l.current?.destroy(), l.current = null, E(p.current.logger, { operation: "table", phase: "destroy" });
|
|
343
345
|
};
|
|
344
|
-
}, [t,
|
|
345
|
-
|
|
346
|
-
}, [
|
|
347
|
-
/* @__PURE__ */
|
|
348
|
-
h && /* @__PURE__ */
|
|
346
|
+
}, [t, s, C]), q(() => {
|
|
347
|
+
T.current();
|
|
348
|
+
}, [F]), /* @__PURE__ */ y("div", { className: "make-app-approval-table-frame", "aria-busy": N.loading, children: [
|
|
349
|
+
/* @__PURE__ */ o("div", { ref: I, className: "make-app-approval-canvas", role: "group", "aria-label": "审批记录表格" }),
|
|
350
|
+
h && /* @__PURE__ */ y("div", { className: "make-app-approval-overlay", role: "alert", children: [
|
|
349
351
|
"表格加载失败 ",
|
|
350
|
-
/* @__PURE__ */
|
|
351
|
-
|
|
352
|
+
/* @__PURE__ */ o(e, { htmlType: "button", variant: "default", onClick: () => {
|
|
353
|
+
x(!1), M((m) => m + 1);
|
|
352
354
|
}, children: "重新加载表格" })
|
|
353
355
|
] }),
|
|
354
|
-
!h &&
|
|
356
|
+
!h && N.failed && /* @__PURE__ */ y("div", { className: "make-app-approval-table-feedback", role: "alert", children: [
|
|
355
357
|
"部分审批记录加载失败 ",
|
|
356
|
-
/* @__PURE__ */
|
|
358
|
+
/* @__PURE__ */ o(e, { htmlType: "button", variant: "default", onClick: () => S.current?.retry(), children: "重试加载" })
|
|
357
359
|
] }),
|
|
358
|
-
!h && !
|
|
359
|
-
/* @__PURE__ */
|
|
360
|
-
/* @__PURE__ */
|
|
360
|
+
!h && !N.failed && N.loading && /* @__PURE__ */ y("div", { className: "make-app-approval-table-loading", role: "status", "aria-label": "正在加载审批记录", "aria-live": "polite", children: [
|
|
361
|
+
/* @__PURE__ */ o("span", { className: "make-app-approval-loading-spinner", "aria-hidden": "true" }),
|
|
362
|
+
/* @__PURE__ */ o("span", { children: "加载中" })
|
|
361
363
|
] }),
|
|
362
|
-
/* @__PURE__ */
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
/* @__PURE__ */
|
|
364
|
+
/* @__PURE__ */ y("ul", { className: "make-app-approval-accessible-rows", "aria-label": "审批记录文字视图", children: [
|
|
365
|
+
N.total === 0 && /* @__PURE__ */ o("li", { children: "暂无审批记录" }),
|
|
366
|
+
N.rows.map((m) => /* @__PURE__ */ y("li", { children: [
|
|
367
|
+
/* @__PURE__ */ y("span", { children: [
|
|
366
368
|
m.applicationNo,
|
|
367
369
|
",",
|
|
368
370
|
m.applicationType,
|
|
@@ -370,10 +372,10 @@ const ue = (e) => typeof e == "object" && e !== null, ye = (e) => ue(e) ? ["id",
|
|
|
370
372
|
m.applicantName,
|
|
371
373
|
",",
|
|
372
374
|
m.applicationTime,
|
|
373
|
-
|
|
375
|
+
s.tab === "initiated" ? `,${le(m.processStatus)}` : "",
|
|
374
376
|
"。"
|
|
375
377
|
] }),
|
|
376
|
-
/* @__PURE__ */
|
|
378
|
+
/* @__PURE__ */ y(e, { htmlType: "button", variant: "text", onClick: () => P(m), children: [
|
|
377
379
|
"打开 ",
|
|
378
380
|
m.applicationNo || m.applicationType,
|
|
379
381
|
" 的审批详情"
|
|
@@ -381,151 +383,154 @@ const ue = (e) => typeof e == "object" && e !== null, ye = (e) => ue(e) ? ["id",
|
|
|
381
383
|
] }, m.id))
|
|
382
384
|
] })
|
|
383
385
|
] });
|
|
384
|
-
},
|
|
385
|
-
const [
|
|
386
|
-
|
|
387
|
-
const b =
|
|
388
|
-
|
|
389
|
-
const
|
|
390
|
-
|
|
391
|
-
let
|
|
386
|
+
}, Ie = [], xe = (e, t, s, R) => {
|
|
387
|
+
const [F, P] = V(0), [L, f] = V(), k = $({ provider: e, logger: R });
|
|
388
|
+
k.current = { provider: e, logger: R };
|
|
389
|
+
const b = ke(() => ({}), [t, s, F]);
|
|
390
|
+
q(() => {
|
|
391
|
+
const l = new AbortController(), { provider: S, logger: h } = k.current, x = { operation: "list", tab: t.tab, page: t.page, pageSize: t.pageSize };
|
|
392
|
+
E(h, { ...x, phase: "start" });
|
|
393
|
+
let C = !1;
|
|
392
394
|
return (async () => {
|
|
393
395
|
try {
|
|
394
|
-
if (await Promise.resolve(),
|
|
395
|
-
const
|
|
396
|
-
if (
|
|
397
|
-
const
|
|
398
|
-
|
|
396
|
+
if (await Promise.resolve(), l.signal.aborted) return;
|
|
397
|
+
const M = await S.loadPage(t, { signal: l.signal });
|
|
398
|
+
if (l.signal.aborted) return;
|
|
399
|
+
const N = re(M, t.pageSize);
|
|
400
|
+
C = !0, f({ ...N, token: b, status: "success" }), E(h, { ...x, phase: "success", rowCount: N.rows.length });
|
|
399
401
|
} catch {
|
|
400
|
-
if (
|
|
401
|
-
|
|
402
|
+
if (l.signal.aborted) return;
|
|
403
|
+
C = !0, f({ token: b, status: "error", rows: Ie, total: 0 }), E(h, { ...x, phase: "error" });
|
|
402
404
|
}
|
|
403
405
|
})(), () => {
|
|
404
|
-
|
|
406
|
+
l.abort(), C || E(h, { ...x, phase: "cancel" });
|
|
405
407
|
};
|
|
406
408
|
}, [t, b]);
|
|
407
|
-
const
|
|
409
|
+
const I = L?.token === b ? L : void 0;
|
|
408
410
|
return {
|
|
409
|
-
initialPage:
|
|
410
|
-
total:
|
|
411
|
-
status:
|
|
412
|
-
reload: () =>
|
|
411
|
+
initialPage: I?.status === "success" ? I : void 0,
|
|
412
|
+
total: I?.total ?? 0,
|
|
413
|
+
status: I?.status ?? "loading",
|
|
414
|
+
reload: () => P((l) => l + 1)
|
|
413
415
|
};
|
|
414
|
-
},
|
|
416
|
+
}, te = { keyword: "", applicantId: "", processStatus: "", startDate: "", endDate: "" }, ge = ["pending", "approved"], ve = { pending: "待处理", approved: "已完成", initiated: "已发起" }, me = /* @__PURE__ */ y("svg", { "aria-hidden": "true", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", children: [
|
|
417
|
+
/* @__PURE__ */ o("circle", { cx: "10.5", cy: "10.5", r: "6.5" }),
|
|
418
|
+
/* @__PURE__ */ o("path", { d: "m16 16 5 5" })
|
|
419
|
+
] }), ae = (e) => {
|
|
415
420
|
if (e === "") return !0;
|
|
416
421
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(e)) return !1;
|
|
417
422
|
const t = /* @__PURE__ */ new Date(`${e}T00:00:00Z`);
|
|
418
423
|
return Number.isFinite(t.getTime()) && t.toISOString().slice(0, 10) === e;
|
|
419
|
-
},
|
|
420
|
-
const { Input:
|
|
421
|
-
|
|
422
|
-
|
|
424
|
+
}, ze = ({ components: e, provider: t, onOpenApproval: s, applicantOptions: R = [], pageSize: F = 20, refreshKey: P, themeKey: L, logger: f, className: k, presentation: b = "desktop", spacing: I = "host", tabs: l = ge }) => {
|
|
425
|
+
const { Input: S, Select: h, DateRangePicker: x, Button: C, Tabs: M } = e, N = ye(), [c, B] = V(te), [n, p] = V(), [T, m] = V(0), [A, D] = V(""), [Y, r] = V(""), [a, d] = V({ ...te, tab: l[0], page: 1, pageSize: F }), { initialPage: g, status: K, reload: v } = xe(t, a, P, f), W = $(!1), _ = $(!0);
|
|
426
|
+
q(() => (_.current = !0, () => {
|
|
427
|
+
_.current = !1;
|
|
423
428
|
}), []);
|
|
424
|
-
const
|
|
425
|
-
if (!
|
|
426
|
-
|
|
429
|
+
const U = K === "loading", X = async (i) => {
|
|
430
|
+
if (!W.current) {
|
|
431
|
+
W.current = !0, r(""), E(f, { operation: "open", phase: "start" });
|
|
427
432
|
try {
|
|
428
|
-
await
|
|
433
|
+
await s(i), E(f, { operation: "open", phase: "success" });
|
|
429
434
|
} catch {
|
|
430
|
-
|
|
435
|
+
_.current && r("审批详情打开失败,请重试"), E(f, { operation: "open", phase: "error" });
|
|
431
436
|
} finally {
|
|
432
|
-
|
|
437
|
+
W.current = !1;
|
|
433
438
|
}
|
|
434
439
|
}
|
|
435
|
-
},
|
|
436
|
-
i ===
|
|
437
|
-
},
|
|
438
|
-
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
/* @__PURE__ */ N("form", { className: "make-app-approval-filters", onSubmit: (i) => {
|
|
440
|
+
}, O = (i) => {
|
|
441
|
+
i === a.tab || !l.includes(i) || (D(""), r(""), i === "initiated" && (B((u) => ({ ...u, keyword: "", applicantId: "", processStatus: "" })), p(void 0)), d((u) => ({ ...u, ...i === "initiated" ? { keyword: "", applicantId: "", processStatus: "" } : {}, tab: i, page: 1 })));
|
|
442
|
+
}, j = (i) => {
|
|
443
|
+
B((u) => ({ ...u, ...i })), b === "mobile" && (D(""), r(""), d((u) => ({ ...u, ...i, page: 1 })));
|
|
444
|
+
}, H = /* @__PURE__ */ y(we, { children: [
|
|
445
|
+
/* @__PURE__ */ y("form", { className: "make-app-approval-filters", onSubmit: (i) => {
|
|
442
446
|
if (i.preventDefault(), b === "mobile") {
|
|
443
|
-
|
|
447
|
+
D(""), r(""), d((u) => ({ ...u, keyword: c.keyword.trim(), page: 1 }));
|
|
444
448
|
return;
|
|
445
449
|
}
|
|
446
|
-
if (!
|
|
447
|
-
|
|
450
|
+
if (!ae(c.startDate) || !ae(c.endDate)) {
|
|
451
|
+
D("请选择有效日期");
|
|
448
452
|
return;
|
|
449
453
|
}
|
|
450
454
|
if (c.startDate && c.endDate && c.startDate > c.endDate) {
|
|
451
|
-
|
|
455
|
+
D("开始日期不能晚于结束日期");
|
|
452
456
|
return;
|
|
453
457
|
}
|
|
454
|
-
|
|
458
|
+
D(""), r(""), d((u) => ({ ...u, ...c, keyword: c.keyword.trim(), page: 1 }));
|
|
455
459
|
}, children: [
|
|
456
|
-
|
|
457
|
-
b === "mobile" && /* @__PURE__ */
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
] }) }),
|
|
461
|
-
/* @__PURE__ */ n(p, { id: `${C}-keyword`, ariaLabel: "申请单ID", placeholder: "搜索申请单ID", value: c.keyword, onChange: (i) => {
|
|
462
|
-
R((s) => ({ ...s, keyword: i })), b === "mobile" && !i && $((s) => ({ ...s, keyword: "", page: 1 }));
|
|
460
|
+
a.tab !== "initiated" && /* @__PURE__ */ y("div", { className: "make-app-approval-filter-field", children: [
|
|
461
|
+
b === "mobile" && (I === "standard" ? /* @__PURE__ */ o("button", { type: "submit", className: "make-app-approval-mobile-search-button", "aria-label": "搜索申请单ID", children: me }) : /* @__PURE__ */ o(C, { htmlType: "submit", variant: "text", ariaLabel: "搜索申请单ID", children: me })),
|
|
462
|
+
/* @__PURE__ */ o(S, { id: `${N}-keyword`, ariaLabel: "申请单ID", placeholder: "搜索申请单ID", value: c.keyword, onChange: (i) => {
|
|
463
|
+
B((u) => ({ ...u, keyword: i })), b === "mobile" && !i && d((u) => ({ ...u, keyword: "", page: 1 }));
|
|
463
464
|
} })
|
|
464
465
|
] }),
|
|
465
|
-
/* @__PURE__ */
|
|
466
|
-
|
|
466
|
+
/* @__PURE__ */ o("div", { className: "make-app-approval-date-control", children: /* @__PURE__ */ o(
|
|
467
|
+
x,
|
|
467
468
|
{
|
|
468
|
-
id: `${
|
|
469
|
+
id: `${N}-period`,
|
|
469
470
|
ariaLabel: "申请时间",
|
|
470
471
|
placeholder: ["开始日期", "结束日期"],
|
|
471
472
|
value: [c.startDate, c.endDate],
|
|
472
|
-
onChange: ([i,
|
|
473
|
-
if (b === "mobile" && (!
|
|
474
|
-
|
|
473
|
+
onChange: ([i, u]) => {
|
|
474
|
+
if (b === "mobile" && (!ae(i) || !ae(u) || i && u && i > u)) {
|
|
475
|
+
D("请选择有效日期范围");
|
|
475
476
|
return;
|
|
476
477
|
}
|
|
477
|
-
if (b === "mobile" && !!i != !!
|
|
478
|
-
|
|
478
|
+
if (b === "mobile" && !!i != !!u) {
|
|
479
|
+
B((J) => ({ ...J, startDate: i, endDate: u }));
|
|
479
480
|
return;
|
|
480
481
|
}
|
|
481
|
-
|
|
482
|
+
j({ startDate: i, endDate: u });
|
|
482
483
|
}
|
|
483
484
|
},
|
|
484
|
-
|
|
485
|
+
T
|
|
485
486
|
) }),
|
|
486
|
-
|
|
487
|
-
|
|
487
|
+
a.tab !== "initiated" && /* @__PURE__ */ o("div", { className: "make-app-approval-filter-field", children: /* @__PURE__ */ o(
|
|
488
|
+
h,
|
|
488
489
|
{
|
|
489
|
-
id: `${
|
|
490
|
+
id: `${N}-applicant`,
|
|
490
491
|
ariaLabel: "申请人",
|
|
491
492
|
purpose: "applicant",
|
|
492
493
|
value: c.applicantId ?? "",
|
|
493
|
-
|
|
494
|
-
|
|
494
|
+
...I === "standard" && n?.value === c.applicantId ? { selectedOption: n } : {},
|
|
495
|
+
options: [{ value: "", label: "全部申请人" }, ...R.filter((i) => i.value !== "")],
|
|
496
|
+
onChange: (i, u) => {
|
|
497
|
+
p((J) => i ? u?.value === i ? u : R.find((G) => G.value === i) ?? (J?.value === i ? J : void 0) : void 0), j({ applicantId: i });
|
|
498
|
+
}
|
|
495
499
|
}
|
|
496
500
|
) }),
|
|
497
|
-
b !== "mobile" && /* @__PURE__ */
|
|
498
|
-
/* @__PURE__ */
|
|
499
|
-
/* @__PURE__ */
|
|
500
|
-
|
|
501
|
+
b !== "mobile" && /* @__PURE__ */ y("div", { className: "make-app-approval-filter-actions", children: [
|
|
502
|
+
/* @__PURE__ */ o(C, { htmlType: "submit", variant: "primary", children: "查询" }),
|
|
503
|
+
/* @__PURE__ */ o(C, { htmlType: "button", variant: "default", onClick: () => {
|
|
504
|
+
B(te), p(void 0), m((i) => i + 1), D(""), r(""), d((i) => ({ ...i, ...te, page: 1 }));
|
|
501
505
|
}, children: "重置" }),
|
|
502
|
-
/* @__PURE__ */
|
|
506
|
+
/* @__PURE__ */ o(C, { htmlType: "button", variant: "default", disabled: U, loading: U, onClick: v, children: "刷新" })
|
|
503
507
|
] })
|
|
504
508
|
] }),
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
/* @__PURE__ */
|
|
508
|
-
b === "mobile" ?
|
|
509
|
-
|
|
510
|
-
}, logger:
|
|
511
|
-
|
|
512
|
-
}, onReload:
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
/* @__PURE__ */
|
|
516
|
-
/* @__PURE__ */
|
|
509
|
+
A && /* @__PURE__ */ o("p", { role: "alert", className: "make-app-approval-error", children: A }),
|
|
510
|
+
Y && /* @__PURE__ */ o("p", { role: "alert", className: "make-app-approval-error", children: Y }),
|
|
511
|
+
/* @__PURE__ */ y("div", { className: "make-app-approval-results", "aria-busy": U, children: [
|
|
512
|
+
b === "mobile" ? g && /* @__PURE__ */ o(Te, { initialPage: g, query: a, provider: t, onReload: v, components: e, onOpen: (i) => {
|
|
513
|
+
X(i);
|
|
514
|
+
}, logger: f }, JSON.stringify([a, P, g])) : /* @__PURE__ */ o(Re, { components: e, initialPage: g, query: a, provider: t, onOpen: (i) => {
|
|
515
|
+
X(i);
|
|
516
|
+
}, onReload: v, themeKey: L, logger: f }),
|
|
517
|
+
U && /* @__PURE__ */ o("div", { className: "make-app-approval-overlay", role: "status", children: "正在加载审批记录…" }),
|
|
518
|
+
K === "error" && /* @__PURE__ */ y("div", { className: "make-app-approval-overlay", role: "alert", children: [
|
|
519
|
+
/* @__PURE__ */ o("span", { children: "审批列表加载失败,请重试" }),
|
|
520
|
+
/* @__PURE__ */ o(C, { htmlType: "button", variant: "default", onClick: v, children: "重试" })
|
|
517
521
|
] })
|
|
518
522
|
] })
|
|
519
|
-
] })
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
+
] });
|
|
524
|
+
return /* @__PURE__ */ o("section", { className: ["make-app-approval", b === "mobile" && "make-app-approval--mobile", I === "standard" && "make-app-approval--standard", k].filter(Boolean).join(" "), "aria-label": "我的审批", children: /* @__PURE__ */ o(M, { items: l.map((i) => ({ value: i, label: ve[i] })), value: a.tab, onChange: O, ariaLabel: "审批分类", children: I === "standard" ? /* @__PURE__ */ o("div", { className: "make-app-approval-panel", children: H }) : H }) });
|
|
525
|
+
}, Be = (e) => {
|
|
526
|
+
const t = e.pageSize ?? 20, s = e.tabs ?? ge;
|
|
527
|
+
if (!s.length || new Set(s).size !== s.length || s.some((R) => !Object.hasOwn(ve, R))) throw new Error("MyApprovalsPage requires valid unique tabs");
|
|
523
528
|
if (!e.scopeKey.trim()) throw new Error("MyApprovalsPage requires scopeKey");
|
|
524
|
-
for (const
|
|
525
|
-
if (!e.components?.[
|
|
529
|
+
for (const R of ["Input", "Select", "DateRangePicker", "Button", "Tabs"])
|
|
530
|
+
if (!e.components?.[R]) throw new Error(`MyApprovalsPage requires components.${R}`);
|
|
526
531
|
if (!Number.isSafeInteger(t) || t < 1 || t > 200) throw new Error("pageSize must be an integer from 1 to 200");
|
|
527
|
-
return /* @__PURE__ */
|
|
532
|
+
return /* @__PURE__ */ o(ze, { ...e, tabs: s, pageSize: t }, JSON.stringify([e.scopeKey, t, s]));
|
|
528
533
|
};
|
|
529
534
|
export {
|
|
530
|
-
|
|
535
|
+
Be as MyApprovalsPage
|
|
531
536
|
};
|