@yuku123/z-team-component 0.2.28 → 0.2.29

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.
@@ -0,0 +1,1743 @@
1
+ import { jsx as e, jsxs as i, Fragment as pe } from "react/jsx-runtime";
2
+ import { ThunderboltOutlined as se, UpOutlined as Ie, DownOutlined as Se, LinkOutlined as $e, CopyOutlined as Te, EditOutlined as we, DeleteOutlined as ge, BranchesOutlined as Ae, HistoryOutlined as Ee, ReloadOutlined as xe, PlusOutlined as j, FileImageOutlined as De } from "@ant-design/icons";
3
+ import { useState as b, useEffect as F, useCallback as re, useMemo as ne, useRef as fe } from "react";
4
+ import _e from "axios";
5
+ import { Empty as le, Modal as X, Select as q, Input as ee, Form as D, Col as Z, Row as be, Space as oe, Dropdown as ke, Popconfirm as ye, Tag as H, Descriptions as Re, Card as Le, Table as He, Tree as Oe, Button as O, Tooltip as Be, Spin as Ue } from "antd";
6
+ const Me = {
7
+ PageHeader: ({ title: a, subtitle: c }) => /* @__PURE__ */ i("div", { style: { marginBottom: 12 }, children: [
8
+ /* @__PURE__ */ e("h2", { style: { margin: 0 }, children: a }),
9
+ c && /* @__PURE__ */ e("p", { style: { color: "#666", margin: "4px 0 0", fontSize: 13 }, children: c })
10
+ ] }),
11
+ TenantDomainSelector: ({
12
+ tenants: a = [],
13
+ domains: c = [],
14
+ selectedTenant: n,
15
+ selectedDomain: h,
16
+ onTenantChange: p,
17
+ onDomainChange: d
18
+ }) => /* @__PURE__ */ i(oe, { style: { marginBottom: 12 }, children: [
19
+ /* @__PURE__ */ e("span", { style: { color: "#666" }, children: "租户" }),
20
+ /* @__PURE__ */ e(
21
+ q,
22
+ {
23
+ value: n,
24
+ onChange: p,
25
+ style: { minWidth: 160 },
26
+ options: a,
27
+ placeholder: "请选择租户"
28
+ }
29
+ ),
30
+ /* @__PURE__ */ e("span", { style: { color: "#666" }, children: "域" }),
31
+ /* @__PURE__ */ e(
32
+ q,
33
+ {
34
+ value: h,
35
+ onChange: d,
36
+ disabled: !n,
37
+ style: { minWidth: 160 },
38
+ options: c,
39
+ placeholder: "请选择域"
40
+ }
41
+ )
42
+ ] }),
43
+ Button: (a) => /* @__PURE__ */ e(O, { ...a }),
44
+ Tree: (a) => /* @__PURE__ */ e(Oe, { ...a }),
45
+ Table: (a) => /* @__PURE__ */ e(He, { ...a }),
46
+ Card: (a) => /* @__PURE__ */ e(Le, { ...a }),
47
+ Descriptions: ({ items: a = [], ...c }) => /* @__PURE__ */ e(Re, { ...c, bordered: !0, size: "small", items: a }),
48
+ Tag: (a) => /* @__PURE__ */ e(H, { ...a }),
49
+ Popconfirm: (a) => /* @__PURE__ */ e(ye, { ...a }),
50
+ Dropdown: (a) => /* @__PURE__ */ e(ke, { ...a }),
51
+ Empty: (a) => /* @__PURE__ */ e(le, { ...a }),
52
+ Space: (a) => /* @__PURE__ */ e(oe, { ...a }),
53
+ Row: (a) => /* @__PURE__ */ e(be, { ...a }),
54
+ Col: (a) => /* @__PURE__ */ e(Z, { ...a }),
55
+ FormItem: ({ label: a, children: c, ...n }) => /* @__PURE__ */ e(D.Item, { label: a, ...n, children: c }),
56
+ Input: (a) => /* @__PURE__ */ e(ee, { ...a }),
57
+ InputTextArea: (a) => /* @__PURE__ */ e(ee.TextArea, { ...a }),
58
+ Select: (a) => /* @__PURE__ */ e(q, { ...a }),
59
+ Modal: (a) => /* @__PURE__ */ e(X, { ...a })
60
+ };
61
+ function ze({ node: a, highlightId: c, onElementClick: n }) {
62
+ var d;
63
+ const h = Me[a.type] || (() => null), p = c === a.id;
64
+ return /* @__PURE__ */ e(
65
+ "div",
66
+ {
67
+ "data-node-id": a.id,
68
+ "data-node-type": a.type,
69
+ className: `manuscript-node ${p ? "manuscript-node-highlight" : ""}`,
70
+ onClick: (l) => {
71
+ l.stopPropagation(), n == null || n(a);
72
+ },
73
+ children: /* @__PURE__ */ e(h, { ...a.props || {}, children: (d = a.children) == null ? void 0 : d.map((l) => /* @__PURE__ */ e(
74
+ ze,
75
+ {
76
+ node: l,
77
+ highlightId: c,
78
+ onElementClick: n
79
+ },
80
+ l.id
81
+ )) })
82
+ }
83
+ );
84
+ }
85
+ function qe({ tree: a, highlightId: c, onElementClick: n }) {
86
+ return !a || a.length === 0 ? /* @__PURE__ */ e(le, { description: "暂无设计稿内容" }) : /* @__PURE__ */ e("div", { className: "manuscript-renderer", children: a.map((h) => /* @__PURE__ */ e(
87
+ ze,
88
+ {
89
+ node: h,
90
+ highlightId: c,
91
+ onElementClick: n
92
+ },
93
+ h.id
94
+ )) });
95
+ }
96
+ const Fe = {
97
+ P0: "red",
98
+ P1: "orange",
99
+ P2: "blue"
100
+ };
101
+ function je({
102
+ caseData: a,
103
+ isHighlighted: c,
104
+ chainData: n,
105
+ onEdit: h,
106
+ onDelete: p,
107
+ onClick: d,
108
+ onEffectClick: l
109
+ }) {
110
+ const [_, r] = b(!1), f = n != null && n.triggerInfo ? Ne(n.triggerInfo, {}) : null, N = n != null && n.crossPageEffects ? Ne(n.crossPageEffects, []) : [];
111
+ return /* @__PURE__ */ i(
112
+ "div",
113
+ {
114
+ className: `manuscript-case-card ${c ? "highlight" : ""}`,
115
+ onClick: () => d == null ? void 0 : d(a),
116
+ children: [
117
+ /* @__PURE__ */ i("div", { className: "case-card-header", onClick: (v) => {
118
+ v.stopPropagation(), r(!_);
119
+ }, children: [
120
+ /* @__PURE__ */ i(oe, { children: [
121
+ /* @__PURE__ */ e("span", { className: "case-id", children: a.caseId }),
122
+ /* @__PURE__ */ e("span", { className: "case-title", children: a.title }),
123
+ /* @__PURE__ */ e(H, { color: Fe[a.priority] || "default", children: a.priority || "P1" }),
124
+ a.bizCode && /* @__PURE__ */ e(Be, { title: `因果链路: ${a.bizCode}`, children: /* @__PURE__ */ e(se, { style: { color: "#fa8c16" } }) })
125
+ ] }),
126
+ /* @__PURE__ */ e(
127
+ O,
128
+ {
129
+ type: "text",
130
+ size: "small",
131
+ icon: _ ? /* @__PURE__ */ e(Ie, {}) : /* @__PURE__ */ e(Se, {}),
132
+ onClick: (v) => {
133
+ v.stopPropagation(), r(!_);
134
+ }
135
+ }
136
+ )
137
+ ] }),
138
+ _ && /* @__PURE__ */ i("div", { className: "case-card-body", children: [
139
+ a.bizCode && /* @__PURE__ */ i("div", { className: "case-section", children: [
140
+ /* @__PURE__ */ i("div", { className: "case-section-title", children: [
141
+ /* @__PURE__ */ e(se, { style: { color: "#fa8c16" } }),
142
+ " 因果链路"
143
+ ] }),
144
+ /* @__PURE__ */ i("div", { className: "causal-chain", children: [
145
+ f && /* @__PURE__ */ i("div", { className: "chain-trigger", children: [
146
+ /* @__PURE__ */ e(H, { color: "orange", children: f.page }),
147
+ /* @__PURE__ */ i("span", { className: "chain-action", children: [
148
+ "→ ",
149
+ f.action
150
+ ] })
151
+ ] }),
152
+ /* @__PURE__ */ e("div", { className: "chain-effects", children: N.map((v, P) => /* @__PURE__ */ i(
153
+ "div",
154
+ {
155
+ className: "chain-effect-row",
156
+ onClick: ($) => {
157
+ $.stopPropagation(), l == null || l(v);
158
+ },
159
+ children: [
160
+ /* @__PURE__ */ e("span", { className: "chain-arrow", children: "→" }),
161
+ /* @__PURE__ */ e(H, { color: "blue", children: v.page }),
162
+ /* @__PURE__ */ i("span", { className: "chain-eff-type", children: [
163
+ "[",
164
+ v.effectType,
165
+ "]"
166
+ ] }),
167
+ /* @__PURE__ */ e("span", { className: "chain-eff-desc", children: v.description }),
168
+ /* @__PURE__ */ e(H, { style: { marginLeft: 8 }, children: v.delay })
169
+ ]
170
+ },
171
+ P
172
+ )) })
173
+ ] })
174
+ ] }),
175
+ a.learningPath && a.learningPath.length > 0 && /* @__PURE__ */ i("div", { className: "case-section", children: [
176
+ /* @__PURE__ */ e("div", { className: "case-section-title", children: "📋 学习路径" }),
177
+ /* @__PURE__ */ e("ol", { className: "case-learning-path", children: a.learningPath.map((v, P) => /* @__PURE__ */ e("li", { children: v }, P)) })
178
+ ] }),
179
+ a.scene && /* @__PURE__ */ i("div", { className: "case-section", children: [
180
+ /* @__PURE__ */ e("div", { className: "case-section-title", children: "📍 起点场景" }),
181
+ /* @__PURE__ */ e("div", { className: "case-scene", children: a.scene })
182
+ ] }),
183
+ /* @__PURE__ */ i("div", { className: "case-section", children: [
184
+ /* @__PURE__ */ e("div", { className: "case-section-title", children: "🔗 设计稿关联" }),
185
+ a.hotspotSelector ? /* @__PURE__ */ e(H, { color: "cyan", icon: /* @__PURE__ */ e($e, {}), children: a.hotspotSelector }) : /* @__PURE__ */ e("span", { style: { color: "#999" }, children: "未关联" })
186
+ ] }),
187
+ /* @__PURE__ */ i("div", { className: "case-card-actions", onClick: (v) => v.stopPropagation(), children: [
188
+ /* @__PURE__ */ e(
189
+ O,
190
+ {
191
+ size: "small",
192
+ icon: /* @__PURE__ */ e(Te, {}),
193
+ onClick: () => h == null ? void 0 : h({ ...a, _action: "duplicate" }),
194
+ children: "复制"
195
+ }
196
+ ),
197
+ /* @__PURE__ */ e(
198
+ O,
199
+ {
200
+ size: "small",
201
+ icon: /* @__PURE__ */ e(we, {}),
202
+ onClick: () => h == null ? void 0 : h(a),
203
+ children: "编辑"
204
+ }
205
+ ),
206
+ /* @__PURE__ */ e(ye, { title: "确认删除此 case?", onConfirm: () => p == null ? void 0 : p(a), children: /* @__PURE__ */ e(O, { size: "small", danger: !0, icon: /* @__PURE__ */ e(ge, {}), children: "删除" }) })
207
+ ] })
208
+ ] })
209
+ ]
210
+ }
211
+ );
212
+ }
213
+ function Ne(a, c) {
214
+ if (!a) return c;
215
+ try {
216
+ return JSON.parse(a);
217
+ } catch {
218
+ return c;
219
+ }
220
+ }
221
+ function Ge({
222
+ open: a,
223
+ initialCase: c,
224
+ bizOptions: n = [],
225
+ designNodes: h = [],
226
+ onCancel: p,
227
+ onSubmit: d
228
+ }) {
229
+ const [l] = D.useForm();
230
+ F(() => {
231
+ var r;
232
+ a && (c ? l.setFieldsValue({
233
+ ...c,
234
+ learningPathText: (r = c.learningPath) == null ? void 0 : r.join(`
235
+ `)
236
+ }) : l.resetFields());
237
+ }, [a, c, l]);
238
+ const _ = async () => {
239
+ var r;
240
+ try {
241
+ const f = await l.validateFields(), N = {
242
+ ...f,
243
+ learningPath: ((r = f.learningPathText) == null ? void 0 : r.split(`
244
+ `).filter((v) => v.trim())) || []
245
+ };
246
+ delete N.learningPathText, d(N);
247
+ } catch {
248
+ }
249
+ };
250
+ return /* @__PURE__ */ e(
251
+ X,
252
+ {
253
+ open: a,
254
+ title: c ? `编辑 case: ${c.caseId}` : "新增 case",
255
+ onCancel: p,
256
+ onOk: _,
257
+ okText: "保存 (commit)",
258
+ destroyOnHidden: !0,
259
+ children: /* @__PURE__ */ i(D, { form: l, layout: "vertical", children: [
260
+ /* @__PURE__ */ i(be, { gutter: 16, children: [
261
+ /* @__PURE__ */ e(Z, { span: 12, children: /* @__PURE__ */ e(
262
+ D.Item,
263
+ {
264
+ name: "caseId",
265
+ label: "Case 编码",
266
+ rules: [{ required: !0, pattern: /^case\.\d+$/, message: "格式: case.NNN" }],
267
+ children: /* @__PURE__ */ e(ee, { placeholder: "case.001", disabled: !!c && !c._action })
268
+ }
269
+ ) }),
270
+ /* @__PURE__ */ e(Z, { span: 12, children: /* @__PURE__ */ e(D.Item, { name: "title", label: "标题", rules: [{ required: !0 }], children: /* @__PURE__ */ e(ee, { placeholder: "新增组织 A" }) }) })
271
+ ] }),
272
+ /* @__PURE__ */ e(
273
+ D.Item,
274
+ {
275
+ name: "bizCode",
276
+ label: "因果链路 (引用 z_biz_understanding.bizCode)",
277
+ extra: "选择这条 case 引用的跨页面因果链路",
278
+ children: /* @__PURE__ */ e(
279
+ q,
280
+ {
281
+ placeholder: "选择因果链路 (可选)",
282
+ allowClear: !0,
283
+ showSearch: !0,
284
+ optionFilterProp: "label",
285
+ options: n
286
+ }
287
+ )
288
+ }
289
+ ),
290
+ /* @__PURE__ */ e(D.Item, { name: "scene", label: "起点场景", children: /* @__PURE__ */ e(ee.TextArea, { rows: 2, placeholder: "管理员进入 4A 中心 → 组织管理 → ..." }) }),
291
+ /* @__PURE__ */ e(D.Item, { name: "learningPathText", label: "学习路径 (每行一步)", children: /* @__PURE__ */ e(
292
+ ee.TextArea,
293
+ {
294
+ rows: 5,
295
+ placeholder: `1. 进入组织管理页
296
+ 2. 选择目标域
297
+ 3. 点击 [+ 新增组织]
298
+ 4. 提交表单
299
+ 5. 观察 5 个页面联动`
300
+ }
301
+ ) }),
302
+ /* @__PURE__ */ i(be, { gutter: 16, children: [
303
+ /* @__PURE__ */ e(Z, { span: 8, children: /* @__PURE__ */ e(D.Item, { name: "priority", label: "优先级", initialValue: "P1", children: /* @__PURE__ */ e(q, { options: [
304
+ { value: "P0", label: "P0 紧急" },
305
+ { value: "P1", label: "P1 重要" },
306
+ { value: "P2", label: "P2 一般" }
307
+ ] }) }) }),
308
+ /* @__PURE__ */ e(Z, { span: 8, children: /* @__PURE__ */ e(D.Item, { name: "status", label: "状态", initialValue: "OPEN", children: /* @__PURE__ */ e(q, { options: [
309
+ { value: "OPEN", label: "OPEN" },
310
+ { value: "IN_PROGRESS", label: "IN_PROGRESS" },
311
+ { value: "DONE", label: "DONE" },
312
+ { value: "ARCHIVED", label: "ARCHIVED" }
313
+ ] }) }) }),
314
+ /* @__PURE__ */ e(Z, { span: 8, children: /* @__PURE__ */ e(D.Item, { name: "hotspotSelector", label: "关联设计稿元素", children: /* @__PURE__ */ e(
315
+ q,
316
+ {
317
+ allowClear: !0,
318
+ placeholder: "选择 design node",
319
+ showSearch: !0,
320
+ optionFilterProp: "label",
321
+ options: h.map((r) => ({
322
+ value: r.id,
323
+ label: `${r.type} #${r.id}`
324
+ }))
325
+ }
326
+ ) }) })
327
+ ] })
328
+ ] })
329
+ }
330
+ );
331
+ }
332
+ const k = _e.create({ baseURL: "/api", timeout: 15e3 });
333
+ k.interceptors.response.use(
334
+ (a) => a.data,
335
+ (a) => (console.error("[ManuscriptView]", a), Promise.reject(a))
336
+ );
337
+ function Ve({ productCode: a, pageCode: c }) {
338
+ const [n, h] = b(null), [p, d] = b(null), [l, _] = b([]), [r, f] = b([]), [N, v] = b([]), [P, $] = b("main"), [K, w] = b(null), [G, A] = b(null), [R, E] = b(!1), [S, T] = b(null), [x, V] = b(!1), [te, B] = b(!1), [U, Y] = b(""), [u, o] = b(!1), s = re(async () => {
339
+ o(!0);
340
+ try {
341
+ const [m, g, z, I, ue] = await Promise.all([
342
+ k.get("/product/manuscript/product", { params: { productCode: a, pageCode: c } }),
343
+ k.get("/product/manuscript/design", { params: { productCode: a, pageCode: c } }),
344
+ k.get("/product/biz-understanding/list", { params: { productCode: a } }),
345
+ k.get("/product/manuscript/history", {
346
+ params: {
347
+ productCode: a,
348
+ pageCode: c,
349
+ branch: P,
350
+ limit: 20
351
+ }
352
+ }),
353
+ k.get("/product/manuscript/branches", { params: { productCode: a, pageCode: c } })
354
+ ]);
355
+ h(m == null ? void 0 : m.data), d(g == null ? void 0 : g.data), _((z == null ? void 0 : z.data) || []), f((I == null ? void 0 : I.data) || []), v((ue == null ? void 0 : ue.data) || []);
356
+ } catch (m) {
357
+ console.error("loadAll 失败:", m);
358
+ } finally {
359
+ o(!1);
360
+ }
361
+ }, [a, c, P]);
362
+ F(() => {
363
+ s();
364
+ }, [s]);
365
+ const y = ne(() => {
366
+ if (!(n != null && n.cases)) return [];
367
+ try {
368
+ return JSON.parse(n.cases);
369
+ } catch {
370
+ return [];
371
+ }
372
+ }, [n]), J = ne(() => {
373
+ if (!(p != null && p.renderTree)) return [];
374
+ try {
375
+ return JSON.parse(p.renderTree);
376
+ } catch {
377
+ return [];
378
+ }
379
+ }, [p]), L = ne(() => {
380
+ const m = [];
381
+ function g(z) {
382
+ for (const I of z || [])
383
+ I.id && m.push({ id: I.id, type: I.type }), I.children && g(I.children);
384
+ }
385
+ return g(J), m;
386
+ }, [J]), Q = ne(() => {
387
+ const m = {};
388
+ for (const g of l) m[g.bizCode] = g;
389
+ return m;
390
+ }, [l]), ae = ne(
391
+ () => l.map((m) => ({ value: m.bizCode, label: `${m.bizCode} — ${m.title}` })),
392
+ [l]
393
+ ), de = (m) => {
394
+ w(m.caseId), A(m.hotspotSelector || null), setTimeout(() => {
395
+ w(null), A(null);
396
+ }, 3e3);
397
+ }, ce = (m) => {
398
+ if (!m.id) return;
399
+ A(m.id);
400
+ const g = y.find((z) => z.hotspotSelector === m.id);
401
+ g && w(g.caseId), setTimeout(() => {
402
+ w(null), A(null);
403
+ }, 3e3);
404
+ }, me = (m) => {
405
+ const g = y.find((z) => z.bizCode);
406
+ g && (w(g.caseId), setTimeout(() => w(null), 3e3));
407
+ }, M = async (m) => {
408
+ const g = (S == null ? void 0 : S._action) === "duplicate" || !S, z = (S == null ? void 0 : S._action) === "duplicate";
409
+ try {
410
+ if (g || z) {
411
+ const I = z ? { ...m, caseId: he(), title: m.title + " (副本)" } : m;
412
+ await k.post("/product/manuscript/case", {
413
+ productCode: a,
414
+ pageCode: c,
415
+ author: "admin",
416
+ caseData: I
417
+ });
418
+ } else
419
+ await k.put("/product/manuscript/case", {
420
+ productCode: a,
421
+ pageCode: c,
422
+ author: "admin",
423
+ originalCaseId: S.caseId,
424
+ caseData: m
425
+ });
426
+ E(!1), T(null), await s();
427
+ } catch (I) {
428
+ X.error({ title: "保存失败", content: I == null ? void 0 : I.message });
429
+ }
430
+ }, ie = async (m) => {
431
+ try {
432
+ await k.delete("/product/manuscript/case", {
433
+ params: { productCode: a, pageCode: c, caseId: m.caseId, author: "admin" }
434
+ }), await s();
435
+ } catch (g) {
436
+ X.error({ title: "删除失败", content: g == null ? void 0 : g.message });
437
+ }
438
+ }, he = () => {
439
+ const m = y.map((z) => parseInt((z.caseId || "case.0").split(".")[1] || "0")).filter((z) => !isNaN(z)), g = m.length > 0 ? Math.max(...m) : 0;
440
+ return `case.${String(g + 1).padStart(3, "0")}`;
441
+ }, Ce = async (m) => {
442
+ $(m);
443
+ }, Pe = async () => {
444
+ var m;
445
+ if (U.trim())
446
+ try {
447
+ const g = (m = N.find((z) => z.branch === P)) == null ? void 0 : m.headSha;
448
+ await k.post("/product/manuscript/branch", {
449
+ productCode: a,
450
+ pageCode: c,
451
+ branch: U,
452
+ fromSha: g
453
+ }), B(!1), Y(""), await s(), $(U);
454
+ } catch (g) {
455
+ X.error({ title: "创建分支失败", content: g == null ? void 0 : g.message });
456
+ }
457
+ };
458
+ return u && !n && !p ? /* @__PURE__ */ i("div", { style: { textAlign: "center", padding: 40 }, children: [
459
+ /* @__PURE__ */ e(Ue, {}),
460
+ " 加载中..."
461
+ ] }) : /* @__PURE__ */ i("div", { className: "manuscript-view", children: [
462
+ /* @__PURE__ */ e("div", { className: "manuscript-toolbar", children: /* @__PURE__ */ i(oe, { children: [
463
+ /* @__PURE__ */ e(Ae, {}),
464
+ /* @__PURE__ */ e("span", { children: "分支:" }),
465
+ /* @__PURE__ */ e(
466
+ q,
467
+ {
468
+ value: P,
469
+ onChange: Ce,
470
+ style: { minWidth: 120 },
471
+ options: N.map((m) => ({ value: m.branch, label: m.branch }))
472
+ }
473
+ ),
474
+ /* @__PURE__ */ e(O, { size: "small", onClick: () => B(!0), children: "新分支" }),
475
+ /* @__PURE__ */ i(
476
+ O,
477
+ {
478
+ size: "small",
479
+ icon: /* @__PURE__ */ e(Ee, {}),
480
+ onClick: () => V(!0),
481
+ children: [
482
+ "历史 (",
483
+ r.length,
484
+ ")"
485
+ ]
486
+ }
487
+ ),
488
+ /* @__PURE__ */ e(O, { size: "small", icon: /* @__PURE__ */ e(xe, {}), onClick: s, children: "刷新" })
489
+ ] }) }),
490
+ /* @__PURE__ */ i("div", { className: "manuscript-layout", children: [
491
+ /* @__PURE__ */ i("div", { className: "manuscript-left", children: [
492
+ /* @__PURE__ */ i("div", { className: "case-list-header", children: [
493
+ /* @__PURE__ */ i("h3", { children: [
494
+ "📋 产品稿件 / ",
495
+ y.length,
496
+ " 条 case",
497
+ (n == null ? void 0 : n.title) && /* @__PURE__ */ e("small", { style: { marginLeft: 8, color: "#888" }, children: n.title })
498
+ ] }),
499
+ /* @__PURE__ */ e(
500
+ O,
501
+ {
502
+ type: "primary",
503
+ icon: /* @__PURE__ */ e(j, {}),
504
+ onClick: () => {
505
+ T(null), E(!0);
506
+ },
507
+ children: "新增 case"
508
+ }
509
+ )
510
+ ] }),
511
+ /* @__PURE__ */ e("div", { className: "case-list", children: y.length === 0 ? /* @__PURE__ */ e(le, { description: "暂无 case, 点击 [新增 case] 开始" }) : y.map((m) => /* @__PURE__ */ e(
512
+ je,
513
+ {
514
+ caseData: m,
515
+ isHighlighted: K === m.caseId,
516
+ chainData: m.bizCode ? Q[m.bizCode] : null,
517
+ onEdit: (g) => {
518
+ T(g), E(!0);
519
+ },
520
+ onDelete: ie,
521
+ onClick: de,
522
+ onEffectClick: me
523
+ },
524
+ m.caseId
525
+ )) })
526
+ ] }),
527
+ /* @__PURE__ */ i("div", { className: "manuscript-right", children: [
528
+ /* @__PURE__ */ i("div", { className: "design-header", children: [
529
+ /* @__PURE__ */ i("h3", { children: [
530
+ "🎨 设计稿件",
531
+ (p == null ? void 0 : p.title) && /* @__PURE__ */ e("small", { style: { marginLeft: 8, color: "#888" }, children: p.title })
532
+ ] }),
533
+ /* @__PURE__ */ i("span", { style: { color: "#888", fontSize: 12 }, children: [
534
+ L.length,
535
+ " 个节点"
536
+ ] })
537
+ ] }),
538
+ /* @__PURE__ */ e("div", { className: "design-canvas", children: /* @__PURE__ */ e(
539
+ qe,
540
+ {
541
+ tree: J,
542
+ highlightId: G,
543
+ onElementClick: ce
544
+ }
545
+ ) })
546
+ ] })
547
+ ] }),
548
+ /* @__PURE__ */ e(
549
+ Ge,
550
+ {
551
+ open: R,
552
+ initialCase: S,
553
+ bizOptions: ae,
554
+ designNodes: L,
555
+ onCancel: () => {
556
+ E(!1), T(null);
557
+ },
558
+ onSubmit: M
559
+ }
560
+ ),
561
+ /* @__PURE__ */ e(
562
+ X,
563
+ {
564
+ open: x,
565
+ title: `commit 历史 (${P} 分支)`,
566
+ onCancel: () => V(!1),
567
+ footer: null,
568
+ children: /* @__PURE__ */ e("div", { className: "commit-history", children: r.length === 0 ? /* @__PURE__ */ e(le, { description: "暂无 commit 记录" }) : r.map((m) => /* @__PURE__ */ i("div", { className: "commit-row", children: [
569
+ /* @__PURE__ */ e("div", { className: "commit-sha", children: /* @__PURE__ */ e(H, { color: "purple", children: m.sha.substring(0, 8) }) }),
570
+ /* @__PURE__ */ i("div", { className: "commit-msg", children: [
571
+ /* @__PURE__ */ i("div", { children: [
572
+ /* @__PURE__ */ e(H, { color: m.operation === "CREATE" ? "green" : m.operation === "UPDATE" ? "blue" : m.operation === "DELETE" ? "red" : m.operation === "BIND" ? "cyan" : "default", children: m.operation }),
573
+ /* @__PURE__ */ e(H, { children: m.targetType }),
574
+ /* @__PURE__ */ e("code", { children: m.targetId })
575
+ ] }),
576
+ /* @__PURE__ */ e("div", { style: { color: "#888", fontSize: 12, marginTop: 4 }, children: m.commitMessage })
577
+ ] }),
578
+ /* @__PURE__ */ i("div", { className: "commit-meta", style: { color: "#888", fontSize: 11 }, children: [
579
+ /* @__PURE__ */ e("div", { children: m.author }),
580
+ /* @__PURE__ */ e("div", { children: m.createdAt })
581
+ ] })
582
+ ] }, m.sha)) })
583
+ }
584
+ ),
585
+ /* @__PURE__ */ e(
586
+ X,
587
+ {
588
+ open: te,
589
+ title: "新建分支",
590
+ onCancel: () => B(!1),
591
+ onOk: Pe,
592
+ okText: "创建",
593
+ children: /* @__PURE__ */ i("div", { style: { padding: "12px 0" }, children: [
594
+ /* @__PURE__ */ e("span", { style: { marginRight: 8 }, children: "分支名:" }),
595
+ /* @__PURE__ */ e(
596
+ "input",
597
+ {
598
+ value: U,
599
+ onChange: (m) => Y(m.target.value),
600
+ placeholder: "feature-xxx",
601
+ style: { padding: "4px 8px", border: "1px solid #d9d9d9", borderRadius: 4, width: 200 }
602
+ }
603
+ ),
604
+ /* @__PURE__ */ i("div", { style: { marginTop: 8, color: "#888", fontSize: 12 }, children: [
605
+ "从当前分支 (",
606
+ /* @__PURE__ */ e("code", { children: P }),
607
+ ") 的 HEAD fork"
608
+ ] })
609
+ ] })
610
+ }
611
+ )
612
+ ] });
613
+ }
614
+ const Je = "_container_1c2b1_6", We = "_sidebar_1c2b1_15", Xe = "_sidebarHeader_1c2b1_25", Ke = "_productList_1c2b1_37", Ye = "_productItem_1c2b1_43", Qe = "_productItemActive_1c2b1_57", Ze = "_productItemName_1c2b1_62", et = "_productItemCode_1c2b1_68", tt = "_productItemStatus_1c2b1_73", at = "_emptyHint_1c2b1_84", it = "_main_1c2b1_92", nt = "_productHeader_1c2b1_100", st = "_productTitle_1c2b1_109", ct = "_productCode_1c2b1_115", rt = "_tabBar_1c2b1_122", lt = "_tab_1c2b1_122", ot = "_tabActive_1c2b1_142", dt = "_tabContent_1c2b1_148", mt = "_formGroup_1c2b1_155", ht = "_formLabel_1c2b1_163", ut = "_formInput_1c2b1_171", bt = "_formTextarea_1c2b1_172", pt = "_designGrid_1c2b1_189", gt = "_designCard_1c2b1_195", _t = "_designImage_1c2b1_202", ft = "_designInfo_1c2b1_209", Nt = "_designName_1c2b1_213", vt = "_designDesc_1c2b1_220", yt = "_designActions_1c2b1_225", zt = "_designLink_1c2b1_233", Ct = "_table_1c2b1_244", Pt = "_empty_1c2b1_84", It = "_btn_1c2b1_284", St = "_btnPrimary_1c2b1_300", $t = "_btnDanger_1c2b1_311", Tt = "_toolbar_1c2b1_321", wt = "_priority_1c2b1_329", At = "_priorityP0_1c2b1_337", Et = "_priorityP1_1c2b1_342", xt = "_priorityP2_1c2b1_347", Dt = "_priorityP3_1c2b1_352", kt = "_status_1c2b1_357", Rt = "_statusActive_1c2b1_367", Lt = "_statusDone_1c2b1_372", Ht = "_featureNo_1c2b1_377", Ot = "_spinner_1c2b1_386", Bt = "_modal_1c2b1_394", Ut = "_modalBody_1c2b1_404", Mt = "_modalTitle_1c2b1_413", qt = "_modalActions_1c2b1_420", Ft = "_bizLayout_1c2b1_430", jt = "_bizList_1c2b1_437", Gt = "_bizFilter_1c2b1_448", Vt = "_bizFilterHint_1c2b1_454", Jt = "_bizListHeader_1c2b1_459", Wt = "_bizItem_1c2b1_467", Xt = "_bizItemActive_1c2b1_481", Kt = "_bizItemHeader_1c2b1_487", Yt = "_bizItemTitle_1c2b1_494", Qt = "_bizItemStatus_1c2b1_504", Zt = "_bizItemSummary_1c2b1_512", ea = "_bizItemMeta_1c2b1_522", ta = "_bizItemDot_1c2b1_527", aa = "_bizDetail_1c2b1_531", ia = "_bizDetailHeader_1c2b1_537", na = "_bizDetailTitle_1c2b1_543", sa = "_bizDetailCode_1c2b1_550", ca = "_bizSection_1c2b1_556", ra = "_bizSectionTitle_1c2b1_560", la = "_bizTriggerCard_1c2b1_570", oa = "_bizEffects_1c2b1_580", da = "_bizEffectCard_1c2b1_586", ma = "_bizEffectPage_1c2b1_595", ha = "_bizEffectArrow_1c2b1_602", ua = "_bizEffectPageCode_1c2b1_608", ba = "_bizEffectDelay_1c2b1_618", pa = "_bizEffectType_1c2b1_626", ga = "_bizEffectDesc_1c2b1_633", _a = "_bizStory_1c2b1_638", fa = "_chatLayout_1c2b1_657", Na = "_chatHeader_1c2b1_666", va = "_chatSessionSelect_1c2b1_673", ya = "_chatHint_1c2b1_683", za = "_chatBody_1c2b1_689", Ca = "_chatEmpty_1c2b1_699", Pa = "_msgRow_1c2b1_707", Ia = "_msgRowUser_1c2b1_714", Sa = "_bubble_1c2b1_718", $a = "_bubbleUser_1c2b1_728", Ta = "_bubbleAssistant_1c2b1_734", wa = "_streamingCursor_1c2b1_741", Aa = "_proposalCard_1c2b1_752", Ea = "_proposalHead_1c2b1_764", xa = "_proposalBadge_1c2b1_771", Da = "_proposalType_1c2b1_779", ka = "_proposalActions_1c2b1_785", Ra = "_proposalAccepted_1c2b1_791", La = "_proposalRejected_1c2b1_797", Ha = "_proposalPreview_1c2b1_803", Oa = "_chatError_1c2b1_813", Ba = "_chatInputRow_1c2b1_822", Ua = "_chatTextarea_1c2b1_828", t = {
615
+ container: Je,
616
+ sidebar: We,
617
+ sidebarHeader: Xe,
618
+ productList: Ke,
619
+ productItem: Ye,
620
+ productItemActive: Qe,
621
+ productItemName: Ze,
622
+ productItemCode: et,
623
+ productItemStatus: tt,
624
+ emptyHint: at,
625
+ main: it,
626
+ productHeader: nt,
627
+ productTitle: st,
628
+ productCode: ct,
629
+ tabBar: rt,
630
+ tab: lt,
631
+ tabActive: ot,
632
+ tabContent: dt,
633
+ formGroup: mt,
634
+ formLabel: ht,
635
+ formInput: ut,
636
+ formTextarea: bt,
637
+ designGrid: pt,
638
+ designCard: gt,
639
+ designImage: _t,
640
+ designInfo: ft,
641
+ designName: Nt,
642
+ designDesc: vt,
643
+ designActions: yt,
644
+ designLink: zt,
645
+ table: Ct,
646
+ empty: Pt,
647
+ btn: It,
648
+ btnPrimary: St,
649
+ btnDanger: $t,
650
+ toolbar: Tt,
651
+ priority: wt,
652
+ priorityP0: At,
653
+ priorityP1: Et,
654
+ priorityP2: xt,
655
+ priorityP3: Dt,
656
+ status: kt,
657
+ statusActive: Rt,
658
+ statusDone: Lt,
659
+ featureNo: Ht,
660
+ spinner: Ot,
661
+ modal: Bt,
662
+ modalBody: Ut,
663
+ modalTitle: Mt,
664
+ modalActions: qt,
665
+ bizLayout: Ft,
666
+ bizList: jt,
667
+ bizFilter: Gt,
668
+ bizFilterHint: Vt,
669
+ bizListHeader: Jt,
670
+ bizItem: Wt,
671
+ bizItemActive: Xt,
672
+ bizItemHeader: Kt,
673
+ bizItemTitle: Yt,
674
+ bizItemStatus: Qt,
675
+ bizItemSummary: Zt,
676
+ bizItemMeta: ea,
677
+ bizItemDot: ta,
678
+ bizDetail: aa,
679
+ bizDetailHeader: ia,
680
+ bizDetailTitle: na,
681
+ bizDetailCode: sa,
682
+ bizSection: ca,
683
+ bizSectionTitle: ra,
684
+ bizTriggerCard: la,
685
+ bizEffects: oa,
686
+ bizEffectCard: da,
687
+ bizEffectPage: ma,
688
+ bizEffectArrow: ha,
689
+ bizEffectPageCode: ua,
690
+ bizEffectDelay: ba,
691
+ bizEffectType: pa,
692
+ bizEffectDesc: ga,
693
+ bizStory: _a,
694
+ chatLayout: fa,
695
+ chatHeader: Na,
696
+ chatSessionSelect: va,
697
+ chatHint: ya,
698
+ chatBody: za,
699
+ chatEmpty: Ca,
700
+ msgRow: Pa,
701
+ msgRowUser: Ia,
702
+ bubble: Sa,
703
+ bubbleUser: $a,
704
+ bubbleAssistant: Ta,
705
+ streamingCursor: wa,
706
+ proposalCard: Aa,
707
+ proposalHead: Ea,
708
+ proposalBadge: xa,
709
+ proposalType: Da,
710
+ proposalActions: ka,
711
+ proposalAccepted: Ra,
712
+ proposalRejected: La,
713
+ proposalPreview: Ha,
714
+ chatError: Oa,
715
+ chatInputRow: Ba,
716
+ chatTextarea: Ua
717
+ }, W = _e.create({ baseURL: "/api", timeout: 3e4 });
718
+ W.interceptors.response.use(
719
+ (a) => a.data,
720
+ (a) => (console.error("[ProductChat] request failed", a), Promise.reject(a))
721
+ );
722
+ const Ma = {
723
+ name: "产品名称",
724
+ vision: "产品愿景",
725
+ target_users: "目标用户",
726
+ description: "业务描述",
727
+ requirement: "业务需求",
728
+ design: "设计稿",
729
+ biz_understanding: "业务理解稿件"
730
+ };
731
+ function ve(a) {
732
+ return a.replace(/<proposal[\s\S]*?<\/proposal>/g, "").trim();
733
+ }
734
+ function qa(a) {
735
+ try {
736
+ return JSON.parse(a);
737
+ } catch {
738
+ return {};
739
+ }
740
+ }
741
+ function Fa(a, c) {
742
+ switch (a) {
743
+ case "name":
744
+ return String(c.name || "");
745
+ case "vision":
746
+ return String(c.vision || "");
747
+ case "target_users":
748
+ return String(c.targetUsers || "");
749
+ case "description":
750
+ return String(c.description || "");
751
+ case "requirement":
752
+ return `[${c.priority || "P1"}] ${c.title || ""}`;
753
+ case "design":
754
+ return String(c.name || "");
755
+ case "biz_understanding":
756
+ return String(c.title || "");
757
+ default:
758
+ return JSON.stringify(c);
759
+ }
760
+ }
761
+ function ja({
762
+ productCode: a,
763
+ productName: c,
764
+ onArtifactChanged: n
765
+ }) {
766
+ const [h, p] = b([]), [d, l] = b(null), [_, r] = b([]), [f, N] = b([]), [v, P] = b(""), [$, K] = b(!1), [w, G] = b(""), [A, R] = b(""), E = fe(null), S = fe(null), T = re(async () => {
767
+ try {
768
+ const u = await W.get(`/product/${a}/chat/sessions`), o = (u == null ? void 0 : u.data) || [];
769
+ p(o), l(
770
+ (s) => s && o.some((y) => y.id === s) ? s : o.length > 0 ? o[0].id : null
771
+ );
772
+ } catch (u) {
773
+ console.error(u);
774
+ }
775
+ }, [a]), x = re(async (u) => {
776
+ try {
777
+ const [o, s] = await Promise.all([
778
+ W.get(`/product/${a}/chat/sessions/${u}/messages`),
779
+ W.get(`/product/${a}/chat/proposals`, {
780
+ params: { sessionId: u }
781
+ })
782
+ ]);
783
+ r((o == null ? void 0 : o.data) || []), N((s == null ? void 0 : s.data) || []);
784
+ } catch (o) {
785
+ console.error(o);
786
+ }
787
+ }, [a]);
788
+ F(() => {
789
+ l(null), r([]), N([]), T();
790
+ }, [T]), F(() => {
791
+ d != null && x(d);
792
+ }, [d, x]), F(() => {
793
+ var u;
794
+ (u = S.current) == null || u.scrollIntoView({ behavior: "smooth" });
795
+ }, [_, w]);
796
+ const V = async () => {
797
+ try {
798
+ const u = await W.post(`/product/${a}/chat/sessions`, {
799
+ title: `${c} · 产品对话`
800
+ }), o = u == null ? void 0 : u.data;
801
+ await T(), o != null && o.id && l(o.id);
802
+ } catch (u) {
803
+ console.error(u);
804
+ }
805
+ }, te = async () => {
806
+ if (d != null && confirm("确认删除该会话(连同消息与提案记录)?"))
807
+ try {
808
+ await W.delete(`/product/${a}/chat/sessions/${d}`), l(null), r([]), N([]), await T();
809
+ } catch (u) {
810
+ console.error(u);
811
+ }
812
+ }, B = async () => {
813
+ const u = v.trim();
814
+ if (!u || $ || d == null) return;
815
+ P(""), R(""), K(!0), G(""), r((s) => [
816
+ ...s,
817
+ { id: -Date.now(), sessionId: d, role: "user", content: u }
818
+ ]);
819
+ const o = new AbortController();
820
+ E.current = o;
821
+ try {
822
+ const s = await fetch(
823
+ `/api/product/${a}/chat/sessions/${d}/chat/stream`,
824
+ {
825
+ method: "POST",
826
+ headers: { "Content-Type": "application/json" },
827
+ body: JSON.stringify({ message: u }),
828
+ signal: o.signal
829
+ }
830
+ );
831
+ if (!s.ok || !s.body) {
832
+ const ae = await s.text().catch(() => "");
833
+ R(ae || `HTTP ${s.status}`);
834
+ return;
835
+ }
836
+ const y = s.body.getReader(), J = new TextDecoder();
837
+ let L = "", Q = "";
838
+ for (; ; ) {
839
+ const { done: ae, value: de } = await y.read();
840
+ if (ae) break;
841
+ L += J.decode(de, { stream: !0 });
842
+ const ce = L.split(`
843
+ `);
844
+ L = ce.pop() || "";
845
+ for (const me of ce) {
846
+ const M = me.trim();
847
+ if (!M) {
848
+ Q = "";
849
+ continue;
850
+ }
851
+ if (!M.startsWith(":")) {
852
+ if (M.startsWith("event:")) {
853
+ Q = M.slice(6).trim();
854
+ continue;
855
+ }
856
+ if (M.startsWith("data:")) {
857
+ const ie = M.slice(5).trim();
858
+ if (Q === "done") {
859
+ Q = "";
860
+ continue;
861
+ }
862
+ if (ie.startsWith("[error]")) {
863
+ R(ie.slice(7).trim());
864
+ return;
865
+ }
866
+ G((he) => he + ie);
867
+ }
868
+ }
869
+ }
870
+ }
871
+ } catch (s) {
872
+ (s == null ? void 0 : s.name) !== "AbortError" && R(String((s == null ? void 0 : s.message) || s));
873
+ } finally {
874
+ E.current = null, K(!1), G(""), d != null && await x(d);
875
+ }
876
+ }, U = async (u, o) => {
877
+ try {
878
+ const s = await W.post(
879
+ `/product/${a}/chat/proposals/${u}/${o}`,
880
+ {}
881
+ ), y = s == null ? void 0 : s.data;
882
+ y != null && y.id && N((J) => J.map((L) => L.id === y.id ? y : L)), o === "accept" && n();
883
+ } catch (s) {
884
+ console.error(s), R("裁定失败,请重试");
885
+ }
886
+ }, Y = (u) => f.filter((o) => o.messageId === u);
887
+ return /* @__PURE__ */ i("div", { className: t.chatLayout, children: [
888
+ /* @__PURE__ */ i("div", { className: t.chatHeader, children: [
889
+ /* @__PURE__ */ i(
890
+ "select",
891
+ {
892
+ className: t.chatSessionSelect,
893
+ value: d ?? "",
894
+ onChange: (u) => l(u.target.value ? Number(u.target.value) : null),
895
+ children: [
896
+ h.length === 0 && /* @__PURE__ */ e("option", { value: "", children: "(暂无会话)" }),
897
+ h.map((u) => /* @__PURE__ */ e("option", { value: u.id, children: u.title }, u.id))
898
+ ]
899
+ }
900
+ ),
901
+ /* @__PURE__ */ e("button", { className: t.btn, onClick: V, children: "新会话" }),
902
+ /* @__PURE__ */ e(
903
+ "button",
904
+ {
905
+ className: t.btn,
906
+ onClick: te,
907
+ disabled: d == null,
908
+ children: "删除会话"
909
+ }
910
+ ),
911
+ /* @__PURE__ */ e("span", { className: t.chatHint, children: "AI 已自动装载产品蓝图与现状;聊出的结论会以提案卡交你裁定后落库" })
912
+ ] }),
913
+ /* @__PURE__ */ e("div", { className: t.chatBody, children: d == null ? /* @__PURE__ */ i("div", { className: t.chatEmpty, children: [
914
+ /* @__PURE__ */ e("p", { children: "新建产品后就可以开聊了。" }),
915
+ /* @__PURE__ */ e("p", { children: "把产品想成什么聊什么:愿景、用户、需求、设计,聊清楚的会沉淀下来。" }),
916
+ /* @__PURE__ */ e("button", { className: `${t.btn} ${t.btnPrimary}`, onClick: V, children: "开聊" })
917
+ ] }) : /* @__PURE__ */ i(pe, { children: [
918
+ _.map(
919
+ (u) => u.role === "user" ? /* @__PURE__ */ e("div", { className: `${t.msgRow} ${t.msgRowUser}`, children: /* @__PURE__ */ e("div", { className: `${t.bubble} ${t.bubbleUser}`, children: u.content }) }, u.id) : /* @__PURE__ */ i("div", { className: t.msgRow, children: [
920
+ /* @__PURE__ */ e("div", { className: `${t.bubble} ${t.bubbleAssistant}`, children: ve(u.content) || "(本条为提案输出)" }),
921
+ Y(u.id).map((o) => /* @__PURE__ */ e(
922
+ Ga,
923
+ {
924
+ proposal: o,
925
+ onDecide: U
926
+ },
927
+ o.id
928
+ ))
929
+ ] }, u.id)
930
+ ),
931
+ $ && /* @__PURE__ */ e("div", { className: t.msgRow, children: /* @__PURE__ */ i("div", { className: `${t.bubble} ${t.bubbleAssistant}`, children: [
932
+ ve(w) || "…",
933
+ /* @__PURE__ */ e("span", { className: t.streamingCursor, children: "▍" })
934
+ ] }) }),
935
+ /* @__PURE__ */ e("div", { ref: S })
936
+ ] }) }),
937
+ A && /* @__PURE__ */ e("div", { className: t.chatError, children: A }),
938
+ /* @__PURE__ */ i("div", { className: t.chatInputRow, children: [
939
+ /* @__PURE__ */ e(
940
+ "textarea",
941
+ {
942
+ className: t.chatTextarea,
943
+ placeholder: d == null ? "先点「开聊」创建会话…" : "和 AI 聊这个产品…(Enter 发送,Shift+Enter 换行)",
944
+ value: v,
945
+ disabled: d == null || $,
946
+ onChange: (u) => P(u.target.value),
947
+ onKeyDown: (u) => {
948
+ u.key === "Enter" && !u.shiftKey && (u.preventDefault(), B());
949
+ }
950
+ }
951
+ ),
952
+ $ ? /* @__PURE__ */ e(
953
+ "button",
954
+ {
955
+ className: `${t.btn} ${t.btnDanger}`,
956
+ onClick: () => {
957
+ var u;
958
+ return (u = E.current) == null ? void 0 : u.abort();
959
+ },
960
+ children: "停止"
961
+ }
962
+ ) : /* @__PURE__ */ e(
963
+ "button",
964
+ {
965
+ className: `${t.btn} ${t.btnPrimary}`,
966
+ onClick: B,
967
+ disabled: !v.trim() || d == null,
968
+ children: "发送"
969
+ }
970
+ )
971
+ ] })
972
+ ] });
973
+ }
974
+ function Ga({
975
+ proposal: a,
976
+ onDecide: c
977
+ }) {
978
+ const n = qa(a.payload), h = Ma[a.proposalType] || a.proposalType, p = a.action === "CREATE";
979
+ return /* @__PURE__ */ i("div", { className: t.proposalCard, children: [
980
+ /* @__PURE__ */ i("div", { className: t.proposalHead, children: [
981
+ /* @__PURE__ */ e("span", { className: t.proposalBadge, children: p ? "新增" : "更新" }),
982
+ /* @__PURE__ */ e("span", { className: t.proposalType, children: h }),
983
+ a.status === "PENDING" && /* @__PURE__ */ i("span", { className: t.proposalActions, children: [
984
+ /* @__PURE__ */ e(
985
+ "button",
986
+ {
987
+ className: `${t.btn} ${t.btnPrimary}`,
988
+ onClick: () => c(a.id, "accept"),
989
+ children: "采纳"
990
+ }
991
+ ),
992
+ /* @__PURE__ */ e(
993
+ "button",
994
+ {
995
+ className: t.btn,
996
+ onClick: () => c(a.id, "reject"),
997
+ children: "驳回"
998
+ }
999
+ )
1000
+ ] }),
1001
+ a.status === "ACCEPTED" && /* @__PURE__ */ i("span", { className: t.proposalAccepted, children: [
1002
+ "已落库 ",
1003
+ a.appliedRef || ""
1004
+ ] }),
1005
+ a.status === "REJECTED" && /* @__PURE__ */ e("span", { className: t.proposalRejected, children: "已驳回" })
1006
+ ] }),
1007
+ /* @__PURE__ */ e("div", { className: t.proposalPreview, children: Fa(a.proposalType, n) || "(空提案)" })
1008
+ ] });
1009
+ }
1010
+ const C = _e.create({ baseURL: "/api", timeout: 15e3 });
1011
+ C.interceptors.response.use(
1012
+ (a) => a.data,
1013
+ (a) => (console.error("[ProductWorkbench] request failed", a), Promise.reject(a))
1014
+ );
1015
+ function si() {
1016
+ const [a, c] = b([]), [n, h] = b(null), [p, d] = b(!1), [l, _] = b("chat"), [r, f] = b([]), [N, v] = b([]), [P, $] = b([]), [K, w] = b([]), [G, A] = b(!1), [R, E] = b(!1), [S, T] = b(!1), x = re(async () => {
1017
+ d(!0);
1018
+ try {
1019
+ const o = await C.get("/product/list"), s = (o == null ? void 0 : o.data) || [];
1020
+ c(s), s.length > 0 && !n && h(s[0]);
1021
+ } catch (o) {
1022
+ console.error(o);
1023
+ } finally {
1024
+ d(!1);
1025
+ }
1026
+ }, [n]);
1027
+ F(() => {
1028
+ x();
1029
+ }, [x]), F(() => {
1030
+ if (!n) return;
1031
+ const o = n.productCode;
1032
+ l === "design" ? C.get(`/product/${o}/design/list`).then((s) => f((s == null ? void 0 : s.data) || [])).catch(() => f([])) : l === "requirement" ? C.get(`/product/${o}/requirement/list`).then((s) => v((s == null ? void 0 : s.data) || [])).catch(() => v([])) : l === "feature" ? C.get(`/product/${o}/feature/list`).then((s) => $((s == null ? void 0 : s.data) || [])).catch(() => $([])) : l === "biz-understanding" && C.get("/product/biz-understanding/list", { params: { productCode: o } }).then((s) => w((s == null ? void 0 : s.data) || [])).catch(() => w([]));
1033
+ }, [n, l]);
1034
+ const V = async (o) => {
1035
+ try {
1036
+ const s = await C.post("/product", o), y = s == null ? void 0 : s.data;
1037
+ await x(), h(y), A(!1);
1038
+ } catch (s) {
1039
+ console.error(s);
1040
+ }
1041
+ }, te = async (o) => {
1042
+ if (n)
1043
+ try {
1044
+ await C.put(`/product/${n.productCode}`, o), await x();
1045
+ } catch (s) {
1046
+ console.error(s);
1047
+ }
1048
+ }, B = async (o) => {
1049
+ if (n)
1050
+ try {
1051
+ await C.post(`/product/${n.productCode}/design`, o), E(!1);
1052
+ const s = await C.get(`/product/${n.productCode}/design/list`);
1053
+ f((s == null ? void 0 : s.data) || []);
1054
+ } catch (s) {
1055
+ console.error(s);
1056
+ }
1057
+ }, U = async (o) => {
1058
+ if (n)
1059
+ try {
1060
+ await C.post(`/product/${n.productCode}/requirement`, o), T(!1);
1061
+ const s = await C.get(`/product/${n.productCode}/requirement/list`);
1062
+ v((s == null ? void 0 : s.data) || []);
1063
+ } catch (s) {
1064
+ console.error(s);
1065
+ }
1066
+ }, Y = async (o) => {
1067
+ if (n && confirm("确认删除该需求?"))
1068
+ try {
1069
+ await C.delete(`/product/${n.productCode}/requirement/${o}`);
1070
+ const s = await C.get(`/product/${n.productCode}/requirement/list`);
1071
+ v((s == null ? void 0 : s.data) || []);
1072
+ } catch (s) {
1073
+ console.error(s);
1074
+ }
1075
+ }, u = async () => {
1076
+ if (n)
1077
+ try {
1078
+ await C.post(`/product/${n.productCode}/feature/decompose`);
1079
+ const o = await C.get(`/product/${n.productCode}/feature/list`);
1080
+ $((o == null ? void 0 : o.data) || []), alert("功能拆分完成");
1081
+ } catch (o) {
1082
+ console.error(o);
1083
+ }
1084
+ };
1085
+ return p ? /* @__PURE__ */ e("div", { className: t.spinner, children: "加载中..." }) : /* @__PURE__ */ i("div", { className: t.container, children: [
1086
+ /* @__PURE__ */ i("aside", { className: t.sidebar, children: [
1087
+ /* @__PURE__ */ e("div", { className: t.sidebarHeader, children: /* @__PURE__ */ i(
1088
+ "button",
1089
+ {
1090
+ className: `${t.btn} ${t.btnPrimary}`,
1091
+ onClick: () => A(!0),
1092
+ title: "新建产品",
1093
+ children: [
1094
+ /* @__PURE__ */ e(j, {}),
1095
+ " 新建"
1096
+ ]
1097
+ }
1098
+ ) }),
1099
+ /* @__PURE__ */ e("div", { className: t.productList, children: a.length === 0 ? /* @__PURE__ */ e("div", { className: t.emptyHint, children: '暂无产品,点击"新建"开始' }) : a.map((o) => /* @__PURE__ */ i(
1100
+ "div",
1101
+ {
1102
+ className: `${t.productItem} ${(n == null ? void 0 : n.productCode) === o.productCode ? t.productItemActive : ""}`,
1103
+ onClick: () => h(o),
1104
+ children: [
1105
+ /* @__PURE__ */ e("div", { className: t.productItemName, children: o.name }),
1106
+ /* @__PURE__ */ e("div", { className: t.productItemCode, children: o.productCode }),
1107
+ /* @__PURE__ */ e("span", { className: t.productItemStatus, children: o.status })
1108
+ ]
1109
+ },
1110
+ o.productCode
1111
+ )) })
1112
+ ] }),
1113
+ /* @__PURE__ */ e("main", { className: t.main, children: n ? /* @__PURE__ */ i(pe, { children: [
1114
+ /* @__PURE__ */ i("div", { className: t.productHeader, children: [
1115
+ /* @__PURE__ */ i("div", { children: [
1116
+ /* @__PURE__ */ e("span", { className: t.productTitle, children: n.name }),
1117
+ /* @__PURE__ */ e("span", { className: t.productCode, children: n.productCode })
1118
+ ] }),
1119
+ /* @__PURE__ */ e("span", { className: t.status, children: n.status })
1120
+ ] }),
1121
+ /* @__PURE__ */ i("div", { className: t.tabBar, children: [
1122
+ /* @__PURE__ */ e(
1123
+ "div",
1124
+ {
1125
+ className: `${t.tab} ${l === "chat" ? t.tabActive : ""}`,
1126
+ onClick: () => _("chat"),
1127
+ title: "产品在对话中生长:聊出的结论经你裁定后落为正式产物",
1128
+ children: "对话"
1129
+ }
1130
+ ),
1131
+ /* @__PURE__ */ e(
1132
+ "div",
1133
+ {
1134
+ className: `${t.tab} ${l === "description" ? t.tabActive : ""}`,
1135
+ onClick: () => _("description"),
1136
+ children: "产品描述"
1137
+ }
1138
+ ),
1139
+ /* @__PURE__ */ e(
1140
+ "div",
1141
+ {
1142
+ className: `${t.tab} ${l === "design" ? t.tabActive : ""}`,
1143
+ onClick: () => _("design"),
1144
+ children: "设计稿"
1145
+ }
1146
+ ),
1147
+ /* @__PURE__ */ e(
1148
+ "div",
1149
+ {
1150
+ className: `${t.tab} ${l === "requirement" ? t.tabActive : ""}`,
1151
+ onClick: () => _("requirement"),
1152
+ children: "业务需求"
1153
+ }
1154
+ ),
1155
+ /* @__PURE__ */ e(
1156
+ "div",
1157
+ {
1158
+ className: `${t.tab} ${l === "feature" ? t.tabActive : ""}`,
1159
+ onClick: () => _("feature"),
1160
+ children: "功能拆分"
1161
+ }
1162
+ ),
1163
+ /* @__PURE__ */ i(
1164
+ "div",
1165
+ {
1166
+ className: `${t.tab} ${l === "biz-understanding" ? t.tabActive : ""}`,
1167
+ onClick: () => _("biz-understanding"),
1168
+ title: "跨页面因果链稿件库 — 一份稿件 = 一个跨页面动作的连锁变化",
1169
+ children: [
1170
+ "业务理解 ",
1171
+ /* @__PURE__ */ e(se, { style: { marginLeft: 4, fontSize: 12 } })
1172
+ ]
1173
+ }
1174
+ ),
1175
+ /* @__PURE__ */ e(
1176
+ "div",
1177
+ {
1178
+ className: `${t.tab} ${l === "manuscript" ? t.tabActive : ""}`,
1179
+ onClick: () => _("manuscript"),
1180
+ title: "产品稿件 (case) × 设计稿件 (UI) 双向高亮",
1181
+ children: "稿件编辑器"
1182
+ }
1183
+ )
1184
+ ] }),
1185
+ /* @__PURE__ */ i("div", { className: t.tabContent, children: [
1186
+ l === "chat" && /* @__PURE__ */ e(
1187
+ ja,
1188
+ {
1189
+ productCode: n.productCode,
1190
+ productName: n.name,
1191
+ onArtifactChanged: () => {
1192
+ x();
1193
+ }
1194
+ }
1195
+ ),
1196
+ l === "description" && /* @__PURE__ */ e(Va, { product: n, onSave: te }),
1197
+ l === "design" && /* @__PURE__ */ e(
1198
+ Ja,
1199
+ {
1200
+ designs: r,
1201
+ onAdd: () => E(!0),
1202
+ onDelete: async (o) => {
1203
+ if (!confirm("确认删除该设计稿?")) return;
1204
+ await C.delete(
1205
+ `/product/${n.productCode}/design/${o}`
1206
+ );
1207
+ const s = await C.get(
1208
+ `/product/${n.productCode}/design/list`
1209
+ );
1210
+ f((s == null ? void 0 : s.data) || []);
1211
+ }
1212
+ }
1213
+ ),
1214
+ l === "requirement" && /* @__PURE__ */ e(
1215
+ Wa,
1216
+ {
1217
+ requirements: N,
1218
+ onAdd: () => T(!0),
1219
+ onDelete: Y
1220
+ }
1221
+ ),
1222
+ l === "feature" && /* @__PURE__ */ e(Xa, { features: P, onDecompose: u }),
1223
+ l === "biz-understanding" && /* @__PURE__ */ e(Za, { items: K }),
1224
+ l === "manuscript" && n && /* @__PURE__ */ e(
1225
+ Ve,
1226
+ {
1227
+ productCode: n.productCode,
1228
+ pageCode: "ctc.4a.org"
1229
+ }
1230
+ )
1231
+ ] })
1232
+ ] }) : /* @__PURE__ */ e("div", { className: t.spinner, children: /* @__PURE__ */ i("div", { children: [
1233
+ /* @__PURE__ */ e("p", { children: "暂无产品" }),
1234
+ /* @__PURE__ */ i(
1235
+ "button",
1236
+ {
1237
+ className: `${t.btn} ${t.btnPrimary}`,
1238
+ onClick: () => A(!0),
1239
+ children: [
1240
+ /* @__PURE__ */ e(j, {}),
1241
+ " 创建第一个产品"
1242
+ ]
1243
+ }
1244
+ )
1245
+ ] }) }) }),
1246
+ G && /* @__PURE__ */ e(
1247
+ Ka,
1248
+ {
1249
+ onCancel: () => A(!1),
1250
+ onSubmit: V
1251
+ }
1252
+ ),
1253
+ R && /* @__PURE__ */ e(
1254
+ Ya,
1255
+ {
1256
+ onCancel: () => E(!1),
1257
+ onSubmit: B
1258
+ }
1259
+ ),
1260
+ S && /* @__PURE__ */ e(
1261
+ Qa,
1262
+ {
1263
+ onCancel: () => T(!1),
1264
+ onSubmit: U
1265
+ }
1266
+ )
1267
+ ] });
1268
+ }
1269
+ function Va({
1270
+ product: a,
1271
+ onSave: c
1272
+ }) {
1273
+ const [n, h] = b(a.name), [p, d] = b(a.vision || ""), [l, _] = b(a.targetUsers || ""), [r, f] = b(a.description || "");
1274
+ return F(() => {
1275
+ h(a.name), d(a.vision || ""), _(a.targetUsers || ""), f(a.description || "");
1276
+ }, [a]), /* @__PURE__ */ i("div", { className: t.formGroup, children: [
1277
+ /* @__PURE__ */ e("label", { className: t.formLabel, children: "产品名称" }),
1278
+ /* @__PURE__ */ e(
1279
+ "input",
1280
+ {
1281
+ className: t.formInput,
1282
+ value: n,
1283
+ onChange: (N) => h(N.target.value)
1284
+ }
1285
+ ),
1286
+ /* @__PURE__ */ e("label", { className: t.formLabel, children: "产品愿景" }),
1287
+ /* @__PURE__ */ e(
1288
+ "textarea",
1289
+ {
1290
+ className: t.formTextarea,
1291
+ value: p,
1292
+ onChange: (N) => d(N.target.value),
1293
+ placeholder: "描述这个产品要解决什么问题..."
1294
+ }
1295
+ ),
1296
+ /* @__PURE__ */ e("label", { className: t.formLabel, children: "目标用户" }),
1297
+ /* @__PURE__ */ e(
1298
+ "textarea",
1299
+ {
1300
+ className: t.formTextarea,
1301
+ value: l,
1302
+ onChange: (N) => _(N.target.value),
1303
+ placeholder: "谁会用这个产品..."
1304
+ }
1305
+ ),
1306
+ /* @__PURE__ */ e("label", { className: t.formLabel, children: "业务描述 (Markdown)" }),
1307
+ /* @__PURE__ */ e(
1308
+ "textarea",
1309
+ {
1310
+ className: t.formTextarea,
1311
+ style: { minHeight: 200 },
1312
+ value: r,
1313
+ onChange: (N) => f(N.target.value),
1314
+ placeholder: `## 核心场景
1315
+ ## 用户故事
1316
+ ## 业务规则`
1317
+ }
1318
+ ),
1319
+ /* @__PURE__ */ e(
1320
+ "button",
1321
+ {
1322
+ className: `${t.btn} ${t.btnPrimary}`,
1323
+ onClick: () => c({ name: n, vision: p, targetUsers: l, description: r }),
1324
+ children: "保存"
1325
+ }
1326
+ )
1327
+ ] });
1328
+ }
1329
+ function Ja({
1330
+ designs: a,
1331
+ onAdd: c,
1332
+ onDelete: n
1333
+ }) {
1334
+ return /* @__PURE__ */ i("div", { children: [
1335
+ /* @__PURE__ */ i("div", { className: t.toolbar, children: [
1336
+ /* @__PURE__ */ i("h3", { style: { margin: 0, fontSize: 14 }, children: [
1337
+ "设计稿 (",
1338
+ a.length,
1339
+ ")"
1340
+ ] }),
1341
+ /* @__PURE__ */ i("button", { className: `${t.btn} ${t.btnPrimary}`, onClick: c, children: [
1342
+ /* @__PURE__ */ e(j, {}),
1343
+ " 添加设计稿"
1344
+ ] })
1345
+ ] }),
1346
+ a.length === 0 ? /* @__PURE__ */ e("div", { className: t.empty, children: '暂无设计稿,点击"添加设计稿"录入' }) : /* @__PURE__ */ e("div", { className: t.designGrid, children: a.map((h) => /* @__PURE__ */ i("div", { className: t.designCard, children: [
1347
+ h.fileUrl && /\.(jpg|jpeg|png|gif|webp|svg)$/i.test(h.fileUrl) ? /* @__PURE__ */ e("img", { className: t.designImage, src: h.fileUrl, alt: h.name }) : /* @__PURE__ */ i(
1348
+ "a",
1349
+ {
1350
+ className: t.designLink,
1351
+ href: h.fileUrl,
1352
+ target: "_blank",
1353
+ rel: "noreferrer",
1354
+ children: [
1355
+ /* @__PURE__ */ e(De, { style: { fontSize: 24, marginRight: 6 } }),
1356
+ "外链预览"
1357
+ ]
1358
+ }
1359
+ ),
1360
+ /* @__PURE__ */ i("div", { className: t.designInfo, children: [
1361
+ /* @__PURE__ */ e("div", { className: t.designName, children: h.name || "(未命名)" }),
1362
+ /* @__PURE__ */ e("div", { className: t.designDesc, children: h.description || h.fileUrl })
1363
+ ] }),
1364
+ /* @__PURE__ */ e("div", { className: t.designActions, children: /* @__PURE__ */ i(
1365
+ "button",
1366
+ {
1367
+ className: `${t.btn} ${t.btnDanger}`,
1368
+ onClick: () => n(h.id),
1369
+ children: [
1370
+ /* @__PURE__ */ e(ge, {}),
1371
+ " 删除"
1372
+ ]
1373
+ }
1374
+ ) })
1375
+ ] }, h.id)) })
1376
+ ] });
1377
+ }
1378
+ function Wa({
1379
+ requirements: a,
1380
+ onAdd: c,
1381
+ onDelete: n
1382
+ }) {
1383
+ const h = (d) => d === "P0" ? t.priorityP0 : d === "P1" ? t.priorityP1 : d === "P2" ? t.priorityP2 : t.priorityP3, p = (d) => d === "IN_PROGRESS" ? t.statusActive : d === "DONE" ? t.statusDone : "";
1384
+ return /* @__PURE__ */ i("div", { children: [
1385
+ /* @__PURE__ */ i("div", { className: t.toolbar, children: [
1386
+ /* @__PURE__ */ i("h3", { style: { margin: 0, fontSize: 14 }, children: [
1387
+ "业务需求 (",
1388
+ a.length,
1389
+ ")"
1390
+ ] }),
1391
+ /* @__PURE__ */ i("button", { className: `${t.btn} ${t.btnPrimary}`, onClick: c, children: [
1392
+ /* @__PURE__ */ e(j, {}),
1393
+ " 新增需求"
1394
+ ] })
1395
+ ] }),
1396
+ a.length === 0 ? /* @__PURE__ */ e("div", { className: t.empty, children: "暂无需求,先录入需求后即可一键拆分" }) : /* @__PURE__ */ i("table", { className: t.table, children: [
1397
+ /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ i("tr", { children: [
1398
+ /* @__PURE__ */ e("th", { style: { width: 80 }, children: "优先级" }),
1399
+ /* @__PURE__ */ e("th", { children: "标题" }),
1400
+ /* @__PURE__ */ e("th", { children: "描述" }),
1401
+ /* @__PURE__ */ e("th", { style: { width: 100 }, children: "状态" }),
1402
+ /* @__PURE__ */ e("th", { style: { width: 100 }, children: "操作" })
1403
+ ] }) }),
1404
+ /* @__PURE__ */ e("tbody", { children: a.map((d) => /* @__PURE__ */ i("tr", { children: [
1405
+ /* @__PURE__ */ e("td", { children: /* @__PURE__ */ e("span", { className: `${t.priority} ${h(d.priority)}`, children: d.priority }) }),
1406
+ /* @__PURE__ */ e("td", { children: d.title }),
1407
+ /* @__PURE__ */ e("td", { style: { color: "var(--text-tertiary, #999)" }, children: d.description }),
1408
+ /* @__PURE__ */ e("td", { children: /* @__PURE__ */ e("span", { className: `${t.status} ${p(d.status)}`, children: d.status }) }),
1409
+ /* @__PURE__ */ e("td", { children: /* @__PURE__ */ e(
1410
+ "button",
1411
+ {
1412
+ className: `${t.btn} ${t.btnDanger}`,
1413
+ onClick: () => n(d.id),
1414
+ children: /* @__PURE__ */ e(ge, {})
1415
+ }
1416
+ ) })
1417
+ ] }, d.id)) })
1418
+ ] })
1419
+ ] });
1420
+ }
1421
+ function Xa({
1422
+ features: a,
1423
+ onDecompose: c
1424
+ }) {
1425
+ return /* @__PURE__ */ i("div", { children: [
1426
+ /* @__PURE__ */ i("div", { className: t.toolbar, children: [
1427
+ /* @__PURE__ */ i("h3", { style: { margin: 0, fontSize: 14 }, children: [
1428
+ "功能拆分 (",
1429
+ a.length,
1430
+ ")"
1431
+ ] }),
1432
+ /* @__PURE__ */ i(
1433
+ "button",
1434
+ {
1435
+ className: `${t.btn} ${t.btnPrimary}`,
1436
+ onClick: c,
1437
+ title: "根据业务需求自动生成 FEATURE-XXX",
1438
+ children: [
1439
+ /* @__PURE__ */ e(se, {}),
1440
+ " 一键拆分"
1441
+ ]
1442
+ }
1443
+ )
1444
+ ] }),
1445
+ a.length === 0 ? /* @__PURE__ */ e("div", { className: t.empty, children: '暂无功能,先在"业务需求"录入需求,再点击"一键拆分"' }) : /* @__PURE__ */ i("table", { className: t.table, children: [
1446
+ /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ i("tr", { children: [
1447
+ /* @__PURE__ */ e("th", { style: { width: 120 }, children: "编号" }),
1448
+ /* @__PURE__ */ e("th", { children: "名称" }),
1449
+ /* @__PURE__ */ e("th", { children: "描述" }),
1450
+ /* @__PURE__ */ e("th", { style: { width: 100 }, children: "状态" }),
1451
+ /* @__PURE__ */ e("th", { style: { width: 220 }, children: "文档路径" })
1452
+ ] }) }),
1453
+ /* @__PURE__ */ e("tbody", { children: a.map((n) => /* @__PURE__ */ i("tr", { children: [
1454
+ /* @__PURE__ */ e("td", { children: /* @__PURE__ */ e("span", { className: t.featureNo, children: n.featureNo }) }),
1455
+ /* @__PURE__ */ e("td", { children: n.name }),
1456
+ /* @__PURE__ */ e("td", { style: { color: "var(--text-tertiary, #999)" }, children: n.description }),
1457
+ /* @__PURE__ */ e("td", { children: /* @__PURE__ */ e("span", { className: t.status, children: n.status }) }),
1458
+ /* @__PURE__ */ e("td", { style: { fontSize: 11, color: "var(--text-tertiary, #999)" }, children: n.docPath })
1459
+ ] }, n.id)) })
1460
+ ] })
1461
+ ] });
1462
+ }
1463
+ function Ka({
1464
+ onCancel: a,
1465
+ onSubmit: c
1466
+ }) {
1467
+ const [n, h] = b(""), [p, d] = b("");
1468
+ return /* @__PURE__ */ e("div", { className: t.modal, children: /* @__PURE__ */ i("div", { className: t.modalBody, children: [
1469
+ /* @__PURE__ */ e("div", { className: t.modalTitle, children: "新建产品" }),
1470
+ /* @__PURE__ */ e("label", { className: t.formLabel, children: "产品名称 *" }),
1471
+ /* @__PURE__ */ e(
1472
+ "input",
1473
+ {
1474
+ className: t.formInput,
1475
+ value: n,
1476
+ onChange: (l) => h(l.target.value),
1477
+ placeholder: "例如:智能客服平台"
1478
+ }
1479
+ ),
1480
+ /* @__PURE__ */ e("label", { className: t.formLabel, children: "产品愿景" }),
1481
+ /* @__PURE__ */ e(
1482
+ "textarea",
1483
+ {
1484
+ className: t.formTextarea,
1485
+ value: p,
1486
+ onChange: (l) => d(l.target.value),
1487
+ placeholder: "简要描述愿景..."
1488
+ }
1489
+ ),
1490
+ /* @__PURE__ */ i("div", { className: t.modalActions, children: [
1491
+ /* @__PURE__ */ e("button", { className: t.btn, onClick: a, children: "取消" }),
1492
+ /* @__PURE__ */ i(
1493
+ "button",
1494
+ {
1495
+ className: `${t.btn} ${t.btnPrimary}`,
1496
+ onClick: () => n && c({ name: n, vision: p, status: "DRAFT" }),
1497
+ disabled: !n,
1498
+ children: [
1499
+ /* @__PURE__ */ e(j, {}),
1500
+ " 创建"
1501
+ ]
1502
+ }
1503
+ )
1504
+ ] })
1505
+ ] }) });
1506
+ }
1507
+ function Ya({
1508
+ onCancel: a,
1509
+ onSubmit: c
1510
+ }) {
1511
+ const [n, h] = b(""), [p, d] = b(""), [l, _] = b("");
1512
+ return /* @__PURE__ */ e("div", { className: t.modal, children: /* @__PURE__ */ i("div", { className: t.modalBody, children: [
1513
+ /* @__PURE__ */ e("div", { className: t.modalTitle, children: "添加设计稿" }),
1514
+ /* @__PURE__ */ e("label", { className: t.formLabel, children: "名称" }),
1515
+ /* @__PURE__ */ e(
1516
+ "input",
1517
+ {
1518
+ className: t.formInput,
1519
+ value: n,
1520
+ onChange: (r) => h(r.target.value),
1521
+ placeholder: "首页 / 登录页 / 后台..."
1522
+ }
1523
+ ),
1524
+ /* @__PURE__ */ e("label", { className: t.formLabel, children: "URL 或图片地址 *" }),
1525
+ /* @__PURE__ */ e(
1526
+ "input",
1527
+ {
1528
+ className: t.formInput,
1529
+ value: p,
1530
+ onChange: (r) => d(r.target.value),
1531
+ placeholder: "https://... 或 Figma link"
1532
+ }
1533
+ ),
1534
+ /* @__PURE__ */ e("label", { className: t.formLabel, children: "说明" }),
1535
+ /* @__PURE__ */ e(
1536
+ "textarea",
1537
+ {
1538
+ className: t.formTextarea,
1539
+ value: l,
1540
+ onChange: (r) => _(r.target.value)
1541
+ }
1542
+ ),
1543
+ /* @__PURE__ */ i("div", { className: t.modalActions, children: [
1544
+ /* @__PURE__ */ e("button", { className: t.btn, onClick: a, children: "取消" }),
1545
+ /* @__PURE__ */ i(
1546
+ "button",
1547
+ {
1548
+ className: `${t.btn} ${t.btnPrimary}`,
1549
+ onClick: () => p && c({ name: n, fileUrl: p, description: l, assetType: "IMAGE" }),
1550
+ disabled: !p,
1551
+ children: [
1552
+ /* @__PURE__ */ e(j, {}),
1553
+ " 添加"
1554
+ ]
1555
+ }
1556
+ )
1557
+ ] })
1558
+ ] }) });
1559
+ }
1560
+ function Qa({
1561
+ onCancel: a,
1562
+ onSubmit: c
1563
+ }) {
1564
+ const [n, h] = b(""), [p, d] = b(""), [l, _] = b("P1");
1565
+ return /* @__PURE__ */ e("div", { className: t.modal, children: /* @__PURE__ */ i("div", { className: t.modalBody, children: [
1566
+ /* @__PURE__ */ e("div", { className: t.modalTitle, children: "新增业务需求" }),
1567
+ /* @__PURE__ */ e("label", { className: t.formLabel, children: "标题 *" }),
1568
+ /* @__PURE__ */ e(
1569
+ "input",
1570
+ {
1571
+ className: t.formInput,
1572
+ value: n,
1573
+ onChange: (r) => h(r.target.value),
1574
+ placeholder: "例如:支持用户拖拽上传设计稿"
1575
+ }
1576
+ ),
1577
+ /* @__PURE__ */ e("label", { className: t.formLabel, children: "描述" }),
1578
+ /* @__PURE__ */ e(
1579
+ "textarea",
1580
+ {
1581
+ className: t.formTextarea,
1582
+ value: p,
1583
+ onChange: (r) => d(r.target.value)
1584
+ }
1585
+ ),
1586
+ /* @__PURE__ */ e("label", { className: t.formLabel, children: "优先级" }),
1587
+ /* @__PURE__ */ i(
1588
+ "select",
1589
+ {
1590
+ className: t.formInput,
1591
+ value: l,
1592
+ onChange: (r) => _(r.target.value),
1593
+ children: [
1594
+ /* @__PURE__ */ e("option", { value: "P0", children: "P0 - 紧急" }),
1595
+ /* @__PURE__ */ e("option", { value: "P1", children: "P1 - 重要" }),
1596
+ /* @__PURE__ */ e("option", { value: "P2", children: "P2 - 一般" }),
1597
+ /* @__PURE__ */ e("option", { value: "P3", children: "P3 - 低" })
1598
+ ]
1599
+ }
1600
+ ),
1601
+ /* @__PURE__ */ i("div", { className: t.modalActions, children: [
1602
+ /* @__PURE__ */ e("button", { className: t.btn, onClick: a, children: "取消" }),
1603
+ /* @__PURE__ */ i(
1604
+ "button",
1605
+ {
1606
+ className: `${t.btn} ${t.btnPrimary}`,
1607
+ onClick: () => n && c({ title: n, description: p, priority: l }),
1608
+ disabled: !n,
1609
+ children: [
1610
+ /* @__PURE__ */ e(j, {}),
1611
+ " 添加"
1612
+ ]
1613
+ }
1614
+ )
1615
+ ] })
1616
+ ] }) });
1617
+ }
1618
+ function Za({ items: a }) {
1619
+ const [c, n] = b(null), [h, p] = b(""), d = (r, f) => {
1620
+ if (!r) return f;
1621
+ try {
1622
+ return JSON.parse(r);
1623
+ } catch {
1624
+ return f;
1625
+ }
1626
+ }, l = h.trim() ? a.filter((r) => d(r.impactedPages, []).some((N) => N.includes(h.trim()))) : a, _ = (r) => r === "P0" ? t.priorityP0 : r === "P1" ? t.priorityP1 : t.priorityP2;
1627
+ return l.length > 0 && (!c || !l.find((r) => r.id === c.id)) && n(l[0]), /* @__PURE__ */ i("div", { className: t.bizLayout, children: [
1628
+ /* @__PURE__ */ i("div", { className: t.bizList, children: [
1629
+ /* @__PURE__ */ i("div", { className: t.bizFilter, children: [
1630
+ /* @__PURE__ */ e(
1631
+ "input",
1632
+ {
1633
+ className: t.formInput,
1634
+ placeholder: "反向追溯: 输入页面编码 (如 ctc.4a.account)",
1635
+ value: h,
1636
+ onChange: (r) => p(r.target.value)
1637
+ }
1638
+ ),
1639
+ h && /* @__PURE__ */ i("span", { className: t.bizFilterHint, children: [
1640
+ l.length,
1641
+ " 篇稿件涉及该页面"
1642
+ ] })
1643
+ ] }),
1644
+ /* @__PURE__ */ i("div", { className: t.bizListHeader, children: [
1645
+ "业务理解 / 跨页面因果链 (",
1646
+ l.length,
1647
+ ")"
1648
+ ] }),
1649
+ l.length === 0 ? /* @__PURE__ */ e("div", { className: t.empty, children: h ? `没有稿件涉及「${h}」` : "暂无稿件, 请先在 DBA 层跑建表 SQL + 种子数据" }) : l.map((r) => {
1650
+ var N;
1651
+ const f = d(r.impactedPages, []);
1652
+ return /* @__PURE__ */ i(
1653
+ "div",
1654
+ {
1655
+ className: `${t.bizItem} ${(c == null ? void 0 : c.id) === r.id ? t.bizItemActive : ""}`,
1656
+ onClick: () => n(r),
1657
+ children: [
1658
+ /* @__PURE__ */ i("div", { className: t.bizItemHeader, children: [
1659
+ /* @__PURE__ */ e("span", { className: `${t.priority} ${_(r.priority)}`, children: r.priority }),
1660
+ /* @__PURE__ */ e("span", { className: t.bizItemTitle, children: r.title }),
1661
+ /* @__PURE__ */ e("span", { className: t.bizItemStatus, children: r.status })
1662
+ ] }),
1663
+ /* @__PURE__ */ e("div", { className: t.bizItemSummary, children: r.summary }),
1664
+ /* @__PURE__ */ i("div", { className: t.bizItemMeta, children: [
1665
+ "触发: ",
1666
+ ((N = d(r.triggerInfo, {})) == null ? void 0 : N.page) || "-",
1667
+ /* @__PURE__ */ e("span", { className: t.bizItemDot, children: "•" }),
1668
+ "影响 ",
1669
+ f.length,
1670
+ " 个页面"
1671
+ ] })
1672
+ ]
1673
+ },
1674
+ r.id
1675
+ );
1676
+ })
1677
+ ] }),
1678
+ /* @__PURE__ */ e("div", { className: t.bizDetail, children: c ? /* @__PURE__ */ i(pe, { children: [
1679
+ /* @__PURE__ */ i("div", { className: t.bizDetailHeader, children: [
1680
+ /* @__PURE__ */ e("div", { className: t.bizDetailTitle, children: c.title }),
1681
+ /* @__PURE__ */ e("div", { className: t.bizDetailCode, children: c.bizCode })
1682
+ ] }),
1683
+ /* @__PURE__ */ i("div", { className: t.bizSection, children: [
1684
+ /* @__PURE__ */ i("div", { className: t.bizSectionTitle, children: [
1685
+ /* @__PURE__ */ e(se, {}),
1686
+ " 触发信息"
1687
+ ] }),
1688
+ (() => {
1689
+ const r = d(c.triggerInfo, {});
1690
+ return /* @__PURE__ */ i("div", { className: t.bizTriggerCard, children: [
1691
+ /* @__PURE__ */ i("div", { children: [
1692
+ /* @__PURE__ */ e("b", { children: "页面:" }),
1693
+ " ",
1694
+ r.page || "-"
1695
+ ] }),
1696
+ /* @__PURE__ */ i("div", { children: [
1697
+ /* @__PURE__ */ e("b", { children: "动作:" }),
1698
+ " ",
1699
+ r.action || "-"
1700
+ ] }),
1701
+ /* @__PURE__ */ i("div", { children: [
1702
+ /* @__PURE__ */ e("b", { children: "元素:" }),
1703
+ " ",
1704
+ r.element || "-"
1705
+ ] }),
1706
+ r.preStates && r.preStates.length > 0 && /* @__PURE__ */ i("div", { children: [
1707
+ /* @__PURE__ */ e("b", { children: "前置:" }),
1708
+ " ",
1709
+ r.preStates.join(" / ")
1710
+ ] })
1711
+ ] });
1712
+ })()
1713
+ ] }),
1714
+ /* @__PURE__ */ i("div", { className: t.bizSection, children: [
1715
+ /* @__PURE__ */ i("div", { className: t.bizSectionTitle, children: [
1716
+ "⚡ 跨页面连带效应 (",
1717
+ d(c.crossPageEffects, []).length,
1718
+ ")"
1719
+ ] }),
1720
+ /* @__PURE__ */ e("div", { className: t.bizEffects, children: d(c.crossPageEffects, []).map((r, f) => /* @__PURE__ */ i("div", { className: t.bizEffectCard, children: [
1721
+ /* @__PURE__ */ i("div", { className: t.bizEffectPage, children: [
1722
+ /* @__PURE__ */ e("span", { className: t.bizEffectArrow, children: "→" }),
1723
+ /* @__PURE__ */ e("span", { className: t.bizEffectPageCode, children: r.page }),
1724
+ /* @__PURE__ */ e("span", { className: t.bizEffectDelay, children: r.delay })
1725
+ ] }),
1726
+ /* @__PURE__ */ i("div", { className: t.bizEffectType, children: [
1727
+ "[",
1728
+ r.effectType,
1729
+ "]"
1730
+ ] }),
1731
+ /* @__PURE__ */ e("div", { className: t.bizEffectDesc, children: r.description })
1732
+ ] }, f)) })
1733
+ ] }),
1734
+ c.story && /* @__PURE__ */ i("div", { className: t.bizSection, children: [
1735
+ /* @__PURE__ */ e("div", { className: t.bizSectionTitle, children: "📖 故事正文" }),
1736
+ /* @__PURE__ */ e("pre", { className: t.bizStory, children: c.story })
1737
+ ] })
1738
+ ] }) : /* @__PURE__ */ e("div", { className: t.empty, children: "从左侧选择一份稿件查看因果链详情" }) })
1739
+ ] });
1740
+ }
1741
+ export {
1742
+ si as default
1743
+ };