From b30b751b47735337d4e7f7ddd3c5ca33af1886e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B7=B4=E6=8E=8C?= Date: Mon, 8 Mar 2021 15:46:36 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=89=8D=E7=AB=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/controller/Index.php | 55 ++-- app/admin/model/Admin.php | 12 +- app/admin/route/admin.php | 2 +- app/keti/controller/KetiInfo.php | 46 ++- app/keti/model/KetiCanyu.php | 79 +++++ app/keti/route/keti.php | 1 + app/keti/view/keti_info/create.html | 326 ++++++++------------- app/keti/view/keti_info/create_all.html | 68 ++--- app/keti/view/keti_info/index.html | 237 +++++++-------- app/keti/view/keti_info/jie_ti.html | 271 +++++++---------- app/keti/view/keti_info/keti_list.html | 324 ++++++++++---------- app/keti/view/ketice/create.html | 105 ++++--- app/keti/view/ketice/index.html | 209 ++++++------- public/static/x-admin2.2/js/createInput.js | 24 +- public/static/x-admin2.2/js/mytable.js | 31 +- 15 files changed, 904 insertions(+), 886 deletions(-) diff --git a/app/admin/controller/Index.php b/app/admin/controller/Index.php index 558495cf..acf525d1 100755 --- a/app/admin/controller/Index.php +++ b/app/admin/controller/Index.php @@ -272,26 +272,26 @@ class Index extends AdminBase } - // 查询管理员 - public function adminList() - { - $src = request()->only([ - 'searchval' - ],'POST'); + // // 查询管理员 + // public function adminList() + // { + // $src = request()->only([ + // 'searchval' + // ],'POST'); - $ad = new AD; - $list = $ad->search($src); - $cnt = $list->count(); - $data = array(); - foreach ($list as $key => $value) { - $data[] = [ - 'xingming' => $value->adSchool->jiancheng . ' -- ' .$value->xingming - ,'id' => $value->id - ]; - } + // $ad = new AD; + // $list = $ad->search($src); + // $cnt = $list->count(); + // $data = array(); + // foreach ($list as $key => $value) { + // $data[] = [ + // 'xingming' => $value->adSchool->jiancheng . ' -- ' .$value->xingming + // ,'id' => $value->id + // ]; + // } - return json($data); - } + // return json($data); + // } // 批量添加 @@ -355,7 +355,7 @@ class Index extends AdminBase // 获取参数 $src = $this->request ->only([ - 'str' => '' + 'searchval' => '' ,'school_id' => '' ,'field' => 'id' ,'order' => 'desc' @@ -363,9 +363,20 @@ class Index extends AdminBase ], 'POST'); $ad = new AD(); - $data = $ad->strSrcTeachers($src); - - $data = reSetObject($data, $src); + $list = $ad->strSrcTeachers($src) + ->visible([ + 'id' + ,'xingming' + ,'adSchool' => ['jiancheng'] + ]); + $data = array(); + foreach ($list as $key => $value) { + $data[] = [ + 'xingming' => $value->adSchool->jiancheng . ' -- ' .$value->xingming + ,'id' => $value->id + ]; + } + $data = reSetArray($data, $src); return json($data); } diff --git a/app/admin/model/Admin.php b/app/admin/model/Admin.php index cc4b584c..0d3de9f3 100755 --- a/app/admin/model/Admin.php +++ b/app/admin/model/Admin.php @@ -77,23 +77,22 @@ class Admin extends BaseModel public function strSrcTeachers($srcfrom) { $src = [ - 'str' => '' + 'searchval' => '' ,'school_id' => '' ]; $src = array_cover($srcfrom, $src); - trim($src['str']); + trim($src['searchval']); // 如果有数据则查询教师信息 $list = self::field('id, xingming, school_id, shengri, sex') ->when(strlen($src['school_id']) > 0, function ($query) use($src) { $query->where('school_id', $src['school_id']); }) - ->when(strlen($src['str']) <= 0, function ($query) use($src) { + ->when(strlen($src['searchval']) <= 0, function ($query) use($src) { $query->where('id', '<=', 0); }) - ->when(strlen($src['str']) > 0, function ($query) use($src) { + ->when(strlen($src['searchval']) > 0, function ($query) use($src) { $query - ->whereOr('xingming', 'like', '%' . $src['str'] . '%') - ->whereOr('shoupin', 'like', $src['str'] . '%'); + ->where('xingming|shoupin', 'like', '%' . $src['searchval'] . '%'); }) ->with( [ @@ -104,7 +103,6 @@ class Admin extends BaseModel ) ->append(['age']) ->select(); - return $list; } diff --git a/app/admin/route/admin.php b/app/admin/route/admin.php index 3e812fae..f1d96cc7 100755 --- a/app/admin/route/admin.php +++ b/app/admin/route/admin.php @@ -21,7 +21,7 @@ Route::group('index', function () { Route::rule('update/', 'Index/update', 'put'); # 更新信息 Route::rule('delete', 'Index/delete', 'delete'); # 删除信息 Route::rule('status', 'Index/setStatus', 'post'); # 删除信息 - Route::rule('adminlist', 'Index/adminList', 'post'); # 用户信息 + // Route::rule('adminlist', 'Index/adminList', 'post'); # 用户信息 Route::rule('downloadxls', 'Index/downloadxls', 'get'); # 用户信息 Route::rule('createall','Index/createAll','get'); # 批量导入 Route::rule('saveall','Index/saveAll','post'); # 批量保存 diff --git a/app/keti/controller/KetiInfo.php b/app/keti/controller/KetiInfo.php index 6fdcfa3e..23be6835 100755 --- a/app/keti/controller/KetiInfo.php +++ b/app/keti/controller/KetiInfo.php @@ -363,14 +363,6 @@ class KetiInfo extends AdminBase // 获取课题信息 $list['data'] = ktinfo::where('id', $id) ->field('id, title, jddengji_id, jtshijian, jtpic,beizhu') - ->with([ - 'ktCy'=>function($query){ - $query->field('ketiinfo_id,teacher_id') - ->with(['teacher'=>function($query){ - $query->field('id, xingming'); - }]); - }, - ]) ->find(); // 设置页面标题 @@ -396,7 +388,7 @@ class KetiInfo extends AdminBase 'jtpic' ,'jddengji_id' ,'jtshijian' - ,'cyteachers'=>array() + ,'teacher_id'=>array() ,'beizhu' ], 'PUT'); $list['id'] = $id; @@ -420,7 +412,8 @@ class KetiInfo extends AdminBase $teacherlist = []; $canyulist = []; // 循环组成获奖教师信息 - foreach ($list['cyteachers'] as $key => $value) { + $list['teacher_id'] = explode(',', $list['teacher_id']); + foreach ($list['teacher_id'] as $key => $value) { $canyulist[] = [ 'teacher_id' => $value ,'category_id' => 11902 @@ -542,4 +535,37 @@ class KetiInfo extends AdminBase flush(); exit(); } + + + // 查询课题参与人信息 + public function srcCy() + { + // 获取参数 + $src = $this->request + ->only([ + 'str' => '' + ,'ketiinfo_id' => '' + ,'category_id' => '' + ,'field' => 'id' + ,'order' => 'desc' + ,'teacher_id' => '' + ], 'POST'); + + $cy = new \app\keti\model\KetiCanyu; + $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/keti/model/KetiCanyu.php b/app/keti/model/KetiCanyu.php index f27591ee..b3a32d14 100755 --- a/app/keti/model/KetiCanyu.php +++ b/app/keti/model/KetiCanyu.php @@ -18,4 +18,83 @@ class KetiCanyu extends BaseModel { return $this->belongsTo('\app\admin\model\Admin', 'teacher_id', 'id'); } + + + //搜索课题册 + public function search($srcfrom) + { + $src = [ + 'ketiinfo_id' => array() + ,'category_id' => array() + ,'searchval' => '' + ]; + $src = array_cover($srcfrom, $src); + $src['ketiinfo_id'] = strToArray($src['ketiinfo_id']); + $src['category_id'] = strToArray($src['category_id']); + + $data = $this + ->when(count($src['ketiinfo_id']) > 0, function($query) use($src){ + $query->where('ketiinfo_id', 'in', $src['ketiinfo_id']); + }) + ->when(count($src['category_id']) > 0, function($query) use($src){ + $query->where('category_id', 'in', $src['category_id']); + }) + ->when(strlen($src['searchval']) > 0, function($query) use($src){ + $query->where('teacher_id', 'in', function ($q) use ($src) { + $q->name('admin') + ->where('xingming', 'like', '%' . $src['searchval'] . '%') + ->field('id'); + }); + }) + ->with( + [ + 'teacher' => function($query){ + $query->field('id, xingming, school_id') + ->with([ + 'adSchool' => function ($q) { + $q->field('id, jiancheng'); + } + ]); + }, + 'keti' => function($query){ + $query->field('id, title'); + }, + ] + ) + ->select(); + + return $data; + } + + + //搜索课题册 + public function searchCanyu($srcfrom) + { + $src = [ + 'ketiinfo_id' => '' + ,'category_id' => array() + ]; + $src = array_cover($srcfrom, $src); + + $list = $this + ->where('ketiinfo_id', $src['ketiinfo_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'); + } + ]); + }, + 'keti' => function($query){ + $query->field('id, title'); + }, + ] + ) + ->select(); + return $list; + } } diff --git a/app/keti/route/keti.php b/app/keti/route/keti.php index 71d26c06..ee9504e6 100755 --- a/app/keti/route/keti.php +++ b/app/keti/route/keti.php @@ -38,6 +38,7 @@ Route::group('ketiinfo', function () { Route::rule('jieti/','KetiInfo/jieTi','get'); # 批量保存 Route::rule('jietiupdate/','KetiInfo/jtUpdate','put'); # 批量保存 Route::rule('download/','KetiInfo/outXlsx','get'); # 批量保存 + Route::rule('srccy','KetiInfo/srcCy','post'); # 获取数据 }); diff --git a/app/keti/view/keti_info/create.html b/app/keti/view/keti_info/create.html index 478341e8..dc4a437b 100755 --- a/app/keti/view/keti_info/create.html +++ b/app/keti/view/keti_info/create.html @@ -1,215 +1,145 @@ {extend name=".././view/create.html" /} {block name="jscss"} - {/block} {block name="form"} -
- {eq name="$list.set.formpost" value="PUT" } - - {/eq} - {eq name="$list.set.formpost" value="POST" } - - {/eq} -
-
-
- - -
-
- -
-
- -
-
-
-
- -
- -
-
-
- -
- -
-
-
- -
-
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
- -
- -
-
+
+ {eq name="$list.set.formpost" value="PUT" } + + {/eq} + {eq name="$list.set.formpost" value="POST" } + + {/eq} +
+
+
+ +
+
+ +
+
+ +
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ +
+ +
+
{/block} - {block name="myjs"} - {/block} - diff --git a/app/keti/view/keti_info/create_all.html b/app/keti/view/keti_info/create_all.html index 9ee0de26..bcc88934 100755 --- a/app/keti/view/keti_info/create_all.html +++ b/app/keti/view/keti_info/create_all.html @@ -1,59 +1,35 @@ {extend name=".././view/create.html" /} {block name="jscss"} {/block} {block name="form"} -
-
- -

