fresh-mint-pl-plan-delivery-time-column-demo.html 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636
  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>运输计划列表 · 送货时间列 Demo</title>
  7. <link rel="preconnect" href="https://fonts.googleapis.com" />
  8. <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
  9. <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet" />
  10. <style>
  11. :root {
  12. --primary: #10b981;
  13. --primary-dark: #059669;
  14. --primary-bg: #ecfdf5;
  15. --text: #1e293b;
  16. --text-muted: #64748b;
  17. --border: #d9e8e2;
  18. --surface: #ffffff;
  19. --table-head: #f8fafc;
  20. --row-alt: #fafafa;
  21. --row-hover: #f1f5f9;
  22. --bg-page: #f1f5f9;
  23. --shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  24. --radius: 10px;
  25. --warn: #d97706;
  26. --info: #0284c7;
  27. --info-bg: #f0f9ff;
  28. }
  29. * { box-sizing: border-box; }
  30. body {
  31. margin: 0;
  32. min-height: 100vh;
  33. font-family: Inter, -apple-system, BlinkMacSystemFont, sans-serif;
  34. font-size: 14px;
  35. line-height: 1.5;
  36. color: var(--text);
  37. background: var(--bg-page);
  38. }
  39. .page { max-width: 1280px; margin: 0 auto; padding: 24px 20px 80px; }
  40. .hero {
  41. background: linear-gradient(135deg, #ecfdf5 0%, #fff 55%, #f0f9ff 100%);
  42. border: 1px solid var(--border);
  43. border-radius: var(--radius);
  44. padding: 22px 24px;
  45. margin-bottom: 16px;
  46. box-shadow: var(--shadow);
  47. }
  48. .hero h1 { margin: 0 0 8px; font-size: 22px; font-weight: 700; }
  49. .hero h1 em { font-style: normal; color: var(--primary-dark); }
  50. .hero p { margin: 0; color: var(--text-muted); max-width: 920px; }
  51. .meta {
  52. display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px;
  53. }
  54. .chip {
  55. display: inline-flex; align-items: center; gap: 6px;
  56. padding: 4px 10px; border-radius: 999px;
  57. background: var(--primary-bg); color: var(--primary-dark);
  58. font-size: 12px; font-weight: 600;
  59. }
  60. .chip.muted { background: #f1f5f9; color: var(--text-muted); }
  61. .compare-bar {
  62. display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  63. margin-bottom: 14px;
  64. }
  65. .compare-btn {
  66. border: 1px solid var(--border);
  67. background: #fff;
  68. color: var(--text-muted);
  69. border-radius: 999px;
  70. padding: 8px 16px;
  71. font-size: 13px;
  72. font-weight: 600;
  73. cursor: pointer;
  74. font-family: inherit;
  75. transition: all .15s ease;
  76. }
  77. .compare-btn:hover { border-color: #a7f3d0; color: var(--primary-dark); }
  78. .compare-btn.active {
  79. background: var(--primary);
  80. border-color: var(--primary);
  81. color: #fff;
  82. }
  83. .compare-btn .badge {
  84. display: inline-block;
  85. margin-left: 6px;
  86. padding: 1px 7px;
  87. border-radius: 999px;
  88. font-size: 11px;
  89. font-weight: 700;
  90. background: rgba(255,255,255,.22);
  91. }
  92. .compare-btn:not(.active) .badge {
  93. background: var(--primary-bg);
  94. color: var(--primary-dark);
  95. }
  96. .hint {
  97. margin-left: auto;
  98. font-size: 12px;
  99. color: var(--text-muted);
  100. }
  101. .hint strong { color: var(--primary-dark); }
  102. .panel {
  103. background: var(--surface);
  104. border: 1px solid var(--border);
  105. border-radius: var(--radius);
  106. box-shadow: var(--shadow);
  107. overflow: hidden;
  108. }
  109. .panel-top {
  110. padding: 14px 18px;
  111. border-bottom: 1px solid var(--border);
  112. display: flex;
  113. align-items: center;
  114. gap: 12px;
  115. }
  116. .panel-top h2 {
  117. margin: 0;
  118. font-size: 16px;
  119. font-weight: 700;
  120. display: flex;
  121. align-items: center;
  122. gap: 8px;
  123. }
  124. .panel-top h2::before {
  125. content: "";
  126. width: 3px;
  127. height: 16px;
  128. border-radius: 2px;
  129. background: var(--primary);
  130. }
  131. .panel-note {
  132. margin-left: auto;
  133. font-size: 12px;
  134. color: var(--text-muted);
  135. }
  136. .toolbar {
  137. display: flex;
  138. flex-wrap: wrap;
  139. gap: 8px;
  140. align-items: center;
  141. padding: 12px 16px;
  142. border-bottom: 1px solid var(--border);
  143. }
  144. .pill {
  145. border: 1px solid var(--border);
  146. background: #fff;
  147. border-radius: 999px;
  148. padding: 6px 12px;
  149. font-size: 12px;
  150. color: var(--text-muted);
  151. cursor: default;
  152. }
  153. .pill.active {
  154. background: var(--primary-bg);
  155. border-color: #a7f3d0;
  156. color: var(--primary-dark);
  157. font-weight: 600;
  158. }
  159. .search {
  160. flex: 1;
  161. min-width: 220px;
  162. max-width: 360px;
  163. height: 36px;
  164. border: 1px solid var(--border);
  165. border-radius: 8px;
  166. padding: 0 12px;
  167. color: var(--text-muted);
  168. background: #fff;
  169. display: flex;
  170. align-items: center;
  171. font-size: 13px;
  172. }
  173. .btn {
  174. height: 36px;
  175. border-radius: 8px;
  176. border: 1px solid var(--border);
  177. background: #fff;
  178. padding: 0 14px;
  179. font-size: 13px;
  180. font-weight: 600;
  181. color: var(--text);
  182. cursor: default;
  183. }
  184. .btn.main {
  185. background: var(--primary);
  186. border-color: var(--primary);
  187. color: #fff;
  188. }
  189. table {
  190. width: 100%;
  191. border-collapse: collapse;
  192. table-layout: fixed;
  193. }
  194. th, td {
  195. padding: 10px 12px;
  196. border-bottom: 1px solid var(--border);
  197. text-align: center;
  198. vertical-align: middle;
  199. font-size: 13px;
  200. }
  201. th {
  202. background: var(--table-head);
  203. color: var(--text-muted);
  204. font-weight: 600;
  205. white-space: nowrap;
  206. }
  207. tr:nth-child(even) td { background: var(--row-alt); }
  208. tr:hover td { background: var(--row-hover); }
  209. .col-left { text-align: left; }
  210. .muted { color: var(--text-muted); }
  211. .plan-no {
  212. color: var(--primary-dark);
  213. font-weight: 600;
  214. text-decoration: none;
  215. }
  216. .new-col {
  217. position: relative;
  218. background: linear-gradient(180deg, #ecfdf5 0%, #f8fafc 100%) !important;
  219. box-shadow: inset 0 0 0 2px rgba(16, 185, 129, 0.35);
  220. }
  221. td.new-col {
  222. background: #ecfdf5 !important;
  223. box-shadow: inset 0 0 0 1px rgba(16, 185, 129, 0.25);
  224. }
  225. .hdr {
  226. display: inline-flex;
  227. align-items: center;
  228. gap: 6px;
  229. justify-content: center;
  230. }
  231. .funnel {
  232. width: 16px;
  233. height: 16px;
  234. border: 0;
  235. background: transparent;
  236. cursor: pointer;
  237. padding: 0;
  238. color: var(--text-muted);
  239. display: inline-flex;
  240. align-items: center;
  241. justify-content: center;
  242. }
  243. .funnel.active { color: var(--primary-dark); }
  244. .funnel svg { width: 14px; height: 14px; }
  245. .times-join { letter-spacing: 0.01em; }
  246. .times-tags {
  247. display: flex;
  248. flex-wrap: wrap;
  249. gap: 4px;
  250. justify-content: center;
  251. }
  252. .tag {
  253. display: inline-block;
  254. padding: 1px 8px;
  255. border-radius: 4px;
  256. background: var(--info-bg);
  257. color: var(--info);
  258. font-size: 12px;
  259. font-weight: 600;
  260. border: 1px solid #bae6fd;
  261. }
  262. .times-stack {
  263. display: flex;
  264. flex-direction: column;
  265. gap: 2px;
  266. align-items: center;
  267. line-height: 1.35;
  268. }
  269. .status {
  270. display: inline-block;
  271. padding: 2px 8px;
  272. border-radius: 4px;
  273. font-size: 12px;
  274. font-weight: 600;
  275. color: #fff;
  276. background: var(--primary-dark);
  277. }
  278. .status.warn { background: var(--warn); }
  279. .filter-pop {
  280. display: none;
  281. position: absolute;
  282. top: calc(100% + 6px);
  283. left: 50%;
  284. transform: translateX(-50%);
  285. width: 280px;
  286. background: #fff;
  287. border: 1px solid var(--border);
  288. border-radius: 10px;
  289. box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  290. padding: 12px;
  291. z-index: 20;
  292. text-align: left;
  293. }
  294. .filter-pop.open { display: block; }
  295. .filter-pop label {
  296. display: block;
  297. font-size: 11px;
  298. color: var(--text-muted);
  299. margin-bottom: 4px;
  300. }
  301. .filter-pop .row {
  302. display: grid;
  303. grid-template-columns: 1fr 1fr;
  304. gap: 8px;
  305. margin-bottom: 10px;
  306. }
  307. .filter-pop input {
  308. width: 100%;
  309. height: 32px;
  310. border: 1px solid var(--border);
  311. border-radius: 6px;
  312. padding: 0 8px;
  313. font-size: 12px;
  314. font-family: inherit;
  315. }
  316. .filter-pop .actions {
  317. display: flex;
  318. justify-content: flex-end;
  319. gap: 8px;
  320. }
  321. .filter-pop .actions button {
  322. height: 28px;
  323. border-radius: 6px;
  324. border: 1px solid var(--border);
  325. background: #fff;
  326. padding: 0 10px;
  327. font-size: 12px;
  328. cursor: pointer;
  329. font-family: inherit;
  330. }
  331. .filter-pop .actions .ok {
  332. background: var(--primary);
  333. border-color: var(--primary);
  334. color: #fff;
  335. font-weight: 600;
  336. }
  337. .filter-note {
  338. font-size: 11px;
  339. color: var(--text-muted);
  340. margin: 0 0 10px;
  341. line-height: 1.4;
  342. }
  343. .legend {
  344. display: grid;
  345. grid-template-columns: 1fr 1fr 1fr;
  346. gap: 12px;
  347. margin-top: 16px;
  348. }
  349. @media (max-width: 960px) { .legend { grid-template-columns: 1fr; } }
  350. .legend-card {
  351. background: #fff;
  352. border: 1px solid var(--border);
  353. border-radius: var(--radius);
  354. padding: 14px 16px;
  355. box-shadow: var(--shadow);
  356. }
  357. .legend-card h3 {
  358. margin: 0 0 6px;
  359. font-size: 13px;
  360. font-weight: 700;
  361. }
  362. .legend-card p {
  363. margin: 0;
  364. font-size: 12px;
  365. color: var(--text-muted);
  366. }
  367. .legend-card.rec {
  368. border-color: #a7f3d0;
  369. background: linear-gradient(180deg, #ecfdf5, #fff);
  370. }
  371. .rec-badge {
  372. display: inline-block;
  373. margin-left: 6px;
  374. padding: 1px 7px;
  375. border-radius: 999px;
  376. font-size: 11px;
  377. background: var(--primary);
  378. color: #fff;
  379. font-weight: 700;
  380. vertical-align: middle;
  381. }
  382. .data-note {
  383. margin-top: 14px;
  384. padding: 12px 14px;
  385. background: #fff;
  386. border: 1px dashed #a7f3d0;
  387. border-radius: 10px;
  388. font-size: 12px;
  389. color: var(--text-muted);
  390. }
  391. .data-note strong { color: var(--text); }
  392. code {
  393. font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  394. font-size: 11px;
  395. background: #f1f5f9;
  396. padding: 1px 5px;
  397. border-radius: 4px;
  398. }
  399. </style>
  400. </head>
  401. <body>
  402. <div class="page">
  403. <header class="hero">
  404. <h1>运输计划 · 新增列 <em>送货时间</em></h1>
  405. <p>
  406. 插入位置:<strong>计划日期</strong> 之后。数据来自各<strong>送货段</strong>
  407. <code>pl_plan_delivery.delivery_time</code>,去重后展示;列头漏斗支持日期区间过滤
  408. (与计划日期列交互一致)。下方可切换三种单元格展示方案。
  409. </p>
  410. <div class="meta">
  411. <span class="chip">列:送货时间</span>
  412. <span class="chip">去重 · 升序</span>
  413. <span class="chip">过滤:日期区间</span>
  414. <span class="chip muted">表单取值格式 YYYY-MM-DD</span>
  415. </div>
  416. </header>
  417. <div class="compare-bar">
  418. <button type="button" class="compare-btn active" data-mode="join">
  419. A · 逗号拼接 <span class="badge">推荐</span>
  420. </button>
  421. <button type="button" class="compare-btn" data-mode="tags">B · 标签堆叠</button>
  422. <button type="button" class="compare-btn" data-mode="stack">C · 多行换行</button>
  423. <span class="hint">当前方案:<strong id="modeLabel">逗号拼接</strong></span>
  424. </div>
  425. <section class="panel">
  426. <div class="panel-top">
  427. <h2>运输计划列表(示意)</h2>
  428. <span class="panel-note">绿色描边列为新增「送货时间」· 点击漏斗可预览过滤浮层</span>
  429. </div>
  430. <div class="toolbar">
  431. <span class="pill active">今天</span>
  432. <span class="pill">近 7 天</span>
  433. <span class="pill">本月</span>
  434. <div class="search">计划编号 / 供方 / 需方 / 产品名称 / 车牌号</div>
  435. <button class="btn main" type="button">新增计划</button>
  436. <button class="btn" type="button">安排运输</button>
  437. </div>
  438. <div style="overflow-x: auto;">
  439. <table>
  440. <thead>
  441. <tr>
  442. <th style="width: 48px;">#</th>
  443. <th class="col-left" style="width: 140px;">计划编号</th>
  444. <th style="width: 100px;">跟进状态</th>
  445. <th style="width: 120px;">
  446. <span class="hdr">计划日期
  447. <span class="funnel" title="计划日期过滤(既有)" aria-hidden="true">
  448. <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M4 6h16M7 12h10M10 18h4"/></svg>
  449. </span>
  450. </span>
  451. </th>
  452. <th style="width: 168px;" class="new-col">
  453. <span class="hdr">送货时间
  454. <button type="button" class="funnel active" id="deliveryFilterBtn" title="送货时间过滤" aria-label="送货时间过滤">
  455. <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M4 6h16M7 12h10M10 18h4"/></svg>
  456. </button>
  457. </span>
  458. <div class="filter-pop" id="deliveryFilterPop">
  459. <p class="filter-note">
  460. 过滤语义示意:任一送货段时间落在区间内即命中该计划
  461. (EXISTS 子查询,不对主表 <code>pl_plan.delivery_time</code> 过滤)。
  462. </p>
  463. <div class="row">
  464. <div>
  465. <label>开始日期</label>
  466. <input type="date" value="2026-09-12" />
  467. </div>
  468. <div>
  469. <label>结束日期</label>
  470. <input type="date" value="2026-09-14" />
  471. </div>
  472. </div>
  473. <div class="actions">
  474. <button type="button" id="filterReset">重置</button>
  475. <button type="button" class="ok" id="filterOk">确定</button>
  476. </div>
  477. </div>
  478. </th>
  479. <th style="width: 90px;">单据类型</th>
  480. <th style="width: 110px;">车牌号</th>
  481. <th class="col-left">客户 / 段次摘要</th>
  482. </tr>
  483. </thead>
  484. <tbody id="tbody"></tbody>
  485. </table>
  486. </div>
  487. </section>
  488. <div class="legend">
  489. <article class="legend-card rec">
  490. <h3>A · 逗号拼接<span class="rec-badge">推荐</span></h3>
  491. <p>与「多值文本列」一致,窄列可读;去重后如 <code>09-12, 09-14</code>。合并单元格场景最稳。</p>
  492. </article>
  493. <article class="legend-card">
  494. <h3>B · 标签堆叠</h3>
  495. <p>视觉区分更强,但列宽吃得更多,合并行高度波动大。</p>
  496. </article>
  497. <article class="legend-card">
  498. <h3>C · 多行换行</h3>
  499. <p>每行一个日期,对齐清晰;行高会随段次数增加,列表节奏变松。</p>
  500. </article>
  501. </div>
  502. <div class="data-note">
  503. <strong>示例数据说明:</strong>
  504. PO20260912001 有 3 个送货段,时间 <code>09-12 / 09-12 / 09-14</code> → 去重后 2 个;
  505. PO20260912002 单段;PO20260912003 两段不同日;PO20260912004 无送货时间 → 展示「—」。
  506. 主表冗余字段 <code>pl_plan.delivery_time</code> 仅同步首段,<strong>不作为本列数据源</strong>。
  507. </div>
  508. </div>
  509. <script>
  510. const rows = [
  511. {
  512. no: 'PO20260912001',
  513. status: '待安排',
  514. statusClass: 'warn',
  515. planDate: '2026-09-12',
  516. times: ['2026-09-12', '2026-09-12', '2026-09-14'],
  517. type: '直销单',
  518. plate: '皖A·D1234',
  519. customer: '甲客户 → 乙客户 / 丙客户'
  520. },
  521. {
  522. no: 'PO20260912002',
  523. status: '已安排',
  524. statusClass: '',
  525. planDate: '2026-09-12',
  526. times: ['2026-09-12'],
  527. type: '出库单',
  528. plate: '皖A·E5678',
  529. customer: '云栋仓库 → 丁客户'
  530. },
  531. {
  532. no: 'PO20260912003',
  533. status: '已安排',
  534. statusClass: '',
  535. planDate: '2026-09-13',
  536. times: ['2026-09-13', '2026-09-15'],
  537. type: '入库单',
  538. plate: '—',
  539. customer: '戊供应商 → 山峡库'
  540. },
  541. {
  542. no: 'PO20260912004',
  543. status: '等通知',
  544. statusClass: 'warn',
  545. planDate: '2026-09-14',
  546. times: [],
  547. type: '直销单',
  548. plate: '—',
  549. customer: '己客户(待补送货时间)'
  550. }
  551. ]
  552. function uniqSorted(times) {
  553. return [...new Set(times.filter(Boolean))].sort()
  554. }
  555. function shortDate(iso) {
  556. if (!iso) return '—'
  557. const m = String(iso).match(/(\d{4})-(\d{2})-(\d{2})/)
  558. return m ? `${m[2]}-${m[3]}` : iso
  559. }
  560. function renderTimes(times, mode) {
  561. const list = uniqSorted(times)
  562. if (!list.length) return '<span class="muted">—</span>'
  563. if (mode === 'tags') {
  564. return `<div class="times-tags">${list.map((t) => `<span class="tag">${shortDate(t)}</span>`).join('')}</div>`
  565. }
  566. if (mode === 'stack') {
  567. return `<div class="times-stack">${list.map((t) => `<span>${shortDate(t)}</span>`).join('')}</div>`
  568. }
  569. return `<span class="times-join">${list.map(shortDate).join(', ')}</span>`
  570. }
  571. const labels = { join: '逗号拼接', tags: '标签堆叠', stack: '多行换行' }
  572. let mode = 'join'
  573. function render() {
  574. const tbody = document.getElementById('tbody')
  575. tbody.innerHTML = rows.map((r, i) => `
  576. <tr>
  577. <td class="muted">${i + 1}</td>
  578. <td class="col-left"><a class="plan-no" href="#">${r.no}</a></td>
  579. <td><span class="status ${r.statusClass}">${r.status}</span></td>
  580. <td>${r.planDate}</td>
  581. <td class="new-col">${renderTimes(r.times, mode)}</td>
  582. <td>${r.type}</td>
  583. <td>${r.plate}</td>
  584. <td class="col-left muted">${r.customer}</td>
  585. </tr>
  586. `).join('')
  587. document.getElementById('modeLabel').textContent = labels[mode]
  588. }
  589. document.querySelectorAll('.compare-btn').forEach((btn) => {
  590. btn.addEventListener('click', () => {
  591. document.querySelectorAll('.compare-btn').forEach((b) => b.classList.remove('active'))
  592. btn.classList.add('active')
  593. mode = btn.dataset.mode
  594. render()
  595. })
  596. })
  597. const pop = document.getElementById('deliveryFilterPop')
  598. const filterBtn = document.getElementById('deliveryFilterBtn')
  599. filterBtn.addEventListener('click', (e) => {
  600. e.stopPropagation()
  601. pop.classList.toggle('open')
  602. })
  603. document.getElementById('filterOk').addEventListener('click', () => pop.classList.remove('open'))
  604. document.getElementById('filterReset').addEventListener('click', () => {
  605. pop.querySelectorAll('input').forEach((el) => { el.value = '' })
  606. })
  607. document.addEventListener('click', (e) => {
  608. if (!pop.contains(e.target) && e.target !== filterBtn && !filterBtn.contains(e.target)) {
  609. pop.classList.remove('open')
  610. }
  611. })
  612. render()
  613. </script>
  614. </body>
  615. </html>