| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209 |
- <%@ page language="java" pageEncoding="UTF-8" contentType="text/html;charset=UTF-8" isELIgnored="false" %>
- <%@ taglib uri="/ssTag" prefix="ss"%>
- <!DOCTYPE html>
- <html lang="zh-CN">
- <head>
- <meta charset="UTF-8">
- <title>星级文明班级评比总表</title>
- <style>
- body {
- margin: 18px;
- color: #111;
- background: #fff;
- font-family: "Microsoft YaHei", sans-serif;
- font-size: 14px;
- }
- .query-area {
- margin: 0 0 20px;
- padding: 15px;
- border: 1px solid #dee2e6;
- border-radius: 4px;
- background-color: #f8f9fa;
- }
- .query-item {
- display: inline-block;
- margin-right: 20px;
- margin-bottom: 10px;
- }
- .query-item label {
- margin-right: 5px;
- font-weight: bold;
- }
- .query-btn,
- .export-btn,
- .reset-btn {
- padding: 6px 15px;
- border: none;
- border-radius: 4px;
- color: #fff;
- cursor: pointer;
- }
- .query-btn {
- background-color: #007bff;
- }
- .export-btn {
- margin-left: 10px;
- background-color: #28a745;
- }
- .reset-btn {
- margin-left: 10px;
- background-color: #dc3545;
- }
- select,
- input[type="month"] {
- width: 150px;
- padding: 6px;
- border: 1px solid #ced4da;
- border-radius: 4px;
- background: #fff;
- }
- .report-title {
- margin: 20px 0;
- text-align: center;
- font-size: 20px;
- font-weight: bold;
- }
- .report-info {
- margin: -8px 0 12px;
- text-align: right;
- color: #555;
- font-size: 13px;
- }
- .report-info span {
- margin-left: 14px;
- }
- table {
- width: 100%;
- border-collapse: collapse;
- font-size: 9pt;
- }
- table,
- th,
- td {
- border: 1px solid #000;
- }
- th,
- td {
- padding: 6px 5px;
- text-align: center;
- white-space: nowrap;
- }
- th {
- background-color: #f2f2f2;
- font-weight: bold;
- }
- tbody tr:hover {
- background-color: #f7fbff;
- }
- .total-cell {
- font-weight: bold;
- }
- .empty-row td {
- padding: 40px 10px;
- color: #777;
- }
- .table-footer {
- margin-top: 10px;
- color: #666;
- font-size: 12px;
- text-align: right;
- }
- .clickable-row {
- cursor: pointer;
- }
- .clickable-row:hover,
- .clickable-row:focus {
- background: #eef6ff;
- outline: 2px solid #9dc7f3;
- outline-offset: -2px;
- }
- .modal-mask {
- position: fixed;
- inset: 0;
- z-index: 9999;
- display: none;
- align-items: center;
- justify-content: center;
- padding: 20px;
- background: rgba(15, 23, 42, 0.48);
- }
- .modal-mask.open {
- display: flex;
- }
- .detail-modal {
- width: min(1280px, calc(100vw - 40px));
- max-height: calc(100vh - 40px);
- overflow: hidden;
- border-radius: 8px;
- background: #fff;
- box-shadow: 0 18px 55px rgba(15, 23, 42, 0.32);
- }
- .modal-header {
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding: 14px 18px;
- border-bottom: 1px solid #dee2e6;
- background: #f8f9fa;
- }
- .modal-title {
- overflow: hidden;
- font-size: 16px;
- font-weight: bold;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- .modal-close {
- width: 30px;
- height: 30px;
- border: 0;
- border-radius: 4px;
- background: transparent;
- color: #555;
- font-size: 24px;
- line-height: 26px;
- cursor: pointer;
- }
- .modal-close:hover {
- background: #e9ecef;
- color: #111;
- }
- .modal-body {
- max-height: calc(100vh - 150px);
- overflow: auto;
- padding: 18px;
- }
- .modal-footer {
- padding: 10px 18px;
- border-top: 1px solid #dee2e6;
- text-align: right;
- }
- .modal-footer button,
- .modal-back {
- padding: 6px 14px;
- border: 1px solid #ced4da;
- border-radius: 4px;
- background: #fff;
- color: #333;
- cursor: pointer;
- }
- .modal-back {
- margin-bottom: 14px;
- }
- .modal-footer button:hover,
- .modal-back:hover {
- background: #f1f3f5;
- }
- .detail-table {
- width: 100%;
- table-layout: fixed;
- }
- .detail-table th,
- .detail-table td {
- padding: 9px 8px;
- white-space: normal;
- }
- .detail-table .item-col {
- width: 32%;
- }
- .detail-table .score-col {
- width: 16%;
- }
- .detail-table .remark-col {
- width: 52%;
- text-align: left;
- }
- .bonus-table .item-col {
- width: 72%;
- text-align: left;
- }
- .bonus-table .score-col {
- width: 28%;
- }
- .month-detail-table {
- width: 100%;
- table-layout: auto;
- }
- .month-detail-table th,
- .month-detail-table td {
- padding: 8px 5px;
- white-space: nowrap;
- }
- .month-detail-table .day-column {
- width: 92px;
- }
- .month-detail-table tbody tr:hover {
- background: #fff;
- }
- .detail-score-button {
- padding: 3px 7px;
- border: 0;
- border-radius: 4px;
- background: transparent;
- font: inherit;
- font-weight: bold;
- cursor: pointer;
- }
- .detail-score-button.negative {
- color: #c62828;
- }
- .detail-score-button.positive {
- color: #16794c;
- }
- .detail-score-button:hover,
- .detail-score-button:focus {
- background: #e8f2ff;
- outline: none;
- }
- .empty-state {
- padding: 36px 10px;
- color: #777;
- text-align: center;
- }
- </style>
- </head>
- <body>
- <div class="query-area">
- <div class="query-item">
- <label for="departmentFilter">院系:</label>
- <select id="departmentFilter">
- <option value="">全部院系</option>
- </select>
- </div>
- <div class="query-item">
- <label for="majorFilter">专业:</label>
- <select id="majorFilter">
- <option value="">全部专业</option>
- </select>
- </div>
- <div class="query-item">
- <label for="classFilter">班级:</label>
- <select id="classFilter">
- <option value="">全部班级</option>
- </select>
- </div>
- <div class="query-item">
- <label for="starFilter">星级:</label>
- <select id="starFilter">
- <option value="">全部星级</option>
- <option value="五星级">五星级</option>
- <option value="四星级">四星级</option>
- <option value="三星级">三星级</option>
- </select>
- </div>
- <div class="query-item">
- <label for="monthFilter">月份:</label>
- <input type="month" id="monthFilter">
- </div>
- <button type="button" class="query-btn" id="searchButton">搜索</button>
- <button type="button" class="export-btn" id="exportButton">导出Excel</button>
- <button type="button" class="reset-btn" id="resetButton">清空</button>
- </div>
- <div class="report-title">星级文明班级评比总表</div>
- <div class="report-info">
- <span>名称:星级文明班级评比总表</span>
- <span>年份:<b id="yearText">-</b></span>
- <span>月份:<b id="monthText">-</b></span>
- <span>状态:<b id="statusText">演示数据</b></span>
- </div>
- <table>
- <thead>
- <tr>
- <th>序号</th>
- <th>院系</th>
- <th>专业</th>
- <th>班级</th>
- <th>宿舍评分汇总<br>(20%)</th>
- <th>课堂考核<br>(5%)</th>
- <th>升旗礼广播操集会<br>(14%)</th>
- <th>清洁卫生<br>(18%)</th>
- <th>风纪仪容<br>(20%)</th>
- <th>考勤<br>(15%)</th>
- <th>增分</th>
- <th>减分</th>
- <th>月份合计</th>
- <th>星级</th>
- <th>部门排名</th>
- <th>全校排名</th>
- </tr>
- </thead>
- <tbody id="reportBody"></tbody>
- </table>
- <div class="table-footer">
- <span id="filterSummary">当前显示当前月份全部演示数据</span>
- ,共 <b id="resultCount">0</b> 条
- </div>
- <div class="modal-mask" id="scoreModalMask" aria-hidden="true">
- <div class="detail-modal" role="dialog" aria-modal="true" aria-labelledby="scoreModalTitle">
- <div class="modal-header">
- <div class="modal-title" id="scoreModalTitle"></div>
- <button type="button" class="modal-close" id="scoreModalClose" aria-label="关闭">×</button>
- </div>
- <div class="modal-body" id="scoreModalBody"></div>
- <div class="modal-footer">
- <button type="button" id="scoreModalFooterClose">关闭</button>
- </div>
- </div>
- </div>
- <script>
- (function () {
- "use strict";
- const DEMO_ROWS = [
- {
- month: "2026-10",
- department: "现代服务部",
- major: "会计",
- className: "25会计2",
- dormScore: "89.41",
- classroomScore: "100.0",
- flagCeremonyScore: "72.0",
- cleaningScore: "100.0",
- disciplineScore: "100.0",
- attendanceScore: "100.0",
- bonus: "7.5",
- deduction: "0.0",
- monthTotal: "93.46",
- starLevel: "五星级",
- departmentRank: "1",
- schoolRank: "1"
- },
- {
- month: "2026-10",
- department: "服装技术部",
- major: "服装陈列",
- className: "25服5",
- dormScore: "86.36",
- classroomScore: "100.0",
- flagCeremonyScore: "66.0",
- cleaningScore: "100.0",
- disciplineScore: "100.0",
- attendanceScore: "100.0",
- bonus: "7.0",
- deduction: "0.0",
- monthTotal: "91.51",
- starLevel: "五星级",
- departmentRank: "1",
- schoolRank: "2"
- },
- {
- month: "2026-10",
- department: "智能制造部",
- major: "数控技术应用",
- className: "24数控1",
- dormScore: "85.20",
- classroomScore: "98.0",
- flagCeremonyScore: "70.0",
- cleaningScore: "100.0",
- disciplineScore: "100.0",
- attendanceScore: "100.0",
- bonus: "6.5",
- deduction: "1.0",
- monthTotal: "88.70",
- starLevel: "四星级",
- departmentRank: "2",
- schoolRank: "4"
- },
- {
- month: "2026-09",
- department: "现代服务部",
- major: "电子商务",
- className: "24电商1",
- dormScore: "88.10",
- classroomScore: "99.0",
- flagCeremonyScore: "74.0",
- cleaningScore: "100.0",
- disciplineScore: "100.0",
- attendanceScore: "100.0",
- bonus: "7.2",
- deduction: "0.0",
- monthTotal: "92.80",
- starLevel: "五星级",
- departmentRank: "1",
- schoolRank: "2"
- },
- {
- month: "2026-09",
- department: "服装技术部",
- major: "服装设计与工艺",
- className: "24服2",
- dormScore: "84.75",
- classroomScore: "98.0",
- flagCeremonyScore: "68.0",
- cleaningScore: "100.0",
- disciplineScore: "100.0",
- attendanceScore: "99.0",
- bonus: "6.8",
- deduction: "0.5",
- monthTotal: "87.42",
- starLevel: "四星级",
- departmentRank: "1",
- schoolRank: "5"
- },
- {
- month: "2026-05",
- department: "现代服务部",
- major: "会计",
- className: "23会计1",
- dormScore: "90.20",
- classroomScore: "99.0",
- flagCeremonyScore: "78.0",
- cleaningScore: "98.0",
- disciplineScore: "100.0",
- attendanceScore: "99.0",
- bonus: "4.5",
- deduction: "1.0",
- monthTotal: "91.76",
- starLevel: "五星级",
- departmentRank: "1",
- schoolRank: "2"
- },
- {
- month: "2026-05",
- department: "服装技术部",
- major: "服装设计与工艺",
- className: "23服1",
- dormScore: "86.80",
- classroomScore: "98.0",
- flagCeremonyScore: "75.0",
- cleaningScore: "97.0",
- disciplineScore: "99.0",
- attendanceScore: "100.0",
- bonus: "3.0",
- deduction: "0.5",
- monthTotal: "88.96",
- starLevel: "四星级",
- departmentRank: "1",
- schoolRank: "6"
- }
- ];
- const DETAIL_CATEGORIES = [
- { key: "dorm", label: "宿舍评分", itemLabel: "扣分项", scoreLabel: "扣分", showRemark: true },
- { key: "classroom", label: "课堂考核", itemLabel: "扣分项", scoreLabel: "扣分", showRemark: true },
- { key: "flag", label: "升旗礼", itemLabel: "扣分项", scoreLabel: "扣分", showRemark: true },
- { key: "cleaning", label: "清洁卫生", itemLabel: "扣分项", scoreLabel: "扣分", showRemark: true },
- { key: "discipline", label: "风纪仪容", itemLabel: "扣分项", scoreLabel: "扣分", showRemark: true },
- { key: "attendance", label: "考勤", itemLabel: "扣分项", scoreLabel: "扣分", showRemark: true },
- { key: "bonus", label: "增分", itemLabel: "增分项", scoreLabel: "分数", showRemark: false },
- { key: "deduction", label: "减分", itemLabel: "减分项", scoreLabel: "分数", showRemark: false }
- ];
- const MOCK_MONTH_DETAILS = {
- "2026-10|25会计2": {
- 31: {
- bonus: {
- value: 1.0,
- items: [{ item: "效果增分", score: 1.0 }]
- }
- },
- 30: {
- dorm: {
- value: -2,
- items: [{ item: "垃圾全部清空", score: -2, remark: "垃圾桶内有少量垃圾未清空" }]
- }
- },
- 26: {
- dorm: {
- value: -4,
- items: [{ item: "卫生间整洁", score: -4, remark: "洗手台有水渍" }]
- },
- flag: {
- value: -2,
- items: [{ item: "队列分数", score: -2, remark: "队列不整齐" }]
- }
- },
- 20: {
- classroom: {
- value: -3,
- items: [{ item: "课堂纪律", score: -3, remark: "课堂交谈" }]
- }
- },
- 14: {
- dorm: {
- value: -3,
- items: [{ item: "床上物品摆放整齐", score: -3, remark: "床下物品摆放不整齐" }]
- }
- },
- 6: {
- dorm: {
- value: -7,
- items: [
- { item: "阳台地板整洁", score: -5, remark: "阳台地板有积水,未及时清理" },
- { item: "垃圾全部清空", score: -2, remark: "垃圾桶内有少量垃圾未清空" }
- ]
- },
- attendance: {
- value: -1,
- items: [{ item: "上午校门考勤", score: -1, remark: "迟到1人次" }]
- }
- },
- 1: {
- bonus: {
- value: 2.0,
- items: [{ item: "参与宿舍管理", score: 2.0 }]
- }
- }
- },
- "2026-10|25服5": {
- 30: {
- dorm: {
- value: -5,
- items: [{ item: "扫地、拖地", score: -5, remark: "地面有明显污渍" }]
- }
- },
- 21: {
- discipline: {
- value: -2,
- items: [{ item: "校门风纪校牌", score: -2, remark: "校牌佩戴不规范" }]
- }
- },
- 12: {
- dorm: {
- value: -5,
- items: [
- { item: "阳台护栏无挂物", score: -3, remark: "阳台护栏悬挂衣物" },
- { item: "垃圾全部清空", score: -2, remark: "垃圾未清空" }
- ]
- },
- bonus: {
- value: 1.0,
- items: [{ item: "好人好事", score: 1.0 }]
- }
- },
- 4: {
- cleaning: {
- value: -2,
- items: [{ item: "清洁工具摆放整齐", score: -2, remark: "清洁工具未归位" }]
- }
- }
- },
- "2026-10|24数控1": {
- 29: {
- dorm: {
- value: -4,
- items: [{ item: "卫生间整洁", score: -4, remark: "卫生间地面不洁" }]
- }
- },
- 22: {
- cleaning: {
- value: -3,
- items: [{ item: "讲台整洁,黑板干净", score: -3, remark: "黑板未擦净" }]
- }
- },
- 18: {
- dorm: {
- value: -7,
- items: [
- { item: "阳台地板整洁", score: -5, remark: "阳台有垃圾" },
- { item: "水电关闭", score: -2, remark: "离开时未关闭照明" }
- ]
- },
- deduction: {
- value: -1,
- items: [{ item: "请假失误", score: -1 }]
- }
- },
- 8: {
- attendance: {
- value: -2,
- items: [{ item: "课堂考勤", score: -2, remark: "旷课1人次" }]
- }
- }
- },
- "2026-09|24电商1": {
- 30: {
- bonus: {
- value: 2.2,
- items: [{ item: "通讯稿", score: 2.2 }]
- }
- },
- 28: {
- dorm: {
- value: -3,
- items: [{ item: "洗漱用品摆放整齐", score: -3, remark: "洗漱用品摆放凌乱" }]
- }
- },
- 17: {
- dorm: {
- value: -5,
- items: [{ item: "阳台地板整洁", score: -5, remark: "阳台积水" }]
- },
- flag: {
- value: -1,
- items: [{ item: "服装分数", score: -1, remark: "校服穿着不规范" }]
- }
- },
- 5: {
- cleaning: {
- value: -2,
- items: [{ item: "垃圾全部清空", score: -2, remark: "垃圾分类不规范" }]
- }
- }
- },
- "2026-09|24服2": {
- 29: {
- dorm: {
- value: -4,
- items: [{ item: "卫生间整洁", score: -4, remark: "地面有积水" }]
- }
- },
- 24: {
- bonus: {
- value: 2.0,
- items: [{ item: "文明风采", score: 2.0 }]
- }
- },
- 16: {
- dorm: {
- value: -4,
- items: [{ item: "床上物品摆放整齐", score: -4, remark: "床下物品外露" }]
- }
- },
- 3: {
- cleaning: {
- value: -2,
- items: [{ item: "清洁工具摆放整齐", score: -2, remark: "清洁工具堆放" }]
- }
- }
- },
- "2026-05|23会计1": {
- 31: {
- bonus: {
- value: 2.0,
- items: [{ item: "校运会加分", score: 2.0 }]
- }
- },
- 28: {
- dorm: {
- value: -5,
- items: [{ item: "阳台地板整洁", score: -5, remark: "阳台有积水" }]
- }
- },
- 21: {
- flag: {
- value: -2,
- items: [{ item: "纪律分数", score: -2, remark: "集会讲话" }]
- }
- },
- 15: {
- cleaning: {
- value: -2,
- items: [{ item: "场室、楼梯地板无污渍、垃圾", score: -2, remark: "楼梯有纸屑" }]
- }
- },
- 9: {
- discipline: {
- value: -1,
- items: [{ item: "校门风纪其他项", score: -1, remark: "仪容不规范" }]
- }
- },
- 5: {
- attendance: {
- value: -1,
- items: [{ item: "校门考勤-上午", score: -1, remark: "迟到1人次" }]
- }
- },
- 1: {
- dorm: {
- value: -3,
- items: [{ item: "清洁工具摆放整齐", score: -3, remark: "清洁工具未归位" }]
- }
- }
- },
- "2026-05|23服1": {
- 30: {
- dorm: {
- value: -4,
- items: [{ item: "床上物品摆放整齐", score: -4, remark: "床上用品未整理" }]
- }
- },
- 26: {
- classroom: {
- value: -2,
- items: [{ item: "课堂纪律", score: -2, remark: "课堂使用手机" }]
- }
- },
- 20: {
- bonus: {
- value: 3.0,
- items: [{ item: "班容班貌", score: 3.0 }]
- }
- },
- 11: {
- dorm: {
- value: -5,
- items: [{ item: "垃圾全部清空", score: -5, remark: "垃圾未清空" }]
- },
- deduction: {
- value: -0.5,
- items: [{ item: "内务分补录", score: -0.5 }]
- }
- },
- 2: {
- cleaning: {
- value: -3,
- items: [{ item: "玻璃光洁", score: -3, remark: "玻璃有明显污渍" }]
- }
- }
- }
- };
- const yearText = document.getElementById("yearText");
- const monthText = document.getElementById("monthText");
- const statusText = document.getElementById("statusText");
- const reportBody = document.getElementById("reportBody");
- const filterSummary = document.getElementById("filterSummary");
- const resultCount = document.getElementById("resultCount");
- const departmentFilter = document.getElementById("departmentFilter");
- const majorFilter = document.getElementById("majorFilter");
- const classFilter = document.getElementById("classFilter");
- const starFilter = document.getElementById("starFilter");
- const monthFilter = document.getElementById("monthFilter");
- const scoreModalMask = document.getElementById("scoreModalMask");
- const scoreModalTitle = document.getElementById("scoreModalTitle");
- const scoreModalBody = document.getElementById("scoreModalBody");
- const scoreModalClose = document.getElementById("scoreModalClose");
- const scoreModalFooterClose = document.getElementById("scoreModalFooterClose");
- let modalTrigger = null;
- function getCurrentMonth() {
- const now = new Date();
- return now.getFullYear() + "-" + String(now.getMonth() + 1).padStart(2, "0");
- }
- function uniqueValues(field) {
- return Array.from(new Set(DEMO_ROWS.map(function (row) {
- return row[field];
- }).filter(Boolean))).sort(function (a, b) {
- return a.localeCompare(b, "zh-CN");
- });
- }
- function fillSelect(select, placeholder, values, selectedValue) {
- select.innerHTML = "";
- const defaultOption = document.createElement("option");
- defaultOption.value = "";
- defaultOption.textContent = placeholder;
- select.appendChild(defaultOption);
- values.forEach(function (value) {
- const option = document.createElement("option");
- option.value = value;
- option.textContent = value;
- select.appendChild(option);
- });
- select.value = selectedValue || "";
- }
- function initializeFilters() {
- fillSelect(departmentFilter, "全部院系", uniqueValues("department"));
- fillSelect(majorFilter, "全部专业", uniqueValues("major"));
- fillSelect(classFilter, "全部班级", uniqueValues("className"));
- }
- function refreshMajorOptions() {
- const department = departmentFilter.value;
- const rows = department
- ? DEMO_ROWS.filter(function (row) { return row.department === department; })
- : DEMO_ROWS;
- const previousMajor = majorFilter.value;
- fillSelect(majorFilter, "全部专业", Array.from(new Set(rows.map(function (row) {
- return row.major;
- }))).sort(function (a, b) {
- return a.localeCompare(b, "zh-CN");
- }), previousMajor);
- refreshClassOptions();
- }
- function refreshClassOptions() {
- const rows = DEMO_ROWS.filter(function (row) {
- return (!departmentFilter.value || row.department === departmentFilter.value)
- && (!majorFilter.value || row.major === majorFilter.value);
- });
- const previousClass = classFilter.value;
- fillSelect(classFilter, "全部班级", Array.from(new Set(rows.map(function (row) {
- return row.className;
- }))).sort(function (a, b) {
- return a.localeCompare(b, "zh-CN");
- }), previousClass);
- }
- function filterRows() {
- return DEMO_ROWS.filter(function (row) {
- return (!monthFilter.value || row.month === monthFilter.value)
- && (!departmentFilter.value || row.department === departmentFilter.value)
- && (!majorFilter.value || row.major === majorFilter.value)
- && (!classFilter.value || row.className === classFilter.value)
- && (!starFilter.value || row.starLevel === starFilter.value);
- }).sort(function (a, b) {
- if (a.month !== b.month) {
- return b.month.localeCompare(a.month);
- }
- return Number(a.schoolRank) - Number(b.schoolRank);
- });
- }
- function createCell(value, className) {
- const cell = document.createElement("td");
- cell.textContent = value == null || value === "" ? "-" : value;
- if (className) {
- cell.className = className;
- }
- return cell;
- }
- function mockKey(row, month) {
- return month + "|" + row.className;
- }
- function getMockMonthDetails(row, month) {
- return MOCK_MONTH_DETAILS[mockKey(row, month)] || {};
- }
- function openScoreModal() {
- scoreModalMask.classList.add("open");
- scoreModalMask.setAttribute("aria-hidden", "false");
- }
- function closeScoreModal() {
- if (modalTrigger && scoreModalMask.contains(document.activeElement)) {
- modalTrigger.focus();
- }
- scoreModalMask.classList.remove("open");
- scoreModalMask.setAttribute("aria-hidden", "true");
- }
- function currentReportMonth(row) {
- return monthFilter.value || row.month || getCurrentMonth();
- }
- function formatPoints(value) {
- const number = Number(value);
- const body = Number.isInteger(number) ? String(number) : number.toFixed(1);
- return number > 0 ? "+" + body : body;
- }
- function showMonthlyDetails(row) {
- const month = currentReportMonth(row);
- const parts = month.split("-");
- const year = Number(parts[0]);
- const monthNumber = Number(parts[1]);
- const details = getMockMonthDetails(row, month);
- const daysInMonth = new Date(year, monthNumber, 0).getDate();
- scoreModalTitle.textContent = row.className + " · " + year + "年" + monthNumber + "月 · 月度明细";
- scoreModalBody.innerHTML = "";
- const table = document.createElement("table");
- table.className = "month-detail-table";
- const header = document.createElement("thead");
- const headerRow = document.createElement("tr");
- header.appendChild(headerRow);
- const dayHeader = document.createElement("th");
- dayHeader.className = "day-column";
- dayHeader.textContent = "天";
- headerRow.appendChild(dayHeader);
- DETAIL_CATEGORIES.forEach(function (category) {
- const th = document.createElement("th");
- th.textContent = category.label;
- headerRow.appendChild(th);
- });
- table.appendChild(header);
- const tbody = document.createElement("tbody");
- let visibleDayCount = 0;
- for (let day = daysInMonth; day >= 1; day--) {
- const dayDetails = details[day] || {};
- const visibleCategories = DETAIL_CATEGORIES.filter(function (category) {
- const event = dayDetails[category.key];
- return event && Number(event.value) !== 0;
- });
- if (!visibleCategories.length) {
- continue;
- }
- visibleDayCount++;
- const tr = document.createElement("tr");
- const dayCell = createCell(day + "日", "day-column");
- tr.appendChild(dayCell);
- DETAIL_CATEGORIES.forEach(function (category) {
- const cell = document.createElement("td");
- const event = dayDetails[category.key];
- if (event && Number(event.value) !== 0) {
- const button = document.createElement("button");
- button.type = "button";
- button.className = "detail-score-button " +
- (Number(event.value) < 0 ? "negative" : "positive");
- button.textContent = formatPoints(event.value);
- button.title = "查看" + category.label + "明细";
- button.addEventListener("click", function () {
- showCategoryDetails(row, month, day, category, event);
- });
- cell.appendChild(button);
- }
- tr.appendChild(cell);
- });
- tbody.appendChild(tr);
- }
- table.appendChild(tbody);
- if (!visibleDayCount) {
- const empty = document.createElement("div");
- empty.className = "empty-state";
- empty.textContent = "当月无扣分、增分或减分记录";
- scoreModalBody.appendChild(empty);
- } else {
- scoreModalBody.appendChild(table);
- }
- openScoreModal();
- }
- function showCategoryDetails(row, month, day, category, event) {
- const parts = month.split("-");
- scoreModalTitle.textContent =
- row.className + " · " + parts[0] + "年" + Number(parts[1]) + "月" + day + "日 · " +
- category.label + "明细";
- const backButton = document.createElement("button");
- backButton.type = "button";
- backButton.className = "modal-back";
- backButton.textContent = "返回月度明细";
- backButton.addEventListener("click", function () {
- showMonthlyDetails(row);
- });
- scoreModalBody.innerHTML = "";
- scoreModalBody.appendChild(backButton);
- const items = (event.items || []).filter(function (item) {
- return Number(item.score) !== 0;
- });
- if (!items.length) {
- const empty = document.createElement("div");
- empty.className = "empty-state";
- empty.textContent = "该日期暂无" + category.label + "明细";
- scoreModalBody.appendChild(empty);
- return;
- }
- const table = document.createElement("table");
- table.className = "detail-table" +
- (category.showRemark ? "" : " bonus-table");
- const headerRow = document.createElement("tr");
- headerRow.innerHTML =
- '<th class="item-col">' + category.itemLabel + '</th>' +
- '<th class="score-col">' + category.scoreLabel + '</th>' +
- (category.showRemark ? '<th class="remark-col">说明</th>' : "");
- const thead = document.createElement("thead");
- thead.appendChild(headerRow);
- table.appendChild(thead);
- const tbody = document.createElement("tbody");
- items.forEach(function (detail) {
- const tr = document.createElement("tr");
- const itemCell = createCell(detail.item, "item-col");
- const scoreCell = createCell(
- String(Math.abs(Number(detail.score))),
- "score-col"
- );
- tr.appendChild(itemCell);
- tr.appendChild(scoreCell);
- if (category.showRemark) {
- tr.appendChild(createCell(detail.remark || "", "remark-col"));
- }
- tbody.appendChild(tr);
- });
- table.appendChild(tbody);
- scoreModalBody.appendChild(table);
- }
- function renderRows(rows) {
- reportBody.innerHTML = "";
- if (!rows.length) {
- const emptyRow = document.createElement("tr");
- emptyRow.className = "empty-row";
- const emptyCell = document.createElement("td");
- emptyCell.colSpan = 16;
- emptyCell.textContent = "暂无数据";
- emptyRow.appendChild(emptyCell);
- reportBody.appendChild(emptyRow);
- return;
- }
- rows.forEach(function (row, index) {
- const tr = document.createElement("tr");
- tr.className = "clickable-row";
- tr.tabIndex = 0;
- tr.setAttribute("role", "button");
- tr.title = "查看" + row.className + "月度明细";
- tr.addEventListener("click", function () {
- modalTrigger = tr;
- showMonthlyDetails(row);
- });
- tr.addEventListener("keydown", function (event) {
- if (event.key === "Enter" || event.key === " ") {
- event.preventDefault();
- modalTrigger = tr;
- showMonthlyDetails(row);
- }
- });
- tr.appendChild(createCell(String(index + 1)));
- tr.appendChild(createCell(row.department));
- tr.appendChild(createCell(row.major));
- tr.appendChild(createCell(row.className));
- tr.appendChild(createCell(row.dormScore));
- tr.appendChild(createCell(row.classroomScore));
- tr.appendChild(createCell(row.flagCeremonyScore));
- tr.appendChild(createCell(row.cleaningScore));
- tr.appendChild(createCell(row.disciplineScore));
- tr.appendChild(createCell(row.attendanceScore));
- tr.appendChild(createCell(row.bonus));
- tr.appendChild(createCell(row.deduction));
- tr.appendChild(createCell(row.monthTotal, "total-cell"));
- tr.appendChild(createCell(row.starLevel));
- tr.appendChild(createCell(row.departmentRank));
- tr.appendChild(createCell(row.schoolRank));
- reportBody.appendChild(tr);
- });
- }
- function updateInfo(rows) {
- const parts = monthFilter.value.split("-");
- yearText.textContent = parts[0] || "-";
- monthText.textContent = parts[1] ? String(Number(parts[1])) : "-";
- statusText.textContent = "演示数据";
- resultCount.textContent = String(rows.length);
- const selectedFilters = [
- departmentFilter.value,
- majorFilter.value,
- classFilter.value,
- starFilter.value
- ].filter(Boolean);
- filterSummary.textContent = selectedFilters.length
- ? "筛选条件:" + selectedFilters.join(" / ")
- : "当前显示当前月份全部演示数据";
- }
- function validateMonth() {
- const currentMonth = getCurrentMonth();
- if (!monthFilter.value) {
- monthFilter.value = currentMonth;
- }
- if (monthFilter.value > currentMonth) {
- window.alert("不能查询未来月份,已恢复为当前月份。");
- monthFilter.value = currentMonth;
- }
- }
- function executeSearch() {
- validateMonth();
- const rows = filterRows();
- renderRows(rows);
- updateInfo(rows);
- }
- function resetFilters() {
- departmentFilter.value = "";
- fillSelect(majorFilter, "全部专业", uniqueValues("major"));
- fillSelect(classFilter, "全部班级", uniqueValues("className"));
- starFilter.value = "";
- monthFilter.value = getCurrentMonth();
- executeSearch();
- }
- departmentFilter.addEventListener("change", function () {
- majorFilter.value = "";
- classFilter.value = "";
- refreshMajorOptions();
- });
- majorFilter.addEventListener("change", function () {
- classFilter.value = "";
- refreshClassOptions();
- });
- document.getElementById("searchButton").addEventListener("click", executeSearch);
- document.getElementById("resetButton").addEventListener("click", resetFilters);
- document.getElementById("exportButton").addEventListener("click", function () {
- window.alert("当前为演示数据,真实数据接入后再开放导出功能。");
- });
- monthFilter.addEventListener("change", validateMonth);
- scoreModalClose.addEventListener("click", closeScoreModal);
- scoreModalFooterClose.addEventListener("click", closeScoreModal);
- scoreModalMask.addEventListener("click", function (event) {
- if (event.target === scoreModalMask) {
- closeScoreModal();
- }
- });
- document.addEventListener("keydown", function (event) {
- if (event.key === "Escape" && scoreModalMask.classList.contains("open")) {
- closeScoreModal();
- }
- });
- monthFilter.addEventListener("change", closeScoreModal);
- document.getElementById("searchButton").addEventListener("click", closeScoreModal);
- document.getElementById("resetButton").addEventListener("click", closeScoreModal);
- const currentMonth = getCurrentMonth();
- monthFilter.max = currentMonth;
- monthFilter.value = currentMonth;
- initializeFilters();
- executeSearch();
- }());
- </script>
- </body>
- </html>
|