From 970c71ed1406dec8b0ba2a55fe082419c183ee8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B7=B4=E6=8E=8C?= Date: Mon, 15 Mar 2021 16:39:19 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=95=99=E5=B8=88=E5=B8=90?= =?UTF-8?q?=E5=8F=B7=E4=B8=8E=E7=94=B5=E8=AF=9D=E9=AA=8C=E8=AF=81=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/controller/Index.php | 73 ++++++ app/admin/route/admin.php | 2 + app/admin/view/index/create.html | 226 +++++++++++------- app/system/controller/School.php | 3 +- app/system/model/School.php | 19 ++ app/system/view/school/create.html | 6 + app/system/view/school/index.html | 6 +- database/migrations/20181028025648_kaoshi.php | 1 + .../20210215021427_teacher_to_admin.php | 21 +- database/seeds/Admin.php | 26 +- public/static/x-admin2.2/js/createInput.js | 1 - 11 files changed, 285 insertions(+), 99 deletions(-) diff --git a/app/admin/controller/Index.php b/app/admin/controller/Index.php index acf525d1..a43c149d 100755 --- a/app/admin/controller/Index.php +++ b/app/admin/controller/Index.php @@ -380,4 +380,77 @@ class Index extends AdminBase return json($data); } + + + // 查询用户名是否重复 + public function srcUsername() + { + // 获取参数 + $srcfrom = $this->request + ->only([ + 'searchval' => '' + ,'id' => '' + ], 'POST'); + $src = [ + 'searchval' => '' + ,'id' => '' + ]; + $src = array_cover($srcfrom, $src); + + $ad = new AD(); + $list = $ad->where('username', $src['searchval']) + ->find(); + $data = ['msg' => '用户名已经存在!', 'val' => 0]; + + if($list) + { + if($src['id'] > 0) + { + + if($src['id'] == $list->id){ + $data = ['msg' => '', 'val' => 1]; + } + } + }else{ + $data = ['msg' => '', 'val' => 1]; + } + return json($data); + } + + + // 查询用户名是否重复 + public function srcPhone() + { + // 获取参数 + $srcfrom = $this->request + ->only([ + 'searchval' => '' + ,'id' + ], 'POST'); + $src = [ + 'searchval' => '' + ,'id' => '' + ]; + $src = array_cover($srcfrom, $src); + + $ad = new AD(); + $list = $ad->where('phone', $src['searchval']) + ->find(); + + // 根据更新结果设置返回提示信息 + $data = ['msg' => '电话号码已经存在!', 'val' => 0]; + if($list) + { + if($src['id'] > 0) + { + + if($src['id'] == $list->id){ + $data = ['msg' => '', 'val' => 1]; + } + } + }else{ + $data = ['msg' => '', 'val' => 1]; + } + return json($data); + } } diff --git a/app/admin/route/admin.php b/app/admin/route/admin.php index f1d96cc7..69685001 100755 --- a/app/admin/route/admin.php +++ b/app/admin/route/admin.php @@ -27,6 +27,8 @@ Route::group('index', function () { Route::rule('saveall','Index/saveAll','post'); # 批量保存 Route::rule('srcteacher','Index/srcAdmin','post'); # 查询教师 Route::rule('resetpassword/', 'Index/resetPassword', 'post'); # 重置密码 + Route::rule('srcusername','Index/srcUsername','post'); # 查询用户名是否已经存在 + Route::rule('srcphone','Index/srcPhone','post'); # 查询电话是否已经存在 }); diff --git a/app/admin/view/index/create.html b/app/admin/view/index/create.html index a7d78020..0e3fc529 100755 --- a/app/admin/view/index/create.html +++ b/app/admin/view/index/create.html @@ -30,7 +30,7 @@ *帐号
- +
@@ -44,106 +44,104 @@
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- {php} - $authgroup = new \app\admin\model\AuthGroup; - $authgrouplist = $authgroup->where('status',1)->select(); - {/php} - {volist name="authgrouplist" id="vo"} - {/volist}
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
-
+
- +
- +
- -
-
-
- -
- +
- +
- {if (isset($list.data.tuixiu)) } - {else /} - - {/if} + {php} + $authgroup = new \app\admin\model\AuthGroup; + $authgrouplist = $authgroup->where('status',1)->select(); + {/php} + {volist name="authgrouplist" id="vo"} + {/volist}
+ +
+ +
- -
- -
- +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ {if (isset($list.data.tuixiu)) } + {else /} + + {/if} +
+
+
+ +
+ +
+
+
+
-
-
- -
{/block} {block name="myjs"} diff --git a/app/system/controller/School.php b/app/system/controller/School.php index 7f2711af..25766b6d 100755 --- a/app/system/controller/School.php +++ b/app/system/controller/School.php @@ -129,7 +129,7 @@ class School extends AdminBase { // 获取单位信息 - $list['data'] = sch::field('id, title, jiancheng, biaoshi, xingzhi_id, jibie_id, status, xueduan_id, paixu') + $list['data'] = sch::field('id, title, jiancheng, biaoshi, xingzhi_id, jibie_id, status, xueduan_id, paixu, kaoshi') ->find($id); // 设置页面标题 @@ -161,6 +161,7 @@ class School extends AdminBase ,'xingzhi_id' ,'jibie_id' ,'xueduan_id' + ,'kaoshi' ,'paixu' => 999 ], 'put'); $list['id'] = $id; diff --git a/app/system/model/School.php b/app/system/model/School.php index b6e69705..7a202887 100755 --- a/app/system/model/School.php +++ b/app/system/model/School.php @@ -34,6 +34,25 @@ class School extends BaseModel } + // 考试获取器 + public function getKaoshiAttr($value) + { + $sex = [ + '0' => '不能' + ,'1' => '能' + ]; + + $str = ''; + if(isset($sex[$value])) + { + $str = $sex[$value]; + }else{ + $str = '未知'; + } + return $str; + } + + // 查询所有单位 public function search($srcfrom) { diff --git a/app/system/view/school/create.html b/app/system/view/school/create.html index 5f9219c7..05cbf937 100755 --- a/app/system/view/school/create.html +++ b/app/system/view/school/create.html @@ -40,6 +40,12 @@
+
+ +
+ +
+
diff --git a/app/system/view/school/index.html b/app/system/view/school/index.html index a609787a..5fa3c5d4 100755 --- a/app/system/view/school/index.html +++ b/app/system/view/school/index.html @@ -57,7 +57,7 @@ @@ -143,7 +143,7 @@ layui.use(['table', 'mytable', 'createInput', 'form'], function() { mytable.delAll(checkStatus, '/system/school/delete', 'mytable'); break; case 'add': - xadmin.open('添加单位', '/system/school/create', '650', '450'); + xadmin.open('添加单位', '/system/school/create', '650', '500'); break; }; }); @@ -161,7 +161,7 @@ layui.use(['table', 'mytable', 'createInput', 'form'], function() { mytable.del(obj, "/system/school/delete"); break; case 'edit': // 编辑 - xadmin.open('编辑单位', '/system/school/edit/' + obj.data.id, '650', '450'); + xadmin.open('编辑单位', '/system/school/edit/' + obj.data.id, '650', '500'); break; }; }); diff --git a/database/migrations/20181028025648_kaoshi.php b/database/migrations/20181028025648_kaoshi.php index d4bdbc4f..4d8e242b 100755 --- a/database/migrations/20181028025648_kaoshi.php +++ b/database/migrations/20181028025648_kaoshi.php @@ -37,6 +37,7 @@ class Kaoshi extends Migrator ->addColumn('zuzhi_id','integer',['limit'=>11,'default'=>0,'null'=>false,'comment'=>'组织考试单位']) ->addColumn('xueqi_id','integer',['limit'=>11,'default'=>0,'null'=>false,'comment'=>'学期']) ->addColumn('category_id','integer',['limit'=>11,'default'=>0,'null'=>false,'comment'=>'类别']) + ->addColumn('user_id','integer',['after' => 'category_id','limit'=>11,'default'=>0,'null'=>false,'comment'=>'用户ID']) ->addColumn('fanwei_id','integer',['limit'=>11,'default'=>0,'null'=>false,'comment'=>'允许查看范围ID']) ->addColumn('bfdate','integer',['limit'=>11,'default'=>1539158918,'null'=>false,'comment'=>'开始日期']) ->addColumn('enddate','integer',['limit'=>11,'default'=>1539158918,'null'=>false,'comment'=>'结束日期']) diff --git a/database/migrations/20210215021427_teacher_to_admin.php b/database/migrations/20210215021427_teacher_to_admin.php index 1612523b..128369a8 100644 --- a/database/migrations/20210215021427_teacher_to_admin.php +++ b/database/migrations/20210215021427_teacher_to_admin.php @@ -52,6 +52,11 @@ class TeacherToAdmin extends Migrator if (!$column) { $table ->addColumn('user_id','integer',['after' => 'category_id','limit'=>11,'default'=>0,'null'=>false,'comment'=>'用户ID']) + ->update(); + } + $column = $table->hasColumn('fanwei_id'); + if (!$column) { + $table ->addColumn('fanwei_id','integer',['after' => 'category_id','limit'=>11,'default'=>0,'null'=>false,'comment'=>'允许查看范围ID']) ->update(); } @@ -60,12 +65,16 @@ class TeacherToAdmin extends Migrator $this->execute('DELETE FROM cj_migrations WHERE version="20210107070200" and migration_name="KaoshiAddUser"'); $table = $this->table('kaoshi_set'); - $table - ->addColumn('lianghao','integer',['after'=>'youxiu','limit'=>3,'default'=>90,'null'=>false,'comment'=>'良好分数线']) - ->addColumn('youxiubi','integer',['after'=>'jige','limit'=>3,'default'=>90,'null'=>false,'comment'=>'优秀人数比']) - ->addColumn('lianghaobi','integer',['after'=>'youxiubi','limit'=>3,'default'=>90,'null'=>false,'comment'=>'良好人数比']) - ->addColumn('jigebi','integer',['after'=>'lianghaobi','limit'=>3,'default'=>00,'null'=>false,'comment'=>'及格人数比']) - ->update(); + $column = $table->hasColumn('lianghao'); + if (!$column) { + $table + ->addColumn('lianghao','integer',['after'=>'youxiu','limit'=>3,'default'=>90,'null'=>false,'comment'=>'良好分数线']) + ->addColumn('youxiubi','integer',['after'=>'jige','limit'=>3,'default'=>90,'null'=>false,'comment'=>'优秀人数比']) + ->addColumn('lianghaobi','integer',['after'=>'youxiubi','limit'=>3,'default'=>90,'null'=>false,'comment'=>'良好人数比']) + ->addColumn('jigebi','integer',['after'=>'lianghaobi','limit'=>3,'default'=>00,'null'=>false,'comment'=>'及格人数比']) + ->update(); + } + } diff --git a/database/seeds/Admin.php b/database/seeds/Admin.php index ad5cbc9b..d619e47f 100755 --- a/database/seeds/Admin.php +++ b/database/seeds/Admin.php @@ -18,17 +18,35 @@ class Admin extends Seeder $rows = [ [ 'id' => 1, - 'xingming' => '超级管理员1', + 'xingming' => '超级管理员一', + 'sex' => 1, + 'shengri' => "-28800", 'username' => 'admin', - 'school_id' => 1, 'password' => '$apr1$RSUodBwI$zOhVq9RQWfQDOW2sbeCDS1', + 'school_id' => 1, + 'phone' => "13190180000", + 'worktime' => "775238400", + 'zhicheng_id' => "10603", + "xueli_id" => "10503", + "quanpin" => "chaojiyi", + "shoupin" => "cjy", + "tuixiu" => 0, ], [ 'id' => 2, - 'xingming' => '超级管理员2', + 'xingming' => '超级管理员二', + 'sex' => 1, + 'shengri' => "-28800", 'username' => 'admin1', - 'school_id' => 1, 'password' => '$apr1$RSUodBwI$zOhVq9RQWfQDOW2sbeCDS1', + 'school_id' => 1, + 'phone' => "13190180001", + 'worktime' => "775238400", + 'zhicheng_id' => "10603", + "xueli_id" => "10503", + "quanpin" => "chaojier", + "shoupin" => "cje", + "tuixiu" => 0, ], ]; diff --git a/public/static/x-admin2.2/js/createInput.js b/public/static/x-admin2.2/js/createInput.js index 6e49ea9f..940d84c8 100644 --- a/public/static/x-admin2.2/js/createInput.js +++ b/public/static/x-admin2.2/js/createInput.js @@ -603,7 +603,6 @@ layui.extend({ }, }); }, - }; //输出test接口 exports('createInput', obj);