From be80ccd69711771e9a9602f878b00e5ea391d31a Mon Sep 17 00:00:00 2001 From: win7 Date: Fri, 6 Dec 2019 13:23:07 +0800 Subject: [PATCH] =?UTF-8?q?=E7=B1=BB=E5=88=AB=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/controller/AuthGroup.php | 2 + app/admin/controller/AuthRule.php | 2 + app/admin/controller/Index.php | 1 + app/chengji/controller/Index.php | 2 + app/kaoshi/controller/Index.php | 2 + app/kaoshi/controller/Kaohao.php | 4 +- app/keti/controller/Index.php | 2 + app/keti/controller/KetiInfo.php | 2 + app/login/controller/Index.php | 5 +- app/renshi/controller/Index.php | 2 + app/renshi/controller/Student.php | 2 + app/rongyu/controller/DwRongyu.php | 2 + app/rongyu/controller/JsRongyu.php | 2 + app/rongyu/controller/JsRongyuInfo.php | 2 + app/system/controller/Category.php | 19 +++-- app/system/controller/Fields.php | 12 ++- app/system/controller/School.php | 23 +++-- app/system/controller/SystemBase.php | 2 +- app/system/route/system.php | 49 +++++++++-- app/system/view/category/create.html | 2 +- app/system/view/category/index.html | 10 +-- app/system/view/fields/create.html | 111 ------------------------- app/system/view/fields/index.html | 9 +- app/system/view/school/create.html | 2 +- app/system/view/school/index.html | 22 ++--- database/seeds/Rule.php | 4 +- public/static/x-admin2.2/js/cjgl.js | 2 +- view/create.html | 6 +- view/list.html | 40 ++++----- 29 files changed, 145 insertions(+), 200 deletions(-) delete mode 100644 app/system/view/fields/create.html diff --git a/app/admin/controller/AuthGroup.php b/app/admin/controller/AuthGroup.php index 6dc04301..41618546 100644 --- a/app/admin/controller/AuthGroup.php +++ b/app/admin/controller/AuthGroup.php @@ -197,6 +197,8 @@ class AuthGroup extends BaseController $id = request()->delete('ids');// 获取delete请求方式传送过来的数据并转换成数据 } + $id = explode(',', $id); + $data = AG::destroy($id); // 根据更新结果设置返回提示信息 diff --git a/app/admin/controller/AuthRule.php b/app/admin/controller/AuthRule.php index 5bbd2a23..35bfc38b 100644 --- a/app/admin/controller/AuthRule.php +++ b/app/admin/controller/AuthRule.php @@ -187,6 +187,8 @@ class AuthRule extends BaseController $id = request()->delete('ids');// 获取delete请求方式传送过来的数据并转换成数据 } + $id = explode(',', $id); + $data = AR::destroy($id); // 根据更新结果设置返回提示信息 diff --git a/app/admin/controller/Index.php b/app/admin/controller/Index.php index 840302a0..2ec58ecc 100644 --- a/app/admin/controller/Index.php +++ b/app/admin/controller/Index.php @@ -265,6 +265,7 @@ class Index extends BaseController if($id == 'm'){ $id = request()->delete('ids'); } + $id = explode(',', $id); $data = AD::destroy($id); diff --git a/app/chengji/controller/Index.php b/app/chengji/controller/Index.php index 5562623d..fc7a2ef5 100644 --- a/app/chengji/controller/Index.php +++ b/app/chengji/controller/Index.php @@ -486,6 +486,8 @@ class Index extends BaseController $id = request()->delete('ids');// 获取delete请求方式传送过来的数据并转换成数据 } + $id = explode(',', $id); + $data = Chengji::destroy($id); // 根据更新结果设置返回提示信息 diff --git a/app/kaoshi/controller/Index.php b/app/kaoshi/controller/Index.php index e958cf78..f3c0d8b5 100644 --- a/app/kaoshi/controller/Index.php +++ b/app/kaoshi/controller/Index.php @@ -332,6 +332,8 @@ class Index extends BaseController $id = request()->delete('ids');// 获取delete请求方式传送过来的数据并转换成数据 } + $id = explode(',', $id); + $data = KS::destroy($id); // 根据更新结果设置返回提示信息 diff --git a/app/kaoshi/controller/Kaohao.php b/app/kaoshi/controller/Kaohao.php index 5742b528..880acc57 100644 --- a/app/kaoshi/controller/Kaohao.php +++ b/app/kaoshi/controller/Kaohao.php @@ -558,10 +558,10 @@ class Kaohao extends BaseController if($id == 'm') { $id = request()->delete('ids');// 获取delete请求方式传送过来的数据并转换成数据 - }else{ - $id = array($id); } + $id = explode(',', $id); + // 删除成绩 $db = new \think\Db; $db::startTrans(); # 启动事务 diff --git a/app/keti/controller/Index.php b/app/keti/controller/Index.php index b786d8da..b21386d4 100644 --- a/app/keti/controller/Index.php +++ b/app/keti/controller/Index.php @@ -214,6 +214,8 @@ class Index extends BaseController $id = request()->delete('ids');// 获取delete请求方式传送过来的数据并转换成数据 } + $id = explode(',', $id); + $data = keti::destroy($id); // 根据更新结果设置返回提示信息 diff --git a/app/keti/controller/KetiInfo.php b/app/keti/controller/KetiInfo.php index ca28a8c1..efd1875b 100644 --- a/app/keti/controller/KetiInfo.php +++ b/app/keti/controller/KetiInfo.php @@ -361,6 +361,8 @@ class KetiInfo extends BaseController $id = request()->delete('ids');// 获取delete请求方式传送过来的数据并转换成数据 } + $id = explode(',', $id); + $data = ktinfo::destroy($id); // 根据更新结果设置返回提示信息 diff --git a/app/login/controller/Index.php b/app/login/controller/Index.php index 720fea45..7b27176f 100644 --- a/app/login/controller/Index.php +++ b/app/login/controller/Index.php @@ -45,14 +45,13 @@ class Index public function yanzheng() { - // 实例化验证模型 - $validate = new \app\login\validate\Yanzheng; - // 获取表单数据 $data = request()->only(['username','password','captcha']); // 验证表单数据 try { + // 实例化验证模型 + $validate = new \app\login\validate\Yanzheng; validate(Yanzheng::class)->check($data); } catch (ValidateException $e) { // 验证失败 输出错误信息 diff --git a/app/renshi/controller/Index.php b/app/renshi/controller/Index.php index c6132caf..f93392a1 100644 --- a/app/renshi/controller/Index.php +++ b/app/renshi/controller/Index.php @@ -235,6 +235,8 @@ class Index extends BaseController $id = request()->delete('ids');// 获取delete请求方式传送过来的数据并转换成数据 } + $id = explode(',', $id); + $data = Teacher::destroy($id); // 根据更新结果设置返回提示信息 diff --git a/app/renshi/controller/Student.php b/app/renshi/controller/Student.php index 8d02b60b..9b641f37 100644 --- a/app/renshi/controller/Student.php +++ b/app/renshi/controller/Student.php @@ -229,6 +229,8 @@ class Student extends BaseController $id = request()->delete('ids');// 获取delete请求方式传送过来的数据并转换成数据 } + $id = explode(',', $id); + $data = STU::destroy($id); // 根据更新结果设置返回提示信息 diff --git a/app/rongyu/controller/DwRongyu.php b/app/rongyu/controller/DwRongyu.php index 30550a67..8169d0e6 100644 --- a/app/rongyu/controller/DwRongyu.php +++ b/app/rongyu/controller/DwRongyu.php @@ -318,6 +318,8 @@ class DwRongyu extends BaseController $id = request()->delete('ids');// 获取delete请求方式传送过来的数据并转换成数据 } + $id = explode(',', $id); + $data = dwry::destroy($id); // 根据更新结果设置返回提示信息 diff --git a/app/rongyu/controller/JsRongyu.php b/app/rongyu/controller/JsRongyu.php index bbdb7994..d0c2847f 100644 --- a/app/rongyu/controller/JsRongyu.php +++ b/app/rongyu/controller/JsRongyu.php @@ -215,6 +215,8 @@ class JsRongyu extends BaseController $id = request()->delete('ids');// 获取delete请求方式传送过来的数据并转换成数据 } + $id = explode(',', $id); + $data = jsry::destroy($id); // 根据更新结果设置返回提示信息 diff --git a/app/rongyu/controller/JsRongyuInfo.php b/app/rongyu/controller/JsRongyuInfo.php index 9af0d050..a89fc3af 100644 --- a/app/rongyu/controller/JsRongyuInfo.php +++ b/app/rongyu/controller/JsRongyuInfo.php @@ -407,6 +407,8 @@ class JsRongyuInfo extends BaseController $id = request()->delete('ids');// 获取delete请求方式传送过来的数据并转换成数据 } + $id = explode(',', $id); + $data = ryinfo::destroy($id); // 根据更新结果设置返回提示信息 diff --git a/app/system/controller/Category.php b/app/system/controller/Category.php index ba70568c..faaf7515 100644 --- a/app/system/controller/Category.php +++ b/app/system/controller/Category.php @@ -17,12 +17,13 @@ class Category extends BaseController { // 设置要给模板赋值的信息 $list['webtitle'] = '类别列表'; + $list['dataurl'] = 'category/data'; // 模板赋值 - $this->assign('list',$list); + $this->view->assign('list',$list); // 渲染模板 - return $this->fetch(); + return $this->view->fetch(); } @@ -76,15 +77,15 @@ class Category extends BaseController 'webtitle'=>'添加类别', 'butname'=>'添加', 'formpost'=>'POST', - 'url'=>'/category', + 'url'=>'save', ); // 模板赋值 - $this->assign('list',$list); + $this->view->assign('list',$list); // 渲染 - return $this->fetch(); + return $this->view->fetch(); } @@ -136,13 +137,13 @@ class Category extends BaseController 'webtitle'=>'编辑类别', 'butname'=>'修改', 'formpost'=>'PUT', - 'url'=>'/category/'.$id, + 'url'=>'/system/category/update/'.$id, ); // 模板赋值 - $this->assign('list',$list); + $this->view->assign('list',$list); // 渲染 - return $this->fetch('create'); + return $this->view->fetch('create'); } // 更新类别信息 @@ -181,6 +182,8 @@ class Category extends BaseController $id = request()->delete('ids'); } + $id = explode(',', $id); + $data = CG::destroy($id); // 根据更新结果设置返回提示信息 diff --git a/app/system/controller/Fields.php b/app/system/controller/Fields.php index e97674a7..e81110cc 100644 --- a/app/system/controller/Fields.php +++ b/app/system/controller/Fields.php @@ -18,7 +18,7 @@ class Fields extends BaseController { // 设置要给模板赋值的信息 $list['webtitle'] = '文件列表'; - $list['dataurl'] = '/system/file'; + $list['dataurl'] = 'file/data'; // 模板赋值 $this->view->assign('list',$list); @@ -78,14 +78,18 @@ class Fields extends BaseController $url = 'uploads\\'.$filist->url; $name = $filist->oldname; - return download('uploads\\chengji\\20190906\\fa3d00866ee52fcc5ae94b178a37de1a.xls', "$name"); + $a = $this->request->root(); + + return download('favicon.ico','aa.ico'); + + // return download('.\\uploads\\chengji\\20190906\\fa3d00866ee52fcc5ae94b178a37de1a.xls', "$name"); // return download('uploads\\'.$filist->url, $filist->oldname)->expire(300); // 下载文件 - $download = new \think\response\Download('uploads\\'.$filist->url); + // $download = new \think\Download('uploads\\'.$filist->url,'aa.xls'); - return $download->name($filist->oldname); + // return $download->name($filist->oldname); } diff --git a/app/system/controller/School.php b/app/system/controller/School.php index c99e4685..59ae8965 100644 --- a/app/system/controller/School.php +++ b/app/system/controller/School.php @@ -14,12 +14,13 @@ class School extends BaseController { // 设置要给模板赋值的信息 $list['webtitle'] = '单位列表'; + $list['dataurl'] = 'school/data'; // 模板赋值 - $this->assign('list',$list); + $this->view->assign('list',$list); // 渲染模板 - return $this->fetch(); + return $this->view->fetch(); } @@ -73,15 +74,15 @@ class School extends BaseController 'webtitle'=>'添加单位', 'butname'=>'添加', 'formpost'=>'POST', - 'url'=>'/school', + 'url'=>'save', ); // 模板赋值 - $this->assign('list',$list); + $this->view->assign('list',$list); // 渲染 - return $this->fetch(); + return $this->view->fetch(); } @@ -125,23 +126,24 @@ class School extends BaseController // 编辑单位 public function edit($id) { + // 获取单位信息 $list['data'] = sch::field('id,title,jiancheng,biaoshi,xingzhi,jibie,status,xueduan,paixu') - ->get($id); + ->find($id); // 设置页面标题 $list['set'] = array( 'webtitle'=>'编辑单位', 'butname'=>'修改', 'formpost'=>'PUT', - 'url'=>'/school/'.$id, + 'url'=>'/system/school/update/'.$id, ); // 模板赋值 - $this->assign('list',$list); + $this->view->assign('list',$list); // 渲染 - return $this->fetch('create'); + return $this->view->fetch('create'); } // 更新单位信息 @@ -153,6 +155,7 @@ class School extends BaseController $list = request() ->only(['title','jiancheng','biaoshi','xingzhi','jibie','xueduan','paixu'=>999],'put'); + // 验证表单数据 $result = $validate->check($list); $msg = $validate->getError(); @@ -181,6 +184,8 @@ class School extends BaseController $id = request()->delete('ids'); } + $id = explode(',', $id); + $data = sch::destroy($id); // 根据更新结果设置返回提示信息 diff --git a/app/system/controller/SystemBase.php b/app/system/controller/SystemBase.php index 6f6bee79..5e33025f 100644 --- a/app/system/controller/SystemBase.php +++ b/app/system/controller/SystemBase.php @@ -22,7 +22,7 @@ class SystemBase extends BaseController 'webtitle'=>'设置系统信息', 'butname'=>'设置', 'formpost'=>'PUT', - 'url'=>'system/id/'.$list['data']['id'], + 'url'=>'update/'.$list['data']['id'], ); diff --git a/app/system/route/system.php b/app/system/route/system.php index 2bfbaf4e..a41c3acf 100644 --- a/app/system/route/system.php +++ b/app/system/route/system.php @@ -22,14 +22,47 @@ use think\facade\Route; // Route::resource('school','system/School'); // Route::resource('fields','system/Fields'); -// systembase -Route::rule('/','systembase/edit','get'); -Route::rule('/','systembase/update','put'); +// 系统设置systembase -// fields -Route::rule('file','fields/index','get'); -Route::rule('file','fields/ajaxdata','ajax'); -Route::rule('file/','fields/delete','delete'); -Route::rule('filedownload/','fields/download','get'); +Route::group('/', function () { + Route::rule('','systembase/edit','get'); # 系统配置页面 + Route::rule('update/','systembase/update','put'); # 配置更新 + }); + +// 文件管理fields +Route::group('file', function () { + Route::rule('','fields/index','get'); # 文件列表 + Route::rule('data','fields/ajaxdata','post'); # 获取数据 + Route::rule('delete/','fields/delete','delete'); # 删除记录 + Route::rule('download/','fields/download','get'); # 文件下载 + }); + + +// 单位管理fields +Route::group('school', function () { + Route::rule('','school/index','get'); # 信息列表 + Route::rule('data','school/ajaxdata','post'); # 获取数据 + Route::rule('create','school/create','get'); # 添加信息 + Route::rule('save','school/save','post'); # 保存信息 + // Route::rule('read','school/read','get'); # 读取信息 + Route::rule('edit/','school/edit','get'); # 修改信息 + Route::rule('update/','school/update','put'); # 更新信息 + Route::rule('delete/','school/delete','delete'); # 删除信息 + Route::rule('status','school/setStatus','post'); # 删除信息 + }); + + +// 类别管理category +Route::group('category', function () { + Route::rule('','category/index','get'); # 信息列表 + Route::rule('data','category/ajaxdata','post'); # 获取数据 + Route::rule('create','category/create','get'); # 添加信息 + Route::rule('save','category/save','post'); # 保存信息 + // Route::rule('read','category/read','get'); # 读取信息 + Route::rule('edit/','category/edit','get'); # 修改信息 + Route::rule('update/','category/update','put'); # 更新信息 + Route::rule('delete/','category/delete','delete'); # 删除信息 + Route::rule('status','category/setStatus','post'); # 删除信息 + }); diff --git a/app/system/view/category/create.html b/app/system/view/category/create.html index dd54e9bc..8ebed7e8 100644 --- a/app/system/view/category/create.html +++ b/app/system/view/category/create.html @@ -1,4 +1,4 @@ -{extend name="common@create" /} +{extend name=".././view/create.html" /} {block name="form"}
diff --git a/app/system/view/category/index.html b/app/system/view/category/index.html index 58511f67..195233b9 100644 --- a/app/system/view/category/index.html +++ b/app/system/view/category/index.html @@ -1,5 +1,5 @@ -{extend name="common@list" /} +{extend name=".././view/list.html" /} {block name="jsset"} {/block} @@ -78,10 +78,10 @@ switch(obj.event){ case 'dels': var checkStatus = table.checkStatus('mytable'); //idmytable 即为基础参数 id 对应的值 - cjgl.delAll(checkStatus,'/category','mytable'); + cjgl.delAll(checkStatus,'category/delete','mytable'); break; case 'add': - cjgl.add('添加类别','/category/create','450','300',''); + cjgl.add('添加类别','category/create','450','230',''); break; }; }); @@ -96,10 +96,10 @@ layer.msg('查看' + data.id); break; case 'del':// 删除 - cjgl.del(obj,"/category"); + cjgl.del(obj,"category/delete"); break; case 'edit':// 编辑 - cjgl.add('编辑类别','/category/'+obj.data.id+'/edit','650','300',''); + cjgl.add('编辑类别','category/edit/'+obj.data.id,'450','230',''); break; }; }); diff --git a/app/system/view/fields/create.html b/app/system/view/fields/create.html deleted file mode 100644 index 64368451..00000000 --- a/app/system/view/fields/create.html +++ /dev/null @@ -1,111 +0,0 @@ -{extend name="common@create" /} - -{block name="form"} - -
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- {php} $category = getCategory(101);{/php} - -
-
-
- -
- {php} $category = getCategory(102);{/php} - -
-
-
- -
- {php} $category = getCategory(103);{/php} - -
-
-
- -
- -
-
-
- -
-
-{/block} - -{block name="myjs"} - -{/block} - diff --git a/app/system/view/fields/index.html b/app/system/view/fields/index.html index 66f3a7a2..2dc883b1 100644 --- a/app/system/view/fields/index.html +++ b/app/system/view/fields/index.html @@ -97,10 +97,7 @@ switch(obj.event){ case 'dels': var checkStatus = table.checkStatus('mytable'); //idmytable 即为基础参数 id 对应的值 - cjgl.delAll(checkStatus,'/system/file','mytable'); - break; - case 'add': - cjgl.add('添加文件','/fields/create','650','500'); + cjgl.delAll(checkStatus,'file/delete','mytable'); break; }; }); @@ -112,10 +109,10 @@ var tr = obj.tr; //获得当前行 tr 的DOM对象 switch(layEvent){ case 'del':// 删除 - cjgl.del(obj,"/system/file"); + cjgl.del(obj,"file/delete"); break; case 'download':// 编辑 - cjgl.add('下载文件','/system/filedownload/'+obj.data.id,'350','150'); + cjgl.add('下载文件','file/download/'+obj.data.id,'350','150'); break; }; }); diff --git a/app/system/view/school/create.html b/app/system/view/school/create.html index 64368451..ee41c0ed 100644 --- a/app/system/view/school/create.html +++ b/app/system/view/school/create.html @@ -1,4 +1,4 @@ -{extend name="common@create" /} +{extend name=".././view/create.html" /} {block name="form"}
diff --git a/app/system/view/school/index.html b/app/system/view/school/index.html index 26297765..c4c25895 100644 --- a/app/system/view/school/index.html +++ b/app/system/view/school/index.html @@ -1,5 +1,5 @@ -{extend name="common@list" /} +{extend name=".././view/list.html" /} {block name="jsset"} {/block} @@ -68,25 +68,25 @@ {field: 'jiancheng', title: '单位简称', minWidth:100,sort: true}, {field: "xingzhi",title: '性质',sort: true,templet:function(d){ var str=''; - if(d.dw_xingzhi) + if(d.dwXingzhi) { - str = d.dw_xingzhi.title; + str = d.dwXingzhi.title; } return str; }}, {field: 'jibie', title: '级别',sort: true,templet:function(d){ var str=''; - if(d.dw_jibie) + if(d.dwJibie) { - str = d.dw_jibie.title; + str = d.dwJibie.title; } return str; }} , {field: 'xueduan', title: '学段',sort: true,templet:function(d){ var str=''; - if(d.dw_xueduan) + if(d.dwXueduan) { - str = d.dw_xueduan.title; + str = d.dwXueduan.title; } return str; }}, @@ -105,10 +105,10 @@ switch(obj.event){ case 'dels': var checkStatus = table.checkStatus('mytable'); //idmytable 即为基础参数 id 对应的值 - cjgl.delAll(checkStatus,'/school','mytable'); + cjgl.delAll(checkStatus,'school/delete','mytable'); break; case 'add': - cjgl.add('添加单位','/school/create','650','500'); + cjgl.add('添加单位','school/create','500','450'); break; }; }); @@ -123,10 +123,10 @@ layer.msg('查看' + data.id); break; case 'del':// 删除 - cjgl.del(obj,"/school"); + cjgl.del(obj,"school/delete"); break; case 'edit':// 编辑 - cjgl.add('编辑单位','/school/'+obj.data.id+'/edit','650','500'); + cjgl.add('编辑单位','school/edit/'+obj.data.id,'650','500'); break; }; }); diff --git a/database/seeds/Rule.php b/database/seeds/Rule.php index 485422f3..c3a02a3a 100644 --- a/database/seeds/Rule.php +++ b/database/seeds/Rule.php @@ -51,8 +51,8 @@ class Rule extends Seeder ['id'=>603,'title'=>'角色列表','name'=>'admin/AuthGroup/index','paixu'=>3,'ismenu' =>1,'pid' =>6,'url'=>'/authgroup',], // 系统设置 - ['id'=>701,'title'=>'类别管理','name'=>'system/Category/index','paixu'=>1,'ismenu' =>1,'pid' =>7,'url'=>'/category',], - ['id'=>702,'title'=>'单位管理','name'=>'system/School/index','paixu'=>2,'ismenu' =>1,'pid' =>7,'url'=>'/school',], + ['id'=>701,'title'=>'类别管理','name'=>'system/Category/index','paixu'=>1,'ismenu' =>1,'pid' =>7,'url'=>'/system/category',], + ['id'=>702,'title'=>'单位管理','name'=>'system/School/index','paixu'=>2,'ismenu' =>1,'pid' =>7,'url'=>'/system/school',], ['id'=>703,'title'=>'文件管理','name'=>'system/Fields/index','paixu'=>3,'ismenu' =>1,'pid' =>7,'url'=>'/system/file',], ['id'=>704,'title'=>'系统设置','name'=>'system/SystemBase/edit','paixu'=>10,'ismenu' =>1,'pid' =>7,'url'=>'/system/',], diff --git a/public/static/x-admin2.2/js/cjgl.js b/public/static/x-admin2.2/js/cjgl.js index ee54f9ec..6843dc7e 100644 --- a/public/static/x-admin2.2/js/cjgl.js +++ b/public/static/x-admin2.2/js/cjgl.js @@ -6,7 +6,7 @@ layui.define(['table'],function(exports){ //提示:模块也可以依赖其它 var table = layui.table; var obj = { // 新建弹窗 - add: function(title,url,width,height,max=false){ + add: function(title,url,width='',height='',max=false){ xadmin.open(title,url,width,height,max); }, del:function(obj,url){ diff --git a/view/create.html b/view/create.html index 70b70fae..f7a0e6f1 100644 --- a/view/create.html +++ b/view/create.html @@ -26,9 +26,9 @@