考试重新整理

This commit is contained in:
小松树 committed 2019-04-30 15:43:39 +08:00
1 parent e181976143
commit d64fa93aac
16 files changed
+371 -245

No files matched your search

+15 -23
View File
@@ -3,18 +3,11 @@ namespace app\chengji\controller;
// 引用控制器基类
use app\common\controller\Base;
// 引用学生数据模型
// use app\renshi\model\Student;
// 引用成绩数据模型
use app\chengji\model\Chengji;
// 引用学科数据模型
// use app\teach\model\Subject;
// 引用文件信息存储数据模型类
// use app\system\model\Fields;
// 引用phpspreadsheet类
use app\renshi\controller\Myexcel;
// 引用考试类
// use app\kaoshi\model\Kaoshi;
// 引用考号数据模型
use app\kaoshi\model\Kaohao;
class Index extends Base
{
@@ -88,27 +81,26 @@ class Index extends Base
$val = input('post.val');
$val = action('system/Encrypt/decrypt',[$val,'key'=>'dlbz']);
$list = explode('|',$val);
$sbj = $list[1];
$cj = new Chengji;
$cjlist = $cj->where('id',$list[0])
->field('id,banji,school,student,'.$list[1])
$kh = new Kaohao;
$cjlist = $kh->where('id',$list[0])
->field('id,banji,school,student')
->with([
'cjBanji'=>function($q){
$q->field('id,paixu,ruxuenian')->append(['banjiTitle']);
}
,'cjStudent'=>function($q){
$q->field('id,xingming');
}
,'cjSchool'=>function($q){
$q->field('id,jiancheng');
'ksChengji'=>function($q) use($sbj){
$q->where('stubject_id',$sbj)
->field('id,kaohao_id,stubject_id,student_id,user_id');
}
])
->find();
// 获取列名
$sbj = new \app\teach\model\Subject;
$cjlist->lieming = $sbj::where('lieming',$list[1])->value('title');
$cjlist->zd = $list[1];
$cjlist->defen = $cjlist[$list[1]];
halt($cjlist);
return json($cjlist);
}
+51 -78
View File
@@ -11,8 +11,8 @@ class Chengji extends Base
// 定义更新成绩后计算平均分和总分
protected static function init()
{
// protected static function init()
// {
// self::afterUpdate(function ($cj) {
// $cj =self::where('id',$cj->id)->find();
// // 重新组合数组
@@ -41,42 +41,15 @@ class Chengji extends Base
// $cj->save();
// });
}
// }
// 学校信息关联表
public function cjSchool()
{
return $this->belongsTo('\app\system\model\School','school','id');
}
// 班级信息关联表
public function cjBanji()
{
return $this->belongsTo('\app\teach\model\Banji','banji','id');
}
// 学生信息关联
public function cjStudent()
{
return $this->belongsTo('\app\renshi\model\Student','student','id');
}
// 满分
public function cjManfen()
{
return $this->hasMany('\app\kaoshi\model\KaoshiSubject','kaoshiid','kaoshi');
}
// 考试关联
public function cjKaoshi()
{
return $this->belongsTo('\app\kaoshi\model\Kaoshi','kaoshi','id');
}
@@ -94,61 +67,61 @@ class Chengji extends Base
// 查询根据考试ID查询考试成绩
public function searchAjax($search)
{
// 获取参数
$kaoshiid = $search['kaoshiid'];
$schoolid = $search['school'];
$nianji = $search['nianji'];
$banji = $search['banji'];
$order = $search['order'];
$order_field = $search['order_field'];
$search = $search['search'];
// public function searchAjax($search)
// {
// // 获取参数
// $kaoshiid = $search['kaoshiid'];
// $schoolid = $search['school'];
// $nianji = $search['nianji'];
// $banji = $search['banji'];
// $order = $search['order'];
// $order_field = $search['order_field'];
// $search = $search['search'];
$data = $this->where('kaoshi',$kaoshiid)
->when(count($schoolid)>0,function($query) use($schoolid){
$query->where('school','in',$schoolid);
})
->when(count($nianji)>0,function($query) use($nianji){
$query->where('nianji','in',$nianji);
})
->when(count($banji)>0,function($query) use($banji){
$query->where('banji','in',$banji);
})
// ->when(strlen($search)>0 && is_numeric($search), function ($query) use($search){
// // 满足条件后执行
// $query->where('yuwen|shuxue|waiyu',$search);
// })
->when(strlen($search)>0 && !is_numeric($search),function($query) use($search){
$query->where('student','in',function ($q) use($search){
$q->name('student')
->where('xingming','like','%'.$search.'%')
->field('id');
});
})
->order([$order_field=>$order])
->select();
// $data = $this->where('kaoshi',$kaoshiid)
// ->when(count($schoolid)>0,function($query) use($schoolid){
// $query->where('school','in',$schoolid);
// })
// ->when(count($nianji)>0,function($query) use($nianji){
// $query->where('nianji','in',$nianji);
// })
// ->when(count($banji)>0,function($query) use($banji){
// $query->where('banji','in',$banji);
// })
// // ->when(strlen($search)>0 && is_numeric($search), function ($query) use($search){
// // // 满足条件后执行
// // $query->where('yuwen|shuxue|waiyu',$search);
// // })
// ->when(strlen($search)>0 && !is_numeric($search),function($query) use($search){
// $query->where('student','in',function ($q) use($search){
// $q->name('student')
// ->where('xingming','like','%'.$search.'%')
// ->field('id');
// });
// })
// ->order([$order_field=>$order])
// ->select();
// $data = $data->append(['cj_school.jiancheng','cj_banji.title','cj_student.xingming']);
// // $data = $data->append(['cj_school.jiancheng','cj_banji.title','cj_student.xingming']);
return $data;
}
// return $data;
// }
// 根据成绩ID查询单条成绩
public function srcOne($id)
{
$data = $this->where('id',$id)
->with([
'cjManfen'
])
->find();
// // 根据成绩ID查询单条成绩
// public function srcOne($id)
// {
// $data = $this->where('id',$id)
// ->with([
// 'cjManfen'
// ])
// ->find();
return $data;
}
// return $data;
// }
+13 -16
View File
@@ -43,25 +43,22 @@
success:function(result){
val = result.val
// 弹出提示
layer.msg(result.msg,
{
icon:1,
time:2000,
},
function(){
// 关闭窗口
if(val == 1)
{
//先得到当前iframe层的索引
var index = parent.layer.getFrameIndex(window.name);
//再执行关闭
parent.layui.table.reload('mytable');
parent.layer.close(index);
}
{
icon:1,
time:2000,
},function(){
if(val == 1)
{
//先得到当前iframe层的索引
var index = parent.layer.getFrameIndex(window.name);
//再执行关闭
parent.layui.table.reload('mytable');
parent.layer.close(index);
}
});
},
error:function(xhr,status,error) {
layer.msg('数据处理错误',{
Loaded 3 of 16 files, more files were not shown because too many files have changed in this diff. Show more