index.html 64 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063
  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><span class="nav-beta">Beta</span></button>
  40. <button class="nav-item" data-view="ask"><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="4" y="8" width="16" height="11" rx="3"/><path d="M12 8V5"/><circle cx="12" cy="3.6" r="1.4"/><path d="M9.5 13.5h.01M14.5 13.5h.01"/><path d="M9.5 16.2h5"/></svg></span><span>智能问数</span><span class="nav-beta">Beta</span></button>
  41. <div class="nav-section-label">设置</div>
  42. <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>
  43. <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>
  44. <div class="sidebar-bottom">
  45. <span id="sidebarVersion">淘宝闪购 · v1.0.0</span>
  46. <img src="/assets/powered-by.png" alt="Hyreal IDE" class="sidebar-powered">
  47. </div>
  48. </aside>
  49. <div class="main-wrap">
  50. <!-- ==================== 门店采集 ==================== -->
  51. <div id="viewCrawl" class="view active">
  52. <main class="content">
  53. <div class="page-header">
  54. <div>
  55. <h1>门店采集</h1>
  56. <div class="sub">从淘宝闪购后台按店铺批量采集菜品图,用于后续视觉美化</div>
  57. </div>
  58. </div>
  59. <div class="crawl-grid">
  60. <div class="left-col">
  61. <div class="panel panel-narrow panel-designed">
  62. <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>
  63. <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>
  64. <div class="panel-body">
  65. <div class="field">
  66. <label>采集通道</label>
  67. <select id="crawlChannel">
  68. <option value="auto">自动 · 优先客户端,不可用回落 Cookie</option>
  69. <option value="client">仅客户端(淘宝闪购)</option>
  70. <option value="cookie">仅 Cookie</option>
  71. </select>
  72. <div class="panel-hint" id="crawlChannelHint">正在检测通道状态…</div>
  73. </div>
  74. <label style="display:flex;align-items:center;gap:6px;font-size:13px;cursor:pointer;">
  75. <input type="checkbox" id="forceFullCrawl">
  76. <span>强制全量抓取(覆盖已有图片)</span>
  77. </label>
  78. </div>
  79. </div>
  80. <button class="btn btn-primary btn-block" id="startBtn">
  81. <span id="startBtnIcon"><svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M8 5v14l11-7z"/></svg></span>
  82. <span id="startBtnText">开始抓取</span>
  83. </button>
  84. <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>
  85. <div class="panel panel-fixed panel-progress">
  86. <div class="panel-title">
  87. <span>进度列表</span>
  88. <span class="actions"><span class="badge" id="crawlStatusBadge"></span></span>
  89. </div>
  90. <div id="progressList"></div>
  91. </div>
  92. </div>
  93. <div class="right-col">
  94. <div class="panel panel-fixed panel-shops">
  95. <div class="panel-title">
  96. <span>店铺清单</span>
  97. <span class="actions">
  98. <span class="badge badge-info" id="shopCount">0 家</span>
  99. <button class="btn btn-ghost btn-small" id="btnToggleAdd">+ 添加店铺</button>
  100. </span>
  101. </div>
  102. <div style="overflow-x:auto;">
  103. <table class="data-table">
  104. <thead>
  105. <tr>
  106. <th style="width:36px;"><input type="checkbox" id="selectAllCb"></th>
  107. <th style="min-width:220px;">店铺</th>
  108. <th style="width:100px;">shopId</th>
  109. <th style="width:100px;">状态</th>
  110. <th style="width:220px;">文件夹</th>
  111. </tr>
  112. </thead>
  113. <tbody id="shopTableBody"></tbody>
  114. </table>
  115. <div id="shopTableEmpty" class="empty-hint">
  116. <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>
  117. <p>尚无店铺<br><small>点击右上角「+ 添加店铺」手动录入</small></p>
  118. </div>
  119. </div>
  120. </div>
  121. </div>
  122. </div>
  123. </main>
  124. </div>
  125. <!-- ==================== 视觉生成 ==================== -->
  126. <div id="viewGen" class="view">
  127. <main class="content">
  128. <div class="page-header">
  129. <div>
  130. <h1>视觉生成</h1>
  131. <div class="sub">基于已采集的菜品图片,批量生成 LOGO / 海报 / 招牌 / 贴纸 + 菜品图</div>
  132. </div>
  133. <div class="toolbar">
  134. <button class="btn btn-ghost btn-small" id="btnRefreshGen">
  135. <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>
  136. 刷新
  137. </button>
  138. </div>
  139. </div>
  140. <div class="gen-overview">
  141. <div class="stats-grid" id="statsBar">
  142. <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>
  143. <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>
  144. <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>
  145. <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>
  146. </div>
  147. <div class="gen-controls">
  148. <div class="field">
  149. <label>扫描范围</label>
  150. <div class="scan-dropdown" id="scanDropdown">
  151. <button type="button" class="scan-dropdown-trigger" id="scanDropdownTrigger" aria-expanded="false" aria-haspopup="listbox">
  152. <span id="scanDropdownText">全量扫描</span>
  153. <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>
  154. </button>
  155. <div class="scan-dropdown-menu" id="scanDropdownMenu" role="listbox" aria-multiselectable="true" hidden></div>
  156. </div>
  157. </div>
  158. <button class="btn btn-primary" id="scanBtn">
  159. <span id="scanIcon"><svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M8 5v14l11-7z"/></svg></span>
  160. <span id="scanText">扫描店铺</span>
  161. </button>
  162. </div>
  163. </div>
  164. <div class="shop-cards" id="shopList"></div>
  165. </main>
  166. </div>
  167. <!-- ==================== 历史创作 ==================== -->
  168. <div id="viewTasks" class="view">
  169. <main class="content">
  170. <div class="page-header">
  171. <div>
  172. <h1>任务中心</h1>
  173. <div class="sub">跟踪生成任务状态,服务重启后可恢复进行中的生成任务</div>
  174. </div>
  175. <div class="toolbar">
  176. <button class="btn btn-ghost btn-small" id="btnRefreshTasks">
  177. <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>
  178. 刷新
  179. </button>
  180. </div>
  181. </div>
  182. <div class="tasks-overview panel panel-designed">
  183. <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>
  184. <div class="tasks-stats">
  185. <div class="task-stat"><span>全部</span><strong id="taskCountAll">0</strong></div>
  186. <div class="task-stat running"><span>进行中</span><strong id="taskCountRunning">0</strong></div>
  187. <div class="task-stat queued"><span>排队</span><strong id="taskCountQueued">0</strong></div>
  188. <div class="task-stat success"><span>成功</span><strong id="taskCountSuccess">0</strong></div>
  189. <div class="task-stat failed"><span>失败</span><strong id="taskCountFailed">0</strong></div>
  190. </div>
  191. <div class="tasks-filters" id="taskFilters">
  192. <button class="history-filter active" data-filter="all">全部</button>
  193. <button class="history-filter" data-filter="running">进行中</button>
  194. <button class="history-filter" data-filter="queued">排队中</button>
  195. <button class="history-filter" data-filter="success">已完成</button>
  196. <button class="history-filter" data-filter="failed">失败</button>
  197. </div>
  198. </div>
  199. <div class="history-summary" id="taskSummary">正在加载任务…</div>
  200. <div class="task-list" id="taskList"></div>
  201. </main>
  202. </div>
  203. <!-- ==================== 历史创作 ==================== -->
  204. <div id="viewHistory" class="view">
  205. <main class="content">
  206. <div class="page-header">
  207. <div>
  208. <h1>历史创作</h1>
  209. <div class="sub">以图片墙回顾已生成的品牌物料与菜品作品</div>
  210. </div>
  211. <div class="toolbar">
  212. <button class="btn btn-ghost btn-small" id="btnRefreshHistory">
  213. <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>
  214. 刷新
  215. </button>
  216. </div>
  217. </div>
  218. <div class="history-toolbar panel">
  219. <div class="history-search">
  220. <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>
  221. <input type="text" id="historySearch" placeholder="搜索门店或作品名称">
  222. </div>
  223. <div class="history-filters" id="historyFilters">
  224. <button class="history-filter active" data-filter="all">全部</button>
  225. <button class="history-filter" data-filter="logo">LOGO</button>
  226. <button class="history-filter" data-filter="banner">海报</button>
  227. <button class="history-filter" data-filter="signage">招牌</button>
  228. <button class="history-filter" data-filter="sticker">贴纸</button>
  229. <button class="history-filter" data-filter="dish">菜品</button>
  230. </div>
  231. </div>
  232. <div class="history-summary" id="historySummary">加载中…</div>
  233. <div class="history-gallery" id="historyGallery"></div>
  234. </main>
  235. </div>
  236. <!-- ==================== 数据采集 ==================== -->
  237. <div id="viewReports" class="view">
  238. <main class="content">
  239. <div class="page-header">
  240. <div>
  241. <h1>数据采集</h1>
  242. <div class="sub">同步控制台:连接商家客户端、按区间取数入库、推送云端主档案</div>
  243. </div>
  244. <div class="toolbar">
  245. <span class="conn-help-wrap">
  246. <span class="badge badge-info" id="reportConnBadge">检测连接…</span>
  247. <button type="button" class="help-btn" id="btnClientHelp" title="客户端连接排查" aria-expanded="false">?</button>
  248. <div class="help-popover" id="clientHelpPopover" hidden>
  249. <div class="help-popover-title">客户端连接排查</div>
  250. <ol class="help-popover-steps">
  251. <li><b>验证调试端口:</b>客户端带参启动后,浏览器打开 <code>http://127.0.0.1:9669/json/version</code> —— 看到一段 JSON(含 "Browser")就是通的;打不开就是客户端没带参。</li>
  252. <li><b>macOS 带参启动:</b>⌘Q 完全退出客户端(活动监视器确认进程没了)→ 终端执行:<code>open -a "淘宝闪购商家版" --args --remote-debugging-port=9669</code></li>
  253. <li><b>Windows 带参启动:</b>任务栏右键完全退出(任务管理器确认)→ 右键快捷方式 → 属性 → 「目标」末尾加 <code>--remote-debugging-port=9669</code> → 以后都用这个快捷方式启动。</li>
  254. <li>回到本页点击「刷新」,徽章变「客户端已连接」后同步即可。若同步弹窗报 <code>Failed to fetch</code>,先确认服务在跑(启动窗口未关闭)。</li>
  255. </ol>
  256. <div class="help-popover-note">注意:客户端每次重启都必须带参启动,否则端口不会开启。</div>
  257. </div>
  258. </span>
  259. <button class="btn btn-ghost btn-small" id="btnNaposDiagnose" hidden>取数诊断</button>
  260. <button class="btn btn-ghost btn-small" id="btnHarvest" hidden>定向采集</button>
  261. <button class="btn btn-ghost btn-small" id="btnReportRefresh">
  262. <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>
  263. 刷新
  264. </button>
  265. <button class="btn btn-primary btn-small" id="btnOpenSync">
  266. <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 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"/><path d="M21 3v5h-5"/><path d="M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"/><path d="M8 16H3v5"/></svg>
  267. 同步数据
  268. </button>
  269. </div>
  270. </div>
  271. <div id="entityTabs"></div>
  272. <div class="panel panel-fixed" id="syncHistoryPanel">
  273. <div class="panel-title">
  274. <span>同步历史</span>
  275. <span class="actions">
  276. <span class="badge" id="reportPushBadge">云端未启用</span>
  277. <button class="btn btn-primary btn-small" id="btnReportPush">
  278. <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>
  279. 推送云端
  280. </button>
  281. </span>
  282. </div>
  283. <div class="table-wrap">
  284. <table class="data-table" id="syncHistoryTable">
  285. <thead><tr><th>时间</th><th>区间</th><th>范围</th><th>新增</th><th>更新</th><th>失败</th><th>备注</th><th>云端</th></tr></thead>
  286. <tbody id="syncHistoryRows"><tr><td colspan="8" class="empty-cell">加载中…</td></tr></tbody>
  287. </table>
  288. <div id="syncHistoryEmpty" class="empty-hint" hidden>
  289. <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>
  290. <p id="syncHistoryEmptyText"></p>
  291. </div>
  292. </div>
  293. </div>
  294. </main>
  295. </div>
  296. <!-- ==================== 数据中台 ==================== -->
  297. <div id="viewLake" class="view">
  298. <main class="content">
  299. <div class="page-header">
  300. <div>
  301. <h1>数据中台</h1>
  302. <div class="sub">本地数据湖全景与明细数据(含全部原始字段),支持云端拉取补全</div>
  303. </div>
  304. <div class="toolbar">
  305. <button class="btn btn-ghost btn-small" id="btnLakeRefresh">
  306. <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>
  307. 刷新
  308. </button>
  309. <button class="btn btn-primary btn-small" id="btnLakePull" title="以钉钉 AI 表格(云端主档案)为准覆盖本地湖;未注册的账号自动创建主体">
  310. <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>
  311. 云端拉取
  312. </button>
  313. <span class="badge" id="lakeSyncBadge"></span>
  314. </div>
  315. </div>
  316. <div class="seg-control lake-tabs" id="lakeTabs" role="tablist">
  317. <button type="button" class="active" data-tab="overview">湖全景</button>
  318. <button type="button" data-tab="detail">明细数据</button>
  319. </div>
  320. <div id="lakeTabOverview">
  321. <div class="stats-grid" id="lakeKpis">
  322. <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>
  323. <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>
  324. <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>
  325. <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>
  326. </div>
  327. <div class="panel panel-fixed report-table-panel">
  328. <div class="panel-title">
  329. <span>主体明细</span>
  330. <span class="actions">
  331. <span class="badge badge-info" id="lakeRowsBadge">0 主体</span>
  332. <span class="conn-help-wrap">
  333. <button type="button" class="help-btn" id="btnLakeHelp" title="多机数据与云端同步规则" aria-expanded="false">?</button>
  334. <div class="help-popover" id="lakeHelpPopover" hidden>
  335. <div class="help-popover-title">多机与云端同步规则</div>
  336. <ol class="help-popover-steps">
  337. <li><b>不产生重复:</b>每一行的身份是「日期×账号×维度×门店」,多台电脑写同一行只会覆盖,不会重复。</li>
  338. <li><b>数据新者胜:</b>推送时对比本地取数时间与云端修改时间,旧数据不会覆盖云端新数据(跳过并计数)。</li>
  339. <li><b>层间矛盾拦截:</b>门店明细全部全零而连锁/公司汇总有数(取数异常形态)时拒绝推送;新店多导致的大面积全零是正常形态,不受影响。</li>
  340. <li><b>拉取不算待推:</b>云端拉取回来的数据本来就已在云端,不计入本机「待推送」;从未本地同步过的只读机器恒显示与云端一致。</li>
  341. <li><b>拉取以云端为准:</b>其他电脑执行「云端拉取」后,本地同键行被云端版本覆盖。</li>
  342. <li><b>推送前备份:</b>每次推送会把将被覆盖的云端记录自动备份到本机(.genpic/aitable-backup/,保留 20 份),坏推送可回滚;不放心误推的机器可在 系统设置 里开「云端写保护」,只拉不推。</li>
  343. </ol>
  344. </div>
  345. </span>
  346. </span>
  347. </div>
  348. <div class="table-wrap">
  349. <table class="data-table" id="lakeEntityTable">
  350. <thead>
  351. <tr>
  352. <th>账号名</th><th>门店/连锁</th><th>总行数</th><th>公司</th><th>连锁</th><th>门店</th><th>汇总</th><th>覆盖区间</th><th>最近同步</th><th>上次推送云端</th>
  353. </tr>
  354. </thead>
  355. <tbody id="lakeEntityRows">
  356. <tr><td colspan="10" class="empty-cell">加载中…</td></tr>
  357. </tbody>
  358. </table>
  359. <div id="lakeEmpty" class="empty-hint" hidden>
  360. <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>
  361. <p>本地湖为空<br><small>取数机先「同步数据」推送云端,本机可用右上角「云端拉取」补全</small></p>
  362. </div>
  363. </div>
  364. </div>
  365. </div>
  366. <div id="lakeTabDetail" hidden>
  367. <div id="lakeEntityTabs"></div>
  368. <div class="report-toolbar panel">
  369. <div class="field report-field-sm">
  370. <label>日期范围</label>
  371. <select id="reportRangePreset">
  372. <option value="1">昨日</option>
  373. <option value="7">近 7 天</option>
  374. <option value="30" selected>近 30 天</option>
  375. <option value="90">近 90 天</option>
  376. <option value="custom">自定义</option>
  377. </select>
  378. </div>
  379. <div class="field report-field-md" id="reportCustomRange" hidden>
  380. <label>起止日期</label>
  381. <div class="report-date-range">
  382. <input type="date" id="reportFromDate">
  383. <span>–</span>
  384. <input type="date" id="reportToDate">
  385. </div>
  386. </div>
  387. <div class="field report-field-lg">
  388. <label>门店</label>
  389. <div class="scan-dropdown" id="reportShopDropdown">
  390. <button type="button" class="scan-dropdown-trigger" id="reportShopTrigger" aria-expanded="false" aria-haspopup="listbox">
  391. <span id="reportShopText">全部门店</span>
  392. <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>
  393. </button>
  394. <div class="scan-dropdown-menu" id="reportShopMenu" role="listbox" aria-multiselectable="true" hidden></div>
  395. </div>
  396. </div>
  397. <div class="field">
  398. <label>视图</label>
  399. <div class="seg-control" id="reportViewModes" role="tablist">
  400. <button type="button" class="active" data-mode="detail">明细</button>
  401. <button type="button" data-mode="shop">按门店</button>
  402. <button type="button" data-mode="date">按日期</button>
  403. </div>
  404. </div>
  405. <div class="field report-field-grow">
  406. <label>搜索门店</label>
  407. <input type="text" id="reportSearch" placeholder="输入门店名称过滤">
  408. </div>
  409. <div class="field">
  410. <label>字段</label>
  411. <div class="seg-control" id="reportFieldModes" role="tablist">
  412. <button type="button" class="active" data-fields="report">报表列</button>
  413. <button type="button" data-fields="all">全部字段</button>
  414. </div>
  415. </div>
  416. <div class="report-toolbar-actions">
  417. <button class="btn btn-ghost btn-small" id="btnColumnCfg">列设置</button>
  418. <button class="btn btn-ghost btn-small" id="btnExportCsv">导出 CSV</button>
  419. </div>
  420. </div>
  421. <div class="panel panel-fixed report-table-panel">
  422. <div class="panel-title">
  423. <span>报表数据</span>
  424. <span class="actions"><span class="badge badge-info" id="reportRowCount">0 行</span></span>
  425. </div>
  426. <div class="report-table-wrap" id="reportTableWrap">
  427. <table class="data-table report-table" id="reportTable">
  428. <thead id="reportTableHead"></thead>
  429. <tbody id="reportTableBody"></tbody>
  430. </table>
  431. <div id="reportEmpty" class="empty-hint" hidden>
  432. <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>
  433. <p id="reportEmptyText">暂无数据<br><small>取数机先「同步数据」推送云端,本机可用右上角「云端拉取」补全</small></p>
  434. </div>
  435. </div>
  436. <div class="report-pager" id="reportPager"></div>
  437. </div>
  438. </div>
  439. </main>
  440. </div>
  441. <!-- ==================== 趋势图表 ==================== -->
  442. <div id="viewAnalysis" class="view">
  443. <main class="content">
  444. <div class="page-header">
  445. <div>
  446. <h1>趋势图表</h1>
  447. <div class="sub">经营 / 运营双视角内置模板,按模板看趋势与归因;深入分析去「智能问数」页</div>
  448. </div>
  449. <div class="toolbar">
  450. <button class="btn btn-ghost btn-small" id="btnExportHtml">
  451. <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>
  452. 导出周报
  453. </button>
  454. </div>
  455. </div>
  456. <div id="analysisEntityTabs"></div>
  457. <div class="ana-tpl-bar" id="anaTplBar"></div>
  458. <div class="ana-note" id="anaTplDesc"></div>
  459. <div class="report-toolbar panel">
  460. <div class="field report-field-sm">
  461. <label>日期范围</label>
  462. <select id="analysisRangePreset">
  463. <option value="1">昨日</option>
  464. <option value="7">近 7 天</option>
  465. <option value="30" selected>近 30 天</option>
  466. <option value="90">近 90 天</option>
  467. </select>
  468. </div>
  469. <div class="field report-field-lg">
  470. <label>门店</label>
  471. <div class="scan-dropdown" id="anaShopDropdown">
  472. <button type="button" class="scan-dropdown-trigger" id="anaShopTrigger" aria-expanded="false" aria-haspopup="listbox">
  473. <span id="anaShopText">全部门店</span>
  474. <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>
  475. </button>
  476. <div class="scan-dropdown-menu" id="anaShopMenu" role="listbox" aria-multiselectable="true" hidden></div>
  477. </div>
  478. </div>
  479. <div class="field report-field-sm" id="anaMetricField">
  480. <label>主指标</label>
  481. <select id="chartMetric" class="chart-metric-select"></select>
  482. </div>
  483. <label class="ana-compare-toggle" id="anaCompareField" title="主趋势图中叠加上一周期的虚线对照">
  484. <input type="checkbox" id="anaComparePrev" checked>
  485. <span>对比上期</span>
  486. </label>
  487. </div>
  488. <div class="delta-strip" id="analysisDeltas"></div>
  489. <div id="analysisEmpty" class="empty-hint" hidden>
  490. <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>
  491. <p id="analysisEmptyText"></p>
  492. </div>
  493. <div class="ana-grid" id="anaGrid"></div>
  494. </main>
  495. </div>
  496. <!-- ==================== 智能问数 ==================== -->
  497. <div id="viewAsk" class="view">
  498. <main class="content content-ask">
  499. <div class="ask-shell">
  500. <aside class="ask-side">
  501. <div class="ask-side-head">
  502. <span class="ask-brand">
  503. <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"/><path d="M9.5 13.5h.01M14.5 13.5h.01"/><path d="M9.5 16.2h5"/></svg>
  504. 智能问数
  505. </span>
  506. <button type="button" class="ask-new-btn" id="btnAskNewSession" title="新建会话">+</button>
  507. </div>
  508. <div class="ask-search">
  509. <input type="text" id="askSearch" placeholder="搜索会话" autocomplete="off">
  510. </div>
  511. <div class="ask-side-list" id="askSessions"></div>
  512. </aside>
  513. <section class="ask-stage">
  514. <div class="ask-stage-head">
  515. <span class="ask-stage-title" id="askStageTitle">新对话</span>
  516. <span class="ask-stage-badge" id="askStageBadge"></span>
  517. </div>
  518. <div class="ask-stage-sub">智能体自动取数、做同环比对比与数据体检;结论均来自本地数据湖,过程与数据质量判定全程可见</div>
  519. <div id="askDigest" class="ask-digest" hidden></div>
  520. <div class="ask-stream" id="askStream">
  521. <div class="ask-hero" id="askEmpty">
  522. <div class="ask-hero-title">给问数一个目标</div>
  523. <div class="ask-hero-sub">智能体会自动规划、调用取数与校验工具(湖概览 / 报表查询 / 同环比对比 / 数据体检),逐步给出带真实数字的结论;切换页面后运行仍会继续,可随时回来查看。</div>
  524. <div class="ask-chips" id="askChips">
  525. <button type="button" data-q="最近7天营业额和单量趋势">最近7天营业额和单量趋势</button>
  526. <button type="button" data-q="最近30天比上一个30天营业额变化多少,主要受哪些门店影响">环比变化与影响门店</button>
  527. <button type="button" data-q="做一次数据体检,看看数据质量有没有问题">数据体检</button>
  528. <button type="button" data-q="上月营业额Top5门店">上月营业额Top5门店</button>
  529. </div>
  530. </div>
  531. </div>
  532. <div class="ask-composer">
  533. <textarea id="askInput" rows="1" placeholder="描述你的数据问题,或从「技能」里点名打法;回车发送,Shift + Enter 换行" autocomplete="off"></textarea>
  534. <div class="ask-composer-bar">
  535. <select id="askEntity" class="ask-ent-select" title="数据主体"></select>
  536. <div class="seg-control" id="askMode">
  537. <button type="button" data-mode="auto" class="active">自动</button>
  538. <button type="button" data-mode="agent">深度分析</button>
  539. <button type="button" data-mode="quick">快问</button>
  540. </div>
  541. <select id="askSkill" class="ask-ent-select" title="内置技能(打法模板,可选)">
  542. <option value="">技能:自动</option>
  543. </select>
  544. <span class="ask-composer-spacer"></span>
  545. <button type="button" class="btn btn-ghost btn-small" id="btnAskStop" hidden>停止</button>
  546. <button type="button" class="ask-send-btn" id="btnAskSend" title="发送">
  547. <svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M3 11l18-8-8 18-2.5-7.5z"/></svg>
  548. </button>
  549. </div>
  550. </div>
  551. </section>
  552. </div>
  553. </main>
  554. </div>
  555. <!-- ==================== 系统设置 ==================== -->
  556. <div id="viewSettings" class="view">
  557. <main class="content">
  558. <div class="page-header">
  559. <div>
  560. <h1>系统设置</h1>
  561. <div class="sub">API 密钥与采集配置,保存后立即生效</div>
  562. </div>
  563. </div>
  564. <div class="settings-workspace">
  565. <div class="settings-col">
  566. <div class="panel panel-narrow">
  567. <div class="stage-marker">
  568. <span class="num">1</span><span>API 设置</span>
  569. <div class="seg-control settings-api-tabs" id="settingsApiTabs" role="tablist">
  570. <button type="button" class="active" data-tab="image">图像模型</button>
  571. <button type="button" data-tab="chat">对话模型</button>
  572. </div>
  573. </div>
  574. <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>
  575. <div class="panel-body">
  576. <div id="settingsTabImage" class="settings-tab-body" role="tabpanel">
  577. <div class="field">
  578. <div class="field-label-row">
  579. <label>API Key<span class="req">*</span></label>
  580. <span class="label-links">
  581. <a class="settings-link settings-link-compact" href="https://o-hubs.com/api/console/keys" target="_blank" rel="noopener noreferrer">
  582. <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>
  583. <span>获取 API Key</span>
  584. </a>
  585. <a class="settings-link settings-link-compact" href="https://o-hubs.com/home" target="_blank" rel="noopener noreferrer">
  586. <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>
  587. <span>充值</span>
  588. </a>
  589. </span>
  590. </div>
  591. <input type="text" id="settingsApiKey" placeholder="sk-...">
  592. </div>
  593. <div class="field">
  594. <label>API 地址</label>
  595. <input type="text" id="settingsApiBase" value="https://api.lk888.ai" disabled>
  596. </div>
  597. <div class="field">
  598. <label>默认模型</label>
  599. <select id="settingsModel"></select>
  600. </div>
  601. <div class="settings-links">
  602. <button type="button" class="settings-link settings-link-btn" id="btnTestImage">
  603. <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>
  604. <span>测试 API 与模型</span>
  605. </button>
  606. <span id="imageTestStatus" class="badge"></span>
  607. </div>
  608. </div>
  609. <div id="settingsTabChat" class="settings-tab-body" role="tabpanel" hidden>
  610. <div class="field">
  611. <label>API Key</label>
  612. <input type="text" id="settingsChatApiKey" placeholder="留空复用上方 API Key">
  613. </div>
  614. <div class="field">
  615. <label>API 地址</label>
  616. <input type="text" id="settingsChatApiBase" disabled placeholder="默认与生图 API 地址一致">
  617. </div>
  618. <div class="field">
  619. <label>对话模型</label>
  620. <select id="settingsChatModel">
  621. <option value="deepseek-v4.1-flash">deepseek-v4.1-flash</option>
  622. <option value="glm-5.3-flash">glm-5.3-flash</option>
  623. </select>
  624. <div class="help">用于快问与问数结论;深度分析缺省也用它</div>
  625. </div>
  626. <div class="field">
  627. <label>深度分析模型(可选)</label>
  628. <select id="settingsChatModelAgent">
  629. <option value="">跟随对话模型</option>
  630. <option value="deepseek-v4.1-flash">deepseek-v4.1-flash</option>
  631. <option value="glm-5.3-flash">glm-5.3-flash</option>
  632. </select>
  633. <div class="help">问数「深度分析」多步规划用的模型,缺省跟随上方对话模型</div>
  634. </div>
  635. <div class="field">
  636. <label>动作 JSON mode</label>
  637. <label style="display:flex;align-items:center;gap:6px;margin:0;">
  638. <input type="checkbox" id="settingsChatJsonMode" />
  639. <span>启用 response_format=json_object(网关支持时更稳,报错请关闭)</span>
  640. </label>
  641. </div>
  642. <div class="settings-links">
  643. <button type="button" class="settings-link settings-link-btn" id="btnTestChat">
  644. <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>
  645. <span>测试对话模型</span>
  646. </button>
  647. <span id="chatTestStatus" class="badge"></span>
  648. </div>
  649. </div>
  650. <div class="panel-save-row">
  651. <button class="btn btn-primary btn-small" id="btnSaveApi">保存设置</button>
  652. <span id="apiSaveStatus" class="badge"></span>
  653. </div>
  654. </div>
  655. </div>
  656. <div class="panel panel-narrow">
  657. <div class="stage-marker"><span class="num">2</span><span>采集配置</span></div>
  658. <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>
  659. <div class="panel-body">
  660. <div class="field">
  661. <label>输出根目录</label>
  662. <input type="text" id="settingsRootDir" placeholder="/path/to/workspace">
  663. </div>
  664. <div class="field-row">
  665. <div class="field">
  666. <label>每页条数</label>
  667. <input type="number" id="pageSizeInput" min="1" value="50">
  668. </div>
  669. <div class="field">
  670. <label>间隔 (ms)</label>
  671. <input type="number" id="delayInput" min="0" value="300">
  672. </div>
  673. </div>
  674. <div class="field">
  675. <label>Cookie(淘宝闪购,兜底通道)</label>
  676. <textarea id="settingsCookie" rows="3" placeholder="采集走客户端通道时无需此项;仅 Cookie 通道 / 客户端不可用时使用。登录 melody.shop.ele.me 后从 DevTools 复制粘贴"></textarea>
  677. </div>
  678. <div class="panel-save-row">
  679. <button class="btn btn-primary btn-small" id="btnSaveCrawl">保存设置</button>
  680. <span id="crawlSaveStatus" class="badge"></span>
  681. </div>
  682. </div>
  683. </div>
  684. </div>
  685. <div class="settings-col">
  686. <div class="panel panel-narrow">
  687. <div class="stage-marker"><span class="num">3</span><span>安全设置</span>
  688. <span class="conn-help-wrap">
  689. <button type="button" class="help-btn" id="btnSecurityHelp" title="局域网访问口令说明" aria-expanded="false">?</button>
  690. <div class="help-popover pop-left" id="securityHelpPopover" hidden>
  691. <div class="help-popover-title">局域网访问口令</div>
  692. <ol class="help-popover-steps">
  693. <li><b>作用:</b>设置后,同一局域网的其他电脑访问本服务需要输入此口令;本机 127.0.0.1 不受影响。</li>
  694. <li><b>清除:</b>输入 <code>-</code> 保存即清除;留空保存保持不变。</li>
  695. <li><b>临时开关:</b>也可用环境变量 <code>ACCESS_TOKEN</code>。</li>
  696. </ol>
  697. </div>
  698. </span>
  699. </div>
  700. <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>
  701. <div class="panel-body">
  702. <div class="field">
  703. <label>局域网访问口令(accessToken)</label>
  704. <input type="text" id="settingsAccessToken" placeholder="未设置" autocomplete="off">
  705. </div>
  706. <div class="panel-save-row">
  707. <button class="btn btn-primary btn-small" id="btnSaveSecurity">保存设置</button>
  708. <span id="securitySaveStatus" class="badge"></span>
  709. </div>
  710. </div>
  711. </div>
  712. <div class="panel panel-narrow">
  713. <div class="stage-marker"><span class="num">4</span><span>钉钉 AI 表格</span>
  714. <span class="conn-help-wrap">
  715. <button type="button" class="help-btn" id="btnAitableHelp" title="钉钉 AI 表格配置说明" aria-expanded="false">?</button>
  716. <div class="help-popover pop-left" id="aitableHelpPopover" hidden>
  717. <div class="help-popover-title">钉钉 AI 表格 · 配置说明</div>
  718. <ol class="help-popover-steps">
  719. <li><b>前置条件:</b>钉钉企业内部应用需开通「AI 表格」API 权限。</li>
  720. <li><b>Base ID:</b>可直接粘贴分享链接(形如 alidocs.dingtalk.com/i/nodes/xxx),保存时自动提取 ID;三张表名留空用默认值。</li>
  721. <li><b>为什么拆三张表:</b>云端按维度拆表(门店明细/连锁汇总/公司汇总),每张表内粒度唯一,钉钉 AI 问数/人工聚合不会跨维度算重。</li>
  722. <li><b>推送与拉取:</b>取数机「同步 → 自动推送」(数据采集页有手动推送按钮),其他电脑在「数据中台」页执行「云端拉取」。本面板只管配置。</li>
  723. </ol>
  724. </div>
  725. </span>
  726. </div>
  727. <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>
  728. <div class="panel-body">
  729. <div class="field">
  730. <label style="display:flex;align-items:center;gap:6px;">
  731. <input type="checkbox" id="settingsAitableEnabled">
  732. <span>启用(同步完成后自动推送增量到云端)</span>
  733. </label>
  734. <label style="display:flex;align-items:center;gap:6px;">
  735. <input type="checkbox" id="settingsAitableReadOnly">
  736. <span>云端写保护(本机只拉不推,防误推坏数据;要推送需先回这里关闭)</span>
  737. </label>
  738. </div>
  739. <div class="field">
  740. <label>AppKey / AppSecret(钉钉企业内部应用)</label>
  741. <input type="text" id="settingsAitableAppKey" placeholder="钉钉开放平台应用的 AppKey" autocomplete="off">
  742. <input type="text" id="settingsAitableAppSecret" placeholder="AppSecret 未设置" autocomplete="off" style="margin-top:6px;">
  743. </div>
  744. <div class="field">
  745. <label>Base ID / 三张数据表名称</label>
  746. <input type="text" id="settingsAitableBaseId" placeholder="粘贴 AI 表格分享链接或直接填 Base ID" autocomplete="off">
  747. <div class="sheet-names-grid">
  748. <input type="text" id="settingsAitableSheetDetail" placeholder="门店明细" autocomplete="off">
  749. <input type="text" id="settingsAitableSheetChain" placeholder="连锁汇总" autocomplete="off">
  750. <input type="text" id="settingsAitableSheetCompany" placeholder="公司汇总" autocomplete="off">
  751. </div>
  752. </div>
  753. <div class="settings-links">
  754. <button type="button" class="settings-link settings-link-btn" id="btnTestAitable"><span>测试连通</span></button>
  755. <span id="aitableStatus" class="badge"></span>
  756. </div>
  757. <div class="panel-save-row">
  758. <button class="btn btn-primary btn-small" id="btnSaveAitable">保存设置</button>
  759. <span id="aitableSaveStatus" class="badge"></span>
  760. </div>
  761. </div>
  762. </div>
  763. </div>
  764. </div>
  765. </main>
  766. </div>
  767. <!-- ==================== 系统日志 ==================== --> <!-- ==================== 系统日志 ==================== -->
  768. <div id="viewLogs" class="view">
  769. <main class="content">
  770. <div class="page-header">
  771. <div>
  772. <h1>系统日志</h1>
  773. <div class="sub">任务与系统的实时运行日志(最近 500 条,自动刷新)</div>
  774. </div>
  775. </div>
  776. <div class="panel panel-fixed panel-log settings-log">
  777. <div class="panel-title">
  778. <span>实时日志</span>
  779. <span class="actions">
  780. <button class="btn btn-ghost btn-small" id="btnClearLog">清空日志</button>
  781. </span>
  782. </div>
  783. <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>
  784. <div class="log-box" id="logPanel"></div>
  785. </div>
  786. </main>
  787. </div>
  788. </div>
  789. </div>
  790. <div class="toast-wrap" id="toast-wrap"></div>
  791. <!-- 添加店铺弹窗 -->
  792. <div class="modal-overlay" id="modalAddShop" hidden>
  793. <div class="modal">
  794. <div class="modal-header">
  795. <div class="modal-title">
  796. <span class="modal-status-icon">
  797. <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>
  798. </span>
  799. <span>添加店铺</span>
  800. </div>
  801. <button class="modal-close" id="btnCloseModal">&times;</button>
  802. </div>
  803. <div class="modal-body">
  804. <div class="field">
  805. <label>店铺清单</label>
  806. <textarea id="manualInput" rows="5" placeholder="每行一个:shopId 店铺名&#10;507068342 鑫龙福麻辣烫(康诺美食城店)"></textarea>
  807. <div class="help">每行一条,shopId 和店铺名用空格或逗号分隔</div>
  808. </div>
  809. </div>
  810. <div class="modal-footer">
  811. <button class="btn btn-ghost btn-small" id="btnCancelAdd">取消</button>
  812. <button class="btn btn-primary btn-small" id="useManualBtn">确认添加</button>
  813. </div>
  814. </div>
  815. </div>
  816. <!-- 列设置弹窗 -->
  817. <div class="modal-overlay" id="modalReportColumns" hidden>
  818. <div class="modal">
  819. <div class="modal-header">
  820. <div class="modal-title">
  821. <span class="modal-status-icon">
  822. <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>
  823. </span>
  824. <span>列设置</span>
  825. </div>
  826. <button class="modal-close" id="btnCloseColumnCfg">&times;</button>
  827. </div>
  828. <div class="modal-body">
  829. <div class="help" style="margin-bottom:8px;">勾选需要在报表中展示的字段(日期与门店名称固定展示)</div>
  830. <div class="colcfg-list" id="columnCfgList"></div>
  831. </div>
  832. <div class="modal-footer">
  833. <button class="btn btn-ghost btn-small" id="btnResetColumns">恢复默认</button>
  834. <button class="btn btn-primary btn-small" id="btnApplyColumns">应用</button>
  835. </div>
  836. </div>
  837. </div>
  838. <!-- 取数诊断弹窗(隐藏入口:连点侧边栏版本号 5 次显现) -->
  839. <div class="modal-overlay" id="modalNaposDiagnose" hidden>
  840. <div class="modal modal-wide">
  841. <div class="modal-header">
  842. <div class="modal-title">
  843. <span class="modal-status-icon">
  844. <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="M14.7 6.3a4.5 4.5 0 0 0-6 6L3 18l3 3 5.7-5.7a4.5 4.5 0 0 0 6-6L14 13l-3-3 3.7-3.7z"/></svg>
  845. </span>
  846. <span>取数诊断</span>
  847. </div>
  848. <button class="modal-close" id="btnCloseDiagnose">&times;</button>
  849. </div>
  850. <div class="modal-body">
  851. <div class="diagnose-summary" id="diagnoseSummary">正在诊断,约需半分钟,请勿关闭…</div>
  852. <details class="diagnose-raw">
  853. <summary>原始报告 JSON(复制或下载发给开发即可)</summary>
  854. <pre id="diagnoseJson"></pre>
  855. </details>
  856. </div>
  857. <div class="modal-footer">
  858. <button class="btn btn-ghost btn-small" id="btnCopyDiagnose">复制报告</button>
  859. <button class="btn btn-ghost btn-small" id="btnDownloadDiagnose">下载报告</button>
  860. <button class="btn btn-primary btn-small" id="btnDismissDiagnose">关闭</button>
  861. </div>
  862. </div>
  863. </div>
  864. <!-- 定向采集弹窗(隐藏入口:与取数诊断一起,连点侧边栏版本号 5 次显现) -->
  865. <div class="modal-overlay" id="modalHarvest" hidden>
  866. <div class="modal modal-wide">
  867. <div class="modal-header">
  868. <div class="modal-title">
  869. <span class="modal-status-icon">
  870. <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="3"/><path d="M5 12a7 7 0 0 1 1.5-4.3M19 12a7 7 0 0 0-1.5-4.3M2.5 12a9.5 9.5 0 0 1 2-5.8M21.5 12a9.5 9.5 0 0 0-2-5.8"/></svg>
  871. </span>
  872. <span>定向采集接口</span>
  873. </div>
  874. <button class="modal-close" id="btnCloseHarvest">&times;</button>
  875. </div>
  876. <div class="modal-body">
  877. <ol class="help-popover-steps" style="position:static;opacity:1;visibility:visible;margin:0 0 10px;">
  878. <li><b>用途:</b>补录接口目录没有覆盖的页面(如「历史订单」「营业时间设置」),供开发侧定位数据源。</li>
  879. <li><b>用法:</b>点「开始采集」后,切到淘宝闪购客户端,<b>正常翻看目标页面约 2 分钟</b>(比如订单页点「历史订单」翻几页),时间到自动结束。</li>
  880. <li><b>安全:</b>只录下你浏览时页面自己发出的请求地址,不重放、不点击、不改任何数据。</li>
  881. <li><b>完成后:</b>点「复制清单」把结果发回开发侧即可。</li>
  882. </ol>
  883. <div class="field-row">
  884. <div class="field">
  885. <label>采集时长</label>
  886. <select id="harvestSeconds">
  887. <option value="60">1 分钟</option>
  888. <option value="120" selected>2 分钟</option>
  889. <option value="300">5 分钟</option>
  890. </select>
  891. </div>
  892. <div class="field" style="flex:0;">
  893. <label>&nbsp;</label>
  894. <button class="btn btn-primary btn-small" id="btnHarvestStart">开始采集</button>
  895. </div>
  896. </div>
  897. <div class="badge" id="harvestStatusBadge" style="margin-bottom:8px;">待开始</div>
  898. <div id="harvestSummary" class="diagnose-summary" hidden></div>
  899. <details class="diagnose-raw" id="harvestRawWrap" hidden>
  900. <summary>接口清单 JSON(复制发给开发即可)</summary>
  901. <pre id="harvestJson"></pre>
  902. </details>
  903. </div>
  904. <div class="modal-footer">
  905. <button class="btn btn-ghost btn-small" id="btnCopyHarvest" hidden>复制清单</button>
  906. <button class="btn btn-ghost btn-small" id="btnHarvestStop" hidden>提前结束</button>
  907. <button class="btn btn-primary btn-small" id="btnDismissHarvest">关闭</button>
  908. </div>
  909. </div>
  910. </div>
  911. <!-- 数据同步弹窗 -->
  912. <div class="modal-overlay" id="modalReportSync" hidden>
  913. <div class="modal modal-wide">
  914. <div class="modal-header">
  915. <div class="modal-title">
  916. <span class="modal-status-icon">
  917. <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>
  918. </span>
  919. <span>同步数据到本地</span>
  920. </div>
  921. <button class="modal-close" id="btnCloseSync">&times;</button>
  922. </div>
  923. <div class="modal-body">
  924. <div class="badge" id="syncEntityBadge">未识别主体</div>
  925. <div class="field">
  926. <label>同步范围</label>
  927. <select id="syncScope">
  928. <option value="all" selected>全部(公司 + 连锁 + 门店明细)</option>
  929. <option value="shop">仅门店明细</option>
  930. <option value="company">仅公司 / 连锁汇总</option>
  931. <option value="custom">指定门店</option>
  932. </select>
  933. </div>
  934. <div class="field" id="syncShopPickWrap" hidden>
  935. <label>选择门店</label>
  936. <div class="scan-dropdown" id="syncShopDropdown">
  937. <button type="button" class="scan-dropdown-trigger" id="syncShopTrigger" aria-expanded="false" aria-haspopup="listbox">
  938. <span id="syncShopText">选择门店</span>
  939. <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>
  940. </button>
  941. <div class="scan-dropdown-menu" id="syncShopMenu" role="listbox" aria-multiselectable="true" hidden></div>
  942. </div>
  943. </div>
  944. <div class="field">
  945. <label>日期范围</label>
  946. <select id="syncRange">
  947. <option value="1">昨日</option>
  948. <option value="7">近 7 天</option>
  949. <option value="30" selected>近 30 天</option>
  950. <option value="90">近 90 天</option>
  951. </select>
  952. <div class="help">经营数据后台保留约 180 天;当天数据未结算,同步区间右端取昨日</div>
  953. </div>
  954. <div class="field">
  955. <label>每日自动同步</label>
  956. <div style="display:flex;gap:10px;align-items:center;">
  957. <label style="display:flex;align-items:center;gap:6px;margin:0;white-space:nowrap;">
  958. <input type="checkbox" id="autoSyncEnabled" />
  959. <span>每天自动同步昨日数据</span>
  960. </label>
  961. <input type="time" id="autoSyncTime" value="06:00" style="width:110px;" />
  962. </div>
  963. <div class="help">需商家客户端以调试端口运行;到点时客户端在线即自动补同步昨日数据,离线则当天在线后补跑。同步记录照常进入同步记录列表。</div>
  964. </div>
  965. <div id="syncProgressWrap" hidden>
  966. <div class="sync-progress-row">
  967. <div class="sync-progress-bar"><span id="syncProgressBar"></span></div>
  968. <span class="badge badge-info" id="syncProgressText">0 / 0</span>
  969. </div>
  970. <div class="sync-stat-row">
  971. <span class="badge badge-ok" id="syncStatAdded">新增 0</span>
  972. <span class="badge badge-info" id="syncStatUpdated">更新 0</span>
  973. <span class="badge badge-fail" id="syncStatFailed">失败 0</span>
  974. <button class="btn btn-ghost btn-small" id="btnSyncCancel" hidden>取消</button>
  975. </div>
  976. <div class="sync-steps" id="syncSteps"></div>
  977. </div>
  978. <div class="help" id="syncHint">同步会把所选区间逐日、逐店的经营数据写入本地数据湖(data/reports/),可反复同步自动去重合并。</div>
  979. </div>
  980. <div class="modal-footer">
  981. <button class="btn btn-ghost btn-small" id="btnCancelSync">关闭</button>
  982. <button class="btn btn-primary btn-small" id="btnStartSync">开始同步</button>
  983. </div>
  984. </div>
  985. </div>
  986. <script src="/crawl.js"></script>
  987. <script src="/gen.js"></script>
  988. <script src="/tasks.js"></script>
  989. <script src="/history.js"></script>
  990. <script src="/vendor/echarts.min.js"></script>
  991. <script src="/analysis-templates.js"></script>
  992. <script src="/reports.js"></script>
  993. <script src="/lake.js"></script>
  994. <script src="/ask.js"></script>
  995. <script src="/app.js"></script>
  996. </body>
  997. </html>