From 9ae506c185e47e5630b76df14b51d4156a7d6163 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=A7=E8=BF=9E=E5=B7=B4=E6=8E=8C?= Date: Mon, 1 Jan 2024 19:02:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=88=90=E7=BB=A9=E4=B8=8D?= =?UTF-8?q?=E5=85=A8=E6=97=B6=E6=98=BE=E7=A4=BA=E9=94=99=E8=A1=8C=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98=EF=BC=88=E4=BD=86=E6=84=BF=E4=BA=BA=E9=95=BF?= =?UTF-8?q?=E9=86=89=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/chengji/controller/Index.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/chengji/controller/Index.php b/app/chengji/controller/Index.php index 255f32e8..cabfa364 100755 --- a/app/chengji/controller/Index.php +++ b/app/chengji/controller/Index.php @@ -354,7 +354,7 @@ class Index extends AdminBase foreach ($chengjiinfo as $key => $value) { $i = 0; // 表格赋值 - $sheet->setCellValue($colname[$i] . $row_temp, $row_temp - 3); + $sheet->setCellValue($colname[$i] . $row_temp, $row_temp - 3); # $i++; $sheet->setCellValue($colname[$i] . $row_temp, $value['banji_title']); $i++; @@ -362,19 +362,24 @@ class Index extends AdminBase $i++; $sheet->setCellValue($colname[$i] . $row_temp, $value['sex']); $i++; - foreach ($subject_id as $k => $val) { + foreach ($subject_id as $k => $val) { # 循环写入成绩 if(isset($value[$val['lieming'] . 'defen'])) { $sheet->setCellValue($colname[$i] . $row_temp, $value[$val['lieming'] . 'defen']); $i++; foreach ($tjxm_left as $tjxml_k => $tjxml_v) { - $sheet->setCellValue($colname[$i] . $row_temp, $value[$val['lieming'] . $tjxml_v['biaoshi']]); + $sheet->setCellValue($colname[$i] . $row_temp, $value[$val['lieming'] . $tjxml_v['biaoshi']] ? $value[$val['lieming'] . $tjxml_v['biaoshi']] : ''); $i++; } }else{ + // 当没有成绩时,空出没有成绩的单元格 $i++; + foreach ($tjxm_left as $tjxml_k => $tjxml_v) { + $i++; + } } } + $sheet->setCellValue($colname[$i] . $row_temp, $value['avg']); $i++; $sheet->setCellValue($colname[$i] . $row_temp, $value['sum']);