index.html
16.8 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
<!DOCTYPE html>
<!--
文件名: app/templates/index.html
职责: WebUI 主页面结构,提供任务控制、数据查询、文件上传、模板选择等交互界面。
注意: 不要删除这个注释。
-->
<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">
</head>
<body>
<!-- 顶部导航栏 -->
<header>
<div class="logo">问界运营分析平台</div>
<nav class="nav-links">
<div class="nav-item active" data-module="task">任务调度</div>
<div class="nav-item" data-module="catalog">数据目录</div>
<div class="nav-item" data-module="upload">数据上传</div>
<div class="nav-item" data-module="analysis">数据分析</div>
</nav>
<div class="user-info">管理员</div>
</header>
<main>
<!-- 左侧明细导航栏 -->
<aside id="sidebar">
<div class="menu-group">
<div class="menu-title">任务管理</div>
<div class="menu-item active">ODS 同步任务</div>
<div class="menu-item">DWS/DWM/DWA 任务</div>
<div class="menu-item">历史任务查询</div>
</div>
<div class="menu-group">
<div class="menu-title">系统配置</div>
<div class="menu-item">同步元数据</div>
<div class="menu-item">调度设置</div>
</div>
</aside>
<!-- 右侧内容展示区 -->
<section id="content-area">
<div class="card">
<h2 id="content-title">任务调度</h2>
<div id="content-body">
<!-- 任务配置部分 (仅 ODS) -->
<div id="task-config-section" style="display:none; margin-bottom: 30px;">
<h3 style="margin-bottom:15px; font-size: 16px; color: #666;">定时任务配置</h3>
<div class="config-grid" style="display: grid; grid-template-columns: repeat(2, 1fr); gap: 15px; background: #f8f9fa; padding: 15px; border-radius: 4px;">
<div><strong>任务ID:</strong> <span id="conf-task-id">-</span></div>
<div><strong>状态:</strong> <span id="conf-status">-</span></div>
<div><strong>下次执行:</strong> <span id="conf-next-run">-</span></div>
<div><strong>触发器:</strong> <span id="conf-trigger">-</span></div>
</div>
<div style="margin-top: 15px;">
<button id="btn-run-ods" style="padding: 8px 16px; background: #1890ff; color: white; border: none; border-radius: 4px; cursor: pointer;">立即同步 ODS</button>
</div>
</div>
<!-- DW 加工控制部分 (DWS/DWM/DWA) -->
<div id="dw-process-section" style="display:none; margin-bottom: 30px; background: #f0f5ff; padding: 20px; border-radius: 8px;">
<h3 style="margin-bottom:15px; font-size: 16px; color: #1890ff;">数据加工控制</h3>
<div style="display: flex; gap: 15px; align-items: center; flex-wrap: wrap;">
<div>
<label>加工层级: </label>
<select id="dw-layer-select" style="padding: 5px;">
<option value="DWS">DWS (宽表层)</option>
<option value="DWM">DWM (指标层)</option>
<option value="DWA">DWA (应用层)</option>
</select>
</div>
<div>
<label>开始日期: </label>
<input type="date" id="dw-start-date" style="padding: 4px;">
</div>
<div>
<label>结束日期: </label>
<input type="date" id="dw-end-date" style="padding: 4px;">
</div>
<div>
<label style="display: flex; align-items: center; gap: 4px; cursor: pointer; font-weight: normal;">
<input type="checkbox" id="dw-full-sync" style="width: 16px; height: 16px;">
全量覆盖
</label>
</div>
<button id="btn-run-dw" style="padding: 6px 20px; background: #52c41a; color: white; border: none; border-radius: 4px; cursor: pointer;">开始加工</button>
</div>
<p style="margin-top: 10px; font-size: 12px; color: #888;">* 提示:默认执行增量同步(最近一天),勾选"全量覆盖"后执行全量覆盖加工。指定日期范围时按日期范围处理。</p>
</div>
<!-- 历史记录部分 -->
<div id="task-history-section" style="display:none;">
<h3 style="margin-bottom:15px; font-size: 16px; color: #666;">执行历史记录</h3>
<table class="data-table" style="width: 100%; border-collapse: collapse;">
<thead>
<tr style="background: #fafafa; border-bottom: 1px solid #f0f0f0;">
<th style="padding: 12px; text-align: left;">开始时间</th>
<th style="padding: 12px; text-align: left;">数据范围</th>
<th style="padding: 12px; text-align: left;">涉及表数</th>
<th style="padding: 12px; text-align: left;">状态</th>
<th style="padding: 12px; text-align: left;">详情</th>
</tr>
</thead>
<tbody id="history-tbody">
<!-- 数据动态加载 -->
</tbody>
</table>
</div>
<!-- 数据上传部分 -->
<div id="data-upload-section" style="display:none;">
<div style="background: #fff; border: 1px dashed #d9d9d9; padding: 30px; text-align: center; border-radius: 8px; margin-bottom: 20px;">
<input type="file" id="excel-file" style="display: none;" accept=".xlsx, .xls">
<div id="drop-zone" style="cursor: pointer;">
<div style="font-size: 40px; color: #1890ff; margin-bottom: 10px;">📤</div>
<p id="file-display-name">点击或将 Excel 文件拖拽到此处上传</p>
<p style="font-size: 12px; color: #999;">支持 .xlsx, .xls 格式</p>
</div>
</div>
<div class="upload-form" style="display: grid; grid-template-columns: 1fr 1fr; gap: 20px; background: #fafafa; padding: 20px; border-radius: 8px;">
<div>
<label style="display: block; margin-bottom: 8px; font-weight: bold;">上传模式:</label>
<select id="upload-mode-select" style="width: 100%; padding: 8px; border: 1px solid #d9d9d9; border-radius: 4px;">
<option value="dynamic">智能分析模式 (LLM 自动识别结构)</option>
<option value="ods">固定表模式 (ODS 层同步)</option>
</select>
</div>
<div id="ods-table-select-div" style="display:none;">
<label style="display: block; margin-bottom: 8px; font-weight: bold;">目标 ODS 表:</label>
<select id="upload-table-name" style="width: 100%; padding: 8px; border: 1px solid #d9d9d9; border-radius: 4px;">
<option value="ods_staff_daily_report_huawei">员工日报华为表 (ODS)</option>
<option value="ods_goods_order">商品订单主表 (ODS)</option>
<option value="ods_host_plant_delivery">主机厂交付数据 (ODS)</option>
</select>
</div>
<div id="dynamic-type-select-div">
<label style="display: block; margin-bottom: 8px; font-weight: bold;">分析数据类型:</label>
<select id="upload-type-select" style="width: 100%; padding: 8px; border: 1px solid #d9d9d9; border-radius: 4px;">
<option value="分析的门店列表">分析的门店列表</option>
<option value="主机厂数据表">主机厂数据表</option>
<option value="赔付方案数据表">赔付方案数据表</option>
</select>
</div>
<div>
<label style="display: block; margin-bottom: 8px; font-weight: bold;">版本标识 (可选):</label>
<input type="text" id="upload-version-tag" placeholder="如: 202406_v1" style="width: 100%; padding: 8px; border: 1px solid #d9d9d9; border-radius: 4px;">
</div>
</div>
<div style="margin-top: 20px; text-align: center;">
<button id="btn-do-upload" style="padding: 10px 40px; background: #52c41a; color: white; border: none; border-radius: 4px; font-size: 16px; cursor: pointer; transition: all 0.3s;">
开始解析并上传
</button>
</div>
<div id="upload-status-tip" style="margin-top: 20px; display: none; padding: 15px; background: #e6f7ff; border: 1px solid #91d5ff; border-radius: 4px;">
<span style="color: #1890ff;">ℹ️ 正在处理中,您可以前往“数据目录”查看已生成的表。</span>
</div>
</div>
<!-- 数据分析部分 -->
<div id="data-analysis-section" style="display:none;">
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px;">
<!-- 步骤1: 上传门店列表 -->
<div style="background: #f8f9fa; padding: 20px; border-radius: 8px; border: 1px solid #e8e8e8;">
<h3 style="margin:0 0 12px; font-size:16px; color:#333;">步骤1: 上传门店列表</h3>
<div id="store-drop-zone" style="border: 1px dashed #d9d9d9; padding: 20px; text-align: center; border-radius: 4px; cursor: pointer; background: #fff;">
<input type="file" id="store-file-input" style="display:none;" accept=".xlsx,.xls">
<div style="font-size:30px; margin-bottom:8px;">🏪</div>
<p id="store-file-name" style="margin:0; font-size:13px; color:#999;">点击选择门店列表文件</p>
<a href="/api/analysis/template/store" style="font-size:12px; color:#1890ff; text-decoration:none; margin-top:8px; display:inline-block;">
📥 下载门店列表模板
</a>
</div>
</div>
<!-- 步骤2: 上传主机厂数据 -->
<div style="background: #f8f9fa; padding: 20px; border-radius: 8px; border: 1px solid #e8e8e8;">
<h3 style="margin:0 0 12px; font-size:16px; color:#333;">步骤2: 上传主机厂数据</h3>
<div id="factory-drop-zone" style="border: 1px dashed #d9d9d9; padding: 20px; text-align: center; border-radius: 4px; cursor: pointer; background: #fff;">
<input type="file" id="factory-file-input" style="display:none;" accept=".xlsx,.xls">
<div style="font-size:30px; margin-bottom:8px;">🏭</div>
<p id="factory-file-name" style="margin:0; font-size:13px; color:#999;">点击选择主机厂数据文件</p>
<p style="font-size:11px; color:#faad14; margin:4px 0;" title="Sheet名称需包含时间范围">⚠ Sheet名包含时间范围(如: (5.26-6.21))</p>
<a href="/api/analysis/template/factory" style="font-size:12px; color:#1890ff; text-decoration:none; margin-top:4px; display:inline-block;">
📥 下载主机厂数据模板
</a>
</div>
</div>
</div>
<!-- 步骤3: 生成报表 -->
<div style="text-align: center; margin: 20px 0;">
<button id="btn-generate-report" style="padding: 12px 48px; background: #1890ff; color: white; border: none; border-radius: 6px; font-size: 16px; cursor: pointer; transition: all 0.3s;">
🚀 开始生成分析报表
</button>
<p style="font-size:12px; color:#999; margin-top:8px;">根据门店数据与主机厂数据,自动计算生态系数并生成Excel报表</p>
<p style="font-size:11px; color:#faad14;">📌 表头参考: <a href="/api/analysis/template/output" style="color:#1890ff;">输出样例</a></p>
</div>
<!-- 生成结果提示 -->
<div id="analysis-result" style="display:none; background: #f6ffed; border: 1px solid #b7eb8f; padding: 20px; border-radius: 8px; text-align: center;">
<h3 style="color:#52c41a; margin:0 0 10px;">✅ 报表生成成功</h3>
<div id="analysis-result-info" style="font-size:13px; color:#666; margin-bottom:15px;"></div>
<a id="btn-download-report" href="/api/analysis/download"
style="display:inline-block; padding: 10px 32px; background: #52c41a; color: white; border: none; border-radius: 4px; font-size: 14px; text-decoration: none; cursor: pointer;">
📥 下载分析报表
</a>
</div>
<div id="analysis-error" style="display:none; background: #fff2f0; border: 1px solid #ffccc7; padding: 20px; border-radius: 8px; text-align: center;">
<h3 style="color:#f5222d; margin:0 0 10px;">❌ 报表生成失败</h3>
<p id="analysis-error-msg" style="margin:0; color:#666;"></p>
</div>
</div>
<div id="welcome-message">
<p>欢迎来到问界门店运营数据分析平台。请从左侧选择具体功能进行操作。</p>
</div>
</div>
</div>
</section>
</main>
<!-- 任务详情弹窗 (Modal) -->
<div id="detail-modal" class="modal">
<div class="modal-content">
<div class="modal-header">
<h3>任务执行详情</h3>
<span class="close-btn" onclick="closeModal()">×</span>
</div>
<div class="modal-body">
<table class="detail-table">
<thead>
<tr>
<th>源表/内容</th>
<th>目标表</th>
<th>时间范围</th>
<th>影响行数</th>
<th>状态</th>
</tr>
</thead>
<tbody id="detail-tbody">
<!-- 动态渲染 -->
</tbody>
</table>
</div>
</div>
</div>
<script src="/static/js/app.js"></script>
</body>
</html>