diff --git a/app/keti/view/keti_info/create.html b/app/keti/view/keti_info/create.html index f11b770c..75473f7b 100755 --- a/app/keti/view/keti_info/create.html +++ b/app/keti/view/keti_info/create.html @@ -4,10 +4,10 @@ {block name="form"}
{eq name="$list.set.formpost" value="PUT" } - + {/eq} {eq name="$list.set.formpost" value="POST" } - + {/eq}
@@ -125,20 +125,12 @@ layui.use(['laydate','createInput'], function() { cInput.uploadPic('upload', "/rongyu/danwei/upload", '课题', 'keti\\lixiang', 'lxpic'); -}); + // 图片放大与缩小 + $('#img').click(function(){ + cInput.imgMax(this); + }) -// 图片放大 -function imgMax(obj, max = false) { - if (max == true) { - $(obj).css("max-width", "800px"); - $(obj).css("max-height", "1000px"); - $(obj).attr('onclick', "imgMax(this)"); - } else { - $(obj).css("max-width", "500px"); - $(obj).css("max-height", "300px"); - $(obj).attr('onclick', "imgMax(this,true)"); - } -} +}); {/block} diff --git a/app/rongyu/controller/Danwei.php b/app/rongyu/controller/Danwei.php index de775c40..df78a2e5 100755 --- a/app/rongyu/controller/Danwei.php +++ b/app/rongyu/controller/Danwei.php @@ -96,7 +96,7 @@ class Danwei extends AdminBase 'url' ,'project' ,'title' - ,'teachers' => array() + ,'teacher_id' => array() ,'hjschool_id' ,'category_id' ,'fzshijian' @@ -116,8 +116,8 @@ class Danwei extends AdminBase $data = DW::create($list); // 重组教师id - $teachers = array(); - foreach ($list['teachers'] as $key => $value) { + $list['teacher_id'] = explode(',', $list['teacher_id']); + foreach ($list['teacher_id'] as $key => $value) { $teachers[]['teacher_id'] = $value; } @@ -277,7 +277,7 @@ class Danwei extends AdminBase ,'fzshijian' ,'fzschool_id' ,'jiangxiang_id' - ,'teachers' => array() + ,'teacher_id' => array() ,'url' ], 'put'); $list['id'] = $id; @@ -299,8 +299,9 @@ class Danwei extends AdminBase // 声明参与教师数组 $canyulist = []; + $list['teacher_id'] = explode(',', $list['teacher_id']); // 循环组成参与教师 - foreach ($list['teachers'] as $key => $value) { + foreach ($list['teacher_id'] as $key => $value) { $canyulist[] = [ 'teacher_id' => $value, ]; @@ -357,4 +358,36 @@ class Danwei extends AdminBase // 返回信息 return json($data); } + + + // 查询单位参与人信息 + public function srcCy() + { + // 获取参数 + $src = $this->request + ->only([ + 'str' => '' + ,'rongyu_id' => '' + ,'field' => 'id' + ,'order' => 'desc' + ,'teacher_id' => '' + ], 'POST'); + + $cy = new \app\rongyu\model\DwRongyuCanyu; + $list = $cy->searchCanyu($src); + $data = array(); + foreach ($list as $key => $value) { + if($value->teacher) + { + $data[] = [ + 'xingming' => $value->teacher->adSchool->jiancheng . '--' .$value->teacher->xingming + ,'id' => $value->teacher_id + ,'selected' => true + ]; + } + } + $data = reSetArray($data, $src); + + return json($data); + } } diff --git a/app/rongyu/controller/JsRongyuInfo.php b/app/rongyu/controller/JsRongyuInfo.php index 0df7cb67..de056d44 100755 --- a/app/rongyu/controller/JsRongyuInfo.php +++ b/app/rongyu/controller/JsRongyuInfo.php @@ -163,20 +163,20 @@ class JsRongyuInfo extends AdminBase // 声明教师数组 $teacherlist = []; // 循环组成获奖教师信息 + $list['hjteachers'] = explode(',', $list['hjteachers']); foreach ($list['hjteachers'] as $key => $value) { $canyulist[] = [ 'teacher_id' => $value ,'category_id' => 11901 ]; } - if(!empty($list['cyteachers'])){ - // 循环组成参与教师信息 - foreach ($list['cyteachers'] as $key => $value) { - $canyulist[] = [ - 'teacher_id' => $value - ,'category_id' => 11902 - ]; - } + // 循环组成参与教师信息 + $list['cyteachers'] = explode(',', $list['cyteachers']); + foreach ($list['cyteachers'] as $key => $value) { + $canyulist[] = [ + 'teacher_id' => $value + ,'category_id' => 11902 + ]; } // 添加新的获奖人与参与人信息 @@ -352,21 +352,21 @@ class JsRongyuInfo extends AdminBase // 声明教师数组 $teacherlist = []; // 循环组成获奖教师信息 + $list['hjteachers'] = explode(',', $list['hjteachers']); foreach ($list['hjteachers'] as $key => $value) { $canyulist[] = [ 'teacher_id' => $value ,'category_id' => 11901 ]; } - if(!empty($list['cyteachers'])){ // 循环组成参与教师信息 + $list['cyteachers'] = explode(',', $list['cyteachers']); foreach ($list['cyteachers'] as $key => $value) { $canyulist[] = [ 'teacher_id' => $value ,'category_id' => 11902 ]; } - } // 添加新的获奖人与参与人信息 $data->allJsry()->saveAll($canyulist); @@ -519,4 +519,37 @@ class JsRongyuInfo extends AdminBase flush(); exit(); } + + + // 查询荣誉参与人信息 + public function srcCy() + { + // 获取参数 + $src = $this->request + ->only([ + 'str' => '' + ,'rongyu_id' => '' + ,'category_id' => '' + ,'field' => 'serid' + ,'order' => 'asc' + ], 'POST'); + + $cy = new \app\rongyu\model\JsRongyuCanyu; + $list = $cy->searchCanyu($src); + $data = array(); + foreach ($list as $key => $value) { + if($value->teacher) + { + $data[] = [ + 'xingming' => $value->teacher->adSchool->jiancheng . '--' .$value->teacher->xingming + ,'id' => $value->teacher_id + ,'selected' => true + ,'serid' => $value->id + ]; + } + } + $data = reSetArray($data, $src); + + return json($data); + } } diff --git a/app/rongyu/model/DwRongyuCanyu.php b/app/rongyu/model/DwRongyuCanyu.php index 29848324..2368761f 100755 --- a/app/rongyu/model/DwRongyuCanyu.php +++ b/app/rongyu/model/DwRongyuCanyu.php @@ -24,4 +24,33 @@ class DwRongyuCanyu extends BaseModel return $this->belongsTo('\app\admin\model\Admin', 'teacher_id', 'id'); } + //搜索课题册 + public function searchCanyu($srcfrom) + { + $src = [ + 'rongyu_id' => '' + ]; + $src = array_cover($srcfrom, $src); + + $list = $this + ->where('rongyu_id', $src['rongyu_id']) + ->with( + [ + 'teacher' => function($query){ + $query->field('id, xingming, school_id') + ->with([ + 'adSchool' => function ($q) { + $q->field('id, jiancheng'); + } + ]); + }, + 'rongyu' => function($query){ + $query->field('id, title'); + }, + ] + ) + ->select(); + return $list; + } + } diff --git a/app/rongyu/model/JsRongyuCanyu.php b/app/rongyu/model/JsRongyuCanyu.php index d5989880..b35b29ca 100755 --- a/app/rongyu/model/JsRongyuCanyu.php +++ b/app/rongyu/model/JsRongyuCanyu.php @@ -19,4 +19,35 @@ class JsRongyuCanyu extends BaseModel { return $this->belongsTo('\app\admin\model\Admin', 'teacher_id', 'id'); } + + //搜索课题册 + public function searchCanyu($srcfrom) + { + $src = [ + 'rongyu_id' => '' + ,'category_id' => '' + ]; + $src = array_cover($srcfrom, $src); + + $list = $this + ->where('rongyu_id', $src['rongyu_id']) + ->where('category_id', $src['category_id']) + ->with( + [ + 'teacher' => function($query){ + $query->field('id, xingming, school_id') + ->with([ + 'adSchool' => function ($q) { + $q->field('id, jiancheng'); + } + ]); + }, + 'rongyu' => function($query){ + $query->field('id, title'); + }, + ] + ) + ->select(); + return $list; + } } diff --git a/app/rongyu/route/rongyu.php b/app/rongyu/route/rongyu.php index b04cce6e..777ad43c 100755 --- a/app/rongyu/route/rongyu.php +++ b/app/rongyu/route/rongyu.php @@ -23,6 +23,7 @@ Route::group('danwei', function () { Route::rule('upload', 'Danwei/upload', 'post'); # 上传图片 Route::rule('createall', 'Danwei/createAll', 'get'); # 批量导入 Route::rule('saveall', 'Danwei/saveAll', 'post'); # 批量保存 + Route::rule('srccy','Danwei/srcCy','post'); # 获取数据 }); @@ -37,7 +38,6 @@ Route::group('jiaoshi', function () { Route::rule('update/','Jiaoshi/update','put'); # 更新信息 Route::rule('delete','Jiaoshi/delete','delete'); # 删除信息 Route::rule('status','Jiaoshi/setStatus','post'); # 删除信息 - }); @@ -55,6 +55,5 @@ Route::group('jsryinfo', function () { Route::rule('saveall/','JsRongyuInfo/saveAll','post'); # 批量保存 Route::rule('list/','JsRongyuInfo/rongyuList','get'); # 批量保存 Route::rule('outxlsx/','JsRongyuInfo/outXlsx','get'); # 批量保存 - - + Route::rule('srccy','JsRongyuInfo/srcCy','post'); # 获取数据 }); diff --git a/app/rongyu/validate/DwRongyu.php b/app/rongyu/validate/DwRongyu.php index bc74d8b5..6a17cf76 100755 --- a/app/rongyu/validate/DwRongyu.php +++ b/app/rongyu/validate/DwRongyu.php @@ -21,7 +21,7 @@ class DwRongyu extends Validate 'fzshijian|发证时间' => 'require|date', 'fzschool_id|发证单位' => 'require|number', 'jiangxiang_id|奖项' => 'require|number', - 'teachers|参与人' =>'array', + 'teacher_id|参与人' =>'require', 'project|项目'=>'length:1,100' ]; diff --git a/app/rongyu/validate/JsRongyuInfo.php b/app/rongyu/validate/JsRongyuInfo.php index db80497d..5d242428 100755 --- 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|获奖人' => 'require|array', + 'hjteachers|获奖人' => 'require', 'hjschool_id|荣誉所在单位' => 'require|number', 'subject_id|荣誉所属学科' => 'require|number', 'hjshijian|发证时间' => 'require|date', 'jiangxiang_id|奖项' => 'require|number', - 'cyteachers|参与人' => 'array', + 'cyteachers|参与人' => '', ]; /** @@ -34,7 +34,7 @@ class JsRongyuInfo extends Validate // 验证场景 protected $scene = [ - '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'], + 'create' => ['rongyuce_id', 'title', 'hjteachers', 'hjschool_id', 'subject_id', 'hjshijian', 'jiangxiang_id', 'pic'], + 'edit' => ['id', 'title', 'hjteachers', 'hjschool_id', 'subject_id', 'hjshijian', 'jiangxiang_id', 'pic'], ]; } diff --git a/app/rongyu/view/danwei/create.html b/app/rongyu/view/danwei/create.html index 3cc70696..c7c5bc3d 100755 --- a/app/rongyu/view/danwei/create.html +++ b/app/rongyu/view/danwei/create.html @@ -4,10 +4,10 @@ {block name="form"}
{eq name="$list.set.formpost" value="PUT" } - + {/eq} {eq name="$list.set.formpost" value="POST" } - + {/eq}
@@ -103,10 +103,8 @@ {block name="myjs"} {/block} diff --git a/app/rongyu/view/danwei/index.html b/app/rongyu/view/danwei/index.html index 66a7b2fc..e2184175 100755 --- a/app/rongyu/view/danwei/index.html +++ b/app/rongyu/view/danwei/index.html @@ -35,7 +35,7 @@
-
+ {/block} {block name="table"} diff --git a/app/rongyu/view/jiaoshi/create.html b/app/rongyu/view/jiaoshi/create.html index 704098b5..fd94e6ba 100755 --- a/app/rongyu/view/jiaoshi/create.html +++ b/app/rongyu/view/jiaoshi/create.html @@ -13,40 +13,20 @@
- -
- {php} $category = categoryChildren(114);{/php} - -
-
-
- +
- {php} $school = danweiJibie('区级', '其它级');{/php} - + +
+
+
+ +
+
@@ -71,14 +51,21 @@ {/block} diff --git a/app/rongyu/view/jiaoshi/index.html b/app/rongyu/view/jiaoshi/index.html index 8bffa95c..46bb6fe4 100755 --- a/app/rongyu/view/jiaoshi/index.html +++ b/app/rongyu/view/jiaoshi/index.html @@ -19,26 +19,20 @@ autocomplete="off" class="layui-input" placeholder="输入关键字并回车"> -
- -
- - {php} $category = categoryChildren(114);{/php} - {volist name="category" id="vo"} - - {/volist} -
+
+ +
+
-
- -
- - {php} $school = danweiJibie('区级','其它级'); {/php} - {volist name="school" id="vo"} - - {/volist} -
+
+
+ +
+
+
{/block} {block name="table"}
@@ -64,7 +58,20 @@ {/block} diff --git a/app/rongyu/view/js_rongyu_info/index.html b/app/rongyu/view/js_rongyu_info/index.html index 5530d972..6e04652f 100755 --- a/app/rongyu/view/js_rongyu_info/index.html +++ b/app/rongyu/view/js_rongyu_info/index.html @@ -21,35 +21,26 @@
- -
- - {php} $category = categoryChildren(114);{/php} - {volist name="category" id="vo"} - - {/volist} -
+ +
+
-
- -
- - {php} $school = danweiJibie('区级', '其它级'); {/php} - {volist name="school" id="vo"} - - {/volist} -
-
-
- -
- - {php} $school = danweiJibie('校级','区级'); {/php} - {volist name="school" id="vo"} - - {/volist} -
+
+
+ +
+
+
+
+ +
+ +
+
{/block} {block name="table"}
@@ -70,7 +61,22 @@ {/block} diff --git a/app/teach/controller/Subject.php b/app/teach/controller/Subject.php index dc5033b9..0c9eaaad 100755 --- a/app/teach/controller/Subject.php +++ b/app/teach/controller/Subject.php @@ -40,6 +40,8 @@ class Subject extends AdminBase ,'limit' => '10' ,'field' => 'update_time' ,'order' => 'asc' + ,'kaoshi' => '' + ,'status' => '' ,'xingzhi' => array() ,'searchval' => '' ],'POST'); @@ -229,5 +231,4 @@ class Subject extends AdminBase // 返回信息 return json($data); } - } diff --git a/app/teach/model/Subject.php b/app/teach/model/Subject.php index 8ea31bd6..0018dae4 100755 --- a/app/teach/model/Subject.php +++ b/app/teach/model/Subject.php @@ -15,7 +15,7 @@ class Subject extends BaseModel ,'kaoshi' => '' ,'searchval' => '' ]; - $src = array_cover($srcfrom, $src) ; + $src = array_cover($srcfrom, $src); // 查询数据 $data = $this @@ -40,6 +40,14 @@ class Subject extends BaseModel // 获取参加考试的学科 public function kaoshi() { + // 整理变量 + $src = [ + 'status' => '' + ,'kaoshi' => '' + ,'searchval' => '' + ]; + $src = array_cover($srcfrom, $src) ; + $data = self::where('kaoshi&status', 1) ->field('id, title, jiancheng, lieming') ->order(['paixu'=>'asc']) @@ -48,6 +56,7 @@ class Subject extends BaseModel return $data; } + // 大类别关联 public function sbjCategory() { diff --git a/app/teach/route/teach.php b/app/teach/route/teach.php index e5873395..271ab8b4 100755 --- a/app/teach/route/teach.php +++ b/app/teach/route/teach.php @@ -58,6 +58,7 @@ Route::group('subject', function () { Route::rule('delete','subject/delete','delete'); # 删除信息 Route::rule('status','subject/setStatus','post'); # 删除信息 Route::rule('kaoshi','subject/kaoshi','post'); # 删除信息 + Route::rule('srccy','subject/srcsbj','post'); # 获取数据 }); diff --git a/app/tools/controller/Index.php b/app/tools/controller/Index.php index 8537f992..ccc56f8a 100755 --- a/app/tools/controller/Index.php +++ b/app/tools/controller/Index.php @@ -169,6 +169,7 @@ class Index extends BaseController : $src['order'] = SORT_ASC; # 数据排序 $arr = $this->sortArrByManyField($arr, $src['field'], $src['order']); } + // halt($arr); $limit_start = $src['page'] * $src['limit'] - $src['limit']; # 获取当前页数据 $limit_length = $src['limit']; $arr = array_slice($arr, $limit_start, $limit_length); diff --git a/public/static/x-admin2.2/js/createInput.js b/public/static/x-admin2.2/js/createInput.js index 55562e57..f437ecf9 100644 --- a/public/static/x-admin2.2/js/createInput.js +++ b/public/static/x-admin2.2/js/createInput.js @@ -269,6 +269,88 @@ layui.extend({ }); }, + + // 放大、缩小图片 + imgMax: function(obj) { + var max; + max = $(obj).attr('max'); + if (max == 0) { + $(obj).css("max-width", "800px"); + $(obj).css("max-height", "1000px"); + $(obj).attr('max', 1); + } else { + $(obj).css("max-width", "500px"); + $(obj).css("max-height", "300px"); + $(obj).attr('max', 0); + } + }, + + + // 创建类别的Select + subjectSelect: function(myid, value = '', kaoshi='', hasNull = true) { + $.ajax({ + url: '/teach/subject/data', + type: 'POST', + data: { + status:1, + kaoshi:kaoshi + }, + success: function(result) { + 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() {}); + }, + }); + }, + + + // 创建班级checkbox + banjiCheckbox: function (myid, data, value, hasAll=true) { + $.ajax({ + url: '/teach/banji/mybanji', + type: 'POST', + data: data, + success: function(result) { + $('#' + myid).children().remove(); + if (hasAll == 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('checkbox'); + }, + error: function(result) { + layer.msg('数据扔半道啦。', function() {}); + }, + }); + } + }; //输出test接口 exports('createInput', obj);