点击上传,或将文件拖拽到此处

-
-
-
-
+
+
+ +

点击上传,或将文件拖拽到此处

+
+
+
+
{/block} - {block name="myjs"} {/block} - diff --git a/app/keti/view/keti_info/index.html b/app/keti/view/keti_info/index.html index 89db67a4..b8084ce3 100755 --- a/app/keti/view/keti_info/index.html +++ b/app/keti/view/keti_info/index.html @@ -1,59 +1,56 @@ - {extend name=".././view/list.html" /} {block name="jsset"} - {/block} {block name="nav"} - - 课题管理 - 课题册 - 课题列表 - + + 课题管理 + 课题册 + 课题列表 + {/block} {block name="search"} -
- -
- -
-
-
- -
- -
-
-
- -
- -
+
+ +
+
-
- -
- -
-
-
- -
- -
+
+
+ +
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
{/block} {block name="table"} -
+
{/block} {block name="myjs"} - + {/block} diff --git a/app/keti/view/keti_info/jie_ti.html b/app/keti/view/keti_info/jie_ti.html index 2aac87b2..d3fba82d 100755 --- a/app/keti/view/keti_info/jie_ti.html +++ b/app/keti/view/keti_info/jie_ti.html @@ -1,185 +1,118 @@ {extend name=".././view/create.html" /} {block name="jscss"} - {/block} {block name="form"} -
- {eq name="$list.set.formpost" value="PUT" } - {if strlen($list.data.jtpic)>0} - - {else /} - - {/if} - {/eq} -
-
-
- -
-
- -
-
- -
-
-
-
- -
-
- -
- {present name="$list.data.kt_cy"} - {volist name="$list.data.kt_cy" id="vo"} -
-
- {$vo.teacher.xingming} -
-
- {/volist} - {/present} -
-
-
- -
- {php}$jddengji = categoryChildren(118);{/php} - -
-
-
- -
- -
-
-
- -
- -
-
-
- -
-
+
+ {eq name="$list.set.formpost" value="PUT" } + {if strlen($list.data.jtpic)>0} + + {else /} + + {/if} + {/eq} +
+
+
+ +
+
+ +
+
+ +
+
+
+
+ +
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+
{/block} - {block name="myjs"} - {/block} - diff --git a/app/keti/view/keti_info/keti_list.html b/app/keti/view/keti_info/keti_list.html index 33f86ccc..82294670 100755 --- a/app/keti/view/keti_info/keti_list.html +++ b/app/keti/view/keti_info/keti_list.html @@ -1,60 +1,57 @@ - {extend name=".././view/list.html" /} {block name="jsset"} - {/block} {block name="nav"} - - 课题管理 - 课题册 - 课题列表 - + + 课题管理 + 课题册 + 课题列表 + {/block} {block name="search"} -
- -
- -
-
-
- -
- -
-
-
- -
- -
+
+ +
+
-
- -
- -
-
-
- -
- -
+
+
+ +
+
- +
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ {/block} {block name="table"} -
+
{/block} {block name="myjs"} - + {/block} diff --git a/app/keti/view/ketice/create.html b/app/keti/view/ketice/create.html index 7473fe19..f0f8d119 100755 --- a/app/keti/view/ketice/create.html +++ b/app/keti/view/ketice/create.html @@ -2,66 +2,61 @@ {block name="jscss"} {/block} {block name="form"} -
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
-
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+
{/block} - {block name="myjs"} - {/block} - diff --git a/app/keti/view/ketice/index.html b/app/keti/view/ketice/index.html index 145c30dc..ccd15572 100755 --- a/app/keti/view/ketice/index.html +++ b/app/keti/view/ketice/index.html @@ -1,44 +1,41 @@ - {extend name=".././view/list.html" /} {block name="jsset"} - {/block} {block name="nav"} - - 课题管理 - 课题册 - + + 课题管理 + 课题册 + {/block} {block name="search"} -
- -
- -
-
-
- -
- -
-
-
- -
- -
-
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
{/block} {block name="table"} -
+
{/block} {block name="myjs"} - + {/block} diff --git a/public/static/x-admin2.2/js/createInput.js b/public/static/x-admin2.2/js/createInput.js index e5750728..1f8dd416 100644 --- a/public/static/x-admin2.2/js/createInput.js +++ b/public/static/x-admin2.2/js/createInput.js @@ -47,7 +47,7 @@ }, - // 选中子后代的复选框 + // 选中后代的复选框 checkboxChildren:function(cid, check){ edit(cid, check); function edit(cid, check) @@ -161,14 +161,14 @@ } $.ajax({ - url:'/admin/index/adminlist', + url:'/admin/index/srcteacher', type:'POST', data:{ searchval:val ,school_id:school_id }, success:function(result){ - cb(result) + cb(result.data) }, error:function(result){ layer.msg('数据扔半道啦。',function(){}); @@ -177,6 +177,24 @@ }, }) return x; + }, + + + // 载入搜索框中已经保存的教师 + loadTeacher: function(obj, url, data) { + $.ajax({ + url:url, + type:'POST', + data:data, + success:function(result){ + obj.update({ + data: result.data + }) + }, + error:function(result){ + layer.msg('数据扔半道啦。',function(){}); + }, + }); } }; diff --git a/public/static/x-admin2.2/js/mytable.js b/public/static/x-admin2.2/js/mytable.js index 36564175..ca386c95 100644 --- a/public/static/x-admin2.2/js/mytable.js +++ b/public/static/x-admin2.2/js/mytable.js @@ -160,7 +160,7 @@ layui.define(['table', 'form', 'upload'], function(exports) { done: function(res) { if (res.val == 1) { $('#' + backId).val(res.url); - document.getElementById("img").src = "__UPLOAD__/" + res.url; + document.getElementById("img").src = "/uploads/" + res.url; } layer.msg(res.msg); }, @@ -178,10 +178,37 @@ layui.define(['table', 'form', 'upload'], function(exports) { }, + // 上传图片 + uploadPicMore: function(uploadId, url, category, serurl) { + upload.render({ + elem: '#' + uploadId, //绑定元素 + url: url, //改成您自己的上传接口 + async: false, + done: function(res) { + layer.msg('上传成功'); + layui.$('#uploadDemoView').removeClass('layui-hide').find('img').attr('src', res.files.file); + }, + data: { + text: category, + serurl: serurl + }, + multiple: true, + number: 100, + acceptMime: '.jpg,.jpeg,.png', + exts: 'jpg|jpeg|png', + auto: true, + error: function() { + //请求异常回调 + layer.msg('上传错误'); + }, + }) + }, + + // 上传图片 uploadXls: function(uploadId, url, category, serurl, backId) { upload.render({ - elem: '#'+ uploadId, //绑定元素 + elem: '#' + uploadId, //绑定元素 url: url, //上传接口 done: function(res) { if (res.val == 1) {