diff --git a/app/admin/controller/Index.php b/app/admin/controller/Index.php index c2035e46..aae0d1f0 100755 --- a/app/admin/controller/Index.php +++ b/app/admin/controller/Index.php @@ -272,28 +272,6 @@ class Index extends AdminBase } - // // 查询管理员 - // public function adminList() - // { - // $src = request()->only([ - // 'searchval' - // ],'POST'); - - // $ad = new AD; - // $list = $ad->search($src); - // $cnt = $list->count(); - // $data = array(); - // foreach ($list as $key => $value) { - // $data[] = [ - // 'xingming' => $value->adSchool->jiancheng . ' -- ' .$value->xingming - // ,'id' => $value->id - // ]; - // } - - // return json($data); - // } - - // 批量添加 public function createAll() { diff --git a/app/kaohao/model/SearchCanYu.php b/app/kaohao/model/SearchCanYu.php index 95cce61f..ce3af8ea 100755 --- a/app/kaohao/model/SearchCanYu.php +++ b/app/kaohao/model/SearchCanYu.php @@ -31,7 +31,7 @@ class SearchCanyu extends BaseModel ->order(['paixu' => 'asc']); } ]) - ->group('school_id') + ->distinct(true) ->field('school_id') ->select(); @@ -46,10 +46,10 @@ class SearchCanyu extends BaseModel ]; } - if(count($data) > 0) - { - $data = \app\facade\Tools::sortArrByManyField($data, 'paixu', SORT_ASC); - } + // if(count($data) > 0) + // { + // $data = \app\facade\Tools::sortArrByManyField($data, 'paixu', SORT_ASC); + // } return $data; } @@ -76,6 +76,17 @@ class SearchCanyu extends BaseModel $src['banji_id'] = strToarray($src['banji_id']); $src['ruxuenian'] = strToarray($src['ruxuenian']); + $lrfg = new \app\kaoshi\model\LuruFengong; + $lrList = $lrfg->srcMyLuruBanji($src); + + if($lrList['count'] > 0) + { + $src['banji_id'] = array_unique($lrList['list']->column('banji_id')); + + count($src['banji_id']) == 0 ? [0] : $src['banji_id']; + } + + // 通过给定参数,从考号表中获取参加考试的班级 $kh = new kh; $bjids = $kh diff --git a/app/kaoshi/controller/KsCanyu.php b/app/kaoshi/controller/KsCanyu.php index 68295def..d5e8af0b 100644 --- a/app/kaoshi/controller/KsCanyu.php +++ b/app/kaoshi/controller/KsCanyu.php @@ -56,10 +56,10 @@ class KsCanYu extends AdminBase ,'limit' => 100 ], 'POST'); $khSrc = new \app\kaohao\model\SearchCanYu; - $myself = config('shangma.lurufanwei'); + // $myself = config('shangma.lurufanwei'); $category = session('onlineCategory'); - if($category == 'teacher' && $myself == true) - { + + $teacher_id = session('user_id'); $s = \think\facade\Session::all(); @@ -76,7 +76,7 @@ class KsCanYu extends AdminBase array_push($src['banji_id'], $value->glBanji->id); } } - } + $bj = $khSrc->class($src); $bj = reSetArray($bj, $src); @@ -84,6 +84,7 @@ class KsCanYu extends AdminBase } + // 根据考试ID和年级获取参加考试班级 public function tjClass() { @@ -126,4 +127,27 @@ class KsCanYu extends AdminBase return json($sbj); } + + + // // 根据教师ID获取可以录入成绩的班级 + // public function lrclass() + // { + // $lrfg = new \app\kaoshi\model\LuruFengong; + + // // 获取参数 + // $src = $this->request + // ->only([ + // 'kaoshi_id' => '' + // ], 'POST'); + + // $lrfgCnt = $lrfg->srcMyLuruBanji($src); + // } + + + // 根据教师ID获取可以录入成绩的班级 + public function lrsubject() + { + + } + } diff --git a/app/kaoshi/model/LuruFengong.php b/app/kaoshi/model/LuruFengong.php index fd07a552..fd2cbead 100644 --- a/app/kaoshi/model/LuruFengong.php +++ b/app/kaoshi/model/LuruFengong.php @@ -22,8 +22,8 @@ class LuruFengong extends BaseModel ]; $src = array_cover($srcfrom, $src) ; $src['kaoshi_id'] = strToarray($src['kaoshi_id']); - $src['banji_id'] = strToarray($src['banji_id']); - $src['subject_id'] = strToarray($src['subject_id']); + $src['banji_id'] = strToarray($src['banji_id']); + $src['subject_id'] = strToarray($src['subject_id']); $logList = self::where('kaoshi_id', 'in', $src['kaoshi_id']) ->when(count($src['banji_id']) > 0, function($query) use($src){ @@ -77,13 +77,34 @@ class LuruFengong extends BaseModel { $src = [ 'kaoshi_id' => '' + ,'banji_id' => array() ]; $src = array_cover($srcfrom, $src) ; + + $all = $this->where('kaoshi_id', $src['kaoshi_id']) + ->select(); + $data['count'] = $all->count(); + $admin_id = session('user_id'); - $data = $this->where('user_id', $admin_id) + $list = $this->where('admin_id', $admin_id) ->where('kaoshi_id', $src['kaoshi_id']) - ->group('banji_id') - ->column(['banji_id']); + ->where(count($src['banji_id']) > 0, function($query) use($src) { + $query->where('banji_id', 'in', $src['banji_id']); + }) + ->with([ + 'fgBanji' => function ($query) { + $query->field('id, ruxuenian, paixu, school_id') + ->with([ + 'glSchool' => function($q){ + $q->field('id, title, jiancheng'); + }, + ]) + ->append(['banjiTitle']); + } + ]) + ->field('banji_id, subject_id') + ->select(); + $data['list'] = $list; return $data; } diff --git a/app/luru/view/index/biaolu.html b/app/luru/view/index/biaolu.html index 8688d134..d3274191 100755 --- a/app/luru/view/index/biaolu.html +++ b/app/luru/view/index/biaolu.html @@ -122,8 +122,8 @@ layui.use(['form', 'upload', 'canyuKaoshi', 'createInput'], function() { form.on('select(src)', function(data) { data = form.val("dwform"); if (data.kaoshi_id > 0 && data.school_id > 0 && data.ruxuenian > 0) { - canyu.banjiCheckbox('banji_id', data); canyu.subjectCheckbox('subject_id', data); + canyu.banjiCheckbox('banji_id', data); } }); diff --git a/database/seeds/Category.php b/database/seeds/Category.php index ee36b9b7..44ff1706 100755 --- a/database/seeds/Category.php +++ b/database/seeds/Category.php @@ -317,11 +317,13 @@ class Category extends Seeder ,'paixu' => 24 ,'isupdate' => 0 ], - // 考试查看范围 - ['id' => 12401,'title' => '区级','p_id' => 124,'paixu' => 1,'isupdate' => 0], - ['id' => 12402,'title' => '学校','p_id' => 124,'paixu' => 2,'isupdate' => 0], - ['id' => 12403,'title' => '年级组','p_id' => 124,'paixu' => 3,'isupdate' => 0], - ['id' => 12404,'title' => '班级','p_id' => 124,'paixu' => 4,'isupdate' => 0], + // 考试查询权限 + ['id' => 12401,'title' => '全区','p_id' => 124,'paixu' => 1,'isupdate' => 0], + ['id' => 12402,'title' => '全校','p_id' => 124,'paixu' => 2,'isupdate' => 0], + ['id' => 12403,'title' => '年级全学科','p_id' => 124,'paixu' => 3,'isupdate' => 0], + ['id' => 12404,'title' => '年级学科','p_id' => 124,'paixu' => 4,'isupdate' => 0], + ['id' => 12405,'title' => '班级全学科','p_id' => 124,'paixu' => 5,'isupdate' => 0], + ['id' => 12406,'title' => '班级学科','p_id' => 124,'paixu' => 6,'isupdate' => 0], ]; $serRows = $this->fetchAll('select * from cj_category'); diff --git a/public/static/x-admin2.2/js/canyuKaoshi.js b/public/static/x-admin2.2/js/canyuKaoshi.js index 57825a6b..83d36034 100644 --- a/public/static/x-admin2.2/js/canyuKaoshi.js +++ b/public/static/x-admin2.2/js/canyuKaoshi.js @@ -10,14 +10,14 @@ layui.define(['table', 'form', 'upload'], function(exports) { var obj = { gradeSelect: function(myid, kaoshi_id, value = '', hasNull = true) { - $.ajax({ + $('#' + myid).children().remove(); + $.ajax({ url: '/kaoshi/kscy/grade', type: 'POST', data: { kaoshi_id: kaoshi_id }, success: function(result) { - $('#' + myid).children().remove(); if (hasNull == true) { str = ''; } else { @@ -44,12 +44,12 @@ layui.define(['table', 'form', 'upload'], function(exports) { // 参与本次考试学科 subjectSelect: function(myid, data, value = '', hasNull = true) { - $.ajax({ + $('#' + myid).children().remove(); + $.ajax({ url: '/kaoshi/kscy/subject', type: 'POST', data: data, success: function(result) { - $('#' + myid).children().remove(); if (hasNull == true) { str = ''; } else { @@ -76,12 +76,13 @@ layui.define(['table', 'form', 'upload'], function(exports) { // 已经参与本次考试学科 subjectCheckbox: function(myid, data, hasAll = true) { - $.ajax({ + $('#' + myid).children().remove(); + $.ajax({ url: '/kaoshi/kscy/subject', type: 'POST', data: data, success: function(result) { - $('#' + myid).children().remove(); + if (hasAll == true) { str = ''; } else { @@ -104,12 +105,12 @@ layui.define(['table', 'form', 'upload'], function(exports) { // 参与本次考试班级 banjiSelect: function(myid, data, value = '', hasNull = true) { - $.ajax({ + $('#' + myid).children().remove(); + $.ajax({ url: '/kaoshi/kscy/class', type: 'POST', data: data, success: function(result) { - $('#' + myid).children().remove(); if (hasNull == true) { str = ''; } else { @@ -136,12 +137,12 @@ layui.define(['table', 'form', 'upload'], function(exports) { // 已经参与本次考试班级 banjiCheckbox: function(myid, data, hasAll = true) { - $.ajax({ + $('#' + myid).children().remove(); + $.ajax({ url: '/kaoshi/kscy/class', type: 'POST', data: data, success: function(result) { - $('#' + myid).children().remove(); if (hasAll == true) { str = ''; } else { @@ -164,14 +165,14 @@ layui.define(['table', 'form', 'upload'], function(exports) { // 参与本次考试学校 schoolSelect: function(myid, kaoshi_id, value = '', hasNull = true) { - $.ajax({ + $('#' + myid).children().remove(); + $.ajax({ url: '/kaoshi/kscy/school', type: 'POST', data: { kaoshi_id: kaoshi_id }, success: function(result) { - $('#' + myid).children().remove(); if (hasNull == true) { str = ''; } else { @@ -198,11 +199,11 @@ layui.define(['table', 'form', 'upload'], function(exports) { // 获取可以编辑的考试 kaoshiSelect: function(myid, hasNull = true) { - $.ajax({ + $('#' + myid).children().remove(); + $.ajax({ url: '/kaoshi/index/srceditkaoshi', type: 'POST', success: function(result) { - $('#' + myid).children().remove(); if (hasNull == true) { str = ''; } else { diff --git a/public/static/x-admin2.2/js/createInput.js b/public/static/x-admin2.2/js/createInput.js index 940d84c8..4d8b02a5 100644 --- a/public/static/x-admin2.2/js/createInput.js +++ b/public/static/x-admin2.2/js/createInput.js @@ -15,14 +15,14 @@ layui.extend({ var obj = { // 创建类别的Select categorySelect: function(myid, pid, value = '', hasNull = true) { - $.ajax({ + $('#' + myid).children().remove(); + $.ajax({ url: '/system/category/children', type: 'POST', data: { p_id: pid }, success: function(result) { - $('#' + myid).children().remove(); if (hasNull == true) { str = ''; } else { @@ -133,7 +133,8 @@ layui.extend({ // 创建单位的Select schoolSelect: function(myid, low = '班级', high = '其它级', value, kaoshi = '', hasNull = true) { - $.ajax({ + $('#' + myid).children().remove(); + $.ajax({ url: '/system/school/srcschool', type: 'POST', data: { @@ -142,7 +143,7 @@ layui.extend({ kaoshi: kaoshi }, success: function(result) { - $('#' + myid).children().remove(); + if (hasNull == true) { str = ''; } else { @@ -445,7 +446,8 @@ layui.extend({ // 创建类别的Select subjectSelect: function(myid, value = '', kaoshi = '', hasNull = true) { - $.ajax({ + $('#' + myid).children().remove(); + $.ajax({ url: '/teach/subject/data', type: 'POST', data: { @@ -453,7 +455,6 @@ layui.extend({ kaoshi: kaoshi }, success: function(result) { - $('#' + myid).children().remove(); if (hasNull == true) { str = ''; } else { @@ -480,12 +481,12 @@ layui.extend({ // 创建班级checkbox banjiCheckbox: function(myid, data, value = '', hasAll = true) { - $.ajax({ + $('#' + myid).children().remove(); + $.ajax({ url: '/teach/banji/mybanji', type: 'POST', data: data, success: function(result) { - $('#' + myid).children().remove(); if (hasAll == true) { str = ''; } else { @@ -512,12 +513,12 @@ layui.extend({ // 创建班级checkbox banjiSelect: function(myid, data, value = '', hasAll = true) { - $.ajax({ + $('#' + myid).children().remove(); + $.ajax({ url: '/teach/banji/mybanji', type: 'POST', data: data, success: function(result) { - $('#' + myid).children().remove(); if (hasAll == true) { str = ''; } else { @@ -544,12 +545,12 @@ layui.extend({ // 创建年级的Select nanjiSelect: function(myid, data, value = '', hasNull = true) { - $.ajax({ + $('#' + myid).children().remove(); + $.ajax({ url: '/teach/banji/njlist', type: 'POST', data: data, success: function(result) { - $('#' + myid).children().remove(); if (hasNull == true) { str = ''; } else { @@ -576,11 +577,11 @@ layui.extend({ // 创建学期的Select xueqiSelect: function(myid, value = '', hasNull = true) { - $.ajax({ + $('#' + myid).children().remove(); + $.ajax({ url: '/teach/xueqi/srcxueqi', type: 'POST', success: function(result) { - $('#' + myid).children().remove(); if (hasNull == true) { str = ''; } else {