From 90ea00e87d4d30cec66a8c39ab8ce21f7fe55b55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E6=9D=BE=E6=A0=91?= Date: Mon, 13 May 2019 13:41:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9ajaxdata=E6=9C=AA=E9=AA=8C?= =?UTF-8?q?=E8=AF=81=E9=94=99=E8=AF=AF=E5=92=8C=E7=8F=AD=E7=BA=A7=E6=88=90?= =?UTF-8?q?=E7=BB=A9=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/chengji/model/Tongji.php | 20 ++++++++++++++----- application/chengji/view/tongji/tj_banji.html | 2 +- .../chengji/view/tongji/tj_nianji.html | 4 ++-- application/common/controller/Base.php | 2 +- 4 files changed, 19 insertions(+), 9 deletions(-) diff --git a/application/chengji/model/Tongji.php b/application/chengji/model/Tongji.php index d3679f93..135c166b 100644 --- a/application/chengji/model/Tongji.php +++ b/application/chengji/model/Tongji.php @@ -102,8 +102,13 @@ class Tongji extends Model $cnt++; } } + if(count($cj)>0) + { + return round($cnt/count($cj)*100); + }else{ + return ''; + } - return round($cnt/count($cj)*100); } @@ -115,18 +120,23 @@ class Tongji extends Model $tempcj = 0; foreach ($sbj as $k => $val) { $tempsbj = 0; - // if(isset($value[$val->lieming])) - // { + if(isset($value[$val->lieming])) + { if($value[$val->lieming]>$val->jige) { $tempsbj++; } - // } + } } $tempcj == $tempsbj ? $jige++ : $jige ; } - return round($jige/count($cj)*100); + if(count($cj)>0) + { + return round($jige/count($cj)*100); + }else{ + return ''; + } } diff --git a/application/chengji/view/tongji/tj_banji.html b/application/chengji/view/tongji/tj_banji.html index 8c1b21d7..276136ef 100644 --- a/application/chengji/view/tongji/tj_banji.html +++ b/application/chengji/view/tongji/tj_banji.html @@ -101,7 +101,7 @@ options.cols[1].push(colinfo); }); }); - options.cols[0].push({title: '全科及格率',minWidth:100,rowspan:2,templet:function(d){ + options.cols[0].push({title: '全科及格率%',minWidth:100,rowspan:2,templet:function(d){ var str = d.chengji.rate; return str; }}); diff --git a/application/chengji/view/tongji/tj_nianji.html b/application/chengji/view/tongji/tj_nianji.html index 99e8ed54..3b31c6c2 100644 --- a/application/chengji/view/tongji/tj_nianji.html +++ b/application/chengji/view/tongji/tj_nianji.html @@ -49,7 +49,7 @@ // 设置列 options.cols=[[ //表头 {type:'numbers',title:'序号',rowspan:2}, - {field: 'school', title: '学校',sort: true,minWidth:80,rowspan:2}, + {field: 'school', title: '学校',minWidth:80,rowspan:2}, ] ,[] ]; @@ -75,7 +75,7 @@ options.cols[1].push(colinfo); }); }); - options.cols[0].push({title: '全科及格率',minWidth:100,rowspan:2,templet:function(d){ + options.cols[0].push({title: '全科及格率%',minWidth:120,rowspan:2,templet:function(d){ var str = d.chengji.rate; return str; }}); diff --git a/application/common/controller/Base.php b/application/common/controller/Base.php index 62908086..2e0fa74b 100644 --- a/application/common/controller/Base.php +++ b/application/common/controller/Base.php @@ -15,7 +15,7 @@ class Base extends Controller protected $middleware = [ 'YanZheng'=>[ 'except'=>[ - 'ajaxData', + // 'ajaxData', 'exit', ], ],