From 9ef528349a2949286fda7b6e6b44db01cc74d734 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B7=B4=E6=8E=8C?= Date: Fri, 27 Mar 2020 15:28:38 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8D=A3=E8=AA=89=E6=95=B4=E7=90=86=E5=AE=8C?= =?UTF-8?q?=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/keti/model/KetiInfo.php | 125 ++++++++++----- app/renshi/controller/Teacher.php | 57 ++++--- app/renshi/model/Teacher.php | 41 ----- app/renshi/route/renshi.php | 4 +- app/renshi/view/teacher/read.html | 95 ++++++++--- app/rongyu/common.php | 7 - app/rongyu/controller/Danwei.php | 2 +- app/rongyu/controller/Jiaoshi.php | 8 +- app/rongyu/controller/JsRongyuInfo.php | 36 ++--- app/rongyu/model/JsRongyu.php | 47 +++--- app/rongyu/model/JsRongyuInfo.php | 148 +++++++++--------- app/rongyu/route/rongyu.php | 10 +- app/rongyu/validate/JsRongyuInfo.php | 8 +- app/rongyu/view/danwei/create.html | 4 +- app/rongyu/view/danwei/index.html | 28 ++-- app/rongyu/view/jiaoshi/create.html | 6 +- app/rongyu/view/jiaoshi/index.html | 18 +-- app/rongyu/view/js_rongyu_info/create.html | 9 +- app/rongyu/view/js_rongyu_info/index.html | 8 +- .../view/js_rongyu_info/rongyu_list.html | 11 +- 20 files changed, 365 insertions(+), 307 deletions(-) delete mode 100644 app/rongyu/common.php diff --git a/app/keti/model/KetiInfo.php b/app/keti/model/KetiInfo.php index a72483a2..8bc119b9 100644 --- a/app/keti/model/KetiInfo.php +++ b/app/keti/model/KetiInfo.php @@ -56,7 +56,7 @@ class KetiInfo extends BaseModel $query->where('ketice_id', $src['ketice_id']); }) ->when(strlen($src['searchval']) > 0, function($query) use($src){ - $query->where('title', 'like', $src['searchval']); + $query->where('title', 'like', '%' . $src['searchval'] . '%'); }) ->with( [ @@ -106,57 +106,98 @@ class KetiInfo extends BaseModel } - //搜索课题册 - public function srcKeti($ketice_id) + // 搜索教师参与的课题 + public function srcTeacherKeti($teacher_id) { - $data = $this - ->where('ketice_id', $ketice_id) + // 查询信息 + $data = self::where('status', 1) + ->where('id', 'in', function($query) use($teacher_id){ + $query->name('KetiCanyu') + ->where('teacher_id', $teacher_id) + ->field('ketiinfo_id'); + }) ->with( - [ - 'fzSchool' => function($query){ - $query->field('id, jiancheng'); - }, - 'KtCe' => function($query){ - $query->field('id, title, lxdanwei_id, category_id, lxshijian') - ->with([ - 'ktCategory' => function($q){ - $q->field('id, title'); - }, - 'ktLxdanwei' => function($q){ - $q->field('id, jiancheng_id, title'); - } - ]); - }, - 'ktCategory'=>function($query){ + [ + 'fzSchool' => function($query){ + $query->field('id, jiancheng, jibie_id') + ->with(['dwJibie' => function($q){ + $q->field('id, title'); + }]); + }, + 'ktCategory' => function($query){ + $query->field('id, title'); + }, + 'ktZcr' => function($query){ + $query->field('ketiinfo_id, teacher_id') + ->with([ + 'teacher' => function($q){ + $q->field('id, xingming'); + } + ]); + }, + 'ktJdDengji' => function($query){ $query->field('id, title'); - }, - 'ktSubject'=>function($query){ - $query->field('id, title'); - }, - 'ktZcr'=>function($query){ - $query->field('ketiinfo_id, teacher_id') - ->with([ - 'teacher'=>function($q){ - $q->field('id, xingming'); - } - ]); - }, - 'ktCy'=>function($query){ - $query->field('ketiinfo_id, teacher_id') - ->with([ - 'teacher'=>function($q){ - $q->field('id, xingming'); - } - ]); } - ] - ) + ]) + ->field('id, title, fzdanwei_id, category_id, jddengji_id, bianhao') + ->order('id') ->select(); return $data; } + // //搜索课题册 + // public function srcKeti($ketice_id) + // { + // $data = $this + // ->where('ketice_id', $ketice_id) + // ->with( + // [ + // 'fzSchool' => function($query){ + // $query->field('id, jiancheng'); + // }, + // 'KtCe' => function($query){ + // $query->field('id, title, lxdanwei_id, category_id, lxshijian') + // ->with([ + // 'ktCategory' => function($q){ + // $q->field('id, title'); + // }, + // 'ktLxdanwei' => function($q){ + // $q->field('id, jiancheng_id, title'); + // } + // ]); + // }, + // 'ktCategory'=>function($query){ + // $query->field('id, title'); + // }, + // 'ktSubject'=>function($query){ + // $query->field('id, title'); + // }, + // 'ktZcr'=>function($query){ + // $query->field('ketiinfo_id, teacher_id') + // ->with([ + // 'teacher'=>function($q){ + // $q->field('id, xingming'); + // } + // ]); + // }, + // 'ktCy'=>function($query){ + // $query->field('ketiinfo_id, teacher_id') + // ->with([ + // 'teacher'=>function($q){ + // $q->field('id, xingming'); + // } + // ]); + // } + // ] + // ) + // ->select(); + + // return $data; + // } + + // 课题主持人关联 public function ktZcr() { diff --git a/app/renshi/controller/Teacher.php b/app/renshi/controller/Teacher.php index d633afca..806ebee8 100644 --- a/app/renshi/controller/Teacher.php +++ b/app/renshi/controller/Teacher.php @@ -212,8 +212,8 @@ class Teacher extends BaseController ) ->append(['age', 'gongling']) ->limit(1) - ->select(); - $myInfo = $myInfo[0]; + ->find(); + // 设置页面标题 $myInfo['webtitle'] = $myInfo->xingming . '信息'; @@ -448,15 +448,30 @@ class Teacher extends BaseController // 查询教师荣誉 public function srcRy($teacher_id) { + // 获取参数 + $src = $this->request + ->only([ + 'page' => '1' + ,'limit' => '10' + ,'field' => 'update_time' + ,'order' => 'desc' + ,'teacher_id' => '' + ], 'POST'); + // 查询数据 - $teacher = new TC(); - $data = $teacher->srcRongyu($teacher_id); - $src = [ - 'field' => 'update_time' - ,'order' => 'desc' - ,'page' => 1 - ,'limit' => 10 - ]; + $rongyu = new \app\rongyu\model\JsRongyuInfo; + $data = $rongyu->srcTeacherRongyu($src['teacher_id']) + ->visible([ + 'id' + ,'title' + ,'ryTuce' => [ + 'title' + ,'fzSchool' + ] + ,'jiangxiang_id' + ,'hjshijian' + ,'update_time' + ]); $data = reSetObject($data, $src); return json($data); @@ -464,17 +479,21 @@ class Teacher extends BaseController // 查询教师课题 - public function srcKt($teacher_id) + public function srcKt() { + // 获取参数 + $src = $this->request + ->only([ + 'page' => '1' + ,'limit' => '10' + ,'field' => 'update_time' + ,'order' => 'desc' + ,'teacher_id' => '' + ], 'POST'); + // 查询数据 - $teacher = new TC(); - $data = $teacher->srcKeti($teacher_id); - $src = [ - 'field' => 'update_time' - ,'order' => 'desc' - ,'page' => 1 - ,'limit' => 10 - ]; + $keti = new \app\keti\model\KetiInfo; + $data = $keti->srcTeacherKeti($src['teacher_id']); $data = reSetObject($data, $src); return json($data); diff --git a/app/renshi/model/Teacher.php b/app/renshi/model/Teacher.php index 9436ae54..bc24d1fd 100644 --- a/app/renshi/model/Teacher.php +++ b/app/renshi/model/Teacher.php @@ -228,47 +228,6 @@ class Teacher extends BaseModel } - // 查询教师荣誉 - public function srcKeti($teacher_id) - { - // 实例化荣誉数据模型 - $ry = new \app\keti\model\KetiInfo; - - // 查询荣誉信息 - $data = $ry->where('status', 1) - ->where('id', 'in', function($query) use($teacher_id){ - $query->name('KetiCanyu') - ->where('teacher_id', $teacher_id) - ->field('ketiinfo_id'); - }) - ->with( - [ - 'fzSchool' => function($query){ - $query->field('id, jiancheng, jibie_id') - ->with(['dwJibie' => function($q){ - $q->field('id, title'); - }]); - }, - 'ktCategory' => function($query){ - $query->field('id, title'); - }, - 'ktZcr' => function($query){ - $query->field('ketiinfo_id, teacher_id') - ->with([ - 'teacher' => function($q){ - $q->field('id, xingming'); - } - ]); - } - ]) - ->field('id, title, fzdanwei_id, category_id, jddengji_id') - ->order('id') - ->select(); - - return $data; - } - - // 职务关联模型 public function jsZhiwu() { diff --git a/app/renshi/route/renshi.php b/app/renshi/route/renshi.php index 2cf82207..bfa8344b 100644 --- a/app/renshi/route/renshi.php +++ b/app/renshi/route/renshi.php @@ -66,8 +66,8 @@ Route::group('teacher', function () { Route::rule('upload','Teacher/upload','post'); # 批量导入 Route::rule('srcteacher','Teacher/srcTeacher','post'); # 查询教师 Route::rule('downloadxls','Teacher/downloadXls','get'); # 下载模板 - Route::rule('srcry/','Teacher/srcRy','post'); # 查询荣誉 - Route::rule('srckt/','Teacher/srcKt','post'); # 查询课题 + Route::rule('srcry','Teacher/srcRy','post'); # 查询荣誉 + Route::rule('srckt','Teacher/srcKt','post'); # 查询课题 }); // 教师管理 diff --git a/app/renshi/view/teacher/read.html b/app/renshi/view/teacher/read.html index 68c17113..36dc53b6 100644 --- a/app/renshi/view/teacher/read.html +++ b/app/renshi/view/teacher/read.html @@ -17,7 +17,7 @@
- +
个人信息
@@ -78,20 +78,68 @@
- \ No newline at end of file + diff --git a/app/rongyu/common.php b/app/rongyu/common.php deleted file mode 100644 index 3e582f69..00000000 --- a/app/rongyu/common.php +++ /dev/null @@ -1,7 +0,0 @@ -cyDwry()->saveAll($teachers); + $data->cyDwry->saveAll($teachers); // 根据更新结果设置返回提示信息 $data ? $data = ['msg' => '添加成功', 'val' => 1] diff --git a/app/rongyu/controller/Jiaoshi.php b/app/rongyu/controller/Jiaoshi.php index d6f8bd57..7de32259 100644 --- a/app/rongyu/controller/Jiaoshi.php +++ b/app/rongyu/controller/Jiaoshi.php @@ -45,9 +45,9 @@ class Jiaoshi extends BaseController ,'limit' => '10' ,'field' => 'update_time' ,'order' => 'desc' - ,'fzschool' => array() - ,'hjschool' => array() - ,'category' => array() + ,'fzschool_id' => array() + ,'hjschool_id' => array() + ,'category_id' => array() ,'searchval' => '' ],'POST'); @@ -108,7 +108,7 @@ class Jiaoshi extends BaseController $data = jsry::create($list); // 根据更新结果设置返回提示信息 - $data ? $data = ['msg' = >'添加成功', 'val' => 1] + $data ? $data = ['msg' =>'添加成功', 'val' => 1] : $data = ['msg' => '数据处理错误', 'val' => 0]; // 返回信息 diff --git a/app/rongyu/controller/JsRongyuInfo.php b/app/rongyu/controller/JsRongyuInfo.php index 9e9b995b..ec2e538e 100644 --- a/app/rongyu/controller/JsRongyuInfo.php +++ b/app/rongyu/controller/JsRongyuInfo.php @@ -38,14 +38,14 @@ class JsRongyuInfo extends BaseController * * @return \think\Response */ - public function rongyuList($rongyuce) + public function rongyuList($rongyuce_id) { // 荣誉数据模型 $ry = new \app\rongyu\model\JsRongyu; // 设置要给模板赋值的信息 - $list['webtitle'] = $ry->where('id', $rongyuce) + $list['webtitle'] = $ry->where('id', $rongyuce_id) ->value('title') . ' 荣誉'; - $list['rongyuce'] = $rongyuce; + $list['rongyuce_id'] = $rongyuce_id; $list['dataurl'] = '/rongyu/jsryinfo/data'; $list['status'] = '/rongyu/jsryinfo/status'; @@ -94,7 +94,7 @@ class JsRongyuInfo extends BaseController * * @return \think\Response */ - public function create($rongyuce = 0) + public function create($rongyuce_id = 0) { // 设置页面标题 $list['set'] = array( @@ -102,7 +102,7 @@ class JsRongyuInfo extends BaseController ,'butname'=>'添加' ,'formpost'=>'POST' ,'url'=>'/rongyu/jsryinfo/save' - ,'rongyuce'=>$rongyuce + ,'rongyuce'=>$rongyuce_id ); // 模板赋值 @@ -120,7 +120,6 @@ class JsRongyuInfo extends BaseController */ public function save() { - // 获取表单数据 $list = request()->only([ 'rongyuce_id' @@ -131,8 +130,8 @@ class JsRongyuInfo extends BaseController ,'subject_id' ,'hjshijian' ,'jiangxiang_id' - ,'hjteachers_id' - ,'cyteachers_id' + ,'hjteachers' + ,'cyteachers' ,'pic' ], 'put'); @@ -148,11 +147,8 @@ class JsRongyuInfo extends BaseController // 实例化验证类 $validate = new \app\rongyu\validate\JsRongyuInfo; - // 验证表单数据 $result = $validate->scene('create')->check($list); $msg = $validate->getError(); - - // 如果验证不通过则停止保存 if(!$result){ return json(['msg' => $msg, 'val' => 0]); } @@ -165,16 +161,16 @@ class JsRongyuInfo extends BaseController // 循环组成获奖教师信息 foreach ($list['hjteachers'] as $key => $value) { $canyulist[] = [ - 'teacherid' => $value - ,'category' => 1 + 'teacher_id' => $value + ,'category_id' => 1 ]; } if(!empty($list['cyteachers'])){ // 循环组成参与教师信息 foreach ($list['cyteachers'] as $key => $value) { $canyulist[] = [ - 'teacherid' => $value - ,'category' => 2 + 'teacher_id' => $value + ,'category_id' => 2 ]; } } @@ -197,7 +193,7 @@ class JsRongyuInfo extends BaseController * @param \think\Request $request * @return \think\Response */ - public function createAll($rongyuce) + public function createAll($rongyuce_id) { // 设置页面标题 @@ -205,7 +201,7 @@ class JsRongyuInfo extends BaseController 'webtitle' => '批量上传教师荣誉册图片' ,'butname' => '批传' ,'formpost' => 'POST' - ,'url' => '/rongyu/jsryinfo/saveall/' . $rongyuce + ,'url' => '/rongyu/jsryinfo/saveall/' . $rongyuce_id ); // 模板赋值 @@ -216,7 +212,7 @@ class JsRongyuInfo extends BaseController // 保存批传 - public function saveall($rongyuce) + public function saveall($rongyuce_id) { // 获取文件信息 $list['text'] = $this->request->post('text'); @@ -235,7 +231,7 @@ class JsRongyuInfo extends BaseController $data = ryinfo::create([ 'pic' => $data['url'] ,'title' => '批传教师荣誉' - ,'rongyuce' => $rongyuce + ,'rongyuce_id' => $rongyuce_id ]); $data ? $data = ['msg' => '批传成功', 'val' => 1] @@ -346,7 +342,7 @@ class JsRongyuInfo extends BaseController $data = ryinfo::update($list); // 删除原来的获奖人与参与人信息 - $data->allJsry()->where('rongyu_id', $id)->delete(true); + $data->allJsry->where('rongyu_id', $id)->delete(true); // 声明教师数组 $teacherlist = []; // 循环组成获奖教师信息 diff --git a/app/rongyu/model/JsRongyu.php b/app/rongyu/model/JsRongyu.php index 9764cebf..298df9ce 100644 --- a/app/rongyu/model/JsRongyu.php +++ b/app/rongyu/model/JsRongyu.php @@ -17,43 +17,38 @@ class JsRongyu extends BaseModel 'searchval'=>'' ]; // 用新值替换初始值 - $src = array_cover( $srcfrom , $src ) ; - - // 整理参数 - $hjschool = $src['hjschool']; - $fzschool = $src['fzschool']; - $category = $src['category']; - $searchval = $src['searchval']; + $src = array_cover($srcfrom, $src); + $src['fzschool_id'] = strToArray($src['fzschool_id']); + $src['hjschool_id'] = strToArray($src['hjschool_id']); + $src['category_id'] = strToArray($src['category_id']); $data = $this - ->order([$src['field'] =>$src['order']]) - ->when(count($fzschool)>0,function($query) use($fzschool){ - $query->where('fzschool','in',$fzschool); + ->when(count($src['fzschool_id']) > 0, function($query) use($src){ + $query->where('fzschool_id', 'in', $src['fzschool_id']); }) - ->when(count($category)>0,function($query) use($category){ - $query->where('category','in',$category); + ->when(count($src['category_id']) > 0, function($query) use($src){ + $query->where('category_id', 'in', $src['category_id']); }) - ->when(strlen($searchval)>0,function($query) use($searchval){ - $query->where('title','like','%'.$searchval.'%'); + ->when(strlen($src['searchval']) > 0, function($query) use($src){ + $query->where('title', 'like', '%' . $src['searchval'] . '%'); }) ->with( [ - 'fzSchool'=>function($query){ - $query->field('id,jiancheng,jibie') - ->with(['dwJibie'=>function($q){ - $q->field('id,title'); + 'fzSchool' => function($query){ + $query->field('id, jiancheng, jibie_id') + ->with(['dwJibie' => function($q){ + $q->field('id, title'); }]); }, - 'lxCategory'=>function($query){ - $query->field('id,title'); + 'lxCategory' => function($query){ + $query->field('id, title'); }, ] ) - ->withCount(['ryInfo'=>'count']) + ->withCount(['ryInfo' => 'count']) ->select(); - return $data; } @@ -61,21 +56,21 @@ class JsRongyu extends BaseModel // 颁奖单位关联 public function fzSchool() { - return $this->belongsTo('\app\system\model\School', 'fzschool', 'id'); + return $this->belongsTo('\app\system\model\School', 'fzschool_id', 'id'); } // 荣誉类型关联 public function lxCategory() { - return $this->belongsTo('\app\system\model\Category', 'category', 'id'); + return $this->belongsTo('\app\system\model\Category', 'category_id', 'id'); } // 荣誉信息关联 public function ryInfo() { - return $this->hasMany('JsRongyuInfo', 'rongyuce', 'id'); + return $this->hasMany('JsRongyuInfo', 'rongyuce_id', 'id'); } @@ -95,7 +90,7 @@ class JsRongyu extends BaseModel // 发证时间获取器 public function getFzshijianAttr($value) { - $value>0 ? $value = date('Y-m-d',$value) : $value = ""; + $value > 0 ? $value = date('Y-m-d', $value) : $value = ""; return $value; } diff --git a/app/rongyu/model/JsRongyuInfo.php b/app/rongyu/model/JsRongyuInfo.php index 8bdca5c4..9cb698f2 100644 --- a/app/rongyu/model/JsRongyuInfo.php +++ b/app/rongyu/model/JsRongyuInfo.php @@ -20,6 +20,10 @@ class JsRongyuInfo extends BaseModel ]; // 用新值替换初始值 $src = array_cover($srcfrom, $src); + $src['fzschool_id'] = strToArray($src['fzschool_id']); + $src['hjschool_id'] = strToArray($src['hjschool_id']); + $src['category_id'] = strToArray($src['category_id']); + $src['subject_id'] = strToArray($src['subject_id']); $data = $this ->when(strlen($src['rongyuce_id']) > 0, function($query) use($src){ @@ -51,12 +55,12 @@ class JsRongyuInfo extends BaseModel }); }) ->when(strlen($src['searchval']) > 0, function($query) use($src){ - $query->where(function($z) use($searchval){ + $query->where(function($z) use($src){ $z->whereOr('title|bianhao', 'like', '%' . $src['searchval'] . '%') ->whereOr('id', 'in', function($q) use($src){ $q->name('JsRongyuCanyu') ->distinct(true) - ->where('teacherid', 'in', function($w) use($src){ + ->where('teacher_id', 'in', function($w) use($src){ $w->name('Teacher') ->where('xingming', 'like', '%' . $src['searchval'] . '%') ->field('id'); @@ -106,96 +110,93 @@ class JsRongyuInfo extends BaseModel } - // 获取需要下载的荣誉信息 - public function srcTuceRy($id) + // // 获取需要下载的荣誉信息 + // public function srcTuceRy($id) + // { + // // 查询数据 + // $data =$this->where('rongyuce', $id) + // ->field('id, rongyuce_id, title, bianhao, hjschool_id, subject_id, jiangxiang_id, hjshijian, pic') + // ->with([ + // 'hjJsry' => function($query){ + // $query->field('rongyu_id, teacher_id') + // ->with([ + // 'teacher' => function($query){ + // $query->field('id, xingming'); + // } + // ]); + // }, + // 'cyJsry' => function($query){ + // $query->field('rongyu_id, teacher_id') + // ->with([ + // 'teacher' => function($query){ + // $query->field('id, xingming'); + // }] + // ); + // }, + // 'ryTuce' => function($query){ + // $query->field('id, title, fzshijian, fzschool_id') + // ->with([ + // 'fzSchool' => function($q){ + // $q->field('id, title'); + // } + // ]); + // }, + // 'rySubject' => function($query){ + // $query->field('id,title'); + // }, + // 'hjSchool' => function($query){ + // $query->field('id, jiancheng'); + // }, + // 'jxCategory' => function($query){ + // $query->field('id, title'); + // } + // ]) + // ->order(['hjschool']) + // ->append(['hjJsName', 'cyJsName']) + // ->select(); + + // return $data; + // } + + + //搜索教师荣誉 + public function srcTeacherRongyu($teacher_id) { // 查询数据 - $data =$this->where('rongyuce', $id) - ->field('id, rongyuce_id, title, bianhao, hjschool_id, subject_id, jiangxiang_id, hjshijian, pic') - ->with([ - 'hjJsry' => function($query){ - $query->field('rongyu_id, teacher_id') - ->with([ - 'teacher' => function($query){ - $query->field('id, xingming'); - } - ]); - }, - 'cyJsry' => function($query){ - $query->field('rongyu_id, teacher_id') - ->with([ - 'teacher' => function($query){ - $query->field('id, xingming'); - }] - ); - }, - 'ryTuce' => function($query){ - $query->field('id, title, fzshijian, fzschool_id') - ->with([ - 'fzSchool' => function($q){ - $q->field('id, title'); - } - ]); - }, - 'rySubject' => function($query){ - $query->field('id,title'); - }, - 'hjSchool' => function($query){ - $query->field('id, jiancheng'); - }, - 'jxCategory' => function($query){ - $query->field('id, title'); - } - ]) - ->order(['hjschool']) - ->append(['hjJsName', 'cyJsName']) - ->select(); - - return $data; - } - - - //搜索单位获奖荣誉 - public function srcTeacher($srcfrom) - { - // 获取参数 - $src = [ - 'teacher_id' => array() - ,'field' => array() - ,'order' => array() - ]; - $src = array_cover($srcfrom, $src); - - $data = $this->order([$src['field'] =>$src['order']]) - ->where('id', 'in', function($query) use($src){ + $data = $this->where('id', 'in', function($query) use($teacher_id){ $query->name('JsRongyuCanyu') - ->where('category_id',1) - ->where('teacher_id',$teacher_id) + ->where('category_id', 1) + ->where('teacher_id', $teacher_id) ->field('rongyu_id'); }) ->where('status', 1) ->with( [ - 'hjSchool'=>function($query){ + 'hjSchool' => function($query){ $query->field('id, jiancheng'); }, - 'rySubject'=>function($query){ + 'rySubject' => function($query){ $query->field('id, title'); }, - 'jxCategory'=>function($query){ + 'jxCategory' => function($query){ $query->field('id, title'); }, - 'ryTuce'=>function($query){ - $query->field('id, title') + 'ryTuce' => function($query){ + $query->field('id, title, fzschool_id') ->with([ - 'fzSchool'=>function($query){ - $query->field('id, title, jibie'); + 'fzSchool' => function($q){ + $q->field('id, title, jibie_id') + ->with([ + 'dwJibie' => function($w){ + $w->field('id,title'); + } + ]); } ]); }, - 'hjJsry'=>function($query){ + 'hjJsry' => function($query){ $query->field('rongyu_id, teacher_id') - ->with(['teacher'=>function($query){ + ->with(['teacher' => function($query){ $query->field('id, xingming'); }]); }, @@ -204,7 +205,6 @@ class JsRongyuInfo extends BaseModel ->append(['hjJsName', 'cyJsName']) ->select(); - return $data; } diff --git a/app/rongyu/route/rongyu.php b/app/rongyu/route/rongyu.php index e92d1dd8..cfacf428 100644 --- a/app/rongyu/route/rongyu.php +++ b/app/rongyu/route/rongyu.php @@ -45,16 +45,16 @@ Route::group('jiaoshi', function () { Route::group('jsryinfo', function () { Route::rule('','JsRongyuInfo/index','get'); # 信息列表 Route::rule('data','JsRongyuInfo/ajaxdata','post'); # 获取数据 - Route::rule('create/','JsRongyuInfo/create','get'); # 添加信息 + Route::rule('create/','JsRongyuInfo/create','get'); # 添加信息 Route::rule('save','JsRongyuInfo/save','post'); # 保存信息 Route::rule('edit/','JsRongyuInfo/edit','get'); # 修改信息 Route::rule('update/','JsRongyuInfo/update','put'); # 更新信息 Route::rule('delete/','JsRongyuInfo/delete','delete'); # 删除信息 Route::rule('status','JsRongyuInfo/setStatus','post'); # 删除信息 - Route::rule('createall/','JsRongyuInfo/createAll','get'); # 批量导入 - Route::rule('saveall/','JsRongyuInfo/saveAll','post'); # 批量保存 - Route::rule('list/','JsRongyuInfo/rongyuList','get'); # 批量保存 - Route::rule('outxlsx/','JsRongyuInfo/outXlsx','get'); # 批量保存 + Route::rule('createall/','JsRongyuInfo/createAll','get'); # 批量导入 + Route::rule('saveall/','JsRongyuInfo/saveAll','post'); # 批量保存 + Route::rule('list/','JsRongyuInfo/rongyuList','get'); # 批量保存 + Route::rule('outxlsx/','JsRongyuInfo/outXlsx','get'); # 批量保存 }); diff --git a/app/rongyu/validate/JsRongyuInfo.php b/app/rongyu/validate/JsRongyuInfo.php index cb892019..db80497d 100644 --- a/app/rongyu/validate/JsRongyuInfo.php +++ b/app/rongyu/validate/JsRongyuInfo.php @@ -16,12 +16,12 @@ class JsRongyuInfo extends Validate 'id|请先上传图片' => 'require', 'rongyuce_id|荣誉册ID丢失' => 'require', 'title|荣册标题' => 'require|length:1,50', - 'hjteachers_id|获奖人' => 'require|array', + 'hjteachers|获奖人' => 'require|array', 'hjschool_id|荣誉所在单位' => 'require|number', 'subject_id|荣誉所属学科' => 'require|number', 'hjshijian|发证时间' => 'require|date', 'jiangxiang_id|奖项' => 'require|number', - 'cyteachers_id|参与人' => 'array', + 'cyteachers|参与人' => 'array', ]; /** @@ -34,7 +34,7 @@ class JsRongyuInfo extends Validate // 验证场景 protected $scene = [ - 'create' => ['rongyuce_id', 'title', 'hjteachers_id', 'hjschool_id', 'subject_id', 'hjshijian', 'jiangxiang_id', 'cyteachers_id', 'pic'], - 'edit' => ['id','title', 'hjteachers_id', 'hjschool_id', 'subject_id', 'hjshijian', 'jiangxiang_id', 'cyteachers_id', 'pic'], + 'create' => ['rongyuce_id', 'title', 'hjteachers', 'hjschool_id', 'subject_id', 'hjshijian', 'jiangxiang_id', 'cyteachers', 'pic'], + 'edit' => ['id', 'title', 'hjteachers', 'hjschool_id', 'subject_id', 'hjshijian', 'jiangxiang_id', 'cyteachers', 'pic'], ]; } diff --git a/app/rongyu/view/danwei/create.html b/app/rongyu/view/danwei/create.html index a4bf25e7..a2752cbf 100644 --- a/app/rongyu/view/danwei/create.html +++ b/app/rongyu/view/danwei/create.html @@ -112,7 +112,7 @@
- {php} $school = schlist('校级','区级');{/php} + {php} $school = schoolList('校级','区级');{/php} {volist name="school" id="vo"} diff --git a/app/rongyu/view/danwei/index.html b/app/rongyu/view/danwei/index.html index eefd9dd7..1dba9528 100644 --- a/app/rongyu/view/danwei/index.html +++ b/app/rongyu/view/danwei/index.html @@ -31,7 +31,7 @@
- {php} $school = schlist('区级','其它级'); {/php} + {php} $school = schoolList('区级','其它级'); {/php} {volist name="school" id="vo"} {/volist} @@ -40,7 +40,7 @@
- {php} $school = schlist('校级','区级'); {/php} + {php} $school = schoolList('校级','区级'); {/php} {volist name="school" id="vo"} {/volist} @@ -75,9 +75,9 @@ // 设置列 options.cols=[[ //表头 {type:'checkbox', fixed: 'left'}, - {field: 'project', title: '项目名称',sort: true, minWidth:240}, - {field: 'title', title: '荣誉名称',sort: true, minWidth:240}, - {field: 'hjschool_id', title: '获奖单位', minWidth:100,sort: true,templet:function(d){ + {field: 'project', title: '项目名称', sort: true}, + {field: 'title', title: '荣誉名称', sort: true, minWidth:240}, + {field: 'hjschool_id', title: '获奖单位', minWidth:100, sort: true, templet:function(d){ var str=''; if(d.hjSchool) { @@ -109,7 +109,7 @@ } return str; }}, - {title: 'fzschool_id', minWidth:100,templet:function(d){ + {field:'fzschool_id', title: '荣誉级别', minWidth:100,templet:function(d){ var str=''; if(d.fzSchool) { @@ -118,11 +118,11 @@ return str; }}, {field: 'fzshijian', minWidth:100, title: '发证时间', sort: true}, - {field: 'status', minWidth:100, title: '状态',templet:'#status', sort: true}, - {field: 'id', title: '操作',toolbar: '#barDemo',minWidth:140} + {field: 'status', minWidth:100, title: '状态', templet:'#status', sort: true}, + {field: 'id', title:'操作', toolbar: '#barDemo', minWidth:140} ]]; - // 提交搜索条件后重载表格 + // 提交搜索条件后重载表格 layui.use(['table','cjgl'],function(){ var table = layui.table cjgl = layui.cjgl; @@ -131,13 +131,13 @@ switch(obj.event){ case 'dels': var checkStatus = table.checkStatus('mytable'); //idmytable 即为基础参数 id 对应的值 - cjgl.delAll(checkStatus,'danwei/delete','mytable'); + cjgl.delAll(checkStatus, 'danwei/delete', 'mytable'); break; case 'add': - cjgl.add('添加单位荣誉','danwei/create','','',true); + cjgl.add('添加单位荣誉', 'danwei/create', '', '', true); break; case 'more': - cjgl.add('批传','danwei/createall','300','200'); + cjgl.add('批传', 'danwei/createall', '300', '200'); break; }; }); @@ -152,10 +152,10 @@ layer.msg('查看' + data.id); break; case 'del':// 删除 - cjgl.del(obj,"danwei/delete"); + cjgl.del(obj, "danwei/delete"); break; case 'edit':// 编辑 - cjgl.add('编辑单位荣誉','danwei/edit/'+obj.data.id,'','',true); + cjgl.add('编辑单位荣誉', 'danwei/edit/' + obj.data.id, '', '', true); break; }; }); diff --git a/app/rongyu/view/jiaoshi/create.html b/app/rongyu/view/jiaoshi/create.html index 1364fd70..d76e6815 100644 --- a/app/rongyu/view/jiaoshi/create.html +++ b/app/rongyu/view/jiaoshi/create.html @@ -15,7 +15,7 @@
- {php} $category = getCategory('教师荣誉类型');{/php} + {php} $category = getCategory(114);{/php} + {php} $school = schoolList('区级', '其它级');{/php} + + {/volist}
- +
- {php} $school = schlist('区级','其它级'); {/php} + {php} $school = schoolList('区级','其它级'); {/php} {volist name="school" id="vo"} - + {/volist}
@@ -66,7 +66,7 @@ options.cols=[[ //表头 {type:'checkbox', fixed: 'left'}, {field: 'title', title: '荣誉名称',sort: true, minWidth:240}, - {field: 'fzschool', title: '颁奖单位',sort: true,templet:function(d){ + {field: 'fzschool_id', title: '颁奖单位',sort: true,templet:function(d){ var str=''; if(d.fzSchool) { @@ -74,7 +74,7 @@ } return str; }}, - {field: "category",title: '荣誉类别',sort: true,templet:function(d){ + {field: "category_id",title: '荣誉类别',sort: true,templet:function(d){ var str=''; if(d.lxCategory) { @@ -82,7 +82,7 @@ } return str; }}, - {field: "category",title: '级别',templet:function(d){ + {field: "fzschool_id",title: '级别',templet:function(d){ var str=''; if(d.fzSchool) { @@ -135,4 +135,4 @@ }); }); -{/block} \ No newline at end of file +{/block} diff --git a/app/rongyu/view/js_rongyu_info/create.html b/app/rongyu/view/js_rongyu_info/create.html index c550ea4e..f69f15e6 100644 --- a/app/rongyu/view/js_rongyu_info/create.html +++ b/app/rongyu/view/js_rongyu_info/create.html @@ -111,7 +111,7 @@
- {php} $school = schlist('校级','区级');{/php} + {php} $school = schoolList('校级','区级');{/php} @@ -152,7 +151,7 @@
- {php} $jiangxiang = getCategory('荣誉奖项');{/php} + {php} $jiangxiang = getCategory(113);{/php}
- +