diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..0fb63ab0 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,18 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +indent_style = space +indent_size = 4 +trim_trailing_whitespace = true + +[*.md] +trim_trailing_whitespace = false + +[*.yml] +indent_size = 2 + +[*.{js,html,css}] +indent_size = 2 \ No newline at end of file diff --git a/README.md b/README.md index 5cdbcb57..def36c38 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ - + # 码蚁免费成绩管理系统 -  坦率地讲,在不久的将来,这也许会是辽东半岛上第二好用的成绩统计系统。如果你觉得还可以,还不赶紧 Watch 、 Start 一下。如果觉得不好,何不给个改进意见再离开,反正已经来了,是吧? +  坦率地讲,在不久的将来,这也许会是辽东半岛上第二好用的成绩统计系统。 ![表情包](https://gitee.com/dlbz/shangma/raw/master/public/examples/timg.jpg) @@ -9,28 +9,29 @@   这是一款注重优化成绩采集方法、丰富成绩分析维度的小学成绩统计系统,力争做到符合教师工作习惯、使用方法简单、数据分析多样、分析结果科学,为教师的试卷分析、教育科研提供数据参考。 -  开发者是一名非计算机专业的小学教师,只因工作遇到了兴趣,才有了这个小项目。为了让自己统计成绩工作变得更优雅,才边学边写这个成绩统计项目。信息录入简单,学生、老师的信息可以直接从学籍、人事负责人获取,将获取的数据复制到模板中便可上传。在操作设计中,遵循 Giles Colborne 的简约至上原则,尽量做到三步便可到达要操作的位置。统计维度参考华东师范大学教育学系王孝玲教授著作的《教育统计学》第五版。前端采用X-admin,后端采用ThinkPHP框架开发。 +  开发者是一名非计算机专业的小学教师,只因工作遇到了兴趣,才有了这个小项目。为了让自己统计成绩工作变得更优雅,才边学边写这个成绩统计项目。信息录入与输出简单,支持在单条录入和表格录入、表格输出,尽量让所有信息可管理。在操作设计中,遵循 Giles Colborne 的简约至上原则,尽量做到三步便可到达要操作的位置。统计维度参考华东师范大学教育学系王孝玲教授著作的《教育统计学》第五版。前端采用X-admin,后端采用ThinkPHP框架开发。 -  “情怀”的代言人罗永浩说:“科技的每一次进步,给我们带来的是更好的世界,而不是完美的世界”。因此,我会不断完善系统功能,让统计成绩不再是一份辛苦的工作,让大家变成成绩分析牛人! +  “情怀”的代言人罗永浩说:“科技的每一次进步,给我们带来的是更好的世界,而不是完美的世界”。因此,这个项目会一直走在奔向完美的路上,让统计成绩不再是一份辛苦的工作,让大家变成成绩分析牛人! ## 主要功能: * 设置系统信息、单位信息管理、类别管理 -* 学期、班级、学科 管理 -* 管理员与权限管理 +* 学期、班级、学科管理 +* 管理员、权限、角色管理 * 教师与学生信息管理 * 考试信息设置 +* 设置参加考试学科及各学科的满分、优秀、及格分数线。 * 生成学生的考试号 * 生成学生试卷标签 * 生成学生成绩采集表 -* 使用电子表格录入成绩 -* 使用二维码录入成绩 -* 编辑、删除成绩 -* 查看成绩列表 -* 查看成绩统计结果 +* 在线录入和修改成绩、表格录入成绩 +* 使用扫码枪录入成绩 +* 查看成绩列表、成绩图表 +* 查看成绩统计结果(表格+统计表) +* 查看学生历次成绩(表格+统计表) 登录界面 @@ -106,8 +107,26 @@ ![权限分配](https://gitee.com/dlbz/shangma/raw/master/public/examples/bjchayi.png) +学生历次考试成绩 + +![权限分配](https://gitee.com/dlbz/shangma/raw/master/public/examples/学生成绩.png) + + + +学生历次考试成绩得分率与成绩在班级、学校、全部中排序的大约位置 + +![权限分配](https://gitee.com/dlbz/shangma/raw/master/public/examples/学生成绩图表.png) + + +学生单次考试成绩 + +![权限分配](https://gitee.com/dlbz/shangma/raw/master/public/examples/学生单次考试成绩.png) + + + ## 演示地址 +[http://www.dl-sm.cn](http://www.dl-sm.cn) 或 [http://xiaoshongshu.cn](http://xiaoshongshu.cn) 帐号 test1 密码 123456 @@ -115,14 +134,20 @@ 里面隐藏了两个很实用的功能,如果想了解隐藏功能,请下载。 ## 更新内容 - 修改考试设置,删除参加考试年级、学科两个数据表,增加考试设置表,修改获取参与年级、班级、学科的方法。 - 升级layui到2.5.6 - 重新梳理视图模板逻辑 - 修复已知错误 + 图表增加下载、还原按钮。 + 增加得分率、学生成绩位置。 + 计算四分位方法改为N-1方法,结果与Excel相同。 + 禁止修改考试相关信息的判断条件由结束时间变成状态。 + 增加禁止修改成绩字段。 + 修复错误:禁止筛选中回车刷新页面、添加单条考号错误、分类保护等。 + 修改项目名字为《码蚁》。 + 学生信息查看中增加学生历次成绩查看。 + 增加成绩统计记录。 + 整理权限验证。 更多更新日志(http://www.xiaoshongshu.cn/login/log) ## 升级提示 - v1.3.1升级到v1.3.2版本时,对 cj_chengji 、 cj_tongji_bj 、 cj_tongji_nj 、 cj_tongji_sch 几个做的字段作了调整,具体调整,请参考号 database/migrations 文件下对应的文件,如果已经存在数据的话,建议重新建表并执行结构同步。如果有没数据可以重新建表。 + v1.3.1升级到v1.3.2版本时,对 cj_chengji 、 cj_tongji_bj 、 cj_tongji_nj 、 cj_tongji_sch等 几个表做的字段作了调整,具体调整,请参考号 database/migrations 文件下对应的文件,如果已经存在数据的话,建议重新建表并执行结构同步。如果有没数据可以重新建表。 ## 更详细信息请查阅官方手册 @@ -135,4 +160,4 @@ https://www.kancloud.cn/llblax/abcd/789222 * 增加学生自助查询成绩 ## 求助 -* 一直想给这个项目起个名字,想了几个都不合适,朋友们能给一个好名字的话兄弟会非常感谢! \ No newline at end of file +* 如果您觉得这个项目还可以,请在码云上给一个Star。 diff --git a/app/chengji/controller/Bjtongji.php b/app/chengji/controller/Bjtongji.php index 20814e35..1870f112 100644 --- a/app/chengji/controller/Bjtongji.php +++ b/app/chengji/controller/Bjtongji.php @@ -32,7 +32,6 @@ class Bjtongji extends BaseController $list['kaoshititle'] = $ksinfo->title; $list['dataurl'] = '/chengji/bjtj/data'; - // 模板赋值 $this->view->assign('list',$list); @@ -62,11 +61,11 @@ class Bjtongji extends BaseController $kh = new \app\kaoshi\model\Kaohao; $src['banji']= array_column($kh->cyBanji($src),'id'); } - + // 统计成绩 $btj = new BTJ; $data = $btj->search($src); - + // 获取记录总数 $cnt = count($data); // 截取当前页数据 @@ -138,7 +137,7 @@ class Bjtongji extends BaseController $dataAll = $ntj->search($src); count($dataAll)>0 ? $data['all'] = $dataAll[0] : $data; - + // 获取参考学科 $ks = new \app\kaoshi\model\Kaoshi; $ksinfo = $ks->where('id',$src['kaoshi']) @@ -292,13 +291,23 @@ class Bjtongji extends BaseController // 获取变量 $kaoshi = input('post.kaoshi'); // 判断考试状态 - event('ksstatus',$kaoshi); + event('ksjs',$kaoshi); // 统计成绩 $btj = new BTJ; $data = $btj->tjBanji($kaoshi); - $data == true ? $data=['msg'=>'各班级成绩统计完成','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; + if(true == $data) + { + $data = ['msg' => '各班级成绩统计完成', 'val' => 1]; + $src = [ + 'kaoshi_id' => $kaoshi, + 'category' => 'bjtj', + ]; + event('tjlog', $src); + }else{ + $data = ['msg' => '数据处理错误', 'val' => 0]; + } return json($data); } @@ -311,25 +320,32 @@ class Bjtongji extends BaseController // 获取变量 $kaoshi = input('post.kaoshi'); // 判断考试状态 - event('ksstatus',$kaoshi); + event('ksjs',$kaoshi); // 统计成绩 $btj = new BTJ; $data = $btj->bjOrder($kaoshi); - $data == true ? $data=['msg'=>'学生成绩在班级位置统计完成。','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; + if(true == $data) + { + $data=['msg'=>'学生成绩在班级位置统计完成。','val'=>1]; + $src = [ + 'kaoshi_id' => $kaoshi, + 'category' => 'bjwz', + ]; + event('tjlog', $src); + }else{ + $data=['msg'=>'数据处理错误','val'=>0]; + } return json($data); } - - - // 统计平均分优秀率及格率 public function myAvg($kaoshi) { - + // 获取参数 $src = $this->request ->only([ @@ -386,5 +402,5 @@ class Bjtongji extends BaseController return json($data); } - + } diff --git a/app/chengji/controller/Index.php b/app/chengji/controller/Index.php index 4193ad83..8719f056 100644 --- a/app/chengji/controller/Index.php +++ b/app/chengji/controller/Index.php @@ -16,7 +16,7 @@ class Index extends BaseController // 成绩列表 public function index($kaoshi) { - + // 设置要给模板赋值的信息 $list['webtitle'] = '学生成绩列表'; @@ -69,7 +69,7 @@ class Index extends BaseController $limit_start = $src['page'] * $src['limit'] - $src['limit']; $limit_length = $src['limit']; $data = array_slice($data,$limit_start,$limit_length); - + // 重组返回内容 $data = [ 'code'=> 0 , // ajax请求次数,作为标识符 @@ -121,7 +121,7 @@ class Index extends BaseController $subject = $src['subject']; // 判断考试状态 - event('ksstatus',$src['kaoshi']); + event('kslu',$src['kaoshi']); // 获取要删除成绩的考号 $kaohao = new \app\kaoshi\model\Kaohao; @@ -140,7 +140,7 @@ class Index extends BaseController }else{ $this->error($msg = '删除失败', $url = '/chengji/index/deletecjs/'.$src['kaoshi'], $wait = 3); } - + // 根据更新结果设置返回提示信息 $data ? $data=['msg'=>'成绩删除成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; @@ -167,7 +167,8 @@ class Index extends BaseController $kaoshiid = Kaohao:: where('id',$khid)->value('Kaoshi'); // 判断考试状态 - event('ksstatus',$kaoshiid); + event('kslu',$kaoshiid); + $data = Chengji::destroy($id); @@ -180,28 +181,27 @@ class Index extends BaseController + // 设置考试状态 + public function setStatus() + { + // 获取id变量 + $id = request()->post('id'); + $value = request()->post('value'); - // // 设置成绩状态 - // public function setStatus() - // { - - // // 获取id变量 - // $id = request()->post('id'); - // $value = request()->post('value'); - - // // 获取班级信息 - // $data = Chengji::where('id',$id)->update(['status'=>$value]); - - // // 根据更新结果设置返回提示信息 - // $data ? $data=['msg'=>'状态设置成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // // 返回信息 - // return json($data); - // } + $khid = Chengji::where('id',$id)->value('kaohao_id'); + $kaoshiid = Kaohao:: where('id',$khid)->value('Kaoshi'); + event('kslu',$kaoshiid); + // 获取考试信息 + $data = Chengji::where('id',$id)->update(['status'=>$value]); + // 根据更新结果设置返回提示信息 + $data ? $data=['msg'=>'状态设置成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; + // 返回信息 + return json($data); + } @@ -235,7 +235,7 @@ class Index extends BaseController - //生成学生表格 + //生成学生成绩表格 public function dwchengjixlsx() { // 获取参数 @@ -324,7 +324,7 @@ class Index extends BaseController $sheet->setCellValue($colname[$i].'3', $value['title']); $i++; } - + // 循环写出成绩及个人信息 $i = 4; @@ -371,7 +371,7 @@ class Index extends BaseController $tj = new \app\chengji\model\Tongji; // $nianji = array(); // $chengjiinfo = $kh->srcChengji($src); - $temp = $tj->tongjiSubject($chengjiinfo,$subject); + $temp = $tj->tongjiSubject($chengjiinfo,$subject); isset($colcnt) ? $colcnt = $colcnt+5 : $colcnt = 12; $colBiankuang = $colcnt; @@ -532,8 +532,8 @@ class Index extends BaseController ->setDescription("该表格由".session('username').session('id')."于".$thistime."在尚码成绩管理系统中下载,只作为内部交流材料,不允许外泄。") //描述 ->setKeywords("尚码 成绩管理") //关键字 ->setCategory("成绩管理"); //分类 - - + + $row = 1; # 定义从 $row 行开始写入数据 $rows = count($subject); # 定义学生信息列要合并的行数 @@ -687,5 +687,5 @@ class Index extends BaseController return json($data); } - + } diff --git a/app/chengji/controller/Luru.php b/app/chengji/controller/Luru.php index e88000e8..5864f373 100644 --- a/app/chengji/controller/Luru.php +++ b/app/chengji/controller/Luru.php @@ -16,10 +16,12 @@ class Luru extends BaseController // 成绩列表 public function index() { - + // 设置要给模板赋值的信息 $list['webtitle'] = '已录列表'; $list['dataurl'] = 'luru/data'; + $list['status'] = '/chengji/index/status'; + // 获取学科列表 $sbj = new \app\teach\model\Subject; @@ -64,7 +66,7 @@ class Luru extends BaseController $limit_start = $src['page'] * $src['limit'] - $src['limit']; $limit_length = $src['limit']; $data = array_slice($data,$limit_start,$limit_length); - + // 重组返回内容 $data = [ 'code'=> 0 , // ajax请求次数,作为标识符 @@ -98,15 +100,15 @@ class Luru extends BaseController // 保存使用二维码录入的成绩 public function malusave() - { + { // 获取表单数据 $list = $this->request->only(['kaohao_id','subject_id','nianji','defen'],'post'); - + $kaoshiid = Kaohao::where('id',$list['kaohao_id'])->value('kaoshi'); // 判断考试状态 - event('ksstatus',$kaoshiid); - + event('kslu',$kaoshiid); + // // 根据考号获取学生年在年级及考试ID // 获取本学科满分 $ksset = new \app\kaoshi\model\KaoshiSet; @@ -136,7 +138,7 @@ class Luru extends BaseController // 如果存在成绩则更新,不存在则添加 if($cjone) { - // 判断记录是否被删除 + // 判断记录是否被删除 if($cjone->delete_time > 0) { $cjone->restore(); @@ -180,11 +182,10 @@ class Luru extends BaseController ,'post'); $list['kaohao_id'] = $id; - // 判断考试结束时间是否已过 $kaoshiid = Kaohao::where('id',$list['kaohao_id'])->value('kaoshi'); // 判断考试状态 - event('ksstatus',$kaoshiid); + event('kslu',$kaoshiid); // 获取学科id $subject = new \app\teach\model\Subject; @@ -212,17 +213,17 @@ class Luru extends BaseController - // 更新成绩 + // 更新成绩 $cjone = Chengji::withTrashed() ->where('kaohao_id',$list['kaohao_id']) ->where('subject_id',$subject_id) ->find(); - + // 如果存在成绩则更新,不存在则添加 if($cjone) { - // 判断记录是否被删除 + // 判断记录是否被删除 if($cjone->delete_time > 1) { $cjone->restore(); @@ -257,14 +258,14 @@ class Luru extends BaseController } - + // 根据考号获取学生信息 public function read() { // 获取表单数据 $val = input('post.val'); // 实例化系统设置类 - $md5 = new \app\system\controller\Encrypt; + $md5 = new \app\system\controller\Encrypt; $val = $md5->decrypt($val,'dlbz'); $list = explode('|',$val); @@ -316,7 +317,7 @@ class Luru extends BaseController // 获取参考年级 $list['data'] = $ks::order(['id'=>'desc']) ->field('id,title') - ->where('enddate','>=',time()) + ->where('luru',1) ->select() ->toArray(); @@ -335,9 +336,9 @@ class Luru extends BaseController return $this->view->fetch(); } - - // 保存表格批量上传的成绩 + + // 保存表格批量上传的成绩 public function saveAll() { // set_time_limit(0); @@ -359,7 +360,7 @@ class Luru extends BaseController return json($data); } // 判断考试状态 - event('ksstatus',$kaoshiid); + event('kslu',$kaoshiid); // 删除空单元格得到学科列名数组 array_splice($cjinfo[1],0,4); @@ -431,7 +432,8 @@ class Luru extends BaseController 'kaohao_id'=>$val[1], 'subject_id'=>$value['id'], 'user_id'=>$user_id, - 'defen'=>$defen/$manfen*100, + 'defen'=>$defen, + 'defenlv'=>$defen/$manfen*100, ]; Chengji::create($data); } @@ -467,10 +469,10 @@ class Luru extends BaseController - - + + } diff --git a/app/chengji/controller/Njtongji.php b/app/chengji/controller/Njtongji.php index a9a6915b..601c3c7f 100644 --- a/app/chengji/controller/Njtongji.php +++ b/app/chengji/controller/Njtongji.php @@ -61,7 +61,7 @@ class Njtongji extends BaseController $schtj = new \app\chengji\model\TongjiSch; $dataAll = $schtj->search($src); count($dataAll)>0 ? $data[] = $dataAll['all'] : $data; - + // 获取记录数 $cnt = count($data); // 截取当前页数据 @@ -126,14 +126,14 @@ class Njtongji extends BaseController $dataAll = $schtj->search($src); count($dataAll)>0 ? $data['all'] = $dataAll['all'] : $data; - + // 获取参考学科 $ks = new \app\kaoshi\model\Kaoshi; $ksinfo = $ks->where('id',$src['kaoshi']) ->field('id,title,bfdate') ->find(); $ksset = new \app\kaoshi\model\KaoshiSet; - $xk = $ksset->srcSubject($src['kaoshi'],'',$src['ruxuenian']); + $xk = $ksset->srcSubject($src['kaoshi'],'',$src['ruxuenian']); // 获取考试年级名称 $njlist = nianjiList($ksinfo->getData('bfdate')); @@ -263,14 +263,24 @@ class Njtongji extends BaseController public function tongji() { // 获取变量 - $kaoshi = input('post.kaoshi'); + $kaoshi = input('post.kaoshi'); // 判断考试状态 - event('ksstatus',$kaoshi); + event('ksjs',$kaoshi); // 统计成绩 $ntj = new NTJ; $data = $ntj->tjNianji($kaoshi); - $data == true ? $data=['msg'=>'各学校年级统计完成','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; + if(true == $data) + { + $data=['msg'=>'各学校年级成绩统计完成','val'=>1]; + $src = [ + 'kaoshi_id' => $kaoshi, + 'category' => 'njtj', + ]; + event('tjlog', $src); + }else{ + $data=['msg'=>'数据处理错误','val'=>0]; + } return json($data); } @@ -282,13 +292,23 @@ class Njtongji extends BaseController // 获取变量 $kaoshi = input('post.kaoshi'); // 判断考试状态 - event('ksstatus',$kaoshi); + event('ksjs',$kaoshi); // 统计成绩 $ntj = new NTJ; $data = $ntj->njOrder($kaoshi); - $data == true ? $data=['msg'=>'学生成绩在班级位置统计完成。','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; + if(true == $data) + { + $data=['msg'=>'学生成绩在学校年级位置统计完成。','val'=>1]; + $src = [ + 'kaoshi_id' => $kaoshi, + 'category' => 'njwz', + ]; + event('tjlog', $src); + }else{ + $data=['msg'=>'数据处理错误','val'=>0]; + } return json($data); } @@ -297,7 +317,7 @@ class Njtongji extends BaseController // 统计平均分优秀率及格率 public function myAvg($kaoshi) { - + // 获取参数 $src = $this->request ->only([ @@ -339,6 +359,6 @@ class Njtongji extends BaseController return json($data); } - + } diff --git a/app/chengji/controller/Schtongji.php b/app/chengji/controller/Schtongji.php index 478ccf3f..88edb09c 100644 --- a/app/chengji/controller/Schtongji.php +++ b/app/chengji/controller/Schtongji.php @@ -12,14 +12,24 @@ class Schtongji public function tongji() { // 获取变量 - $kaoshi = input('post.kaoshi'); + $kaoshi = input('post.kaoshi'); // 判断考试状态 - event('ksstatus',$kaoshi); + event('ksjs',$kaoshi); // 统计成绩 $schtj = new SCHTJ; $data = $schtj->tjSchool($kaoshi); - $data == true ? $data=['msg'=>'全区年级统计完成','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; + if(true == $data) + { + $data=['msg'=>'全区年级统计完成','val'=>1]; + $src = [ + 'kaoshi_id' => $kaoshi, + 'category' => 'schtj', + ]; + event('tjlog', $src); + }else{ + $data=['msg'=>'数据处理错误','val'=>0]; + } return json($data); } @@ -31,13 +41,23 @@ class Schtongji // 获取变量 $kaoshi = input('post.kaoshi'); // 判断考试状态 - event('ksstatus',$kaoshi); + event('ksjs',$kaoshi); // 统计成绩 $schtj = new SCHTJ; $data = $schtj->schOrder($kaoshi); - $data == true ? $data=['msg'=>'学生成绩在班级位置统计完成。','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; + if(true == $data) + { + $data=['msg'=>'学生成绩在全区位置统计完成','val'=>1]; + $src = [ + 'kaoshi_id' => $kaoshi, + 'category' => 'schwz', + ]; + event('tjlog', $src); + }else{ + $data=['msg'=>'数据处理错误','val'=>0]; + } return json($data); } diff --git a/app/chengji/controller/Tongji.php b/app/chengji/controller/Tongji.php index f718cd66..3cdd47f8 100644 --- a/app/chengji/controller/Tongji.php +++ b/app/chengji/controller/Tongji.php @@ -24,7 +24,7 @@ class Tongji extends BaseController $list['nianji'] = $ksset->srcNianji($kaoshi); $list['subject'] = $ksset->srcSubject($kaoshi); - + // 获取参与班级 if(count($list['nianji'])>0) { @@ -61,13 +61,13 @@ class Tongji extends BaseController 'ruxuenian'=>'', 'school'=>array(), 'banji'=>array(), - ],'POST'); + ],'POST'); // 统计成绩 $btj = new \app\chengji\model\TongjiBj; $data = $btj->tjBanjiCnt($src); - + // 获取记录总数 $cnt = count($data); // 截取当前页数据 @@ -85,34 +85,47 @@ class Tongji extends BaseController } - public function newJieguo() + public function newJieguo($kaoshi_id) { - // 获取成绩最后修改时间 - $cj = new \app\chengji\model\Chengji; - $cj = $cj->order(['update_time'=>'desc'])->find(); - $cj = $cj->getData('update_time'); + // 获取考试信息 + $ks = new \app\kaoshi\model\Kaoshi; + $ksinfo = $ks->where('id',$kaoshi_id) + ->field('id,title') + ->find(); - // 分别获取班级、年级、学校统计结果更新时间 - $bj = new \app\chengji\model\TongjiBj; - $bj = $bj->order(['update_time'=>'desc'])->find(); - $bj = $bj->getData('update_time'); + // 设置要给模板赋值的信息 + $list['webtitle'] = '最新统计结果状态'; + $list['kaoshi'] = $kaoshi_id; + $list['kaoshititle'] = $ksinfo->title; + $list['dataurl'] = '/chengji/tongji/jgdata'; - $nj = new \app\chengji\model\TongjiNj; - $nj = $nj->order(['update_time'=>'desc'])->find(); - $nj = $nj->getData('update_time'); - $sch = new \app\chengji\model\TongjiSch; - $sch = $sch->order(['update_time'=>'desc'])->find(); - $sch = $sch->getData('update_time'); + // 模板赋值 + $this->view->assign('list',$list); - if($cj>=$bj || $cj>=$nj || $cj>=$sch) - { - $data=['msg'=>'不是最新结果,重算一下!','val'=>0]; - }else{ - $data=['msg'=>'是最新结果,不用算啦~','val'=>1]; - } + // 渲染模板 + return $this->view->fetch(); + } + + + public function ajaxNewJieguo() + { + // 获取参数 + $src = $this->request + ->only([ + 'kaoshi'=>'', + ],'POST'); + + // 实例化考号 + $kh = new \app\kaoshi\model\Kaohao; + $lastcj = $kh->lastUpdateTime($src['kaoshi']); + $logLastTime = $lastcj->getData('update_time'); + + $log = new \app\kaoshi\model\TongjiLog; + + + halt($logLastTime); - return json($data); } diff --git a/app/chengji/model/Chengji.php b/app/chengji/model/Chengji.php index b6320729..85fa2f51 100644 --- a/app/chengji/model/Chengji.php +++ b/app/chengji/model/Chengji.php @@ -8,7 +8,7 @@ use app\common\model\Base; class Chengji extends Base { - + // 学科关联 public function subjectName() @@ -35,7 +35,7 @@ class Chengji extends Base { // 初始化参数 $src = array( - 'field'=>'banji', + 'field'=>'update_time', 'order'=>'desc', 'kaoshi'=>'0', 'banji'=>array(), @@ -46,15 +46,15 @@ class Chengji extends Base // 用新值替换初始值 $src = array_cover( $srcfrom , $src ) ; - $banji = strToarray($src['banji']); - $subject_id = $src['subject_id']; - $kaoshi = $src['kaoshi']; - $searchval = $src['searchval']; + $src['banji'] = strToarray($src['banji']); + // $subject_id = $src['subject_id']; + // $kaoshi = $src['kaoshi']; + // $searchval = $src['searchval']; $stu = new \app\renshi\model\Student; $stuid = $stu - ->when(strlen($searchval)>0,function($query)use($searchval){ - $query->where('xingming','like','%'.$searchval.'%') + ->when(strlen($src['searchval'])>0,function($query)use($src){ + $query->where('xingming','like','%'.$src['searchval'].'%') ->field('id'); }) ->column('id'); @@ -62,9 +62,10 @@ class Chengji extends Base $nianji = nianjiList(); $cjList = $this + ->whereMonth('update_time') ->where('user_id',$src['user_id']) - ->when(is_numeric($subject_id),function($query)use($subject_id){ - $query->where('subject_id',$subject_id); + ->when(is_numeric($src['subject_id']),function($query)use($src){ + $query->where('subject_id',$src['subject_id']); }) ->when(count($stuid)>0,function($query)use($stuid){ $query->where('kaohao_id','in',function($q)use($stuid){ @@ -78,7 +79,7 @@ class Chengji extends Base 'subjectName'=>function($query){ $query->field('id,title,lieming'); } - ,'cjKaohao'=>function($query)use($searchval){ + ,'cjKaohao'=>function($query){ $query->field('id,kaoshi,school,ruxuenian,nianji,banji,paixu,student') ->append(['banjiTitle']) ->with([ @@ -94,8 +95,6 @@ class Chengji extends Base ]); } ]) - ->whereTime('update_time','-240 hours') - ->limit(200) ->select(); // 重新整理成绩 @@ -167,15 +166,15 @@ class Chengji extends Base - /** + /** * 把给定的成绩进行排序 - * @access public + * @access public * @param array $cj 要计算的一维数组成绩 * @param array $col 0=>paixu,1=>weizhi * @param int $xm 项目 0=>学科得分,1=>平均分,2=>总分 * @param int $jibie 级别 1=>班级,2=>年级,3=>区 * @return array $result 返回成绩排序结果 - */ + */ public function saveOrder($cj,$col) { $cnt = count($cj); # 获取元素数量 @@ -195,7 +194,7 @@ class Chengji extends Base { $data[$key][$col[0]] = $data[$key-1][$col[0]]; } - $data[$key][$col[1]] = 1 - ($data[$key][$col[0]]-1)/$cnt; + $data[$key][$col[1]] = ($data[$key][$col[0]]-1)/$cnt; $data[$key][$col[1]] = round($data[$key][$col[1]] * 100 , 2) ; } @@ -204,87 +203,4 @@ class Chengji extends Base return true; } - - - /** - * 学生个人成绩列表 - * @access public - * @param array $cj 要计算的一维数组成绩 - * @param array $col 0=>paixu,1=>weizhi - * @param int $xm 项目 0=>学科得分,1=>平均分,2=>总分 - * @param int $jibie 级别 1=>班级,2=>年级,3=>区 - * @return array $result 返回成绩排序结果 - */ - public function oneChengji($srcfrom) - { - // 初始化参数 - $src = array( - 'student'=>'', - 'kaoshi'=>array(), - ); - - // 用新值替换初始值 - $src = array_cover( $srcfrom , $src ); - - $kh = new \app\kaoshi\model\Kaohao; - $stuCj = $kh->srcOneStudentChengji($src); - - - // 获取可以参加考试的学科 - $sbj = new \app\teach\model\Subject; - $sbjList = $sbj->where('kaoshi',1) - ->where('status',1) - ->field('id,lieming') - ->column('lieming','id'); - - // 整理数据 - $data = array(); - foreach ($stuCj as $key => $value) { - $data[$key] = [ - 'kaoshiId'=>$value->kaoshi, - 'kaoshiTitle'=>$value->cjKaoshi->title, - 'kaohaoId'=>$value->id, - 'banjiTitle'=>$value->banjiTitle, - 'zuzhi'=>$value->cjKaoshi->ksZuzhi->jiancheng, - 'category'=>$value->cjKaoshi->ksCategory->title, - 'bfdate'=>$value->cjKaoshi->bfdate, - 'enddate'=>$value->cjKaoshi->enddate, - ]; - - $cjcnt = count($value->ksChengji); - - if($cjcnt > 0) - { - $sbj = $value->ksChengji->column('subject_id'); - foreach ($sbjList as $sbj_k => $sbj_val) { - // 通过学科ID获取这个学科成绩对应的成绩下标。 - // 这个地方需要再核实。 - $xb = array_search($sbj_k, $sbj); # ksChengji下标 - if($xb === false) - { - $data[$key][$sbj_val] = ''; - }else{ - $data[$key][$sbj_val] = $value->ksChengji[$xb]->defen; - } - } - $defen = array_column($value->ksChengji->toArray(), 'defen'); - $sum = array_sum($defen ); - $avg = $sum / $cjcnt; - $data[$key]['sum'] = $sum; - $data[$key]['avg'] = round($avg,2); - }else{ - foreach ($sbjList as $sbj_k => $sbj_val) { - $data[$key][$sbj_val] = ''; - } - $data[$key]['sum'] = ''; - $data[$key]['avg'] = ''; - } - } - - return $data; - } - - - - } diff --git a/app/chengji/model/TongjiBj.php b/app/chengji/model/TongjiBj.php index 32dbb845..71a9a8a5 100644 --- a/app/chengji/model/TongjiBj.php +++ b/app/chengji/model/TongjiBj.php @@ -13,10 +13,10 @@ use app\kaoshi\model\Kaohao; */ class TongjiBj extends Base { - /** + /** * 统计指定个年级的各班级成绩 * 统计项目参考tongji方法 - * @access public + * @access public * @param number $kaoshi 考试id * @param number $ruxuenian 入学年 * @return array 返回类型 @@ -32,7 +32,6 @@ class TongjiBj extends Base // 初始化统计结果 $data = array(); - // 循环年级 foreach ($nianji as $njkey => $value) { // 获取参加考试班级 @@ -107,10 +106,10 @@ class TongjiBj extends Base - /** + /** * 统计指定个年级的各班级成绩 * 统计项目参考tongji方法 - * @access public + * @access public * @param number $kaoshi 考试id * @param number $ruxuenian 入学年 * @return array 返回类型 @@ -118,7 +117,7 @@ class TongjiBj extends Base public function tjBanjiCnt($srcfrom) { - // 初始化参数 + // 初始化参数 $src = array( 'page'=>'1', 'limit'=>'10', @@ -178,10 +177,10 @@ class TongjiBj extends Base - /** + /** * 班级成绩统计结果查询 * 从数据库中取出数据 - * @access public + * @access public * @param number $kaoshi 考试id * @param number $ruxuenian 入学年 * @return array 返回类型 @@ -189,7 +188,7 @@ class TongjiBj extends Base public function search($srcfrom) { - // 初始化参数 + // 初始化参数 $src = array( 'kaoshi'=>'', 'banji'=>array(), @@ -241,7 +240,7 @@ class TongjiBj extends Base // 重组数据 foreach ($tongjiJg as $key => $value) { - + $data[$value->banji_id]=[ 'id'=>$value->id, 'school'=>$value->bjBanji->glSchool->jiancheng, @@ -274,7 +273,7 @@ class TongjiBj extends Base 'jige'=>$val->jige, ]; } - + } } @@ -322,7 +321,7 @@ class TongjiBj extends Base } } return true; - } + } @@ -368,5 +367,5 @@ class TongjiBj extends Base } - + } diff --git a/app/chengji/model/TongjiNj.php b/app/chengji/model/TongjiNj.php index 2cb3bd07..f4dbe258 100644 --- a/app/chengji/model/TongjiNj.php +++ b/app/chengji/model/TongjiNj.php @@ -10,10 +10,10 @@ use app\chengji\model\Tongji as TJ; */ class TongjiNj extends Base { - /** + /** * 统计各学校的指定个年级的成绩 * 统计项目参考tongji方法 - * @access public + * @access public * @param number $kaoshi 考试id * @param number $ruxuenian 入学年 * @return array 返回类型 @@ -108,14 +108,14 @@ class TongjiNj extends Base - - /** + + /** * 年级成绩统计结果查询 * 从数据库中取出数据 - * @access public + * @access public * @param number $kaoshi 考试id * @param number $ruxuenian 入学年 * @return array 返回类型 @@ -123,7 +123,7 @@ class TongjiNj extends Base public function search($srcfrom) { - // 初始化参数 + // 初始化参数 $src = array( 'kaoshi'=>'', 'ruxuenian'=>array(), @@ -212,7 +212,7 @@ class TongjiNj extends Base 'jige'=>$val->jige, ]; } - + } } @@ -241,7 +241,7 @@ class TongjiNj extends Base foreach ($nianji as $njkey => $value) { // 获取参加考试班级 $src['ruxuenian'] = $value['nianji']; - + $school = $kh->cySchool($src); $subject = $ksset->srcSubject($kaoshi,'',$value['nianji']); @@ -265,7 +265,7 @@ class TongjiNj extends Base } return true; - } + } // 考试关联 diff --git a/app/chengji/model/TongjiSch.php b/app/chengji/model/TongjiSch.php index da7b71f2..3dc58d60 100644 --- a/app/chengji/model/TongjiSch.php +++ b/app/chengji/model/TongjiSch.php @@ -10,10 +10,10 @@ use app\chengji\model\Tongji as TJ; */ class TongjiSch extends Base { - /** + /** * 统计各学校的指定个年级的成绩 * 统计项目参考tongji方法 - * @access public + * @access public * @param number $kaoshi 考试id * @param number $ruxuenian 入学年 * @return array 返回类型 @@ -27,7 +27,7 @@ class TongjiSch extends Base // 查询要统计的年级 $ksset = new \app\kaoshi\model\KaoshiSet; $njList = $ksset->srcNianji($kaoshi); - + // 实例化学生成绩统计类 $tj = new TJ; foreach ($njList as $k => $nianji) { @@ -92,15 +92,15 @@ class TongjiSch extends Base } } - + return true; } - /** + /** * 年级成绩统计结果查询 * 从数据库中取出数据 - * @access public + * @access public * @param number $kaoshi 考试id * @param number $ruxuenian 入学年 * @return array 返回类型 @@ -108,7 +108,7 @@ class TongjiSch extends Base public function search($srcfrom) { - // 初始化参数 + // 初始化参数 $src = array( 'kaoshi'=>'', 'ruxuenian'=>'', @@ -166,7 +166,7 @@ class TongjiSch extends Base 'jige'=>$val->jige, ]; } - + } } @@ -211,7 +211,7 @@ class TongjiSch extends Base } return true; - } + } diff --git a/app/chengji/route/chengji.php b/app/chengji/route/chengji.php index 0b6baf56..c82ddeca 100644 --- a/app/chengji/route/chengji.php +++ b/app/chengji/route/chengji.php @@ -24,6 +24,7 @@ Route::group('index', function () { Route::rule('dwxlsx','Index/dwchengjixlsx','post'); # 成绩删除 Route::rule('dwchengjitiao/','Index/dwChengjitiao','get'); # 成绩删除 Route::rule('dwcjtiaoxlsx','Index/dwchengjitiaoxlsx','post'); # 成绩删除 + Route::rule('status','Index/setStatus','post'); # 删除信息 }); @@ -31,7 +32,6 @@ Route::group('index', function () { Route::group('tongji', function () { Route::rule('yilucnt/','Tongji/yiluCnt'); # 更新信息 Route::rule('data','Tongji/ajaxData','post'); # 扫码界面 - Route::rule('newjieguo','Tongji/newJieguo','post'); }); diff --git a/app/chengji/view/bjtongji/biaoge.html b/app/chengji/view/bjtongji/biaoge.html index 984d5909..2e82c24a 100644 --- a/app/chengji/view/bjtongji/biaoge.html +++ b/app/chengji/view/bjtongji/biaoge.html @@ -1,7 +1,7 @@ {extend name=".././view/list.html" /} {block name="jsset"} - {load href="__STATIC__/echarts/echarts.js" /} +{load href="__STATIC__/echarts/echarts.js" /} {/block} {block name="nav"} @@ -26,9 +26,9 @@
{volist name="$list.nianji" id="vo"} - + {/volist}
@@ -40,7 +40,7 @@ {/block} {block name="table"} -
+
{/block} {block name="echart"} @@ -49,15 +49,15 @@
- + {/block} {block name="myjs"} - - -{/block} \ No newline at end of file + + {/block} diff --git a/app/chengji/view/index/index.html b/app/chengji/view/index/index.html index 60d63f29..a18e0d50 100644 --- a/app/chengji/view/index/index.html +++ b/app/chengji/view/index/index.html @@ -12,7 +12,7 @@
{/block} {block name="search"} - +
@@ -75,6 +75,7 @@ @@ -148,6 +149,9 @@ switch(layEvent){ case 'detail':// 查看 cjgl.add(obj.data.student+' 成绩录入信息','/chengji/index/readcjadd/'+obj.data.id,'','',true); + break; + case 'chengji':// 查看 + cjgl.add(obj.data.student+' 成绩图表','/kaoshi/kaohao/read/'+obj.data.id,'','',true); break; case 'del':// 删除 cjgl.del(obj,"/kaoshi/kaohao/delete"); @@ -162,7 +166,7 @@ ,colname = obj.field ,rowdata = obj.data; - // 修改服务器数据 + // 修改服务器数据 $.ajax({ url:"/chengji/luru/update/"+rowdata.id, type:'PUT', @@ -195,10 +199,10 @@ // 获取参数 var formval = form.val('search'); cjgl.createCheckbox('banji',formval,'/kaoshi/index/cybanji','banji','banTitle'); - } + } }); -{/block} \ No newline at end of file +{/block} diff --git a/app/chengji/view/luru/biaolu.html b/app/chengji/view/luru/biaolu.html index 83ec1e0a..c75314ce 100644 --- a/app/chengji/view/luru/biaolu.html +++ b/app/chengji/view/luru/biaolu.html @@ -11,7 +11,7 @@
- +
@@ -36,7 +36,6 @@
@@ -105,12 +104,12 @@
- -
- - - +
+ + + + {/block} {block name="myjs"} diff --git a/app/chengji/view/luru/index.html b/app/chengji/view/luru/index.html index 75b66754..308f50a8 100644 --- a/app/chengji/view/luru/index.html +++ b/app/chengji/view/luru/index.html @@ -35,11 +35,11 @@ {block name="myjs"} -{/block} \ No newline at end of file +{/block} diff --git a/app/chengji/view/njtongji/biaoge.html b/app/chengji/view/njtongji/biaoge.html index 4475e521..04ab830d 100644 --- a/app/chengji/view/njtongji/biaoge.html +++ b/app/chengji/view/njtongji/biaoge.html @@ -17,7 +17,7 @@
{foreach $list.nianji as $key=>$vo} - {/foreach}
@@ -40,9 +40,9 @@ -{/block} \ No newline at end of file +{/block} diff --git a/app/event.php b/app/event.php index fa40e005..f7587a67 100644 --- a/app/event.php +++ b/app/event.php @@ -2,7 +2,7 @@ // 事件定义文件 return [ 'bind' => [ - 'kaoshistatus'=>'ksstatus', + 'myevent'=>'app\event\MyEvent', ], 'listen' => [ @@ -11,8 +11,14 @@ return [ 'HttpEnd' => [], 'LogLevel' => [], 'LogWrite' => [], - 'ksstatus' => [ - 'app\listener\KaoshiStatus' + 'kslu' => [ + '\app\listener\KaoshiLuru' + ], + 'tjlog' => [ + '\app\listener\TongjiLog' + ], + 'ksjs' => [ + '\app\listener\KaoshiJieShu' ], ], 'subscribe' => [ diff --git a/app/event/KaoshiStatus.php b/app/event/KaoshiStatus.php deleted file mode 100644 index fd59b20d..00000000 --- a/app/event/KaoshiStatus.php +++ /dev/null @@ -1,25 +0,0 @@ -kaoshiInfo($kaoshiid); - if($ksinfo->status == 0) - { - return $this->error('考试状态为禁用,不允许操作!','/login/err'); - } - return $ksinfo; - } - -} diff --git a/app/event/MyEvent.php b/app/event/MyEvent.php new file mode 100644 index 00000000..bcdc691c --- /dev/null +++ b/app/event/MyEvent.php @@ -0,0 +1,54 @@ +kaoshiInfo($kaoshi_id); + return $ksinfo; + } + + + // 添加考试统计日志 + public function addTongjiLog($kaoshi_id, $category) + { + // 添加统计日志 + $tjLog = new TongjiLog; + $log = $tjLog::withTrashed() + ->where('kaoshi_id', $kaoshi_id) + ->where('category', $category) + ->find(); + + if(true == $log) + { + if($log->delete_time > 0) + { + $log->restore(); + } + $log->update_time = time(); + $log->user_id = session('userid'); + $data = $log->save(); + }else{ + $data = $tjLog->save([ + 'kaoshi_id' => $kaoshi_id, + 'category' => $category, + 'user_id' => session('userid'), + ]); + } + + $data ? $data=['msg'=>'更新成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; + + return $data; + } + +} diff --git a/app/index/view/index/welcome.html b/app/index/view/index/welcome.html index 0b45ef38..dbea82fa 100644 --- a/app/index/view/index/welcome.html +++ b/app/index/view/index/welcome.html @@ -95,17 +95,10 @@
@@ -120,7 +113,6 @@ {$list.version} 升级日志 - 服务器地址 {$list.server.SERVER_ADDR} @@ -194,4 +186,4 @@ }; - \ No newline at end of file + diff --git a/app/kaoshi/controller/Index.php b/app/kaoshi/controller/Index.php index ad0c68c9..51816edd 100644 --- a/app/kaoshi/controller/Index.php +++ b/app/kaoshi/controller/Index.php @@ -20,6 +20,8 @@ class Index extends BaseController // 设置要给模板赋值的信息 $list['webtitle'] = '考试列表'; $list['dataurl'] = 'index/data'; + $list['status'] = '/kaoshi/index/status'; + $list['luru'] = '/kaoshi/index/luru'; // 模板赋值 $this->view->assign('list',$list); @@ -57,7 +59,7 @@ class Index extends BaseController $limit_start = $src['page'] * $src['limit'] - $src['limit']; $limit_length = $src['limit']; $data = $data->slice($limit_start,$limit_length); - + // 重组返回内容 $data = [ 'code'=> 0 , // ajax请求次数,作为标识符 @@ -90,12 +92,12 @@ class Index extends BaseController return $this->view->fetch('create'); } - + // 保存信息 public function save() { - + // 实例化验证模型 $validate = new \app\kaoshi\validate\Kaoshi; @@ -113,7 +115,7 @@ class Index extends BaseController } - // 保存数据 + // 保存数据 $ks = new KS(); $ksdata = $ks->create($list); @@ -126,14 +128,6 @@ class Index extends BaseController return json($data); } - // - public function read($id) - { - // - } - - - // 修改考试信息 public function edit($id) @@ -168,19 +162,19 @@ class Index extends BaseController // 更新考试信息 public function update($id) { - event('ksstatus',$id); + event('kslu',$id); $validate = new \app\kaoshi\validate\Kaoshi; // 获取表单数据 $list = request()->only(['title','xueqi','category','bfdate','enddate','zuzhi'],'post'); - + // 验证表单数据 $result = $validate->check($list); $msg = $validate->getError(); - + // 如果验证不通过则停止保存 if(!$result){ @@ -201,143 +195,6 @@ class Index extends BaseController } - - - - // 设置考试信息 - public function kaoshiSet($id) - { - // 获取考试信息 - $data = KS::where('id',$id) - ->with([ - 'ksSubject'=>function($query){ - $query->with([ - 'subjectName'=>function($q){ - $q->field('id,jiancheng'); - } - ]); - } - ,'ksNianji' - ]) - ->field('id') - ->find(); - - // 重新整理年级和学科 - $subject=array(); - $subjectid=array(); - foreach ($data['ks_subject'] as $key => $value) { - $subjectid[] = $value['subjectid']; - $subject[$value->lieming]['manfen'] = $value['manfen']; - $subject[$value->lieming]['youxiu'] = $value['youxiu']; - $subject[$value->lieming]['jige'] = $value['jige']; - } - - $nianji = array(); - foreach ($data['ks_nianji'] as $key => $value) { - $nianji[] = $value['nianji']; - } - - $list['data']['ks_subjectid'] = implode(',' , $subjectid); - $list['data']['ks_nianjiid'] = implode(',' , $nianji); - $list['data']['ks_subject'] = $subject; - - - // 设置页面标题 - $list['set'] = array( - 'webtitle'=>'设置考试', - 'butname'=>'设置', - 'formpost'=>'PUT', - 'url'=>'/kaoshi/index/updateset/'.$id, - 'kaoshi'=>$id, - ); - - // 模板赋值 - $this->view->assign('list',$list); - // 渲染 - return $this->view->fetch(); - - } - - - - - - // // 更新考试信息 - // public function updateSet($id) - // { - - // $validate = new \app\kaoshi\validate\Kaoshiset; - - // // 获取表单数据 - // $list = request()->only(['nianji','subject','manfen','youxiu','jige','lieming','nianjiname'],'post'); - - - // // 验证表单数据 - // $result = $validate->check($list); - // $msg = $validate->getError(); - - - // // 如果验证不通过则停止保存 - // if(!$result){ - // return json(['msg'=>$msg,'val'=>0]);; - // } - - // $list['id'] = $id; - - // // 整理数据 - // $data = array(); - // $i = 0; - // foreach ($list['subject'] as $key => $value) { - // $data[$i]['subjectid'] = $key; - // $data[$i]['manfen'] = $list['manfen'][$key]; - // $data[$i]['youxiu'] = $list['youxiu'][$key]; - // $data[$i]['jige'] = $list['jige'][$key]; - // $data[$i]['lieming'] = $list['lieming'][$key]; - // $data[$i]['kaoshiid'] = $id; - // $i++; - // } - - - // // 更新数据 - // // 删除原来的数据 - // $subject = new \app\kaoshi\model\KaoshiSubject; - - // $subject::destroy(function($query) use ($id){ - // $query->where('kaoshiid',$id); - // }); - - // // 添加新的数据 - // $subjectdata = $subject->saveAll($data); - - // // 整理数据 - // $data = array(); - // $i = 0; - // foreach ($list['nianji'] as $key => $value) { - // $data[$i]['nianji'] = $key; - // $data[$i]['nianjiname'] = $list['nianjiname'][$key]; - // $data[$i]['kaoshiid'] = $id; - // $i++; - // } - - // // 更新数据 - // $nianji = new \app\kaoshi\model\KaoshiNianji; - // $nianji::destroy(function($query) use ($id){ - // $query->where('kaoshiid',$id); - // }); - // $nianjidata = $nianji->saveAll($data); - - - // // 根据更新结果设置返回提示信息 - // $subjectdata && $nianjidata ? $data=['msg'=>'设置成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // // 返回信息 - // return json($data); - // } - - - - - // 删除考试 public function delete($id) { @@ -379,6 +236,25 @@ class Index extends BaseController } + // 设置成绩是否允许操作 + public function luru() + { + + // 获取id变量 + $id = request()->post('id'); + $value = request()->post('value'); + + // 获取考试信息 + $data = KS::where('id',$id)->update(['luru'=>$value]); + + // 根据更新结果设置返回提示信息 + $data ? $data=['msg'=>'状态设置成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; + + // 返回信息 + return json($data); + } + + // 考试更多操作页面 public function moreAction($kaoshi) { diff --git a/app/kaoshi/controller/Kaohao.php b/app/kaoshi/controller/Kaohao.php index ad1c2750..9ed2e21d 100644 --- a/app/kaoshi/controller/Kaohao.php +++ b/app/kaoshi/controller/Kaohao.php @@ -16,14 +16,14 @@ use PhpOffice\PhpSpreadsheet\Spreadsheet; // 引用二维码生成类 use \Endroid\QrCode\QrCode; -// 调用验证类 +// 调用验证类 use think\Validate; class Kaohao extends BaseController { // 生成考号 - public function create($kaoshi) + public function createAll($kaoshi) { // 获取参考年级 @@ -36,7 +36,7 @@ class Kaohao extends BaseController 'webtitle'=>'生成考号', 'butname'=>'生成', 'formpost'=>'POST', - 'url'=>'/kaoshi/kaohao/save', + 'url'=>'/kaoshi/kaohao/saveall', 'kaoshi'=>$kaoshi ); @@ -49,7 +49,7 @@ class Kaohao extends BaseController } // 保存考号 - public function save() + public function saveAll() { // 实例化验证模型 @@ -57,7 +57,7 @@ class Kaohao extends BaseController // 获取表单数据 $list = request()->only(['school','kaoshi','banjiids'],'post'); - event('ksstatus',$list['kaoshi']); + event('kslu',$list['kaoshi']); // 验证表单数据 $result = $validate->check($list); @@ -82,7 +82,7 @@ class Kaohao extends BaseController } ]) ->select(); - + // 获取参加考试年级数组 $bfdate = KS::where('id',$list['kaoshi'])->value('bfdate'); $njlist = nianjiList($bfdate); @@ -122,7 +122,7 @@ class Kaohao extends BaseController $data = $kh ->allowField(['id','kaoshi','student','school','ruxuenian','nianji','banji','paixu','create_time','update_time']) ->saveAll($kaohao); - + // 根据更新结果设置返回提示信息 $data ? $data=['msg'=>'生成成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; @@ -134,9 +134,9 @@ class Kaohao extends BaseController // 添加单条考号 - public function addOne($kaoshi) + public function create($kaoshi) { - + // 获取参考年级、学科 $ksset = new ksset; $list['data']['nianji'] = $ksset->srcNianji($kaoshi); @@ -169,14 +169,14 @@ class Kaohao extends BaseController // 保存单条考号 - public function saveOne() + public function save() { // 获取表单数据 $list = request()->only(['kaoshi','banji','student'],'post'); $list['student'] = explode(' ', $list['student']); $list['student'] = $list['student'][1]; - event('ksstatus',$list['kaoshi']); + event('kslu', $list['kaoshi']); // 查询考号是否存在 $ks = KH::withTrashed() @@ -187,7 +187,7 @@ class Kaohao extends BaseController // 如果存在成绩则更新,不存在则添加 if($ks) { - // 判断记录是否被删除 + // 判断记录是否被删除 if($ks->delete_time > 0) { $ks->restore(); @@ -209,12 +209,6 @@ class Kaohao extends BaseController $data = KH::create($list); } - - - - - - // 根据更新结果设置返回提示信息 $data ? $data=['msg'=>'生成成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; @@ -223,6 +217,36 @@ class Kaohao extends BaseController } + + // 学生信息 + public function read($id) + { + + $list['webtitle'] ='成绩'; + $list['dataurl'] = '/renshi/studentcj/chengjilist'; + $list['id'] = $id; + + $stucj = new KH; + $defen = $stucj->khSrcChengji($id); + + $color = ['layui-bg-red','layui-bg-orange','layui-bg-green','layui-bg-cyan','layui-bg-blue','layui-bg-black']; + + foreach ($defen->ksChengji as $key => $value) { + $list['cj'][$value->subject_id]['defen'] = $value->defen * 1; + $list['cj'][$value->subject_id]['defenlv'] = $value->defenlv * 1; + $list['cj'][$value->subject_id]['title'] = $value->subjectName->title; + $list['cj'][$value->subject_id]['color'] = $color[$key % 5]; + } + + // // 模板赋值 + $this->view->assign('list',$list); + // 渲染模板 + return $this->view->fetch(); + } + + + + /** * 生成指定网址的二维码 * @param string $url 二维码中所代表的网址 @@ -256,7 +280,7 @@ class Kaohao extends BaseController // Word处理 // 实例化类 - $phpWord = new \PhpOffice\PhpWord\PhpWord(); + $phpWord = new \PhpOffice\PhpWord\PhpWord(); // 设置页面格式 @@ -286,7 +310,7 @@ class Kaohao extends BaseController 'bold' => true, ] ); - + // 循环写出信息 foreach ($chengjiinfo as $key => $value) { @@ -295,10 +319,10 @@ class Kaohao extends BaseController $table = $section->addTable($key); $table->addRow(1500); - + $img = $this->create_qrcode($value['id'].','.$xkkey); $table->addCell(850)->addImage($img,$imageStyle); - + // $table->addCell(700)->addImage('aaaa.jpg',$imageStyle); $info = $table->addCell(650); @@ -361,7 +385,7 @@ class Kaohao extends BaseController // 获取表单数据 $list = request()->only(['banjiids'=>array(),'kaoshi','subject'=>array()],'post'); - event('ksstatus',$list['kaoshi']); + event('kslu', $list['kaoshi']); $kaoshi = $list['kaoshi']; $banji = $list['banjiids']; $subject = $list['subject']; @@ -377,7 +401,7 @@ class Kaohao extends BaseController if(!$result){ $this->error($msg); } - + $ks = new KS(); $kslist = $ks::where('id',$kaoshi) @@ -417,7 +441,7 @@ class Kaohao extends BaseController // 实例化系统设置类 - $md5 = new \app\system\controller\Encrypt; + $md5 = new \app\system\controller\Encrypt; // 循环写出信息 @@ -459,7 +483,7 @@ class Kaohao extends BaseController $writer->save('php://output'); ob_flush(); flush(); - + } @@ -468,7 +492,7 @@ class Kaohao extends BaseController // 下载考试成绩采集表 public function caiji($kaoshi) { - + // 获取参考年级、学科 $ksset = new ksset; $list['data']['nianji'] = $ksset->srcNianji($kaoshi); @@ -495,13 +519,13 @@ class Kaohao extends BaseController // 渲染 return $this->view->fetch('biaoqian'); } - - - // 获取参考名单 + + + // 获取参考名单 public function dwcaiji() { // 实例化验证模型 @@ -509,7 +533,8 @@ class Kaohao extends BaseController // 获取表单数据 $list = request()->only(['banjiids'=>array(),'ruxuenian','kaoshi','subject'=>array()],'post'); - event('ksstatus',$list['kaoshi']); + event('kslu',$list['kaoshi']); + $kaoshi = $list['kaoshi']; $banji = $list['banjiids']; @@ -524,7 +549,7 @@ class Kaohao extends BaseController if(!$result){ $this->error($msg); } - + $ks = new KS(); $kslist = $ks::where('id',$kaoshi) ->field('id,title') @@ -647,8 +672,8 @@ class Kaohao extends BaseController // 判断考试结束时间是否已过 $ksid = KH::where('id',$id[0])->value('kaoshi'); - event('ksstatus',$ksid); - + event('kslu',$ksid); + $data = KH::destroy($id); // 根据更新结果设置返回提示信息 @@ -657,5 +682,5 @@ class Kaohao extends BaseController return json($data); } - + } diff --git a/app/kaoshi/controller/KaoshiSet.php b/app/kaoshi/controller/KaoshiSet.php index b49b830d..3fe43c11 100644 --- a/app/kaoshi/controller/KaoshiSet.php +++ b/app/kaoshi/controller/KaoshiSet.php @@ -68,7 +68,7 @@ class KaoshiSet extends BaseController $limit_start = $src['page'] * $src['limit'] - $src['limit']; $limit_length = $src['limit']; $data = $data->slice($limit_start,$limit_length); - + // 重组返回内容 $data = [ 'code'=> 0 , // ajax请求次数,作为标识符 @@ -89,7 +89,7 @@ class KaoshiSet extends BaseController */ public function create($kaoshi) { - + // 设置页面标题 $list['set'] = array( 'webtitle'=>'设置考试', @@ -131,11 +131,11 @@ class KaoshiSet extends BaseController // 'lieming'=>array() ],'POST'); - event('ksstatus',$src['kaoshi']); + event('kslu',$src['kaoshi']); // 验证表单数据 $validate = new \app\kaoshi\validate\Kaoshiset; - $result = $validate->check($src); + $result = $validate->scene('create')->check($src); $msg = $validate->getError(); // 如果验证不通过则停止保存 if(!$result){ @@ -175,21 +175,10 @@ class KaoshiSet extends BaseController $data ? $data=['msg'=>'设置成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; // 返回信息 - return json($data); + return json($data); } - /** - * 显示指定的资源 - * - * @param int $id - * @return \think\Response - */ - public function read($id) - { - // - } - /** * 显示编辑资源表单页. * @@ -198,7 +187,29 @@ class KaoshiSet extends BaseController */ public function edit($id) { - // + // 获取考试信息 + $ksset = new ksset; + $list['data'] = $ksset::where('id',$id) + ->field('id,kaoshi_id,nianjiname,subject_id,manfen,youxiu,jige') + ->with([ + 'subjectName' => function($query){ + $query->field('id,title,jiancheng'); + } + ]) + ->find()->toArray(); + + // 设置页面标题 + $list['set'] = array( + 'webtitle'=>'编辑考试设置', + 'butname'=>'修改', + 'formpost'=>'PUT', + 'url'=>'/kaoshi/kaoshiset/update/'.$id, + ); + + // 模板赋值 + $this->view->assign('list',$list); + // 渲染 + return $this->view->fetch('edit'); } /** @@ -208,9 +219,31 @@ class KaoshiSet extends BaseController * @param int $id * @return \think\Response */ - public function update(Request $request, $id) + public function update($id) { - // + $validate = new \app\kaoshi\validate\KaoshiSetEdit; + // 获取表单数据 + $list = request()->only(['id','kaoshi','manfen','youxiu','jige'],'post'); + + // 验证表单数据 + $result = $validate->scene('edit')->check($list); + $msg = $validate->getError(); + // 如果验证不通过则停止保存 + if(!$result){ + return json(['msg'=>$msg,'val'=>0]);; + } + event('kslu',$list['kaoshi']); + + // 更新数据 + $ksset = new ksset(); + $ksdata = $ksset::update($list); + + + // 根据更新结果设置返回提示信息 + $ksdata ? $data=['msg'=>'更新成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; + + // 返回信息 + return json($data); } /** @@ -233,8 +266,8 @@ class KaoshiSet extends BaseController // 判断考试结束时间是否已过 $ksset = new ksset; $ksid = $ksset::where('id',$id[0])->value('kaoshi_id'); - event('ksstatus',$ksid); - + event('kslu',$ksid); + $data = ksset::destroy($id,true); // 根据更新结果设置返回提示信息 $data ? $data=['msg'=>'删除成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; @@ -246,11 +279,13 @@ class KaoshiSet extends BaseController // 设置荣誉状态 public function setStatus() { - // 获取id变量 $id = request()->post('id'); $value = request()->post('value'); + $ksid = ksset::where('id',$id)->value('kaoshi_id'); + event('kslu',$ksid); + // 获取学生信息 $data = ksset::where('id',$id)->update(['status'=>$value]); diff --git a/app/kaoshi/controller/TongjiLog.php b/app/kaoshi/controller/TongjiLog.php new file mode 100644 index 00000000..21403d04 --- /dev/null +++ b/app/kaoshi/controller/TongjiLog.php @@ -0,0 +1,65 @@ +where('id',$kaoshi_id) + ->field('id,title') + ->find(); + + // 设置要给模板赋值的信息 + $list['webtitle'] = '最新统计结果状态'; + $list['kaoshi'] = $kaoshi_id; + $list['kaoshititle'] = $ksinfo->title; + $list['dataurl'] = '/kaoshi/tjlog/data'; + + + // 模板赋值 + $this->view->assign('list',$list); + + // 渲染模板 + return $this->view->fetch(); + } + + public function ajaxData() + { + // 获取参数 + $src = $this->request + ->only([ + 'kaoshi'=>'', + ],'POST'); + + // 实例化考号 + $kh = new \app\kaoshi\model\Kaohao; + $lastcj = $kh->lastUpdateTime($src['kaoshi']); + $cjLastTime = $lastcj->getData('update_time'); + $src['cjlast'] = $cjLastTime; + + $log = new \app\kaoshi\model\TongjiLog; + $data = $log->search($src); + $cnt = count($data); + + // 重组返回内容 + $data = [ + 'code'=> 0 , // ajax请求次数,作为标识符 + 'msg'=>"", // 获取到的结果数(每页显示数量) + 'count'=>$cnt, // 符合条件的总数据量 + 'data'=>$data, //获取到的数据结果 + ]; + return json($data); + } +} diff --git a/app/kaoshi/model/Kaohao.php b/app/kaoshi/model/Kaohao.php index 295f27ab..1feb22b9 100644 --- a/app/kaoshi/model/Kaohao.php +++ b/app/kaoshi/model/Kaohao.php @@ -7,14 +7,14 @@ use app\common\model\Base; class Kaohao extends Base { - /** - * 根据班级ID和考试ID,以班级为单位分组,查询参加当前考试的学生信息 - * - * @access public - * @param mixed $kaoshi 当前考试ID - * @param array $banji 学生所在班级 + /** + * 根据班级ID和考试ID,以班级为单位分组,查询参加当前考试的学生信息 + * + * @access public + * @param mixed $kaoshi 当前考试ID + * @param array $banji 学生所在班级 * @return array 返回类型 - */ + */ public function srcKaohaoBanji($kaoshi,$banji) { // 获取考试标签 @@ -54,9 +54,9 @@ class Kaohao extends Base if($val->cjStudent == Null) { $stuinof = $stu::withTrashed() - ->where('id',$val->student) - ->field('id,xingming') - ->find(); + ->where('id',$val->student) + ->field('id,xingming') + ->find(); $data[$key]->banjiKaohao[$key]->cjStudent = array('id'=>$stuinof->id,'xingming'=>$stuinof->xingming); } } @@ -65,20 +65,20 @@ class Kaohao extends Base } - /** + /** * 整理出适合显示的学生成绩, - * 以考号为基础查询学生成绩信息并排序,计划在网页上显示成绩列表中使用 + * 以考号为基础查询学生成绩信息并排序,计划在网页上显示成绩列表中使用 * 信息包括:学校、年级、班级、姓名、性别、各学科成绩、平均分、总分 - * @access public - * @param array $src 参数数组 + * @access public + * @param array $src 参数数组 * @param number $src['kaoshi'] 考试ID - * @param array $src['banji'] 班级数组 + * @param array $src['banji'] 班级数组 * @param number $src['searchval'] 关键字 * @return array 返回类型 */ public function srcChengji($srcfrom) { - // 初始化参数 + // 初始化参数 $src = array( 'kaoshi'=>'0', 'banji'=>array(), @@ -88,7 +88,7 @@ class Kaohao extends Base // 用新值替换初始值 $src = array_cover( $srcfrom , $src ) ; - $khlist = self::search($src); + $khlist = self::search($src); // 成绩整理 if($khlist->isEmpty()) @@ -164,21 +164,21 @@ class Kaohao extends Base - /** + /** * 按考号查询学生成绩,整理出学生每个学科成绩 - * 计划在成绩排序中使用 + * 计划在成绩排序中使用 * 信息包括:成绩id,排序,位置 - * @access public - * @param array $src 参数数组 + * @access public + * @param array $src 参数数组 * @param number $src['kaoshi'] 考试ID - * @param array $src['banji'] 班级数组 + * @param array $src['banji'] 班级数组 * @param number $src['searchval'] 关键字 * @return array 返回类型 */ public function srcChengjiSubject($srcfrom) { - // 初始化参数 + // 初始化参数 $src = array( 'kaoshi'=>'0', 'banji'=>array(), @@ -188,7 +188,7 @@ class Kaohao extends Base // 用新值替换初始值 $src = array_cover( $srcfrom , $src ) ; - $khlist = self::search($src); + $khlist = self::search($src); // 成绩整理 @@ -211,18 +211,18 @@ class Kaohao extends Base - /** + /** * 列出成绩原始数据,其它数据模型中的方法以此方法为基础进行数据整理 - * @access public - * @param array $src 参数数组 + * @access public + * @param array $src 参数数组 * @param number $src['kaoshi'] 考试ID - * @param array $src['banji'] 班级数组 + * @param array $src['banji'] 班级数组 * @param number $src['searchval'] 关键字 * @return array 返回成绩对象 */ public function search($srcfrom) { - // 初始化参数 + // 初始化参数 $src = array( 'kaoshi'=>'0', 'banji'=>array(), @@ -263,61 +263,140 @@ class Kaohao extends Base } - - - - // 获取单个学生考试成绩 public function srcOneStudentChengji($srcfrom) { - // 初始化参数 + // 初始化参数 $src = array( - 'student'=>'', - 'kaoshi'=>array(), + 'student' => '', + 'category' => '', + 'xueqi' => '', + 'kaoshi' => '', ); // 用新值替换初始值 $src = array_cover( $srcfrom , $src ) ; + + if(isset($srcfrom['bfdate']) && strlen($srcfrom['bfdate'])>0) + { + $src['bfdate'] = $srcfrom['bfdate']; + }else{ + $src['bfdate'] = date("Y-m-d",strtotime("-1 year")); + } + + if(isset($srcfrom['enddate']) && strlen($srcfrom['enddate'])>0) + { + $src['enddate'] = $srcfrom['enddate']; + }else{ + $src['enddate'] = date("Y-m-d",strtotime("+1 day")); + } + + $src['category'] = strToarray($src['category']); + $src['xueqi'] = strToarray($src['xueqi']); $src['kaoshi'] = strToarray($src['kaoshi']); + $stuCj = $this->where('student',$src['student']) - ->when(count($src['kaoshi'])>0,function($query)use($src){ - $query->where('kaoshi_id','in',$src['kaoshi']) + ->when(count($src['category'])>0, function($query) use($src){ + $query->where('kaoshi','in',function($q) use($src){ + $q->name('kaoshi') + ->where('category','in',$src['category']) + ->field('id'); + }); + }) + ->when(count($src['xueqi'])>0, function($query) use($src){ + $query->where('kaoshi','in',function($q) use($src){ + $q->name('kaoshi') + ->where('xueqi','in',function($w) use($src){ + $w->name('xueqi') + ->where('category','in',$src['xueqi']) + ->field('id'); + }) ->field('id'); - }) - ->with([ - 'ksChengji'=>function($query){ - $query->field('id,kaohao_id,subject_id,defen,bweizhi,xweizhi,qweizhi'); - } - ,'cjSchool'=>function($query){ - $query->field('id,jiancheng'); - } - ,'cjKaoshi'=>function($query){ - $query->field('id,title,zuzhi,xueqi,category,bfdate,enddate') - ->with([ - 'ksCategory'=>function($q){ - $q->field('id,title'); - } - ,'ksZuzhi'=>function($q) - { - $q->field('id,title,jiancheng'); - } - ]); - } - ]) - ->field('id,kaoshi,student,ruxuenian,nianji,banji,paixu') - ->append(['banjiTitle']) - ->select(); + }); + }) + ->when(count($src['kaoshi'])>0, function($query) use($src){ + $query->where('kaoshi', 'in', $src['kaoshi']); + }) + ->where('kaoshi','in',function($query) use($src){ + $query->name('kaoshi') + ->whereTime('bfdate|enddate','between',[ $src['bfdate'],$src['enddate'] ]) + ->field('id'); + }) + ->with([ + 'ksChengji'=>function($query){ + $query->field('id,kaohao_id,subject_id,defen,defenlv,bweizhi,xweizhi,qweizhi'); + } + ,'cjSchool'=>function($query){ + $query->field('id,jiancheng'); + } + ,'cjKaoshi'=>function($query){ + $query->field('id,title,zuzhi,xueqi,category,bfdate,enddate') + ->with([ + 'ksCategory'=>function($q){ + $q->field('id,title'); + } + ,'ksZuzhi'=>function($q) + { + $q->field('id,title,jiancheng'); + } + ]); + } + ]) + ->field('id,kaoshi,student,ruxuenian,nianji,banji,paixu') + ->append(['banjiTitle']) + ->select(); return $stuCj; } + // 根据考号查询成绩 + public function khSrcChengji($id) + { + $stuCj = self::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,student,ruxuenian,nianji,banji,paixu') + ->append(['banjiTitle']) + ->find(); + + return $stuCj; + } + + + + // 获取考试成绩最后更新时间 + public function lastUpdateTime($kaoshi_id) + { + // 获取考号 + $kaohaoids = self::where('kaoshi', $kaoshi_id) + ->cache(true) + ->column('id'); + + $cj = new \app\chengji\model\Chengji; + $lastcj = $cj->where('kaohao_id', 'in', $kaohaoids) + ->order(['update_time' => 'desc']) + ->find(); + + return $lastcj; + } + + + - // 满分 public function banjiKaohao() @@ -362,18 +441,18 @@ class Kaohao extends Base return $this->hasMany('\app\chengji\model\Chengji','kaohao_id','id'); } - - /** + + /** * 获取参加考试的学校 - * @access public + * @access public * @param number $kaoshi 考试id * @param number $ruxuenian 入学年 * @return array 返回类型 */ public function cySchool($srcfrom) { - // 初始化参数 + // 初始化参数 $src = array( 'kaoshi'=>'', 'ruxuenian'=>'', @@ -414,17 +493,17 @@ class Kaohao extends Base } - /** + /** * 获取参加考试的班级 - * @access public + * @access public * @param number $kaoshi 考试id * @param number $ruxuenian 入学年 * @return array 返回班级数据模型 */ public function cyBanji($srcfrom) { - - // 初始化参数 + + // 初始化参数 $src = array( 'kaoshi'=>'', 'ruxuenian'=>array(), @@ -462,7 +541,7 @@ class Kaohao extends Base } ]) // ->cache(true) - ->field('banji + ->field('banji ,any_value(id) as id ,any_value(nianji) as nianji ,any_value(paixu) as paixu @@ -493,9 +572,9 @@ class Kaohao extends Base } - /** + /** * 获取参加考试的班级全名 - * @access public + * @access public * @param number $kaoshi 考试id * @param number $ruxuenian 入学年 * @return array 返回类型 @@ -508,9 +587,9 @@ class Kaohao extends Base return $title; } - /** + /** * 获取参加考试的班级全名 - * @access public + * @access public * @param number $kaoshi 考试id * @param number $ruxuenian 入学年 * @return array 返回类型 @@ -525,7 +604,7 @@ class Kaohao extends Base // 转置成绩数组 private function zzcj($array = array()) { - + $arr = array(); foreach ($array as $key => $value) { $arr[$value['subject_id']] = $value['defen']; diff --git a/app/kaoshi/model/Kaoshi.php b/app/kaoshi/model/Kaoshi.php index 2c2bda27..82b1e5f9 100644 --- a/app/kaoshi/model/Kaoshi.php +++ b/app/kaoshi/model/Kaoshi.php @@ -67,18 +67,18 @@ class Kaoshi extends Base { // 获取参考年级 $kaoshiList = $this->where('id',$kaoshi) - ->field('id,title,status') + ->field('id,title,status,luru') ->find(); return $kaoshiList; } - + // 开始时间修改器 public function setBfdateAttr($value) { return strtotime($value); - } + } // 开始时间获取器 public function getBfdateAttr($value) @@ -165,6 +165,4 @@ class Kaoshi extends Base } - - } diff --git a/app/kaoshi/model/KaoshiSet.php b/app/kaoshi/model/KaoshiSet.php index 1b434b3b..65c47514 100644 --- a/app/kaoshi/model/KaoshiSet.php +++ b/app/kaoshi/model/KaoshiSet.php @@ -17,7 +17,7 @@ class KaoshiSet extends Base // 查询参加考试学科 public function search($srcfrom=array()) { - // 初始化参数 + // 初始化参数 $src = array( 'kaoshi'=>'0', 'nianji'=>array(), @@ -32,7 +32,6 @@ class KaoshiSet extends Base $nianji = strToarray($src['nianji']); $subject = strToarray($src['subject']); - $data = $this->where('kaoshi_id',$src['kaoshi']) ->order([$src['field'] =>$src['order']]) ->when(count($nianji)>0,function($query)use($nianji){ @@ -81,7 +80,7 @@ class KaoshiSet extends Base $query->field('id,title,jiancheng,paixu,lieming'); } ]) - // ->cache(true) + ->where('status',1) ->select(); @@ -110,6 +109,7 @@ class KaoshiSet extends Base return $data; } + /** * 查询参加考试年级 * @@ -141,5 +141,5 @@ class KaoshiSet extends Base return $data; } - + } diff --git a/app/kaoshi/model/TongjiLog.php b/app/kaoshi/model/TongjiLog.php new file mode 100644 index 00000000..7235b8ac --- /dev/null +++ b/app/kaoshi/model/TongjiLog.php @@ -0,0 +1,79 @@ + '', + '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']) + ->with([ + 'userName'=>function($query){ + $query->field('id,xingming'); + } + ]) + ->append(['url']) + ->select(); + + foreach ($logList as $key => $value) { + $logList[$key]->cjlast = $src['date']; + } + + return $logList; + } + + // 开始时间获取器 + public function getCategoryAttr($value) + { + $src = [ + 'bjtj' => '班级统计', + 'njtj' => '年级统计', + 'schtj' => '区统计', + 'bjwz' => '班级位置', + 'njwz' => '年级位置', + 'schwz' => '区位置', + ]; + + return $src[$value]; + } + + // 开始时间获取器 + public function getUrlAttr() + { + $src = [ + 'bjtj' => '/chengji/bjtj/tongji', + 'njtj' => '/chengji/njtj/tongji', + 'schtj' => '/chengji/schtj/tongji', + 'bjwz' => '/chengji/bjtj/bjorder', + 'njwz' => '/chengji/njtj/njorder', + 'schwz' => '/chengji/schtj/schorder', + ]; + + $val = $this->getData('category'); + + return $src[$val]; + } + + // 学科关联 + public function userName() + { + return $this->belongsTo('\app\admin\model\Admin','user_id','id'); + } + +} diff --git a/app/kaoshi/route/kaoshi.php b/app/kaoshi/route/kaoshi.php index fecc90bb..728e0f62 100644 --- a/app/kaoshi/route/kaoshi.php +++ b/app/kaoshi/route/kaoshi.php @@ -27,6 +27,7 @@ Route::group('index', function () { Route::rule('cybanji','Index/cyBanji','post'); # 获取参加考试班级 Route::rule('cysubject','Index/cySubject','post'); # 获取参加考试学科 Route::rule('kaoshiinfo/','Index/kaoshiInfo','post'); # 获取参加考试的学校、学科、班级、年级等信息 + Route::rule('luru','Index/luru','post'); # 删除信息 }); @@ -36,11 +37,12 @@ Route::group('kaohao', function () { Route::rule('save','Kaohao/save','post'); # 保存信息 Route::rule('biaoqian/','Kaohao/biaoqian','get'); # 信息列表 Route::rule('biaoqianxls','Kaohao/biaoqianXls','post'); # 信息列表 - Route::rule('caiji/','Kaohao/caiji','get'); # 成绩采集下载页面 + Route::rule('caiji/','Kaohao/caiji','get'); # 成绩采集下载页面 Route::rule('dwcaiji','Kaohao/dwcaiji','post'); # 成绩采集下载 Route::rule('delete/','Kaohao/delete','delete'); # 成绩采集下载 - Route::rule('add/','Kaohao/addOne','get'); # 信息列表 - Route::rule('saveone','Kaohao/saveOne','post'); # 保存信息 + Route::rule('createall/','Kaohao/createAll','get'); # 信息列表 + Route::rule('saveall','Kaohao/saveAll','post'); # 保存信息 + Route::rule('read/','Kaohao/read','get'); # 读取信息 }); @@ -57,4 +59,18 @@ Route::group('kaoshiset', function () { }); +// 考试设置 +Route::group('tjlog', function () { + Route::rule('index/','TongjiLog/index','get'); + Route::rule('data','TongjiLog/ajaxData','post'); + }); + + + + + + + + + diff --git a/app/kaoshi/validate/KaoshiSetEdit.php b/app/kaoshi/validate/KaoshiSetEdit.php new file mode 100644 index 00000000..f8103ab9 --- /dev/null +++ b/app/kaoshi/validate/KaoshiSetEdit.php @@ -0,0 +1,35 @@ + ['规则1','规则2'...] + * + * @var + */ + protected $rule = [ + 'kaoshi|考试ID' => 'require|integer', + 'manfen|满分' => 'require|number', + 'youxiu|优秀' => 'require|number', + 'jige|及格' => 'require|number', + // 'lieming|列名' => 'require|array', + ]; + + /** + * 定义错误信息 + * 格式:'字段名.规则名' => '错误信息' + * + * @var array + */ + protected $message = []; + + protected $scene = [ + 'edit' => ['id','kaoshi','manfen','youxiu','jige'], + ]; +} diff --git a/app/kaoshi/validate/Kaoshiset.php b/app/kaoshi/validate/Kaoshiset.php index 7c0016dc..e075631f 100644 --- a/app/kaoshi/validate/Kaoshiset.php +++ b/app/kaoshi/validate/Kaoshiset.php @@ -10,8 +10,8 @@ class Kaoshiset extends Validate * 定义验证规则 * 格式:'字段名' => ['规则1','规则2'...] * - * @var - */ + * @var + */ protected $rule = [ 'kaoshi|考试ID' => 'require|integer', 'nianji|年级' => 'require|integer', @@ -22,12 +22,16 @@ class Kaoshiset extends Validate 'jige|及格' => 'require|array', // 'lieming|列名' => 'require|array', ]; - + /** * 定义错误信息 * 格式:'字段名.规则名' => '错误信息' * * @var array - */ + */ protected $message = []; + + protected $scene = [ + 'create' => ['kaoshi','nianji','nianjiname','subject','manfen','youxiu','jige'], + ]; } diff --git a/app/kaoshi/view/index/create.html b/app/kaoshi/view/index/create.html index 3fab0ccc..6b779d1c 100644 --- a/app/kaoshi/view/index/create.html +++ b/app/kaoshi/view/index/create.html @@ -5,7 +5,7 @@
- {php} $schoollist = schlist('校级','区级',['小学','初中','中小学','其他学段']);{/php} + {php} $schoollist = schlist('校级','区级',['小学','初中','中小学']);{/php} -
-
-
-
- -
- {php}$schoolList = schlist('校级','校级',array('小学','中小学')){/php} - -
-
-
- -
- -
-
- -
- -
- -
-
-
- -
-
- -
-
-
- -
- -
- -{/block} - -{block name="myjs"} - -{/block} - diff --git a/app/kaoshi/view/kaohao/create.html b/app/kaoshi/view/kaohao/create.html index cade470f..a6514a86 100644 --- a/app/kaoshi/view/kaohao/create.html +++ b/app/kaoshi/view/kaohao/create.html @@ -1,73 +1,149 @@ {extend name=".././view/create.html" /} {block name="form"} -
-
- -
- {php}$schoolList = schlist('校级','校级',array('小学','中小学')){/php} - -
-
-
- {foreach $list.data.nianji as $key=>$vo } - -
- -
- {/foreach} -
- -
- -
-
+
+
+ +
+
+ +
+
+
+
+ +
+ {php}$schoolList = schlist('校级','校级',array('小学','中小学')){/php} + +
+
+
+ +
+ +
+
+ +
+ +
+ +
+
+
+ +
+
+ +
+
+
+ +
+ +
+
{/block} {block name="myjs"} {/block} diff --git a/app/kaoshi/view/kaohao/create_all.html b/app/kaoshi/view/kaohao/create_all.html new file mode 100644 index 00000000..cade470f --- /dev/null +++ b/app/kaoshi/view/kaohao/create_all.html @@ -0,0 +1,74 @@ +{extend name=".././view/create.html" /} + +{block name="form"} +
+
+ +
+ {php}$schoolList = schlist('校级','校级',array('小学','中小学')){/php} + +
+
+
+ {foreach $list.data.nianji as $key=>$vo } + +
+ +
+ {/foreach} +
+ +
+ +
+
+{/block} + +{block name="myjs"} + +{/block} + diff --git a/app/kaoshi/view/kaohao/read.html b/app/kaoshi/view/kaohao/read.html new file mode 100644 index 00000000..bb277f3e --- /dev/null +++ b/app/kaoshi/view/kaohao/read.html @@ -0,0 +1,158 @@ + + + + + {$list.webtitle} + + + + {load href="__XADMIN__/css/font.css" /} + {load href="__XADMIN__/css/xadmin.css" /} + {load href="__XADMIN__/js/jquery.min.js" /} + {load href="__XADMIN__/lib/layui/layui.js" /} + {load href="__XADMIN__/js/xadmin.js" /} + {load href="__XADMIN__/js/cookie.js" /} + {load href="__XADMIN__/js/md5.min.js" /} + {load href="__STATIC__/echarts/echarts.js" /} + {$list.webtitle} + + +
+
+
+
+
+ 成绩列表 + + + + + + + + + + + + + + + {volist name="list.cj" id="vo"} + + + + + + {/volist} + +
学科得分得分率
{$vo.title}{$vo.defen}{$vo.defenlv}
+
+
+
+
+ 得分率 + {volist name="list.cj" id="vo"} +
+ +
+
+
+
+
+
+
+ {/volist} +
+
+
+
+ 雷达图 +
+
+
+
+
+
+ + + diff --git a/app/kaoshi/view/kaoshi_set/edit.html b/app/kaoshi/view/kaoshi_set/edit.html new file mode 100644 index 00000000..75f9c62f --- /dev/null +++ b/app/kaoshi/view/kaoshi_set/edit.html @@ -0,0 +1,64 @@ +{extend name=".././view/create.html" /} + +{block name="form"} +
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ + +
+ +
+
+{/block} + +{block name="myjs"} + +{/block} + diff --git a/app/kaoshi/view/kaoshi_set/index.html b/app/kaoshi/view/kaoshi_set/index.html index f26fb1f1..ca8ca9e8 100644 --- a/app/kaoshi/view/kaoshi_set/index.html +++ b/app/kaoshi/view/kaoshi_set/index.html @@ -46,8 +46,8 @@ + + -{/block} \ No newline at end of file +{/block} diff --git a/app/kaoshi/view/tongji_log/index.html b/app/kaoshi/view/tongji_log/index.html new file mode 100644 index 00000000..f1fec27f --- /dev/null +++ b/app/kaoshi/view/tongji_log/index.html @@ -0,0 +1,79 @@ + +{extend name=".././view/list.html" /} +{block name="jsset"} + +{/block} +{block name="nav"} + + 考试管理 + 更多操作 + 统计结果 + 统计结果检测 + {$list['kaoshititle']} + +{/block} +{block name="search"} + +{/block} +{block name="table"} +
+{/block} +{block name="myjs"} + + + + + + +{/block} diff --git a/app/keti/controller/KetiInfo.php b/app/keti/controller/KetiInfo.php index 0a4c9fc9..894d46f2 100644 --- a/app/keti/controller/KetiInfo.php +++ b/app/keti/controller/KetiInfo.php @@ -93,7 +93,7 @@ class KetiInfo extends BaseController $limit_start = $src['page'] * $src['limit'] - $src['limit']; $limit_length = $src['limit']; $data = $data->slice($limit_start,$limit_length); - + // 重组返回内容 $data = [ 'code'=> 0 , // ajax请求次数,作为标识符 @@ -121,7 +121,7 @@ class KetiInfo extends BaseController 'webtitle'=>'添加课题册', 'butname'=>'添加', 'formpost'=>'POST', - 'url'=>'/keti/ketiinfo/save', + 'url'=>'/keti/ketiinfo/save', 'ketice'=>$ketice ); @@ -167,7 +167,7 @@ class KetiInfo extends BaseController 'category' => 1, ]; } - + // 添加新的获奖人与参与人信息 $cy = $data->ktZcr()->saveAll($canyulist); @@ -231,26 +231,6 @@ class KetiInfo extends BaseController } - /** - * 上传荣誉图片并保存 - * - * @param \think\Request $request - * @return \think\Response - */ - // public function upload() - // { - // // 获取文件信息 - // $list['text'] = $this->request->post('text'); - // $list['serurl'] = $this->request->post('serurl'); - - // // 获取表单上传文件 - // $file = request()->file('file'); - // // 上传文件并返回结果 - // $data = upload($list,$file); - - // return json($data); - // } - /** * 显示指定的资源 @@ -285,7 +265,7 @@ class KetiInfo extends BaseController }, ]) ->find(); - + // 设置页面标题 $list['set'] = array( @@ -341,7 +321,7 @@ class KetiInfo extends BaseController 'category' => 1, ]; } - + // 添加新的获奖人与参与人信息 $data = $data->ktZcr()->saveAll($canyulist); @@ -464,7 +444,7 @@ class KetiInfo extends BaseController 'category' => 2, ]; } - + // 添加新的获奖人与参与人信息 $data = $data->ktCy()->saveAll($canyulist); @@ -479,34 +459,6 @@ class KetiInfo extends BaseController } - // /** - // * 上传荣誉图片并保存 - // * - // * @param \think\Request $request - // * @return \think\Response - // */ - // public function jtupload() - // { - - // // 获取表单上传文件 例如上传了001.jpg - // $file = request()->file('file'); - // // 移动到框架应用根目录/uploads/ 目录下 - // $info = $file->validate(['size'=>2*1024*1024,'ext'=>'jpg,png,gif,jpeg'])->move('uploads\keti\jieti'); - - // if($info){ - // // 成功上传后 获取上传信息 - // $list['url'] = $info->getSaveName(); - // $list['url'] = str_replace('\\','/',$list['url']); - // // 如果图片上传成功,则返回 - // $data = array('msg'=>'上传成功','val'=>true,'url'=>$list['url']); - // }else{ - // // 上传失败获取错误信息 - // $data = array('msg'=>$file->getError(),'val'=>false,'url'=>null); - // } - - // // 返回信息 - // return json($data); - // } // 下载课题信息表 @@ -582,16 +534,16 @@ class KetiInfo extends BaseController ], ], ]; - + if($key+4>9) { - + $worksheet->getStyle('A10:H'.($key+4))->applyFromArray($styleArray); // 设置行高 for($i = 10; $i<=($key+4); $i++){ $worksheet->getRowDimension($i)->setRowHeight(30); } - + } $worksheet->getStyle('A4')->applyFromArray($styleArray); diff --git a/app/listener/KaoshiJieShu.php b/app/listener/KaoshiJieShu.php new file mode 100644 index 00000000..54d33fe2 --- /dev/null +++ b/app/listener/KaoshiJieShu.php @@ -0,0 +1,30 @@ +ksInfo($kaoshi_id); + if($ksInfo->status == 0) + { + return $this->error('本次考试已经结束,不能操作!','/login/err'); + } + + return $ksInfo; + } +} diff --git a/app/listener/KaoshiLuru.php b/app/listener/KaoshiLuru.php new file mode 100644 index 00000000..0373f923 --- /dev/null +++ b/app/listener/KaoshiLuru.php @@ -0,0 +1,31 @@ +ksInfo($kaoshi_id); + if($ksInfo->luru == 0) + { + return $this->error('本次考试已经不允许操作!','/login/err'); + } + + return $ksInfo; + + } +} diff --git a/app/listener/KaoshiStatus.php b/app/listener/KaoshiStatus.php deleted file mode 100644 index f647db27..00000000 --- a/app/listener/KaoshiStatus.php +++ /dev/null @@ -1,21 +0,0 @@ -getKsStatus($kaoshiid); - } -} diff --git a/app/listener/TongjiLog.php b/app/listener/TongjiLog.php new file mode 100644 index 00000000..cff9c327 --- /dev/null +++ b/app/listener/TongjiLog.php @@ -0,0 +1,28 @@ + '', + 'category' => '', + ]; + // 用新值替换初始值 + $src = array_cover($srcfrom, $src) ; + $event = new MyEvent; + $tjLog = $event->addTongjiLog($src['kaoshi_id'], $src['category']); + + return true; + } +} diff --git a/app/login/view/index/shangma_log.html b/app/login/view/index/shangma_log.html index 8d481fc0..1c031fe2 100644 --- a/app/login/view/index/shangma_log.html +++ b/app/login/view/index/shangma_log.html @@ -47,7 +47,7 @@
  • -

    V1.3.2 2020-02-12

    +

    V1.3.2 2020-03-09

    图表增加下载、还原按钮。
    @@ -57,10 +57,17 @@
    禁止修改考试相关信息的判断条件由结束时间变成状态。
    - 修复错误:禁止筛选中回车刷新页面、添加单条考号错误。 + 增加禁止修改成绩字段。
    - 修改项目名字为《码蚁》 - + 修复错误:禁止筛选中回车刷新页面、添加单条考号错误、分类保护等。 +
    + 修改项目名字为《码蚁》。 +
    + 学生信息查看中增加学生历次成绩查看。 +
    + 增加成绩统计记录。 +
    + 整理权限验证。

  • @@ -135,7 +142,7 @@ 修改部分数据排序方法
    增加考号表字段,更新计算学生班级方法 - +

    @@ -169,7 +176,7 @@ 优化各页面中类型获取方式
    修改学生名单同步算法 - +

    @@ -221,4 +228,4 @@ - \ No newline at end of file + diff --git a/app/middleware/Auth.php b/app/middleware/Auth.php index 2d948176..b6dd2862 100644 --- a/app/middleware/Auth.php +++ b/app/middleware/Auth.php @@ -10,7 +10,7 @@ use think\facade\Config; class Auth { - use \liliuwei\think\Jump; + use \liliuwei\think\Jump; /** * 处理请求 * @@ -20,7 +20,7 @@ class Auth */ public function handle($request, \Closure $next) { - + $admins = Config::get('auth.auth_config.administrator'); // 如果当前用户ID在配置排除的列表中,愚昧取消验证 if(in_array(session('userid'),$admins)){ @@ -36,35 +36,59 @@ class Auth $url = $mod.'/'.$con.'/'.$act; - // 排除应用 $uneed_m = array('index'); // 排除控制器 $uneed_c = array(); # 荣誉器名首字母要大写 - // 排除方法 + $uneed_a = array( - 'upload','myinfo', - 'mybanji','banjilist', - 'editpassword','updatepassword', - // 学生信息查询 - 'ajaxdatachengji','srcstudent','ajaxdataby','ajaxdatadel', - // 教师信息查询 - 'srcteacher','srcry','srckt','ajaxdatadel', - // 查询班级成绩、查询年级成绩、查询录入成绩人员信息 - 'ajaxaddinfo', - // 批量保存 - 'saveall', - // 考试 - 'cybanji','kaoshiinfo','cyschool','cynianji','cybanji','cysubject', - // 下载成绩表、下载成绩统计表 - 'dwchengjixlsx','dwbanjixls','dwnianjixlsx','dwchengjitiaoxlsx','newjieguo', - //保存考号、下载试卷标签、下载成绩采集表 - 'updateset','biaoqianxls','dwcaiji','saveone', - //课题结题图片上传和更新 - 'jtupdate','ajaxdata', + 'upload', # 上传 + 'ajaxdata', # 常规数据获取 + 'saveall', # 批量保存 ); + + // 排除指定模块下的指定方法 - $uneed_u = array('index/Index/index'); + $uneed_u = array( + // Index应用 + 'index/index/index', # 主页 + 'index/index/welcome', # 欢迎页 + // Admin应用 + 'admin/index/myinfo', # 个人信息 + 'admin/index/editpassword', # 编辑密码 + 'admin/index/updatepassword', # 更新密码 + // Teach应用 + 'teach/banji/mybanji', # 获取班级数据 + 'teach/banji/banjilist', # 获取班级数据 + // Kaoshi应用 + 'kaoshi/index/cyschool', # 获取参加考试学校 + 'kaoshi/index/cynianji', # 获取参加考试年级 + 'kaoshi/index/cybanji', # 获取参加考试班级 + 'kaoshi/index/cysubject', # 获取参加考试学科 + 'kaoshi/index/cysubject', # 获取参加考试学科 + 'kaoshi/kaohao/biaoqianxls', # 下载试卷标签 + 'kaoshi/kaohao/dwcaiji', # 下载成绩采集表 + // Renshi应用 + 'renshi/student/ajaxdataby', # 获取毕业学生列表 + 'renshi/student/ajaxdatadel', # 获取删除学生列表 + 'renshi/student/srcstudent', # 查询学生名单 + 'renshi/studentchengji/ajaxonestudentchengjitubiao', # 获取学生成绩拆线图数据 + 'renshi/studentchengji/ajaxonestudentchengjileida', # 获取学生成绩雷达图数据 + 'renshi/teacher/ajaxdatadel', # 获取删除教师列表 + 'renshi/teacher/srcteacher', # 搜索教师 + 'renshi/teacher/srcry', # 获取当前教师荣誉列表 + 'renshi/teacher/srckt', # 获取当前教师课题列表 + // Chengji应用 + 'chengji/index/ajaxaddinfo', # 获取录入该学生成绩人员的信息 + 'chengji/index/dwchengjixlsx', # 下载学生成绩 + 'chengji/index/dwchengjitiaoxlsx', # 下载学生成绩条 + 'chengji/bjtongji/dwbanjixls', # 下载班级成绩统计表 + 'chengji/bjtongji/myavg', # 获取单项成绩数据 + 'chengji/bjtongji/myxiangti', # 获取成绩箱体图数据 + 'chengji/njtongji/dwnianjixlsx', # 下载年级成绩统计表 + 'chengji/njtongji/myavg', # 获取单项成绩数据 + 'chengji/njtongji/myxiangti', # 获取成绩箱体图数据 + ); // 验证是否是排除方法 diff --git a/app/middleware/UserLogin.php b/app/middleware/UserLogin.php index 766b80e9..b0bf0a95 100644 --- a/app/middleware/UserLogin.php +++ b/app/middleware/UserLogin.php @@ -5,6 +5,7 @@ namespace app\middleware; class UserLogin { + use \liliuwei\think\Jump; /** * 处理请求 * @@ -14,32 +15,41 @@ class UserLogin */ public function handle($request, \Closure $next) { - // 尝试从session中获取用户名和密码 $username = session('?username') ? $username = session('username') : $username = ''; $password = session('?password') ? $password = session('password') : $password = ''; - // 尝试从cookie中获取用户名和密码 - if( strlen($username)<1 ) + if (strlen($username)<1 ) { $username = cookie('?username') ? $username = cookie('username') : $username = ''; $password = cookie('?password') ? $password = cookie('password') : $password = ''; } + $isajax = $request->isAjax(); + // 如果没有获取到用户名和密码,则跳转到登录页面 - if( strlen($username)<1 ) + if(strlen($username)<1) { - - echo ""; + if($isajax) + { + $this->error('很长时间没有操作,登录超时啦~'); + }else{ + echo ""; + } } // 检验用户名或密码是否正确 $yz = new \app\login\controller\Index; $yz = $yz->check($username,$password); if($yz['status'] == 0){ - echo ""; - } + if($isajax) + { + $this->error('密码刚才修改过了,请重新登录~','/login/err'); + }else{ + echo ""; + } + } return $next($request); } diff --git a/app/renshi/controller/Student.php b/app/renshi/controller/Student.php index e8047f27..16ec1b9a 100644 --- a/app/renshi/controller/Student.php +++ b/app/renshi/controller/Student.php @@ -75,7 +75,7 @@ class Student extends BaseController $limit_start = $src['page'] * $src['limit'] - $src['limit']; $limit_length = $src['limit']; $data = $data->slice($limit_start,$limit_length); - + // 重组返回内容 $data = [ 'code'=> 0 , // ajax请求次数,作为标识符 @@ -130,7 +130,7 @@ class Student extends BaseController $limit_start = $src['page'] * $src['limit'] - $src['limit']; $limit_length = $src['limit']; $data = $data->slice($limit_start,$limit_length); - + // 重组返回内容 $data = [ 'code'=> 0 , // ajax请求次数,作为标识符 @@ -207,7 +207,7 @@ class Student extends BaseController $limit_start = $src['page'] * $src['limit'] - $src['limit']; $limit_length = $src['limit']; $data = $data->slice($limit_start,$limit_length); - + // 重组返回内容 $data = [ 'code'=> 0 , // ajax请求次数,作为标识符 @@ -239,7 +239,7 @@ class Student extends BaseController return $this->view->fetch('create'); } - + // 保存信息 public function save() @@ -286,89 +286,6 @@ class Student extends BaseController return json($data); } - // - public function read($id) - { - // 查询学生信息 - $myInfo = STU::withTrashed() - ->where('id',$id) - ->with([ - 'stuBanji'=>function($query) - { - $query->field('id,school,ruxuenian,paixu')->append(['banjiTitle']); - }, - 'stuSchool'=>function($query) - { - $query->field('id,title'); - } - ]) - ->find(); - - // 获取参加考试学科 - $sbj = new \app\teach\model\Subject; - $ksSbj = $sbj - ->where('kaoshi',1) - ->field('id,title,jiancheng,lieming') - ->select() - ->toArray(); - $myInfo['sbj'] = $ksSbj; - // 设置页面标题 - $myInfo['webtitle'] = $myInfo->xingming.' 信息'; - - - // 模板赋值 - $this->view->assign('list',$myInfo); - // 渲染模板 - return $this->view->fetch(); - } - - - - // 获取考试成绩 - public function ajaxDatachengji() - { - // 获取表单参数 - // 获取参数 - $src = $this->request - ->only([ - 'page'=>'1', - 'limit'=>'10', - 'field'=>'kaoshiId', - 'order'=>'desc', - 'student'=>'', - ],'POST'); - - // 获取学生成绩 - $cj = new \app\chengji\model\Chengji; - $khList = $cj->oneChengji($src); - - // 获取符合条件记录总数 - $cnt = count($khList); - // 获取当前页数据 - $limit_start = $src['page'] * $src['limit'] - $src['limit']; - $limit_length = $src['limit']; - // $khList = $khList->slice($limit_start,$limit_length); - - // 按条件排序 - $src['order'] == 'desc' ? $src['order'] =SORT_DESC :$src['order'] = SORT_ASC; - if($cnt>0){ - $khList = sortArrByManyField($khList,$src['field'],$src['order']); - } - - - // 重组返回内容 - $data = [ - 'code'=> 0 , // ajax请求次数,作为标识符 - 'msg'=>"", // 获取到的结果数(每页显示数量) - 'count'=>$cnt, // 符合条件的总数据量 - 'data'=>$khList, //获取到的数据结果 - ]; - - - return json($data); - } - - // 修改学生信息 @@ -449,7 +366,36 @@ class Student extends BaseController return json($data); } - + + // 学生信息 + public function read($id) + { + // 查询教师信息 + $myInfo = STU::withTrashed() + ->where('id',$id) + ->with([ + 'stuBanji'=>function($query) + { + $query->field('id,school,ruxuenian,paixu')->append(['banjiTitle']); + }, + 'stuSchool'=>function($query) + { + $query->field('id,title'); + } + ]) + ->find(); + // 设置页面标题 + $myInfo['webtitle'] = $myInfo->xingming.'-信息'; + + + // 模板赋值 + $this->view->assign('list',$myInfo); + // 渲染模板 + return $this->view->fetch(); + } + + + @@ -549,17 +495,16 @@ class Student extends BaseController $this->error('请使用模板上传','/login/err'); return json($data); } - + // 删除标题行 array_splice($stuinfo,0,3); - $stuinfo = array_filter($stuinfo,function($q){ return $q[1] != null && strlen($q[2]) >=6 && $q[3] != null; }); - // 获取班级对应的入学年和排序 + // 获取班级对应的入学年和排序 $bj = array_column($stuinfo, 3); // 获取班级名 @@ -598,7 +543,7 @@ class Student extends BaseController ->select(); $sfzh = $serStulist->column('shenfenzhenghao'); - // 返回数据对比结果 + // 返回数据对比结果 $jiaoji = array_intersect($xlsStuList, $sfzh); #返回交集 $add = array_diff($xlsStuList, $sfzh); $del = array_diff($sfzh, $xlsStuList); @@ -766,7 +711,7 @@ class Student extends BaseController $data = array('msg'=>'请使用模板上传','val'=>0,'url'=>null); return json($data); } - + // 删除标题行 array_splice($stuinfo,0,3); @@ -775,10 +720,10 @@ class Student extends BaseController }); - // 获取班级对应的入学年和排序 + // 获取班级对应的入学年和排序 $stuids = array_column($stuinfo, 1); - + // 实例化学生数据模型 $stu = new STU; @@ -791,9 +736,9 @@ class Student extends BaseController return json($data); } - - + + // 下载表格模板 public function download() { diff --git a/app/renshi/controller/StudentChengji.php b/app/renshi/controller/StudentChengji.php new file mode 100644 index 00000000..fc8c5d16 --- /dev/null +++ b/app/renshi/controller/StudentChengji.php @@ -0,0 +1,152 @@ +where('id',$id) + ->with([ + 'stuBanji'=>function($query) + { + $query->field('id,school,ruxuenian,paixu')->append(['banjiTitle']); + }, + 'stuSchool'=>function($query) + { + $query->field('id,title'); + } + ]) + ->find(); + + + // 获取参加考试学科 + $sbj = new \app\teach\model\Subject; + $ksSbj = $sbj + ->where('kaoshi',1) + ->field('id,title,jiancheng,lieming') + ->select() + ->toArray(); + + $myInfo['sbj'] = $ksSbj; + // 设置页面标题 + $myInfo['webtitle'] = $myInfo->xingming.'-成绩'; + $myInfo['dataurl'] = '/renshi/studentcj/data'; + $myInfo['student'] = $id; + + + // 模板赋值 + $this->view->assign('list',$myInfo); + // 渲染模板 + return $this->view->fetch(); + } + + + // 获取单个考试成绩列表 + public function ajaxData() + { + // 获取表单参数 + // 获取参数 + $src = $this->request + ->only([ + 'page'=>'1', + 'limit'=>'10', + 'field'=>'kaoshiId', + 'order'=>'desc', + 'student'=>'', + 'category'=>'', + 'xueqi'=>'', + 'bfdate'=>'', + 'enddate'=>'', + ],'POST'); + + // 获取学生成绩 + $stucj = new STUCJ; + $khList = $stucj->oneStudentChengjiList($src); + + // 获取符合条件记录总数 + $cnt = count($khList); + // 获取当前页数据 + $limit_start = $src['page'] * $src['limit'] - $src['limit']; + $limit_length = $src['limit']; + // $khList = $khList->slice($limit_start,$limit_length); + + // 按条件排序 + $src['order'] == 'desc' ? $src['order'] =SORT_DESC :$src['order'] = SORT_ASC; + if($cnt>0){ + $khList = sortArrByManyField($khList,$src['field'],$src['order']); + } + + + // 重组返回内容 + $data = [ + 'code'=> 0 , // ajax请求次数,作为标识符 + 'msg'=>"", // 获取到的结果数(每页显示数量) + 'count'=>$cnt, // 符合条件的总数据量 + 'data'=>$khList, //获取到的数据结果 + ]; + + + return json($data); + } + + + // 获取单个考试成绩图表 + public function ajaxOneStudentChengjiTuBiao() + { + // 获取表单参数 + // 获取参数 + $src = $this->request + ->only([ + 'field'=>'kaoshiId', + 'order'=>'asc', + 'student'=>'', + 'subject'=>'', + 'category'=>'', + 'xueqi'=>'', + 'bfdate'=>'', + 'enddate'=>'', + ],'POST'); + + // 获取学生成绩 + $stucj = new STUCJ; + $data = $stucj->oneStudentSubjectChengji($src); + + return json($data); + } + + + + + // 获取单个考试成绩图表 + public function ajaxOneStudentChengjiLeiDa() + { + // 获取表单参数 + // 获取参数 + $src = $this->request + ->only([ + 'kaohaoid'=>'', + ],'POST'); + + // 获取学生成绩 + $stucj = new STUCJ; + $data = $stucj->oneStudentLeiDa($src); + + return json($data); + } + + +} diff --git a/app/renshi/model/StudentChengji.php b/app/renshi/model/StudentChengji.php new file mode 100644 index 00000000..c79d0ded --- /dev/null +++ b/app/renshi/model/StudentChengji.php @@ -0,0 +1,280 @@ +'', + 'kaoshi'=>array(), + 'category'=>'', + 'xueqi'=>'', + 'bfdate'=>'', + 'enddate'=>'', + ); + + // 用新值替换初始值 + $src = array_cover( $srcfrom , $src ); + + $kh = new \app\kaoshi\model\Kaohao; + $stuCj = $kh->srcOneStudentChengji($src); + + + // 获取可以参加考试的学科 + $sbj = new \app\teach\model\Subject; + $sbjList = $sbj->where('kaoshi',1) + ->where('status',1) + ->field('id,lieming') + ->column('lieming','id'); + + // 整理数据 + $data = array(); + foreach ($stuCj as $key => $value) { + $data[$key] = [ + 'kaoshiId'=>$value->kaoshi, + 'kaoshiTitle'=>$value->cjKaoshi->title, + 'kaohaoId'=>$value->id, + 'banjiTitle'=>$value->banjiTitle, + 'zuzhi'=>$value->cjKaoshi->ksZuzhi->jiancheng, + // 'category'=>$value->cjKaoshi->ksCategory->title, + 'bfdate'=>$value->cjKaoshi->bfdate, + 'enddate'=>$value->cjKaoshi->enddate, + ]; + + $cjcnt = count($value->ksChengji); + + if($cjcnt > 0) + { + $sbj = $value->ksChengji->column('subject_id'); + foreach ($sbjList as $sbj_k => $sbj_val) { + // 通过学科ID获取这个学科成绩对应的成绩下标。 + // 这个地方需要再核实。 + $xb = array_search($sbj_k, $sbj); # ksChengji下标 + if($xb === false) + { + $data[$key][$sbj_val] = ''; + }else{ + $data[$key][$sbj_val] = $value->ksChengji[$xb]->defen; + } + } + $defen = array_column($value->ksChengji->toArray(), 'defen'); + $sum = array_sum($defen ); + $avg = $sum / $cjcnt; + $data[$key]['sum'] = $sum; + $data[$key]['avg'] = round($avg,2); + }else{ + foreach ($sbjList as $sbj_k => $sbj_val) { + $data[$key][$sbj_val] = ''; + } + $data[$key]['sum'] = ''; + $data[$key]['avg'] = ''; + } + } + + return $data; + } + + + // 一个学生一个学科历次成绩 + public function oneStudentSubjectChengji($srcfrom) + { + // 初始化参数 + $src = array( + 'student'=>'', + 'kaoshi'=>array(), + 'subject'=>'', + 'category'=>'', + 'xueqi'=>'', + 'bfdate'=>'', + 'enddate'=>'', + ); + + + // 用新值替换初始值 + $src = array_cover( $srcfrom , $src ); + + $kh = new \app\kaoshi\model\Kaohao; + $stuCj = $kh->srcOneStudentChengji($src); + + + // 获取可以参加考试的学科 + $sbj = new \app\teach\model\Subject; + $sbjList = $sbj->where('kaoshi',1) + ->where('status',1) + ->field('id,lieming') + ->column('lieming','id'); + + // 整理数据 + $data = array(); + $xAxis = array(); + $series = [ + 0 => [ + 'name'=>'得分率%', + 'type'=>'line', + 'data'=>array(), + ], + 1 => [ + 'name'=>'班级位置%', + 'type'=>'line', + 'data'=>array(), + ], + 2 => [ + 'name'=>'学校位置%', + 'type'=>'line', + 'data'=>array(), + ], + 3 => [ + 'name'=>'全部位置%', + 'type'=>'line', + 'data'=>array(), + ], + ]; + foreach ($stuCj as $key => $value) { + $cjcnt = count($value->ksChengji); + if($cjcnt > 0) + { + foreach ($value->ksChengji as $sbj_k => $sbj_val) { + if($src['subject'] == $sbj_val->subject_id) + { + $xAxis[] = $value->cjKaoshi->title; + $series['0']['data'][] = $sbj_val->defenlv; + $series['1']['data'][] = round($sbj_val->bweizhi,0); + $series['2']['data'][] = round($sbj_val->xweizhi,0); + $series['3']['data'][] = round($sbj_val->qweizhi,0); + } + } + } + } + + $data = [ + 'xAxis' => $xAxis, + 'series' => $series, + 'legend' => ['得分率%','班级位置%','学校位置%','全部位置%'], + ]; + + return $data; + } + + // 一个学生一个学科历次成绩 + public function oneStudentLeiDa($srcfrom) + { + // 初始化参数 + $src = array( + 'kaohaoid'=>'', + ); + + // 用新值替换初始值 + $src = array_cover( $srcfrom , $src ); + + $kh = new \app\kaoshi\model\Kaohao; + // 考号信息 + $khInfo = $kh->where('id', $src['kaohaoid']) + ->with([ + 'ksChengji'=>function($query){ + $query->field('id,kaohao_id,subject_id,defen'); + } + ]) + ->find(); + + // 参加考试学科 + $subject = subjectList(); + // 获取参加考试学科满分 + $ksset = new \app\kaoshi\model\KaoshiSet; + $manfen = $ksset->srcSubject($khInfo->kaoshi, '', $khInfo->ruxuenian); + + // 查询区成绩 + $SchoolChengji = new \app\chengji\model\TongjiSch; + $schcj = $SchoolChengji + ->where('kaoshi_id',$khInfo->kaoshi) + ->where('ruxuenian',$khInfo->ruxuenian) + ->select(); + + // 循环写入成绩 + $indicator = array(); + $legend = ['得分','全体平均分']; + $bjcj = array(); + $bjcj['name'] = '得分'; + $qcj = array(); + $qcj['name'] = '全体平均分'; + $i = 0; + + foreach ($subject as $sbj_k => $sbj_val) { + + // 试卷满分 + if(isset($indicator[$i]) == false) + { + $indicator[$i]['name'] = $sbj_val->title; + foreach ($manfen as $mf_k => $mf_val) { + if($sbj_val['id'] == $mf_val['id']) + { + $indicator[$i]['max'] = $mf_val['fenshuxian']['manfen']; + continue; + } + if(isset($indicator[$i]) == false) + { + $indicator[$i]['max'] = null; + } + } + } + + // 学生成绩 + if(isset($bjcj['value'][$i]) == false) + { + foreach ($khInfo->ksChengji as $cj_k => $cj_val) { + if($sbj_val['id'] == $cj_val->subject_id) + { + $bjcj['value'][$i] = $cj_val->defen; + continue; + } + if(isset($bjcj['value'][$i]) == false) + { + $bjcj['value'][$i] = null; + } + } + } + + // 班级成绩 + if(isset($qcj['value'][$i]) == false) + { + foreach ($schcj as $sch_k => $sch_val) { + if($sbj_val['id'] == $sch_val->subject_id) + { + $qcj['value'][$i] = $sch_val->avg; + continue; + } + if(isset($qcj['value'][$i]) == false) + { + $qcj['value'][$i] = null; + } + } + } + + $i++; + } + + $data = [ + 'title' => '学生成绩', + 'legend' => $legend, + 'indicator' => $indicator, + 'series' => [ + 'name'=>'成绩', + 'type' => 'radar', + 'data' => [$bjcj,$qcj], + ], + ]; + + return $data; + } + +} diff --git a/app/renshi/route/renshi.php b/app/renshi/route/renshi.php index 2a454ad5..e25d7225 100644 --- a/app/renshi/route/renshi.php +++ b/app/renshi/route/renshi.php @@ -10,16 +10,15 @@ // +---------------------------------------------------------------------- use think\facade\Route; - // 学生管理 Route::group('student', function () { Route::rule('','Student/index','get'); # 信息列表 Route::rule('data','Student/ajaxdata','post'); # 获取数据 Route::rule('create','Student/create','get'); # 添加信息 Route::rule('save','Student/save','post'); # 保存信息 - Route::rule('read/','Student/read','get'); # 读取信息 Route::rule('edit/','Student/edit','get'); # 修改信息 Route::rule('update/','Student/update','put'); # 更新信息 + Route::rule('read/','Student/read','get'); # 读取信息 Route::rule('delete/','Student/delete','delete'); # 删除信息 Route::rule('status','Student/setStatus','post'); # 删除信息 Route::rule('createall','Student/createAll','get'); # 批量导入 @@ -27,18 +26,27 @@ Route::group('student', function () { Route::rule('deletes','Student/deletes','get'); # 批量保存 Route::rule('deleteall','Student/deleteXlsx','post'); # 批量保存 Route::rule('download','Student/download','get'); # 批量保存 - Route::rule('chengji','Student/ajaxDatachengji','post'); # 获取学生成绩 Route::rule('srcstudent','Student/srcStudent','post'); # 获取学生成绩 Route::rule('redel/','Student/reDel','delete'); # 恢复删除的学生 }); + +// 学生成绩列表 +Route::group('studentcj', function () { + Route::rule('','StudentChengji/index','get'); # 读取信息 + Route::rule('data','StudentChengji/ajaxData','post'); # 获取学生成绩列表 + Route::rule('chengjitubiao','StudentChengji/ajaxOneStudentChengjiTuBiao','post'); # 获取学生成绩列表 + Route::rule('chengjileida','StudentChengji/ajaxOneStudentChengjiLeiDa','post'); # 获取学生成绩列表 + }); + + // 学生管理 Route::group('student', function () { - Route::rule('bylist','Student/byList','get'); # 信息列表 - Route::rule('databy','Student/ajaxdataBy','post'); # 获取数据 - Route::rule('dellist','Student/delList','get'); # 信息列表 - Route::rule('datadel','Student/ajaxdataDel','post'); # 获取数据 - }); + Route::rule('bylist','Student/byList','get'); # 信息列表 + Route::rule('databy','Student/ajaxdataBy','post'); # 获取数据 + Route::rule('dellist','Student/delList','get'); # 信息列表 + Route::rule('datadel','Student/ajaxdataDel','post'); # 获取数据 + }); // 教师管理 diff --git a/app/renshi/view/student/by_list.html b/app/renshi/view/student/by_list.html index 84620afa..46486c76 100644 --- a/app/renshi/view/student/by_list.html +++ b/app/renshi/view/student/by_list.html @@ -45,6 +45,7 @@ -{/block} \ No newline at end of file +{/block} diff --git a/app/renshi/view/student/del_list.html b/app/renshi/view/student/del_list.html index fbf09f86..b7927e42 100644 --- a/app/renshi/view/student/del_list.html +++ b/app/renshi/view/student/del_list.html @@ -70,6 +70,7 @@ @@ -124,9 +125,12 @@ var layEvent = obj.event; //获得 lay-event 对应的值(也可以是表头的 event 参数对应的值) var tr = obj.tr; //获得当前行 tr 的DOM对象 switch(layEvent){ - case 'detail':// 查看 + case 'detail':// 查看 cjgl.add(obj.data.xingming+'信息','/renshi/student/read/'+obj.data.id,'','',true); break; + case 'chengji':// 查看 + cjgl.add(obj.data.xingming+'成绩','/renshi/studentcj/'+obj.data.id,'','',true); + break; case 'huifu':// 恢复删除 cjgl.redel(obj,"/renshi/student/redel"); break; @@ -134,4 +138,4 @@ }); }); -{/block} \ No newline at end of file +{/block} diff --git a/app/renshi/view/student/index.html b/app/renshi/view/student/index.html index 7e97357a..ea52e983 100644 --- a/app/renshi/view/student/index.html +++ b/app/renshi/view/student/index.html @@ -82,6 +82,7 @@ @@ -147,9 +148,12 @@ var layEvent = obj.event; //获得 lay-event 对应的值(也可以是表头的 event 参数对应的值) var tr = obj.tr; //获得当前行 tr 的DOM对象 switch(layEvent){ - case 'detail':// 查看 - cjgl.add(obj.data.xingming+'信息','student/read/'+obj.data.id,'','',true); + case 'detail':// 查看 + cjgl.add(obj.data.xingming+'-信息','student/read/'+obj.data.id,'','',true); break; + case 'chengji':// 查看 + parent.xadmin.add_tab(obj.data.xingming + '-成绩','/renshi/studentcj/'+obj.data.id,true); + break; case 'del':// 删除 cjgl.del(obj,"student/delete"); break; @@ -163,4 +167,4 @@ }); }); -{/block} \ No newline at end of file +{/block} diff --git a/app/renshi/view/student/read.html b/app/renshi/view/student/read.html index 90780dae..199c9b95 100644 --- a/app/renshi/view/student/read.html +++ b/app/renshi/view/student/read.html @@ -1,22 +1,23 @@ - - - {php}echo session('webtitle'){/php} - - - - {load href="__XADMIN__/css/font.css" /} - {load href="__XADMIN__/css/xadmin.css" /} - {load href="__XADMIN__/js/jquery.min.js" /} - {load href="__XADMIN__/lib/layui/layui.js" /} - {load href="__XADMIN__/js/xadmin.js" /} - {load href="__XADMIN__/js/cookie.js" /} - {load href="__XADMIN__/js/md5.min.js" /} - {$list.webtitle} - - + + + {php}echo session('webtitle'){/php} + + + + {load href="__XADMIN__/css/font.css" /} + {load href="__XADMIN__/css/xadmin.css" /} + {load href="__XADMIN__/js/jquery.min.js" /} + {load href="__XADMIN__/lib/layui/layui.js" /} + {load href="__XADMIN__/js/xadmin.js" /} + {load href="__XADMIN__/js/cookie.js" /} + {load href="__XADMIN__/js/md5.min.js" /} + {$list.webtitle} + +
    +
    个人信息
    @@ -45,69 +46,6 @@
    - -
    - 历次考试成绩 -
    -
    -
    -
    - -
    - - -
    - - - \ No newline at end of file + + diff --git a/app/renshi/view/student_chengji/index.html b/app/renshi/view/student_chengji/index.html new file mode 100644 index 00000000..a02d028c --- /dev/null +++ b/app/renshi/view/student_chengji/index.html @@ -0,0 +1,275 @@ + +{extend name=".././view/list.html" /} +{block name="jsset"} +{load href="__STATIC__/echarts/echarts.js" /} +{/block} +{block name="nav"} + + 考试管理 + 更多操作 + 成绩查看 + 各班级成绩统计表 + {$list['webtitle']} + +{/block} +{block name="search"} +
    + +
    + +
    +
    +
    + +
    + + {php} $category = getCategory('学期');{/php} + {volist name="category" id="vo"} + + {/volist} +
    +
    +
    + +
    + {php} $category = getCategory('考试');{/php} + {volist name="category" id="vo"} + + {/volist} +
    +
    +
    +
    + +
    + +
    +
    + +
    +
    +
    + + + +{/block} +{block name="table"} +
    +{/block} +{block name="echart"} + {volist name="$list.sbj" id="vo"} +
    + {/volist} +{/block} +{block name="myjs"} + + + + + + +{/block} diff --git a/app/rongyu/view/js_rongyu_info/create.html b/app/rongyu/view/js_rongyu_info/create.html index 76e61cfb..04c48c66 100644 --- a/app/rongyu/view/js_rongyu_info/create.html +++ b/app/rongyu/view/js_rongyu_info/create.html @@ -63,7 +63,7 @@
    + {/block} diff --git a/app/system/controller/Category.php b/app/system/controller/Category.php index 7aa8e166..7a04079b 100644 --- a/app/system/controller/Category.php +++ b/app/system/controller/Category.php @@ -9,8 +9,8 @@ use app\system\model\Category as CG; class Category extends BaseController { - - + + // 类别列表 public function index() @@ -56,7 +56,7 @@ class Category extends BaseController $limit_start = $src['page'] * $src['limit']-$src['limit']; $limit_length = $src['limit']; $data = $data->slice($limit_start,$limit_length); - + // 重组返回内容 $data = [ 'code'=> 0 , // ajax请求次数,作为标识符 @@ -89,7 +89,7 @@ class Category extends BaseController return $this->view->fetch(); } - + // 保存信息 public function save() @@ -113,7 +113,7 @@ class Category extends BaseController return json(['msg'=>$msg,'val'=>0]);; } - // 保存数据 + // 保存数据 $data = CG::create($list); @@ -129,11 +129,6 @@ class Category extends BaseController // 编辑类别 public function edit($id) { - $isupdate = CG::where('id',$id)->value('isupdate'); - if($isupdate == 0) - { - $this->error('系统默认分类不允许修改','/login/err'); - } // 获取单位信息 $list['data'] = CG::field('id,title,pid,paixu') @@ -161,6 +156,12 @@ class Category extends BaseController // 获取表单数据 $list = request()->only(['title','pid','paixu'],'put'); + $isupdate = CG::where('id',$id)->value('isupdate'); + if($isupdate == 0) + { + $this->error('系统默认分类不允许修改','/login/err'); + } + // 验证表单数据 $result = $validate->check($list); $msg = $validate->getError(); @@ -183,7 +184,7 @@ class Category extends BaseController return json($data); } - + // 删除类别 public function delete($id) { @@ -194,10 +195,13 @@ class Category extends BaseController $id = explode(',', $id); - $data = CG::destroy($id); + $data = CG::destroy(function($query) use($id){ + $query->where('isupdate',1) + ->where('id','in',$id); + }); // 根据更新结果设置返回提示信息 - $data ? $data=['msg'=>'删除成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; + $data ? $data=['msg'=>'除系统保留分类以外,其它删除成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; // 返回信息 return json($data); diff --git a/app/teach/controller/Subject.php b/app/teach/controller/Subject.php index bee40811..1b352cd1 100644 --- a/app/teach/controller/Subject.php +++ b/app/teach/controller/Subject.php @@ -15,12 +15,14 @@ class Subject extends BaseController // 设置要给模板赋值的信息 $list['webtitle'] = '学科列表'; $list['dataurl'] = 'subject/data'; + $list['status'] = '/teach/subject/status'; + $list['kaoshi'] = '/teach/subject/kaoshi'; // 模板赋值 $this->view->assign('list',$list); // 渲染模板 - return $this->view->fetch(); + return $this->view->fetch(); } @@ -50,7 +52,7 @@ class Subject extends BaseController $limit_start = $src['page'] * $src['limit'] - $src['limit']; $limit_length = $src['limit']; $data = $data->slice($limit_start,$limit_length); - + // 重组返回内容 $data = [ 'code'=> 0 , // ajax请求次数,作为标识符 @@ -81,7 +83,7 @@ class Subject extends BaseController return $this->view->fetch('create'); } - + // 保存信息 public function save() @@ -104,7 +106,7 @@ class Subject extends BaseController return json(['msg'=>$msg,'val'=>0]); } - // 保存数据 + // 保存数据 $data = SJ::create($list); // 根据更新结果设置返回提示信息 @@ -177,7 +179,7 @@ class Subject extends BaseController return json($data); } - + diff --git a/app/teach/model/Banji.php b/app/teach/model/Banji.php index fd5cb895..412de580 100644 --- a/app/teach/model/Banji.php +++ b/app/teach/model/Banji.php @@ -7,7 +7,7 @@ use app\common\model\Base; class Banji extends Base { - + // 查询所有班级 public function search($src) { @@ -125,49 +125,49 @@ class Banji extends Base } - // /** - // * 获取考试时的班级名称(文本格式-一年级十一班) - // * $jdshijian 考试开始时间 - // * $ruxuenian 年级 - // * $paixu 班级 - // * 返回 $str 班级名称 - // * */ - // public function myBanjiTitle($bjid,$jdshijian=0) - // { - // // 查询班级信息 - // $bjinfo = $this::withTrashed() - // ->where('id',$bjid) - // ->field('id,ruxuenian,paixu,delete_time') - // ->find(); + /** + * 获取考试时的班级名称(文本格式-一年级十一班) + * $jdshijian 考试开始时间 + * $ruxuenian 年级 + * $paixu 班级 + * 返回 $str 班级名称 + * */ + public function myBanjiTitle($bjid,$jdshijian=0) + { + // 查询班级信息 + $bjinfo = $this::withTrashed() + ->where('id',$bjid) + ->field('id,ruxuenian,paixu,delete_time') + ->find(); - // //获取班级、年级列表 - // $njlist = nianjiList($jdshijian); - // $bjlist = banjinamelist(); + //获取班级、年级列表 + $njlist = nianjiList($jdshijian); + $bjlist = banjinamelist(); - // if(array_key_exists($bjinfo->ruxuenian,$njlist)) - // { - // $bjtitle = $njlist[$bjinfo->ruxuenian].$bjlist[$bjinfo->paixu]; - // }else{ - // $bjtitle = $bjinfo->ruxuenian.'界'.$bjinfo->paixu.'班'; - // } + if(array_key_exists($bjinfo->ruxuenian,$njlist)) + { + $bjtitle = $njlist[$bjinfo->ruxuenian].$bjlist[$bjinfo->paixu]; + }else{ + $bjtitle = $bjinfo->ruxuenian.'界'.$bjinfo->paixu.'班'; + } - // // 如果该班级被删除,则标删除 - // if($bjinfo->delete_time != null) - // { - // $bjtitle = $bjtitle.'(删)'; - // } + // 如果该班级被删除,则标删除 + if($bjinfo->delete_time != null) + { + $bjtitle = $bjtitle.'(删)'; + } - // return $bjtitle; - // } + return $bjtitle; + } // /** // * 获取考试时的班级名称(数字格式5.1) // * $jdshijian 考试开始时间 // * $ruxuenian 年级 // * $paixu 班级 - // * 返回 $str 班级名称 - // * */ + // * 返回 $str 班级名称 + // * */ // public function myBanjiNum($bjid,$jdshijian=0) // { // // 查询班级信息 diff --git a/app/teach/view/subject/index.html b/app/teach/view/subject/index.html index acc4933e..d8767294 100644 --- a/app/teach/view/subject/index.html +++ b/app/teach/view/subject/index.html @@ -44,7 +44,7 @@ @@ -104,42 +104,6 @@ }; }); - //监听指定开关 - lForm.on('switch(kaoshi)', function(data){ - - var statusval; - var title; - if(data.elem.checked ==true){ - statusval=1; - title='参加考试'; - }else{ - statusval=0; - title='取消参加考试'; - } - // 设置修改后的状态值 - layer.confirm('确认要'+title+'吗?',function(index){ - $.ajax({ - url:'/teach/subject/kaoshi', - type:'POST', - data:{ - id:data.elem.id, - value: statusval, - }, - success:function(result){ - if(result.val == 1){ - layer.msg('已'+title); - }else{ - layer.msg('数据处理错误!',function(){}); - } - }, - error:function(result){ - layer.msg('数据扔半道啦。',function(){}); - }, - }); - }); - }); - - }); -{/block} \ No newline at end of file +{/block} diff --git a/database/migrations/20181010035225_system_base.php b/database/migrations/20181010035225_system_base.php index 5fabd7fc..7c690893 100644 --- a/database/migrations/20181010035225_system_base.php +++ b/database/migrations/20181010035225_system_base.php @@ -26,7 +26,7 @@ class SystemBase extends Migrator * Remember to call "create()" or "update()" and NOT "save()" when working * with the Table class. */ - public function change() + public function up() { // 定义表的名称 $table = $this->table('system_base'); diff --git a/database/migrations/20181010075304_auth_group.php b/database/migrations/20181010075304_auth_group.php index c5741659..9fda2e6b 100644 --- a/database/migrations/20181010075304_auth_group.php +++ b/database/migrations/20181010075304_auth_group.php @@ -26,7 +26,7 @@ class AuthGroup extends Migrator * Remember to call "create()" or "update()" and NOT "save()" when working * with the Table class. */ - public function change() + public function up() { // 定义数据表名称 $table = $this->table('auth_group'); diff --git a/database/migrations/20181010075517_auth_group_access.php b/database/migrations/20181010075517_auth_group_access.php index 666a62cd..5b184d75 100644 --- a/database/migrations/20181010075517_auth_group_access.php +++ b/database/migrations/20181010075517_auth_group_access.php @@ -26,7 +26,7 @@ class AuthGroupAccess extends Migrator * Remember to call "create()" or "update()" and NOT "save()" when working * with the Table class. */ - public function change() + public function up() { // 定义数据表名称 $table = $this->table('auth_group_access'); diff --git a/database/migrations/20181010075553_auth_rule.php b/database/migrations/20181010075553_auth_rule.php index 39117a0e..3d2438e2 100644 --- a/database/migrations/20181010075553_auth_rule.php +++ b/database/migrations/20181010075553_auth_rule.php @@ -26,7 +26,7 @@ class AuthRule extends Migrator * Remember to call "create()" or "update()" and NOT "save()" when working * with the Table class. */ - public function change() + public function up() { // 定义数据表名称 $table = $this->table('auth_rule'); diff --git a/database/migrations/20181012140355_member.php b/database/migrations/20181012140355_member.php index 4c2cdef6..a933408a 100644 --- a/database/migrations/20181012140355_member.php +++ b/database/migrations/20181012140355_member.php @@ -26,7 +26,7 @@ class Member extends Migrator * Remember to call "create()" or "update()" and NOT "save()" when working * with the Table class. */ - public function change() + public function up() { // 定义数据表名称 $table = $this->table('admin'); @@ -37,7 +37,7 @@ class Member extends Migrator ->addColumn('sex','boolean',['limit'=>1,'default'=>'2','null'=>false,'default'=>2,'comment'=>'0=女,1=男,2=未知']) ->addColumn('shengri','integer',['limit'=>11,'null'=>true,'comment'=>'出生日期']) ->addColumn('username','string',['limit'=>20,'null'=>false,'default'=>'a','comment'=>'用户帐号']) - ->addColumn('password','string',['limit'=>37,'null'=>false,'default'=>'$apr1$RSUodBwI$zOhVq9RQWfQDOW2sbeCDS1','comment'=>'登录密码']) + ->addColumn('password','string',['limit'=>137,'null'=>false,'default'=>'$apr1$RSUodBwI$zOhVq9RQWfQDOW2sbeCDS1','comment'=>'登录密码']) ->addColumn('teacher_id','string',['limit'=>11,'null'=>true,'comment'=>'教师编号']) ->addColumn('school','integer',['limit'=>11,'null'=>false,'default'=>0,'comment'=>'所在单位']) ->addColumn('phone','string',['limit'=>11,'null'=>true,'comment'=>'联系方式']) diff --git a/database/migrations/20181025041505_category.php b/database/migrations/20181025041505_category.php index e3c8ed1a..91028560 100644 --- a/database/migrations/20181025041505_category.php +++ b/database/migrations/20181025041505_category.php @@ -26,7 +26,7 @@ class Category extends Migrator * Remember to call "create()" or "update()" and NOT "save()" when working * with the Table class. */ - public function change() + public function up() { // 定义数据表名称 $table = $this->table('category'); diff --git a/database/migrations/20181026002455_school.php b/database/migrations/20181026002455_school.php index c73e2159..afbd6a53 100644 --- a/database/migrations/20181026002455_school.php +++ b/database/migrations/20181026002455_school.php @@ -26,7 +26,7 @@ class School extends Migrator * Remember to call "create()" or "update()" and NOT "save()" when working * with the Table class. */ - public function change() + public function up() { // 定义数据表名称 $table = $this->table('school'); diff --git a/database/migrations/20181028023517_teacher.php b/database/migrations/20181028023517_teacher.php index a70f27b8..9726a4c2 100644 --- a/database/migrations/20181028023517_teacher.php +++ b/database/migrations/20181028023517_teacher.php @@ -26,7 +26,7 @@ class Teacher extends Migrator * Remember to call "create()" or "update()" and NOT "save()" when working * with the Table class. */ - public function change() + public function up() { // 定义数据表名称 $table = $this->table('teacher'); diff --git a/database/migrations/20181028024920_xueqi.php b/database/migrations/20181028024920_xueqi.php index 957ac6cc..6fe087e5 100644 --- a/database/migrations/20181028024920_xueqi.php +++ b/database/migrations/20181028024920_xueqi.php @@ -26,7 +26,7 @@ class Xueqi extends Migrator * Remember to call "create()" or "update()" and NOT "save()" when working * with the Table class. */ - public function change() + public function up() { // 定义数据表名称 $table = $this->table('xueqi'); diff --git a/database/migrations/20181028025648_kaoshi.php b/database/migrations/20181028025648_kaoshi.php index 3d62fdb3..f01065b0 100644 --- a/database/migrations/20181028025648_kaoshi.php +++ b/database/migrations/20181028025648_kaoshi.php @@ -26,7 +26,7 @@ class Kaoshi extends Migrator * Remember to call "create()" or "update()" and NOT "save()" when working * with the Table class. */ - public function change() + public function up() { // 定义数据表名称 $table = $this->table('kaoshi'); diff --git a/database/migrations/20181030024954_subject.php b/database/migrations/20181030024954_subject.php index 3460be8e..6d1de77f 100644 --- a/database/migrations/20181030024954_subject.php +++ b/database/migrations/20181030024954_subject.php @@ -26,7 +26,7 @@ class Subject extends Migrator * Remember to call "create()" or "update()" and NOT "save()" when working * with the Table class. */ - public function change() + public function up() { // 定义数据表名称 $table = $this->table('subject'); diff --git a/database/migrations/20181101040801_fields.php b/database/migrations/20181101040801_fields.php index 1958b5d5..5e3cd8ad 100644 --- a/database/migrations/20181101040801_fields.php +++ b/database/migrations/20181101040801_fields.php @@ -26,7 +26,7 @@ class Fields extends Migrator * Remember to call "create()" or "update()" and NOT "save()" when working * with the Table class. */ - public function change() + public function up() { // 定义数据表名称 $table = $this->table('fields'); diff --git a/database/migrations/20181102003411_student.php b/database/migrations/20181102003411_student.php index f9691c5b..b7576437 100644 --- a/database/migrations/20181102003411_student.php +++ b/database/migrations/20181102003411_student.php @@ -26,7 +26,7 @@ class Student extends Migrator * Remember to call "create()" or "update()" and NOT "save()" when working * with the Table class. */ - public function change() + public function up() { // 定义数据表名称 $table = $this->table('student'); diff --git a/database/migrations/20181102004156_banji.php b/database/migrations/20181102004156_banji.php index 48a48b54..b9fad252 100644 --- a/database/migrations/20181102004156_banji.php +++ b/database/migrations/20181102004156_banji.php @@ -26,7 +26,7 @@ class Banji extends Migrator * Remember to call "create()" or "update()" and NOT "save()" when working * with the Table class. */ - public function change() + public function up() { // 定义数据表名称 $table = $this->table('banji'); diff --git a/database/migrations/20181114055804_kaohao.php b/database/migrations/20181114055804_kaohao.php index e24b3400..10be7e54 100644 --- a/database/migrations/20181114055804_kaohao.php +++ b/database/migrations/20181114055804_kaohao.php @@ -26,7 +26,7 @@ class Kaohao extends Migrator * Remember to call "create()" or "update()" and NOT "save()" when working * with the Table class. */ - public function change() + public function up() { // 定义数据表名称 $table = $this->table('kaohao'); diff --git a/database/migrations/20181218041034_dw_rongyu.php b/database/migrations/20181218041034_dw_rongyu.php index 875f75fb..01012a66 100644 --- a/database/migrations/20181218041034_dw_rongyu.php +++ b/database/migrations/20181218041034_dw_rongyu.php @@ -26,7 +26,7 @@ class DwRongyu extends Migrator * Remember to call "create()" or "update()" and NOT "save()" when working * with the Table class. */ - public function change() + public function up() { // 定义数据表名称 $table = $this->table('dw_rongyu'); diff --git a/database/migrations/20181221041509_js_rongyu.php b/database/migrations/20181221041509_js_rongyu.php index 5dbe3735..8b174914 100644 --- a/database/migrations/20181221041509_js_rongyu.php +++ b/database/migrations/20181221041509_js_rongyu.php @@ -26,7 +26,7 @@ class JsRongyu extends Migrator * Remember to call "create()" or "update()" and NOT "save()" when working * with the Table class. */ - public function change() + public function up() { // 定义数据表名称 $table = $this->table('js_rongyu'); diff --git a/database/migrations/20181221041523_js_rongyu_info.php b/database/migrations/20181221041523_js_rongyu_info.php index 661dcece..f56f7580 100644 --- a/database/migrations/20181221041523_js_rongyu_info.php +++ b/database/migrations/20181221041523_js_rongyu_info.php @@ -26,7 +26,7 @@ class JsRongyuInfo extends Migrator * Remember to call "create()" or "update()" and NOT "save()" when working * with the Table class. */ - public function change() + public function up() { // 定义数据表名称 $table = $this->table('js_rongyu_info'); diff --git a/database/migrations/20181227061353_dw_rongyu_canyu.php b/database/migrations/20181227061353_dw_rongyu_canyu.php index bf9e3d8b..50df7ee2 100644 --- a/database/migrations/20181227061353_dw_rongyu_canyu.php +++ b/database/migrations/20181227061353_dw_rongyu_canyu.php @@ -26,7 +26,7 @@ class DwRongyuCanyu extends Migrator * Remember to call "create()" or "update()" and NOT "save()" when working * with the Table class. */ - public function change() + public function up() { // 定义数据表名称 $table = $this->table('dw_rongyu_canyu'); diff --git a/database/migrations/20190214052203_js_rongyu_canyu.php b/database/migrations/20190214052203_js_rongyu_canyu.php index 482c6694..51efe209 100644 --- a/database/migrations/20190214052203_js_rongyu_canyu.php +++ b/database/migrations/20190214052203_js_rongyu_canyu.php @@ -26,7 +26,7 @@ class JsRongyuCanyu extends Migrator * Remember to call "create()" or "update()" and NOT "save()" when working * with the Table class. */ - public function change() + public function up() { // 定义数据表名称 $table = $this->table('js_rongyu_canyu'); diff --git a/database/migrations/20190218055858_keti.php b/database/migrations/20190218055858_keti.php index 8ee2bd69..e2983ab9 100644 --- a/database/migrations/20190218055858_keti.php +++ b/database/migrations/20190218055858_keti.php @@ -26,7 +26,7 @@ class Keti extends Migrator * Remember to call "create()" or "update()" and NOT "save()" when working * with the Table class. */ - public function change() + public function up() { // 定义数据表名称 $table = $this->table('keti'); diff --git a/database/migrations/20190222040223_keti_info.php b/database/migrations/20190222040223_keti_info.php index be76de48..b51f35be 100644 --- a/database/migrations/20190222040223_keti_info.php +++ b/database/migrations/20190222040223_keti_info.php @@ -26,7 +26,7 @@ class KetiInfo extends Migrator * Remember to call "create()" or "update()" and NOT "save()" when working * with the Table class. */ - public function change() + public function up() { // 定义数据表名称 $table = $this->table('keti_info'); diff --git a/database/migrations/20190222041040_keti_canyu.php b/database/migrations/20190222041040_keti_canyu.php index ffeb23ec..aeac3da2 100644 --- a/database/migrations/20190222041040_keti_canyu.php +++ b/database/migrations/20190222041040_keti_canyu.php @@ -26,7 +26,7 @@ class KetiCanyu extends Migrator * Remember to call "create()" or "update()" and NOT "save()" when working * with the Table class. */ - public function change() + public function up() { // 定义数据表名称 $table = $this->table('keti_canyu'); diff --git a/database/migrations/20190430034853_chengji.php b/database/migrations/20190430034853_chengji.php index dec526ac..4afea29d 100644 --- a/database/migrations/20190430034853_chengji.php +++ b/database/migrations/20190430034853_chengji.php @@ -26,7 +26,7 @@ class Chengji extends Migrator * Remember to call "create()" or "update()" and NOT "save()" when working * with the Table class. */ - public function change() + public function up() { // 定义数据表名称 $table = $this->table('chengji'); diff --git a/database/migrations/20200106012240_tongji_nj.php b/database/migrations/20200106012240_tongji_nj.php index 62d1048b..2cc850c7 100644 --- a/database/migrations/20200106012240_tongji_nj.php +++ b/database/migrations/20200106012240_tongji_nj.php @@ -26,7 +26,7 @@ class TongjiNj extends Migrator * Remember to call "create()" or "update()" and NOT "save()" when working * with the Table class. */ - public function change() + public function up() { // 定义数据表名称 $table = $this->table('tongji_nj'); diff --git a/database/migrations/20200106013922_tongji_bj.php b/database/migrations/20200106013922_tongji_bj.php index 0e3b0686..cd57d04a 100644 --- a/database/migrations/20200106013922_tongji_bj.php +++ b/database/migrations/20200106013922_tongji_bj.php @@ -26,7 +26,7 @@ class TongjiBj extends Migrator * Remember to call "create()" or "update()" and NOT "save()" when working * with the Table class. */ - public function change() + public function up() { // 定义数据表名称 $table = $this->table('tongji_bj'); diff --git a/database/migrations/20200107045207_tongji_sch.php b/database/migrations/20200107045207_tongji_sch.php index 99116fb9..63b4d412 100644 --- a/database/migrations/20200107045207_tongji_sch.php +++ b/database/migrations/20200107045207_tongji_sch.php @@ -26,7 +26,7 @@ class TongjiSch extends Migrator * Remember to call "create()" or "update()" and NOT "save()" when working * with the Table class. */ - public function change() + public function up() { // 定义数据表名称 $table = $this->table('tongji_sch'); diff --git a/database/migrations/202001132733_kaoshi_set.php b/database/migrations/202001132733_kaoshi_set.php index 1023d137..bdfbfdb6 100644 --- a/database/migrations/202001132733_kaoshi_set.php +++ b/database/migrations/202001132733_kaoshi_set.php @@ -26,7 +26,7 @@ class KaoshiSet extends Migrator * Remember to call "create()" or "update()" and NOT "save()" when working * with the Table class. */ - public function change() + public function up() { // 定义数据表名称 $table = $this->table('kaoshi_set'); @@ -40,6 +40,7 @@ class KaoshiSet extends Migrator ->addColumn('manfen','integer',['limit'=>3,'default'=>100,'null'=>false,'comment'=>'满分']) ->addColumn('youxiu','integer',['limit'=>3,'default'=>90,'null'=>false,'comment'=>'优秀']) ->addColumn('jige','integer',['limit'=>3,'default'=>00,'null'=>false,'comment'=>'及格']) + ->addColumn('luru','boolean',['default'=>1,'null'=>false,'comment'=>'是否允许录入成绩']) ->addColumn('status','boolean',['default'=>1,'null'=>false,'comment'=>'状态']) ->addColumn('create_time','integer',['limit'=>11,'default'=>'1539158918','null'=>false,'comment'=>'创建时间']) ->addColumn('update_time','integer',['limit'=>11,'default'=>'1539158918','null'=>false,'comment'=>'更新时间']) diff --git a/database/migrations/20200309035912_tongji_log.php b/database/migrations/20200309035912_tongji_log.php new file mode 100644 index 00000000..82f248cb --- /dev/null +++ b/database/migrations/20200309035912_tongji_log.php @@ -0,0 +1,44 @@ +table('tongji_log'); + + // 添加当前表字段 + $table + ->addColumn('kaoshi_id','integer',['limit'=>11,'default'=>'0','null'=>false,'comment'=>'考试ID']) + ->addColumn('category','string',['limit'=>25,'default'=>'a','null'=>false,'comment'=>'统计项目']) + ->addColumn('user_id','integer',['limit'=>11,'default'=>'0','null'=>false,'comment'=>'统计人ID']) + ->addColumn('create_time','integer',['limit'=>11,'default'=>'1539158918','null'=>false,'comment'=>'创建时间']) + ->addColumn('update_time','integer',['limit'=>11,'default'=>'1539158918','null'=>false,'comment'=>'更新时间']) + ->addColumn('delete_time','integer',['limit'=>11,'null'=>true,'comment'=>'删除时间']) + ->create(); + } +} diff --git a/database/seeds/Category.php b/database/seeds/Category.php index 70e6c43c..b278134d 100644 --- a/database/seeds/Category.php +++ b/database/seeds/Category.php @@ -49,7 +49,7 @@ class Category extends Seeder ['id'=>1011010,'title'=>'地方/校本课程','pid'=>110,'paixu'=>11,'isupdate'=>0], ['id'=>1011011,'title'=>'幼儿园全科','pid'=>110,'paixu'=>12,'isupdate'=>0], ['id'=>1011012,'title'=>'其它','pid'=>110,'paixu'=>13,'isupdate'=>0], - + // 文件 ['id'=>1011101,'title'=>'教师名单','pid'=>111,'paixu'=>1,'isupdate'=>0], ['id'=>1011102,'title'=>'学生名单','pid'=>111,'paixu'=>2,'isupdate'=>0], @@ -66,7 +66,7 @@ class Category extends Seeder ['title'=>'教育行政部门','pid'=>101,'paixu'=>8,'isupdate'=>0], ['title'=>'其他教育机构','pid'=>101,'paixu'=>9,'isupdate'=>0], // 单位级别 - ['title'=>'班级','pid'=>102,'paixu'=>1,'isupdate'=>0], + ['title'=>'班级','pid'=>102,'paixu'=>1,'status'=>0,'isupdate'=>0], ['title'=>'教研组','pid'=>102,'paixu'=>2,'isupdate'=>0], ['title'=>'校级','pid'=>102,'paixu'=>3,'isupdate'=>0], ['title'=>'区级','pid'=>102,'paixu'=>4,'isupdate'=>0], @@ -148,9 +148,9 @@ class Category extends Seeder ['title'=>'A.基础研究','pid'=>117,'paixu'=>1,'isupdate'=>0], ['title'=>'B.应用研究','pid'=>117,'paixu'=>2,'isupdate'=>0], ['title'=>'C.综合研究','pid'=>117,'paixu'=>3,'isupdate'=>0], - + ]; // 保存数据 $this->table('category')->insert($rows)->save(); } -} \ No newline at end of file +} diff --git a/database/seeds/Rule.php b/database/seeds/Rule.php index 89f4d8c8..8eb3b744 100644 --- a/database/seeds/Rule.php +++ b/database/seeds/Rule.php @@ -53,9 +53,9 @@ class Rule extends Seeder // 管理员管理 ['id'=>601,'title'=>'管理员列表','name'=>'admin/Index/index','paixu'=>1,'ismenu' =>1,'pid' =>6,'url'=>'/admin/index',], - ['id'=>602,'title'=>'权限列表','name'=>'admin/AuthRule/index','paixu'=>2,'ismenu' =>1,'pid' =>6,'url'=>'/admin/authrule',], + ['id'=>602,'title'=>'权限列表','name'=>'admin/AuthRule/index','paixu'=>2,'ismenu' =>1,'pid' =>6,'url'=>'/admin/Authrule'], ['id'=>603,'title'=>'角色列表','name'=>'admin/AuthGroup/index','paixu'=>3,'ismenu' =>1,'pid' =>6,'url'=>'/admin/authgroup',], - + // 系统设置 ['id'=>701,'title'=>'类别管理','name'=>'system/Category/index','paixu'=>1,'ismenu' =>1,'pid' =>7,'url'=>'/system/category',], ['id'=>702,'title'=>'单位管理','name'=>'system/School/index','paixu'=>2,'ismenu' =>1,'pid' =>7,'url'=>'/system/school',], @@ -70,8 +70,8 @@ class Rule extends Seeder // 荣誉管理 ['id'=>901,'title'=>'课题册','name'=>'keti/Ketice/index','paixu'=>1,'ismenu' =>1,'pid' =>9,'url'=>'/keti/ketice',], ['id'=>902,'title'=>'课题列表','name'=>'keti/KetiInfo/index','paixu'=>2,'ismenu' =>1,'pid' =>9,'url'=>'/keti/ketiinfo',], - - + + // 三级-权限 // 扫码录入 ['id'=>1000000000,'title'=>'扫码查询','name'=>'Chengji/Luru/read','paixu' =>1,'pid'=>101], @@ -80,8 +80,10 @@ class Rule extends Seeder ['title'=>'表格保存','name'=>'Chengji/Luru/saveAll','paixu' =>3,'pid'=>102], ['title'=>'表格上传','name'=>'Chengji/Luru/upload','paixu' =>4,'pid'=>102], ['title'=>'成绩更新','name'=>'Chengji/Luru/update','paixu' =>5,'pid'=>102], + // 成绩状态 + ['title'=>'成绩状态','name'=>'Chengji/Index/setStatus','paixu'=>4,'pid'=>103], + - // 考试管理 ['title'=>'添加','name'=>'Kaoshi/Index/create','paixu' =>1,'pid'=>301], ['title'=>'删除','name'=>'Kaoshi/Index/delete','paixu'=>2,'pid'=>301], @@ -89,12 +91,13 @@ class Rule extends Seeder ['title'=>'更新','name'=>'Kaoshi/Index/update','paixu'=>4,'pid'=>301,], ['title'=>'保存','name'=>'Kaoshi/Index/save','paixu'=>5,'pid'=>301,], ['title'=>'状态','name'=>'Kaoshi/Index/setStatus','paixu'=>6,'pid'=>301], + ['title'=>'操作成绩权限','name'=>'Kaoshi/Index/luru','paixu'=>7,'pid'=>301], // 考试操作 ['id'=>30201,'title'=>'前期操作','name'=>'kaoshicaozuo1','paixu'=>1,'pid'=>302], ['id'=>30202,'title'=>'成绩录入','name'=>'kaoshicaozuo2','paixu'=>2,'pid'=>302], ['id'=>30203,'title'=>'成绩统计','name'=>'kaoshicaozuo3','paixu'=>4,'pid'=>302], ['id'=>30204,'title'=>'统计结果','name'=>'kaoshicaozuo4','paixu'=>4,'pid'=>302], - + // 师生管理 @@ -104,14 +107,18 @@ class Rule extends Seeder ['title'=>'删除','name'=>'renshi/Student/delete','paixu'=>3,'pid'=>401], ['title'=>'编辑','name'=>'renshi/Student/edit','paixu'=>4,'pid'=>401,], ['title'=>'更新','name'=>'renshi/Student/update','paixu'=>5,'pid'=>401,], - ['title'=>'查看','name'=>'renshi/Student/read','paixu'=>6,'pid'=>401,], - ['title'=>'状态','name'=>'renshi/Student/setStatus','paixu'=>7,'pid'=>401], - ['title'=>'下载模板','name'=>'renshi/Student/download','paixu'=>8,'pid'=>401], - ['title'=>'校对导入','name'=>'renshi/Student/createAll','paixu'=>9,'pid'=>401], - ['title'=>'批量保存','name'=>'renshi/Student/saveAll','paixu'=>10,'pid'=>401], - ['title'=>'表格删除页面','name'=>'renshi/Student/deletes','paixu'=>11,'pid'=>401], - ['title'=>'表格删除数据','name'=>'renshi/Student/deleteXlsx','paixu'=>12,'pid'=>401], - + ['title'=>'查看信息','name'=>'renshi/Student/read','paixu'=>6,'pid'=>401,], + ['title'=>'状态','name'=>'renshi/Student/setStatus','paixu'=>8,'pid'=>401], + ['title'=>'下载模板','name'=>'renshi/Student/download','paixu'=>9,'pid'=>401], + ['title'=>'校对导入','name'=>'renshi/Student/createAll','paixu'=>10,'pid'=>401], + ['title'=>'批量保存','name'=>'renshi/Student/saveAll','paixu'=>11,'pid'=>401], + ['title'=>'表格删除页面','name'=>'renshi/Student/deletes','paixu'=>12,'pid'=>401], + ['title'=>'表格删除数据','name'=>'renshi/Student/deleteXlsx','paixu'=>13,'pid'=>401], + ['title'=>'查看成绩','name'=>'renshi/StudentChengji/index','paixu'=>7,'pid'=>401], + + + + // 毕业学生 ['title'=>'格式占位','name'=>'biyexueshengzhanwei','paixu' =>1,'pid'=>402], @@ -132,7 +139,7 @@ class Rule extends Seeder ['title'=>'批量保存','name'=>'renshi/Teacher/saveAll','paixu'=>10,'pid'=>404], ['title'=>'表格模板下载','name'=>'renshi/Teacher/downloadXls','paixu'=>11,'pid'=>404], ['title'=>'姓名转换VBA下载','name'=>'renshi/Teacher/downloadVba','paixu'=>12,'pid'=>404], - + // 删除教师 ['title'=>'恢复删除','name'=>'renshi/Teacher/reDel','paixu'=>1,'pid'=>405], @@ -247,7 +254,7 @@ class Rule extends Seeder ['title'=>'状态','name'=>'rongyu/JsRongyuInfo/setStatus','paixu'=>7,'pid'=>803], ['title'=>'批量上传','name'=>'rongyu/JsRongyuInfo/createAll','paixu'=>8,'pid'=>803], ['title'=>'批量保存','name'=>'rongyu/JsRongyuInfo/saveAll','paixu'=>9,'pid'=>803], - + // 课题管理 // 课题册 @@ -270,8 +277,9 @@ class Rule extends Seeder ['title'=>'状态','name'=>'keti/ketiinfo/setStatus','paixu'=>7,'pid'=>902], ['title'=>'批量上传','name'=>'keti/ketiinfo/createAll','paixu'=>8,'pid'=>902], ['title'=>'批量保存','name'=>'keti/ketiinfo/saveAll','paixu'=>9,'pid'=>902], - ['title'=>'结题','name'=>'keti/ketiinfo/jieTi','paixu'=>10,'pid'=>902], - ['title'=>'下载','name'=>'keti/KetiInfo/outXlsx','paixu'=>11,'pid'=>902], + ['title'=>'结题编辑','name'=>'keti/ketiinfo/jieTi','paixu'=>10,'pid'=>902], + ['title'=>'结题更新','name'=>'keti/ketiinfo/jtUpdate','paixu'=>11,'pid'=>902], + ['title'=>'下载','name'=>'keti/KetiInfo/outXlsx','paixu'=>12,'pid'=>902], // 四级权限 @@ -281,9 +289,11 @@ class Rule extends Seeder ['title'=>'新建','name'=>'kaoshi/kaoshiset/create','paixu'=>1,'pid'=>3020101], ['title'=>'保存','name'=>'kaoshi/kaoshiset/save','paixu'=>2,'pid'=>3020101], ['title'=>'删除','name'=>'kaoshi/kaoshiset/delete','paixu'=>3,'pid'=>3020101], + ['title'=>'编辑','name'=>'kaoshi/kaoshiset/edit','paixu'=>4,'pid'=>3020101], + ['title'=>'更新','name'=>'kaoshi/kaoshiset/update','paixu'=>5,'pid'=>3020101], + ['title'=>'状态','name'=>'kaoshi/kaoshiset/setStatus','paixu'=>6,'pid'=>3020101], - ['title'=>'生成考号','name'=>'kaoshi/Kaohao/create','paixu'=>2,'pid'=>30201], - ['title'=>'保存考号','name'=>'kaoshi/Kaohao/save','paixu'=>3,'pid'=>30201], + ['title'=>'批量生成考号','name'=>'kaoshi/Kaohao/createall','paixu'=>2,'pid'=>30201], ['title'=>'下载试卷标签信息','name'=>'kaoshi/Kaohao/biaoqian','paixu'=>4,'pid'=>30201], @@ -297,6 +307,7 @@ class Rule extends Seeder ['title'=>'统计学生成绩在班级位置','name'=>'chengji/Bjtongji/bjorder','paixu'=>4,'pid'=>30203], ['title'=>'统计学生成绩在学校位置','name'=>'chengji/Njtongji/njorder','paixu'=>5,'pid'=>30203], ['title'=>'统计学生成绩在区位置','name'=>'chengji/Schtongji/schorder','paixu'=>6,'pid'=>30203], + ['title'=>'检测统计结果','name'=>'kaoshi/tjlog/index','paixu'=>7,'pid'=>30203], // 成绩列表 // 学生成绩 @@ -304,12 +315,13 @@ class Rule extends Seeder ['title'=>'录入人信息','name'=>'Chengji/Index/readAdd','paixu'=>1,'pid'=>3020401], ['title'=>'考号删除','name'=>'kaoshi/Kaohao/delete','paixu'=>2,'pid'=>3020401], ['title'=>'删除成绩','name'=>'Chengji/Index/delete','paixu'=>3,'pid'=>3020401], - ['title'=>'成绩状态','name'=>'Chengji/Index/setStatus','paixu'=>4,'pid'=>3020401], - ['title'=>'批量删除界面','name'=>'Chengji/Index/deletecjs','paixu'=>5,'pid'=>3020401], - ['title'=>'批量删除','name'=>'Chengji/Index/deletecjmore','paixu'=>6,'pid'=>3020401], - ['title'=>'下载学生成绩条','name'=>'Chengji/Index/dwChengjitiao','paixu'=>7,'pid'=>3020401], - ['title'=>'添加考号','name'=>'Kaoshi/Kaohao/addOne','paixu'=>8,'pid'=>3020401], - ['title'=>'下载学生成绩','name'=>'chengji/Index/dwChengji','paixu'=>9,'pid'=>3020401], + ['title'=>'批量删除界面','name'=>'Chengji/Index/deletecjs','paixu'=>4,'pid'=>3020401], + ['title'=>'批量删除','name'=>'Chengji/Index/deletecjmore','paixu'=>5,'pid'=>3020401], + ['title'=>'下载学生成绩条','name'=>'Chengji/Index/dwChengjitiao','paixu'=>6,'pid'=>3020401], + ['title'=>'添加单个考号','name'=>'Kaoshi/Kaohao/create','paixu'=>7,'pid'=>3020401], + ['title'=>'保存单个考号','name'=>'Kaoshi/Kaohao/save','paixu'=>8,'pid'=>3020401], + ['title'=>'学生成绩图表','name'=>'kaoshi/kaohao/read','paixu'=>9,'pid'=>3020401], + ['title'=>'下载学生成绩','name'=>'chengji/Index/dwChengji','paixu'=>10,'pid'=>3020401], // 班级成绩统计表 ['id'=>3020402,'title'=>'班级成绩','name'=>'banjichengji','paixu'=>2,'pid'=>30204], ['title'=>'班级成绩统计','name'=>'Chengji/Bjtongji/biaoge','paixu'=>1,'pid'=>3020402], @@ -322,10 +334,12 @@ class Rule extends Seeder ['title'=>'下载年级成绩统计表','name'=>'chengji/Njtongji/dwBiaoge','paixu'=>2,'pid'=>3020403], ['title'=>'条形统计图','name'=>'chengji/Njtongji/myavg','paixu'=>3,'pid'=>3020403], ['title'=>'箱体图','name'=>'chengji/Njtongji/myxiangti','paixu'=>4,'pid'=>3020403], + // 统计记录 + ['id'=>3020404,'title'=>'统计记录','name'=>'kaoshi/TongjiLog/index','paixu'=>4,'pid'=>30204], ]; // 保存数据 $this->table('auth_rule')->insert($rows)->save(); } -} \ No newline at end of file +} diff --git a/database/seeds/Subject.php b/database/seeds/Subject.php index bff88c58..fa091433 100644 --- a/database/seeds/Subject.php +++ b/database/seeds/Subject.php @@ -45,4 +45,4 @@ class Subject extends Seeder // 保存数据 $this->table('subject')->insert($rows)->save(); } -} \ No newline at end of file +} diff --git a/public/examples/学生单次考试成绩.png b/public/examples/学生单次考试成绩.png new file mode 100644 index 00000000..a850c3bf Binary files /dev/null and b/public/examples/学生单次考试成绩.png differ diff --git a/public/examples/学生成绩.png b/public/examples/学生成绩.png new file mode 100644 index 00000000..a1c74c59 Binary files /dev/null and b/public/examples/学生成绩.png differ diff --git a/public/examples/学生成绩图表.png b/public/examples/学生成绩图表.png new file mode 100644 index 00000000..292d1aaa Binary files /dev/null and b/public/examples/学生成绩图表.png differ diff --git a/public/static/x-admin2.2/js/cjgl.js b/public/static/x-admin2.2/js/cjgl.js index e4f243a9..6549b848 100644 --- a/public/static/x-admin2.2/js/cjgl.js +++ b/public/static/x-admin2.2/js/cjgl.js @@ -1,393 +1,411 @@ -/** +/** 扩展cjgl模块 - **/ + **/ layui.define(['table'],function(exports){ //提示:模块也可以依赖其它模块,如:layui.define('layer', callback); - var table = layui.table - form = layui.form; - var obj = { + var table = layui.table + form = layui.form; + var obj = { // 新建弹窗 add: function(title,url,width='',height='',max=false){ - xadmin.open(title,url,width,height,max); + xadmin.open(title,url,width,height,max); }, // 删除单条记录 del:function(obj,url){ - layer.confirm('确认要删除吗?',function(index){ - $.ajax({ - url:url+'/m', - type:'DELETE', - data:{ - ids:obj.data.id - }, - success:function(result){ - if(result.val == 1) - { - obj.del(); - layer.msg(result.msg); - }else{ - layer.msg(result.msg,function(){}); - } - }, - error:function(result){ - layer.msg('数据扔半道啦。',function(){}); - }, - }); + layer.confirm('确认要删除吗?',function(index){ + $.ajax({ + url:url+'/m', + type:'DELETE', + data:{ + ids:obj.data.id + }, + success:function(result){ + if(result.val == 1) + { + obj.del(); + layer.msg(result.msg); + }else{ + layer.msg(result.msg,function(){}); + } + }, + error:function(result){ + layer.msg('数据扔半道啦。',function(){}); + }, }); + }); }, // 删除单条记录 redel:function(obj,url){ - layer.confirm('确认要恢复删除吗?',function(index){ - $.ajax({ - url:url+'/'+obj.data.id, - type:'DELETE', - data:{ - id:obj.data.id - }, - success:function(result){ - if(result.val == 1) - { - obj.del(); - layer.msg(result.msg); - }else{ - layer.msg(result.msg,function(){}); - } - }, - error:function(result){ - layer.msg('数据扔半道啦。',function(){}); - }, - }); + layer.confirm('确认要恢复删除吗?',function(index){ + $.ajax({ + url:url+'/'+obj.data.id, + type:'DELETE', + data:{ + id:obj.data.id + }, + success:function(result){ + if(result.val == 1) + { + obj.del(); + layer.msg(result.msg); + }else{ + layer.msg(result.msg,function(){}); + } + }, + error:function(result){ + layer.msg('数据扔半道啦。',function(){}); + }, }); + }); }, // 删除全部 delAll:function(obj,url,tableid){ //判断是否选择数据 if(obj.data.length==0){ - parent.layer.msg('请先选择要删除的数据行!',function(){}); - return ; + parent.layer.msg('请先选择要删除的数据行!',function(){}); + return ; } layer.confirm('确认要删除吗?',function(index){ - // 捉一下所有被选中的数据 - var ids = ""; - for(var i=0;i
    请选择
    '); - // 声明变量 - var mydl = srcInput.next().children('dl'); + // 声明变量 + var srcInput = $(myobj); + // 删除原来列表 + srcInput.next().remove(); + // 添加列表div + srcInput.after('
    请选择
    '); + // 声明变量 + var mydl = srcInput.next().children('dl'); - // 获取数据 - $.post( - "/renshi/teacher/srcteacher", - { - "str":val, - }, - function(data,status){ - - if($.isEmptyObject(data)) - { - return true; - } - for (var i = data.length - 1; i >= 0; i--) { - mydl.append('
    '+data[i].xingming+' '+data[i].jsDanwei.jiancheng+' '+data[i].shengri+'
    '); - } - } + // 获取数据 + $.post( + "/renshi/teacher/srcteacher", + { + "str":val, + }, + function(data,status){ + + if($.isEmptyObject(data)) + { + return true; + } + for (var i = data.length - 1; i >= 0; i--) { + mydl.append('
    '+data[i].xingming+' '+data[i].jsDanwei.jiancheng+' '+data[i].shengri+'
    '); + } + } ); - }, + }, // 添加教师 addTeacher:function(myobj){ - var myId = $(myobj).attr('id') - ,teachername = $(myobj).attr('teachername') - ,addname = $(myobj).attr('addname') - ,myTitle = $(myobj).text() - ,myList = $(myobj).parent().parent() - ,myBut = $(myList).parent().parent(); + var myId = $(myobj).attr('id') + ,teachername = $(myobj).attr('teachername') + ,addname = $(myobj).attr('addname') + ,myTitle = $(myobj).text() + ,myList = $(myobj).parent().parent() + ,myBut = $(myList).parent().parent(); - if(myId){ - $(myBut).append('
    '+teachername+'
    '); - } - $(myList).prev().val(''); - $(myList).remove(); + if(myId){ + $(myBut).append('
    '+teachername+'
    '); + } + $(myList).prev().val(''); + $(myList).remove(); }, // Select获取焦点 selectOnfocus1:function(myobj,val,addname){ - // 声明变量 - var srcInput = $(myobj); - // 删除原来列表 - srcInput.next().remove(); + // 声明变量 + var srcInput = $(myobj); + // 删除原来列表 + srcInput.next().remove(); - // 添加列表div - srcInput.after('
    请选择
    '); - // 声明变量 - var mydl = srcInput.next().children('dl'); + // 添加列表div + srcInput.after('
    请选择
    '); + // 声明变量 + var mydl = srcInput.next().children('dl'); - // 获取数据 - $.post( - "/renshi/teacher/srcteacher", - { - "str":val, - }, - function(data,status){ - - if($.isEmptyObject(data)) - { - return true; - } - for (var i = data.length - 1; i >= 0; i--) { - mydl.append('
    '+data[i].xingming+' '+data[i].jsDanwei.jiancheng+' '+data[i].shengri+'
    '); - } - } + // 获取数据 + $.post( + "/renshi/teacher/srcteacher", + { + "str":val, + }, + function(data,status){ + + if($.isEmptyObject(data)) + { + return true; + } + for (var i = data.length - 1; i >= 0; i--) { + mydl.append('
    '+data[i].xingming+' '+data[i].jsDanwei.jiancheng+' '+data[i].shengri+'
    '); + } + } ); - }, + }, // 添加教师 addTeacher1:function(myobj){ - var myId = $(myobj).attr('id') - ,teachername = $(myobj).attr('teachername') - ,addname = $(myobj).attr('addname') - ,myTitle = $(myobj).text() - ,myList = $(myobj).parent().parent() - ,myBut = $(myList).parent().parent(); + var myId = $(myobj).attr('id') + ,teachername = $(myobj).attr('teachername') + ,addname = $(myobj).attr('addname') + ,myTitle = $(myobj).text() + ,myList = $(myobj).parent().parent() + ,myBut = $(myList).parent().parent(); - $(myList).prev().val(myId); - $(myList).remove(); + $(myList).prev().val(myId); + $(myList).remove(); }, // 删除教师 delTeacher:function(myobj){ - $(myobj).parent().remove(); + $(myobj).parent().remove(); }, - /** - * 动太获取复选框列表并添加列表 - * - * @access public - * @param parentId 要添加checkbox的divID - * @param array val post时需要的参数 + /** + * 动太获取复选框列表并添加列表 + * + * @access public + * @param parentId 要添加checkbox的divID + * @param array val post时需要的参数 * @param url post地址 * @param createName 新checkbox名 * @param title 输出返回数组的列 * @return array 返回类型 - */ + */ createCheckbox:function(parentId,val,url,createName,title='title'){ - $('#'+parentId).children().remove(); - $.post( - url, - val, - function(data,status){ - if(data.count){ - cnt = data.count; - mydata = data.data; - }else{ - cnt = 0; - mydata = Array(); - } - - if(cnt>0){ - $('#'+parentId).append(''); - } - for(x in mydata){ - $('#'+parentId).append(''); - } - form.render(); - } + $('#'+parentId).children().remove(); + $.post( + url, + val, + function(data,status){ + if(data.count){ + cnt = data.count; + mydata = data.data; + }else{ + cnt = 0; + mydata = Array(); + } + + if(cnt>0){ + $('#'+parentId).append(''); + } + for(x in mydata){ + $('#'+parentId).append(''); + } + form.render(); + } ); }, - /** - * 动太获取复选框列表并添加列表 - * - * @access public - * @param idd 要添加select的ID - * @param array val post时需要的参数 + /** + * 动太获取复选框列表并添加列表 + * + * @access public + * @param idd 要添加select的ID + * @param array val post时需要的参数 * @param url post地址 * @param createName 新checkbox名 * @param title 输出返回数组的列 * @return array 返回类型 - */ + */ createSelectOption:function(id,val,url,cloval='id',cloname='title'){ - $('#'+id).children().remove(); - $.post( - url, - val, - function(data,status){ - cnt = data.count; - mydata = data.data; - if(cnt>0){ - $('#'+id).append(''); - } - for(x in mydata){ - $('#'+id).append(''); - } - form.render(); - } - ); + $('#'+id).children().remove(); + $.post( + url, + val, + function(data,status){ + cnt = data.count; + mydata = data.data; + if(cnt>0){ + $('#'+id).append(''); + } + for(x in mydata){ + $('#'+id).append(''); + } + form.render(); + } + ); }, - /** + /** * 单击全选按钮,全部选中或取消选中后面的checkbox - * 选中所有全部checkbox - * - * @access public + * 选中所有全部checkbox + * + * @access public * @param parentId 选中checkbox父级div的id - * @param checked post时需要的参数 + * @param checked post时需要的参数 * @return array 返回类型 - */ + */ checkboxAll:function(parentId,checked){ - if(checked==true) - { - $('#'+parentId).find("input[checkall='c']").prop('checked',true); - }else{ - $('#'+parentId).find("input[checkall='c']").prop('checked',false); - } - form.render(); + if(checked==true) + { + $('#'+parentId).find("input[checkall='c']").prop('checked',true); + }else{ + $('#'+parentId).find("input[checkall='c']").prop('checked',false); + } + form.render(); }, - /** - * 如果有选中的checkbox,那么就选中全选按钮,否则取消选中 - * - * @access public + /** + * 如果有选中的checkbox,那么就选中全选按钮,否则取消选中 + * + * @access public * @param parentId 选中checkbox父级div的id * @return array 返回类型 - */ + */ checkboxParent:function(parentId){ - children = $('#'+parentId).find(".layui-form-checked").prev("input[checkall='c']"); - children = children.length; - if(children==0) - { - $('#'+parentId).find("input[checkall='p']").prop('checked',false); - }else{ - $('#'+parentId).find("input[checkall='p']").prop('checked',true); - } - form.render(); + children = $('#'+parentId).find(".layui-form-checked").prev("input[checkall='c']"); + children = children.length; + if(children==0) + { + $('#'+parentId).find("input[checkall='p']").prop('checked',false); + }else{ + $('#'+parentId).find("input[checkall='p']").prop('checked',true); + } + form.render(); }, - /** - * 在创建角色中,选中类别时的动作 - * - * @access public + /** + * 在创建角色中,选中类别时的动作 + * + * @access public * @param id 选中复选框的ID * @param checked 选中复选框的状态 * @return array 返回类型 - */ + */ checkedAuth:function(id,checed){ - obj = $('#p'+id).html(); - aa = $('#p'+id).find("input[type='checkbox']").prop('checked',checked); - form.render(); + obj = $('#p'+id).html(); + aa = $('#p'+id).find("input[type='checkbox']").prop('checked',checked); + form.render(); }, + /** + * 成绩统计 + * @access public + * @param id 选中复选框的ID + * @param checked 选中复选框的状态 + * @return array 返回类型 + */ + tongjiCj:function(url,val){ + $.ajax({ + url:url, + type:'POST', + async: true, + data:val, + beforeSend: function () { + $("body").append('
    '); + }, + complete: function () { + $("#load").remove(); + }, + success:function(result){ + layer.msg(result.msg); + }, + error:function(result){ + layer.msg('数据扔半道,回不来啦。',function(){}); + }, + }); + }, + + + }; //输出test接口 exports('cjgl', obj); -}); \ No newline at end of file +}); diff --git a/view/list.html b/view/list.html index 9984f080..ca153024 100644 --- a/view/list.html +++ b/view/list.html @@ -1,6 +1,6 @@ - + {$list.webtitle} @@ -30,7 +30,7 @@ })(); - +
    {block name="nav"}{/block} @@ -57,12 +57,14 @@ {block name="table"}{/block} {block name="echart"}{/block}
    - + - + {block name="myjs"}{/block} - \ No newline at end of file +