From 3cd5780cc84f9ae7e18f76a8a58d1708a2aaa7be Mon Sep 17 00:00:00 2001 From: win10 Date: Tue, 14 Jan 2020 10:05:13 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E6=96=B0=E5=B8=83=E5=B1=80=E8=A1=A8?= =?UTF-8?q?=E6=A0=BC=E5=BD=95=E5=85=A5=E5=AE=8C=E6=88=90=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/chengji/controller/Luru.php | 21 +--------- app/chengji/model/Chengji.php | 28 ++++++++++++-- app/chengji/view/luru/index.html | 66 +++++++------------------------- 3 files changed, 40 insertions(+), 75 deletions(-) diff --git a/app/chengji/controller/Luru.php b/app/chengji/controller/Luru.php index 4c0f3048..c003ffac 100644 --- a/app/chengji/controller/Luru.php +++ b/app/chengji/controller/Luru.php @@ -17,26 +17,6 @@ class Luru extends BaseController public function index() { - $ks = new \app\kaoshi\model\Kaoshi; - // 获取参考年级 - $list['data'] = $ks::order(['id'=>'desc']) - ->field('id,title') - ->with([ - 'ksNianji' - ,'ksSubject'=>function($query){ - $query->field('id,subjectid,kaoshiid') - ->with(['subjectName'=>function($q){ - $q->field('id,title'); - }] - ); - } - ]) - ->limit(6) - ->select() - ->toArray(); - - - // 设置要给模板赋值的信息 $list['webtitle'] = '已录列表'; $list['dataurl'] = 'luru/data'; @@ -188,6 +168,7 @@ class Luru extends BaseController ,'post'); $list['kaohao_id'] = $id; + // 判断考试结束时间是否已过 $kaoshiid = Kaohao::where('id',$list['kaohao_id'])->value('kaoshi'); $enddate = kaoshiDate($kaoshiid,'enddate'); diff --git a/app/chengji/model/Chengji.php b/app/chengji/model/Chengji.php index a2967147..3ccb9f79 100644 --- a/app/chengji/model/Chengji.php +++ b/app/chengji/model/Chengji.php @@ -40,7 +40,7 @@ class Chengji extends Base 'kaoshi'=>'0', 'banji'=>array(), 'subject_id'=>array(), - 'searchval'=>array(), + 'searchval'=>'', 'user_id'=>session('userid'), ); @@ -51,6 +51,18 @@ class Chengji extends Base $kaoshi = $src['kaoshi']; $searchval = $src['searchval']; + $ks = new \app\kaoshi\model\Kaoshi; + $bfdate = $ks->where('id',$kaoshi) + ->value('bfdate'); + $nj = nianjiList($bfdate); + $stu = new \app\renshi\model\Student; + $stuid = $stu + ->when(strlen($searchval)>0,function($query)use($searchval){ + $query->where('xingming','like','%'.$searchval.'%') + ->field('id'); + }) + ->column('id'); + $nianji = nianjiList(); $cjList = $this @@ -58,11 +70,19 @@ class Chengji extends Base ->when(count($subject_id)>0,function($query)use($subject_id){ $query->where('subjectid','in',$subject_id); }) + ->when(count($stuid)>0,function($query)use($stuid){ + $query->where('kaohao_id','in',function($q)use($stuid){ + $q->name('kaohao') + ->where('student','in',$stuid) + ->whereTime('update_time','-480 hours') + ->field('id'); + }); + }) ->with([ 'subjectName'=>function($query){ $query->field('id,title,lieming'); } - ,'cjKaohao'=>function($query){ + ,'cjKaohao'=>function($query)use($searchval){ $query->field('id,kaoshi,school,ruxuenian,nianji,banji,paixu,student') ->append(['banjiTitle']) ->with([ @@ -89,12 +109,14 @@ class Chengji extends Base 'id'=>$value->id, 'kaoshi'=>$value->cjKaohao->cjKaoshi->title, 'kaoshiid'=>$value->cjKaohao->cjKaoshi->id, + 'kaohaoid'=>$value->cjKaohao->id, 'school'=>$value->cjKaohao->cjSchool->jiancheng, 'schoolid'=>$value->cjKaohao->cjSchool->paixu, 'banji'=>$value->cjKaohao->banjiTitle, 'banjiid'=>$value->cjKaohao->banji, 'subject'=>$value->subjectName->title, - 'subjectid'=>$value->subjectid, + 'subjectid'=>$value->id, + 'subjectname'=>$value->subjectName->lieming, 'defen'=>$value->defen, 'status'=>$value->status, 'update_time'=>$value->update_time, diff --git a/app/chengji/view/luru/index.html b/app/chengji/view/luru/index.html index d7deb2d2..81558541 100644 --- a/app/chengji/view/luru/index.html +++ b/app/chengji/view/luru/index.html @@ -11,34 +11,14 @@ {/block} {block name="search"}
- -
- + +
+
-
- -
- {php} $category = getCategory('课题立项类型');{/php} - - - {volist name="category" id="vo"} - - {/volist} -
-
-
- -
- {php} $school = schlist('区级','其它级'); {/php} - {volist name="school" id="vo"} - - {/volist} -
-
{/block} {block name="table"}
@@ -50,16 +30,10 @@ -
@@ -67,7 +41,7 @@ // 设置列 options.cols=[[ //表头 {type:'checkbox', fixed: 'left'}, - {field: 'kaoshiid', title: '考试',sort: true, minWidth:120,templet:function(d){ + {field: 'kaoshiid', title: '考试',sort: true, minWidth:180,templet:function(d){ var str =''; if(d.kaoshi) { @@ -103,7 +77,7 @@ {field: 'defen', title: '得分', sort: true,minWidth:80,edit:'text'}, {field: 'update_time', title: '修改时间', sort: true,minWidth:160}, {field: 'status', title: '状态',templet:'#status', sort: true}, - {field: 'id', title: '操作',toolbar: '#barDemo',minWidth:140} + {field: 'id', title: '操作',toolbar: '#barDemo',minWidth:70} ]]; // 设置每页显示条数 options.limit = 25; @@ -118,10 +92,7 @@ switch(obj.event){ case 'dels': var checkStatus = table.checkStatus('mytable'); //idmytable 即为基础参数 id 对应的值 - cjgl.delAll(checkStatus,'ketice/delete','mytable'); - break; - case 'add': - cjgl.add('添加荣誉册','ketice/create','500','300'); + cjgl.delAll(checkStatus,'/chengji/index/delete','mytable'); break; }; }); @@ -132,17 +103,8 @@ var layEvent = obj.event; //获得 lay-event 对应的值(也可以是表头的 event 参数对应的值) var tr = obj.tr; //获得当前行 tr 的DOM对象 switch(layEvent){ - case 'detail':// 查看 - parent.xadmin.add_tab(obj.data.title + ' 列表','/keti/ketiinfo/list/'+obj.data.id,true); - break; case 'del':// 删除 - cjgl.del(obj,"ketice/delete"); - break; - case 'edit':// 编辑 - cjgl.add('编辑荣誉册','ketice/edit/'+obj.data.id,'500','300'); - break; - case 'more':// 状态 - cjgl.add('批传','/keti/ketiinfo/createall/'+obj.data.id,'300','200'); + cjgl.del(obj,"/chengji/index/delete"); break; }; }); @@ -151,16 +113,16 @@ table.on('edit(mytable)',function(obj){ //声明变量 var newdefen = obj.value - ,colname = obj.data.subjectName.lieming - ,id = obj.data.cjKaohao.kaoshi; + ,colname = obj.data.subjectname + ,id = obj.data.kaohaoid; // 修改服务器数据 $.ajax({ url:"/chengji/luru/update/"+id, type:'PUT', data:{ - "colname":colname, - "newdefen":newdefen + "colname":colname + ,"newdefen":newdefen }, success:function(result){ if(result.val == 0)