bj_starClassSummary.jsp 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209
  1. <%@ page language="java" pageEncoding="UTF-8" contentType="text/html;charset=UTF-8" isELIgnored="false" %>
  2. <%@ taglib uri="/ssTag" prefix="ss"%>
  3. <!DOCTYPE html>
  4. <html lang="zh-CN">
  5. <head>
  6. <meta charset="UTF-8">
  7. <title>星级文明班级评比总表</title>
  8. <style>
  9. body {
  10. margin: 18px;
  11. color: #111;
  12. background: #fff;
  13. font-family: "Microsoft YaHei", sans-serif;
  14. font-size: 14px;
  15. }
  16. .query-area {
  17. margin: 0 0 20px;
  18. padding: 15px;
  19. border: 1px solid #dee2e6;
  20. border-radius: 4px;
  21. background-color: #f8f9fa;
  22. }
  23. .query-item {
  24. display: inline-block;
  25. margin-right: 20px;
  26. margin-bottom: 10px;
  27. }
  28. .query-item label {
  29. margin-right: 5px;
  30. font-weight: bold;
  31. }
  32. .query-btn,
  33. .export-btn,
  34. .reset-btn {
  35. padding: 6px 15px;
  36. border: none;
  37. border-radius: 4px;
  38. color: #fff;
  39. cursor: pointer;
  40. }
  41. .query-btn {
  42. background-color: #007bff;
  43. }
  44. .export-btn {
  45. margin-left: 10px;
  46. background-color: #28a745;
  47. }
  48. .reset-btn {
  49. margin-left: 10px;
  50. background-color: #dc3545;
  51. }
  52. select,
  53. input[type="month"] {
  54. width: 150px;
  55. padding: 6px;
  56. border: 1px solid #ced4da;
  57. border-radius: 4px;
  58. background: #fff;
  59. }
  60. .report-title {
  61. margin: 20px 0;
  62. text-align: center;
  63. font-size: 20px;
  64. font-weight: bold;
  65. }
  66. .report-info {
  67. margin: -8px 0 12px;
  68. text-align: right;
  69. color: #555;
  70. font-size: 13px;
  71. }
  72. .report-info span {
  73. margin-left: 14px;
  74. }
  75. table {
  76. width: 100%;
  77. border-collapse: collapse;
  78. font-size: 9pt;
  79. }
  80. table,
  81. th,
  82. td {
  83. border: 1px solid #000;
  84. }
  85. th,
  86. td {
  87. padding: 6px 5px;
  88. text-align: center;
  89. white-space: nowrap;
  90. }
  91. th {
  92. background-color: #f2f2f2;
  93. font-weight: bold;
  94. }
  95. tbody tr:hover {
  96. background-color: #f7fbff;
  97. }
  98. .total-cell {
  99. font-weight: bold;
  100. }
  101. .empty-row td {
  102. padding: 40px 10px;
  103. color: #777;
  104. }
  105. .table-footer {
  106. margin-top: 10px;
  107. color: #666;
  108. font-size: 12px;
  109. text-align: right;
  110. }
  111. .clickable-row {
  112. cursor: pointer;
  113. }
  114. .clickable-row:hover,
  115. .clickable-row:focus {
  116. background: #eef6ff;
  117. outline: 2px solid #9dc7f3;
  118. outline-offset: -2px;
  119. }
  120. .modal-mask {
  121. position: fixed;
  122. inset: 0;
  123. z-index: 9999;
  124. display: none;
  125. align-items: center;
  126. justify-content: center;
  127. padding: 20px;
  128. background: rgba(15, 23, 42, 0.48);
  129. }
  130. .modal-mask.open {
  131. display: flex;
  132. }
  133. .detail-modal {
  134. width: min(1280px, calc(100vw - 40px));
  135. max-height: calc(100vh - 40px);
  136. overflow: hidden;
  137. border-radius: 8px;
  138. background: #fff;
  139. box-shadow: 0 18px 55px rgba(15, 23, 42, 0.32);
  140. }
  141. .modal-header {
  142. display: flex;
  143. align-items: center;
  144. justify-content: space-between;
  145. padding: 14px 18px;
  146. border-bottom: 1px solid #dee2e6;
  147. background: #f8f9fa;
  148. }
  149. .modal-title {
  150. overflow: hidden;
  151. font-size: 16px;
  152. font-weight: bold;
  153. text-overflow: ellipsis;
  154. white-space: nowrap;
  155. }
  156. .modal-close {
  157. width: 30px;
  158. height: 30px;
  159. border: 0;
  160. border-radius: 4px;
  161. background: transparent;
  162. color: #555;
  163. font-size: 24px;
  164. line-height: 26px;
  165. cursor: pointer;
  166. }
  167. .modal-close:hover {
  168. background: #e9ecef;
  169. color: #111;
  170. }
  171. .modal-body {
  172. max-height: calc(100vh - 150px);
  173. overflow: auto;
  174. padding: 18px;
  175. }
  176. .modal-footer {
  177. padding: 10px 18px;
  178. border-top: 1px solid #dee2e6;
  179. text-align: right;
  180. }
  181. .modal-footer button,
  182. .modal-back {
  183. padding: 6px 14px;
  184. border: 1px solid #ced4da;
  185. border-radius: 4px;
  186. background: #fff;
  187. color: #333;
  188. cursor: pointer;
  189. }
  190. .modal-back {
  191. margin-bottom: 14px;
  192. }
  193. .modal-footer button:hover,
  194. .modal-back:hover {
  195. background: #f1f3f5;
  196. }
  197. .detail-table {
  198. width: 100%;
  199. table-layout: fixed;
  200. }
  201. .detail-table th,
  202. .detail-table td {
  203. padding: 9px 8px;
  204. white-space: normal;
  205. }
  206. .detail-table .item-col {
  207. width: 32%;
  208. }
  209. .detail-table .score-col {
  210. width: 16%;
  211. }
  212. .detail-table .remark-col {
  213. width: 52%;
  214. text-align: left;
  215. }
  216. .bonus-table .item-col {
  217. width: 72%;
  218. text-align: left;
  219. }
  220. .bonus-table .score-col {
  221. width: 28%;
  222. }
  223. .month-detail-table {
  224. width: 100%;
  225. table-layout: auto;
  226. }
  227. .month-detail-table th,
  228. .month-detail-table td {
  229. padding: 8px 5px;
  230. white-space: nowrap;
  231. }
  232. .month-detail-table .day-column {
  233. width: 92px;
  234. }
  235. .month-detail-table tbody tr:hover {
  236. background: #fff;
  237. }
  238. .detail-score-button {
  239. padding: 3px 7px;
  240. border: 0;
  241. border-radius: 4px;
  242. background: transparent;
  243. font: inherit;
  244. font-weight: bold;
  245. cursor: pointer;
  246. }
  247. .detail-score-button.negative {
  248. color: #c62828;
  249. }
  250. .detail-score-button.positive {
  251. color: #16794c;
  252. }
  253. .detail-score-button:hover,
  254. .detail-score-button:focus {
  255. background: #e8f2ff;
  256. outline: none;
  257. }
  258. .empty-state {
  259. padding: 36px 10px;
  260. color: #777;
  261. text-align: center;
  262. }
  263. </style>
  264. </head>
  265. <body>
  266. <div class="query-area">
  267. <div class="query-item">
  268. <label for="departmentFilter">院系:</label>
  269. <select id="departmentFilter">
  270. <option value="">全部院系</option>
  271. </select>
  272. </div>
  273. <div class="query-item">
  274. <label for="majorFilter">专业:</label>
  275. <select id="majorFilter">
  276. <option value="">全部专业</option>
  277. </select>
  278. </div>
  279. <div class="query-item">
  280. <label for="classFilter">班级:</label>
  281. <select id="classFilter">
  282. <option value="">全部班级</option>
  283. </select>
  284. </div>
  285. <div class="query-item">
  286. <label for="starFilter">星级:</label>
  287. <select id="starFilter">
  288. <option value="">全部星级</option>
  289. <option value="五星级">五星级</option>
  290. <option value="四星级">四星级</option>
  291. <option value="三星级">三星级</option>
  292. </select>
  293. </div>
  294. <div class="query-item">
  295. <label for="monthFilter">月份:</label>
  296. <input type="month" id="monthFilter">
  297. </div>
  298. <button type="button" class="query-btn" id="searchButton">搜索</button>
  299. <button type="button" class="export-btn" id="exportButton">导出Excel</button>
  300. <button type="button" class="reset-btn" id="resetButton">清空</button>
  301. </div>
  302. <div class="report-title">星级文明班级评比总表</div>
  303. <div class="report-info">
  304. <span>名称:星级文明班级评比总表</span>
  305. <span>年份:<b id="yearText">-</b></span>
  306. <span>月份:<b id="monthText">-</b></span>
  307. <span>状态:<b id="statusText">演示数据</b></span>
  308. </div>
  309. <table>
  310. <thead>
  311. <tr>
  312. <th>序号</th>
  313. <th>院系</th>
  314. <th>专业</th>
  315. <th>班级</th>
  316. <th>宿舍评分汇总<br>(20%)</th>
  317. <th>课堂考核<br>(5%)</th>
  318. <th>升旗礼广播操集会<br>(14%)</th>
  319. <th>清洁卫生<br>(18%)</th>
  320. <th>风纪仪容<br>(20%)</th>
  321. <th>考勤<br>(15%)</th>
  322. <th>增分</th>
  323. <th>减分</th>
  324. <th>月份合计</th>
  325. <th>星级</th>
  326. <th>部门排名</th>
  327. <th>全校排名</th>
  328. </tr>
  329. </thead>
  330. <tbody id="reportBody"></tbody>
  331. </table>
  332. <div class="table-footer">
  333. <span id="filterSummary">当前显示当前月份全部演示数据</span>
  334. ,共 <b id="resultCount">0</b> 条
  335. </div>
  336. <div class="modal-mask" id="scoreModalMask" aria-hidden="true">
  337. <div class="detail-modal" role="dialog" aria-modal="true" aria-labelledby="scoreModalTitle">
  338. <div class="modal-header">
  339. <div class="modal-title" id="scoreModalTitle"></div>
  340. <button type="button" class="modal-close" id="scoreModalClose" aria-label="关闭">&times;</button>
  341. </div>
  342. <div class="modal-body" id="scoreModalBody"></div>
  343. <div class="modal-footer">
  344. <button type="button" id="scoreModalFooterClose">关闭</button>
  345. </div>
  346. </div>
  347. </div>
  348. <script>
  349. (function () {
  350. "use strict";
  351. const DEMO_ROWS = [
  352. {
  353. month: "2026-10",
  354. department: "现代服务部",
  355. major: "会计",
  356. className: "25会计2",
  357. dormScore: "89.41",
  358. classroomScore: "100.0",
  359. flagCeremonyScore: "72.0",
  360. cleaningScore: "100.0",
  361. disciplineScore: "100.0",
  362. attendanceScore: "100.0",
  363. bonus: "7.5",
  364. deduction: "0.0",
  365. monthTotal: "93.46",
  366. starLevel: "五星级",
  367. departmentRank: "1",
  368. schoolRank: "1"
  369. },
  370. {
  371. month: "2026-10",
  372. department: "服装技术部",
  373. major: "服装陈列",
  374. className: "25服5",
  375. dormScore: "86.36",
  376. classroomScore: "100.0",
  377. flagCeremonyScore: "66.0",
  378. cleaningScore: "100.0",
  379. disciplineScore: "100.0",
  380. attendanceScore: "100.0",
  381. bonus: "7.0",
  382. deduction: "0.0",
  383. monthTotal: "91.51",
  384. starLevel: "五星级",
  385. departmentRank: "1",
  386. schoolRank: "2"
  387. },
  388. {
  389. month: "2026-10",
  390. department: "智能制造部",
  391. major: "数控技术应用",
  392. className: "24数控1",
  393. dormScore: "85.20",
  394. classroomScore: "98.0",
  395. flagCeremonyScore: "70.0",
  396. cleaningScore: "100.0",
  397. disciplineScore: "100.0",
  398. attendanceScore: "100.0",
  399. bonus: "6.5",
  400. deduction: "1.0",
  401. monthTotal: "88.70",
  402. starLevel: "四星级",
  403. departmentRank: "2",
  404. schoolRank: "4"
  405. },
  406. {
  407. month: "2026-09",
  408. department: "现代服务部",
  409. major: "电子商务",
  410. className: "24电商1",
  411. dormScore: "88.10",
  412. classroomScore: "99.0",
  413. flagCeremonyScore: "74.0",
  414. cleaningScore: "100.0",
  415. disciplineScore: "100.0",
  416. attendanceScore: "100.0",
  417. bonus: "7.2",
  418. deduction: "0.0",
  419. monthTotal: "92.80",
  420. starLevel: "五星级",
  421. departmentRank: "1",
  422. schoolRank: "2"
  423. },
  424. {
  425. month: "2026-09",
  426. department: "服装技术部",
  427. major: "服装设计与工艺",
  428. className: "24服2",
  429. dormScore: "84.75",
  430. classroomScore: "98.0",
  431. flagCeremonyScore: "68.0",
  432. cleaningScore: "100.0",
  433. disciplineScore: "100.0",
  434. attendanceScore: "99.0",
  435. bonus: "6.8",
  436. deduction: "0.5",
  437. monthTotal: "87.42",
  438. starLevel: "四星级",
  439. departmentRank: "1",
  440. schoolRank: "5"
  441. },
  442. {
  443. month: "2026-05",
  444. department: "现代服务部",
  445. major: "会计",
  446. className: "23会计1",
  447. dormScore: "90.20",
  448. classroomScore: "99.0",
  449. flagCeremonyScore: "78.0",
  450. cleaningScore: "98.0",
  451. disciplineScore: "100.0",
  452. attendanceScore: "99.0",
  453. bonus: "4.5",
  454. deduction: "1.0",
  455. monthTotal: "91.76",
  456. starLevel: "五星级",
  457. departmentRank: "1",
  458. schoolRank: "2"
  459. },
  460. {
  461. month: "2026-05",
  462. department: "服装技术部",
  463. major: "服装设计与工艺",
  464. className: "23服1",
  465. dormScore: "86.80",
  466. classroomScore: "98.0",
  467. flagCeremonyScore: "75.0",
  468. cleaningScore: "97.0",
  469. disciplineScore: "99.0",
  470. attendanceScore: "100.0",
  471. bonus: "3.0",
  472. deduction: "0.5",
  473. monthTotal: "88.96",
  474. starLevel: "四星级",
  475. departmentRank: "1",
  476. schoolRank: "6"
  477. }
  478. ];
  479. const DETAIL_CATEGORIES = [
  480. { key: "dorm", label: "宿舍评分", itemLabel: "扣分项", scoreLabel: "扣分", showRemark: true },
  481. { key: "classroom", label: "课堂考核", itemLabel: "扣分项", scoreLabel: "扣分", showRemark: true },
  482. { key: "flag", label: "升旗礼", itemLabel: "扣分项", scoreLabel: "扣分", showRemark: true },
  483. { key: "cleaning", label: "清洁卫生", itemLabel: "扣分项", scoreLabel: "扣分", showRemark: true },
  484. { key: "discipline", label: "风纪仪容", itemLabel: "扣分项", scoreLabel: "扣分", showRemark: true },
  485. { key: "attendance", label: "考勤", itemLabel: "扣分项", scoreLabel: "扣分", showRemark: true },
  486. { key: "bonus", label: "增分", itemLabel: "增分项", scoreLabel: "分数", showRemark: false },
  487. { key: "deduction", label: "减分", itemLabel: "减分项", scoreLabel: "分数", showRemark: false }
  488. ];
  489. const MOCK_MONTH_DETAILS = {
  490. "2026-10|25会计2": {
  491. 31: {
  492. bonus: {
  493. value: 1.0,
  494. items: [{ item: "效果增分", score: 1.0 }]
  495. }
  496. },
  497. 30: {
  498. dorm: {
  499. value: -2,
  500. items: [{ item: "垃圾全部清空", score: -2, remark: "垃圾桶内有少量垃圾未清空" }]
  501. }
  502. },
  503. 26: {
  504. dorm: {
  505. value: -4,
  506. items: [{ item: "卫生间整洁", score: -4, remark: "洗手台有水渍" }]
  507. },
  508. flag: {
  509. value: -2,
  510. items: [{ item: "队列分数", score: -2, remark: "队列不整齐" }]
  511. }
  512. },
  513. 20: {
  514. classroom: {
  515. value: -3,
  516. items: [{ item: "课堂纪律", score: -3, remark: "课堂交谈" }]
  517. }
  518. },
  519. 14: {
  520. dorm: {
  521. value: -3,
  522. items: [{ item: "床上物品摆放整齐", score: -3, remark: "床下物品摆放不整齐" }]
  523. }
  524. },
  525. 6: {
  526. dorm: {
  527. value: -7,
  528. items: [
  529. { item: "阳台地板整洁", score: -5, remark: "阳台地板有积水,未及时清理" },
  530. { item: "垃圾全部清空", score: -2, remark: "垃圾桶内有少量垃圾未清空" }
  531. ]
  532. },
  533. attendance: {
  534. value: -1,
  535. items: [{ item: "上午校门考勤", score: -1, remark: "迟到1人次" }]
  536. }
  537. },
  538. 1: {
  539. bonus: {
  540. value: 2.0,
  541. items: [{ item: "参与宿舍管理", score: 2.0 }]
  542. }
  543. }
  544. },
  545. "2026-10|25服5": {
  546. 30: {
  547. dorm: {
  548. value: -5,
  549. items: [{ item: "扫地、拖地", score: -5, remark: "地面有明显污渍" }]
  550. }
  551. },
  552. 21: {
  553. discipline: {
  554. value: -2,
  555. items: [{ item: "校门风纪校牌", score: -2, remark: "校牌佩戴不规范" }]
  556. }
  557. },
  558. 12: {
  559. dorm: {
  560. value: -5,
  561. items: [
  562. { item: "阳台护栏无挂物", score: -3, remark: "阳台护栏悬挂衣物" },
  563. { item: "垃圾全部清空", score: -2, remark: "垃圾未清空" }
  564. ]
  565. },
  566. bonus: {
  567. value: 1.0,
  568. items: [{ item: "好人好事", score: 1.0 }]
  569. }
  570. },
  571. 4: {
  572. cleaning: {
  573. value: -2,
  574. items: [{ item: "清洁工具摆放整齐", score: -2, remark: "清洁工具未归位" }]
  575. }
  576. }
  577. },
  578. "2026-10|24数控1": {
  579. 29: {
  580. dorm: {
  581. value: -4,
  582. items: [{ item: "卫生间整洁", score: -4, remark: "卫生间地面不洁" }]
  583. }
  584. },
  585. 22: {
  586. cleaning: {
  587. value: -3,
  588. items: [{ item: "讲台整洁,黑板干净", score: -3, remark: "黑板未擦净" }]
  589. }
  590. },
  591. 18: {
  592. dorm: {
  593. value: -7,
  594. items: [
  595. { item: "阳台地板整洁", score: -5, remark: "阳台有垃圾" },
  596. { item: "水电关闭", score: -2, remark: "离开时未关闭照明" }
  597. ]
  598. },
  599. deduction: {
  600. value: -1,
  601. items: [{ item: "请假失误", score: -1 }]
  602. }
  603. },
  604. 8: {
  605. attendance: {
  606. value: -2,
  607. items: [{ item: "课堂考勤", score: -2, remark: "旷课1人次" }]
  608. }
  609. }
  610. },
  611. "2026-09|24电商1": {
  612. 30: {
  613. bonus: {
  614. value: 2.2,
  615. items: [{ item: "通讯稿", score: 2.2 }]
  616. }
  617. },
  618. 28: {
  619. dorm: {
  620. value: -3,
  621. items: [{ item: "洗漱用品摆放整齐", score: -3, remark: "洗漱用品摆放凌乱" }]
  622. }
  623. },
  624. 17: {
  625. dorm: {
  626. value: -5,
  627. items: [{ item: "阳台地板整洁", score: -5, remark: "阳台积水" }]
  628. },
  629. flag: {
  630. value: -1,
  631. items: [{ item: "服装分数", score: -1, remark: "校服穿着不规范" }]
  632. }
  633. },
  634. 5: {
  635. cleaning: {
  636. value: -2,
  637. items: [{ item: "垃圾全部清空", score: -2, remark: "垃圾分类不规范" }]
  638. }
  639. }
  640. },
  641. "2026-09|24服2": {
  642. 29: {
  643. dorm: {
  644. value: -4,
  645. items: [{ item: "卫生间整洁", score: -4, remark: "地面有积水" }]
  646. }
  647. },
  648. 24: {
  649. bonus: {
  650. value: 2.0,
  651. items: [{ item: "文明风采", score: 2.0 }]
  652. }
  653. },
  654. 16: {
  655. dorm: {
  656. value: -4,
  657. items: [{ item: "床上物品摆放整齐", score: -4, remark: "床下物品外露" }]
  658. }
  659. },
  660. 3: {
  661. cleaning: {
  662. value: -2,
  663. items: [{ item: "清洁工具摆放整齐", score: -2, remark: "清洁工具堆放" }]
  664. }
  665. }
  666. },
  667. "2026-05|23会计1": {
  668. 31: {
  669. bonus: {
  670. value: 2.0,
  671. items: [{ item: "校运会加分", score: 2.0 }]
  672. }
  673. },
  674. 28: {
  675. dorm: {
  676. value: -5,
  677. items: [{ item: "阳台地板整洁", score: -5, remark: "阳台有积水" }]
  678. }
  679. },
  680. 21: {
  681. flag: {
  682. value: -2,
  683. items: [{ item: "纪律分数", score: -2, remark: "集会讲话" }]
  684. }
  685. },
  686. 15: {
  687. cleaning: {
  688. value: -2,
  689. items: [{ item: "场室、楼梯地板无污渍、垃圾", score: -2, remark: "楼梯有纸屑" }]
  690. }
  691. },
  692. 9: {
  693. discipline: {
  694. value: -1,
  695. items: [{ item: "校门风纪其他项", score: -1, remark: "仪容不规范" }]
  696. }
  697. },
  698. 5: {
  699. attendance: {
  700. value: -1,
  701. items: [{ item: "校门考勤-上午", score: -1, remark: "迟到1人次" }]
  702. }
  703. },
  704. 1: {
  705. dorm: {
  706. value: -3,
  707. items: [{ item: "清洁工具摆放整齐", score: -3, remark: "清洁工具未归位" }]
  708. }
  709. }
  710. },
  711. "2026-05|23服1": {
  712. 30: {
  713. dorm: {
  714. value: -4,
  715. items: [{ item: "床上物品摆放整齐", score: -4, remark: "床上用品未整理" }]
  716. }
  717. },
  718. 26: {
  719. classroom: {
  720. value: -2,
  721. items: [{ item: "课堂纪律", score: -2, remark: "课堂使用手机" }]
  722. }
  723. },
  724. 20: {
  725. bonus: {
  726. value: 3.0,
  727. items: [{ item: "班容班貌", score: 3.0 }]
  728. }
  729. },
  730. 11: {
  731. dorm: {
  732. value: -5,
  733. items: [{ item: "垃圾全部清空", score: -5, remark: "垃圾未清空" }]
  734. },
  735. deduction: {
  736. value: -0.5,
  737. items: [{ item: "内务分补录", score: -0.5 }]
  738. }
  739. },
  740. 2: {
  741. cleaning: {
  742. value: -3,
  743. items: [{ item: "玻璃光洁", score: -3, remark: "玻璃有明显污渍" }]
  744. }
  745. }
  746. }
  747. };
  748. const yearText = document.getElementById("yearText");
  749. const monthText = document.getElementById("monthText");
  750. const statusText = document.getElementById("statusText");
  751. const reportBody = document.getElementById("reportBody");
  752. const filterSummary = document.getElementById("filterSummary");
  753. const resultCount = document.getElementById("resultCount");
  754. const departmentFilter = document.getElementById("departmentFilter");
  755. const majorFilter = document.getElementById("majorFilter");
  756. const classFilter = document.getElementById("classFilter");
  757. const starFilter = document.getElementById("starFilter");
  758. const monthFilter = document.getElementById("monthFilter");
  759. const scoreModalMask = document.getElementById("scoreModalMask");
  760. const scoreModalTitle = document.getElementById("scoreModalTitle");
  761. const scoreModalBody = document.getElementById("scoreModalBody");
  762. const scoreModalClose = document.getElementById("scoreModalClose");
  763. const scoreModalFooterClose = document.getElementById("scoreModalFooterClose");
  764. let modalTrigger = null;
  765. function getCurrentMonth() {
  766. const now = new Date();
  767. return now.getFullYear() + "-" + String(now.getMonth() + 1).padStart(2, "0");
  768. }
  769. function uniqueValues(field) {
  770. return Array.from(new Set(DEMO_ROWS.map(function (row) {
  771. return row[field];
  772. }).filter(Boolean))).sort(function (a, b) {
  773. return a.localeCompare(b, "zh-CN");
  774. });
  775. }
  776. function fillSelect(select, placeholder, values, selectedValue) {
  777. select.innerHTML = "";
  778. const defaultOption = document.createElement("option");
  779. defaultOption.value = "";
  780. defaultOption.textContent = placeholder;
  781. select.appendChild(defaultOption);
  782. values.forEach(function (value) {
  783. const option = document.createElement("option");
  784. option.value = value;
  785. option.textContent = value;
  786. select.appendChild(option);
  787. });
  788. select.value = selectedValue || "";
  789. }
  790. function initializeFilters() {
  791. fillSelect(departmentFilter, "全部院系", uniqueValues("department"));
  792. fillSelect(majorFilter, "全部专业", uniqueValues("major"));
  793. fillSelect(classFilter, "全部班级", uniqueValues("className"));
  794. }
  795. function refreshMajorOptions() {
  796. const department = departmentFilter.value;
  797. const rows = department
  798. ? DEMO_ROWS.filter(function (row) { return row.department === department; })
  799. : DEMO_ROWS;
  800. const previousMajor = majorFilter.value;
  801. fillSelect(majorFilter, "全部专业", Array.from(new Set(rows.map(function (row) {
  802. return row.major;
  803. }))).sort(function (a, b) {
  804. return a.localeCompare(b, "zh-CN");
  805. }), previousMajor);
  806. refreshClassOptions();
  807. }
  808. function refreshClassOptions() {
  809. const rows = DEMO_ROWS.filter(function (row) {
  810. return (!departmentFilter.value || row.department === departmentFilter.value)
  811. && (!majorFilter.value || row.major === majorFilter.value);
  812. });
  813. const previousClass = classFilter.value;
  814. fillSelect(classFilter, "全部班级", Array.from(new Set(rows.map(function (row) {
  815. return row.className;
  816. }))).sort(function (a, b) {
  817. return a.localeCompare(b, "zh-CN");
  818. }), previousClass);
  819. }
  820. function filterRows() {
  821. return DEMO_ROWS.filter(function (row) {
  822. return (!monthFilter.value || row.month === monthFilter.value)
  823. && (!departmentFilter.value || row.department === departmentFilter.value)
  824. && (!majorFilter.value || row.major === majorFilter.value)
  825. && (!classFilter.value || row.className === classFilter.value)
  826. && (!starFilter.value || row.starLevel === starFilter.value);
  827. }).sort(function (a, b) {
  828. if (a.month !== b.month) {
  829. return b.month.localeCompare(a.month);
  830. }
  831. return Number(a.schoolRank) - Number(b.schoolRank);
  832. });
  833. }
  834. function createCell(value, className) {
  835. const cell = document.createElement("td");
  836. cell.textContent = value == null || value === "" ? "-" : value;
  837. if (className) {
  838. cell.className = className;
  839. }
  840. return cell;
  841. }
  842. function mockKey(row, month) {
  843. return month + "|" + row.className;
  844. }
  845. function getMockMonthDetails(row, month) {
  846. return MOCK_MONTH_DETAILS[mockKey(row, month)] || {};
  847. }
  848. function openScoreModal() {
  849. scoreModalMask.classList.add("open");
  850. scoreModalMask.setAttribute("aria-hidden", "false");
  851. }
  852. function closeScoreModal() {
  853. if (modalTrigger && scoreModalMask.contains(document.activeElement)) {
  854. modalTrigger.focus();
  855. }
  856. scoreModalMask.classList.remove("open");
  857. scoreModalMask.setAttribute("aria-hidden", "true");
  858. }
  859. function currentReportMonth(row) {
  860. return monthFilter.value || row.month || getCurrentMonth();
  861. }
  862. function formatPoints(value) {
  863. const number = Number(value);
  864. const body = Number.isInteger(number) ? String(number) : number.toFixed(1);
  865. return number > 0 ? "+" + body : body;
  866. }
  867. function showMonthlyDetails(row) {
  868. const month = currentReportMonth(row);
  869. const parts = month.split("-");
  870. const year = Number(parts[0]);
  871. const monthNumber = Number(parts[1]);
  872. const details = getMockMonthDetails(row, month);
  873. const daysInMonth = new Date(year, monthNumber, 0).getDate();
  874. scoreModalTitle.textContent = row.className + " · " + year + "年" + monthNumber + "月 · 月度明细";
  875. scoreModalBody.innerHTML = "";
  876. const table = document.createElement("table");
  877. table.className = "month-detail-table";
  878. const header = document.createElement("thead");
  879. const headerRow = document.createElement("tr");
  880. header.appendChild(headerRow);
  881. const dayHeader = document.createElement("th");
  882. dayHeader.className = "day-column";
  883. dayHeader.textContent = "天";
  884. headerRow.appendChild(dayHeader);
  885. DETAIL_CATEGORIES.forEach(function (category) {
  886. const th = document.createElement("th");
  887. th.textContent = category.label;
  888. headerRow.appendChild(th);
  889. });
  890. table.appendChild(header);
  891. const tbody = document.createElement("tbody");
  892. let visibleDayCount = 0;
  893. for (let day = daysInMonth; day >= 1; day--) {
  894. const dayDetails = details[day] || {};
  895. const visibleCategories = DETAIL_CATEGORIES.filter(function (category) {
  896. const event = dayDetails[category.key];
  897. return event && Number(event.value) !== 0;
  898. });
  899. if (!visibleCategories.length) {
  900. continue;
  901. }
  902. visibleDayCount++;
  903. const tr = document.createElement("tr");
  904. const dayCell = createCell(day + "日", "day-column");
  905. tr.appendChild(dayCell);
  906. DETAIL_CATEGORIES.forEach(function (category) {
  907. const cell = document.createElement("td");
  908. const event = dayDetails[category.key];
  909. if (event && Number(event.value) !== 0) {
  910. const button = document.createElement("button");
  911. button.type = "button";
  912. button.className = "detail-score-button " +
  913. (Number(event.value) < 0 ? "negative" : "positive");
  914. button.textContent = formatPoints(event.value);
  915. button.title = "查看" + category.label + "明细";
  916. button.addEventListener("click", function () {
  917. showCategoryDetails(row, month, day, category, event);
  918. });
  919. cell.appendChild(button);
  920. }
  921. tr.appendChild(cell);
  922. });
  923. tbody.appendChild(tr);
  924. }
  925. table.appendChild(tbody);
  926. if (!visibleDayCount) {
  927. const empty = document.createElement("div");
  928. empty.className = "empty-state";
  929. empty.textContent = "当月无扣分、增分或减分记录";
  930. scoreModalBody.appendChild(empty);
  931. } else {
  932. scoreModalBody.appendChild(table);
  933. }
  934. openScoreModal();
  935. }
  936. function showCategoryDetails(row, month, day, category, event) {
  937. const parts = month.split("-");
  938. scoreModalTitle.textContent =
  939. row.className + " · " + parts[0] + "年" + Number(parts[1]) + "月" + day + "日 · " +
  940. category.label + "明细";
  941. const backButton = document.createElement("button");
  942. backButton.type = "button";
  943. backButton.className = "modal-back";
  944. backButton.textContent = "返回月度明细";
  945. backButton.addEventListener("click", function () {
  946. showMonthlyDetails(row);
  947. });
  948. scoreModalBody.innerHTML = "";
  949. scoreModalBody.appendChild(backButton);
  950. const items = (event.items || []).filter(function (item) {
  951. return Number(item.score) !== 0;
  952. });
  953. if (!items.length) {
  954. const empty = document.createElement("div");
  955. empty.className = "empty-state";
  956. empty.textContent = "该日期暂无" + category.label + "明细";
  957. scoreModalBody.appendChild(empty);
  958. return;
  959. }
  960. const table = document.createElement("table");
  961. table.className = "detail-table" +
  962. (category.showRemark ? "" : " bonus-table");
  963. const headerRow = document.createElement("tr");
  964. headerRow.innerHTML =
  965. '<th class="item-col">' + category.itemLabel + '</th>' +
  966. '<th class="score-col">' + category.scoreLabel + '</th>' +
  967. (category.showRemark ? '<th class="remark-col">说明</th>' : "");
  968. const thead = document.createElement("thead");
  969. thead.appendChild(headerRow);
  970. table.appendChild(thead);
  971. const tbody = document.createElement("tbody");
  972. items.forEach(function (detail) {
  973. const tr = document.createElement("tr");
  974. const itemCell = createCell(detail.item, "item-col");
  975. const scoreCell = createCell(
  976. String(Math.abs(Number(detail.score))),
  977. "score-col"
  978. );
  979. tr.appendChild(itemCell);
  980. tr.appendChild(scoreCell);
  981. if (category.showRemark) {
  982. tr.appendChild(createCell(detail.remark || "", "remark-col"));
  983. }
  984. tbody.appendChild(tr);
  985. });
  986. table.appendChild(tbody);
  987. scoreModalBody.appendChild(table);
  988. }
  989. function renderRows(rows) {
  990. reportBody.innerHTML = "";
  991. if (!rows.length) {
  992. const emptyRow = document.createElement("tr");
  993. emptyRow.className = "empty-row";
  994. const emptyCell = document.createElement("td");
  995. emptyCell.colSpan = 16;
  996. emptyCell.textContent = "暂无数据";
  997. emptyRow.appendChild(emptyCell);
  998. reportBody.appendChild(emptyRow);
  999. return;
  1000. }
  1001. rows.forEach(function (row, index) {
  1002. const tr = document.createElement("tr");
  1003. tr.className = "clickable-row";
  1004. tr.tabIndex = 0;
  1005. tr.setAttribute("role", "button");
  1006. tr.title = "查看" + row.className + "月度明细";
  1007. tr.addEventListener("click", function () {
  1008. modalTrigger = tr;
  1009. showMonthlyDetails(row);
  1010. });
  1011. tr.addEventListener("keydown", function (event) {
  1012. if (event.key === "Enter" || event.key === " ") {
  1013. event.preventDefault();
  1014. modalTrigger = tr;
  1015. showMonthlyDetails(row);
  1016. }
  1017. });
  1018. tr.appendChild(createCell(String(index + 1)));
  1019. tr.appendChild(createCell(row.department));
  1020. tr.appendChild(createCell(row.major));
  1021. tr.appendChild(createCell(row.className));
  1022. tr.appendChild(createCell(row.dormScore));
  1023. tr.appendChild(createCell(row.classroomScore));
  1024. tr.appendChild(createCell(row.flagCeremonyScore));
  1025. tr.appendChild(createCell(row.cleaningScore));
  1026. tr.appendChild(createCell(row.disciplineScore));
  1027. tr.appendChild(createCell(row.attendanceScore));
  1028. tr.appendChild(createCell(row.bonus));
  1029. tr.appendChild(createCell(row.deduction));
  1030. tr.appendChild(createCell(row.monthTotal, "total-cell"));
  1031. tr.appendChild(createCell(row.starLevel));
  1032. tr.appendChild(createCell(row.departmentRank));
  1033. tr.appendChild(createCell(row.schoolRank));
  1034. reportBody.appendChild(tr);
  1035. });
  1036. }
  1037. function updateInfo(rows) {
  1038. const parts = monthFilter.value.split("-");
  1039. yearText.textContent = parts[0] || "-";
  1040. monthText.textContent = parts[1] ? String(Number(parts[1])) : "-";
  1041. statusText.textContent = "演示数据";
  1042. resultCount.textContent = String(rows.length);
  1043. const selectedFilters = [
  1044. departmentFilter.value,
  1045. majorFilter.value,
  1046. classFilter.value,
  1047. starFilter.value
  1048. ].filter(Boolean);
  1049. filterSummary.textContent = selectedFilters.length
  1050. ? "筛选条件:" + selectedFilters.join(" / ")
  1051. : "当前显示当前月份全部演示数据";
  1052. }
  1053. function validateMonth() {
  1054. const currentMonth = getCurrentMonth();
  1055. if (!monthFilter.value) {
  1056. monthFilter.value = currentMonth;
  1057. }
  1058. if (monthFilter.value > currentMonth) {
  1059. window.alert("不能查询未来月份,已恢复为当前月份。");
  1060. monthFilter.value = currentMonth;
  1061. }
  1062. }
  1063. function executeSearch() {
  1064. validateMonth();
  1065. const rows = filterRows();
  1066. renderRows(rows);
  1067. updateInfo(rows);
  1068. }
  1069. function resetFilters() {
  1070. departmentFilter.value = "";
  1071. fillSelect(majorFilter, "全部专业", uniqueValues("major"));
  1072. fillSelect(classFilter, "全部班级", uniqueValues("className"));
  1073. starFilter.value = "";
  1074. monthFilter.value = getCurrentMonth();
  1075. executeSearch();
  1076. }
  1077. departmentFilter.addEventListener("change", function () {
  1078. majorFilter.value = "";
  1079. classFilter.value = "";
  1080. refreshMajorOptions();
  1081. });
  1082. majorFilter.addEventListener("change", function () {
  1083. classFilter.value = "";
  1084. refreshClassOptions();
  1085. });
  1086. document.getElementById("searchButton").addEventListener("click", executeSearch);
  1087. document.getElementById("resetButton").addEventListener("click", resetFilters);
  1088. document.getElementById("exportButton").addEventListener("click", function () {
  1089. window.alert("当前为演示数据,真实数据接入后再开放导出功能。");
  1090. });
  1091. monthFilter.addEventListener("change", validateMonth);
  1092. scoreModalClose.addEventListener("click", closeScoreModal);
  1093. scoreModalFooterClose.addEventListener("click", closeScoreModal);
  1094. scoreModalMask.addEventListener("click", function (event) {
  1095. if (event.target === scoreModalMask) {
  1096. closeScoreModal();
  1097. }
  1098. });
  1099. document.addEventListener("keydown", function (event) {
  1100. if (event.key === "Escape" && scoreModalMask.classList.contains("open")) {
  1101. closeScoreModal();
  1102. }
  1103. });
  1104. monthFilter.addEventListener("change", closeScoreModal);
  1105. document.getElementById("searchButton").addEventListener("click", closeScoreModal);
  1106. document.getElementById("resetButton").addEventListener("click", closeScoreModal);
  1107. const currentMonth = getCurrentMonth();
  1108. monthFilter.max = currentMonth;
  1109. monthFilter.value = currentMonth;
  1110. initializeFilters();
  1111. executeSearch();
  1112. }());
  1113. </script>
  1114. </body>
  1115. </html>