diff --git a/app/chengji/controller/Bjtongji.php b/app/chengji/controller/Bjtongji.php index e3db35c6..3e6d4155 100644 --- a/app/chengji/controller/Bjtongji.php +++ b/app/chengji/controller/Bjtongji.php @@ -63,18 +63,7 @@ class Bjtongji extends AdminBase // 统计成绩 $btj = new BTJ; $data = $btj->search($src); - - // 获取记录总数 - $cnt = count($data); - // 截取当前页数据 - $data = array_slice($data, ($src['page'] - 1) * $src['limit'], $src['limit']); - // 重组返回内容 - $data = [ - 'code'=> 0 , // ajax请求次数,作为标识符 - 'msg'=>"", // 获取到的结果数(每页显示数量) - 'count'=>$cnt, // 符合条件的总数据量 - 'data'=>$data, //获取到的数据结果 - ]; + $data = reSetArray($data, $src); return json($data); } diff --git a/app/chengji/model/TongjiBj.php b/app/chengji/model/TongjiBj.php index 5360fb43..1e5c4dac 100644 --- a/app/chengji/model/TongjiBj.php +++ b/app/chengji/model/TongjiBj.php @@ -331,15 +331,20 @@ class TongjiBj extends BaseModel ,'subject_id' => array() ,'school_id' => '' ,'ruxuenian' => '' + ,'teacher_id' => '' ); $src = array_cover($srcfrom, $src); $src['banji_id'] = strToarray($src['banji_id']); $src['subject_id'] = strToarray($src['subject_id']); + $src['teacher_id'] = strToarray($src['teacher_id']); $data = $this->where('kaoshi_id', $src['kaoshi_id']) ->when(count($src['banji_id']) > 0, function ($query) use($src) { $query->where('banji_id', 'in', $src['banji_id']); }) + ->when(count($src['teacher_id']) > 0, function ($query) use($src) { + $query->where('teacher_id', 'in', $src['teacher_id']); + }) ->where('banji_id', 'in', function ($query) use($src) { $query->name('banji') ->when(strlen($src['school_id']) > 0, function ($q) use ($src) { @@ -361,6 +366,72 @@ class TongjiBj extends BaseModel } + // 查询与指定教师相关的所有考试成绩 + public function searchTeacher($srcfrom) + { + // 初始化参数 + $src = array( + 'xueqi_id' => '' + ,'category_id' => array() + ,'subject_id' => array() + ,'teacher_id' => 0 + ,'bfdate' => '' + ,'enddate' => '' + ); + $src = array_cover($srcfrom, $src); + $src['xueqi_id'] = strToarray($src['xueqi_id']); + $src['subject_id'] = strToarray($src['subject_id']); + $src['category_id'] = strToarray($src['category_id']); + + 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")); + } + + $data = $this->where('teacher_id', $src['teacher_id']) + ->where('subject_id', '<>', 0) + ->when(count($src['subject_id']) > 0, function ($query) use($src) { + $query->where('subject_id', 'in', $src['subject_id']); + }) + ->where('kaoshi_id', 'in', function ($query) use($src) { + $query->name('kaoshi') + ->whereTime('bfdate|enddate', 'between', [$src['bfdate'], $src['enddate']]) + ->when(count($src['xueqi_id'])>0, function ($q) use($src) { + $q->where('xueqi_id', 'in', function ($w) use($src) { + $w->name('xueqi') + ->where('category_id', 'in', $src['xueqi_id']) + ->field('id'); + }); + }) + ->when(count($src['category_id'])>0, function ($q) use($src) { + $q->where('category_id', 'in', $src['category_id']); + }) + ->field('id'); + }) + ->with([ + 'bjSubject' => function ($query) { + $query->field('id, title, jiancheng'); + } + ,'bjKaoshi' => function ($query) { + $query->field('id, title, enddate'); + } + ]) + ->append(['banjiTitle']) + ->select(); + + return $data; + } + + // 查询任课教师 public function renke($srcfrom) { diff --git a/app/teacherSearchChengji/controller/Index.php b/app/teacherSearchChengji/controller/Index.php index 810e288d..86edba6f 100644 --- a/app/teacherSearchChengji/controller/Index.php +++ b/app/teacherSearchChengji/controller/Index.php @@ -41,8 +41,12 @@ class Index extends TeacherSearchBase ,'font' => '' ,'authCid' => [ [ - 'title' => '成绩查询一' - ,'url' => '' + 'title' => '班级成绩' + ,'url' => '/teachersearchchengji/index/banji' + ] + , [ + 'title' => '学生成绩' + ,'url' => '/teachersearchchengji/index/databanji' ] ] ] @@ -121,9 +125,8 @@ class Index extends TeacherSearchBase // 学生查询页首页 - public function read($kaohao_id) + public function read($teacher_id) { - halt('aa'); $kh = new \app\kaohao\model\Kaohao; $khInfo = $kh->where('id', $kaohao_id) ->with([ @@ -203,4 +206,50 @@ class Index extends TeacherSearchBase // 返回信息 return json($data); } + + + // 班级成绩列表 + public function banji() + { + $teacher_id = session('teacher.userid'); + $list['teacher_id'] = $teacher_id; + + $sbj = new \app\teach\model\Subject; + $list['subject'] = $sbj->kaoshi(); + + // 设置要给模板赋值的信息 + $list['webtitle'] = '班级成绩列表'; + $list['dataurl'] = '/teachersearchchengji/index/banjidata'; + + // 模板赋值 + $this->view->assign('list', $list); + + // 渲染模板 + return $this->view->fetch(); + } + + + // 获取班级成绩数据 + public function ajaxDataBanji() + { + // 获取参数 + $src = $this->request + ->only([ + 'page' => '1' + ,'limit' => '10' + ,'teacher_id' => '' + ,'xueqi_id' => '' + ,'category_id' => array() # 考试类型 + ,'subject_id' => array() + ,'bfdate' => '' + ,'enddate' => '' + ], 'POST'); + + // 统计成绩 + $btj = new \app\chengji\model\TongjiBj; + $data = $btj->searchTeacher($src); + $data = reSetObject($data, $src); + + return json($data); + } } diff --git a/app/teacherSearchChengji/route/teacher.php b/app/teacherSearchChengji/route/teacher.php index 113df6c9..80aa17aa 100644 --- a/app/teacherSearchChengji/route/teacher.php +++ b/app/teacherSearchChengji/route/teacher.php @@ -16,6 +16,7 @@ Route::group('index', function () { Route::rule('welcome','Index/welcome','get'); # 信息列表 Route::rule('read/', 'Index/read', 'get'); # 读取信息 Route::rule('editpassword','Index/editpassword','get'); # 信息列表 - Route::rule('updatepassword/','Index/updatePassword','put'); # 信息列表 - + Route::rule('updatepassword/','Index/updatePassword','put'); # 信息列表 + Route::rule('banji','Index/banji','get'); # 信息列表 + Route::rule('banjidata','Index/ajaxDataBanji','post'); # 获取数据 }); diff --git a/app/teacherSearchChengji/view/index/banji.html b/app/teacherSearchChengji/view/index/banji.html new file mode 100644 index 00000000..ada0aec2 --- /dev/null +++ b/app/teacherSearchChengji/view/index/banji.html @@ -0,0 +1,508 @@ + +{extend name=".././view/list.html" /} +{block name="jsset"} +{load href="__STATIC__/echarts/echarts.js" /} +{load href="__STATIC__/echarts/infographic.js" /} +{/block} +{block name="nav"} + + 成绩查询 + 班级成绩 + +{/block} +{block name="search"} +
+ +
+ + {php} $category = categoryChildren(108);{/php} + {volist name="category" id="vo"} + + {/volist} +
+
+
+ +
+ {php} $category = categoryChildren(109);{/php} + {volist name="category" id="vo"} + + {/volist} +
+
+
+ +
+ {volist name="list.subject" id="vo"} + + {/volist} +
+
+
+
+ +
+ +
+
+ +
+
+
+ +{/block} +{block name="table"} +
+{/block} +{block name="echart"} + +
+
+
+
+
+ +{/block} +{block name="myjs"} + + + + + + + {/block} diff --git a/view/list.html b/view/list.html index 311ded58..69a68ef9 100644 --- a/view/list.html +++ b/view/list.html @@ -137,6 +137,9 @@ cjgl.checkboxParent(parentId); $("#srcsubmit").click(); return true; + }else{ + $("#srcsubmit").click(); + return true; } });