From 60529919eee486012efa09d44263f04b1bce0993 Mon Sep 17 00:00:00 2001 From: win7 Date: Thu, 2 Jan 2020 16:27:52 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=AD=A6=E7=94=9F=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E6=9F=A5=E7=9C=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/kaoshi/model/Kaoshi.php | 14 +++- app/middleware/Auth.php | 2 + app/renshi/controller/Student.php | 84 ++++++++++++++++++++++- app/renshi/route/renshi.php | 3 +- app/renshi/view/student/index.html | 3 +- app/renshi/view/student/read.html | 103 +++++++++++++++++++++++++++++ 6 files changed, 203 insertions(+), 6 deletions(-) create mode 100644 app/renshi/view/student/read.html diff --git a/app/kaoshi/model/Kaoshi.php b/app/kaoshi/model/Kaoshi.php index 88266f0d..cdd00290 100644 --- a/app/kaoshi/model/Kaoshi.php +++ b/app/kaoshi/model/Kaoshi.php @@ -19,8 +19,6 @@ class Kaoshi extends Base // 用新值替换初始值 $src = array_cover( $srcfrom , $src ) ; - - // 整理变量 // $xingzhi = $src['xingzhi']; $searchval = $src['searchval']; @@ -44,6 +42,10 @@ class Kaoshi extends Base ); } ,'ksNianji' + ,'ksZuzhi'=>function($q) + { + $q->field('id,title,jiancheng'); + } ] ) ->select(); @@ -89,7 +91,7 @@ class Kaoshi extends Base { return $this->hasMany('KaoshiSubject','kaoshiid','id'); } - // 参考学科关联表 + // 参考类别关联表 public function ksCategory() { return $this->belongsTo('\app\system\model\Category','category','id'); @@ -101,6 +103,12 @@ class Kaoshi extends Base return $this->hasMany('\app\chengji\model\Chengji','kaoshi','id'); } + // 考试组织单位关联表 + public function ksZuzhi() + { + return $this->belongsTo('\app\system\model\School','zuzhi','id'); + } + diff --git a/app/middleware/Auth.php b/app/middleware/Auth.php index 890a0f1f..c3ca6caa 100644 --- a/app/middleware/Auth.php +++ b/app/middleware/Auth.php @@ -46,6 +46,8 @@ class Auth 'upload','myinfo', 'mybanji','banjilist', 'editpassword','updatepassword', + // 学生信息查询 + 'ajaxdatachengji', // 教师信息查询 'srcteacher','srcry','srckt', // 查询班级成绩、查询年级成绩、查询录入成绩人员信息 diff --git a/app/renshi/controller/Student.php b/app/renshi/controller/Student.php index ee286e49..ceb5155e 100644 --- a/app/renshi/controller/Student.php +++ b/app/renshi/controller/Student.php @@ -157,7 +157,89 @@ class Student extends BaseController // public function read($id) { - // + // 查询教师信息 + $myInfo = STU::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(); + } + + + + // 获取考试成绩 + public function ajaxDatachengji() + { + // 获取表单参数 + // 获取参数 + $src = $this->request + ->only([ + 'page'=>'1', + 'limit'=>'10', + 'field'=>'update_time', + 'type'=>'desc', + 'studentid'=>'', + ],'POST'); + + // 获取学生成绩 + $kh = new \app\kaoshi\model\Kaohao; + $khList = $kh + ->where('student',$src['studentid']) + ->field('id,kaoshi,school,ruxuenian,banji,paixu,student') + ->with([ + 'cjSchool'=>function($query){ + $query->field('id,jiancheng'); + } + ,'cjKaoshi'=>function($query) + { + $query->field('id,title,category,zuzhi,bfdate,enddate') + ->with([ + 'ksCategory'=>function($query){ + $query->field('id,title'); + } + ,'ksZuzhi'=>function($query) + { + $query->field('id,title,jiancheng'); + } + ]); + } + ,'ksChengji' + ]) + ->append(['banjiTitle']) + ->select(); + + // 获取符合条件记录总数 + $cnt = $khList->count(); + // 获取当前页数据 + $limit_start = $src['page'] * $src['limit'] - $src['limit']; + $limit_length = $src['limit']; + $khList = $khList->slice($limit_start,$limit_length); + + // 重组返回内容 + $data = [ + 'code'=> 0 , // ajax请求次数,作为标识符 + 'msg'=>"", // 获取到的结果数(每页显示数量) + 'count'=>$cnt, // 符合条件的总数据量 + 'data'=>$khList, //获取到的数据结果 + ]; + + + return json($data); } diff --git a/app/renshi/route/renshi.php b/app/renshi/route/renshi.php index 0e7651d7..45ab1a8c 100644 --- a/app/renshi/route/renshi.php +++ b/app/renshi/route/renshi.php @@ -17,7 +17,7 @@ Route::group('student', function () { 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('read/','student/read','get'); # 读取信息 Route::rule('edit/','student/edit','get'); # 修改信息 Route::rule('update/','student/update','put'); # 更新信息 Route::rule('delete/','student/delete','delete'); # 删除信息 @@ -27,6 +27,7 @@ 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'); # 获取学生成绩 }); diff --git a/app/renshi/view/student/index.html b/app/renshi/view/student/index.html index dc72fcaf..ff219364 100644 --- a/app/renshi/view/student/index.html +++ b/app/renshi/view/student/index.html @@ -81,6 +81,7 @@ @@ -147,7 +148,7 @@ var tr = obj.tr; //获得当前行 tr 的DOM对象 switch(layEvent){ case 'detail':// 查看 - layer.msg('查看' + data.id); + cjgl.add(obj.data.xingming+'信息','student/read/'+obj.data.id,'','',true); break; case 'del':// 删除 cjgl.del(obj,"student/delete"); diff --git a/app/renshi/view/student/read.html b/app/renshi/view/student/read.html new file mode 100644 index 00000000..82e0b553 --- /dev/null +++ b/app/renshi/view/student/read.html @@ -0,0 +1,103 @@ + + + + + {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} + + +
+ +
+ 个人信息 +
+ + + + + + + + + + + + + + + + + + + +
姓名{$list.xingming}        {$list.quanpin}        {$list.shoupin}
性别{$list.sex}
出生日期{$list.shengri}        {$list.age}周岁
学校班级{$list.stuSchool.title}        {$list.stuBanji.banjiTitle}
创建时间{$list.create_time}
+
+
+ + +
+ 历次考试成绩 +
+
+
+
+
+ + + \ No newline at end of file