From 16ee6a269ad31770e05e5f31d5ccfc0325de215e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B7=B4=E6=8E=8C?= Date: Thu, 9 Apr 2020 14:15:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=88=90=E7=BB=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/chengji/common.php | 21 +-- app/chengji/controller/Bjtongji.php | 178 +++++++++------------ app/chengji/controller/Njtongji.php | 105 ++++++------ app/chengji/controller/Schtongji.php | 20 +-- app/chengji/model/TongjiBj.php | 2 +- app/chengji/model/TongjiNj.php | 8 +- app/chengji/model/TongjiSch.php | 8 +- app/chengji/view/bjtongji/biaoge.html | 3 +- app/chengji/view/bjtongji/dw_biaoge.html | 10 +- app/chengji/view/njtongji/biaoge.html | 17 +- app/chengji/view/njtongji/dw_biaoge.html | 4 +- app/chengji/view/schtongji/biaoge.html | 10 +- app/event/MyEvent.php | 2 +- app/kaohao/controller/Index.php | 2 +- app/kaohao/model/Search.php | 70 ++++---- app/kaohao/view/index/read.html | 8 +- app/kaoshi/controller/TongjiLog.php | 8 +- app/kaoshi/model/Kaoshi.php | 5 +- app/kaoshi/model/TongjiLog.php | 25 ++- app/kaoshi/view/index/index.html | 12 +- app/kaoshi/view/index/more_action.html | 4 +- app/kaoshi/view/tongji_log/index.html | 7 +- app/listener/KaoshiJieShu.php | 2 +- app/listener/TongjiLog.php | 4 +- app/renshi/controller/StudentChengji.php | 5 +- app/renshi/model/StudentChengji.php | 22 +-- app/renshi/view/student_chengji/index.html | 22 ++- database/seeds/Rule.php | 8 +- 28 files changed, 265 insertions(+), 327 deletions(-) diff --git a/app/chengji/common.php b/app/chengji/common.php index 409aeafe..e9e90b62 100644 --- a/app/chengji/common.php +++ b/app/chengji/common.php @@ -58,7 +58,7 @@ function manfenvalidate($defen, $manfen) { $chengji[$key][] = '项目'; foreach ($value['chengji'] as $k => $val) { - $chengji[$key][] = $val['banji_title']; + $chengji[$key][] = $val['title']; $series[] = ['type'=>'bar']; } } @@ -93,17 +93,15 @@ function manfenvalidate($defen, $manfen) */ function xiangti($jg) { - $data = array(); $axisData = array(); $chengji = array(); $category = array(); foreach ($jg as $key => $value) { - if($key ==0) - { + if ($key ==0) { foreach ($value['chengji'] as $k => $val) { - $category[$k] = $val['banji_title']; + $category[$k] = $val['title']; } } @@ -115,17 +113,15 @@ function manfenvalidate($defen, $manfen) $chengji[$k][$key][4] = $val['sifenwei']['max']; } - if( isset($value['banji_title'])) - { - $temp = $value['school_jiancheng'].$value['banji_title']; - }else{ + if (isset($value['banji_title'])) { + $temp = $value['school_jiancheng'] . $value['banji_title']; + } else { $temp = $value['school_jiancheng']; } $axisData[] = $temp; } - $data = [ 'axisData' => $axisData ,'boxData' => $chengji @@ -143,10 +139,9 @@ function manfenvalidate($defen, $manfen) */ function tjOrder($cj,$type = 'desc') { - if($type == 'desc') - { + if ($type == 'desc') { arsort($cj); - }else{ + } else { asort($cj); } diff --git a/app/chengji/controller/Bjtongji.php b/app/chengji/controller/Bjtongji.php index 9b524351..9ebfa4c3 100644 --- a/app/chengji/controller/Bjtongji.php +++ b/app/chengji/controller/Bjtongji.php @@ -54,8 +54,7 @@ class Bjtongji extends BaseController ,'banji_id' => array() ], 'POST'); - if(count($src['banji_id'])==0) - { + if (count($src['banji_id'])==0) { // 获取参与考试的班级 $khSrc = new \app\kaohao\model\Search; $src['banji_id']= array_column($khSrc->cyBanji($src),'id'); @@ -69,7 +68,6 @@ class Bjtongji extends BaseController $cnt = count($data); // 截取当前页数据 $data = array_slice($data, ($src['page'] - 1) * $src['limit'], $src['limit']); - // 重组返回内容 $data = [ 'code'=> 0 , // ajax请求次数,作为标识符 @@ -87,22 +85,22 @@ class Bjtongji extends BaseController { // 设置页面标题 $list['set'] = array( - 'webtitle'=>'各班级成绩汇总表下载', - 'butname'=>'下载', - 'formpost'=>'POST', - 'url'=>'/chengji/bjtj/dwxlsx', - 'kaoshi'=>$kaoshi_id + 'webtitle' => '各班级成绩汇总表下载' + ,'butname' => '下载' + ,'formpost' => 'POST' + ,'url' => '/chengji/bjtj/dwxlsx' + ,'kaoshi_id' => $kaoshi_id ); // 获取参与学校 - $khSrc = new \app\kaoshi\model\KaohaoSearch; - $src['kaoshi'] = $kaoshi_id; - $list['set']['school'] = $khSrc->cySchool($src); + $khSrc = new \app\kaohao\model\Search; + $src['kaoshi_id'] = $kaoshi_id; + $list['set']['school_id'] = $khSrc->cySchool($src); // 获取年级与学科 $ksset = new \app\kaoshi\model\KaoshiSet; $list['set']['nianji'] = $ksset->srcNianji($kaoshi_id); // 模板赋值 - $this->view->assign('list',$list); + $this->view->assign('list', $list); // 渲染 return $this->view->fetch(); @@ -114,77 +112,65 @@ class Bjtongji extends BaseController { // 获取表单参数 $src = $this->request - ->only([ - 'kaoshi'=>'', - 'ruxuenian'=>'', - 'school'=>array(), - ],'POST'); + ->only([ + 'kaoshi_id' => '' + ,'ruxuenian' => '' + ,'school_id' => array() + ], 'POST'); + $src['school_id'] = strToarray($src['school_id']); - - // 如果获取到的school是字符串,将它转换成数组 - $src['school'] = strToarray($src['school']); - - // 获取参与考试的班级 - $kh = new \app\kaoshi\model\Kaohao; - $src['banji']= array_column($kh->cyBanji($src), 'id'); - // $src['banji']= $kh->cyBanji($src); - - - // 获统计成绩结果 - $btj = new BTJ; + // 获取相关参数 + $khSrc = new \app\kaohao\model\Search; # 参考班级 + $src['banji_id']= array_column($khSrc->cyBanji($src), 'id'); + $btj = new BTJ; # 成绩统计结果 $data = $btj->search($src); $ntj = new \app\chengji\model\TongjiNj; $dataAll = $ntj->search($src); - count($dataAll)>0 ? $data['all'] = $dataAll[0] : $data; - - - // 获取参考学科 - $ks = new \app\kaoshi\model\Kaoshi; - $ksinfo = $ks->where('id',$src['kaoshi']) - ->field('id,title,bfdate') + count($dataAll) > 0 ? $data['all'] = $dataAll[0] : $data; + $ks = new \app\kaoshi\model\Kaoshi; # 参考学科 + $ksinfo = $ks->where('id', $src['kaoshi_id']) + ->field('id, title, bfdate') ->find(); $ksset = new \app\kaoshi\model\KaoshiSet; - $xk = $ksset->srcSubject($src['kaoshi'],'',$src['ruxuenian']); - - // 获取考试年级名称 - $njlist = nianjiList($ksinfo->getData('bfdate')); + $xk = $ksset->srcSubject($src['kaoshi_id'], '', $src['ruxuenian']); + $njlist = nianJiNameList($ksinfo->getData('bfdate')); # 参考年级 $nianji = $njlist[$src['ruxuenian']]; + $school = new \app\system\model\School; # 学校、年级信息 + $schoolname = $school->where('id', 'in', $src['school_id'])->value('jiancheng'); + $tabletitle = $ksinfo->title . ' ' . $schoolname . ' ' . $nianji . '各班级成绩汇总'; - - // 获取要下载成绩的学校和年级信息 - $school = new \app\system\model\School; - $schoolname = $school->where('id','in',$src['school'])->value('jiancheng'); - $tabletitle = $ksinfo->title.' '.$schoolname.' '. $nianji.'各班级成绩汇总'; - - // 创建表格 - $spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet; + // 将数据写入表格中 + $spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet; # 创建文档 $sheet = $spreadsheet->getActiveSheet(); $thistime = date("Y-m-d h:i:sa"); - // 设置文档属性 - $spreadsheet->getProperties() - ->setCreator("尚码成绩管理系统") //作者 - ->setTitle("尚码成绩管理") //标题 + $spreadsheet->getProperties() # 设置文档属性 + ->setCreator("码蚁成绩管理系统") //作者 + ->setTitle("码蚁成绩管理") //标题 ->setLastModifiedBy(session('username')) //最后修改者 - ->setDescription("该表格由".session('username').session('id')."于".$thistime."在尚码成绩管理系统中下载,只作为内部交流材料,不允许外泄。") //描述 - ->setKeywords("尚码 成绩管理") //关键字 + ->setDescription("该表格由" . session('username') . session('id') . "于" . $thistime . "在码蚁成绩管理系统中下载,只作为内部交流材料,不允许外泄。") //描述 + ->setKeywords("码蚁 成绩管理") //关键字 ->setCategory("成绩管理"); //分类 - - $sbjcol = ['cjCnt'=>'人数','avg'=>'平均分','jige'=>'及格率%','youxiu'=>'优秀率%']; + // 设置要导出的项目、列名、起始行 + $sbjcol = [ + 'cjCnt' => '人数' + ,'avg' => '平均分' + ,'jige' => '及格率%' + ,'youxiu' => '优秀率%' + ]; $sbjcolcnt = count($sbjcol); - $colname = excelLieming(); + $colname = excelColumnName(); $colcnt = $sbjcolcnt*count($xk)+3; - // 设置表头信息 - $sheet->mergeCells('A1:'.$colname[$colcnt].'1'); + $sheet->mergeCells('A1:' . $colname[$colcnt] . '1'); $sheet->setCellValue('A1', $tabletitle); $sheet->mergeCells('A3:A4'); $sheet->setCellValue('A3', '序号'); $sheet->mergeCells('B3:B4'); $sheet->setCellValue('B3', '班级'); $col = 2; - foreach ($xk as $key => $value) { + foreach ($xk as $key => $value) { # 把学科信息定入表头 $colend = $col + $sbjcolcnt - 1; $sheet->mergeCells($colname[$col].'3:'.$colname[$colend].'3'); $sheet->setCellValue($colname[$col].'3', $value['title'].' ('.$value['fenshuxian']['manfen'].')'); @@ -200,9 +186,7 @@ class Bjtongji extends BaseController $sheet->setCellValue($colname[$col].'3', '全科平均'); $sheet->getStyle('C3:'.$colname[$col].'4')->getAlignment()->setWrapText(true); - - - $row = 5; + $row = 5; # 循环写入成绩 foreach ($data as $key => $value) { $col = 2; $sheet->setCellValue('A'.$row, $row-4); @@ -211,7 +195,7 @@ class Bjtongji extends BaseController $sheet->setCellValue('B'.$row, '合计'); $a = 'hj'; }else{ - $sheet->setCellValue('B'.$row, $value['title']); + $sheet->setCellValue('B'.$row, $value['banji_title']); $a = 'val'; } @@ -227,19 +211,15 @@ class Bjtongji extends BaseController $row++; } - - - // 居中 - $styleArray = [ + // 设置表格格式 + $styleArray = [ # 居中 'alignment' => [ 'horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER, 'vertical' => \PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER, //垂直居中 ], ]; $sheet->getStyle('A1:'.$colname[$col].($row-1))->applyFromArray($styleArray); - - // 加边框 - $styleArray = [ + $styleArray = [ # 加边框 'borders' => [ 'allBorders' => [ 'borderStyle' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN, @@ -247,27 +227,24 @@ class Bjtongji extends BaseController ], ], ]; - $sheet->getStyle('A3:'.$colname[$col].($row-1))->applyFromArray($styleArray); - // 修改标题字号 - $sheet->getStyle('A1')->getFont()->setBold(true)->setName('宋体')->setSize(20); - // 设置行高 - $sheet->getDefaultRowDimension()->setRowHeight(35); + $sheet->getStyle('A3:'.$colname[$col].($row-1)) + ->applyFromArray($styleArray); + $sheet->getStyle('A1')->getFont()->setBold(true) + ->setName('宋体')->setSize(20); # 修改标题字号 + $sheet->getDefaultRowDimension()->setRowHeight(35); # 设置行高 $sheet->getRowDimension('3:4')->setRowHeight(25); - // 设置列宽 - $sheet->getDefaultColumnDimension()->setWidth(8.3); + $sheet->getDefaultColumnDimension()->setWidth(8.3); # 设置列宽 $sheet->getColumnDimension('A')->setWidth(5); $sheet->getColumnDimension('B')->setWidth(10.5); - // 页面设置 - $sheet->getPageSetup()->setOrientation(\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::ORIENTATION_LANDSCAPE); - $sheet->getPageSetup()->setPaperSize(\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A4); - $sheet->getPageMargins()->setTop(0.8); + $sheet->getPageSetup()->setOrientation(\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::ORIENTATION_LANDSCAPE); # 横向 + $sheet->getPageSetup()->setPaperSize(\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A4); # 大小A4 + $sheet->getPageMargins()->setTop(0.8); # 页边距 $sheet->getPageMargins()->setRight(0.2); $sheet->getPageMargins()->setLeft(0.2); $sheet->getPageMargins()->setBottom(0.8); - // 打印居中 - $sheet->getPageSetup()->setHorizontalCentered(true); + $sheet->getPageSetup()->setHorizontalCentered(true); # 打印居中 $sheet->getPageSetup()->setVerticalCentered(false); // 保存文件 @@ -279,33 +256,29 @@ class Bjtongji extends BaseController $writer->save('php://output'); ob_flush(); flush(); - - } - // 统计各班级成绩 public function tongji() { // 获取变量 - $kaoshi_id = input('post.kaoshi'); + $kaoshi_id = input('post.kaoshi_id'); // 判断考试状态 - event('ksjs',$kaoshi_id); + event('ksjs', $kaoshi_id); // 统计成绩 $btj = new BTJ; $data = $btj->tjBanji($kaoshi_id); - if(true == $data) - { + if (true == $data) { $data = ['msg' => '各班级成绩统计完成', 'val' => 1]; $src = [ 'kaoshi_id' => $kaoshi_id, - 'category' => 'bjtj', + 'category_id' => 'bjtj', ]; event('tjlog', $src); - }else{ + } else { $data = ['msg' => '数据处理错误', 'val' => 0]; } @@ -313,12 +286,11 @@ class Bjtongji extends BaseController } - // 统计学生在班级名次 public function bjOrder() { // 获取变量 - $kaoshi_id = input('post.kaoshi'); + $kaoshi_id = input('post.kaoshi_id'); // 判断考试状态 event('ksjs', $kaoshi_id); @@ -326,15 +298,14 @@ class Bjtongji extends BaseController $btj = new BTJ; $data = $btj->bjOrder($kaoshi_id); - if(true == $data) - { - $data=['msg'=>'学生成绩在班级位置统计完成。','val'=>1]; + if (true == $data) { + $data = ['msg' => '学生成绩在班级位置统计完成。', 'val' => 1]; $src = [ 'kaoshi_id' => $kaoshi_id ,'category_id' => 'bjwz' ]; event('tjlog', $src); - }else{ + } else { $data = ['msg' => '数据处理错误', 'val' => 0]; } @@ -345,7 +316,6 @@ class Bjtongji extends BaseController // 统计平均分优秀率及格率 public function myAvg($kaoshi_id) { - // 获取参数 $src = $this->request ->only([ @@ -359,20 +329,18 @@ class Bjtongji extends BaseController if (count($src['banji_id']) == 0) { // 获取参与考试的班级 $khSrc = new \app\kaohao\model\Search; - $src['banji_id']= array_column($khSrc->cyBanji($src), 'id'); + $src['banji_id'] = array_column($khSrc->cyBanji($src), 'id'); } // 统计成绩 $btj = new BTJ; $data = $btj->search($src); - $data = tiaoxingOnexiangmu($data, $src['xiangmu']); return json($data); } - // 统计平均分优秀率及格率 public function myXiangti($kaoshi_id) { @@ -383,12 +351,12 @@ class Bjtongji extends BaseController ,'ruxuenian' => '' ,'school_id' => array() ,'banji_id' => array() - ],'POST'); + ], 'POST'); if (count($src['banji_id']) == 0) { // 获取参与考试的班级 $khSrc = new \app\kaohao\model\Search; - $src['banji']= array_column($khSrc->cyBanji($src), 'id'); + $src['banji_id']= array_column($khSrc->cyBanji($src), 'id'); } // 统计成绩 diff --git a/app/chengji/controller/Njtongji.php b/app/chengji/controller/Njtongji.php index 8f1e3fd2..f1c78b7d 100644 --- a/app/chengji/controller/Njtongji.php +++ b/app/chengji/controller/Njtongji.php @@ -19,16 +19,16 @@ class Njtongji extends BaseController ->find(); // 获取参与学校 $khSrc = new \app\kaohao\model\Search; - $src['kaoshi'] = $kaoshi_id; - $list['school'] = $khSrc->cySchool($src); + $src['kaoshi_id'] = $kaoshi_id; + $list['school_id'] = $khSrc->cySchool($src); // 获取年级与学科 $ksset = new \app\kaoshi\model\KaoshiSet; $list['nianji'] = $ksset->srcNianji($kaoshi_id); - $list['subject'] = $ksset->srcSubject($kaoshi_id, '', ''); + $list['subject_id'] = $ksset->srcSubject($kaoshi_id, '', ''); // 设置要给模板赋值的信息 $list['webtitle'] = '各学校的年级成绩统计表'; - $list['kaoshi'] = $kaoshi_id; + $list['kaoshi_id'] = $kaoshi_id; $list['kaoshititle'] = $ksinfo->title; $list['dataurl'] = '/chengji/njtj/data'; @@ -46,28 +46,36 @@ class Njtongji extends BaseController // 获取参数 $src = $this->request ->only([ - 'page'=>'1', - 'limit'=>'30', - 'kaoshi_id'=>'', - 'ruxuenian'=>'', + 'page' => '1' + ,'limit' => '30' + ,'kaoshi_id' => '' + ,'ruxuenian' => '' ],'POST'); // 统计成绩 $ntj = new NTJ; $data = $ntj->search($src); - $data = reSetArray($data); + $data = array_slice($data, ($src['page'] - 1) * $src['limit'], $src['limit']); $schtj = new \app\chengji\model\TongjiSch; $dataAll = $schtj->search($src); if (count($dataAll) > 0) { - $data['data'][] = $dataAll['all']; - $data['count'] = $data['count'] + 1; + $data[] = $dataAll['all']; } + // 获取记录总数 + $cnt = count($data); + // 重组返回内容 + $data = [ + 'code'=> 0 , // ajax请求次数,作为标识符 + 'msg'=>"", // 获取到的结果数(每页显示数量) + 'count'=>$cnt, // 符合条件的总数据量 + 'data'=>$data, //获取到的数据结果 + ]; + return json($data); } - // 年级、班级学生成绩统计结果下载界面 public function dwBiaoge($kaoshi_id) { @@ -95,7 +103,6 @@ class Njtongji extends BaseController // 年级、班级学生成绩统计下载表格 public function dwNianjixlsx() { - // 获取参数 $src = $this->request ->only([ @@ -114,36 +121,32 @@ class Njtongji extends BaseController $data['all'] = $dataAll['all']; } - // 获取参考学科 - $ks = new \app\kaoshi\model\Kaoshi; + // 获取信息 + $ks = new \app\kaoshi\model\Kaoshi; # 获取参考学科 $ksinfo = $ks->where('id', $src['kaoshi_id']) ->field('id, title, bfdate') ->find(); $ksset = new \app\kaoshi\model\KaoshiSet; $xk = $ksset->srcSubject($src['kaoshi_id'], '', $src['ruxuenian']); - - // 获取考试年级名称 - $njlist = nianjiList($ksinfo->getData('bfdate')); + $njlist = nianJiNameList($ksinfo->getData('bfdate')); # 获取考试年级名称 $nianji = $njlist[$src['ruxuenian']]; + $tabletitle = $ksinfo->title . ' ' . $nianji . '各学校成绩汇总'; # 获取要下载成绩的学校和年级信息 - // 获取要下载成绩的学校和年级信息 - $tabletitle = $ksinfo->title . ' ' . $nianji . '各学校成绩汇总'; - - // 创建表格 + //创建文件 $spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet; $sheet = $spreadsheet->getActiveSheet(); - $thistime = date("Y-m-d h:i:sa"); // 设置文档属性 $spreadsheet->getProperties() - ->setCreator("尚码成绩管理系统") //作者 - ->setTitle("尚码成绩管理") //标题 + ->setCreator("码蚁成绩管理系统") //作者 + ->setTitle("码蚁成绩管理") //标题 ->setLastModifiedBy(session('username')) //最后修改者 - ->setDescription("该表格由".session('username').session('id')."于".$thistime."在尚码成绩管理系统中下载,只作为内部交流材料,不允许外泄。") //描述 - ->setKeywords("尚码 成绩管理") //关键字 + ->setDescription("该表格由".session('username').session('id')."于".$thistime."在码蚁成绩管理系统中下载,只作为内部交流材料,不允许外泄。") //描述 + ->setKeywords("码蚁 成绩管理") //关键字 ->setCategory("成绩管理"); //分类 + // 设置导出项目、列表等 $sbjcol = [ 'cjCnt' => '人数' ,'avg' => '平均分' @@ -151,7 +154,7 @@ class Njtongji extends BaseController ,'youxiu' => '优秀率%' ]; $sbjcolcnt = count($sbjcol); - $colname = excelLieming(); + $colname = excelColumnName(); $colcnt = $sbjcolcnt * count($xk) + 3; // 设置表头信息 @@ -178,11 +181,12 @@ class Njtongji extends BaseController $sheet->setCellValue($colname[$col] . '3', '总平均分'); $sheet->getStyle('C3:' . $colname[$col] . '4')->getAlignment()->setWrapText(true); + // 写入统计结果 $row = 5; foreach ($data as $key => $value) { $col = 2; $sheet->setCellValue('A' . $row, $row - 4); - $sheet->setCellValue('B' . $row, $value['school']); + $sheet->setCellValue('B' . $row, $value['school_jiancheng']); foreach ($xk as $ke => $val) { foreach ($sbjcol as $k => $v) { $sheet->setCellValue($colname[$col] . $row, $value['chengji'][$val['lieming']][$k]); @@ -195,17 +199,15 @@ class Njtongji extends BaseController $row ++; } - // 居中 - $styleArray = [ + // 文档排版 + $styleArray = [ # 居中 'alignment' => [ 'horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER, 'vertical' => \PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER, //垂直居中 ], ]; $sheet->getStyle('A1:' . $colname[$col] . ($row - 1))->applyFromArray($styleArray); - - // 加边框 - $styleArray = [ + $styleArray = [ # 加边框 'borders' => [ 'allBorders' => [ 'borderStyle' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN, @@ -214,25 +216,22 @@ class Njtongji extends BaseController ], ]; $sheet->getStyle('A3:' . $colname[$col] . ($row - 1))->applyFromArray($styleArray); - // 修改标题字号 - $sheet->getStyle('A1')->getFont()->setBold(true)->setName('宋体')->setSize(20); - // 设置行高 - $sheet->getDefaultRowDimension()->setRowHeight(35); + + $sheet->getStyle('A1')->getFont()->setBold(true)->setName('宋体')->setSize(20); # 修改标题字号 + $sheet->getDefaultRowDimension()->setRowHeight(35); # 设置行高 $sheet->getRowDimension('3:4')->setRowHeight(25); - // 设置列宽 - $sheet->getDefaultColumnDimension()->setWidth(8.3); + $sheet->getDefaultColumnDimension()->setWidth(8.3); # 设置列宽 $sheet->getColumnDimension('A')->setWidth(5); $sheet->getColumnDimension('B')->setWidth(10.5); // 页面设置 $sheet->getPageSetup()->setOrientation(\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::ORIENTATION_LANDSCAPE); $sheet->getPageSetup()->setPaperSize(\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A4); - $sheet->getPageMargins()->setTop(0.8); + $sheet->getPageMargins()->setTop(0.8); # 设置页边距 $sheet->getPageMargins()->setRight(0.2); $sheet->getPageMargins()->setLeft(0.2); $sheet->getPageMargins()->setBottom(0.8); - // 打印居中 - $sheet->getPageSetup()->setHorizontalCentered(true); + $sheet->getPageSetup()->setHorizontalCentered(true); # 打印居中 $sheet->getPageSetup()->setVerticalCentered(false); // 保存文件 @@ -246,19 +245,19 @@ class Njtongji extends BaseController flush(); } + // 统计各班级成绩 public function tongji() { // 获取变量 - $kaoshi_id = input('post.kaoshi'); + $kaoshi_id = input('post.kaoshi_id'); // 判断考试状态 event('ksjs', $kaoshi_id); // 统计成绩 $ntj = new NTJ; $data = $ntj->tjNianji($kaoshi_id); - if(true == $data) - { + if (true == $data) { $data = [ 'msg'=>'各学校年级成绩统计完成' ,'val'=>1 @@ -268,7 +267,7 @@ class Njtongji extends BaseController ,'category_id' => 'njtj' ]; event('tjlog', $src); - }else{ + } else { $data = [ 'msg' => '数据处理错误' ,'val' => 0 @@ -287,16 +286,11 @@ class Njtongji extends BaseController // 判断考试状态 event('ksjs', $kaoshi_id); - halt($kaoshi_id); - // 统计成绩 $ntj = new NTJ; $data = $ntj->njOrder($kaoshi_id); - halt($data); - - if(true == $data) - { + if (true == $data) { $data = [ 'msg' => '学生成绩在学校年级位置统计完成。' ,'val' => 1 @@ -306,7 +300,7 @@ class Njtongji extends BaseController ,'category_id' => 'njwz' ]; event('tjlog', $src); - }else{ + } else { $data = [ 'msg' => '数据处理错误' ,'val' => 0 @@ -327,7 +321,7 @@ class Njtongji extends BaseController ,'ruxuenian' => '' ,'school_id' => array() ,'xiangmu' => '' - ],'POST'); + ], 'POST'); // 统计成绩 $ntj = new NTJ; @@ -354,7 +348,6 @@ class Njtongji extends BaseController // 统计成绩 $ntj = new NTJ; $data = $ntj->search($src); - $data = xiangti($data); return json($data); diff --git a/app/chengji/controller/Schtongji.php b/app/chengji/controller/Schtongji.php index 88edb09c..1dc9cc38 100644 --- a/app/chengji/controller/Schtongji.php +++ b/app/chengji/controller/Schtongji.php @@ -12,19 +12,19 @@ class Schtongji public function tongji() { // 获取变量 - $kaoshi = input('post.kaoshi'); + $kaoshi_id = input('post.kaoshi_id'); // 判断考试状态 - event('ksjs',$kaoshi); + event('ksjs', $kaoshi_id); // 统计成绩 $schtj = new SCHTJ; - $data = $schtj->tjSchool($kaoshi); + $data = $schtj->tjSchool($kaoshi_id); if(true == $data) { $data=['msg'=>'全区年级统计完成','val'=>1]; $src = [ - 'kaoshi_id' => $kaoshi, - 'category' => 'schtj', + 'kaoshi_id' => $kaoshi_id, + 'category_id' => 'schtj', ]; event('tjlog', $src); }else{ @@ -39,20 +39,20 @@ class Schtongji public function schOrder() { // 获取变量 - $kaoshi = input('post.kaoshi'); + $kaoshi_id = input('post.kaoshi_id'); // 判断考试状态 - event('ksjs',$kaoshi); + event('ksjs', $kaoshi_id); // 统计成绩 $schtj = new SCHTJ; - $data = $schtj->schOrder($kaoshi); + $data = $schtj->schOrder($kaoshi_id); if(true == $data) { $data=['msg'=>'学生成绩在全区位置统计完成','val'=>1]; $src = [ - 'kaoshi_id' => $kaoshi, - 'category' => 'schwz', + 'kaoshi_id' => $kaoshi_id, + 'category_id' => 'schwz', ]; event('tjlog', $src); }else{ diff --git a/app/chengji/model/TongjiBj.php b/app/chengji/model/TongjiBj.php index 95f110b2..8bfcb4e3 100644 --- a/app/chengji/model/TongjiBj.php +++ b/app/chengji/model/TongjiBj.php @@ -215,7 +215,7 @@ class TongjiBj extends BaseModel ,'youxiu' => $val->youxiu * 1 ,'jige' => $val->jige * 1 ,'cjCnt' => $val->chengji_cnt - ,'banji_title' => $val->bjSubject->title + ,'title' => $val->bjSubject->title ,'jiancheng' => $val->bjSubject->jiancheng ,'biaozhuncha' => $val->biaozhuncha * 1 ,'sifenwei' => [ diff --git a/app/chengji/model/TongjiNj.php b/app/chengji/model/TongjiNj.php index 0d2f45a9..41b2ce56 100644 --- a/app/chengji/model/TongjiNj.php +++ b/app/chengji/model/TongjiNj.php @@ -35,7 +35,7 @@ class TongjiNj extends BaseModel ,'school_id' => $school['id'] ,'ruxuenian' => $nianji['nianji'] ]; - $src['banji'] = array_column($khSrc->cyBanji($src), 'id'); + $src['banji_id'] = array_column($khSrc->cyBanji($src), 'id'); $subject = $ksset->srcSubject($kaoshi_id, '', $nianji['nianji']); $temp = $khSrc->srcChengjiList($src); $temp = $tj->tongjiSubject($temp, $subject); @@ -155,8 +155,8 @@ class TongjiNj extends BaseModel foreach ($tongjiJg as $key => $value) { $data[$value->school_id] = [ 'id' => $value->id - ,'school_id' => $value->njSchool->jiancheng - ,'schoolpaixu' => $value->njSchool->paixu + ,'school_jiancheng' => $value->njSchool->jiancheng + ,'school_paixu' => $value->njSchool->paixu ,'stuCnt' => $value->stu_cnt // 'title'=>$value->banjiTitle, // 'banjipaixu'=>$value->bjBanji->paixu, @@ -188,7 +188,7 @@ class TongjiNj extends BaseModel } } - $data = sortArrByManyField($data, 'schoolpaixu', SORT_ASC); + $data = sortArrByManyField($data, 'school_paixu', SORT_ASC); return $data; } diff --git a/app/chengji/model/TongjiSch.php b/app/chengji/model/TongjiSch.php index 7af0a2c2..bf50f9ec 100644 --- a/app/chengji/model/TongjiSch.php +++ b/app/chengji/model/TongjiSch.php @@ -27,7 +27,7 @@ class TongjiSch extends BaseModel 'kaoshi_id' => $kaoshi_id ,'ruxuenian' => $nianji['nianji'] ]; - $src['banji'] = array_column($khSrc->cyBanji($src), 'id'); + $src['banji_id'] = array_column($khSrc->cyBanji($src), 'id'); $subject = $ksset->srcSubject($kaoshi_id, '', $nianji['nianji']); $temp = $khSrc->srcChengjiList($src); $temp = $tj->tongjiSubject($temp, $subject); @@ -95,8 +95,6 @@ class TongjiSch extends BaseModel 'kaoshi_id' => '' ,'ruxuenian' => '' ); - - // 用新值替换初始值 $src = array_cover($srcfrom, $src); $kaoshi_id = $src['kaoshi_id']; @@ -124,8 +122,8 @@ class TongjiSch extends BaseModel foreach ($tongjiJg as $key => $value) { $data['all'] = [ 'id' => $value->id - ,'school_id' => '全区' - ,'schoolpaixu' => 999 + ,'school_jiancheng' => '全区' + ,'school_paixu' => 9999 ]; foreach ($value->schJieguo as $k => $val) { if ($val->subject_id > 0) { diff --git a/app/chengji/view/bjtongji/biaoge.html b/app/chengji/view/bjtongji/biaoge.html index bcb74205..bea9b915 100644 --- a/app/chengji/view/bjtongji/biaoge.html +++ b/app/chengji/view/bjtongji/biaoge.html @@ -131,6 +131,7 @@ table.on('toolbar(mytable)', function(obj){ switch(obj.event){ case 'dels': + break; var checkStatus = table.checkStatus('mytable'); //idmytable 即为基础参数 id 对应的值 cjgl.delAll(checkStatus,'/school','mytable'); break; @@ -138,7 +139,7 @@ cjgl.add('添加单位','/school/create','650','500'); break; case 'download': - cjgl.add('下载成绩','/chengji/bjtj/dwbiaoge/{$list.kaoshi_id}','650','300'); + cjgl.add('下载成绩','/chengji/bjtj/dwbiaoge/' + "{$list.kaoshi_id}",'650','300'); break; }; }); diff --git a/app/chengji/view/bjtongji/dw_biaoge.html b/app/chengji/view/bjtongji/dw_biaoge.html index 421a6d76..688f7026 100644 --- a/app/chengji/view/bjtongji/dw_biaoge.html +++ b/app/chengji/view/bjtongji/dw_biaoge.html @@ -4,13 +4,13 @@
- +
- - {foreach $list.set.school as $key=>$vo} + {foreach $list.set.school_id as $key=>$vo} - {/foreach} + {/foreach}
@@ -27,7 +27,7 @@ - +
- + {/block} {block name="table"}
@@ -58,12 +58,12 @@ // 设置列 options.cols=[[ //表头 {type:'numbers',title:'序号',rowspan:2}, - {field: 'school', title: '学校',minWidth:80,rowspan:2}, + {field: 'school_jiancheng', title: '学校',minWidth:80,rowspan:2}, ] ,[] ]; // 获取学科 - var xk = ''; + var xk = ''; xk = eval(decodeURIComponent(xk)); var xiangmu = {cjCnt:'参考人数',avg:'平均分',jige:'及格率%',youxiu:'优秀率%'}; // 要显示哪些统计结果 @@ -100,15 +100,6 @@ return str; }}); - - - // 设置查询条件 - options.where = { - kaoshi:"{$list.kaoshi}" - ,ruxuenian:$("input[name='ruxuenian']:checked").val() - } - - options.autoSort=true; @@ -134,7 +125,7 @@ cjgl.add('添加单位','/school/create','650','500'); break; case 'download': - cjgl.add('下载成绩','/chengji/njtj/dwbiaoge/{$list.kaoshi}','650','300'); + cjgl.add('下载成绩','/chengji/njtj/dwbiaoge/{$list.kaoshi_id}','650','300'); break; }; }); diff --git a/app/chengji/view/njtongji/dw_biaoge.html b/app/chengji/view/njtongji/dw_biaoge.html index 0d379e78..f1a4ad04 100644 --- a/app/chengji/view/njtongji/dw_biaoge.html +++ b/app/chengji/view/njtongji/dw_biaoge.html @@ -11,11 +11,11 @@ {foreach $list.set.nianji as $key=>$vo} - {/foreach} + {/foreach} - +
- + {/block} {block name="table"}
@@ -75,7 +75,7 @@ return str; } }; - + options.cols[1].push(colinfo); }); }); @@ -89,7 +89,7 @@ }}); - + // 设置查询条件 options.where = { kaoshi:"{$list.kaoshi}" @@ -142,4 +142,4 @@ }); }); -{/block} \ No newline at end of file +{/block} diff --git a/app/event/MyEvent.php b/app/event/MyEvent.php index b304b0e2..b2180f92 100644 --- a/app/event/MyEvent.php +++ b/app/event/MyEvent.php @@ -11,7 +11,7 @@ class MyEvent { // 获取考试状态 - public function ksInfo($kaoshi_id=0) + public function ksInfo($kaoshi_id = 0) { $kaoshi = new Kaoshi; $ksinfo = $kaoshi->kaoshiInfo($kaoshi_id); diff --git a/app/kaohao/controller/Index.php b/app/kaohao/controller/Index.php index 8de02ca3..3fac1c87 100644 --- a/app/kaohao/controller/Index.php +++ b/app/kaohao/controller/Index.php @@ -223,7 +223,7 @@ class Index extends BaseController $list['dataurl'] = '/renshi/studentcj/chengjilist'; $list['id'] = $id; - $stucj = new KH; + $stucj = new \app\kaohao\model\Search; $defen = $stucj->khSrcChengji($id); $color = [ 'layui-bg-red' diff --git a/app/kaohao/model/Search.php b/app/kaohao/model/Search.php index c94ff7bb..34056716 100644 --- a/app/kaohao/model/Search.php +++ b/app/kaohao/model/Search.php @@ -266,46 +266,46 @@ class Search extends BaseModel } - // // 根据考号查询成绩 - // public function khSrcChengji($id) - // { - // $kh = new kh; - // $stuCj = $kh::where('id', $id) - // ->with([ - // 'ksChengji'=>function($query){ - // $query - // ->with([ - // 'subjectName'=>function($q){ - // $q->field('id, title'); - // } - // ]) - // ->field('id, kaohao_id, subject_id, defen, defenlv, bweizhi, xweizhi, qweizhi'); - // } - // ]) - // ->field('id, kaoshi_id, student_id, ruxuenian, nianji, banji_id, paixu') - // ->append(['banjiTitle']) - // ->find(); + // 根据考号查询成绩 + public function khSrcChengji($id) + { + $kh = new kh; + $stuCj = $kh::where('id', $id) + ->with([ + 'ksChengji'=>function($query){ + $query + ->with([ + 'subjectName'=>function($q){ + $q->field('id, title'); + } + ]) + ->field('id, kaohao_id, subject_id, defen, defenlv, bweizhi, xweizhi, qweizhi'); + } + ]) + ->field('id, kaoshi_id, student_id, ruxuenian, nianji, banji_id, paixu') + ->append(['banjiTitle']) + ->find(); - // return $stuCj; - // } + return $stuCj; + } - // // 获取考试成绩最后更新时间 - // public function lastUpdateTime($kaoshi_id) - // { - // // 获取考号 - // $kh = new kh; - // $kaohaoids = $kh->where('kaoshi', $kaoshi_id) - // ->cache(true) - // ->column('id'); + // 获取考试成绩最后更新时间 + public function lastUpdateTime($kaoshi_id) + { + // 获取考号 + $kh = new kh; + $kaohaoids = $kh->where('kaoshi_id', $kaoshi_id) + ->cache(true) + ->column('id'); - // $cj = new \app\chengji\model\Chengji; - // $lastcj = $cj->where('kaohao_id', 'in', $kaohaoids) - // ->order(['update_time' => 'desc']) - // ->find(); + $cj = new \app\chengji\model\Chengji; + $lastcj = $cj->where('kaohao_id', 'in', $kaohaoids) + ->order(['update_time' => 'desc']) + ->find(); - // return $lastcj; - // } + return $lastcj; + } // 获取参加考试学校 diff --git a/app/kaohao/view/index/read.html b/app/kaohao/view/index/read.html index e0dfba40..41289636 100644 --- a/app/kaohao/view/index/read.html +++ b/app/kaohao/view/index/read.html @@ -100,11 +100,11 @@ getLeiDa("{$list.id}"); // 条形统计图--平均分 - function getLeiDa(kaohaoid){ + function getLeiDa(kaohao_id){ var url = '/renshi/studentcj/chengjileida'; var title = '学科成绩雷达图'; var val = { - kaohaoid:kaohaoid + kaohao_id: kaohao_id }; createLeiDa(url,val,title); } @@ -121,10 +121,10 @@ * @param val 图表标题 * @return array 返回类型 */ - function createLeiDa(url,val,title) + function createLeiDa(url, val, title) { var myLeiDa = echarts.init(document.getElementById('leida')); - $.post(url,val).done(function (data) { + $.post(url, val).done(function (data) { myLeiDa.setOption({ title: { text:'', diff --git a/app/kaoshi/controller/TongjiLog.php b/app/kaoshi/controller/TongjiLog.php index 3bdc1255..f47bbd44 100644 --- a/app/kaoshi/controller/TongjiLog.php +++ b/app/kaoshi/controller/TongjiLog.php @@ -23,7 +23,7 @@ class TongjiLog extends BaseController // 设置要给模板赋值的信息 $list['webtitle'] = '最新统计结果状态'; - $list['kaoshi'] = $kaoshi_id; + $list['kaoshi_id'] = $kaoshi_id; $list['kaoshititle'] = $ksinfo->title; $list['dataurl'] = '/kaoshi/tjlog/data'; @@ -40,12 +40,12 @@ class TongjiLog extends BaseController { $src = $this->request ->only([ - 'kaoshi' => '', + 'kaoshi_id' => '', ], 'POST'); // 实例化考号 - $kh = new \app\kaoshi\model\Kaohao; - $lastcj = $kh->lastUpdateTime($src['kaoshi']); + $khSrc = new \app\kaohao\model\Search; + $lastcj = $khSrc->lastUpdateTime($src['kaoshi_id']); $cjLastTime = $lastcj->getData('update_time'); $src['cjlast'] = $cjLastTime; diff --git a/app/kaoshi/model/Kaoshi.php b/app/kaoshi/model/Kaoshi.php index 39f6e3b5..47be2baa 100644 --- a/app/kaoshi/model/Kaoshi.php +++ b/app/kaoshi/model/Kaoshi.php @@ -63,17 +63,16 @@ class Kaoshi extends BaseModel // 考试参加考试的学校、学科、年级、班级 - public function kaoshiInfo($kaoshi = 0) + public function kaoshiInfo($id = 0) { // 获取参考年级 - $kaoshiList = $this->where('id', $kaoshi) + $kaoshiList = $this->where('id', $id) ->field('id, title, status, luru') ->find(); return $kaoshiList; } - // 开始时间修改器 public function setBfdateAttr($value) { diff --git a/app/kaoshi/model/TongjiLog.php b/app/kaoshi/model/TongjiLog.php index bf1980ca..9f25c8f6 100644 --- a/app/kaoshi/model/TongjiLog.php +++ b/app/kaoshi/model/TongjiLog.php @@ -15,17 +15,16 @@ class TongjiLog extends BaseModel public function search($srcfrom) { $src = [ - 'kaoshi' => '', + 'kaoshi_id' => '', 'cjlast' => 0, ]; - // 用新值替换初始值 $src = array_cover($srcfrom, $src) ; $src['date'] = date('Y-m-d h:i:s', $src['cjlast']); - $logList = self::where('kaoshi_id',$src['kaoshi']) + $logList = self::where('kaoshi_id',$src['kaoshi_id']) ->with([ 'userName'=>function($query){ - $query->field('id,xingming'); + $query->field('id, xingming'); } ]) ->append(['url']) @@ -39,15 +38,15 @@ class TongjiLog extends BaseModel } // 开始时间获取器 - public function getCategoryAttr($value) + public function getCategoryIdAttr($value) { $src = [ - 'bjtj' => '班级统计', - 'njtj' => '年级统计', - 'schtj' => '区统计', - 'bjwz' => '班级位置', - 'njwz' => '年级位置', - 'schwz' => '区位置', + 'bjtj' => '班级统计' + ,'njtj' => '年级统计' + ,'schtj' => '区统计' + ,'bjwz' => '班级位置' + ,'njwz' => '年级位置' + ,'schwz' => '区位置' ]; return $src[$value]; @@ -65,7 +64,7 @@ class TongjiLog extends BaseModel 'schwz' => '/chengji/schtj/schorder', ]; - $val = $this->getData('category'); + $val = $this->getData('category_id'); return $src[$val]; } @@ -73,7 +72,7 @@ class TongjiLog extends BaseModel // 学科关联 public function userName() { - return $this->belongsTo('\app\admin\model\Admin','user_id','id'); + return $this->belongsTo('\app\admin\model\Admin', 'user_id', 'id'); } } diff --git a/app/kaoshi/view/index/index.html b/app/kaoshi/view/index/index.html index 3fc6e84f..ba23c6dd 100644 --- a/app/kaoshi/view/index/index.html +++ b/app/kaoshi/view/index/index.html @@ -22,7 +22,7 @@
- + {php} $category = getCategory(108);{/php} {volist name="category" id="vo"} @@ -96,10 +96,10 @@ switch(obj.event){ case 'dels': var checkStatus = table.checkStatus('mytable'); //idmytable 即为基础参数 id 对应的值 - cjgl.delAll(checkStatus,'index/delete','mytable'); + cjgl.delAll(checkStatus, 'index/delete', 'mytable'); break; case 'add': - cjgl.add('新建考试','index/create','','',true); + cjgl.add('新建考试', 'index/create', '', '', true); break; }; }); @@ -111,13 +111,13 @@ var tr = obj.tr; //获得当前行 tr 的DOM对象 switch(layEvent){ case 'del':// 删除 - cjgl.del(obj,"index/delete"); + cjgl.del(obj, "index/delete"); break; case 'edit':// 编辑 - cjgl.add('编辑考试','index/edit/'+obj.data.id,'','',true); + cjgl.add('编辑考试', 'index/edit/' + obj.data.id, '', '', true); break; case 'more':// 状态 - parent.xadmin.add_tab(obj.data.title + ' 操作','/kaoshi/index/more/'+obj.data.id,true); + parent.xadmin.add_tab(obj.data.title + ' 操作', '/kaoshi/index/more/' + obj.data.id, true); break; }; }); diff --git a/app/kaoshi/view/index/more_action.html b/app/kaoshi/view/index/more_action.html index 203ab691..c34ef305 100644 --- a/app/kaoshi/view/index/more_action.html +++ b/app/kaoshi/view/index/more_action.html @@ -197,7 +197,7 @@ type:'POST', async: true, data:{ - kaoshi:"{$kaoshi_id}" + kaoshi_id:"{$kaoshi_id}" }, beforeSend: function () { $("body").append('
'); @@ -209,7 +209,7 @@ layer.msg(result.msg); }, error:function(result){ - layer.msg('数据扔半道,回不来啦。',function(){}); + layer.msg('数据扔半道,回不来啦。', function(){}); }, }); } diff --git a/app/kaoshi/view/tongji_log/index.html b/app/kaoshi/view/tongji_log/index.html index f1fec27f..394e4c2f 100644 --- a/app/kaoshi/view/tongji_log/index.html +++ b/app/kaoshi/view/tongji_log/index.html @@ -13,7 +13,7 @@ {/block} {block name="search"} - + {/block} {block name="table"}
@@ -34,9 +34,8 @@ //设置列 options.cols=[[ //表头 {field:'id',type:'numbers',title:'序号',align:'center'}, - {field: 'category', title: '统计项目',align:'center',sort: false,minWidth:80,rowspan:2}, + {field: 'category_id', title: '统计项目',align:'center',sort: false,minWidth:80,rowspan:2}, {field: 'update_time', title: '最后统计时间',align:'center',sort: false,minWidth:130,rowspan:2}, - {field: 'cjlast', title: '最后更新成绩时间',align:'center',sort: false,minWidth:130,rowspan:2}, {field: 'cjlast', title: '统计人',align:'center',sort: false,minWidth:130,rowspan:2,templet:function(d){ str = ''; if(d.userName) @@ -62,7 +61,7 @@ switch(layEvent){ case 'tongji':// 删除 val = { - kaoshi:obj.data.kaoshi_id, + kaoshi_id:obj.data.kaoshi_id, }; cjgl.tongjiCj(obj.data.url,val); break; diff --git a/app/listener/KaoshiJieShu.php b/app/listener/KaoshiJieShu.php index 54d33fe2..069d14aa 100644 --- a/app/listener/KaoshiJieShu.php +++ b/app/listener/KaoshiJieShu.php @@ -22,7 +22,7 @@ class KaoshiJieShu $ksInfo = $event->ksInfo($kaoshi_id); if($ksInfo->status == 0) { - return $this->error('本次考试已经结束,不能操作!','/login/err'); + return $this->error('本次考试已经结束,不能操作!', '/login/err'); } return $ksInfo; diff --git a/app/listener/TongjiLog.php b/app/listener/TongjiLog.php index cff9c327..750c8769 100644 --- a/app/listener/TongjiLog.php +++ b/app/listener/TongjiLog.php @@ -16,12 +16,12 @@ class TongjiLog { $src = [ 'kaoshi_id' => '', - 'category' => '', + 'category_id' => '', ]; // 用新值替换初始值 $src = array_cover($srcfrom, $src) ; $event = new MyEvent; - $tjLog = $event->addTongjiLog($src['kaoshi_id'], $src['category']); + $tjLog = $event->addTongjiLog($src['kaoshi_id'], $src['category_id']); return true; } diff --git a/app/renshi/controller/StudentChengji.php b/app/renshi/controller/StudentChengji.php index 4b463407..010f4d52 100644 --- a/app/renshi/controller/StudentChengji.php +++ b/app/renshi/controller/StudentChengji.php @@ -40,7 +40,7 @@ class StudentChengji extends BaseController // 设置页面标题 $myInfo['webtitle'] = $myInfo->xingming . ' - 成绩'; $myInfo['dataurl'] = '/renshi/studentcj/data'; - $myInfo['student'] = $id; + $myInfo['student_id'] = $id; // 模板赋值 $this->view->assign('list', $myInfo); @@ -69,8 +69,7 @@ class StudentChengji extends BaseController // 获取学生成绩 $stucj = new STUCJ; $khList = $stucj->oneStudentChengjiList($src); - halt($khList); - $data = reSetArray($data, $src); + $data = reSetArray($khList, $src); return json($data); } diff --git a/app/renshi/model/StudentChengji.php b/app/renshi/model/StudentChengji.php index f0a72a31..3271b45a 100644 --- a/app/renshi/model/StudentChengji.php +++ b/app/renshi/model/StudentChengji.php @@ -25,23 +25,23 @@ class StudentChengji extends BaseModel $src = array_cover($srcfrom, $src); // 查询成绩 - $kh = new \app\kaoshi\model\Kaohao; - $stuCj = $kh->srcOneStudentChengji($src); + $khSrc = new \app\kaohao\model\Search; + $stuCj = $khSrc->srcOneStudentChengji($src); // 获取可以参加考试的学科 $sbj = new \app\teach\model\Subject; $sbjList = $sbj->where('kaoshi', 1) - ->where('status', 1) - ->field('id, lieming') - ->column('lieming', 'id'); + ->where('status', 1) + ->field('id, lieming') + ->column('lieming', 'id'); // 整理数据 $data = array(); foreach ($stuCj as $key => $value) { $data[$key] = [ - 'kaoshi_id' => $value->kaoshi, + 'kaoshi_id' => $value->kaoshi_id, 'kaoshiTitle' => $value->cjKaoshi->title, - 'kaohao_idd' => $value->id, + 'kaohao_id' => $value->id, 'banjiTitle' => $value->banjiTitle, 'zuzhi_id' => $value->cjKaoshi->ksZuzhi->jiancheng, 'category_id' => $value->cjKaoshi->ksCategory->title, @@ -98,8 +98,8 @@ class StudentChengji extends BaseModel ); $src = array_cover( $srcfrom , $src ); - $kh = new \app\kaoshi\model\Kaohao; - $stuCj = $kh->srcOneStudentChengji($src); + $khSrc = new \app\kaohao\model\Search; + $stuCj = $khSrc->srcOneStudentChengji($src); // 获取可以参加考试的学科 @@ -139,7 +139,7 @@ class StudentChengji extends BaseModel if($cjcnt > 0) { foreach ($value->ksChengji as $sbj_k => $sbj_val) { - if($src['subject'] == $sbj_val->subject_id) + if($src['subject_id'] == $sbj_val->subject_id) { $xAxis[] = $value->cjKaoshi->title; $series['0']['data'][] = $sbj_val->defenlv; @@ -177,7 +177,7 @@ class StudentChengji extends BaseModel // 用新值替换初始值 $src = array_cover($srcfrom, $src); - $kh = new \app\kaoshi\model\Kaohao; + $kh = new \app\kaohao\model\Kaohao; // 考号信息 $khInfo = $kh->where('id', $src['kaohao_id']) ->with([ diff --git a/app/renshi/view/student_chengji/index.html b/app/renshi/view/student_chengji/index.html index 64034fe4..1c4e56c1 100644 --- a/app/renshi/view/student_chengji/index.html +++ b/app/renshi/view/student_chengji/index.html @@ -24,7 +24,7 @@
- + {php} $category = getCategory(108);{/php} {volist name="category" id="vo"} @@ -55,7 +55,7 @@
- + {/block} {block name="table"}
@@ -92,10 +92,9 @@ endate = d.bfdate + '~' + endate; return endate; }} - ,{field:'zuzhi',title: '组织单位',sort:true, minWidth:100} + ,{field:'zuzhi_id',title: '组织单位',sort:true, minWidth:100} ]]; - var xk = ''; xk = eval(decodeURIComponent(xk)); for(x in xk) @@ -105,7 +104,6 @@ options.cols[0].push({field: 'avg', title: '平均分', minWidth:100,sort: true}); options.cols[0].push({field: 'sum', title: '总分', minWidth:100,sort: true}); - // 提交搜索条件后重载表格 layui.use(['table','cjgl','laydate','element'],function(){ var table = layui.table @@ -169,13 +167,12 @@ cjgl.add('添加单位','/school/create','650','500'); break; case 'download': - cjgl.add('下载成绩','/chengji/bjtj/dwbiaoge/{$list.kaoshi}','650','300'); + cjgl.add('下载成绩','/chengji/bjtj/dwbiaoge/{$list.kaoshi_id}','650','300'); break; }; }); - //监听行工具条 table.on('tool(mytable)', function(obj){ var data = obj.data; //获得当前行数据 @@ -183,13 +180,12 @@ var tr = obj.tr; //获得当前行 tr 的DOM对象 switch(layEvent){ case 'detail':// 查看 - cjgl.add(obj.data.kaoshiTitle + '考试成绩','/kaoshi/kaohao/read/'+obj.data.kaohaoId,'','',true); + cjgl.add(obj.data.kaoshiTitle + '考试成绩','/kaohao/index/read/' + obj.data.kaohao_id,'','',true); break; }; }); - // 监听表单提交 form.on('radio', function(data){ for(x in xk) @@ -213,13 +209,13 @@ // 条形统计图--平均分 - function getDefenlv(sbjid,sbjlieming,sbjtitle){ + function getDefenlv(sbjid, sbjlieming, sbjtitle){ var id = sbjlieming; var url = '/renshi/studentcj/chengjitubiao'; var val = form.val('search'); - val.subject = sbjid; + val.subject_id = sbjid; var title = sbjtitle; - createZhexian(id,url,val,title); + createZhexian(id, url, val, title); } }); @@ -234,7 +230,7 @@ * @param val 图表标题 * @return array 返回类型 */ - function createZhexian(id,url,val,title) + function createZhexian(id, url, val, title) { var myZhexian = echarts.init(document.getElementById(id)); $.post(url,val).done(function (data) { diff --git a/database/seeds/Rule.php b/database/seeds/Rule.php index b2c4c097..6afa155f 100644 --- a/database/seeds/Rule.php +++ b/database/seeds/Rule.php @@ -322,7 +322,7 @@ class Rule extends Seeder ], ['id' => 302040102 ,'title' => '考号删除' - ,'name' => 'kaoshi/kaohao/delete' + ,'name' => 'kaohao/index/delete' ,'paixu' => 2 ,'pid' => 3020401 ], @@ -352,19 +352,19 @@ class Rule extends Seeder ], ['id' => 302040106 ,'title' => '添加单个考号' - ,'name' => 'kaoshi/kaohao/create' + ,'name' => 'kaohao/index/create' ,'paixu' => 7 ,'pid' => 3020401 ], ['id' => 302040107 ,'title' => '保存单个考号' - ,'name' => 'kaoshi/kaohao/save' + ,'name' => 'kaohao/index/save' ,'paixu' => 8 ,'pid' => 3020401 ], ['id' => 302040108 ,'title' => '学生成绩图表' - ,'name' => 'kaoshi/kaohao/read' + ,'name' => 'kaohao/index/read' ,'paixu' => 9 ,'pid' => 3020401 ],