index.html
13.4 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
<!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-section="ods">ODS 同步任务</div>
<div class="nav-item" data-section="dw">DWS/DWM/DWA 任务</div>
<div class="nav-item" data-section="analysis-modal">模板分析</div>
</nav>
<div class="user-info">管理员</div>
</header>
<main>
<!-- 全宽内容展示区(左侧边栏已移除) -->
<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-analysis-section" style="display:none;">
<div style="display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px;">
<!-- 步骤1: 上传门店列表 -->
<div style="background: #f8f9fa; padding: 8px 16px; border-radius: 6px; border: 1px solid #e8e8e8; display: flex; align-items: center; gap: 16px;">
<span style="font-size:14px; font-weight:600; color:#333; white-space:nowrap;">步骤1: 门店列表</span>
<div id="store-drop-zone" style="flex:1; border: 1px dashed #d9d9d9; padding: 6px 12px; border-radius: 4px; cursor: pointer; background: #fff; display: flex; align-items: center; gap: 8px;">
<input type="file" id="store-file-input" style="display:none;" accept=".xlsx,.xls">
<span style="font-size:16px;">🏪</span>
<p id="store-file-name" style="margin:0; font-size:13px; color:#999;">点击选择门店列表文件</p>
</div>
<a href="api/analysis/template/store" style="font-size:12px; color:#1890ff; text-decoration:none; white-space:nowrap;">📥 下载模板</a>
</div>
<!-- 步骤2: 生态主机厂数据(26日周期) -->
<div style="background: #f8f9fa; padding: 8px 16px; border-radius: 6px; border: 1px solid #e8e8e8; display: flex; align-items: center; gap: 12px;">
<span style="font-size:14px; font-weight:600; color:#333; white-space:nowrap;">步骤2: 生态(26日)</span>
<div id="ecology-drop-zone" style="border: 1px dashed #d9d9d9; padding: 6px 12px; border-radius: 4px; cursor: pointer; background: #fff; display: flex; align-items: center; gap: 8px;">
<input type="file" id="ecology-factory-input" style="display:none;" accept=".xlsx,.xls">
<span style="font-size:16px;">🏭</span>
<p id="ecology-file-name" style="margin:0; font-size:12px; color:#999;">点击选择生态主机厂数据</p>
</div>
<input type="date" id="ecology-start-date" style="width:130px; padding: 4px 6px; border: 1px solid #d9d9d9; border-radius: 4px; font-size:12px;" placeholder="开始">
<span style="color:#999; font-size:12px;">~</span>
<input type="date" id="ecology-end-date" style="width:130px; padding: 4px 6px; border: 1px solid #d9d9d9; border-radius: 4px; font-size:12px;" placeholder="结束">
</div>
<!-- 步骤3: 自然月主机厂数据(1日周期) -->
<div style="background: #f8f9fa; padding: 8px 16px; border-radius: 6px; border: 1px solid #e8e8e8; display: flex; align-items: center; gap: 12px;">
<span style="font-size:14px; font-weight:600; color:#333; white-space:nowrap;">步骤3: 自然月(1日)</span>
<div id="nature-drop-zone" style="border: 1px dashed #d9d9d9; padding: 6px 12px; border-radius: 4px; cursor: pointer; background: #fff; display: flex; align-items: center; gap: 8px;">
<input type="file" id="nature-factory-input" style="display:none;" accept=".xlsx,.xls">
<span style="font-size:16px;">📅</span>
<p id="nature-file-name" style="margin:0; font-size:12px; color:#999;">点击选择自然月主机厂数据</p>
</div>
<input type="date" id="nature-start-date" style="width:130px; padding: 4px 6px; border: 1px solid #d9d9d9; border-radius: 4px; font-size:12px;" placeholder="开始">
<span style="color:#999; font-size:12px;">~</span>
<input type="date" id="nature-end-date" style="width:130px; padding: 4px 6px; border: 1px solid #d9d9d9; border-radius: 4px; font-size:12px;" placeholder="结束">
</div>
</div>
<!-- 步骤4: 生成报表 -->
<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;">门店按兜底截止日期分组:月底/25日→生态数据sheet,其余→自然月sheet</p>
<p style="font-size:11px; color:#faad14;">📌 使用模板: 输出-问界生态系数-模板.xlsx</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>