From 1d69b383c28e024e336b11b331e5f41319bfe515 Mon Sep 17 00:00:00 2001 From: cxdbz Date: Mon, 13 Jan 2020 21:52:29 +0800 Subject: [PATCH] 0 --- app/chengji/model/Chengji.php | 39 ++++++++++++++++++++++++++++---- app/chengji/view/luru/index.html | 25 +++++++++++++------- 2 files changed, 51 insertions(+), 13 deletions(-) diff --git a/app/chengji/model/Chengji.php b/app/chengji/model/Chengji.php index 0a1f486c..a2967147 100644 --- a/app/chengji/model/Chengji.php +++ b/app/chengji/model/Chengji.php @@ -72,15 +72,44 @@ class Chengji extends Base ,'cjStudent'=>function($query){ $query->field('id,xingming,sex'); } + ,'cjKaoshi'=>function($query){ + $query->field('id,title'); + } ]); } ]) - ->order([$src['field']=>$src['type']]) + ->whereTime('update_time','-240 hours') ->limit(200) - ->select() - ->toArray(); + ->select(); - return $cjList; + // 重新整理成绩 + $data = array(); + foreach ($cjList as $key => $value) { + $data[$key] = [ + 'id'=>$value->id, + 'kaoshi'=>$value->cjKaohao->cjKaoshi->title, + 'kaoshiid'=>$value->cjKaohao->cjKaoshi->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, + 'defen'=>$value->defen, + 'status'=>$value->status, + 'update_time'=>$value->update_time, + ]; + $value->cjKaohao->cjStudent ? $data[$key]['student']=$value->cjKaohao->cjStudent->xingming : $data[$key]['student']= ''; + } + + // 按条件排序 + $src['type'] == 'desc' ? $src['type'] =SORT_DESC :$src['type'] = SORT_ASC; + if(count($data)>0){ + $data = sortArrByManyField($data,$src['field'],$src['type']); + } + + + return $data; } @@ -110,9 +139,9 @@ class Chengji extends Base $chengjilist = $kh->srcChengji($src); - $src['type'] == 'desc' ? $src['type'] =SORT_DESC :$src['type'] = SORT_ASC; // 按条件排序 + $src['type'] == 'desc' ? $src['type'] =SORT_DESC :$src['type'] = SORT_ASC; if(count($chengjilist)>0){ $chengjilist = sortArrByManyField($chengjilist,$src['field'],$src['type']); } diff --git a/app/chengji/view/luru/index.html b/app/chengji/view/luru/index.html index c20e53f0..d7deb2d2 100644 --- a/app/chengji/view/luru/index.html +++ b/app/chengji/view/luru/index.html @@ -67,27 +67,36 @@ // 设置列 options.cols=[[ //表头 {type:'checkbox', fixed: 'left'}, - {field: 'kaohao_id', title: '学校',sort: false, minWidth:120,templet:function(d){ + {field: 'kaoshiid', title: '考试',sort: true, minWidth:120,templet:function(d){ var str =''; - if(d.cjKaohao) + if(d.kaoshi) { - str = d.cjKaohao.cjSchool.jiancheng; + str = d.kaoshi; } return str; }}, - {field: 'kaohao_id', title: '班级',sort: false,templet:function(d){ + {field: 'schoolid', title: '学校',sort: true, minWidth:70,templet:function(d){ + var str =''; + if(d.school) + { + str = d.school; + } + return str; + }}, + {field: 'banjiid', title: '班级',sort: true,templet:function(d){ var str=''; - if(d.cjKaohao) + if(d.banji) { - str = d.cjKaohao.banjiTitle; + str = d.banji; } return str; }}, + {field: 'student', title: '姓名',sort: true}, {field: "subjectid",title: '学科',sort: true,templet:function(d){ var str=''; - if(d.subjectName) + if(d.subject) { - str = d.subjectName.title; + str = d.subject; } return str; }},