@yuku123/z-team-component 0.2.88 → 0.2.89

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.
Files changed (68) hide show
  1. package/dist/{ChangeLogView-NTgsfOSm.js → ChangeLogView-DagOxr6O.js} +1 -1
  2. package/dist/{ComponentDoc-C_9NDft5.js → ComponentDoc-CP8PmT4l.js} +3 -3
  3. package/dist/ComponentDoc-D1vtx1CE.js +3998 -0
  4. package/dist/{InvitationManagementPage-BG8Mpbt2.js → InvitationManagementPage-C-8t565B.js} +1 -1
  5. package/dist/InvitationManagementPage-DDx-AX4v.js +495 -0
  6. package/dist/{OnboardingPage-DFd0xco-.js → OnboardingPage-DUUHQLSp.js} +2 -2
  7. package/dist/OnboardingPage-DUVza4FC.js +393 -0
  8. package/dist/ScheduledTasks-BSJP-8rB.js +10708 -0
  9. package/dist/ScheduledTasks-CGNB0zlb.js +10708 -0
  10. package/dist/{SystemShell-uZ1sd-J6.js → SystemShell-DTFR-Pfd.js} +5 -5
  11. package/dist/SystemShell-DZ-W2gUt.js +689 -0
  12. package/dist/{api-0JOL66LK.js → api-BftpestH.js} +392 -391
  13. package/dist/{api-F3Y96sko.js → api-GfWm5pTp.js} +1 -1
  14. package/dist/api-nf4Uaca5.js +20 -0
  15. package/dist/{createWorkspaceWsHandler-DQZwHUBx.js → createWorkspaceWsHandler-rKc7vc8k.js} +4579 -4532
  16. package/dist/{index-UiavaizS.js → index-3qkbu-HG.js} +1520 -1509
  17. package/dist/{index-CLBXAp2N.js → index-9Vozb4E5.js} +3 -3
  18. package/dist/{index-DBb5VQw-.js → index-B1lzhb6f.js} +1 -1
  19. package/dist/{index-BmmzWO1c.js → index-B51WSpDM.js} +7 -7
  20. package/dist/{index-Ch7aeuH5.js → index-B5dDwxhs.js} +1 -1
  21. package/dist/{index-BqyNh0xw.js → index-BMQ6XkO3.js} +1 -1
  22. package/dist/{index-w2dEymcR.js → index-BR0HXBjY.js} +3 -3
  23. package/dist/index-B_H-Ynz5.js +9844 -0
  24. package/dist/index-BngdCYiY.js +149 -0
  25. package/dist/{index-B7XgDudF.js → index-BqG6XqTh.js} +2 -2
  26. package/dist/{index-BnpvrcjU.js → index-BxBGVGKQ.js} +4 -4
  27. package/dist/{index-BPvg2-3g.js → index-C1kpuot_.js} +2 -2
  28. package/dist/{index-Bfg9EVcF.js → index-C5FC0WCa.js} +5 -5
  29. package/dist/{index-Bqtk18nN.js → index-CHTu5H1U.js} +3 -3
  30. package/dist/{index-CWui9wFp.js → index-CUhSJJL0.js} +2 -2
  31. package/dist/index-D8ncig8C.js +149 -0
  32. package/dist/index-D92Y4nix.js +178 -0
  33. package/dist/index-DTFcQizU.js +3488 -0
  34. package/dist/index-D_t92tEF.js +2700 -0
  35. package/dist/{index-Czw72Bov.js → index-DcHrkop2.js} +3 -3
  36. package/dist/index-DelMCvoP.js +118 -0
  37. package/dist/{index-BYzj7oPE.js → index-DoC-nKZZ.js} +2 -2
  38. package/dist/index-Dxx0UEBW.js +93 -0
  39. package/dist/{index-D8Gfs8hx.js → index-DyFaoD5W.js} +2 -2
  40. package/dist/index-EdPtymBD.js +574 -0
  41. package/dist/index-JS2OVZ4Q.js +3488 -0
  42. package/dist/index-LkYDFjtJ.js +914 -0
  43. package/dist/{index-Dg2HcBzv.js → index-MYohlrH6.js} +4 -4
  44. package/dist/{index-s6svdmEi.js → index-VGtET31b.js} +1 -1
  45. package/dist/index-d7BD8lzt.js +242 -0
  46. package/dist/{index-C4th4Aoe.js → index-ji8TPz9K.js} +4 -4
  47. package/dist/index-mIk8zAAm.js +1143 -0
  48. package/dist/index-p1jMVRnp.js +112 -0
  49. package/dist/{index-YNiDI1gx.js → index-pScDd5cp.js} +6 -6
  50. package/dist/{index-iFmkxmf9.js → index-s_ikMJ2V.js} +1 -1
  51. package/dist/{index-0x46DewW.js → index-v3WaXkDJ.js} +3 -3
  52. package/dist/index.js +1 -1
  53. package/dist/{instance-BCsQR-qS.js → instance-CI6-4BZ6.js} +1 -1
  54. package/dist/{menuPermission-cHXJpApG.js → menuPermission-CF3r6JEV.js} +3 -3
  55. package/dist/menuPermission-CZvOK8eU.js +60 -0
  56. package/dist/pages.js +1 -1
  57. package/dist/{personal-DEVcqGLw.js → personal-D-eMMf0_.js} +2 -2
  58. package/dist/{schedule-B0EBBRli.js → schedule-ChO2xIGd.js} +1 -1
  59. package/dist/{send-default-agent-team-message-yWr8M0Tf.js → send-default-agent-team-message-c5oKdQQA.js} +1 -1
  60. package/dist/{sso-user-VnBakX7L.js → sso-user-DToM5dPy.js} +1 -1
  61. package/dist/{training-DDChztdn.js → training-B38tnwLL.js} +1 -1
  62. package/dist/{useAppStore-Db3-RUiE.js → useAppStore-BFO_h1L2.js} +1 -1
  63. package/dist/{webide-DIyLJmHA.js → webide-DTZ46LPR.js} +4 -4
  64. package/dist/z-team-component.css +2 -2
  65. package/package.json +1 -1
  66. package/dist/ScheduledTasks-C1ZHUXKI.js +0 -9809
  67. package/dist/index-CAUSIiIP.js +0 -139
  68. package/dist/index-DgwMPSIc.js +0 -3312
