Просмотр исходного кода

fix(starclass): center PC report drill-down modal

apple 3 недель назад
Родитель
Сommit
dae9af7761
1 измененных файлов с 195 добавлено и 151 удалено
  1. 195 151
      web/page/biz/ssnwjc_starClassSummary.jsp

+ 195 - 151
web/page/biz/ssnwjc_starClassSummary.jsp

@@ -107,29 +107,34 @@
             z-index: 9000;
             inset: 0;
             display: none;
-            justify-content: flex-end;
-            background: rgba(20, 28, 38, .36);
+            align-items: center;
+            justify-content: center;
+            padding: 24px;
+            background: rgba(20, 28, 38, .42);
         }
         .drill-mask.open { display: flex; }
         .drill-panel {
             display: flex;
-            width: min(760px, 92vw);
-            height: 100%;
+            width: min(1120px, calc(100vw - 48px));
+            max-height: calc(100vh - 48px);
             flex-direction: column;
             background: #fff;
-            box-shadow: -8px 0 30px rgba(20, 28, 38, .18);
+            border: 1px solid #d8dde3;
+            border-radius: 4px;
+            box-shadow: 0 18px 55px rgba(20, 28, 38, .28);
         }
         .drill-head {
             display: flex;
             align-items: flex-start;
             justify-content: space-between;
             gap: 16px;
-            padding: 18px 20px 14px;
+            padding: 13px 16px 12px;
+            background: #f7f8fa;
             border-bottom: 1px solid #e5e7eb;
         }
         .drill-title {
             margin: 0;
-            font-size: 19px;
+            font-size: 18px;
             line-height: 1.4;
         }
         .drill-breadcrumb {
@@ -144,24 +149,30 @@
             gap: 8px;
         }
         .drill-actions button {
-            padding: 7px 12px;
+            padding: 6px 13px;
             color: #333;
-            background: #f3f4f6;
-            border: 1px solid #d9dde3;
+            background: #fff;
+            border: 1px solid #cfd5dc;
             border-radius: 4px;
             cursor: pointer;
             font: inherit;
             font-size: 13px;
         }
+        .drill-actions button:hover {
+            color: #0b5ea8;
+            border-color: #87a9c9;
+        }
         .drill-actions button:disabled {
             color: #aaa;
             cursor: default;
         }
         .drill-body {
             overflow: auto;
-            flex: 1;
-            padding: 16px 20px 28px;
-            background: #f7f8fa;
+            flex: 1 1 auto;
+            min-height: 220px;
+            max-height: calc(100vh - 150px);
+            padding: 14px 16px 18px;
+            background: #fff;
         }
         .drill-loading,
         .drill-empty {
@@ -171,106 +182,86 @@
             border: 1px solid #e5e7eb;
             text-align: center;
         }
