From 3f8574df3420f9f96abd15c383c5c5fa5ba36890 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B7=B4=E6=8E=8C?= Date: Tue, 11 Dec 2018 16:36:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=80=83=E8=AF=95=E6=9B=B4?= =?UTF-8?q?=E5=A4=9A=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/chengji/controller/Index.php | 47 ++++++++-- application/chengji/controller/Tongji.php | 17 +++- application/chengji/validate/Cjdownload.php | 26 ++++++ application/chengji/view/index/download.html | 71 ++++++++++------ .../chengji/view/tongji/downloadnj.html | 85 +++++++++++++++++++ application/common/view/create.html | 5 +- .../kaoshi/view/more_action/caiji.html | 1 - .../kaoshi/view/more_action/index.html | 39 +++++++-- public/error/error.tpl | 8 +- route/chengji.php | 8 +- 10 files changed, 259 insertions(+), 48 deletions(-) create mode 100644 application/chengji/validate/Cjdownload.php create mode 100644 application/chengji/view/tongji/downloadnj.html diff --git a/application/chengji/controller/Index.php b/application/chengji/controller/Index.php index a891d58b..81e191b8 100644 --- a/application/chengji/controller/Index.php +++ b/application/chengji/controller/Index.php @@ -151,14 +151,12 @@ class Index extends Base $data = $cjmod->saveAll($cj); // 判断成绩更新结果 - empty($cj) ? $data = ['msg'=>'上传失败','val' => 0] : $data = ['msg'=>'上传成功','val' => 1,]; - ob_flush(); - flush(); + empty($cj) ? $data=['msg'=>'上传失败','val'=>0] : $data=['msg'=>'上传成功','val'=>1]; // 返回成绩结果 return json($data); - - + ob_flush(); + flush(); } @@ -379,18 +377,33 @@ class Index extends Base //生成学生表格 public function chengjixls() { + // 实例化验证模型 + $validate = new \app\teach\validate\Kaoshi; + // 验证表单数据 + $result = $validate->check($list); + $msg = $validate->getError(); + + + set_time_limit(0); $list = input(); $id = $list['id']; // 获取数据库信息 $chengjiinfo = Chengji::where('kaoshi',$id) ->where('banji','in',$list['banjiids']) - ->order(['ruxuenian','stuAvg'=>'desc']) + ->order(['stuAvg'=>'desc']) ->append(['cj_student.xingming','cj_banji.title']) ->select(); // 获取考试标题 $ks = Kaoshi::where('id',$id)->find('title'); + + // 实例化成绩统计模型 + $tj = new \app\chengji\model\Tongji(); + // 获取统计成绩参数 + $canshu = $tj->getCanshu($id); + $tj = $tj->tongji($chengjiinfo,$canshu); + // 创建表格 @@ -407,6 +420,16 @@ class Index extends Base $sheet->setCellValue('F2', '英语'); $sheet->setCellValue('G2', '平均分'); $sheet->setCellValue('H2', '总分'); + $sheet->setCellValue('J2', '项目'); + $sheet->setCellValue('K2', '语文'); + $sheet->setCellValue('L2', '数学'); + $sheet->setCellValue('M2', '英语'); + $sheet->setCellValue('J3', '人数'); + $sheet->setCellValue('J4', '平均分'); + $sheet->setCellValue('J5', '优秀率'); + $sheet->setCellValue('J6', '及格率'); + $sheet->setCellValue('J7', '标准差'); + // 循环写出信息 @@ -427,6 +450,18 @@ class Index extends Base } } + // 循环写出统计结果 + $x = 11; + $lieming = array(11=>'K',12=>'L',13=>'M'); + foreach ($tj as $key => $value) { + $sheet->setCellValue($lieming[$x].'3', $value['cnt']); + $sheet->setCellValue($lieming[$x].'4', $value['avg']); + $sheet->setCellValue($lieming[$x].'5', $value['youxiu']); + $sheet->setCellValue($lieming[$x].'6', $value['jige']); + $sheet->setCellValue($lieming[$x].'7', $value['biaozhuncha']); + $x++; + } + // 保存文件 $filename = $ks.'学生成绩列表'.date('ymdHis').'.xls'; diff --git a/application/chengji/controller/Tongji.php b/application/chengji/controller/Tongji.php index 5602fbfc..69e0f993 100644 --- a/application/chengji/controller/Tongji.php +++ b/application/chengji/controller/Tongji.php @@ -52,7 +52,7 @@ class Tongji extends Base // 实例化成绩统计模型 $tj = new \app\chengji\model\Tongji(); - + // 获取统计成绩参数 $canshu = $tj->getCanshu($getParam['kaoshiid']); @@ -82,4 +82,19 @@ class Tongji extends Base return json($data); } + + // 年级、班级学生成绩统计结果下载 + public function downloadnj() + { + + } + + + + // 获取各学校、各年级考试成绩 + public function schoolNianji() + { + + } + } diff --git a/application/chengji/validate/Cjdownload.php b/application/chengji/validate/Cjdownload.php new file mode 100644 index 00000000..14aca152 --- /dev/null +++ b/application/chengji/validate/Cjdownload.php @@ -0,0 +1,26 @@ + ['规则1','规则2'...] + * + * @var array + */ + protected $rule = [ + 'banjiids|参考班级' => 'require|array', + ]; + + /** + * 定义错误信息 + * 格式:'字段名.规则名' => '错误信息' + * + * @var array + */ + protected $message = []; +} diff --git a/application/chengji/view/index/download.html b/application/chengji/view/index/download.html index 22f2ab7f..d81c344f 100644 --- a/application/chengji/view/index/download.html +++ b/application/chengji/view/index/download.html @@ -28,13 +28,10 @@
- - {php} - $school = new app\system\model\School; - $school = $school->where('status',1)->field('id,title')->all(); - {/php} - + {volist name="school" id="vo"} {/volist} @@ -42,25 +39,35 @@
- {php} - $njlist = nianjiList(); - {/php}
- + +
+ + {php} + $njlist = nianjiList(); + {/php} + + +
+
+
- {foreach $njlist as $key=>$vo}
-
+
- {/foreach}
@@ -109,33 +116,42 @@ }; + // 获取班级列表 function getbanji() { + // 获取单位id + var danwei = $('#school').val(); + if(danwei== null || danwei==''){ + $('#school').focus(); + layer.alert('请先选择学校'); + return true; + } $.ajax({ type: 'POST', - url: "/banji/banjilist", + url: "/banji/mybanji", data:{ - school:$('#school').val(), + school:danwei, + nianji:$('#ruxuenian').val() }, dataType: 'json', success: function(data){ - $('dd').each(function(){ - $(this).text(''); - }); + // 删除原来的班级 + $('#banji').text(''); + // 清除选选 + $('#all').prop('checked',false); + // 循环写出新班级 for (var val in data) { - for(var bj in data[val]['banji']) - { - $('#n' + val).append(''; - } + $('#banji').append(''; } + }, error:function(data) { layer.alert('获取班级失败'); }, - }); + }); } - function selectall(obj) +function selectall(obj) { // 定位复选框位置 var topobj = $(obj).parents('dt').next('dd'); @@ -160,6 +176,7 @@ } } + diff --git a/application/chengji/view/tongji/downloadnj.html b/application/chengji/view/tongji/downloadnj.html new file mode 100644 index 00000000..57177f21 --- /dev/null +++ b/application/chengji/view/tongji/downloadnj.html @@ -0,0 +1,85 @@ + + + + + + + + + + + + +{css href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/static/h-ui/css/H-ui.min.css" /} +{css href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/static/h-ui.admin/css/H-ui.admin.css" /} +{css href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/lib/Hui-iconfont/1.0.8/iconfont.css" /} +{css href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/static/h-ui.admin/skin/default/skin.css" id="skin" /} +{css rel="stylesheet" type="text/css" href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/static/h-ui.admin/css/style.css" /} +{$list.title|default='学生成绩下载'} + + + + +
+
+
+ +
+ + {php} $school = new app\system\model\School; $school = $school->where('jibie','>',1)->field('id,title')->all();{/php} + + +
+
+
+ +
+ + {php} + $njlist = nianjiList(); + {/php} + + +
+
+ +
+
+ +
+
+
+
+ +{js href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/lib/jquery/1.9.1/jquery.js"} +{js href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/lib/layer/2.4/layer.js"} +{js href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/static/h-ui/js/H-ui.min.js"} +{js href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/static/h-ui.admin/js/H-ui.admin.js"} + + + +{js href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/lib/My97DatePicker/4.8/WdatePicker.js"} +{js href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/lib/jquery.validation/1.14.0/jquery.validate.js"} +{js href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/lib/jquery.validation/1.14.0/validate-methods.js"} +{js href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/lib/jquery.validation/1.14.0/messages_zh.js"} + + + diff --git a/application/common/view/create.html b/application/common/view/create.html index 28d502a6..051a842c 100644 --- a/application/common/view/create.html +++ b/application/common/view/create.html @@ -66,7 +66,10 @@ $(function(){ $('#form-member-add').ajaxSubmit({ type: mytype, success: function(data){ - layer.alert(data.msg); + layer.msg(data.msg,{ + icon: 6, + }); + sleep(2000); window.parent.location.reload(); }, error: function(data){ diff --git a/application/kaoshi/view/more_action/caiji.html b/application/kaoshi/view/more_action/caiji.html index fa42d802..e19245dc 100644 --- a/application/kaoshi/view/more_action/caiji.html +++ b/application/kaoshi/view/more_action/caiji.html @@ -46,7 +46,6 @@ $njlist = nianjiList(); {/php}
-
{foreach $njlist as $key=>$vo} diff --git a/application/kaoshi/view/more_action/index.html b/application/kaoshi/view/more_action/index.html index df13e58d..f858125d 100644 --- a/application/kaoshi/view/more_action/index.html +++ b/application/kaoshi/view/more_action/index.html @@ -43,8 +43,6 @@ 下载成绩采集表 -
-
  • @@ -56,19 +54,46 @@

  • - +

    - 下载学生成绩 + 年级(班级)成绩统计
  • - - + +

    - 年级成绩统计 + 学校(年级)成绩统计 +
  • +
+
    +
  • +

    + + + +

    + 下载成绩采集表 +
  • + +
  • +

    + + + +

    + 下载年级(班级)成绩统计表 +
  • +
  • +

    + + + +

    + 下载学校(年级)成绩统计表
diff --git a/public/error/error.tpl b/public/error/error.tpl index 5d485886..ecb08ff1 100644 --- a/public/error/error.tpl +++ b/public/error/error.tpl @@ -60,10 +60,10 @@ // 跳转到上一页 - function loginurl() - { - location.href = '/login'; - } + // function loginurl() + // { + // this.href = 'history.go(-1)'; + // } // 关闭页面 function tebclose() diff --git a/route/chengji.php b/route/chengji.php index e09791fc..964a4afd 100644 --- a/route/chengji.php +++ b/route/chengji.php @@ -21,4 +21,10 @@ Route::get('chengji/:id/chengjilist','chengji/Index/chengjilist'); Route::get('chengji/:id/download','chengji/Index/download'); Route::post('chengji/chengjixls','chengji/Index/chengjixls'); -Route::get('cjtongji/:id/nianji','chengji/Tongji/nianji'); \ No newline at end of file +Route::get('cjtongji/:id/nianji','chengji/Tongji/nianji'); +Route::post('/chengji/:id/downloadnj','chengji/Tongji/downloadnj'); + + + + +