@@ -0,0 +1,1143 @@
1
+ import { jsxs as n, jsx as e } from "react/jsx-runtime";
2
+ import { useNavigate as X, useParams as me, useLocation as ye, useRoutes as ge } from "react-router-dom";
3
+ import { useState as m, useEffect as M, useMemo as be } from "react";
4
+ import { RocketOutlined as fe, AppstoreOutlined as ce, CheckCircleOutlined as W, PlayCircleOutlined as K, CloseCircleOutlined as Z, BellOutlined as oe, BulbOutlined as ee, EditOutlined as _e, CloudUploadOutlined as we, CopyOutlined as ve, DeleteOutlined as Ie, ReloadOutlined as te, PlusOutlined as re, ArrowLeftOutlined as Ce, SaveOutlined as le, ShopOutlined as de, StarFilled as Te, CloudDownloadOutlined as ke, DashboardOutlined as xe, InfoCircleOutlined as Pe } from "@ant-design/icons";
5
+ import { Typography as j, Row as q, Col as R, Card as E, Statistic as N, Table as Oe, Tag as T, Form as b, Space as D, Button as u, Popconfirm as pe, Drawer as V, Input as A, Select as H, message as d, Tabs as Ae, Descriptions as C, Alert as Se, Switch as Re, Spin as De } from "antd";
6
+ import { r as _ } from "./ComponentDoc-CP8PmT4l.js";
7
+ import { ListTable as Y } from "@yuku123/z-frontend-common/ui";
8
+ const z = (r) => `script-admin/scripts/${encodeURIComponent(r)}`, P = {
9
+ list: () => _.get("script-admin/scripts"),
10
+ detail: (r) => _.get(z(r)),
11
+ create: (r) => _.post("script-admin/scripts", r),
12
+ update: (r, h) => _.put(z(r), h),
13
+ remove: (r) => _.delete(z(r)),
14
+ run: (r, h) => _.post(`${z(r)}/run`, h ?? {}),
15
+ publish: (r, h = "HTTP") => _.post(`${z(r)}/publish?exposeAs=${encodeURIComponent(h)}`),
16
+ unpublish: (r) => _.post(`${z(r)}/unpublish`),
17
+ copy: (r) => _.post(`${z(r)}/copy`),
18
+ invokeLogPage: (r) => _.get("script-admin/invoke-log/page", { params: r }),
19
+ summary: (r = 1) => _.get("script-admin/summary", { params: { days: r } })
20
+ }, L = {
21
+ list: () => _.get("schedule-admin/jobs"),
22
+ add: (r) => _.post("schedule-admin/jobs", r),
23
+ start: (r) => _.post(`schedule-admin/jobs/${r}/start`),
24
+ stop: (r) => _.post(`schedule-admin/jobs/${r}/stop`),
25
+ trigger: (r) => _.post(`schedule-admin/jobs/${r}/trigger`),
26
+ remove: (r) => _.delete(`schedule-admin/jobs/${r}`)
27
+ }, he = [
28
+ { value: "EL", label: "EL(SpEL 表达式)" },
29
+ { value: "GROOVY", label: "GROOVY(Groovy 脚本)" },
30
+ { value: "LUA", label: "LUA(Lua 脚本)" },
31
+ { value: "SQL", label: "SQL(语句解析)" },
32
+ { value: "MOCK", label: "MOCK(Mock 响应)" },
33
+ { value: "API_BRIDGE", label: "API_BRIDGE(HTTP 桥接)" }
34
+ ];
35
+ function F(r) {
36
+ if (r == null || r === "") return "-";
37
+ const h = typeof r == "number" ? new Date(r) : new Date(r);
38
+ if (Number.isNaN(h.getTime())) return String(r);
39
+ const a = (f) => String(f).padStart(2, "0");
40
+ return `${h.getFullYear()}-${a(h.getMonth() + 1)}-${a(h.getDate())} ${a(h.getHours())}:${a(h.getMinutes())}:${a(h.getSeconds())}`;
41
+ }
42
+ const { Title: Ee, Paragraph: Ne } = j;
43
+ function J() {
44
+ const [r, h] = m(null), [a, f] = m([]), [y, w] = m(0), [s, v] = m(0), [p, k] = m(!1), o = async () => {
45
+ k(!0);
46
+ try {
47
+ const [g, x, O, t] = await Promise.all([
48
+ P.summary(1).catch(() => null),
49
+ P.invokeLogPage({ current: 1, size: 5 }).catch(() => null),
50
+ L.list().catch(() => []),
51
+ _.post("rpa/demand/list", {}).catch(() => [])
52
+ ]);
53
+ h(g), f(Array.isArray(x == null ? void 0 : x.records) ? x.records : []), w(Array.isArray(O) ? O.length : 0);
54
+ const l = t;
55
+ v(
56
+ Array.isArray(l) ? l.length : Array.isArray(l == null ? void 0 : l.data) ? l.data.length : 0
57
+ );
58
+ } catch (g) {
59
+ console.warn("dashboard load failed", g);
60
+ } finally {
61
+ k(!1);
62
+ }
63
+ };
64
+ return M(() => {
65
+ o();
66
+ }, []), /* @__PURE__ */ n("div", { style: { padding: 24, background: "#f5f7fa", minHeight: "100%" }, children: [
67
+ /* @__PURE__ */ n(Ee, { level: 3, style: { marginTop: 0 }, children: [
68
+ /* @__PURE__ */ e(fe, {}),
69
+ " RPA 卓越中心"
70
+ ] }),
71
+ /* @__PURE__ */ e(Ne, { type: "secondary", children: "应用与运行都在脚本中心执行,触发器由调度中心按 cron 驱动;RPA 只负责产品视图与应用市场 / 需求中心。" }),
72
+ /* @__PURE__ */ n(q, { gutter: 16, style: { marginBottom: 24 }, children: [
73
+ /* @__PURE__ */ e(R, { span: 6, children: /* @__PURE__ */ e(E, { loading: p, children: /* @__PURE__ */ e(
74
+ N,
75
+ {
76
+ title: "脚本数",
77
+ value: (r == null ? void 0 : r.script_count) ?? 0,
78
+ prefix: /* @__PURE__ */ e(ce, {})
79
+ }
80
+ ) }) }),
81
+ /* @__PURE__ */ e(R, { span: 6, children: /* @__PURE__ */ e(E, { loading: p, children: /* @__PURE__ */ e(
82
+ N,
83
+ {
84
+ title: "在线脚本",
85
+ value: (r == null ? void 0 : r.online_count) ?? 0,
86
+ prefix: /* @__PURE__ */ e(W, { style: { color: "#52c41a" } })
87
+ }
88
+ ) }) }),
89
+ /* @__PURE__ */ e(R, { span: 6, children: /* @__PURE__ */ e(E, { loading: p, children: /* @__PURE__ */ e(
90
+ N,
91
+ {
92
+ title: "今日运行",
93
+ value: (r == null ? void 0 : r.run_total_count) ?? 0,
94
+ prefix: /* @__PURE__ */ e(K, {})
95
+ }
96
+ ) }) }),
97
+ /* @__PURE__ */ e(R, { span: 6, children: /* @__PURE__ */ e(E, { loading: p, children: /* @__PURE__ */ e(
98
+ N,
99
+ {
100
+ title: "运行成功率",
101
+ value: (r == null ? void 0 : r.success_rate) ?? "N/A",
102
+ styles: { content: { color: "#2F70F1" } }
103
+ }
104
+ ) }) })
105
+ ] }),
106
+ /* @__PURE__ */ n(q, { gutter: 16, children: [
107
+ /* @__PURE__ */ e(R, { span: 12, children: /* @__PURE__ */ e(E, { title: "最近 5 条运行", loading: p, children: /* @__PURE__ */ e(
108
+ Oe,
109
+ {
110
+ size: "small",
111
+ rowKey: "id",
112
+ dataSource: a,
113
+ pagination: !1,
114
+ columns: [
115
+ { title: "脚本", dataIndex: "script_code", width: 160, ellipsis: !0 },
116
+ { title: "来源", dataIndex: "app_name", width: 100 },
117
+ {
118
+ title: "状态",
119
+ dataIndex: "invoke_status",
120
+ width: 90,
121
+ render: (g) => g === 1 ? /* @__PURE__ */ e(T, { icon: /* @__PURE__ */ e(W, {}), color: "success", children: "成功" }) : /* @__PURE__ */ e(T, { icon: /* @__PURE__ */ e(Z, {}), color: "error", children: "失败" })
122
+ },
123
+ {
124
+ title: "耗时(ms)",
125
+ dataIndex: "duration_ms",
126
+ width: 90,
127
+ render: (g) => g ?? "-"
128
+ },
129
+ {
130
+ title: "时间",
131
+ dataIndex: "invoked_at",
132
+ width: 170,
133
+ render: (g) => F(g)
134
+ }
135
+ ]
136
+ }
137
+ ) }) }),
138
+ /* @__PURE__ */ e(R, { span: 12, children: /* @__PURE__ */ e(E, { title: "卓越中心统计", children: /* @__PURE__ */ n(q, { gutter: 16, children: [
139
+ /* @__PURE__ */ e(R, { span: 12, children: /* @__PURE__ */ e(
140
+ N,
141
+ {
142
+ title: "成功运行",
143
+ value: (r == null ? void 0 : r.run_success_count) ?? 0,
144
+ prefix: /* @__PURE__ */ e(W, { style: { color: "#52c41a" } })
145
+ }
146
+ ) }),
147
+ /* @__PURE__ */ e(R, { span: 12, children: /* @__PURE__ */ e(
148
+ N,
149
+ {
150
+ title: "失败运行",
151
+ value: (r == null ? void 0 : r.run_failed_count) ?? 0,
152
+ prefix: /* @__PURE__ */ e(Z, { style: { color: "#ff4d4f" } })
153
+ }
154
+ ) }),
155
+ /* @__PURE__ */ e(R, { span: 12, style: { marginTop: 16 }, children: /* @__PURE__ */ e(
156
+ N,
157
+ {
158
+ title: "触发器数",
159
+ value: y,
160
+ prefix: /* @__PURE__ */ e(oe, { style: { color: "#722ed1" } })
161
+ }
162
+ ) }),
163
+ /* @__PURE__ */ e(R, { span: 12, style: { marginTop: 16 }, children: /* @__PURE__ */ e(
164
+ N,
165
+ {
166
+ title: "需求数",
167
+ value: s,
168
+ prefix: /* @__PURE__ */ e(ee, { style: { color: "#faad14" } })
169
+ }
170
+ ) })
171
+ ] }) }) })
172
+ ] })
173
+ ] });
174
+ }
175
+ const { Title: $e, Paragraph: ze } = j, Le = (r) => r === 1 ? /* @__PURE__ */ e(T, { color: "success", children: "在线" }) : /* @__PURE__ */ e(T, { color: "default", children: "草稿" });
176
+ function He() {
177
+ const r = X(), [h, a] = m([]), [f, y] = m(!1), [w, s] = m(!1), [v] = b.useForm(), p = async () => {
178
+ y(!0);
179
+ try {
180
+ const t = await P.list();
181
+ a(Array.isArray(t) ? t : []);
182
+ } catch (t) {
183
+ console.warn(t);
184
+ } finally {
185
+ y(!1);
186
+ }
187
+ };
188
+ M(() => {
189
+ p();
190
+ }, []);
191
+ const k = async () => {
192
+ try {
193
+ const t = await v.validateFields();
194
+ await P.create({
195
+ scriptCode: t.scriptCode.trim(),
196
+ scriptName: t.scriptName.trim(),
197
+ dslType: t.dslType,
198
+ sourceCode: t.sourceCode,
199
+ description: t.description
200
+ }), d.success("创建成功"), s(!1), v.resetFields(), p();
201
+ } catch (t) {
202
+ if (t != null && t.errorFields) return;
203
+ d.error("创建失败: " + ((t == null ? void 0 : t.message) ?? t));
204
+ }
205
+ }, o = async (t) => {
206
+ try {
207
+ const l = await P.run(t);
208
+ d.success(`执行成功(${(l == null ? void 0 : l.duration_ms) ?? "-"}ms)`);
209
+ } catch (l) {
210
+ d.error("执行失败: " + ((l == null ? void 0 : l.message) ?? l));
211
+ }
212
+ }, g = async (t) => {
213
+ try {
214
+ const l = await P.publish(t, "HTTP");
215
+ d.success("已发布: " + ((l == null ? void 0 : l.http_path) ?? t)), p();
216
+ } catch (l) {
217
+ d.error("发布失败: " + ((l == null ? void 0 : l.message) ?? l));
218
+ }
219
+ }, x = async (t) => {
220
+ try {
221
+ const l = await P.copy(t);
222
+ d.success("已复制为 " + ((l == null ? void 0 : l.script_code) ?? "新脚本")), p();
223
+ } catch (l) {
224
+ d.error("复制失败: " + ((l == null ? void 0 : l.message) ?? l));
225
+ }
226
+ }, O = async (t) => {
227
+ try {
228
+ await P.remove(t), d.success("已删除"), p();
229
+ } catch (l) {
230
+ d.error("删除失败: " + ((l == null ? void 0 : l.message) ?? l));
231
+ }
232
+ };
233
+ return /* @__PURE__ */ n("div", { style: { padding: 24, background: "#fff", minHeight: "100%" }, children: [
234
+ /* @__PURE__ */ e($e, { level: 3, style: { marginTop: 0 }, children: "应用管理" }),
235
+ /* @__PURE__ */ e(ze, { type: "secondary", children: "应用即脚本:源码、执行、发布都由脚本中心承载。" }),
236
+ /* @__PURE__ */ e(
237
+ Y,
238
+ {
239
+ rows: h,
240
+ loading: f,
241
+ rowKey: "script_code",
242
+ searchKeys: ["script_code", "script_name", "dsl_type"],
243
+ searchPlaceholder: "按编码 / 名称 / DSL 过滤",
244
+ emptyTitle: "暂无应用",
245
+ emptyDescription: "新建一个应用,就是往脚本中心登记一条脚本。",
246
+ cardProps: { variant: "borderless", styles: { body: { padding: 0 } } },
247
+ cardExtra: /* @__PURE__ */ n(D, { children: [
248
+ /* @__PURE__ */ e(u, { icon: /* @__PURE__ */ e(te, {}), onClick: p, loading: f, children: "刷新" }),
249
+ /* @__PURE__ */ e(u, { type: "primary", icon: /* @__PURE__ */ e(re, {}), onClick: () => s(!0), children: "新建应用" })
250
+ ] }),
251
+ columns: [
252
+ { title: "编码", dataIndex: "script_code", width: 180, ellipsis: !0 },
253
+ { title: "名称", dataIndex: "script_name", width: 180, ellipsis: !0 },
254
+ {
255
+ title: "DSL",
256
+ dataIndex: "dsl_type",
257
+ width: 110,
258
+ render: (t) => /* @__PURE__ */ e(T, { color: "blue", children: t })
259
+ },
260
+ {
261
+ title: "状态",
262
+ dataIndex: "status",
263
+ width: 80,
264
+ render: (t) => Le(t)
265
+ },
266
+ {
267
+ title: "暴露方式",
268
+ dataIndex: "expose_as",
269
+ width: 110,
270
+ render: (t) => t && t !== "NONE" ? /* @__PURE__ */ e(T, { color: "purple", children: t }) : /* @__PURE__ */ e(T, { children: "未暴露" })
271
+ },
272
+ { title: "HTTP 路径", dataIndex: "http_path", width: 220, ellipsis: !0 },
273
+ { title: "版本", dataIndex: "version", width: 80 },
274
+ { title: "描述", dataIndex: "description", ellipsis: !0 },
275
+ {
276
+ title: "更新时间",
277
+ dataIndex: "update_time",
278
+ width: 170,
279
+ render: (t) => F(t)
280
+ },
281
+ {
282
+ title: "操作",
283
+ width: 330,
284
+ render: (t, l) => /* @__PURE__ */ n(D, { size: 4, children: [
285
+ /* @__PURE__ */ e(
286
+ u,
287
+ {
288
+ size: "small",
289
+ icon: /* @__PURE__ */ e(_e, {}),
290
+ onClick: () => r(`/rpa/app/${encodeURIComponent(l.script_code)}/edit`),
291
+ children: "编辑"
292
+ }
293
+ ),
294
+ /* @__PURE__ */ e(
295
+ u,
296
+ {
297
+ size: "small",
298
+ icon: /* @__PURE__ */ e(K, {}),
299
+ type: "primary",
300
+ ghost: !0,
301
+ onClick: () => o(l.script_code),
302
+ children: "运行"
303
+ }
304
+ ),
305
+ /* @__PURE__ */ e(
306
+ u,
307
+ {
308
+ size: "small",
309
+ icon: /* @__PURE__ */ e(we, {}),
310
+ onClick: () => g(l.script_code),
311
+ children: "发布"
312
+ }
313
+ ),
314
+ /* @__PURE__ */ e(
315
+ u,
316
+ {
317
+ size: "small",
318
+ icon: /* @__PURE__ */ e(ve, {}),
319
+ onClick: () => x(l.script_code),
320
+ children: "复制"
321
+ }
322
+ ),
323
+ /* @__PURE__ */ e(
324
+ pe,
325
+ {
326
+ title: "确认删除该应用对应的脚本?",
327
+ onConfirm: () => O(l.script_code),
328
+ children: /* @__PURE__ */ e(u, { size: "small", danger: !0, icon: /* @__PURE__ */ e(Ie, {}), children: "删除" })
329
+ }
330
+ )
331
+ ] })
332
+ }
333
+ ]
334
+ }
335
+ ),
336
+ /* @__PURE__ */ e(
337
+ V,
338
+ {
339
+ title: "新建应用",
340
+ open: w,
341
+ onClose: () => s(!1),
342
+ size: "large",
343
+ extra: /* @__PURE__ */ n(D, { children: [
344
+ /* @__PURE__ */ e(u, { onClick: () => s(!1), children: "取消" }),
345
+ /* @__PURE__ */ e(u, { type: "primary", onClick: k, children: "创建" })
346
+ ] }),
347
+ children: /* @__PURE__ */ n(b, { form: v, layout: "vertical", children: [
348
+ /* @__PURE__ */ e(
349
+ b.Item,
350
+ {
351
+ name: "scriptCode",
352
+ label: "应用编码",
353
+ rules: [
354
+ { required: !0, message: "请输入应用编码" },
355
+ { pattern: /^[A-Za-z][A-Za-z0-9_-]*$/, message: "字母开头,仅字母/数字/下划线/中划线" }
356
+ ],
357
+ children: /* @__PURE__ */ e(A, { placeholder: "例如: finance_report_daily" })
358
+ }
359
+ ),
360
+ /* @__PURE__ */ e(b.Item, { name: "scriptName", label: "应用名称", rules: [{ required: !0 }], children: /* @__PURE__ */ e(A, { placeholder: "例如: 财务报表自动生成" }) }),
361
+ /* @__PURE__ */ e(b.Item, { name: "dslType", label: "脚本语言", rules: [{ required: !0 }], initialValue: "GROOVY", children: /* @__PURE__ */ e(H, { options: he }) }),
362
+ /* @__PURE__ */ e(b.Item, { name: "sourceCode", label: "脚本内容", children: /* @__PURE__ */ e(
363
+ A.TextArea,
364
+ {
365
+ rows: 8,
366
+ placeholder: "创建后可继续在编辑页修改;留空也能先建草稿。",
367
+ style: { fontFamily: "monospace" }
368
+ }
369
+ ) }),
370
+ /* @__PURE__ */ e(b.Item, { name: "description", label: "描述", children: /* @__PURE__ */ e(A.TextArea, { rows: 2, placeholder: "用途说明" }) })
371
+ ] })
372
+ }
373
+ )
374
+ ] });
375
+ }
376
+ const { Title: ae, Paragraph: Q } = j;
377
+ function Fe() {
378
+ const { scriptCode: r = "" } = me(), h = X(), [a, f] = m(null), [y, w] = m(""), [s, v] = m("{}"), [p, k] = m(null), [o, g] = m(!1), [x] = b.useForm(), O = async () => {
379
+ try {
380
+ const i = await P.detail(r), c = (i == null ? void 0 : i.data) ?? i;
381
+ f(c), w((c == null ? void 0 : c.source_code) ?? ""), x.setFieldsValue({
382
+ scriptName: (c == null ? void 0 : c.script_name) ?? "",
383
+ dslType: (c == null ? void 0 : c.dsl_type) ?? "GROOVY",
384
+ description: (c == null ? void 0 : c.description) ?? ""
385
+ });
386
+ } catch (i) {
387
+ d.error("加载失败: " + ((i == null ? void 0 : i.message) ?? i));
388
+ }
389
+ };
390
+ M(() => {
391
+ r && O();
392
+ }, [r]);
393
+ const t = async () => {
394
+ try {
395
+ const i = await x.validateFields();
396
+ g(!0), await P.update(r, {
397
+ scriptName: i.scriptName,
398
+ dslType: i.dslType,
399
+ description: i.description
400
+ }), d.success("已保存"), O();
401
+ } catch (i) {
402
+ i != null && i.errorFields || d.error("保存失败: " + ((i == null ? void 0 : i.message) ?? i));
403
+ } finally {
404
+ g(!1);
405
+ }
406
+ }, l = async () => {
407
+ try {
408
+ g(!0), await P.update(r, { sourceCode: y }), d.success("源码已保存"), O();
409
+ } catch (i) {
410
+ d.error("保存失败: " + ((i == null ? void 0 : i.message) ?? i));
411
+ } finally {
412
+ g(!1);
413
+ }
414
+ }, S = async () => {
415
+ let i = {};
416
+ try {
417
+ i = s.trim() ? JSON.parse(s) : {};
418
+ } catch (c) {
419
+ d.error("参数不是合法 JSON: " + c.message);
420
+ return;
421
+ }
422
+ try {
423
+ const c = await P.run(r, i);
424
+ k(JSON.stringify((c == null ? void 0 : c.data) ?? c, null, 2)), d.success(`执行成功(${(c == null ? void 0 : c.duration_ms) ?? "-"}ms)`);
425
+ } catch (c) {
426
+ k((c == null ? void 0 : c.message) ?? String(c)), d.error("执行失败");
427
+ }
428
+ }, G = async (i) => {
429
+ try {
430
+ const c = await P.publish(r, i);
431
+ d.success("已发布: " + ((c == null ? void 0 : c.http_path) ?? (c == null ? void 0 : c.mcp_tool_name) ?? r)), O();
432
+ } catch (c) {
433
+ d.error("发布失败: " + ((c == null ? void 0 : c.message) ?? c));
434
+ }
435
+ }, I = async () => {
436
+ try {
437
+ await P.unpublish(r), d.success("已取消发布"), O();
438
+ } catch (i) {
439
+ d.error("取消失败: " + ((i == null ? void 0 : i.message) ?? i));
440
+ }
441
+ };
442
+ return /* @__PURE__ */ n("div", { style: { padding: 24, background: "#fff", minHeight: "100%" }, children: [
443
+ /* @__PURE__ */ n(D, { style: { marginBottom: 16 }, children: [
444
+ /* @__PURE__ */ e(u, { icon: /* @__PURE__ */ e(Ce, {}), onClick: () => h("/rpa/app"), children: "返回" }),
445
+ /* @__PURE__ */ e(ae, { level: 3, style: { margin: 0 }, children: (a == null ? void 0 : a.script_name) || r || "应用编辑" }),
446
+ a && (a.status === 1 ? /* @__PURE__ */ e(T, { color: "success", children: "在线" }) : /* @__PURE__ */ e(T, { children: "草稿" }))
447
+ ] }),
448
+ /* @__PURE__ */ e(
449
+ Ae,
450
+ {
451
+ items: [
452
+ {
453
+ key: "basic",
454
+ label: "基本信息",
455
+ children: /* @__PURE__ */ n("div", { style: { padding: 16, maxWidth: 720 }, children: [
456
+ /* @__PURE__ */ n(C, { size: "small", column: 2, bordered: !0, style: { marginBottom: 24 }, children: [
457
+ /* @__PURE__ */ e(C.Item, { label: "应用编码", children: a == null ? void 0 : a.script_code }),
458
+ /* @__PURE__ */ e(C.Item, { label: "版本", children: a == null ? void 0 : a.version }),
459
+ /* @__PURE__ */ e(C.Item, { label: "暴露方式", children: (a == null ? void 0 : a.expose_as) ?? "NONE" }),
460
+ /* @__PURE__ */ e(C.Item, { label: "HTTP 路径", children: (a == null ? void 0 : a.http_path) ?? "-" }),
461
+ /* @__PURE__ */ e(C.Item, { label: "MCP 工具", children: (a == null ? void 0 : a.mcp_tool_name) ?? "-" }),
462
+ /* @__PURE__ */ e(C.Item, { label: "更新时间", children: F(a == null ? void 0 : a.update_time) })
463
+ ] }),
464
+ /* @__PURE__ */ n(b, { form: x, layout: "vertical", children: [
465
+ /* @__PURE__ */ e(b.Item, { label: "应用名称", name: "scriptName", rules: [{ required: !0 }], children: /* @__PURE__ */ e(A, {}) }),
466
+ /* @__PURE__ */ e(b.Item, { label: "脚本语言", name: "dslType", rules: [{ required: !0 }], children: /* @__PURE__ */ e(H, { options: he }) }),
467
+ /* @__PURE__ */ e(b.Item, { label: "描述", name: "description", children: /* @__PURE__ */ e(A.TextArea, { rows: 3 }) }),
468
+ /* @__PURE__ */ e(u, { type: "primary", icon: /* @__PURE__ */ e(le, {}), loading: o, onClick: t, children: "保存" })
469
+ ] })
470
+ ] })
471
+ },
472
+ {
473
+ key: "source",
474
+ label: "源码与试运行",
475
+ children: /* @__PURE__ */ n("div", { style: { padding: 16 }, children: [
476
+ /* @__PURE__ */ e(
477
+ A.TextArea,
478
+ {
479
+ value: y,
480
+ onChange: (i) => w(i.target.value),
481
+ rows: 16,
482
+ style: { fontFamily: "monospace" },
483
+ placeholder: "脚本源码"
484
+ }
485
+ ),
486
+ /* @__PURE__ */ e(D, { style: { marginTop: 12 }, children: /* @__PURE__ */ e(u, { type: "primary", icon: /* @__PURE__ */ e(le, {}), loading: o, onClick: l, children: "保存源码" }) }),
487
+ /* @__PURE__ */ e(ae, { level: 5, style: { marginTop: 24 }, children: "试运行" }),
488
+ /* @__PURE__ */ e(Q, { type: "secondary", style: { marginBottom: 8 }, children: "执行参数(JSON,EL/GROOVY 里以 params 访问)" }),
489
+ /* @__PURE__ */ e(
490
+ A.TextArea,
491
+ {
492
+ value: s,
493
+ onChange: (i) => v(i.target.value),
494
+ rows: 4,
495
+ style: { fontFamily: "monospace" }
496
+ }
497
+ ),
498
+ /* @__PURE__ */ e(
499
+ u,
500
+ {
501
+ style: { marginTop: 12 },
502
+ icon: /* @__PURE__ */ e(K, {}),
503
+ onClick: S,
504
+ children: "运行"
505
+ }
506
+ ),
507
+ p != null && /* @__PURE__ */ e(
508
+ Se,
509
+ {
510
+ style: { marginTop: 16 },
511
+ type: "info",
512
+ message: "执行结果",
513
+ description: /* @__PURE__ */ e("pre", { style: { margin: 0, whiteSpace: "pre-wrap", wordBreak: "break-all" }, children: p })
514
+ }
515
+ )
516
+ ] })
517
+ },
518
+ {
519
+ key: "trigger",
520
+ label: "触发器",
521
+ children: /* @__PURE__ */ n("div", { style: { padding: 16 }, children: [
522
+ /* @__PURE__ */ e(Q, { type: "secondary", children: "触发器由调度中心按 cron 驱动这条脚本,去触发器页管理。" }),
523
+ /* @__PURE__ */ e(u, { type: "primary", onClick: () => h("/rpa/trigger"), children: "管理触发器" })
524
+ ] })
525
+ },
526
+ {
527
+ key: "publish",
528
+ label: "发布",
529
+ children: /* @__PURE__ */ n("div", { style: { padding: 16 }, children: [
530
+ /* @__PURE__ */ n(Q, { type: "secondary", children: [
531
+ "HTTP 暴露固定为 ",
532
+ /* @__PURE__ */ n("code", { children: [
533
+ "/api/script-run/",
534
+ r
535
+ ] }),
536
+ ";MCP 暴露会注册同名工具。"
537
+ ] }),
538
+ /* @__PURE__ */ n(D, { children: [
539
+ /* @__PURE__ */ e(u, { type: "primary", onClick: () => G("HTTP"), children: "发布为 HTTP" }),
540
+ /* @__PURE__ */ e(u, { onClick: () => G("MCP"), children: "发布为 MCP" }),
541
+ /* @__PURE__ */ e(u, { onClick: () => G("BOTH"), children: "同时发布" }),
542
+ /* @__PURE__ */ e(u, { danger: !0, onClick: I, children: "取消发布" })
543
+ ] }),
544
+ /* @__PURE__ */ n(C, { size: "small", column: 2, bordered: !0, style: { marginTop: 24, maxWidth: 720 }, children: [
545
+ /* @__PURE__ */ e(C.Item, { label: "当前状态", children: (a == null ? void 0 : a.status) === 1 ? /* @__PURE__ */ e(T, { color: "success", children: "在线" }) : /* @__PURE__ */ e(T, { children: "草稿" }) }),
546
+ /* @__PURE__ */ e(C.Item, { label: "暴露方式", children: (a == null ? void 0 : a.expose_as) ?? "NONE" }),
547
+ /* @__PURE__ */ e(C.Item, { label: "HTTP 路径", span: 2, children: (a == null ? void 0 : a.http_path) ?? "-" }),
548
+ /* @__PURE__ */ e(C.Item, { label: "MCP 工具", span: 2, children: (a == null ? void 0 : a.mcp_tool_name) ?? "-" })
549
+ ] })
550
+ ] })
551
+ }
552
+ ]
553
+ }
554
+ )
555
+ ] });
556
+ }
557
+ const { Title: Me, Paragraph: je } = j;
558
+ function Ge() {
559
+ const [r, h] = m([]), [a, f] = m([]), [y, w] = m(!1), [s, v] = m(!1), [p] = b.useForm(), k = async () => {
560
+ w(!0);
561
+ try {
562
+ const [t, l] = await Promise.all([
563
+ L.list(),
564
+ P.list().catch(() => [])
565
+ ]);
566
+ h(Array.isArray(t) ? t : []), f(Array.isArray(l) ? l : []);
567
+ } catch (t) {
568
+ console.warn(t);
569
+ } finally {
570
+ w(!1);
571
+ }
572
+ };
573
+ M(() => {
574
+ k();
575
+ }, []);
576
+ const o = async () => {
577
+ try {
578
+ const t = await p.validateFields();
579
+ await L.add({
580
+ job_desc: t.jobDesc.trim(),
581
+ job_cron: t.jobCron.trim(),
582
+ script_code: t.scriptCode,
583
+ author: t.author
584
+ }), d.success("触发器已创建并启动"), v(!1), p.resetFields(), k();
585
+ } catch (t) {
586
+ if (t != null && t.errorFields) return;
587
+ d.error("创建失败: " + ((t == null ? void 0 : t.message) ?? t));
588
+ }
589
+ }, g = async (t, l) => {
590
+ try {
591
+ await (l ? L.start(t.id) : L.stop(t.id)), d.success(l ? "已启动" : "已停止"), k();
592
+ } catch (S) {
593
+ d.error("切换失败: " + ((S == null ? void 0 : S.message) ?? S));
594
+ }
595
+ }, x = async (t) => {
596
+ try {
597
+ await L.trigger(t.id), d.success("已触发一次执行");
598
+ } catch (l) {
599
+ d.error("触发失败: " + ((l == null ? void 0 : l.message) ?? l));
600
+ }
601
+ }, O = async (t) => {
602
+ try {
603
+ await L.remove(t), d.success("已删除"), k();
604
+ } catch (l) {
605
+ d.error("删除失败: " + ((l == null ? void 0 : l.message) ?? l));
606
+ }
607
+ };
608
+ return /* @__PURE__ */ n("div", { style: { padding: 24, background: "#fff", minHeight: "100%" }, children: [
609
+ /* @__PURE__ */ e(Me, { level: 3, style: { marginTop: 0 }, children: "触发器" }),
610
+ /* @__PURE__ */ e(je, { type: "secondary", children: "每条触发器 = 调度中心里一个 cron 任务,到点执行指定脚本。" }),
611
+ /* @__PURE__ */ e(
612
+ Y,
613
+ {
614
+ rows: r,
615
+ loading: y,
616
+ rowKey: "id",
617
+ searchKeys: ["job_desc", "script_code", "job_cron"],
618
+ searchPlaceholder: "按描述 / 脚本 / Cron 过滤",
619
+ emptyTitle: "暂无触发器",
620
+ emptyDescription: "新建一个触发器,让脚本按 cron 自动执行。",
621
+ cardProps: { variant: "borderless", styles: { body: { padding: 0 } } },
622
+ cardExtra: /* @__PURE__ */ n(D, { children: [
623
+ /* @__PURE__ */ e(u, { icon: /* @__PURE__ */ e(te, {}), onClick: k, loading: y, children: "刷新" }),
624
+ /* @__PURE__ */ e(u, { type: "primary", icon: /* @__PURE__ */ e(re, {}), onClick: () => v(!0), children: "新建触发器" })
625
+ ] }),
626
+ columns: [
627
+ { title: "ID", dataIndex: "id", width: 60 },
628
+ { title: "任务描述", dataIndex: "job_desc", width: 200, ellipsis: !0 },
629
+ { title: "脚本", dataIndex: "script_code", width: 180, ellipsis: !0 },
630
+ {
631
+ title: "Cron",
632
+ dataIndex: "job_cron",
633
+ width: 180,
634
+ render: (t) => /* @__PURE__ */ e("code", { children: t })
635
+ },
636
+ {
637
+ title: "启用",
638
+ dataIndex: "trigger_status",
639
+ width: 80,
640
+ render: (t, l) => /* @__PURE__ */ e(Re, { checked: t === 1, onChange: (S) => g(l, S) })
641
+ },
642
+ {
643
+ title: "上次触发",
644
+ dataIndex: "trigger_last_time",
645
+ width: 170,
646
+ render: (t) => F(t)
647
+ },
648
+ {
649
+ title: "下次触发",
650
+ dataIndex: "trigger_next_time",
651
+ width: 170,
652
+ render: (t) => F(t)
653
+ },
654
+ { title: "作者", dataIndex: "author", width: 100 },
655
+ {
656
+ title: "操作",
657
+ width: 180,
658
+ render: (t, l) => /* @__PURE__ */ n(D, { size: 4, children: [
659
+ /* @__PURE__ */ e(u, { size: "small", icon: /* @__PURE__ */ e(K, {}), onClick: () => x(l), children: "立即执行" }),
660
+ /* @__PURE__ */ e(pe, { title: "确认删除该触发器?", onConfirm: () => O(l.id), children: /* @__PURE__ */ e(u, { size: "small", danger: !0, children: "删除" }) })
661
+ ] })
662
+ }
663
+ ]
664
+ }
665
+ ),
666
+ /* @__PURE__ */ e(
667
+ V,
668
+ {
669
+ title: "新建触发器",
670
+ open: s,
671
+ onClose: () => v(!1),
672
+ size: "large",
673
+ extra: /* @__PURE__ */ n(D, { children: [
674
+ /* @__PURE__ */ e(u, { onClick: () => v(!1), children: "取消" }),
675
+ /* @__PURE__ */ e(u, { type: "primary", onClick: o, children: "创建" })
676
+ ] }),
677
+ children: /* @__PURE__ */ n(b, { form: p, layout: "vertical", children: [
678
+ /* @__PURE__ */ e(b.Item, { name: "jobDesc", label: "任务描述", rules: [{ required: !0 }], children: /* @__PURE__ */ e(A, { placeholder: "例如: 每日 9 点生成报表" }) }),
679
+ /* @__PURE__ */ e(b.Item, { name: "scriptCode", label: "执行脚本", rules: [{ required: !0 }], children: /* @__PURE__ */ e(
680
+ H,
681
+ {
682
+ showSearch: !0,
683
+ optionFilterProp: "label",
684
+ placeholder: "选择脚本",
685
+ options: a.map((t) => ({
686
+ value: t.script_code,
687
+ label: `${t.script_code}(${t.script_name})`
688
+ }))
689
+ }
690
+ ) }),
691
+ /* @__PURE__ */ e(
692
+ b.Item,
693
+ {
694
+ name: "jobCron",
695
+ label: "Cron 表达式(Quartz 6/7 段)",
696
+ rules: [{ required: !0 }],
697
+ extra: /* @__PURE__ */ e(T, { children: "例:0 0 9 * * ? 表示每天 9:00" }),
698
+ children: /* @__PURE__ */ e(A, { placeholder: "0 0 9 * * ?" })
699
+ }
700
+ ),
701
+ /* @__PURE__ */ e(b.Item, { name: "author", label: "作者", children: /* @__PURE__ */ e(A, { placeholder: "可选" }) })
702
+ ] })
703
+ }
704
+ )
705
+ ] });
706
+ }
707
+ const { Title: Be, Paragraph: Ke } = j;
708
+ function ie() {
709
+ const [r, h] = m([]), [a, f] = m(0), [y, w] = m(1), [s, v] = m(20), [p, k] = m(""), [o, g] = m(void 0), [x, O] = m(!1), [t, l] = m(null), S = async (I = y, i = s, c = p, ue = o) => {
710
+ O(!0);
711
+ try {
712
+ const B = await P.invokeLogPage({
713
+ scriptCode: c.trim() || void 0,
714
+ success: ue,
715
+ current: I,
716
+ size: i
717
+ }), $ = (B == null ? void 0 : B.data) ?? B;
718
+ h(Array.isArray($ == null ? void 0 : $.records) ? $.records : []), f(Number(($ == null ? void 0 : $.total) ?? 0));
719
+ } catch (B) {
720
+ console.warn(B);
721
+ } finally {
722
+ O(!1);
723
+ }
724
+ };
725
+ M(() => {
726
+ S(1, s, "", void 0);
727
+ }, []);
728
+ const G = () => {
729
+ w(1), S(1, s, p, o);
730
+ };
731
+ return /* @__PURE__ */ n("div", { style: { padding: 24, background: "#fff", minHeight: "100%" }, children: [
732
+ /* @__PURE__ */ e(Be, { level: 3, style: { marginTop: 0 }, children: "运行监控" }),
733
+ /* @__PURE__ */ e(Ke, { type: "secondary", children: "脚本中心每次执行(控制台试运行 / HTTP 暴露 / API Key 调用)都会在这里留痕。" }),
734
+ /* @__PURE__ */ e(
735
+ Y,
736
+ {
737
+ rows: r,
738
+ loading: x,
739
+ rowKey: "id",
740
+ emptyTitle: "暂无运行记录",
741
+ emptyDescription: "脚本被执行后,运行记录会出现在这里。",
742
+ cardProps: { variant: "borderless", styles: { body: { padding: 0 } } },
743
+ cardExtra: /* @__PURE__ */ n(D, { children: [
744
+ /* @__PURE__ */ e(
745
+ A.Search,
746
+ {
747
+ placeholder: "按脚本编码过滤",
748
+ allowClear: !0,
749
+ style: { width: 220 },
750
+ value: p,
751
+ onChange: (I) => k(I.target.value),
752
+ onSearch: G
753
+ }
754
+ ),
755
+ /* @__PURE__ */ e(
756
+ H,
757
+ {
758
+ style: { width: 120 },
759
+ value: o,
760
+ placeholder: "全部状态",
761
+ allowClear: !0,
762
+ onChange: (I) => {
763
+ g(I), w(1), S(1, s, p, I);
764
+ },
765
+ options: [
766
+ { value: 1, label: "成功" },
767
+ { value: 0, label: "失败" }
768
+ ]
769
+ }
770
+ ),
771
+ /* @__PURE__ */ e(u, { icon: /* @__PURE__ */ e(te, {}), onClick: G, loading: x, children: "刷新" })
772
+ ] }),
773
+ pagination: {
774
+ current: y,
775
+ pageSize: s,
776
+ total: a,
777
+ showSizeChanger: !0,
778
+ pageSizeOptions: ["10", "20", "50", "100"],
779
+ showTotal: (I) => `共 ${I} 条`,
780
+ onChange: (I, i) => {
781
+ w(I), v(i), S(I, i, p, o);
782
+ }
783
+ },
784
+ columns: [
785
+ { title: "ID", dataIndex: "id", width: 70 },
786
+ { title: "脚本", dataIndex: "script_code", width: 200, ellipsis: !0 },
787
+ { title: "来源", dataIndex: "app_name", width: 120 },
788
+ {
789
+ title: "状态",
790
+ dataIndex: "invoke_status",
791
+ width: 90,
792
+ render: (I) => I === 1 ? /* @__PURE__ */ e(T, { icon: /* @__PURE__ */ e(W, {}), color: "success", children: "成功" }) : /* @__PURE__ */ e(T, { icon: /* @__PURE__ */ e(Z, {}), color: "error", children: "失败" })
793
+ },
794
+ { title: "HTTP", dataIndex: "http_status", width: 80 },
795
+ {
796
+ title: "耗时(ms)",
797
+ dataIndex: "duration_ms",
798
+ width: 100,
799
+ render: (I) => I ?? "-"
800
+ },
801
+ { title: "错误", dataIndex: "error_message", ellipsis: !0 },
802
+ {
803
+ title: "时间",
804
+ dataIndex: "invoked_at",
805
+ width: 170,
806
+ render: (I) => F(I)
807
+ },
808
+ {
809
+ title: "操作",
810
+ width: 90,
811
+ render: (I, i) => /* @__PURE__ */ e(u, { size: "small", onClick: () => l(i), children: "详情" })
812
+ }
813
+ ]
814
+ }
815
+ ),
816
+ /* @__PURE__ */ e(
817
+ V,
818
+ {
819
+ title: t ? `运行详情 - #${t.id}` : "运行详情",
820
+ open: !!t,
821
+ onClose: () => l(null),
822
+ size: "large",
823
+ children: t && /* @__PURE__ */ n(C, { size: "small", column: 2, bordered: !0, children: [
824
+ /* @__PURE__ */ e(C.Item, { label: "脚本", children: t.script_code }),
825
+ /* @__PURE__ */ e(C.Item, { label: "来源", children: t.app_name }),
826
+ /* @__PURE__ */ e(C.Item, { label: "状态", children: t.invoke_status === 1 ? /* @__PURE__ */ e(T, { color: "success", children: "成功" }) : /* @__PURE__ */ e(T, { color: "error", children: "失败" }) }),
827
+ /* @__PURE__ */ e(C.Item, { label: "HTTP 状态", children: t.http_status }),
828
+ /* @__PURE__ */ e(C.Item, { label: "耗时(ms)", children: t.duration_ms ?? "-" }),
829
+ /* @__PURE__ */ e(C.Item, { label: "时间", children: F(t.invoked_at) }),
830
+ /* @__PURE__ */ e(C.Item, { label: "错误信息", span: 2, children: t.error_message || "-" })
831
+ ] })
832
+ }
833
+ )
834
+ ] });
835
+ }
836
+ const { Title: Ue, Paragraph: ne } = j;
837
+ function We() {
838
+ const [r, h] = m([]), [a, f] = m(!1), y = async () => {
839
+ f(!0);
840
+ try {
841
+ const s = await _.post("rpa/market/list", {});
842
+ h(Array.isArray(s == null ? void 0 : s.data) ? s.data : Array.isArray(s) ? s : []);
843
+ } catch (s) {
844
+ console.warn(s);
845
+ } finally {
846
+ f(!1);
847
+ }
848
+ };
849
+ M(() => {
850
+ y();
851
+ }, []);
852
+ const w = async (s, v) => {
853
+ try {
854
+ await _.post(`rpa/market/${s}/install`, {}), d.success(`已安装: ${v}`);
855
+ } catch (p) {
856
+ d.error((p == null ? void 0 : p.message) ?? "安装失败");
857
+ }
858
+ };
859
+ return /* @__PURE__ */ n("div", { style: { padding: 24, background: "#f5f7fa", minHeight: "100%" }, children: [
860
+ /* @__PURE__ */ n(Ue, { level: 3, style: { marginTop: 0 }, children: [
861
+ /* @__PURE__ */ e(de, {}),
862
+ " 应用市场"
863
+ ] }),
864
+ /* @__PURE__ */ e(ne, { type: "secondary", children: "影刀 RPA 应用市场 (MVP: 卡片展示 + 一键安装)" }),
865
+ /* @__PURE__ */ e(De, { spinning: a, children: /* @__PURE__ */ n(q, { gutter: [16, 16], children: [
866
+ r.length === 0 && /* @__PURE__ */ e(R, { span: 24, children: /* @__PURE__ */ e(E, { children: /* @__PURE__ */ e("div", { style: { textAlign: "center", color: "#999", padding: 32 }, children: "暂无市场条目" }) }) }),
867
+ r.map((s) => /* @__PURE__ */ e(R, { xs: 24, sm: 12, md: 8, lg: 6, children: /* @__PURE__ */ e(
868
+ E,
869
+ {
870
+ hoverable: !0,
871
+ actions: [
872
+ /* @__PURE__ */ e(
873
+ u,
874
+ {
875
+ type: "primary",
876
+ icon: /* @__PURE__ */ e(ke, {}),
877
+ onClick: () => w(s.id, s.appName),
878
+ children: "安装"
879
+ },
880
+ "install"
881
+ )
882
+ ],
883
+ children: /* @__PURE__ */ e(
884
+ E.Meta,
885
+ {
886
+ avatar: /* @__PURE__ */ e("span", { style: { fontSize: 32 }, children: s.icon || "📦" }),
887
+ title: /* @__PURE__ */ n("span", { children: [
888
+ s.featured === 1 && /* @__PURE__ */ e(Te, { style: { color: "#faad14", marginRight: 6 } }),
889
+ s.appName
890
+ ] }),
891
+ description: /* @__PURE__ */ n("div", { children: [
892
+ /* @__PURE__ */ e(T, { children: s.category ?? "未分类" }),
893
+ /* @__PURE__ */ n(T, { color: "blue", children: [
894
+ s.downloads ?? 0,
895
+ " 次安装"
896
+ ] }),
897
+ /* @__PURE__ */ n(
898
+ "div",
899
+ {
900
+ style: {
901
+ marginTop: 8,
902
+ color: "#666",
903
+ fontSize: 12
904
+ },
905
+ children: [
906
+ "作者: ",
907
+ s.author ?? "anonymous"
908
+ ]
909
+ }
910
+ ),
911
+ /* @__PURE__ */ e(
912
+ ne,
913
+ {
914
+ style: { marginTop: 8, marginBottom: 0 },
915
+ ellipsis: { rows: 2 },
916
+ children: s.description
917
+ }
918
+ )
919
+ ] })
920
+ }
921
+ )
922
+ }
923
+ ) }, s.id))
924
+ ] }) })
925
+ ] });
926
+ }
927
+ const { Title: qe } = j, Ve = {
928
+ LOW: "default",
929
+ MEDIUM: "blue",
930
+ HIGH: "orange",
931
+ URGENT: "red"
932
+ };
933
+ function Ye() {
934
+ const [r, h] = m([]), [a, f] = m(!1), [y, w] = m(!1), [s] = b.useForm(), v = async () => {
935
+ f(!0);
936
+ try {
937
+ const o = await _.post("rpa/demand/list", {});
938
+ h(Array.isArray(o == null ? void 0 : o.data) ? o.data : Array.isArray(o) ? o : []);
939
+ } catch (o) {
940
+ console.warn(o);
941
+ } finally {
942
+ f(!1);
943
+ }
944
+ };
945
+ M(() => {
946
+ v();
947
+ }, []);
948
+ const p = async () => {
949
+ try {
950
+ const o = await s.validateFields();
951
+ await _.post("rpa/demand/submit", o), d.success("需求已提交"), w(!1), s.resetFields(), v();
952
+ } catch (o) {
953
+ if (o != null && o.errorFields) return;
954
+ d.error((o == null ? void 0 : o.message) ?? String(o));
955
+ }
956
+ }, k = async (o, g) => {
957
+ await _.put(`rpa/demand/${o}/status`, { status: g }), d.success("状态已更新"), v();
958
+ };
959
+ return /* @__PURE__ */ n("div", { style: { padding: 24, background: "#fff", minHeight: "100%" }, children: [
960
+ /* @__PURE__ */ n(D, { style: { marginBottom: 16 }, children: [
961
+ /* @__PURE__ */ n(qe, { level: 3, style: { margin: 0 }, children: [
962
+ /* @__PURE__ */ e(ee, {}),
963
+ " 需求中心"
964
+ ] }),
965
+ /* @__PURE__ */ e(u, { type: "primary", icon: /* @__PURE__ */ e(re, {}), onClick: () => w(!0), children: "提交需求" })
966
+ ] }),
967
+ /* @__PURE__ */ e(
968
+ Y,
969
+ {
970
+ rows: r,
971
+ loading: a,
972
+ rowKey: "id",
973
+ searchKeys: ["demand_code", "title", "status"],
974
+ searchPlaceholder: "按编号 / 标题 / 状态过滤",
975
+ emptyTitle: "暂无需求",
976
+ emptyDescription: "把要做的事提成需求,需求中心负责跟踪到落地。",
977
+ cardProps: { variant: "borderless", styles: { body: { padding: 0 } } },
978
+ columns: [
979
+ { title: "编号", dataIndex: "demand_code", width: 200, ellipsis: !0 },
980
+ { title: "标题", dataIndex: "title", ellipsis: !0 },
981
+ { title: "分类", dataIndex: "category", width: 100 },
982
+ {
983
+ title: "优先级",
984
+ dataIndex: "priority",
985
+ width: 90,
986
+ render: (o) => /* @__PURE__ */ e(T, { color: Ve[o] ?? "default", children: o })
987
+ },
988
+ {
989
+ title: "状态",
990
+ dataIndex: "status",
991
+ width: 110,
992
+ render: (o, g) => /* @__PURE__ */ e(
993
+ H,
994
+ {
995
+ size: "small",
996
+ value: o,
997
+ style: { width: 110 },
998
+ onChange: (x) => k(g.id, x),
999
+ options: [
1000
+ { value: "OPEN", label: "OPEN" },
1001
+ { value: "IN_PROGRESS", label: "IN_PROGRESS" },
1002
+ { value: "DONE", label: "DONE" },
1003
+ { value: "REJECTED", label: "REJECTED" }
1004
+ ]
1005
+ }
1006
+ )
1007
+ },
1008
+ { title: "提交人", dataIndex: "submitter", width: 120 },
1009
+ { title: "创建时间", dataIndex: "created_at", width: 170 }
1010
+ ]
1011
+ }
1012
+ ),
1013
+ /* @__PURE__ */ e(
1014
+ V,
1015
+ {
1016
+ title: "提交需求",
1017
+ open: y,
1018
+ onClose: () => w(!1),
1019
+ size: "large",
1020
+ footer: /* @__PURE__ */ n(D, { style: { float: "right" }, children: [
1021
+ /* @__PURE__ */ e(u, { onClick: () => w(!1), children: "取消" }),
1022
+ /* @__PURE__ */ e(u, { type: "primary", onClick: p, children: "提交" })
1023
+ ] }),
1024
+ children: /* @__PURE__ */ n(b, { form: s, layout: "vertical", children: [
1025
+ /* @__PURE__ */ e(b.Item, { name: "title", label: "需求标题", rules: [{ required: !0 }], children: /* @__PURE__ */ e(A, { placeholder: "简短描述需求" }) }),
1026
+ /* @__PURE__ */ e(b.Item, { name: "category", label: "分类", children: /* @__PURE__ */ e(
1027
+ H,
1028
+ {
1029
+ options: [
1030
+ { value: "DESKTOP", label: "桌面自动化" },
1031
+ { value: "WEB", label: "网页自动化" },
1032
+ { value: "MOBILE", label: "手机自动化" },
1033
+ { value: "AI", label: "AI 智能" },
1034
+ { value: "MARKET", label: "应用市场" },
1035
+ { value: "OTHER", label: "其他" }
1036
+ ]
1037
+ }
1038
+ ) }),
1039
+ /* @__PURE__ */ e(b.Item, { name: "priority", label: "优先级", children: /* @__PURE__ */ e(
1040
+ H,
1041
+ {
1042
+ defaultValue: "MEDIUM",
1043
+ options: [
1044
+ { value: "LOW", label: "LOW" },
1045
+ { value: "MEDIUM", label: "MEDIUM" },
1046
+ { value: "HIGH", label: "HIGH" },
1047
+ { value: "URGENT", label: "URGENT" }
1048
+ ]
1049
+ }
1050
+ ) }),
1051
+ /* @__PURE__ */ e(b.Item, { name: "description", label: "详细描述", children: /* @__PURE__ */ e(A.TextArea, { rows: 5, placeholder: "详细描述应用场景/痛点/期望" }) })
1052
+ ] })
1053
+ }
1054
+ )
1055
+ ] });
1056
+ }
1057
+ const Je = "_shell_ezj0g_6", Qe = "_sidebar_ezj0g_14", Ze = "_main_ezj0g_25", Xe = "_menuWrap_ezj0g_43", U = {
1058
+ shell: Je,
1059
+ sidebar: Qe,
1060
+ main: Ze,
1061
+ menuWrap: Xe
1062
+ }, se = [
1063
+ { key: "/rpa/dashboard", icon: /* @__PURE__ */ e(xe, {}), label: "概览" },
1064
+ { key: "/rpa/app", icon: /* @__PURE__ */ e(ce, {}), label: "应用管理" },
1065
+ { key: "/rpa/trigger", icon: /* @__PURE__ */ e(oe, {}), label: "触发器" },
1066
+ { key: "/rpa/run", icon: /* @__PURE__ */ e(K, {}), label: "运行监控" },
1067
+ { key: "/rpa/market", icon: /* @__PURE__ */ e(de, {}), label: "应用市场" },
1068
+ { key: "/rpa/demand", icon: /* @__PURE__ */ e(ee, {}), label: "需求中心" },
1069
+ { key: "/rpa/about", icon: /* @__PURE__ */ e(Pe, {}), label: "关于 RPA" }
1070
+ ];
1071
+ function et() {
1072
+ return /* @__PURE__ */ n("div", { style: { padding: 24, maxWidth: 880 }, children: [
1073
+ /* @__PURE__ */ e("h2", { children: "RPA 与脚本中心的关系" }),
1074
+ /* @__PURE__ */ e("p", { children: "RPA 本身不实现执行引擎,它是脚本中心(z-script,与配置中心同级的 L3 中间件)的一层产品皮: 应用就是脚本,流程就是脚本源码,运行记录就是脚本调用审计。" }),
1075
+ /* @__PURE__ */ n("ul", { style: { lineHeight: 1.9 }, children: [
1076
+ /* @__PURE__ */ e("li", { children: "应用管理 → 脚本中心的脚本(EL / GROOVY / LUA / SQL / MOCK / API_BRIDGE)" }),
1077
+ /* @__PURE__ */ e("li", { children: "编辑与试运行 → 脚本源码 + 沙箱执行" }),
1078
+ /* @__PURE__ */ e("li", { children: "运行监控 → z_script_invoke_log(控制台、HTTP 暴露、API Key 调用统一留痕)" }),
1079
+ /* @__PURE__ */ e("li", { children: "触发器 → 调度中心按 cron 执行脚本(执行器 scriptJobHandler)" }),
1080
+ /* @__PURE__ */ e("li", { children: "应用市场 / 需求中心 → z-rpa 自己维护的产品元数据" })
1081
+ ] }),
1082
+ /* @__PURE__ */ e("h3", { children: "当前缺口" }),
1083
+ /* @__PURE__ */ n("ul", { style: { lineHeight: 1.9 }, children: [
1084
+ /* @__PURE__ */ e("li", { children: "浏览器 / 桌面端的元素驱动(点击、输入、截图)脚本中心尚不提供, 因此「录制回放式 RPA」还不是本工作台的能力。" }),
1085
+ /* @__PURE__ */ e("li", { children: "触发器目前只有 cron;webhook 触发未接线。" }),
1086
+ /* @__PURE__ */ e("li", { children: "运行记录是审计视图,不支持中止正在执行的脚本。" })
1087
+ ] })
1088
+ ] });
1089
+ }
1090
+ function tt() {
1091
+ return ge([
1092
+ { path: "", element: /* @__PURE__ */ e(J, {}) },
1093
+ { path: "dashboard", element: /* @__PURE__ */ e(J, {}) },
1094
+ { path: "app", element: /* @__PURE__ */ e(He, {}) },
1095
+ { path: "app/:scriptCode/edit", element: /* @__PURE__ */ e(Fe, {}) },
1096
+ { path: "trigger", element: /* @__PURE__ */ e(Ge, {}) },
1097
+ { path: "run", element: /* @__PURE__ */ e(ie, {}) },
1098
+ { path: "run/:id", element: /* @__PURE__ */ e(ie, {}) },
1099
+ { path: "market", element: /* @__PURE__ */ e(We, {}) },
1100
+ { path: "demand", element: /* @__PURE__ */ e(Ye, {}) },
1101
+ { path: "about", element: /* @__PURE__ */ e(et, {}) }
1102
+ ]) ?? /* @__PURE__ */ e(J, {});
1103
+ }
1104
+ function ot({ onModeSwitch: r }) {
1105
+ const h = X(), { pathname: a } = ye(), f = be(() => {
1106
+ for (const y of se)
1107
+ if (a.startsWith(y.key)) return y.key;
1108
+ return a;
1109
+ }, [a]);
1110
+ return /* @__PURE__ */ n("div", { className: U.shell, children: [
1111
+ /* @__PURE__ */ e("aside", { className: U.sidebar, children: /* @__PURE__ */ e("div", { className: U.menuWrap, children: se.map((y) => /* @__PURE__ */ n(
1112
+ "button",
1113
+ {
1114
+ type: "button",
1115
+ onClick: () => h(y.key),
1116
+ style: {
1117
+ display: "flex",
1118
+ alignItems: "center",
1119
+ gap: 10,
1120
+ width: "100%",
1121
+ padding: "10px 16px",
1122
+ border: "none",
1123
+ background: f === y.key ? "var(--color-primary-bg, #e6f4ff)" : "transparent",
1124
+ color: f === y.key ? "var(--color-primary, #2F70F1)" : "var(--text-primary, #333)",
1125
+ fontWeight: f === y.key ? 600 : 400,
1126
+ cursor: "pointer",
1127
+ fontSize: 14,
1128
+ textAlign: "left",
1129
+ borderLeft: f === y.key ? "3px solid var(--color-primary, #2F70F1)" : "3px solid transparent"
1130
+ },
1131
+ children: [
1132
+ y.icon,
1133
+ /* @__PURE__ */ e("span", { children: y.label })
1134
+ ]
1135
+ },
1136
+ y.key
1137
+ )) }) }),
1138
+ /* @__PURE__ */ e("main", { className: U.main, children: /* @__PURE__ */ e(tt, {}) })
1139
+ ] });
1140
+ }
1141
+ export {
1142
+ ot as default
1143
+ };