-        .drill-list {
-            overflow: hidden;
-            background: #fff;
-            border: 1px solid #e5e7eb;
-        }
-        .drill-row {
-            display: flex;
+        .drill-table {
             width: 100%;
-            min-height: 64px;
-            align-items: center;
-            justify-content: space-between;
-            gap: 16px;
-            padding: 12px 15px;
+            table-layout: fixed;
+            border-collapse: collapse;
+            border: 1px solid #d8dde3;
+        }
+        .drill-table th,
+        .drill-table td {
+            padding: 9px 10px;
+            border: 1px solid #d8dde3;
+            white-space: normal;
+            word-break: break-all;
+            line-height: 1.55;
+        }
+        .drill-table th {
+            color: #333;
+            background: #f2f4f6;
+            font-size: 13px;
+            font-weight: 700;
+        }
+        .drill-table td {
             color: #222;
             background: #fff;
-            border: 0;
-            border-bottom: 1px solid #e5e7eb;
-            cursor: pointer;
+            font-size: 13px;
             text-align: left;
-            font: inherit;
+            vertical-align: middle;
+        }
+        .drill-table tbody tr[role="button"] {
+            cursor: pointer;
+        }
+        .drill-table tbody tr[role="button"]:hover td {
+            background: #f7fbff;
+        }
+        .drill-table tbody tr[role="button"]:focus {
+            outline: 2px solid #8bb9e8;
+            outline-offset: -2px;
         }
-        .drill-row:last-child { border-bottom: 0; }
-        .drill-row:hover { background: #f8fbff; }
-        .drill-row-main { min-width: 0; }
-        .drill-row-title {
-            font-size: 15px;
+        .drill-table .drill-main-cell {
+            width: 24%;
             font-weight: 600;
-            line-height: 1.45;
         }
-        .drill-row-meta {
-            margin-top: 5px;
-            color: #777;
-            font-size: 12px;
-            line-height: 1.5;
+        .drill-table .drill-index-cell {
+            width: 8%;
+            color: #555;
+            text-align: center;
+            white-space: nowrap;
         }
-        .drill-row-amount {
-            flex: 0 0 auto;
-            font-size: 15px;
+        .drill-table .drill-meta-cell {
+            width: 58%;
+            color: #555;
+        }
+        .drill-table .drill-amount-cell {
+            width: 18%;
             font-weight: 700;
+            text-align: right;
+            white-space: nowrap;
         }
-        .drill-row-amount.positive { color: #1677c8; }
-        .drill-row-amount.negative { color: #d9534f; }
+        .positive { color: #1677c8; }
+        .negative { color: #d9534f; }
         .drill-section {
             margin-bottom: 14px;
-            background: #fff;
-            border: 1px solid #e5e7eb;
         }
         .drill-section-title {
-            padding: 11px 14px;
-            background: #fafafa;
-            border-bottom: 1px solid #e5e7eb;
+            margin-bottom: 8px;
+            padding: 0;
+            color: #333;
+            background: transparent;
+            border: 0;
             font-size: 14px;
             font-weight: 700;
         }
-        .drill-info-row {
-            display: grid;
-            grid-template-columns: 105px minmax(0, 1fr);
-            min-height: 42px;
-            border-bottom: 1px solid #eceff2;
-        }
-        .drill-info-row:last-child { border-bottom: 0; }
-        .drill-info-label,
-        .drill-info-value {
-            display: flex;
-            align-items: center;
-            padding: 9px 12px;
-            font-size: 13px;
-            line-height: 1.55;
-            word-break: break-all;
-        }
-        .drill-info-label {
-            justify-content: flex-end;
-            color: #666;
-            background: #fafafa;
-            border-right: 1px solid #eceff2;
-        }
-        .drill-item {
-            display: flex;
-            align-items: flex-start;
-            justify-content: space-between;
-            gap: 14px;
-            padding: 12px 14px;
-            border-bottom: 1px solid #eceff2;
-        }
-        .drill-item:last-child { border-bottom: 0; }
-        .drill-item-main { min-width: 0; }
-        .drill-item-name {
-            font-size: 14px;
-            font-weight: 600;
-        }
-        .drill-item-remark {
-            margin-top: 5px;
-            color: #777;
-            font-size: 12px;
-            line-height: 1.55;
+        .drill-info-table .drill-info-label {
+            width: 130px;
+            color: #555;
+            background: #f7f8fa;
+            text-align: right;
+            vertical-align: top;
         }
-        .drill-item-amount {
-            flex: 0 0 auto;
-            font-size: 15px;
-            font-weight: 700;
+        .drill-info-table .drill-info-value {
+            color: #222;
         }
         .drill-notice {
             margin-bottom: 12px;
@@ -281,6 +272,16 @@
             font-size: 12px;
             line-height: 1.55;
         }
+        @media (max-width: 720px) {
+            .drill-mask { padding: 10px; }
+            .drill-panel {
+                width: calc(100vw - 20px);
+                max-height: calc(100vh - 20px);
+            }
+            .drill-table .drill-main-cell { width: 30%; }
+            .drill-table .drill-meta-cell { width: 46%; }
+            .drill-table .drill-amount-cell { width: 24%; }
+        }
     </style>
 </head>
 <body>
@@ -646,40 +647,60 @@
                 empty.textContent = emptyText || "暂无明细";
                 drillBody.appendChild(empty);
             } else {
-                const list = document.createElement("div");
-                list.className = "drill-list";
+                const table = document.createElement("table");
+                table.className = "drill-table";
+                const thead = document.createElement("thead");
+                const headRow = document.createElement("tr");
+                [
+                    ["项目/日期", "drill-main-cell"],
+                    ["明细", "drill-meta-cell"],
+                    ["分值", "drill-amount-cell"]
+                ].forEach(function (config) {
+                    const th = document.createElement("th");
+                    th.className = config[1];
+                    th.textContent = config[0];
+                    headRow.appendChild(th);
+                });
+                thead.appendChild(headRow);
+                table.appendChild(thead);
+                const tbody = document.createElement("tbody");
                 listRows.forEach(function (item) {
-                    const button = document.createElement("button");
-                    button.type = "button";
-                    button.className = "drill-row";
-                    const main = document.createElement("div");
-                    main.className = "drill-row-main";
-                    const rowTitle = document.createElement("div");
-                    rowTitle.className = "drill-row-title";
-                    rowTitle.textContent = item.title || "明细";
-                    const meta = document.createElement("div");
-                    meta.className = "drill-row-meta";
-                    meta.textContent = (item.meta || []).filter(Boolean).join("  ");
-                    main.appendChild(rowTitle);
-                    if (meta.textContent)
-                        main.appendChild(meta);
-                    button.appendChild(main);
+                    const row = document.createElement("tr");
+                    row.tabIndex = 0;
+                    row.setAttribute("role", "button");
+
+                    const titleCell = document.createElement("td");
+                    titleCell.className = "drill-main-cell";
+                    titleCell.textContent = item.title || "明细";
+                    row.appendChild(titleCell);
+
+                    const metaCell = document.createElement("td");
+                    metaCell.className = "drill-meta-cell";
+                    metaCell.textContent = (item.meta || [])
+                        .filter(Boolean).join("  ");
+                    row.appendChild(metaCell);
+
+                    const amountCell = document.createElement("td");
+                    amountCell.className = "drill-amount-cell";
                     if (item.amount !== undefined && item.amount !== null) {
-                        const amount = document.createElement("div");
-                        amount.className = "drill-row-amount "
+                        amountCell.className += " "
                             + (Number(item.amount) >= 0 ? "positive" : "negative");
-                        amount.textContent = formatSigned(item.amount);
-                        button.appendChild(amount);
+                        amountCell.textContent = formatSigned(item.amount);
                     } else {
-                        const arrow = document.createElement("div");
-                        arrow.className = "drill-row-amount";
-                        arrow.textContent = "›";
-                        button.appendChild(arrow);
+                        amountCell.textContent = "查看 ›";
                     }
-                    button.addEventListener("click", item.open);
-                    list.appendChild(button);
+                    row.appendChild(amountCell);
+                    row.addEventListener("click", item.open);
+                    row.addEventListener("keydown", function (event) {
+                        if (event.key === "Enter" || event.key === " ") {
+                            event.preventDefault();
+                            item.open();
+                        }
+                    });
+                    tbody.appendChild(row);
                 });
-                drillBody.appendChild(list);
+                table.appendChild(tbody);
+                drillBody.appendChild(table);
             }
             if (updateState) {
                 drillCurrent = {
@@ -881,19 +902,23 @@
             infoTitle.className = "drill-section-title";
             infoTitle.textContent = "记录信息";
             infoSection.appendChild(infoTitle);
+            const infoTable = document.createElement("table");
+            infoTable.className = "drill-table drill-info-table";
+            const infoBody = document.createElement("tbody");
             fields.forEach(function (field) {
-                const row = document.createElement("div");
-                row.className = "drill-info-row";
-                const label = document.createElement("div");
+                const row = document.createElement("tr");
+                const label = document.createElement("td");
                 label.className = "drill-info-label";
                 label.textContent = field[0];
-                const value = document.createElement("div");
+                const value = document.createElement("td");
                 value.className = "drill-info-value";
                 value.textContent = String(field[1]);
                 row.appendChild(label);
                 row.appendChild(value);
-                infoSection.appendChild(row);
+                infoBody.appendChild(row);
             });
+            infoTable.appendChild(infoBody);
+            infoSection.appendChild(infoTable);
             drillBody.appendChild(infoSection);
 
             const itemSection = document.createElement("section");
@@ -908,43 +933,62 @@
                 empty.textContent = "未找到更细的扣分或增分项";
                 itemSection.appendChild(empty);
             } else {
-                items.forEach(function (item) {
-                    const row = document.createElement("div");
-                    row.className = "drill-item";
-                    const main = document.createElement("div");
-                    main.className = "drill-item-main";
-                    const name = document.createElement("div");
-                    name.className = "drill-item-name";
-                    name.textContent = item.itemName || "增扣分项";
+                const itemTable = document.createElement("table");
+                itemTable.className = "drill-table";
+                const thead = document.createElement("thead");
+                const headRow = document.createElement("tr");
+                [
+                    ["序号", "drill-index-cell"],
+                    ["具体项目", "drill-main-cell"],
+                    ["说明", "drill-meta-cell"],
+                    ["分值", "drill-amount-cell"]
+                ].forEach(function (config) {
+                    const th = document.createElement("th");
+                    th.className = config[1];
+                    th.textContent = config[0];
+                    headRow.appendChild(th);
+                });
+                thead.appendChild(headRow);
+                itemTable.appendChild(thead);
+                const tbody = document.createElement("tbody");
+                items.forEach(function (item, index) {
+                    const row = document.createElement("tr");
+                    const indexCell = document.createElement("td");
+                    indexCell.className = "drill-index-cell";
+                    indexCell.textContent = String(index + 1);
+                    row.appendChild(indexCell);
+
+                    const nameCell = document.createElement("td");
+                    nameCell.className = "drill-main-cell";
+                    nameCell.textContent = item.itemName || "增扣分项";
+                    row.appendChild(nameCell);
                     const metaParts = [
                         item.studentName,
                         item.className,
                         item.remark
                     ].filter(Boolean);
-                    if (metaParts.length) {
-                        const remark = document.createElement("div");
-                        remark.className = "drill-item-remark";
-                        remark.textContent = metaParts.join("  ");
-                        main.appendChild(name);
-                        main.appendChild(remark);
-                    } else {
-                        main.appendChild(name);
-                    }
-                    row.appendChild(main);
+                    const metaCell = document.createElement("td");
+                    metaCell.className = "drill-meta-cell";
+                    metaCell.textContent = metaParts.join("  ");
+                    row.appendChild(metaCell);
+
+                    const amountCell = document.createElement("td");
+                    amountCell.className = "drill-amount-cell";
                     let amountValue;
                     if (item.delta !== undefined)
                         amountValue = Number(item.delta || 0);
                     else if (item.deducted !== undefined)
                         amountValue = -Number(item.deducted || 0);
                     if (amountValue !== undefined) {
-                        const amount = document.createElement("div");
-                        amount.className = "drill-item-amount "
+                        amountCell.className += " "
                             + (amountValue >= 0 ? "positive" : "negative");
-                        amount.textContent = formatSigned(amountValue);
-                        row.appendChild(amount);
+                        amountCell.textContent = formatSigned(amountValue);
                     }
-                    itemSection.appendChild(row);
+                    row.appendChild(amountCell);
+                    tbody.appendChild(row);
                 });
+                itemTable.appendChild(tbody);
+                itemSection.appendChild(itemTable);
             }
             drillBody.appendChild(itemSection);