diff --git a/app/admin/view/index/index.html b/app/admin/view/index/index.html index e1ba7fbd..17431d47 100755 --- a/app/admin/view/index/index.html +++ b/app/admin/view/index/index.html @@ -58,9 +58,7 @@ layui.use(['table', 'mytable', 'form'], function() { options.cols = [ [ //表头 { type: 'checkbox', fixed: 'left' }, - { field: 'status', title: '状态', templet: '#status', sort: true }, - { field: 'id', title: '操作', toolbar: '#barDemo', minWidth: 140 }, - { field: 'xingming', title: '姓名', sort: true, minWidth: 80 }, + { field: 'xingming', title: '姓名', sort: true, minWidth: 80, fixed: 'left' }, { field: 'sex', title: '性别', minWidth: 100, sort: true }, { field: "shengri", title: '生日', minWidth: 100, sort: true }, { field: 'username', title: '帐号', sort: true }, @@ -96,6 +94,8 @@ layui.use(['table', 'mytable', 'form'], function() { { field: 'denglucishu', title: '登录次数', minWidth: 100, sort: true }, { field: 'thistime', title: '最后登录时间', minWidth: 180, sort: true }, { field: 'ip', title: '最后登录地址', minWidth: 130, sort: true }, + { field: 'status', title: '状态', templet: '#status', sort: true }, + { field: 'id', title: '操作', toolbar: '#barDemo', minWidth: 140 }, ] ]; diff --git a/app/chengji/controller/Bjtongji.php b/app/chengji/controller/Bjtongji.php index c83ceffc..e2f95919 100755 --- a/app/chengji/controller/Bjtongji.php +++ b/app/chengji/controller/Bjtongji.php @@ -515,11 +515,8 @@ class Bjtongji extends AdminBase $list['data'] = $btj->where('kaoshi_id', $info->kaoshi_id) ->where('banji_id', $info->banji_id) ->where('subject_id', '>', 0) - ->field('id, teacher_id, kaoshi_id, banji_id, subject_id') + ->field('id, kaoshi_id, banji_id, subject_id') ->with([ - 'bjTeacher' => function ($query) { - $query->field('id, xingming'); - }, 'bjSubject' => function ($query) { $query ->field('id, title, jiancheng'); } @@ -564,10 +561,13 @@ class Bjtongji extends AdminBase // 整理数据 $list = array(); foreach ($src['id'] as $key => $value) { - $list[$key] = [ - 'id' => $value - ,'teacher_id' => $src['teacher_id'][$key] - ]; + if(strlen($src['teacher_id'][$key]) > 0) + { + $list[$key] = [ + 'id' => $value + ,'teacher_id' => $src['teacher_id'][$key] + ]; + } } $btj = new BTJ; @@ -586,7 +586,11 @@ class Bjtongji extends AdminBase { $list['data']['kaoshi_id'] = $kaoshi_id; $sbj = new \app\teach\model\Subject; - $list['data']['subject_id'] = $sbj->kaoshi(); + $src = [ + 'kaoshi' => 1 + ,'status' => 1 + ]; + // $list['data']['subject_id'] = $sbj->search($src); // halt($list); // 设置页面标题 $list['set'] = array( @@ -610,28 +614,36 @@ class Bjtongji extends AdminBase $src = $this->request ->only([ 'teacher_id' => '' - ,'id' => array() + ,'banji_id' => array() + ,'subject_id' => '' + ,'kaoshi_id' => '' ], 'POST'); + // 验证表单数据 $validate = new \app\chengji\validate\RenKe; - $result = $validate->scene('edit')->check($src); + $result = $validate->scene('editteacher')->check($src); $msg = $validate->getError(); if(!$result){ return json(['msg'=>$msg,'val'=>0]);; } // 整理数据 - $list = array(); - foreach ($src['id'] as $key => $value) { - $list[$key] = [ - 'id' => $value - ,'teacher_id' => $src['teacher_id'] + $btj = new BTJ; + foreach ($src['banji_id'] as $key => $value) { + $map = [ + ['kaoshi_id', '=', $src['kaoshi_id']], + ['banji_id', '=', $value], + ['subject_id', '=', $src['subject_id']], ]; + $btjInfo = $btj->where([ $map ])->find(); + if($btjInfo) + { + $btjInfo->teacher_id = $src['teacher_id']; + $data = $btjInfo->save(); + } } - $btj = new BTJ; - $data = $btj->saveAll($list); $data ? $data = ['msg' => '设置成功', 'val' => 1] : $data = ['msg' => '数据处理错误', 'val' => 0]; diff --git a/app/chengji/controller/Index.php b/app/chengji/controller/Index.php index 3bd64b54..60a34ee3 100755 --- a/app/chengji/controller/Index.php +++ b/app/chengji/controller/Index.php @@ -152,7 +152,7 @@ class Index extends AdminBase // 删除单人单科成绩 - public function delete($id) + public function delete() { // 整理数据 $id = request()->delete('id'); diff --git a/app/chengji/model/TongjiBj.php b/app/chengji/model/TongjiBj.php index c0407ba9..f7ffab3d 100755 --- a/app/chengji/model/TongjiBj.php +++ b/app/chengji/model/TongjiBj.php @@ -667,7 +667,7 @@ class TongjiBj extends BaseModel ->append(['banTitle']) ->find(); - $njlist = nianJiNameList('str', $ksInfo->getData('enddate')); + $njlist = \app\facade\Tools::nianJiNameList($ksInfo->getData('enddate'), 'str'); $njname = $njlist[$bjInfo->ruxuenian]; $title = $njname . $bjInfo->banTitle; diff --git a/app/chengji/route/chengji.php b/app/chengji/route/chengji.php index 316c078e..039a7fc0 100755 --- a/app/chengji/route/chengji.php +++ b/app/chengji/route/chengji.php @@ -17,7 +17,7 @@ Route::group('index', function () { Route::rule('data','Index/ajaxData','post'); # 成绩获取 Route::rule('readcjadd/','Index/readAdd','get'); # 成绩录入列表 Route::rule('dataadd','Index/ajaxaddinfo','post'); # 成绩录入列表数据 - Route::rule('delete/','Index/delete','delete'); # 成绩删除 + Route::rule('delete','Index/delete','delete'); # 成绩删除 Route::rule('deletecjs/','Index/deletecjs','get'); # 成绩删除 Route::rule('deletecjmore','Index/deletecjmore','post'); # 成绩删除 Route::rule('dwchengji/','Index/dwChengji','get'); # 成绩删除 diff --git a/app/chengji/validate/RenKe.php b/app/chengji/validate/RenKe.php index 381e63c2..48fc6a01 100755 --- a/app/chengji/validate/RenKe.php +++ b/app/chengji/validate/RenKe.php @@ -14,8 +14,11 @@ class RenKe extends Validate * @var array */ protected $rule = [ - 'id|ID' => 'require|array', + 'id|班级成绩编号' => 'require|array', + 'baji_id|班级编号' => 'require|array', 'teacher_id|教师' => 'require', + 'subject_id|学科' => 'require', + 'kaoshi_id|考试编辑' => 'require', ]; /** @@ -30,6 +33,12 @@ class RenKe extends Validate 'edit' => [ 'id' ,'teacher_id' + ], + 'editteacher' => [ + 'banji_id' + ,'teacher_id' + ,'subject_id' + ,'kaoshi_id' ] ]; } diff --git a/app/chengji/view/bjtongji/renke.html b/app/chengji/view/bjtongji/renke.html index b64203bd..fc0edeba 100755 --- a/app/chengji/view/bjtongji/renke.html +++ b/app/chengji/view/bjtongji/renke.html @@ -13,29 +13,26 @@ {/block} {block name="search"}
- -
- - {volist name="$list.school_id" id="vo"} - - {/volist} -
+ +
+ +
- -
- {volist name="$list.nianji" id="vo"} - - {/volist} -
+ +
+ +
- -
-
+ +
+
+ {/block} {block name="table"} @@ -60,42 +57,51 @@ {/block} diff --git a/app/chengji/view/bjtongji/renke_edit.html b/app/chengji/view/bjtongji/renke_edit.html index e8121435..128f67c7 100755 --- a/app/chengji/view/bjtongji/renke_edit.html +++ b/app/chengji/view/bjtongji/renke_edit.html @@ -4,17 +4,14 @@
{volist name="list.data" id="vo"}
- -
- - - -
-
+ +
+
+
+ {/volist}
- -
+ +
+
- -
- - -
-
+ +
+
+
-
- -
- {volist name="list.set.school_id" id="vo"} - - {/volist} -
-
-
- -
- {foreach $list.set.nianji as $key=>$vo} - - {/foreach} -
-
-
- -
-
-
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+
+
{/block} @@ -80,19 +81,32 @@ {/block} diff --git a/app/kaohao/controller/Index.php b/app/kaohao/controller/Index.php index 41b59b73..6de51a49 100755 --- a/app/kaohao/controller/Index.php +++ b/app/kaohao/controller/Index.php @@ -169,12 +169,13 @@ class Index extends AdminBase // 获取表单数据 $list = request()->only([ 'kaoshi_id' - ,'banji_id' - ,'student_id' ,'school_id' + ,'ruxuenian' + ,'nianji' + ,'banji_id' + ,'paixu' + ,'student_id' ], 'POST'); - $list['student_id'] = explode(' ', $list['student_id']); - $list['student_id'] = $list['student_id'][1]; event('kslu', $list['kaoshi_id']); @@ -184,27 +185,37 @@ class Index extends AdminBase ->where('student_id', $list['student_id']) ->find(); - // 如果存在成绩则更新,不存在则添加 - if($ks) - { - // 判断记录是否被删除 - if($ks->delete_time > 0) - { - $ks->restore(); - } - $data = ['msg' => '生成成功', 'val' => 1]; - }else{ - // 获取参加考试年级数组 - $enddate = KS::where('id', $list['kaoshi_id'])->value('enddate'); - $njlist = nianJiNameList('str', $enddate); + $list['student_id'] = explode(',', $list['student_id']); + $temp = array(); + foreach ($list['student_id'] as $key => $value) { + $temp = [ + 'kaoshi_id' => $list['kaoshi_id'] + ,'school_id' => $list['school_id'] + ,'ruxuenian' => $list['ruxuenian'] + ,'nianji' => $list['nianji'] + ,'banji_id' => $list['banji_id'] + ,'paixu' => $list['paixu'] + ,'student_id' => $value + ]; + + $ks = KH::withTrashed() + ->where('kaoshi_id', $temp['kaoshi_id']) + ->where('student_id', $temp['student_id']) + ->find(); + + // 如果存在成绩则更新,不存在则添加 + if($ks) + { + // 判断记录是否被删除 + if($ks->delete_time > 0) + { + $ks->restore(); + } + $data = ['msg' => '生成成功', 'val' => 1]; + }else{ + $data = KH::create($temp); + } - // 获取班级信息 - $bj = new \app\teach\model\Banji; - $bjinfo = $bj->where('id', $list['banji_id'])->find(); - $list['ruxuenian'] = $bjinfo->ruxuenian; - $list['nianji'] = $njlist[$bjinfo->ruxuenian]; - $list['paixu'] = $bjinfo->paixu; - $data = KH::create($list); } // 根据更新结果设置返回提示信息 @@ -238,7 +249,7 @@ class Index extends AdminBase // 删除考号 - public function delete($id) + public function delete() { // 整理数据 $id = request()->delete('id'); diff --git a/app/kaohao/route/kaohao.php b/app/kaohao/route/kaohao.php index 334d4195..48aa00e0 100755 --- a/app/kaohao/route/kaohao.php +++ b/app/kaohao/route/kaohao.php @@ -14,7 +14,7 @@ use think\facade\Route; Route::group('index', function () { Route::rule('create/', 'Index/create', 'get'); # 信息列表 Route::rule('save', 'Index/save', 'post'); # 保存信息 - Route::rule('delete/', 'Index/delete', 'delete'); # 成绩采集下载 + Route::rule('delete', 'Index/delete', 'delete'); # 成绩采集下载 Route::rule('createall/', 'Index/createAll', 'get'); # 信息列表 Route::rule('saveall', 'Index/saveAll', 'post'); # 保存信息 Route::rule('read/', 'Index/read', 'get'); # 读取信息 diff --git a/app/kaohao/validate/Kaohao.php b/app/kaohao/validate/Kaohao.php index 65cfe38d..2fff8822 100755 --- a/app/kaohao/validate/Kaohao.php +++ b/app/kaohao/validate/Kaohao.php @@ -14,7 +14,12 @@ class Kaohao extends Validate */ protected $rule = [ 'kaoshi_id|考试号' => 'require|number', - 'banji_id|参考班级' => 'require|array', + 'school_id|学校' => 'require|number', + 'ruxuenian|入学年' => 'require|number', + 'nianji|年级名称' => 'require|number', + 'banji_id|参考班级' => 'require', + 'paixu|班级排序' => 'require|number', + 'student_id|学生' => 'require', ]; /** @@ -27,6 +32,15 @@ class Kaohao extends Validate protected $scene = [ 'create' => [ + 'kaoshi_id' + ,'school_id' + ,'ruxuenian' + ,'nianji' + ,'banji_id' + ,'paixu' + ,'student_id' + ], + 'createAll' => [ 'kaoshi_id' ,'banji_id' ] diff --git a/app/kaohao/view/index/create.html b/app/kaohao/view/index/create.html index 5b62befd..82cb07e7 100755 --- a/app/kaohao/view/index/create.html +++ b/app/kaohao/view/index/create.html @@ -2,39 +2,17 @@ {block name="form"} -
- -
-
- -
-
-
- {php}$schoolList = danweiJibie('校级', '校级'); {/php} -
- +
-
@@ -43,22 +21,20 @@ *班级
-
-
- -
-
- -
-
+
+ +
+
- + + +
diff --git a/app/kaoshi/view/luru_fengong/index.html b/app/kaoshi/view/luru_fengong/index.html index 71788a57..4513bcbc 100644 --- a/app/kaoshi/view/luru_fengong/index.html +++ b/app/kaoshi/view/luru_fengong/index.html @@ -74,6 +74,7 @@ layui.use(['table', 'mytable', 'canyuKaoshi'], function() { field: 'admin_id', title: '教师', sort: true, + fixed: 'left', templet: function(d) { var str = ''; if (d.fgAdmin) { diff --git a/app/kaoshi/view/tongji_xiangmu/index.html b/app/kaoshi/view/tongji_xiangmu/index.html index d9fee0a1..1a390a4c 100755 --- a/app/kaoshi/view/tongji_xiangmu/index.html +++ b/app/kaoshi/view/tongji_xiangmu/index.html @@ -56,10 +56,11 @@ // 提交搜索条件后重载表格 - layui.use(['table', 'mytable', 'createInput'], function(){ + layui.use(['table', 'mytable', 'createInput', 'form'], function(){ var table = layui.table ,mytable = layui.mytable - ,cInput = layui.createInput; + ,cInput = layui.createInput + ,form = layui.form; cInput.categorySelect('category_id', 122);; @@ -93,7 +94,7 @@ mytable.delAll(checkStatus, '/kaoshi/tjxm/delete', 'mytable'); break; case 'add': - mytable.add('新建项目', '/kaoshi/tjxm/create', '600', '300', false); + xadmin.open('新建项目', '/kaoshi/tjxm/create', '600', '300', false); break; }; }); @@ -108,7 +109,7 @@ mytable.del(obj, "/kaoshi/tjxm/delete"); break; case 'edit':// 编辑 - mytable.add('编辑项目', '/kaoshi/tjxm/edit/' + obj.data.id, '600', '300', false); + xadmin.open('编辑项目', '/kaoshi/tjxm/edit/' + obj.data.id, '600', '300', false); break; }; }); diff --git a/app/student/controller/Index.php b/app/student/controller/Index.php index d3e28d5e..92b7faf3 100755 --- a/app/student/controller/Index.php +++ b/app/student/controller/Index.php @@ -578,12 +578,15 @@ class Index extends AdminBase { // 声明结果数组 $data = array(); - $str = input("post.str"); + $str = input("post.searchval"); $banji_id = input("post.banji_id"); $kaoshi = input("post.kaoshi"); + $src = array(); + // 判断是否存在数据,如果没有数据则返回。 if(strlen($str) <= 0){ + $data = reSetObject($data, $src); return json($data); } @@ -610,7 +613,17 @@ class Index extends AdminBase ) ->append(['age']) ->select(); - return json($list); + + foreach ($list as $key => $value) { + $data[] = [ + 'id' => $value->id + ,'xingming' => $value->xingming + ]; + } + + $data = reSetArray($data, $src); + + return json($data); } diff --git a/app/student/view/index/index.html b/app/student/view/index/index.html index 3f5960ac..654b268e 100755 --- a/app/student/view/index/index.html +++ b/app/student/view/index/index.html @@ -88,12 +88,13 @@ layui.use(['table', 'mytable', 'createInput', 'form'], function() { options.cols = [ [ //表头 { type: 'checkbox', fixed: 'left' }, - { field: 'xingming', title: '姓名', sort: true }, - { field: 'sex', title: '性别', sort: true }, + { field: 'xingming', title: '姓名', minWidth:100, sort: true, fixed: 'left' }, + { field: 'sex', title: '性别', sort: true, minWidth:100 }, { field: "shengri", title: '周岁', sort: true, + minWidth:100, templet: function(d) { return d.age; } @@ -110,8 +111,8 @@ layui.use(['table', 'mytable', 'createInput', 'form'], function() { return str; } }, - { field: 'status', title: '是否参加考试', templet: '#kaoshi', sort: true }, - { field: 'status', title: '状态', templet: '#status', sort: true }, + { field: 'status', title: '是否参加考试', templet: '#kaoshi', minWidth:80, sort: true }, + { field: 'status', title: '状态', templet: '#status', minWidth:80, sort: true }, { field: 'id', title: '操作', toolbar: '#barDemo', minWidth: 180 } ] ]; diff --git a/app/system/view/back_up/index.html b/app/system/view/back_up/index.html index c84fd1b7..75fdfbfc 100755 --- a/app/system/view/back_up/index.html +++ b/app/system/view/back_up/index.html @@ -40,12 +40,12 @@ layui.use(['table', 'backUp', 'form'], function() { options.cols = [ [ //表头 { field: 'time', type: 'checkbox', fixed: 'left' }, - { field: 'ltime', title: '时间', sort: true, minWidth: 100 }, + { field: 'ltime', title: '时间', sort: true, minWidth: 100, fixed: 'left'}, { field: 'juan', title: '卷数', sort: true, minWidth: 100 }, { field: 'yasuo', title: '压缩', sort: true, minWidth: 100 }, { field: 'lsize', title: '文件大小', minWidth: 100, sort: true }, { field: 'status', title: '状态', minWidth: 100, sort: true }, - { field: 'id', title: '操作', toolbar: '#barDemo', minWidth: 90 } + { field: 'id', title: '操作', toolbar: '#barDemo', minWidth: 90, fixed: 'right'} ] ]; diff --git a/app/system/view/category/index.html b/app/system/view/category/index.html index 18df66aa..9eeb88b1 100755 --- a/app/system/view/category/index.html +++ b/app/system/view/category/index.html @@ -94,7 +94,7 @@ layui.use(['table', 'mytable', 'createInput', 'form'], function() { } }, { field: 'status', title: '状态', templet: '#status', sort: true }, - { field: 'id', title: '操作', toolbar: '#barDemo', minWidth: 140 } + { field: 'id', title: '操作', toolbar: '#barDemo', minWidth: 80, fixed: 'right'} ] ]; diff --git a/app/system/view/fields/index.html b/app/system/view/fields/index.html index 6160f296..b34a4490 100755 --- a/app/system/view/fields/index.html +++ b/app/system/view/fields/index.html @@ -92,7 +92,7 @@ layui.use(['table', 'mytable', 'form'], function() { } }, { field: 'update_time', title: '上传时间', minWidth: 160, sort: true }, - { field: 'id', title: '操作', toolbar: '#barDemo', minWidth: 90 } + { field: 'id', title: '操作', toolbar: '#barDemo', minWidth: 90, fixed: 'right' } ] ]; diff --git a/public/static/x-admin2.2/js/canyuKaoshi.js b/public/static/x-admin2.2/js/canyuKaoshi.js index e0d640f6..926a9f11 100644 --- a/public/static/x-admin2.2/js/canyuKaoshi.js +++ b/public/static/x-admin2.2/js/canyuKaoshi.js @@ -102,6 +102,38 @@ layui.define(['table', 'form', 'upload'], function(exports) { }, + // 参与本次考试班级 + banjiSelect: function(myid, data, value= '', hasNull = true){ + $.ajax({ + url: '/kaoshi/kscy/class', + type: 'POST', + data: data, + success: function(result) { + $('#' + myid).children().remove(); + if (hasNull == true) { + str = ''; + } else { + str = ''; + } + temp = ""; + $(result.data).each(function(i, el) { + if (value != '' && value == el.id) { + temp = ''; + } else { + temp = ''; + } + str = str + temp; + }); + $('#' + myid).append(str); + form.render('select'); + }, + error: function(result) { + layer.msg('数据扔半道啦。', function() {}); + }, + }); + }, + + // 已经参与本次考试班级 banjiCheckbox: function(myid, data,hasAll = true){ $.ajax({ diff --git a/public/static/x-admin2.2/js/createInput.js b/public/static/x-admin2.2/js/createInput.js index 3159330b..b828cf0f 100644 --- a/public/static/x-admin2.2/js/createInput.js +++ b/public/static/x-admin2.2/js/createInput.js @@ -124,7 +124,6 @@ layui.extend({ { layui.each(myPid, function(i, el){ this.checked = check; - // editPid(el, check); }) } } @@ -172,11 +171,15 @@ layui.extend({ }, // 查询老师 - searchTeacher: function(id, radio = false) { - school_id = $('#' + id).attr('school_id'); + searchTeacher: function(id, radio = false, name = '') { + if(name == '') + { + name = id; + } + var school_id = ''; x = xmSelect.render({ el: '#' + id, - name: id, + name: name, autoRow: true, toolbar: { show: true }, filterable: true, @@ -189,7 +192,7 @@ layui.extend({ name: 'xingming', value: 'id', }, - height: '25px', + // height: '25px', size: 'mini', radio: radio, showCount: 8, @@ -234,6 +237,75 @@ layui.extend({ }, + // 查询老师 + searchStudent: function(id, radio = false, name = '') { + if(name == '') + { + name = id; + } + var banji_id = ''; + x = xmSelect.render({ + el: '#' + id, + name: name, + autoRow: true, + toolbar: { show: true }, + filterable: true, + remoteSearch: true, + tips: '请选择教师', + theme: { + color: '#1cbbb4', + }, + prop: { + name: 'xingming', + value: 'id', + }, + // height: '25px', + size: 'mini', + radio: radio, + showCount: 8, + repeat: false, + model: { + label: { + type: 'text', + //使用字符串拼接的方式 + text: { + //左边拼接的字符 + left: '【', + //右边拼接的字符 + right: '】', + //中间的分隔符 + separator: ',', + }, + } + }, + remoteMethod: function(val, cb, show) { + + //这里如果val为空, 则不触发搜索 + if (!val) { + return cb([]); + } + + $.ajax({ + url: '/student/index/srcstudent', + type: 'POST', + data: { + searchval: val, + banji_id: 1, + kaoshi:1 + }, + success: function(result) { + cb(result.data); + }, + error: function(result) { + layer.msg('数据扔半道啦。', function() {}); + }, + }); + }, + }) + return x; + }, + + // 载入搜索框中已经保存的教师 loadTeacher: function(obj, url, data) { $.ajax({ @@ -382,7 +454,7 @@ layui.extend({ // 创建班级checkbox - banjiCheckbox: function(myid, data, value, hasAll = true) { + banjiCheckbox: function(myid, data, value='', hasAll = true) { $.ajax({ url: '/teach/banji/mybanji', type: 'POST', @@ -414,7 +486,7 @@ layui.extend({ // 创建班级checkbox - banjiSelect: function(myid, data, value, hasAll = true) { + banjiSelect: function(myid, data, value='', hasAll = true) { $.ajax({ url: '/teach/banji/mybanji', type: 'POST', @@ -446,7 +518,7 @@ layui.extend({ // 创建年级的Select - nanjiSelect: function(myid, data, value, hasNull = true) { + nanjiSelect: function(myid, data, value='', hasNull = true) { $.ajax({ url: '/teach/banji/njlist', type: 'POST',