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