strategy_info.html
28.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>盯防效果数据查看 - 问界门店运营数据分析平台</title>
<link rel="stylesheet" href="./static/css/style.css">
<style>
:root {
--primary: #1890ff;
--bg: #f5f7fa;
--card-bg: #fff;
--text: #333;
--text-secondary: #666;
--text-muted: #999;
--border: #f0f0f0;
--success: #52c41a;
--warning: #fa8c16;
--danger: #f5222d;
--purple: #722ed1;
}
body { background: var(--bg); }
.detail-header {
background: var(--card-bg);
padding: 14px 24px;
border-bottom: 1px solid var(--border);
display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
gap: 12px;
}
.breadcrumb { font-size: 14px; color: var(--text-secondary); }
.breadcrumb a { color: var(--text-secondary); text-decoration: none; }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb .current { color: var(--text); font-weight: 500; }
.header-actions { display: flex; gap: 10px; }
.btn { padding: 7px 16px; border-radius: 4px; font-size: 13px; cursor: pointer; border: 1px solid #d9d9d9; background: #fff; color: #333; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { opacity: 0.9; }
.detail-container {
display: flex;
gap: 16px;
padding: 16px 24px 24px;
max-width: 1600px;
margin: 0 auto;
}
.left-panel { width: 320px; flex-shrink: 0; display: flex; flex-direction: column; gap: 16px; }
.right-panel { flex: 1; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.card {
background: var(--card-bg);
border-radius: 8px;
box-shadow: 0 1px 3px rgba(0,0,0,0.06);
overflow: hidden;
}
.card-header {
padding: 14px 16px;
border-bottom: 1px solid var(--border);
display: flex;
align-items: center;
gap: 8px;
font-weight: 600;
font-size: 15px;
color: var(--text);
}
.card-body { padding: 16px; }
.info-row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid #fafafa; font-size: 13px; }
.info-row:last-child { border-bottom: none; }
.info-label { color: var(--text-muted); flex-shrink: 0; margin-right: 12px; }
.info-value { color: var(--text); text-align: right; word-break: break-all; }
.tag {
display: inline-flex;
align-items: center;
gap: 4px;
padding: 3px 10px;
border-radius: 12px;
font-size: 12px;
font-weight: 500;
}
.tag-monitoring { background: #f3e8ff; color: var(--purple); }
.tag-monitoring::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--purple); }
.tag-ended { background: #f5f5f5; color: var(--text-muted); }
.tag-warning { background: #fff2f0; color: var(--danger); border: 1px solid #ffccc7; }
.tag-alert { background: #fff7e6; color: var(--warning); border: 1px solid #ffd591; }
.tag-new { background: #e6f7ff; color: var(--primary); border: 1px solid #91d5ff; }
.tag-direct { background: #e6f7ff; color: var(--primary); }
.tag-franchise { background: #fff7e6; color: var(--warning); }
.tag-baodi { background: #e6f7ff; color: var(--primary); border: 1px solid #91d5ff; }
.effect-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.effect-item {
background: #f8f9fa;
border-radius: 6px;
padding: 14px;
text-align: center;
}
.effect-item .label { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.effect-item .value { font-size: 20px; font-weight: 700; }
.effect-item .value.up { color: var(--success); }
.effect-item .value.down { color: var(--danger); }
.right-panel .card-header { display: flex; justify-content: space-between; }
.card-subtitle { font-size: 12px; color: var(--text-muted); font-weight: normal; }
.performance-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.performance-table th {
background: #fafafa;
color: var(--text-secondary);
font-weight: 600;
padding: 12px 10px;
text-align: center;
border-bottom: 1px solid var(--border);
white-space: nowrap;
}
.performance-table td {
padding: 14px 10px;
border-bottom: 1px solid var(--border);
text-align: center;
vertical-align: middle;
}
.performance-table tr:hover { background: #fafafa; }
.performance-table .dim { color: var(--text-muted); }
.performance-table .period { text-align: left; }
.period-label { font-weight: 500; color: var(--text); }
.period-range { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.rate-cell { display: flex; flex-direction: column; gap: 2px; align-items: center; }
.rate-value { font-weight: 600; }
.rate-value.up { color: var(--success); }
.rate-value.down { color: var(--danger); }
.rate-value.warning { color: var(--warning); }
.rate-status { font-size: 11px; color: var(--text-muted); }
.comparison-grid {
display: grid;
grid-template-columns: 1fr auto 1fr;
gap: 16px;
align-items: center;
}
.comparison-box {
background: #f8f9fa;
border-radius: 8px;
padding: 18px;
}
.comparison-box.highlight { background: #f3e8ff; }
.comparison-title { font-size: 13px; color: var(--text-secondary); margin-bottom: 12px; }
.comparison-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.comparison-metric .label { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.comparison-metric .value { font-size: 18px; font-weight: 700; color: var(--text); }
.comparison-metric .value.rate::after { content: '%'; font-size: 12px; font-weight: 400; color: var(--text-muted); }
.arrow-box { display: flex; align-items: center; justify-content: center; }
.arrow-box .arrow { font-size: 24px; color: var(--primary); }
.chart-container { height: 280px; position: relative; }
.chart-legend { display: flex; justify-content: flex-end; gap: 16px; margin-bottom: 10px; font-size: 12px; }
.legend-item { display: flex; align-items: center; gap: 6px; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; }
.svg-chart { width: 100%; height: 100%; }
.conclusion {
background: #f6ffed;
border: 1px solid #b7eb8f;
border-radius: 6px;
padding: 14px;
line-height: 1.8;
white-space: pre-wrap;
font-size: 13px;
color: #333;
}
.loading { text-align: center; padding: 60px; color: var(--text-muted); }
.error-tip { text-align: center; padding: 60px; color: var(--danger); }
@media (max-width: 1200px) {
.detail-container { flex-direction: column; }
.left-panel { width: 100%; }
}
</style>
</head>
<body>
<header>
<div class="logo">问界运营分析平台</div>
<nav class="nav-links">
<a class="nav-item" href="./">首页</a>
<a class="nav-item" href="./ods">ODS 同步任务</a>
<a class="nav-item" href="./dw">DWS/DWM/DWA 任务</a>
<a class="nav-item" href="./analysis">问界生态系数分析</a>
<a class="nav-item" href="./harmony">鸿蒙生态分析</a>
<a class="nav-item" href="./harmony/sub-brand">鸿蒙子品牌分析</a>
<a class="nav-item active" href="./strategy">策略效果盯防</a>
</nav>
<div class="user-info" id="user-info">管理员</div>
</header>
<div class="detail-header">
<div class="breadcrumb">
<a href="./strategy">盯防管理</a> > <span class="current">盯防效果数据查看</span>
</div>
<div class="header-actions">
<button class="btn btn-primary" onclick="history.back()">返回列表</button>
</div>
</div>
<div class="detail-container" id="detail-container">
<div class="loading">正在加载盯防效果数据...</div>
</div>
<script>
window.API_BASE = (function(){var p=window.location.pathname;if(p.endsWith('/'))p=p.slice(0,-1);var i=p.lastIndexOf('/');return p.substring(0,i)+'/api';})();
const PRODUCT_META = {
ew: { name: '整车延保', color: '#1890ff' },
ax: { name: '安心包', color: '#fa8c16' },
battery: { name: '电池2', color: '#52c41a' }
};
function escapeHtml(s) {
if (s === null || s === undefined) return '';
return String(s).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"');
}
function formatNum(n) {
if (n === null || n === undefined) return '-';
return Number(n).toLocaleString('zh-CN');
}
function formatRate(v) {
if (v === null || v === undefined) return '-';
return Number(v).toFixed(1) + '%';
}
function formatRatio(v) {
if (v === null || v === undefined) return '-';
const arrow = v > 0 ? '↑' : (v < 0 ? '↓' : '→');
return arrow + ' ' + Math.abs(v).toFixed(1) + '%';
}
function getStatusClass(status) {
if (status === '盯防中') return 'tag-monitoring';
return 'tag-ended';
}
function getMonitorClass(type) {
if (type === '业绩下滑盯防') return 'tag-warning';
if (type === '预警盯防') return 'tag-alert';
return 'tag-new';
}
function renderRateCell(rate, target) {
let cls = '';
if (target !== undefined && target !== null && rate !== null) {
cls = rate >= target ? 'up' : 'down';
}
return `<div class="rate-cell"><span class="rate-value ${cls}">${formatRate(rate)}</span>${target !== undefined && target !== null ? '<span class="rate-status">达标线' + target + '%</span>' : ''}</div>`;
}
function renderWeeklyTable(weeks, beforeAfter) {
if (!weeks || weeks.length === 0) {
return '<div style="padding:30px;text-align:center;color:#999">暂无周维度明细数据</div>';
}
let baseIdx = 0, execIdx = 0;
const rows = weeks.map((w, idx) => {
const phaseText = w.phase === 'exec' ? '盯防中' : '盯防前';
const phaseClass = w.phase === 'exec' ? 'tag-monitoring' : 'tag-ended';
const weekNo = w.phase === 'exec' ? (++execIdx) : (++baseIdx);
const prev = weeks[idx - 1];
const momDelivery = prev && prev.delivery > 0 ? ((w.delivery - prev.delivery) / prev.delivery * 100) : null;
const ewRate = w.ew_rate;
const axRate = w.ax_rate;
const batteryRate = w.battery_rate;
return `<tr>
<td class="period">
<div class="period-label">${phaseText} 第${weekNo}周</div>
<div class="period-range">${w.week_start.slice(5)} ~ ${w.week_end.slice(5)}</div>
</td>
<td>${formatNum(w.delivery)}</td>
<td>${renderRateCell(ewRate, 15)}</td>
<td>${renderRateCell(axRate, 20)}</td>
<td>${renderRateCell(batteryRate, 7)}</td>
<td><span class="tag ${phaseClass}">${phaseText}</span></td>
<td class="${momDelivery > 0 ? 'up' : (momDelivery < 0 ? 'down' : '')}">${momDelivery !== null && momDelivery !== undefined ? formatRatio(momDelivery) : '-'}</td>
</tr>`;
}).join('');
const before = beforeAfter ? beforeAfter.before : null;
const after = beforeAfter ? beforeAfter.after : null;
const summaryRows = [];
if (before && after) {
const ewChange = after.ew_rate !== null && before.ew_rate !== null ? after.ew_rate - before.ew_rate : null;
const axChange = after.ax_rate !== null && before.ax_rate !== null ? after.ax_rate - before.ax_rate : null;
const batteryChange = after.battery_rate !== null && before.battery_rate !== null ? after.battery_rate - before.battery_rate : null;
summaryRows.push(`<tr style="background:#fafafa;font-weight:500">
<td class="period"><div class="period-label">${before.label}(汇总)</div></td>
<td>${formatNum(before.delivery)}</td>
<td>${renderRateCell(before.ew_rate, 15)}</td>
<td>${renderRateCell(before.ax_rate, 20)}</td>
<td>${renderRateCell(before.battery_rate, 7)}</td>
<td><span class="tag tag-ended">盯防前</span></td>
<td>-</td>
</tr>`);
summaryRows.push(`<tr style="background:#f3e8ff;font-weight:500">
<td class="period"><div class="period-label">${after.label}(汇总)</div></td>
<td>${formatNum(after.delivery)}</td>
<td>${renderRateCell(after.ew_rate, 15)}</td>
<td>${renderRateCell(after.ax_rate, 20)}</td>
<td>${renderRateCell(after.battery_rate, 7)}</td>
<td><span class="tag tag-monitoring">盯防中</span></td>
<td class="up">${formatRatio(after.delivery > before.delivery ? ((after.delivery - before.delivery) / before.delivery * 100) : 0)}</td>
</tr>`);
}
return `<table class="performance-table">
<thead>
<tr>
<th style="text-align:left">时间维度</th>
<th>交付数</th>
<th>整车延保2</th>
<th>安心包2</th>
<th>电池2</th>
<th>盯防状态</th>
<th>环比变化</th>
</tr>
</thead>
<tbody>${summaryRows.join('')}${rows}</tbody>
</table>`;
}
function renderComparison(comp) {
if (!comp) return '';
const before = comp.before;
const after = comp.after;
const ewChange = (after.ew_rate !== null && before.ew_rate !== null) ? (after.ew_rate - before.ew_rate) : null;
const axChange = (after.ax_rate !== null && before.ax_rate !== null) ? (after.ax_rate - before.ax_rate) : null;
const batteryChange = (after.battery_rate !== null && before.battery_rate !== null) ? (after.battery_rate - before.battery_rate) : null;
return `<div class="comparison-grid">
<div class="comparison-box">
<div class="comparison-title">${before.label}(前${before.weeks}周均值)</div>
<div class="comparison-metrics">
<div class="comparison-metric"><div class="label">周均交付数</div><div class="value">${formatNum(before.delivery)}</div></div>
<div class="comparison-metric"><div class="label">整车延保2</div><div class="value rate">${formatRate(before.ew_rate)}</div></div>
<div class="comparison-metric"><div class="label">安心包2</div><div class="value rate">${formatRate(before.ax_rate)}</div></div>
<div class="comparison-metric"><div class="label">电池2</div><div class="value rate">${formatRate(before.battery_rate)}</div></div>
</div>
</div>
<div class="arrow-box"><span class="arrow">→</span></div>
<div class="comparison-box highlight">
<div class="comparison-title">${after.label}(后${after.weeks}周均值)</div>
<div class="comparison-metrics">
<div class="comparison-metric"><div class="label">周均交付数</div><div class="value">${formatNum(after.delivery)}</div></div>
<div class="comparison-metric"><div class="label">整车延保2</div><div class="value rate">${formatRate(after.ew_rate)}</div></div>
<div class="comparison-metric"><div class="label">安心包2</div><div class="value rate">${formatRate(after.ax_rate)}</div></div>
<div class="comparison-metric"><div class="label">电池2</div><div class="value rate">${formatRate(after.battery_rate)}</div></div>
</div>
</div>
</div>`;
}
function renderTrendChart(weeks) {
if (!weeks || weeks.length === 0) return '<div style="padding:40px;text-align:center;color:#999">暂无趋势数据</div>';
const width = 800;
const height = 240;
const padding = { top: 20, right: 30, bottom: 40, left: 40 };
const chartW = width - padding.left - padding.right;
const chartH = height - padding.top - padding.bottom;
const keys = ['ew_rate', 'ax_rate', 'battery_rate'];
const colors = ['#1890ff', '#fa8c16', '#52c41a'];
const allValues = weeks.flatMap(w => keys.map(k => w[k]).filter(v => v !== null && v !== undefined));
const maxVal = allValues.length ? Math.max(...allValues, 15) : 100;
const minVal = 0;
function x(i) { return padding.left + (i / (weeks.length - 1 || 1)) * chartW; }
function y(v) { return padding.top + chartH - ((v - minVal) / (maxVal - minVal)) * chartH; }
const lines = keys.map((key, kidx) => {
const points = weeks.map((w, i) => {
const v = w[key];
if (v === null || v === undefined) return '';
return `${x(i)},${y(v)}`;
}).filter(Boolean).join(' ');
if (!points) return '';
const circles = weeks.map((w, i) => {
const v = w[key];
if (v === null || v === undefined) return '';
return `<circle cx="${x(i)}" cy="${y(v)}" r="4" fill="${colors[kidx]}" stroke="#fff" stroke-width="2"/>`;
}).join('');
return `<polyline fill="none" stroke="${colors[kidx]}" stroke-width="2.5" points="${points}" stroke-linecap="round" stroke-linejoin="round"/>${circles}`;
}).join('');
const xAxisLabels = weeks.map((w, i) => {
return `<text x="${x(i)}" y="${height - 12}" text-anchor="middle" font-size="11" fill="#999">${w.week_start.slice(5)}</text>`;
}).join('');
const yTicks = [0, 25, 50, 75, 100].filter(t => t <= maxVal);
const yAxis = yTicks.map(t => {
const yy = y(t);
return `<line x1="${padding.left}" y1="${yy}" x2="${width - padding.right}" y2="${yy}" stroke="#f0f0f0" stroke-dasharray="2,2"/>
<text x="${padding.left - 8}" y="${yy + 4}" text-anchor="end" font-size="11" fill="#999">${t}%</text>`;
}).join('');
// 盯防中区域阴影
const execIdx = weeks.findIndex(w => w.phase === 'exec');
let execRect = '';
if (execIdx >= 0) {
const x1 = x(execIdx - 0.5);
const x2 = x(weeks.length - 1 + 0.5);
execRect = `<rect x="${x1}" y="${padding.top}" width="${x2 - x1}" height="${chartH}" fill="#f3e8ff" fill-opacity="0.3"/>
<text x="${(x1 + x2) / 2}" y="${padding.top + 14}" text-anchor="middle" font-size="11" fill="#722ed1">盯防周期</text>`;
}
return `<div class="chart-legend">
<span class="legend-item"><span class="legend-dot" style="background:#1890ff"></span>整车延保2</span>
<span class="legend-item"><span class="legend-dot" style="background:#fa8c16"></span>安心包2</span>
<span class="legend-item"><span class="legend-dot" style="background:#52c41a"></span>电池2</span>
</div>
<svg class="svg-chart" viewBox="0 0 ${width} ${height}" preserveAspectRatio="xMidYMid meet">
${yAxis}
${execRect}
${lines}
${xAxisLabels}
<line x1="${padding.left}" y1="${padding.top + chartH}" x2="${width - padding.right}" y2="${padding.top + chartH}" stroke="#e0e0e0"/>
</svg>`;
}
function renderEffectSummary(effect, beforeAfter) {
const dc = effect.delivery_change || {};
const pc = (effect.product_changes || []).reduce((m, p) => { m[p.key] = p; return m; }, {});
const ew = pc.extended_warranty || {};
const ax = pc.ax_package || {};
const battery = pc.battery_extended || {};
const deliveryRatio = dc.ratio;
const ewChange = ew.pp_change;
const axChange = ax.pp_change;
const batteryChange = battery.pp_change;
return `<div class="effect-summary">
<div class="effect-item">
<div class="label">交付数变化</div>
<div class="value ${deliveryRatio > 0 ? 'up' : (deliveryRatio < 0 ? 'down' : '')}">${formatRatio(deliveryRatio)}</div>
</div>
<div class="effect-item">
<div class="label">整车延保2</div>
<div class="value ${ewChange > 0 ? 'up' : (ewChange < 0 ? 'down' : '')}">${ewChange !== null && ewChange !== undefined ? (ewChange > 0 ? '+' : '') + ewChange.toFixed(1) + 'pp' : '-'}</div>
</div>
<div class="effect-item">
<div class="label">安心包2</div>
<div class="value ${axChange > 0 ? 'up' : (axChange < 0 ? 'down' : '')}">${axChange !== null && axChange !== undefined ? (axChange > 0 ? '+' : '') + axChange.toFixed(1) + 'pp' : '-'}</div>
</div>
<div class="effect-item">
<div class="label">电池2</div>
<div class="value ${batteryChange > 0 ? 'up' : (batteryChange < 0 ? 'down' : '')}">${batteryChange !== null && batteryChange !== undefined ? (batteryChange > 0 ? '+' : '') + batteryChange.toFixed(1) + 'pp' : '-'}</div>
</div>
</div>`;
}
function render(data) {
const s = data.strategy || {};
const store = data.store || {};
const effect = data.effect || {};
const weeks = data.weekly_breakdown || [];
const comp = data.before_after;
const opMode = store.operation_mode || '';
const modeTagClass = opMode.includes('直营') ? 'tag-direct' : 'tag-franchise';
document.getElementById('detail-container').innerHTML = `
<div class="left-panel">
<div class="card">
<div class="card-header">门店信息</div>
<div class="card-body">
<div class="info-row"><span class="info-label">门店</span><span class="info-value">${escapeHtml(s.merchant_name || '-')}</span></div>
<div class="info-row"><span class="info-label">兜底指标</span><span class="info-value"><span class="tag tag-baodi">${escapeHtml(data.baodi_type || '交付')}</span></span></div>
<div class="info-row"><span class="info-label">兜底类型</span><span class="info-value">${escapeHtml(data.baodi_type || '交付')}</span></div>
<div class="info-row"><span class="info-label">特殊情况1</span><span class="info-value">-</span></div>
<div class="info-row"><span class="info-label">特殊情况2</span><span class="info-value">-</span></div>
<div class="info-row"><span class="info-label">区域(省)</span><span class="info-value">${escapeHtml(store.province || '-')}</span></div>
<div class="info-row"><span class="info-label">直营/加盟</span><span class="info-value"><span class="tag ${modeTagClass}">${escapeHtml(opMode || '-')}</span></span></div>
<div class="info-row"><span class="info-label">区域运营</span><span class="info-value">-</span></div>
<div class="info-row"><span class="info-label">飞行督导</span><span class="info-value">-</span></div>
<div class="info-row"><span class="info-label">线上运营</span><span class="info-value">-</span></div>
</div>
</div>
<div class="card">
<div class="card-header">盯防信息</div>
<div class="card-body">
<div class="info-row"><span class="info-label">盯防类型</span><span class="info-value"><span class="tag ${getMonitorClass(data.monitor_type)}">${escapeHtml(data.monitor_type || '-')}</span></span></div>
<div class="info-row"><span class="info-label">盯防标题</span><span class="info-value">${escapeHtml(s.title || '-')}</span></div>
<div class="info-row"><span class="info-label">盯防内容</span><span class="info-value">${escapeHtml(s.description || '-')}</span></div>
<div class="info-row"><span class="info-label">盯防周期</span><span class="info-value">${escapeHtml(s.start_date || '')} ~ ${escapeHtml(s.end_date || '')}</span></div>
<div class="info-row"><span class="info-label">数据刷新时间</span><span class="info-value">${data.monitor_refresh_time ? escapeHtml(data.monitor_refresh_time) : '<span style="color:#f5222d">从未刷新</span>'}</span></div>
<div class="info-row"><span class="info-label">任务接收人</span><span class="info-value">${escapeHtml(s.created_by || '-')}</span></div>
</div>
</div>
<div class="card">
<div class="card-header">盯防效果摘要</div>
<div class="card-body">
${renderEffectSummary(effect, comp)}
</div>
</div>
</div>
<div class="right-panel">
<div class="card">
<div class="card-header">
<span>业绩数据明细</span>
<span class="card-subtitle">兜底指标:交付数 | 盯防周期:${escapeHtml(s.start_date || '')} ~ ${escapeHtml(s.end_date || '')}</span>
</div>
<div class="card-body" style="padding:0">
${renderWeeklyTable(weeks, comp)}
</div>
</div>
<div class="card">
<div class="card-header">盯防前后业绩对比</div>
<div class="card-body">
${renderComparison(comp)}
</div>
</div>
<div class="card">
<div class="card-header">转化率周趋势</div>
<div class="card-body">
<div class="chart-container">${renderTrendChart(weeks)}</div>
</div>
</div>
<div class="card">
<div class="card-header">分析结论</div>
<div class="card-body">
<div class="conclusion">${escapeHtml(data.conclusion || '暂无分析结论')}</div>
</div>
</div>
</div>
`;
}
async function loadDetail() {
const params = new URLSearchParams(window.location.search);
const id = params.get('id');
if (!id) {
document.getElementById('detail-container').innerHTML = '<div class="error-tip">缺少策略 ID</div>';
return;
}
try {
const res = await fetch(window.API_BASE + '/strategy/' + id);
const json = await res.json();
if (json.status !== 'success') throw new Error(json.detail || '加载失败');
render(json.data);
} catch (err) {
document.getElementById('detail-container').innerHTML = '<div class="error-tip">加载失败: ' + escapeHtml(err.message) + '</div>';
}
}
document.addEventListener('DOMContentLoaded', loadDetail);
</script>
<script src="./static/js/auth.js"></script>
</body>
</html>