oa-start-history-demo.html 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555
  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" />
  6. <title>OA 发起审批 · 历史记录 Demo</title>
  7. <style>
  8. :root {
  9. --primary: #10b981;
  10. --primary-dark: #059669;
  11. --primary-bg: #ecfdf5;
  12. --text: #334155;
  13. --text-strong: #0f172a;
  14. --text-muted: #94a3b8;
  15. --border: #cbd5e1;
  16. --bg: #f8fafc;
  17. --danger: #ef4444;
  18. --warning: #d97706;
  19. --info: #64748b;
  20. }
  21. * { box-sizing: border-box; }
  22. body {
  23. margin: 0;
  24. font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  25. font-size: 14px;
  26. line-height: 1.5;
  27. color: var(--text);
  28. background: var(--bg);
  29. }
  30. .page { max-width: 1100px; margin: 0 auto; padding: 24px; }
  31. .note {
  32. margin-bottom: 16px;
  33. padding: 12px 16px;
  34. background: #fff;
  35. border: 1px solid var(--border);
  36. border-radius: 10px;
  37. color: var(--text-muted);
  38. font-size: 13px;
  39. }
  40. .note strong { color: var(--text-strong); }
  41. .search-wrap { display: flex; justify-content: center; margin: 8px 0 20px; }
  42. .search {
  43. width: min(520px, 100%);
  44. height: 42px;
  45. padding: 0 16px 0 40px;
  46. border: 1px solid var(--border);
  47. border-radius: 999px;
  48. background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85zm-5.242.656a5 5 0 1 1 0-10 5 5 0 0 1 0 10z'/%3E%3C/svg%3E") 14px center no-repeat;
  49. box-shadow: 0 1px 2px rgb(15 23 42 / 6%);
  50. outline: none;
  51. }
  52. .tabs { display: flex; gap: 28px; margin-bottom: 8px; }
  53. .tab {
  54. padding: 0 0 12px;
  55. border: 0;
  56. background: none;
  57. font-size: 16px;
  58. font-weight: 600;
  59. color: var(--text);
  60. cursor: pointer;
  61. }
  62. .tab.active {
  63. color: var(--text-strong);
  64. box-shadow: inset 0 -3px 0 var(--text-strong);
  65. }
  66. .hint { color: var(--text-muted); font-size: 13px; margin: 8px 0 20px; }
  67. .section-head {
  68. display: flex;
  69. align-items: center;
  70. gap: 8px;
  71. margin-bottom: 14px;
  72. }
  73. .section-head h3 { margin: 0; font-size: 14px; font-weight: 600; }
  74. .dot { width: 6px; height: 6px; border-radius: 50%; background: #f87171; }
  75. .meta { margin-left: auto; color: var(--text-muted); font-size: 12px; }
  76. .card-row { display: flex; flex-wrap: wrap; gap: 16px; }
  77. .card {
  78. display: flex;
  79. flex-direction: column;
  80. gap: 12px;
  81. width: 280px;
  82. min-height: 100px;
  83. padding: 14px 16px 10px;
  84. background: #fff;
  85. border: 1px solid var(--border);
  86. border-radius: 14px;
  87. box-shadow: 0 2px 8px rgb(15 23 42 / 8%);
  88. transition: border-color .15s, box-shadow .15s, transform .15s;
  89. }
  90. .card:hover {
  91. border-color: #86efac;
  92. box-shadow: 0 4px 14px rgb(16 185 129 / 16%);
  93. transform: translateY(-1px);
  94. }
  95. .card-main { display: flex; gap: 14px; align-items: center; }
  96. .icon {
  97. width: 40px; height: 40px; border-radius: 10px;
  98. background: linear-gradient(135deg, #34d399, #059669);
  99. color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 14px;
  100. flex-shrink: 0;
  101. }
  102. .icon.blue { background: linear-gradient(135deg, #60a5fa, #2563eb); }
  103. .icon.amber { background: linear-gradient(135deg, #fbbf24, #d97706); }
  104. .name { display: block; font-weight: 600; color: var(--text-strong); }
  105. .desc { display: block; margin-top: 4px; font-size: 12px; color: var(--text-muted); }
  106. .ops {
  107. display: flex;
  108. gap: 6px;
  109. justify-content: flex-end;
  110. padding-top: 8px;
  111. border-top: 1px solid #f1f5f9;
  112. }
  113. .btn {
  114. height: 26px;
  115. padding: 0 10px;
  116. border-radius: 5px;
  117. border: 1px solid var(--border);
  118. background: #fff;
  119. color: var(--text);
  120. font-size: 11px;
  121. cursor: pointer;
  122. display: inline-flex;
  123. align-items: center;
  124. gap: 3px;
  125. }
  126. .btn:hover { border-color: #86efac; color: var(--primary-dark); }
  127. .btn.primary {
  128. background: var(--primary);
  129. border-color: var(--primary);
  130. color: #fff;
  131. }
  132. .btn.primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }
  133. .btn.ghost-perm {
  134. border-style: dashed;
  135. color: var(--text-muted);
  136. }
  137. .legend {
  138. margin-top: 28px;
  139. padding: 14px 16px;
  140. background: #fff;
  141. border: 1px dashed #86efac;
  142. border-radius: 10px;
  143. font-size: 13px;
  144. }
  145. .legend code {
  146. padding: 1px 6px;
  147. background: var(--primary-bg);
  148. border-radius: 4px;
  149. color: var(--primary-dark);
  150. font-size: 12px;
  151. }
  152. /* Dialog */
  153. .mask {
  154. position: fixed; inset: 0;
  155. background: rgb(15 23 42 / 45%);
  156. display: none;
  157. align-items: flex-start;
  158. justify-content: center;
  159. padding: 40px 16px 24px;
  160. z-index: 50;
  161. overflow: auto;
  162. }
  163. .mask.open { display: flex; }
  164. .dialog {
  165. width: min(1080px, 100%);
  166. max-height: calc(100vh - 80px);
  167. background: #fff;
  168. border-radius: 12px;
  169. box-shadow: 0 20px 50px rgb(15 23 42 / 25%);
  170. display: flex;
  171. flex-direction: column;
  172. overflow: hidden;
  173. }
  174. .dialog-h {
  175. display: flex;
  176. align-items: center;
  177. justify-content: space-between;
  178. padding: 16px 20px;
  179. border-bottom: 1px solid #e2e8f0;
  180. }
  181. .dialog-h h2 {
  182. margin: 0;
  183. font-size: 16px;
  184. color: var(--text-strong);
  185. display: flex;
  186. align-items: center;
  187. gap: 8px;
  188. }
  189. .dialog-h h2::before {
  190. content: "";
  191. width: 3px; height: 16px;
  192. background: var(--primary);
  193. border-radius: 2px;
  194. }
  195. .close {
  196. width: 28px; height: 28px; border: 0; background: transparent;
  197. font-size: 18px; color: var(--text-muted); cursor: pointer; border-radius: 6px;
  198. }
  199. .close:hover { background: #f1f5f9; }
  200. .dialog-b { padding: 16px 20px; overflow: auto; flex: 1; }
  201. .filter {
  202. padding: 14px 16px;
  203. background: #f8fafc;
  204. border: 1px solid #e2e8f0;
  205. border-radius: 10px;
  206. margin-bottom: 14px;
  207. }
  208. .filter-grid {
  209. display: grid;
  210. grid-template-columns: repeat(3, 1fr);
  211. gap: 12px 16px;
  212. }
  213. .field label {
  214. display: block;
  215. font-size: 11px;
  216. color: var(--text-muted);
  217. margin-bottom: 4px;
  218. }
  219. .field input, .field select {
  220. width: 100%;
  221. height: 36px;
  222. padding: 0 10px;
  223. border: 1px solid var(--border);
  224. border-radius: 8px;
  225. background: #fff;
  226. font-size: 13px;
  227. color: var(--text);
  228. }
  229. .filter-actions {
  230. display: flex;
  231. justify-content: flex-end;
  232. gap: 8px;
  233. margin-top: 12px;
  234. }
  235. .btn-md {
  236. height: 36px;
  237. padding: 0 14px;
  238. border-radius: 8px;
  239. font-size: 13px;
  240. border: 1px solid var(--border);
  241. background: #fff;
  242. cursor: pointer;
  243. display: inline-flex;
  244. align-items: center;
  245. gap: 6px;
  246. }
  247. .btn-md.main {
  248. background: var(--primary);
  249. border-color: var(--primary);
  250. color: #fff;
  251. }
  252. table {
  253. width: 100%;
  254. border-collapse: collapse;
  255. font-size: 13px;
  256. }
  257. th, td {
  258. padding: 10px 8px;
  259. text-align: center;
  260. border-bottom: 1px solid #f1f5f9;
  261. white-space: nowrap;
  262. }
  263. th {
  264. color: var(--text-muted);
  265. font-weight: 600;
  266. background: #fafbfc;
  267. font-size: 12px;
  268. }
  269. tr:nth-child(even) td { background: #fafbfc; }
  270. tr:hover td { background: var(--primary-bg); }
  271. .tag {
  272. display: inline-block;
  273. padding: 2px 8px;
  274. border-radius: 999px;
  275. font-size: 12px;
  276. line-height: 1.4;
  277. }
  278. .tag.ok { background: #ecfdf5; color: #059669; }
  279. .tag.run { background: #ecfdf5; color: #047857; }
  280. .tag.reject { background: #fef2f2; color: #dc2626; }
  281. .tag.cancel { background: #f1f5f9; color: #64748b; }
  282. .link {
  283. color: var(--primary-dark);
  284. background: none;
  285. border: 0;
  286. cursor: pointer;
  287. font-size: 13px;
  288. padding: 0 4px;
  289. }
  290. .pager {
  291. display: flex;
  292. align-items: center;
  293. justify-content: flex-end;
  294. gap: 12px;
  295. margin-top: 12px;
  296. padding-top: 12px;
  297. border-top: 1px solid #e2e8f0;
  298. color: var(--text-muted);
  299. font-size: 13px;
  300. }
  301. .pager .btn { height: 28px; }
  302. .dyn-col { background: #f0fdf4 !important; color: #047857; }
  303. .dyn-cell { color: var(--text-strong); }
  304. @media (max-width: 900px) {
  305. .filter-grid { grid-template-columns: 1fr 1fr; }
  306. .card { width: 100%; }
  307. }
  308. </style>
  309. </head>
  310. <body>
  311. <div class="page">
  312. <div class="note">
  313. <strong>Demo 说明:</strong>在「发起审批」流程卡片上,【发起】左侧增加【历史记录】(按钮始终显示;全员数据靠权限字符)。
  314. 点击有权限示意卡片上的「历史记录」可打开弹窗。下方虚线按钮仅示意「无全员权限时仍显示历史,但只看本人」。
  315. </div>
  316. <div class="search-wrap">
  317. <input class="search" placeholder="请输入审批单名称" readonly />
  318. </div>
  319. <div class="tabs">
  320. <button class="tab active" type="button">全部</button>
  321. <button class="tab" type="button">人事</button>
  322. <button class="tab" type="button">财务</button>
  323. <button class="tab" type="button">行政</button>
  324. </div>
  325. <div class="hint">选择一个审批单即可发起 · 有权限时可查看该流程全员历史</div>
  326. <div class="section-head">
  327. <h3>人事</h3>
  328. <span class="dot"></span>
  329. <span class="meta">3 个表单</span>
  330. </div>
  331. <div class="card-row">
  332. <!-- 有权限:历史记录 + 发起 -->
  333. <div class="card">
  334. <div class="card-main">
  335. <div class="icon">假</div>
  336. <div>
  337. <span class="name">请假申请</span>
  338. <span class="desc">事假 / 年假 / 病假等</span>
  339. </div>
  340. </div>
  341. <div class="ops">
  342. <button class="btn" type="button" onclick="openHistory('请假申请')">历史记录</button>
  343. <button class="btn primary" type="button">发起</button>
  344. </div>
  345. </div>
  346. <div class="card">
  347. <div class="card-main">
  348. <div class="icon blue">出</div>
  349. <div>
  350. <span class="name">出差申请</span>
  351. <span class="desc">差旅事前审批</span>
  352. </div>
  353. </div>
  354. <div class="ops">
  355. <button class="btn" type="button" onclick="openHistory('出差申请')">历史记录</button>
  356. <button class="btn primary" type="button">发起</button>
  357. </div>
  358. </div>
  359. <!-- 无权限:仅发起 -->
  360. <div class="card">
  361. <div class="card-main">
  362. <div class="icon amber">补</div>
  363. <div>
  364. <span class="name">补卡申请</span>
  365. <span class="desc">无历史权限时不显示按钮</span>
  366. </div>
  367. </div>
  368. <div class="ops">
  369. <button class="btn ghost-perm" type="button" title="示意:无权限则不渲染此按钮" disabled>历史记录(隐藏)</button>
  370. <button class="btn primary" type="button">发起</button>
  371. </div>
  372. </div>
  373. </div>
  374. <div class="legend">
  375. <div><strong>交互点:</strong>点击「请假申请 / 出差申请」的 <code>历史记录</code> 打开弹窗</div>
  376. <div style="margin-top:6px">弹窗内:筛选(流程名称只读、审批状态、审批 ID、发起/完成时间段;全员权限另有申请人)+ 列表(标准列 + 表单前 6 个业务字段)+ 分页;操作查看/打印</div>
  377. </div>
  378. </div>
  379. <div class="mask" id="mask" onclick="onMask(event)">
  380. <div class="dialog" role="dialog" aria-modal="true">
  381. <div class="dialog-h">
  382. <h2 id="dlgTitle">历史记录 · 请假申请</h2>
  383. <button class="close" type="button" onclick="closeHistory()" aria-label="关闭">×</button>
  384. </div>
  385. <div class="dialog-b">
  386. <div class="filter">
  387. <div class="filter-grid">
  388. <div class="field">
  389. <label>流程名称</label>
  390. <input id="fAppName" value="请假申请" />
  391. </div>
  392. <div class="field">
  393. <label>审批状态</label>
  394. <select>
  395. <option value="">全部</option>
  396. <option>进行中</option>
  397. <option selected>已完成</option>
  398. <option>已拒绝</option>
  399. <option>已打回</option>
  400. <option>已撤销</option>
  401. </select>
  402. </div>
  403. <div class="field">
  404. <label>审批 ID</label>
  405. <input placeholder="请输入审批 ID" />
  406. </div>
  407. <div class="field">
  408. <label>发起时间</label>
  409. <input value="2026-08-01 至 2026-08-28" />
  410. </div>
  411. <div class="field">
  412. <label>完成时间</label>
  413. <input placeholder="YYYY-MM-DD 至 YYYY-MM-DD" />
  414. </div>
  415. </div>
  416. <div class="filter-actions">
  417. <button class="btn-md" type="button">重置</button>
  418. <button class="btn-md main" type="button">搜索</button>
  419. </div>
  420. </div>
  421. <div style="overflow:auto">
  422. <table>
  423. <thead>
  424. <tr>
  425. <th>序号</th>
  426. <th>审批 ID</th>
  427. <th>流程名称</th>
  428. <th>申请人</th>
  429. <th class="dyn-col">请假类型 ★</th>
  430. <th class="dyn-col">开始日期 ★</th>
  431. <th class="dyn-col">请假天数 ★</th>
  432. <th class="dyn-col">结束日期 ★</th>
  433. <th class="dyn-col">请假事由 ★</th>
  434. <th class="dyn-col">附件说明 ★</th>
  435. <th>发起时间</th>
  436. <th>完成时间</th>
  437. <th>审批状态</th>
  438. <th>当前节点</th>
  439. <th>操作</th>
  440. </tr>
  441. </thead>
  442. <tbody>
  443. <tr>
  444. <td>1</td>
  445. <td>a1b2c3d4-e5f6</td>
  446. <td>请假申请</td>
  447. <td>张三</td>
  448. <td class="dyn-cell">年假</td>
  449. <td class="dyn-cell">2026-09-01</td>
  450. <td class="dyn-cell">2</td>
  451. <td class="dyn-cell">2026-09-02</td>
  452. <td class="dyn-cell">家庭事务</td>
  453. <td class="dyn-cell">-</td>
  454. <td>2026-08-28 09:12</td>
  455. <td>2026-08-28 11:30</td>
  456. <td><span class="tag ok">已完成</span></td>
  457. <td>—</td>
  458. <td><button class="link" type="button">查看</button></td>
  459. </tr>
  460. <tr>
  461. <td>2</td>
  462. <td>b2c3d4e5-f6a7</td>
  463. <td>请假申请</td>
  464. <td>李四</td>
  465. <td class="dyn-cell">事假</td>
  466. <td class="dyn-cell">2026-08-29</td>
  467. <td class="dyn-cell">1</td>
  468. <td class="dyn-cell">2026-08-29</td>
  469. <td class="dyn-cell">外出办事</td>
  470. <td class="dyn-cell">-</td>
  471. <td>2026-08-27 14:05</td>
  472. <td>—</td>
  473. <td><span class="tag run">进行中</span></td>
  474. <td>部门负责人</td>
  475. <td><button class="link" type="button">查看</button></td>
  476. </tr>
  477. <tr>
  478. <td>3</td>
  479. <td>c3d4e5f6-a7b8</td>
  480. <td>请假申请</td>
  481. <td>王五</td>
  482. <td class="dyn-cell">病假</td>
  483. <td class="dyn-cell">2026-08-26</td>
  484. <td class="dyn-cell">3</td>
  485. <td class="dyn-cell">2026-08-28</td>
  486. <td class="dyn-cell">就医</td>
  487. <td class="dyn-cell">医院证明</td>
  488. <td>2026-08-25 10:22</td>
  489. <td>2026-08-25 16:40</td>
  490. <td><span class="tag reject">已拒绝</span></td>
  491. <td>—</td>
  492. <td><button class="link" type="button">查看</button></td>
  493. </tr>
  494. <tr>
  495. <td>4</td>
  496. <td>d4e5f6a7-b8c9</td>
  497. <td>请假申请</td>
  498. <td>赵六</td>
  499. <td class="dyn-cell">年假</td>
  500. <td class="dyn-cell">2026-08-22</td>
  501. <td class="dyn-cell">0.5</td>
  502. <td class="dyn-cell">2026-08-22</td>
  503. <td class="dyn-cell">休息</td>
  504. <td class="dyn-cell">-</td>
  505. <td>2026-08-20 08:50</td>
  506. <td>2026-08-20 09:10</td>
  507. <td><span class="tag cancel">已撤销</span></td>
  508. <td>—</td>
  509. <td><button class="link" type="button">查看</button></td>
  510. </tr>
  511. </tbody>
  512. </table>
  513. </div>
  514. <div class="pager">
  515. <span>共 28 条</span>
  516. <button class="btn" type="button">上一页</button>
  517. <span>第 1 / 3 页</span>
  518. <button class="btn" type="button">下一页</button>
  519. </div>
  520. <p style="margin:14px 0 0;font-size:12px;color:var(--text-muted)">
  521. ★ 绿色表头为业务字段(表单前 6 列),插在「申请人」与「发起时间」之间;不同流程列名不同。审批 ID 为实例 id。
  522. </p>
  523. </div>
  524. </div>
  525. </div>
  526. <script>
  527. function openHistory(name) {
  528. document.getElementById('dlgTitle').textContent = '历史记录 · ' + name;
  529. document.getElementById('fAppName').value = name;
  530. document.getElementById('mask').classList.add('open');
  531. }
  532. function closeHistory() {
  533. document.getElementById('mask').classList.remove('open');
  534. }
  535. function onMask(e) {
  536. if (e.target.id === 'mask') closeHistory();
  537. }
  538. document.addEventListener('keydown', function (e) {
  539. if (e.key === 'Escape') closeHistory();
  540. });
  541. </script>
  542. </body>
  543. </html>