Sfoglia il codice sorgente

fix(report): 本/上分列着色防继承;收窄老师列

Made-with: Cursor
yemeishu 1 mese fa
parent
commit
db76883e49

+ 8 - 7
scripts/report_teacher_weekly_stats.php

@@ -119,13 +119,14 @@ $compareCellHtml = static function (int $cur, int $prev): string {
     return $text;
 };
 
-/** 「本 / 上」并列显示;仅当本 > 上时将本侧数字标绿(上分保持默认色) */
+/** 「本 / 上」并列:仅本侧数字可绿加粗;「 / 」与上周期数字强制黑色(避免 PDF 引擎继承样式) */
 $slashPairGreenHtml = static function (int $cur, int $prev): string {
+    $rest = '<span style="color:#111827;font-weight:normal;"> / '.$prev.'</span>';
     if ($cur > $prev) {
-        return '<span style="color:#16a34a;font-weight:600;">'.$cur.'</span> / '.$prev;
+        return '<span style="color:#16a34a;font-weight:700;">'.$cur.'</span>'.$rest;
     }
 
-    return $cur.' / '.$prev;
+    return '<span style="color:#111827;font-weight:normal;">'.$cur.'</span>'.$rest;
 };
 
 $byTeacher = \Illuminate\Support\Facades\DB::table('papers')
@@ -433,10 +434,10 @@ echo "### 按老师\n\n";
 
 echo '<table class="weekly-teacher-table">';
 echo '<colgroup>';
-echo '<col style="width:4%" /><col style="width:12%" />';
-echo '<col class="col-slash" style="width:10%" /><col style="width:13%" />';
-echo '<col class="col-slash" style="width:10%" /><col style="width:13%" />';
-echo '<col class="col-slash" style="width:10%" />';
+echo '<col style="width:4%" /><col class="col-name" style="width:7%" />';
+echo '<col class="col-slash" style="width:11%" /><col style="width:14%" />';
+echo '<col class="col-slash" style="width:11%" /><col style="width:14%" />';
+echo '<col class="col-slash" style="width:11%" />';
 echo '</colgroup>';
 echo '<thead><tr>';
 echo '<th>排名</th><th>老师</th><th>学案数量</th><th>学案·环比</th><th>分析数量</th><th>学情·环比</th><th>学生数</th>';

+ 15 - 6
scripts/report_teacher_weekly_stats_pdf.php

@@ -45,12 +45,21 @@ th { background: #f3f4f6; font-weight: 600; }
 .weekly-chart { margin: 8px 0 14px 0; page-break-inside: avoid; }
 .weekly-chart p { margin: 0 0 6px 0; }
 .weekly-teacher-table { table-layout: fixed; width: 100%; font-size: 9pt; }
-.weekly-teacher-table col.col-rank { width: 5%; }
-.weekly-teacher-table col.col-name { width: 6%; }
-.weekly-teacher-table col.col-tid { width: 8%; }
-.weekly-teacher-table col.col-slash { width: 10%; }
-.weekly-teacher-table .td-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 0; }
-.weekly-teacher-table .td-slash { font-variant-numeric: tabular-nums; font-size: 9pt; }
+.weekly-teacher-table col.col-name { width: 7%; }
+.weekly-teacher-table col.col-slash { width: 11%; }
+.weekly-teacher-table .td-name {
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+  max-width: 0;
+  color: #111827;
+  font-size: 9pt;
+}
+.weekly-teacher-table .td-slash {
+  font-variant-numeric: tabular-nums;
+  font-size: 9pt;
+  color: #111827;
+}
 .weekly-teacher-table .td-stu { font-size: 8.5pt; }
 .weekly-teacher-table .td-name .teacher-id { color: #6b7280; font-size: 9pt; font-weight: normal; }
 </style>