优化汇总表显示
This commit is contained in:
1 parent
46dd71a2bf
commit
b6b88bf3a4
3 files changed
+8
-9
No files matched your search
@@ -17,7 +17,7 @@ class Tongji extends Base
|
||||
->with([
|
||||
'KsNianji'
|
||||
,'ksSubject'=>function($query){
|
||||
$query->field('kaoshiid,subjectid')
|
||||
$query->field('kaoshiid,subjectid,manfen')
|
||||
->with(['subjectName'=>function($q){
|
||||
$q->field('id,title,lieming');
|
||||
}]
|
||||
@@ -39,7 +39,6 @@ class Tongji extends Base
|
||||
$list['kaoshi'] = $kaoshi;
|
||||
|
||||
|
||||
|
||||
// 模板赋值
|
||||
$this->assign('list',$list);
|
||||
|
||||
@@ -147,7 +146,7 @@ class Tongji extends Base
|
||||
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||
$sheet = $spreadsheet->getActiveSheet();
|
||||
|
||||
$sbjcol = ['cnt'=>'人数','avg'=>'平均分','jige'=>'及格率','youxiu'=>'优秀率'];
|
||||
$sbjcol = ['cnt'=>'人数','avg'=>'平均分','jige'=>'及格率%','youxiu'=>'优秀率%'];
|
||||
$sbjcolcnt = count($sbjcol);
|
||||
$colname = excelLieming();
|
||||
$colcnt = $sbjcolcnt*count($xk)+3;
|
||||
@@ -164,14 +163,14 @@ class Tongji extends Base
|
||||
foreach ($xk as $key => $value) {
|
||||
$colend = $col + $sbjcolcnt - 1;
|
||||
$sheet->mergeCells($colname[$col].'3:'.$colname[$colend].'3');
|
||||
$sheet->setCellValue($colname[$col].'3', $value->subject_name->title.' '.$value->manfen);
|
||||
$sheet->setCellValue($colname[$col].'3', $value->subject_name->title.' ('.$value->manfen.')');
|
||||
foreach ($sbjcol as $k => $val) {
|
||||
$sheet->setCellValue($colname[$col].'4', $val);
|
||||
$col++;
|
||||
}
|
||||
}
|
||||
$sheet->mergeCells($colname[$col].'3:'.$colname[$col].'4');
|
||||
$sheet->setCellValue($colname[$col].'3', '全科及格');
|
||||
$sheet->setCellValue($colname[$col].'3', '全科及格率%');
|
||||
$col++;
|
||||
$sheet->mergeCells($colname[$col].'3:'.$colname[$col].'4');
|
||||
$sheet->setCellValue($colname[$col].'3', '全科平均');
|
||||
@@ -217,7 +216,7 @@ class Tongji extends Base
|
||||
->with([
|
||||
'KsNianji'
|
||||
,'ksSubject'=>function($query){
|
||||
$query->field('kaoshiid,subjectid')
|
||||
$query->field('kaoshiid,subjectid,manfen')
|
||||
->with(['subjectName'=>function($q){
|
||||
$q->field('id,title,lieming');
|
||||
}]
|
||||
@@ -361,7 +360,7 @@ class Tongji extends Base
|
||||
foreach ($xk as $key => $value) {
|
||||
$colend = $col + $sbjcolcnt - 1;
|
||||
$sheet->mergeCells($colname[$col].'3:'.$colname[$colend].'3');
|
||||
$sheet->setCellValue($colname[$col].'3', $value->subject_name->title.' '.$value->manfen);
|
||||
$sheet->setCellValue($colname[$col].'3', $value->subject_name->title.' ('.$value->manfen.')');
|
||||
foreach ($sbjcol as $k => $val) {
|
||||
$sheet->setCellValue($colname[$col].'4', $val);
|
||||
$col++;
|
||||
|
||||
@@ -95,7 +95,7 @@
|
||||
var xiangmu = {cnt:'人数',avg:'平均分',jige:'及格率%',youxiu:'优秀率%'}; // 要显示哪些统计结果
|
||||
|
||||
$.each(xk,function(index,value){
|
||||
options.cols[0].push({title: xk[index].subject_name.title,colspan:4,align:'center'});
|
||||
options.cols[0].push({title: xk[index].subject_name.title+'('+xk[index].manfen+')',colspan:4,align:'center'});
|
||||
$.each(xiangmu,function(i,val){
|
||||
var colname = xk[index].subject_name.lieming;
|
||||
// console.log(colname + ' ' + i);
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
var xiangmu = {cnt:'人数',avg:'平均分',jige:'及格率%',youxiu:'优秀率%'}; // 要显示哪些统计结果
|
||||
|
||||
$.each(xk,function(index,value){
|
||||
options.cols[0].push({title: xk[index].subject_name.title,colspan:4,align:'center'});
|
||||
options.cols[0].push({title: xk[index].subject_name.title+'('+xk[index].manfen+')',colspan:4,align:'center'});
|
||||
$.each(xiangmu,function(i,val){
|
||||
var colname = xk[index].subject_name.lieming;
|
||||
// console.log(colname + ' ' + i);
|
||||
|
||||
Reference in new issue
Block a user