index.html 55 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919
  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>智慧运营中台</title>
  7. <link rel="icon" href="/assets/logo.png">
  8. <link rel="stylesheet" href="/style.css">
  9. </head>
  10. <body>
  11. <!-- Splash Screen -->
  12. <div class="splash" id="splash">
  13. <img src="/assets/logo.png" alt="智慧运营中台" class="splash-logo">
  14. <div class="splash-name">智慧运营中台</div>
  15. <div class="splash-sub">淘宝闪购专业版</div>
  16. <div class="splash-bar"><span></span></div>
  17. <div class="splash-powered">
  18. <span>powered by</span>
  19. <img src="/assets/powered-by.png" alt="Hyreal IDE">
  20. </div>
  21. </div>
  22. <div class="app-frame">
  23. <aside class="sidebar">
  24. <div class="sidebar-brand">
  25. <div class="sidebar-logo"><img src="/assets/logo.png" alt="门"></div>
  26. <div class="sidebar-titles">
  27. <div class="t1">智慧运营中台</div>
  28. <div class="t2">淘宝闪购专业版</div>
  29. </div>
  30. </div>
  31. <div class="nav-section-label">门店装修</div>
  32. <button class="nav-item active" data-view="crawl"><span class="ico"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 6h16M4 12h10M4 18h16"/></svg></span><span>门店采集</span></button>
  33. <button class="nav-item" data-view="gen"><span class="ico"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 3l1.8 4.9L19 9.7l-4.3 3 1.2 5.3-3.9-3-3.9 3 1.2-5.3-4.3-3 5.2-1.8z"/></svg></span><span>视觉生成</span></button>
  34. <button class="nav-item" data-view="tasks"><span class="ico"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 7h10M4 12h16M4 17h7"/><circle cx="18" cy="7" r="2"/><circle cx="15" cy="17" r="2"/></svg></span><span>任务中心</span></button>
  35. <button class="nav-item" data-view="history"><span class="ico"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="4" width="18" height="16" rx="3"/><circle cx="9" cy="10" r="1.8"/><path d="M21 16l-5-5-6 6"/></svg></span><span>历史创作</span></button>
  36. <div class="nav-section-label">经营分析</div>
  37. <button class="nav-item" data-view="reports"><span class="ico"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 3v12"/><path d="M7 10l5 5 5-5"/><path d="M4 21h16"/></svg></span><span>数据采集</span></button>
  38. <button class="nav-item" data-view="lake"><span class="ico"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><ellipse cx="12" cy="5" rx="7" ry="2.5"/><path d="M5 5v6c0 1.4 3.1 2.5 7 2.5s7-1.1 7-2.5V5"/><path d="M5 11v6c0 1.4 3.1 2.5 7 2.5s7-1.1 7-2.5v-6"/></svg></span><span>数据中台</span></button>
  39. <button class="nav-item" data-view="analysis"><span class="ico"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 17l5-6 4 3 5-8 4 5"/><path d="M3 21h18"/></svg></span><span>趋势图表</span></button>
  40. <div class="nav-section-label">设置</div>
  41. <button class="nav-item" data-view="settings"><span class="ico"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.7 1.7 0 0 0 .34 1.87l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06A1.7 1.7 0 0 0 15 19.4a1.7 1.7 0 0 0-1 1.55V21a2 2 0 1 1-4 0v-.05A1.7 1.7 0 0 0 9 19.4a1.7 1.7 0 0 0-1.87.34l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06A1.7 1.7 0 0 0 4.6 15a1.7 1.7 0 0 0-1.55-1H3a2 2 0 1 1 0-4h.05A1.7 1.7 0 0 0 4.6 9a1.7 1.7 0 0 0-.34-1.87l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06A1.7 1.7 0 0 0 9 4.6h.09A1.7 1.7 0 0 0 10 3.05V3a2 2 0 1 1 4 0v.05A1.7 1.7 0 0 0 15 4.6a1.7 1.7 0 0 0 1.87-.34l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06A1.7 1.7 0 0 0 19.4 9v.09a1.7 1.7 0 0 0 1.55.91H21a2 2 0 1 1 0 4h-.05a1.7 1.7 0 0 0-1.55 1z"/></svg></span><span>系统设置</span></button>
  42. <button class="nav-item" data-view="logs"><span class="ico"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 5h16v11H8l-4 4Z"/><path d="M8 9h8M8 12h5"/></svg></span><span>系统日志</span></button>
  43. <div class="sidebar-bottom">
  44. <span>v1.0.0</span>
  45. <img src="/assets/powered-by.png" alt="Hyreal IDE" class="sidebar-powered">
  46. </div>
  47. </aside>
  48. <div class="main-wrap">
  49. <!-- ==================== 门店采集 ==================== -->
  50. <div id="viewCrawl" class="view active">
  51. <main class="content">
  52. <div class="page-header">
  53. <div>
  54. <h1>门店采集</h1>
  55. <div class="sub">从淘宝闪购后台按店铺批量采集菜品图,用于后续视觉美化</div>
  56. </div>
  57. </div>
  58. <div class="crawl-grid">
  59. <div class="left-col">
  60. <div class="panel panel-narrow panel-designed">
  61. <div class="stage-marker"><span class="stage-icon"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 7h16M4 17h16"/><circle cx="9" cy="7" r="2.2"/><circle cx="15" cy="17" r="2.2"/></svg></span><span>抓取设置</span></div>
  62. <span class="panel-watermark"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 3a9 9 0 1 0 0 18 9 9 0 0 0 0-18Z"/><path d="M12 8v4l3 2"/></svg></span>
  63. <div class="panel-body">
  64. <div class="field">
  65. <label>抓取内容</label>
  66. <select disabled><option>菜品图片 + 名称</option></select>
  67. </div>
  68. <button class="collapse-trigger" id="advToggle" aria-expanded="false">
  69. <span>高级设置</span><span class="chev"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M9 6l6 6-6 6"/></svg></span>
  70. </button>
  71. <div id="advBody" class="collapse">
  72. <div style="padding-top:12px;display:flex;flex-direction:column;gap:12px;">
  73. <label style="display:flex;align-items:center;gap:6px;font-size:13px;cursor:pointer;">
  74. <input type="checkbox" id="forceFullCrawl">
  75. <span>强制全量抓取(覆盖已有图片)</span>
  76. </label>
  77. </div>
  78. </div>
  79. </div>
  80. </div>
  81. <button class="btn btn-primary btn-block" id="startBtn">
  82. <span id="startBtnIcon"><svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M8 5v14l11-7z"/></svg></span>
  83. <span id="startBtnText">开始抓取</span>
  84. </button>
  85. <button class="btn btn-danger btn-block" id="stopBtn" disabled style="display:none;"><svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><rect x="6" y="6" width="12" height="12" rx="2"/></svg><span>停止</span></button>
  86. <div class="panel panel-fixed panel-progress">
  87. <div class="panel-title">
  88. <span>进度列表</span>
  89. <span class="actions"><span class="badge" id="crawlStatusBadge"></span></span>
  90. </div>
  91. <div id="progressList"></div>
  92. </div>
  93. </div>
  94. <div class="right-col">
  95. <div class="panel panel-fixed panel-shops">
  96. <div class="panel-title">
  97. <span>店铺清单</span>
  98. <span class="actions">
  99. <span class="badge badge-info" id="shopCount">0 家</span>
  100. <button class="btn btn-ghost btn-small" id="btnToggleAdd">+ 添加店铺</button>
  101. </span>
  102. </div>
  103. <div style="overflow-x:auto;">
  104. <table class="data-table">
  105. <thead>
  106. <tr>
  107. <th style="width:36px;"><input type="checkbox" id="selectAllCb"></th>
  108. <th style="min-width:220px;">店铺</th>
  109. <th style="width:100px;">shopId</th>
  110. <th style="width:100px;">状态</th>
  111. <th style="width:220px;">文件夹</th>
  112. </tr>
  113. </thead>
  114. <tbody id="shopTableBody"></tbody>
  115. </table>
  116. <div id="shopTableEmpty" class="empty-hint">
  117. <div class="empty-icon"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="5" y="4" width="14" height="17" rx="2"/><path d="M9 4a3 3 0 0 1 6 0"/><path d="M9 10h6M9 14h6M9 18h4"/></svg></div>
  118. <p>尚无店铺<br><small>点击右上角「+ 添加店铺」手动录入</small></p>
  119. </div>
  120. </div>
  121. </div>
  122. </div>
  123. </div>
  124. </main>
  125. </div>
  126. <!-- ==================== 视觉生成 ==================== -->
  127. <div id="viewGen" class="view">
  128. <main class="content">
  129. <div class="page-header">
  130. <div>
  131. <h1>视觉生成</h1>
  132. <div class="sub">基于已采集的菜品图片,批量生成 LOGO / 海报 / 招牌 / 贴纸 + 菜品图</div>
  133. </div>
  134. <div class="toolbar">
  135. <button class="btn btn-ghost btn-small" id="btnRefreshGen">
  136. <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M20 12a8 8 0 1 1-2.3-5.6"/><path d="M20 4v5h-5"/></svg>
  137. 刷新
  138. </button>
  139. </div>
  140. </div>
  141. <div class="gen-overview">
  142. <div class="stats-grid" id="statsBar">
  143. <div class="metric accent"><span class="metric-icon"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 20V9l8-5 8 5v11"/><path d="M9 20v-6h6v6"/></svg></span><span class="metric-body"><span class="metric-label">店铺</span><span class="metric-value" id="statShops">—</span><span class="stat-delta" id="statShopsDelta"></span></span></div>
  144. <div class="metric ok"><span class="metric-icon"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12.5l4.5 4.5L19 7.5"/></svg></span><span class="metric-body"><span class="metric-label">已生成</span><span class="metric-value" id="statDone">—</span><span class="stat-delta" id="statDoneDelta"></span></span></div>
  145. <div class="metric warn"><span class="metric-icon"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M7 3h10M7 21h10"/><path d="M8 3c0 8 8 8 8 18M16 3c0 8-8 8-8 18"/></svg></span><span class="metric-body"><span class="metric-label">待处理</span><span class="metric-value" id="statPending">—</span><span class="stat-delta" id="statPendingDelta"></span></span></div>
  146. <div class="metric fail"><span class="metric-icon"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="9"/><path d="M12 7v6M12 16.5v.5"/></svg></span><span class="metric-body"><span class="metric-label">失败</span><span class="metric-value" id="statFail">—</span><span class="stat-delta" id="statFailDelta"></span></span></div>
  147. </div>
  148. <div class="gen-controls">
  149. <div class="field">
  150. <label>扫描范围</label>
  151. <div class="scan-dropdown" id="scanDropdown">
  152. <button type="button" class="scan-dropdown-trigger" id="scanDropdownTrigger" aria-expanded="false" aria-haspopup="listbox">
  153. <span id="scanDropdownText">全量扫描</span>
  154. <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 9l6 6 6-6"/></svg>
  155. </button>
  156. <div class="scan-dropdown-menu" id="scanDropdownMenu" role="listbox" aria-multiselectable="true" hidden></div>
  157. </div>
  158. </div>
  159. <button class="btn btn-primary" id="scanBtn">
  160. <span id="scanIcon"><svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M8 5v14l11-7z"/></svg></span>
  161. <span id="scanText">扫描店铺</span>
  162. </button>
  163. </div>
  164. </div>
  165. <div class="shop-cards" id="shopList"></div>
  166. </main>
  167. </div>
  168. <!-- ==================== 历史创作 ==================== -->
  169. <div id="viewTasks" class="view">
  170. <main class="content">
  171. <div class="page-header">
  172. <div>
  173. <h1>任务中心</h1>
  174. <div class="sub">跟踪生成任务状态,服务重启后可恢复进行中的生成任务</div>
  175. </div>
  176. <div class="toolbar">
  177. <button class="btn btn-ghost btn-small" id="btnRefreshTasks">
  178. <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M20 12a8 8 0 1 1-2.3-5.6"/><path d="M20 4v5h-5"/></svg>
  179. 刷新
  180. </button>
  181. </div>
  182. </div>
  183. <div class="tasks-overview panel panel-designed">
  184. <span class="panel-watermark"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 7h10M4 12h16M4 17h7"/><circle cx="18" cy="7" r="2"/><circle cx="15" cy="17" r="2"/></svg></span>
  185. <div class="tasks-stats">
  186. <div class="task-stat"><span>全部</span><strong id="taskCountAll">0</strong></div>
  187. <div class="task-stat running"><span>进行中</span><strong id="taskCountRunning">0</strong></div>
  188. <div class="task-stat queued"><span>排队</span><strong id="taskCountQueued">0</strong></div>
  189. <div class="task-stat success"><span>成功</span><strong id="taskCountSuccess">0</strong></div>
  190. <div class="task-stat failed"><span>失败</span><strong id="taskCountFailed">0</strong></div>
  191. </div>
  192. <div class="tasks-filters" id="taskFilters">
  193. <button class="history-filter active" data-filter="all">全部</button>
  194. <button class="history-filter" data-filter="running">进行中</button>
  195. <button class="history-filter" data-filter="queued">排队中</button>
  196. <button class="history-filter" data-filter="success">已完成</button>
  197. <button class="history-filter" data-filter="failed">失败</button>
  198. </div>
  199. </div>
  200. <div class="history-summary" id="taskSummary">正在加载任务…</div>
  201. <div class="task-list" id="taskList"></div>
  202. </main>
  203. </div>
  204. <!-- ==================== 历史创作 ==================== -->
  205. <div id="viewHistory" class="view">
  206. <main class="content">
  207. <div class="page-header">
  208. <div>
  209. <h1>历史创作</h1>
  210. <div class="sub">以图片墙回顾已生成的品牌物料与菜品作品</div>
  211. </div>
  212. <div class="toolbar">
  213. <button class="btn btn-ghost btn-small" id="btnRefreshHistory">
  214. <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M20 12a8 8 0 1 1-2.3-5.6"/><path d="M20 4v5h-5"/></svg>
  215. 刷新
  216. </button>
  217. </div>
  218. </div>
  219. <div class="history-toolbar panel">
  220. <div class="history-search">
  221. <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="11" cy="11" r="6.5"/><path d="M20 20l-4.2-4.2"/></svg>
  222. <input type="text" id="historySearch" placeholder="搜索门店或作品名称">
  223. </div>
  224. <div class="history-filters" id="historyFilters">
  225. <button class="history-filter active" data-filter="all">全部</button>
  226. <button class="history-filter" data-filter="logo">LOGO</button>
  227. <button class="history-filter" data-filter="banner">海报</button>
  228. <button class="history-filter" data-filter="signage">招牌</button>
  229. <button class="history-filter" data-filter="sticker">贴纸</button>
  230. <button class="history-filter" data-filter="dish">菜品</button>
  231. </div>
  232. </div>
  233. <div class="history-summary" id="historySummary">加载中…</div>
  234. <div class="history-gallery" id="historyGallery"></div>
  235. </main>
  236. </div>
  237. <!-- ==================== 数据采集 ==================== -->
  238. <div id="viewReports" class="view">
  239. <main class="content">
  240. <div class="page-header">
  241. <div>
  242. <h1>数据采集</h1>
  243. <div class="sub">同步控制台:连接商家客户端、按区间取数入库、推送云端主档案</div>
  244. </div>
  245. <div class="toolbar">
  246. <span class="conn-help-wrap">
  247. <span class="badge badge-info" id="reportConnBadge">检测连接…</span>
  248. <button type="button" class="help-btn" id="btnClientHelp" title="客户端连接排查" aria-expanded="false">?</button>
  249. <div class="help-popover" id="clientHelpPopover" hidden>
  250. <div class="help-popover-title">客户端连接排查</div>
  251. <ol class="help-popover-steps">
  252. <li><b>验证调试端口:</b>客户端带参启动后,浏览器打开 <code>http://127.0.0.1:9669/json/version</code> —— 看到一段 JSON(含 "Browser")就是通的;打不开就是客户端没带参。</li>
  253. <li><b>macOS 带参启动:</b>⌘Q 完全退出客户端(活动监视器确认进程没了)→ 终端执行:<code>open -a "淘宝闪购商家版" --args --remote-debugging-port=9669</code></li>
  254. <li><b>Windows 带参启动:</b>任务栏右键完全退出(任务管理器确认)→ 右键快捷方式 → 属性 → 「目标」末尾加 <code>--remote-debugging-port=9669</code> → 以后都用这个快捷方式启动。</li>
  255. <li>回到本页点「刷新」,徽章变「客户端已连接」后同步即可。若同步弹窗报 <code>Failed to fetch</code>,先确认服务在跑(启动窗口未关闭)。</li>
  256. </ol>
  257. <div class="help-popover-note">注意:客户端每次重启都必须带参启动,否则端口不会开启。</div>
  258. </div>
  259. </span>
  260. <button class="btn btn-ghost btn-small" id="btnReportRefresh">
  261. <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M20 12a8 8 0 1 1-2.3-5.6"/><path d="M20 4v5h-5"/></svg>
  262. 刷新
  263. </button>
  264. <button class="btn btn-primary btn-small" id="btnOpenSync">
  265. <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 3v12"/><path d="M7 10l5 5 5-5"/><path d="M4 21h16"/></svg>
  266. 同步数据
  267. </button>
  268. </div>
  269. </div>
  270. <div id="entityTabs"></div>
  271. <div class="panel panel-fixed" id="syncHistoryPanel">
  272. <div class="panel-title">
  273. <span>同步历史</span>
  274. <span class="actions">
  275. <span class="badge" id="reportPushBadge">云端未启用</span>
  276. <button class="btn btn-primary btn-small" id="btnReportPush">
  277. <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 21V9"/><path d="M7 14l5-5 5 5"/><path d="M4 3h16"/></svg>
  278. 推送云端
  279. </button>
  280. </span>
  281. </div>
  282. <div class="table-wrap">
  283. <table class="data-table">
  284. <thead><tr><th>时间</th><th>区间</th><th>范围</th><th>新增</th><th>更新</th><th>失败</th><th>备注</th><th>云端</th></tr></thead>
  285. <tbody id="syncHistoryRows"><tr><td colspan="8" class="empty-cell">暂无同步记录</td></tr></tbody>
  286. </table>
  287. </div>
  288. </div>
  289. </main>
  290. </div>
  291. <!-- ==================== 数据中台 ==================== -->
  292. <div id="viewLake" class="view">
  293. <main class="content">
  294. <div class="page-header">
  295. <div>
  296. <h1>数据中台</h1>
  297. <div class="sub">本地数据湖全景与明细数据(含全部原始字段),可从云端拉取补全</div>
  298. </div>
  299. <div class="toolbar">
  300. <button class="btn btn-ghost btn-small" id="btnLakeRefresh">
  301. <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M20 12a8 8 0 1 1-2.3-5.6"/><path d="M20 4v5h-5"/></svg>
  302. 刷新
  303. </button>
  304. <button class="btn btn-primary btn-small" id="btnLakePull" title="以钉钉 AI 表格(云端主档案)为准,拉回本地湖;未注册的账号自动创建主体">
  305. <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 3v12"/><path d="M7 10l5 5 5-5"/><path d="M4 21h16"/></svg>
  306. 从云端拉取
  307. </button>
  308. <span class="badge" id="lakeSyncBadge"></span>
  309. </div>
  310. </div>
  311. <div class="seg-control lake-tabs" id="lakeTabs" role="tablist">
  312. <button type="button" class="active" data-tab="overview">湖全景</button>
  313. <button type="button" data-tab="detail">明细数据</button>
  314. </div>
  315. <div id="lakeTabOverview">
  316. <div class="stats-grid" id="lakeKpis">
  317. <div class="metric"><span class="metric-body"><span class="metric-label">数据主体</span><span class="metric-value" id="lakeEntityCount">–</span><span class="metric-sub">已注册的商家账号</span></span></div>
  318. <div class="metric"><span class="metric-body"><span class="metric-label">湖内总行数</span><span class="metric-value" id="lakeRowCount">–</span><span class="metric-sub">按 日期×维度×门店 幂等去重</span></span></div>
  319. <div class="metric"><span class="metric-body"><span class="metric-label">日期覆盖</span><span class="metric-value" id="lakeCoverage">–</span><span class="metric-sub">最早 ~ 最晚(后台约 180 天)</span></span></div>
  320. <div class="metric"><span class="metric-body"><span class="metric-label">最近同步</span><span class="metric-value" id="lakeLastSync">–</span><span class="metric-sub">取数写入本地湖的时间</span></span></div>
  321. </div>
  322. <div class="panel panel-fixed report-table-panel">
  323. <div class="panel-title">
  324. <span>主体明细</span>
  325. <span class="actions">
  326. <span class="badge badge-info" id="lakeRowsBadge">0 主体</span>
  327. <span class="conn-help-wrap">
  328. <button type="button" class="help-btn" id="btnLakeHelp" title="多机数据与云端同步规则" aria-expanded="false">?</button>
  329. <div class="help-popover" id="lakeHelpPopover" hidden>
  330. <div class="help-popover-title">多机与云端同步规则</div>
  331. <ol class="help-popover-steps">
  332. <li><b>不产生重复:</b>每一行的身份是「日期×账号×维度×门店」,多台电脑写同一行只会覆盖,不会重复。</li>
  333. <li><b>数据新者胜:</b>推送时对比本地取数时间与云端修改时间,旧数据不会覆盖云端新数据(跳过并计数)。</li>
  334. <li><b>全零拦截:</b>大批量指标全零(疑似取数异常)时拒绝推送,防止坏数据污染云端主档案。</li>
  335. <li><b>拉取以云端为准:</b>其他电脑「从云端拉取」后,本地同键行被云端版本覆盖。</li>
  336. </ol>
  337. </div>
  338. </span>
  339. </span>
  340. </div>
  341. <div class="table-wrap">
  342. <table class="data-table">
  343. <thead>
  344. <tr>
  345. <th>账号名</th><th>门店/连锁</th><th>总行数</th><th>公司</th><th>连锁</th><th>门店</th><th>汇总</th><th>覆盖区间</th><th>最近同步</th><th>上次推送云端</th>
  346. </tr>
  347. </thead>
  348. <tbody id="lakeEntityRows">
  349. <tr><td colspan="10" class="empty-cell">加载中…</td></tr>
  350. </tbody>
  351. </table>
  352. </div>
  353. </div>
  354. </div>
  355. <div id="lakeTabDetail" hidden>
  356. <div id="lakeEntityTabs"></div>
  357. <div class="report-toolbar panel">
  358. <div class="field report-field-sm">
  359. <label>日期范围</label>
  360. <select id="reportRangePreset">
  361. <option value="1">昨日</option>
  362. <option value="7">近 7 天</option>
  363. <option value="30" selected>近 30 天</option>
  364. <option value="90">近 90 天</option>
  365. <option value="custom">自定义</option>
  366. </select>
  367. </div>
  368. <div class="field report-field-md" id="reportCustomRange" hidden>
  369. <label>起止日期</label>
  370. <div class="report-date-range">
  371. <input type="date" id="reportFromDate">
  372. <span>–</span>
  373. <input type="date" id="reportToDate">
  374. </div>
  375. </div>
  376. <div class="field report-field-lg">
  377. <label>门店</label>
  378. <div class="scan-dropdown" id="reportShopDropdown">
  379. <button type="button" class="scan-dropdown-trigger" id="reportShopTrigger" aria-expanded="false" aria-haspopup="listbox">
  380. <span id="reportShopText">全部门店</span>
  381. <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 9l6 6 6-6"/></svg>
  382. </button>
  383. <div class="scan-dropdown-menu" id="reportShopMenu" role="listbox" aria-multiselectable="true" hidden></div>
  384. </div>
  385. </div>
  386. <div class="field">
  387. <label>视图</label>
  388. <div class="seg-control" id="reportViewModes" role="tablist">
  389. <button type="button" class="active" data-mode="detail">明细</button>
  390. <button type="button" data-mode="shop">按门店</button>
  391. <button type="button" data-mode="date">按日期</button>
  392. </div>
  393. </div>
  394. <div class="field report-field-grow">
  395. <label>搜索门店</label>
  396. <input type="text" id="reportSearch" placeholder="输入门店名称过滤">
  397. </div>
  398. <div class="field">
  399. <label>字段</label>
  400. <div class="seg-control" id="reportFieldModes" role="tablist">
  401. <button type="button" class="active" data-fields="report">报表列</button>
  402. <button type="button" data-fields="all">全部字段</button>
  403. </div>
  404. </div>
  405. <div class="report-toolbar-actions">
  406. <button class="btn btn-ghost btn-small" id="btnColumnCfg">列设置</button>
  407. <button class="btn btn-ghost btn-small" id="btnExportCsv">导出 CSV</button>
  408. </div>
  409. </div>
  410. <div class="panel panel-fixed report-table-panel">
  411. <div class="panel-title">
  412. <span>报表数据</span>
  413. <span class="actions"><span class="badge badge-info" id="reportRowCount">0 行</span></span>
  414. </div>
  415. <div class="report-table-wrap" id="reportTableWrap">
  416. <table class="data-table report-table" id="reportTable">
  417. <thead id="reportTableHead"></thead>
  418. <tbody id="reportTableBody"></tbody>
  419. </table>
  420. <div id="reportEmpty" class="empty-hint" hidden>
  421. <div class="empty-icon"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 20V11M10 20V4M16 20v-6M2.5 20h19"/></svg></div>
  422. <p id="reportEmptyText">暂无数据<br><small>请确认商家客户端已登录,然后点击右上角「同步数据」</small></p>
  423. </div>
  424. </div>
  425. <div class="report-pager" id="reportPager"></div>
  426. </div>
  427. </div>
  428. </main>
  429. </div>
  430. <!-- ==================== 趋势图表 ==================== -->
  431. <div id="viewAnalysis" class="view">
  432. <main class="content">
  433. <div class="page-header">
  434. <div>
  435. <h1>趋势图表</h1>
  436. <div class="sub">主指标趋势 · 门店对比 · 转化漏斗,支持环比;有疑问点右下角问数助手</div>
  437. </div>
  438. <div class="toolbar">
  439. <button class="btn btn-ghost btn-small" id="btnExportHtml">
  440. <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 3v12"/><path d="M7 10l5 5 5-5"/><path d="M4 21h16"/></svg>
  441. 导出周报
  442. </button>
  443. </div>
  444. </div>
  445. <div id="analysisEntityTabs"></div>
  446. <div class="report-toolbar panel">
  447. <div class="field report-field-sm">
  448. <label>日期范围</label>
  449. <select id="analysisRangePreset">
  450. <option value="1">昨日</option>
  451. <option value="7">近 7 天</option>
  452. <option value="30" selected>近 30 天</option>
  453. <option value="90">近 90 天</option>
  454. </select>
  455. </div>
  456. <div class="field report-field-lg">
  457. <label>门店</label>
  458. <div class="scan-dropdown" id="anaShopDropdown">
  459. <button type="button" class="scan-dropdown-trigger" id="anaShopTrigger" aria-expanded="false" aria-haspopup="listbox">
  460. <span id="anaShopText">全部门店</span>
  461. <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 9l6 6 6-6"/></svg>
  462. </button>
  463. <div class="scan-dropdown-menu" id="anaShopMenu" role="listbox" aria-multiselectable="true" hidden></div>
  464. </div>
  465. </div>
  466. <div class="field report-field-sm">
  467. <label>主指标</label>
  468. <select id="chartMetric" class="chart-metric-select"></select>
  469. </div>
  470. <label class="ana-compare-toggle" title="主趋势图中叠加上一周期的虚线对照">
  471. <input type="checkbox" id="anaComparePrev" checked>
  472. <span>对比上期</span>
  473. </label>
  474. </div>
  475. <div class="delta-strip" id="analysisDeltas"></div>
  476. <div class="ana-grid">
  477. <div class="panel ana-cell ana-span2">
  478. <div class="panel-title"><span id="anaTrendTitle">主指标趋势</span></div>
  479. <div id="chartTrend" class="chart chart-lg"></div>
  480. </div>
  481. <div class="panel ana-cell">
  482. <div class="panel-title"><span>门店排行 Top 10</span></div>
  483. <div id="chartRank" class="chart chart-lg"></div>
  484. </div>
  485. <div class="panel ana-cell">
  486. <div class="panel-title"><span>转化漏斗(曝光 → 进店 → 下单)</span></div>
  487. <div id="chartFunnel" class="chart chart-lg"></div>
  488. </div>
  489. <div class="panel ana-cell ana-span2">
  490. <div class="panel-title"><span id="anaCompareTitle">门店对比 · Top 5</span></div>
  491. <div id="chartCompare" class="chart chart-lg"></div>
  492. </div>
  493. </div>
  494. </main>
  495. </div>
  496. <!-- ==================== 系统设置 ==================== -->
  497. <div id="viewSettings" class="view">
  498. <main class="content">
  499. <div class="page-header">
  500. <div>
  501. <h1>系统设置</h1>
  502. <div class="sub">API 密钥与采集配置,保存后立即生效</div>
  503. </div>
  504. </div>
  505. <div class="settings-workspace">
  506. <div class="settings-col">
  507. <div class="panel panel-narrow">
  508. <div class="stage-marker">
  509. <span class="num">1</span><span>API 设置</span>
  510. <div class="seg-control settings-api-tabs" id="settingsApiTabs" role="tablist">
  511. <button type="button" class="active" data-tab="image">图像模型</button>
  512. <button type="button" data-tab="chat">对话模型</button>
  513. </div>
  514. </div>
  515. <span class="panel-watermark"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="7.5" cy="15.5" r="4.5"/><path d="M11 12L21 2"/><path d="M16 7l3 3"/></svg></span>
  516. <div class="panel-body">
  517. <div id="settingsTabImage" class="settings-tab-body" role="tabpanel">
  518. <div class="field">
  519. <div class="field-label-row">
  520. <label>API Key<span class="req">*</span></label>
  521. <span class="label-links">
  522. <a class="settings-link settings-link-compact" href="https://o-hubs.com/api/console/keys" target="_blank" rel="noopener noreferrer">
  523. <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="7.5" cy="15.5" r="4.5"/><path d="M11 12L21 2"/><path d="M16 7l3 3"/></svg>
  524. <span>获取 API Key</span>
  525. </a>
  526. <a class="settings-link settings-link-compact" href="https://o-hubs.com/home" target="_blank" rel="noopener noreferrer">
  527. <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="6" width="18" height="13" rx="3"/><path d="M3 10h18"/><path d="M7 15h3"/></svg>
  528. <span>充值</span>
  529. </a>
  530. </span>
  531. </div>
  532. <input type="text" id="settingsApiKey" placeholder="sk-...">
  533. </div>
  534. <div class="field">
  535. <label>API 地址</label>
  536. <input type="text" id="settingsApiBase" value="https://api.lk888.ai" disabled>
  537. </div>
  538. <div class="field">
  539. <label>默认模型</label>
  540. <select id="settingsModel"></select>
  541. </div>
  542. <div class="settings-links">
  543. <button type="button" class="settings-link settings-link-btn" id="btnTestImage">
  544. <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M20 12a8 8 0 1 1-2.3-5.6"/><path d="M20 4v5h-5"/></svg>
  545. <span>测试 API 与模型</span>
  546. </button>
  547. <span id="imageTestStatus" class="badge"></span>
  548. </div>
  549. </div>
  550. <div id="settingsTabChat" class="settings-tab-body" role="tabpanel" hidden>
  551. <div class="field">
  552. <label>API Key</label>
  553. <input type="text" id="settingsChatApiKey" placeholder="留空复用上方 API Key">
  554. </div>
  555. <div class="field">
  556. <label>API 地址</label>
  557. <input type="text" id="settingsChatApiBase" disabled placeholder="默认与生图 API 地址一致">
  558. </div>
  559. <div class="field">
  560. <label>对话模型</label>
  561. <select id="settingsChatModel">
  562. <option value="deepseek-v4.1-flash">deepseek-v4.1-flash</option>
  563. <option value="glm-5.3-flash">glm-5.3-flash</option>
  564. </select>
  565. </div>
  566. <div class="settings-links">
  567. <button type="button" class="settings-link settings-link-btn" id="btnTestChat">
  568. <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M20 12a8 8 0 1 1-2.3-5.6"/><path d="M20 4v5h-5"/></svg>
  569. <span>测试对话模型</span>
  570. </button>
  571. <span id="chatTestStatus" class="badge"></span>
  572. </div>
  573. </div>
  574. <div class="panel-save-row">
  575. <button class="btn btn-primary btn-small" id="btnSaveApi">保存设置</button>
  576. <span id="apiSaveStatus" class="badge"></span>
  577. </div>
  578. </div>
  579. </div>
  580. <div class="panel panel-narrow">
  581. <div class="stage-marker"><span class="num">2</span><span>采集配置</span></div>
  582. <span class="panel-watermark"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2Z"/><path d="M3 11h18"/></svg></span>
  583. <div class="panel-body">
  584. <div class="field">
  585. <label>输出根目录</label>
  586. <input type="text" id="settingsRootDir" placeholder="/path/to/workspace">
  587. </div>
  588. <div class="field-row">
  589. <div class="field">
  590. <label>每页条数</label>
  591. <input type="number" id="pageSizeInput" min="1" value="50">
  592. </div>
  593. <div class="field">
  594. <label>间隔 (ms)</label>
  595. <input type="number" id="delayInput" min="0" value="300">
  596. <div class="help">建议 ≥ 200</div>
  597. </div>
  598. </div>
  599. <div class="field">
  600. <label>Cookie(淘宝闪购)</label>
  601. <textarea id="settingsCookie" rows="3" placeholder="登录 melody.shop.ele.me 后从 DevTools 复制"></textarea>
  602. <div class="help">Cookie 保存后不再回显;会话过期时粘贴新值即可更新</div>
  603. </div>
  604. <div class="panel-save-row">
  605. <button class="btn btn-primary btn-small" id="btnSaveCrawl">保存设置</button>
  606. <span id="crawlSaveStatus" class="badge"></span>
  607. </div>
  608. </div>
  609. </div>
  610. </div>
  611. <div class="settings-col">
  612. <div class="panel panel-narrow">
  613. <div class="stage-marker"><span class="num">3</span><span>安全设置</span></div>
  614. <span class="panel-watermark"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 3l7 3v5c0 4.4-3 8.4-7 10-4-1.6-7-5.6-7-10V6Z"/><path d="M9.5 12l1.8 1.8L15 10"/></svg></span>
  615. <div class="panel-body">
  616. <div class="field">
  617. <label>局域网访问口令(accessToken)</label>
  618. <input type="text" id="settingsAccessToken" placeholder="未设置" autocomplete="off">
  619. <div class="help">设置后,同一局域网的其他电脑访问本服务需要输入此口令(本机 127.0.0.1 不受影响)。留空保持不变;输入 - 清除口令。临时开关也可用环境变量 ACCESS_TOKEN。</div>
  620. </div>
  621. <div class="panel-save-row">
  622. <button class="btn btn-primary btn-small" id="btnSaveSecurity">保存设置</button>
  623. <span id="securitySaveStatus" class="badge"></span>
  624. </div>
  625. </div>
  626. </div>
  627. <div class="panel panel-narrow">
  628. <div class="stage-marker"><span class="num">4</span><span>钉钉 AI 表格</span></div>
  629. <span class="panel-watermark"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="4" width="18" height="16" rx="3"/><path d="M3 10h18M9 10v10"/></svg></span>
  630. <div class="panel-body">
  631. <div class="field">
  632. <label style="display:flex;align-items:center;gap:6px;">
  633. <input type="checkbox" id="settingsAitableEnabled">
  634. <span>启用(同步完成后自动推送增量到云端)</span>
  635. </label>
  636. </div>
  637. <div class="field">
  638. <label>AppKey / AppSecret(钉钉企业内部应用)</label>
  639. <input type="text" id="settingsAitableAppKey" placeholder="钉钉开放平台应用的 AppKey" autocomplete="off">
  640. <input type="text" id="settingsAitableAppSecret" placeholder="AppSecret 未设置" autocomplete="off" style="margin-top:6px;">
  641. <div class="help">Secret 保存后不回显;输入 - 清除。应用需开通「AI 表格」API 权限。</div>
  642. </div>
  643. <div class="field">
  644. <label>Base ID / 三张数据表名称</label>
  645. <input type="text" id="settingsAitableBaseId" placeholder="粘贴 AI 表格分享链接或直接填 Base ID" autocomplete="off">
  646. <input type="text" id="settingsAitableSheetDetail" placeholder="门店明细" autocomplete="off" style="margin-top:6px;">
  647. <input type="text" id="settingsAitableSheetChain" placeholder="连锁汇总" autocomplete="off" style="margin-top:6px;">
  648. <input type="text" id="settingsAitableSheetCompany" placeholder="公司汇总" autocomplete="off" style="margin-top:6px;">
  649. <div class="help">Base ID 可直接粘贴分享链接(形如 alidocs.dingtalk.com/i/nodes/xxx),保存时自动提取 ID。云端按维度拆三张表(门店明细/连锁汇总/公司汇总),每张表内粒度唯一,钉钉 AI 问数/人工聚合不会跨维度算重;表名留空用默认值。</div>
  650. </div>
  651. <div class="settings-links">
  652. <button type="button" class="settings-link settings-link-btn" id="btnTestAitable"><span>测试连通</span></button>
  653. <span id="aitableStatus" class="badge"></span>
  654. </div>
  655. <div class="help">架构:取数机「同步 → 自动推送」(数据采集页有手动推送按钮),其他电脑在「数据中台」页从云端拉取。推送/拉取入口分别在数据采集与数据中台页,本面板只管配置。</div>
  656. <div class="panel-save-row">
  657. <button class="btn btn-primary btn-small" id="btnSaveAitable">保存设置</button>
  658. <span id="aitableSaveStatus" class="badge"></span>
  659. </div>
  660. </div>
  661. </div>
  662. </div>
  663. </div>
  664. </main>
  665. </div>
  666. <!-- ==================== 系统日志 ==================== --> <!-- ==================== 系统日志 ==================== -->
  667. <div id="viewLogs" class="view">
  668. <main class="content">
  669. <div class="page-header">
  670. <div>
  671. <h1>系统日志</h1>
  672. <div class="sub">任务与系统的实时运行日志(最近 500 条,自动刷新)</div>
  673. </div>
  674. </div>
  675. <div class="panel panel-fixed panel-log settings-log">
  676. <div class="panel-title">
  677. <span>实时日志</span>
  678. <span class="actions">
  679. <button class="btn btn-ghost btn-small" id="btnClearLog">清空日志</button>
  680. </span>
  681. </div>
  682. <span class="panel-watermark log-watermark"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 5h16v11H8l-4 4Z"/><path d="M8 9h8M8 12h5"/></svg></span>
  683. <div class="log-box" id="logPanel"></div>
  684. </div>
  685. </main>
  686. </div>
  687. </div>
  688. </div>
  689. <div class="toast-wrap" id="toast-wrap"></div>
  690. <!-- 智能问数 · 机器人(仅经营分析相关页面显示) -->
  691. <div class="chatbot-fab" id="chatbotFab" title="智能问数" hidden>
  692. <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="4" y="8" width="16" height="11" rx="3"/><path d="M12 8V5"/><circle cx="12" cy="3.6" r="1.4"/><circle cx="9" cy="13" r="1.1" fill="currentColor" stroke="none"/><circle cx="15" cy="13" r="1.1" fill="currentColor" stroke="none"/><path d="M9.5 16.2h5"/></svg>
  693. </div>
  694. <div class="chatbot-panel" id="chatbotPanel" hidden>
  695. <div class="chatbot-head">
  696. <span class="chatbot-title">
  697. <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="4" y="8" width="16" height="11" rx="3"/><path d="M12 8V5"/><circle cx="12" cy="3.6" r="1.4"/><circle cx="9" cy="13" r="1.1" fill="currentColor" stroke="none"/><circle cx="15" cy="13" r="1.1" fill="currentColor" stroke="none"/><path d="M9.5 16.2h5"/></svg>
  698. 智能问数
  699. </span>
  700. <span class="chatbot-sub">支持上下文追问</span>
  701. <button type="button" class="chatbot-icon-btn" id="btnChatClear" title="清空对话">
  702. <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 6h18"/><path d="M8 6V4h8v2"/><path d="M6 6l1 14h10l1-14"/></svg>
  703. </button>
  704. <button type="button" class="chatbot-icon-btn" id="btnChatClose" title="收起">
  705. <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 6l12 12M18 6L6 18"/></svg>
  706. </button>
  707. </div>
  708. <div class="chatbot-body" id="chatbotBody">
  709. <div class="chatbot-msg bot">
  710. <div class="chatbot-bubble">你好,我是经营数据助手。可以直接问,也支持追问 —— 比如先问「上月营业额Top5门店」,再问「那二店的单量呢」。</div>
  711. </div>
  712. <div class="chatbot-chips" id="chatbotChips">
  713. <button type="button" data-q="上月营业额Top5门店">上月营业额Top5门店</button>
  714. <button type="button" data-q="最近7天进店转化率趋势">最近7天进店转化率趋势</button>
  715. <button type="button" data-q="昨天营业额和订单总量">昨天营业额和订单总量</button>
  716. <button type="button" data-q="哪几家门店曝光高但下单少">哪几家门店曝光高但下单少</button>
  717. </div>
  718. </div>
  719. <div class="chatbot-input-row">
  720. <input type="text" id="chatbotInput" placeholder="输入问题,回车发送…" autocomplete="off">
  721. <button type="button" class="btn btn-primary btn-small" id="btnChatSend" title="发送">
  722. <svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M3 11l18-8-8 18-2.5-7.5z"/></svg>
  723. </button>
  724. </div>
  725. </div>
  726. <!-- 添加店铺弹窗 -->
  727. <div class="modal-overlay" id="modalAddShop" hidden>
  728. <div class="modal">
  729. <div class="modal-header">
  730. <div class="modal-title">
  731. <span class="modal-status-icon">
  732. <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 20V9l8-5 8 5v11"/><path d="M9 20v-6h6v6"/></svg>
  733. </span>
  734. <span>添加店铺</span>
  735. </div>
  736. <button class="modal-close" id="btnCloseModal">&times;</button>
  737. </div>
  738. <div class="modal-body">
  739. <div class="field">
  740. <label>店铺清单</label>
  741. <textarea id="manualInput" rows="5" placeholder="每行一个:shopId 店铺名&#10;507068342 鑫龙福麻辣烫(康诺美食城店)"></textarea>
  742. <div class="help">每行一条,shopId 和店铺名用空格或逗号分隔</div>
  743. </div>
  744. </div>
  745. <div class="modal-footer">
  746. <button class="btn btn-ghost btn-small" id="btnCancelAdd">取消</button>
  747. <button class="btn btn-primary btn-small" id="useManualBtn">确认添加</button>
  748. </div>
  749. </div>
  750. </div>
  751. <!-- 列设置弹窗 -->
  752. <div class="modal-overlay" id="modalReportColumns" hidden>
  753. <div class="modal">
  754. <div class="modal-header">
  755. <div class="modal-title">
  756. <span class="modal-status-icon">
  757. <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 6h16M4 12h16M4 18h16"/></svg>
  758. </span>
  759. <span>列设置</span>
  760. </div>
  761. <button class="modal-close" id="btnCloseColumnCfg">&times;</button>
  762. </div>
  763. <div class="modal-body">
  764. <div class="help" style="margin-bottom:8px;">勾选需要在报表中展示的字段(日期与门店名称固定展示)</div>
  765. <div class="colcfg-list" id="columnCfgList"></div>
  766. </div>
  767. <div class="modal-footer">
  768. <button class="btn btn-ghost btn-small" id="btnResetColumns">恢复默认</button>
  769. <button class="btn btn-primary btn-small" id="btnApplyColumns">应用</button>
  770. </div>
  771. </div>
  772. </div>
  773. <!-- 数据同步弹窗 -->
  774. <div class="modal-overlay" id="modalReportSync" hidden>
  775. <div class="modal modal-wide">
  776. <div class="modal-header">
  777. <div class="modal-title">
  778. <span class="modal-status-icon">
  779. <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 3v12"/><path d="M7 10l5 5 5-5"/><path d="M4 21h16"/></svg>
  780. </span>
  781. <span>同步数据到本地</span>
  782. </div>
  783. <button class="modal-close" id="btnCloseSync">&times;</button>
  784. </div>
  785. <div class="modal-body">
  786. <div class="badge" id="syncEntityBadge">未识别主体</div>
  787. <div class="field">
  788. <label>同步范围</label>
  789. <select id="syncScope">
  790. <option value="all" selected>全部(公司 + 连锁 + 门店明细)</option>
  791. <option value="shop">仅门店明细</option>
  792. <option value="company">仅公司 / 连锁汇总</option>
  793. <option value="custom">指定门店</option>
  794. </select>
  795. </div>
  796. <div class="field" id="syncShopPickWrap" hidden>
  797. <label>选择门店</label>
  798. <div class="scan-dropdown" id="syncShopDropdown">
  799. <button type="button" class="scan-dropdown-trigger" id="syncShopTrigger" aria-expanded="false" aria-haspopup="listbox">
  800. <span id="syncShopText">选择门店</span>
  801. <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 9l6 6 6-6"/></svg>
  802. </button>
  803. <div class="scan-dropdown-menu" id="syncShopMenu" role="listbox" aria-multiselectable="true" hidden></div>
  804. </div>
  805. </div>
  806. <div class="field">
  807. <label>日期范围</label>
  808. <select id="syncRange">
  809. <option value="1">昨日</option>
  810. <option value="7">近 7 天</option>
  811. <option value="30" selected>近 30 天</option>
  812. <option value="90">近 90 天</option>
  813. </select>
  814. <div class="help">经营数据后台保留约 180 天;当天数据未结算,同步区间右端取昨日</div>
  815. </div>
  816. <div class="field">
  817. <label>每日自动同步</label>
  818. <div style="display:flex;gap:10px;align-items:center;">
  819. <label style="display:flex;align-items:center;gap:6px;margin:0;white-space:nowrap;">
  820. <input type="checkbox" id="autoSyncEnabled" />
  821. <span>每天自动同步昨日数据</span>
  822. </label>
  823. <input type="time" id="autoSyncTime" value="06:00" style="width:110px;" />
  824. </div>
  825. <div class="help">需商家客户端以调试端口运行;到点时客户端在线即自动补同步昨日数据,离线则当天在线后补跑。同步记录照常进入同步记录列表。</div>
  826. </div>
  827. <div id="syncProgressWrap" hidden>
  828. <div class="sync-progress-row">
  829. <div class="sync-progress-bar"><span id="syncProgressBar"></span></div>
  830. <span class="badge badge-info" id="syncProgressText">0 / 0</span>
  831. </div>
  832. <div class="sync-stat-row">
  833. <span class="badge badge-ok" id="syncStatAdded">新增 0</span>
  834. <span class="badge badge-info" id="syncStatUpdated">更新 0</span>
  835. <span class="badge badge-fail" id="syncStatFailed">失败 0</span>
  836. <button class="btn btn-ghost btn-small" id="btnSyncCancel" hidden>取消</button>
  837. </div>
  838. <div class="sync-steps" id="syncSteps"></div>
  839. </div>
  840. <div class="help" id="syncHint">同步会把所选区间逐日、逐店的经营数据写入本地数据湖(data/reports/),可反复同步自动去重合并。</div>
  841. </div>
  842. <div class="modal-footer">
  843. <button class="btn btn-ghost btn-small" id="btnCancelSync">关闭</button>
  844. <button class="btn btn-primary btn-small" id="btnStartSync">开始同步</button>
  845. </div>
  846. </div>
  847. </div>
  848. <script src="/crawl.js"></script>
  849. <script src="/gen.js"></script>
  850. <script src="/tasks.js"></script>
  851. <script src="/history.js"></script>
  852. <script src="/vendor/echarts.min.js"></script>
  853. <script src="/reports.js"></script>
  854. <script src="/lake.js"></script>
  855. <script src="/app.js"></script>
  856. </body>
  857. </html>