From 37faca9806b6cadd388dd06933c828131c47c1e5 Mon Sep 17 00:00:00 2001 From: cxdbz Date: Wed, 24 Apr 2019 21:01:15 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8D=A3=E8=AA=89=E4=BF=A1=E6=81=AF=E5=AE=8C?= =?UTF-8?q?=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/rongyu/controller/DwRongyu.php | 1 + .../rongyu/controller/JsRongyuInfo.php | 74 +++--- application/rongyu/model/DwRongyu.php | 2 +- application/rongyu/model/JsRongyuInfo.php | 6 + application/rongyu/validate/JsRongyuInfo.php | 4 +- application/rongyu/view/dw_rongyu/create.html | 4 +- .../rongyu/view/dw_rongyu/create_all.html | 2 +- application/rongyu/view/dw_rongyu/index.html | 4 +- application/rongyu/view/js_rongyu/index.html | 2 +- .../rongyu/view/js_rongyu_info/create.html | 241 +++++++++++++++--- .../view/js_rongyu_info/create_all.html | 6 +- .../rongyu/view/js_rongyu_info/index.html | 51 ++-- .../view/js_rongyu_info/rongyu_list.html | 85 ++++-- application/teach/view/banji/index.html | 2 +- application/teach/view/subject/index.html | 2 +- application/teach/view/xueqi/index.html | 2 +- public/static/xadmin/js/cjgl.js | 7 +- .../54fd25923c68a28ae96aad271f54ae1d.jpg | Bin 0 -> 86497 bytes .../1ae559884003120010e7b72552d61cdc.jpg | Bin 0 -> 86497 bytes .../3a0d51943854a6e833471d36ab07bcef.jpg | Bin 0 -> 86497 bytes .../496036126fb138d3c5ffb2c4403d5b98.jpg | Bin 0 -> 86497 bytes .../4aac6247a41bab8774c93823fbc08c4f.jpg | Bin 0 -> 247966 bytes .../9b9114e239e5de0b87af50adc8b77375.jpg | Bin 0 -> 86497 bytes .../ab37f2935a2af96bf31c55e44abc558e.jpg | Bin 0 -> 247966 bytes .../b5886e8c03cba44f78a087a66090adfb.jpg | Bin 0 -> 86497 bytes .../de3cefa19c0edc2003aaf7075a056a2b.jpg | Bin 0 -> 86497 bytes route/rongyu.php | 3 +- 27 files changed, 374 insertions(+), 124 deletions(-) create mode 100644 public/uploads/jiaoshirongyu/20190424/54fd25923c68a28ae96aad271f54ae1d.jpg create mode 100644 public/uploads/rongyu_teacher/20190424/1ae559884003120010e7b72552d61cdc.jpg create mode 100644 public/uploads/rongyu_teacher/20190424/3a0d51943854a6e833471d36ab07bcef.jpg create mode 100644 public/uploads/rongyu_teacher/20190424/496036126fb138d3c5ffb2c4403d5b98.jpg create mode 100644 public/uploads/rongyu_teacher/20190424/4aac6247a41bab8774c93823fbc08c4f.jpg create mode 100644 public/uploads/rongyu_teacher/20190424/9b9114e239e5de0b87af50adc8b77375.jpg create mode 100644 public/uploads/rongyu_teacher/20190424/ab37f2935a2af96bf31c55e44abc558e.jpg create mode 100644 public/uploads/rongyu_teacher/20190424/b5886e8c03cba44f78a087a66090adfb.jpg create mode 100644 public/uploads/rongyu_teacher/20190424/de3cefa19c0edc2003aaf7075a056a2b.jpg diff --git a/application/rongyu/controller/DwRongyu.php b/application/rongyu/controller/DwRongyu.php index c498932b..bb885e57 100644 --- a/application/rongyu/controller/DwRongyu.php +++ b/application/rongyu/controller/DwRongyu.php @@ -158,6 +158,7 @@ class DwRongyu extends Base return $this->fetch(); } + // 保存批传 public function createAllSave() { // 获取文件信息 diff --git a/application/rongyu/controller/JsRongyuInfo.php b/application/rongyu/controller/JsRongyuInfo.php index aaca3124..c96399f2 100644 --- a/application/rongyu/controller/JsRongyuInfo.php +++ b/application/rongyu/controller/JsRongyuInfo.php @@ -58,6 +58,7 @@ class JsRongyuInfo extends Base */ public function ajaxData() { + // 获取参数 $src = $this->request ->only([ @@ -110,6 +111,7 @@ class JsRongyuInfo extends Base 'butname'=>'添加', 'formpost'=>'POST', 'url'=>'/jsryinfo', + 'rongyuce'=>$id ); // 模板赋值 @@ -124,7 +126,7 @@ class JsRongyuInfo extends Base * @param \think\Request $request * @return \think\Response */ - public function save() + public function save($rongyuce) { // 获取表单数据 @@ -190,7 +192,7 @@ class JsRongyuInfo extends Base 'webtitle'=>'批量上传教师荣誉册图片', 'butname'=>'批传', 'formpost'=>'POST', - 'url'=>'jsryinfoaddall/'.$id, + 'url'=>'/jsryinfoaddall/'.$id, ); // 模板赋值 @@ -199,6 +201,36 @@ class JsRongyuInfo extends Base return $this->fetch(); } + // 保存批传 + public function createAllSave($id) + { + // 获取文件信息 + $list['text'] = $this->request->post('text'); + $list['serurl'] = $this->request->post('serurl'); + + // 获取表单上传文件 + $file = request()->file('file'); + // 上传文件并返回结果 + $data = upload($list,$file); + + if($data['val'] != 1) + { + $data=['msg'=>'添加失败','val'=>0]; + } + + $data = ryinfo::create([ + 'url'=>$data['url'] + ,'title'=>'批传' + ,'rongyuce'=>$id + ]); + + $data ? $data=['msg'=>'批传成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; + + return json($data); + } + + + /** * 上传荣誉图片并保存 * @@ -208,37 +240,14 @@ class JsRongyuInfo extends Base public function upload() { // 获取文件信息 - $rongyuce=input('post.rongyuce'); + $list['text'] = $this->request->post('text'); + $list['serurl'] = $this->request->post('serurl'); - - // 获取表单上传文件 例如上传了001.jpg + // 获取表单上传文件 $file = request()->file('file'); - // 移动到框架应用根目录/uploads/ 目录下 - $info = $file->validate(['size'=>2*1024*1024,'ext'=>'jpg,png,gif,jpeg'])->move('uploads\jiaoshirongyu'); + // 上传文件并返回结果 + $data = upload($list,$file); - - - if($info){ - // 成功上传后 获取上传信息 - $list['url'] = $info->getSaveName(); - // $list['category'] = $info->getExtension(); - // $list['newname'] = $info->getFilename(); - // $myfileurl = '\uploads\\'.$list['url']; - // $list['bianjitime'] = filemtime('uploads\danweirongyu\\'.$list['url']); - $list['url'] = str_replace('\\','/',$list['url']); - - - // 如果图片上传成功,则添加荣誉记录 - $data = ryinfo::create(['pic'=>$list['url'],'rongyuce'=>$rongyuce]); - $id = $data->id; - - $id ? $data = array('msg'=>'上传成功','val'=>true,'url'=>$list['url'],'ryid'=>$id) : $data = array('msg'=>'保存文件信息失败','val'=>false,'url'=>null); - }else{ - // 上传失败获取错误信息 - $data = array('msg'=>$file->getError(),'val'=>false,'url'=>null); - } - - // 返回信息 return json($data); } @@ -289,6 +298,7 @@ class JsRongyuInfo extends Base 'butname'=>'修改', 'formpost'=>'PUT', 'url'=>'/jsryinfo/'.$id, + 'rongyuce'=>$id ); // 模板赋值 @@ -327,14 +337,13 @@ class JsRongyuInfo extends Base $data = ryinfo::update($list); // 删除原来的获奖人与参与人信息 - $data->allJsry()->where('rongyuid',$list['id'])->delete(true); + $data->allJsry()->where('rongyuid',$id)->delete(true); // 声明教师数组 $teacherlist = []; // 循环组成获奖教师信息 foreach ($list['hjteachers'] as $key => $value) { $canyulist[] = [ 'teacherid' => $value, - 'rongyuid' => $list['id'], 'category' => 1, ]; } @@ -343,7 +352,6 @@ class JsRongyuInfo extends Base foreach ($list['cyteachers'] as $key => $value) { $canyulist[] = [ 'teacherid' => $value, - 'rongyuid' => $list['id'], 'category' => 2, ]; } diff --git a/application/rongyu/model/DwRongyu.php b/application/rongyu/model/DwRongyu.php index b07f4893..9f3bdc93 100644 --- a/application/rongyu/model/DwRongyu.php +++ b/application/rongyu/model/DwRongyu.php @@ -79,7 +79,7 @@ class DwRongyu extends Base // 奖项 public function jxCategory() { - return $this->belongsTo('\app\system\model\Category','category','id'); + return $this->belongsTo('\app\system\model\Category','jiangxiang','id'); } // 参与人 diff --git a/application/rongyu/model/JsRongyuInfo.php b/application/rongyu/model/JsRongyuInfo.php index 144dc310..cf23a5c6 100644 --- a/application/rongyu/model/JsRongyuInfo.php +++ b/application/rongyu/model/JsRongyuInfo.php @@ -60,6 +60,12 @@ class JsRongyuInfo extends Base $query->field('id,xingming'); }]); }, + 'cyJsry'=>function($query){ + $query->field('rongyuid,teacherid') + ->with(['teacher'=>function($query){ + $query->field('id,xingming'); + }]); + }, ] ) // ->append(['hjJsName','cyJsName']) diff --git a/application/rongyu/validate/JsRongyuInfo.php b/application/rongyu/validate/JsRongyuInfo.php index c7d5cc7c..36da8961 100644 --- a/application/rongyu/validate/JsRongyuInfo.php +++ b/application/rongyu/validate/JsRongyuInfo.php @@ -34,7 +34,7 @@ class JsRongyuInfo extends Validate // 验证场景 protected $scene = [ - 'add' => ['rongyuce','title','hjteachers','hjschool','subject','hjshijian','jiangxiang','cyteachers'], - 'edit' => ['id','title','hjteachers','hjschool','subject','hjshijian','jiangxiang','cyteachers'], + 'add' => ['rongyuce','title','hjteachers','hjschool','subject','hjshijian','jiangxiang','cyteachers','pic'], + 'edit' => ['id','title','hjteachers','hjschool','subject','hjshijian','jiangxiang','cyteachers','pic'], ]; } diff --git a/application/rongyu/view/dw_rongyu/create.html b/application/rongyu/view/dw_rongyu/create.html index 305b2f2c..41d7f6c1 100644 --- a/application/rongyu/view/dw_rongyu/create.html +++ b/application/rongyu/view/dw_rongyu/create.html @@ -36,7 +36,7 @@ {/eq}
-
+
@@ -221,7 +221,7 @@ keyup:function(){ var val = $.trim($(this).val()); if(val.length>0){ - cjgl.selectOnfocus(this,val); + cjgl.selectOnfocus(this,val,'teachers[]'); } }, }) diff --git a/application/rongyu/view/dw_rongyu/create_all.html b/application/rongyu/view/dw_rongyu/create_all.html index 89e053ae..b4f9969f 100644 --- a/application/rongyu/view/dw_rongyu/create_all.html +++ b/application/rongyu/view/dw_rongyu/create_all.html @@ -17,7 +17,7 @@ layui.use('upload', function(){ //执行实例 var uploadInst = upload.render({ elem: '#upload' //绑定元素 - ,url: "/dwry/createall" //上传接口 + ,url: "{$list.set.url}" //上传接口 ,done: function(res){ layer.msg(res.msg); } diff --git a/application/rongyu/view/dw_rongyu/index.html b/application/rongyu/view/dw_rongyu/index.html index 7622cb4c..086bed0f 100644 --- a/application/rongyu/view/dw_rongyu/index.html +++ b/application/rongyu/view/dw_rongyu/index.html @@ -20,7 +20,7 @@ autocomplete="off" class="layui-input">
-
+
{php} $category = getCategory(112);{/php} @@ -29,7 +29,7 @@ {/volist}
-
+
{php} $school = schlist('区级','其它级'); {/php} diff --git a/application/rongyu/view/js_rongyu/index.html b/application/rongyu/view/js_rongyu/index.html index c2e5b66d..72698a1c 100644 --- a/application/rongyu/view/js_rongyu/index.html +++ b/application/rongyu/view/js_rongyu/index.html @@ -20,7 +20,7 @@ autocomplete="off" class="layui-input">
-
+
{php} $category = getCategory(112);{/php} diff --git a/application/rongyu/view/js_rongyu_info/create.html b/application/rongyu/view/js_rongyu_info/create.html index fd8c9571..dafa63ee 100644 --- a/application/rongyu/view/js_rongyu_info/create.html +++ b/application/rongyu/view/js_rongyu_info/create.html @@ -1,11 +1,60 @@ {extend name="common@create" /} {block name="jscss"} + {/block} {block name="form"} +
+ {eq name="$list.set.formpost" value="PUT" } + {if strlen($list.data.pic)>0} + + {else /} + + {/if} + {/eq} +
+
+
+ +
+
+ +
+
+
+
+
- -
- {php} $category = getCategory(112);{/php} - -
-
+ +
+ +
+
- + +
+
+ +
+ {present name="$list.data.hj_jsry"} + {volist name="$list.data.hj_jsry" id="vo"} +
+
+ {$vo.teacher.xingming} +
+
+ {/volist} + {/present} +
+
+
+ +
+
+ +
+ {present name="$list.data.cy_jsry"} + {volist name="$list.data.cy_jsry" id="vo"} +
+
+ {$vo.teacher.xingming} +
+
+ {/volist} + {/present} +
+
+
+
- {php} $school = schlist('区级','其它级');{/php} - {volist name="school" id="vo"}
-
+
+ +
+ {php} $jiangxiang = getCategory(113);{/php} + +
+
+
+
- +
+
-
+
{php} $category = getCategory(112);{/php} @@ -29,7 +30,7 @@ {/volist}
-
+
{php} $school = schlist('区级','其它级'); {/php} @@ -59,14 +60,10 @@ -
@@ -93,25 +90,38 @@ layui.use(['table','laypage','form','cjgl'], function(){ defaultToolbar:'', cols: [[ //表头 {type:'checkbox', fixed: 'left'}, - {field: 'title', title: '荣誉名称',sort: true, minWidth:240}, - {field: 'fzschool', title: '颁奖单位',sort: true,templet:function(d){ + {title: '荣誉册',templet:function(d){ var str=''; - if(d.fz_school) + if(d.ry_tuce) { - str = d.fz_school.jiancheng; + str = d.ry_tuce.title; } return str; }}, - {field: "category",title: '荣誉类别',sort: true,templet:function(d){ + {field: 'bianhao', title: '获奖编号 ',sort: true}, + {title: '获奖人',templet:function(d){ var str=''; - if(d.lx_category) + if(d.hj_jsry) { - str = d.lx_category.title; + for (var k = 0, length = d.hj_jsry.length; k < length; k++) { + if(k == 0){ + str = d.hj_jsry[k].teacher.xingming; + }else{ + str =str+'、'+d.hj_jsry[k].teacher.xingming; + } + } } return str; }}, - {field: 'count', title: '荣誉数', sort: true}, - {field: 'fzshijian', title: '颁奖时间', sort: true}, + {field: "jiangxiang",title: '奖项',sort: true,templet:function(d){ + var str=''; + if(d.jx_category) + { + str = d.jx_category.title; + } + return str; + }}, + {field: 'hjshijian', title: '获奖时间', sort: true}, {field: 'status', title: '状态',templet:'#status', sort: true}, {field: 'id', title: '操作',toolbar: '#barDemo',minWidth:140} ]], @@ -149,10 +159,10 @@ layui.use(['table','laypage','form','cjgl'], function(){ switch(obj.event){ case 'dels': var checkStatus = table.checkStatus('mytable'); //idmytable 即为基础参数 id 对应的值 - cjgl.delAll(checkStatus,'/jsry','mytable'); + cjgl.delAll(checkStatus,'/jsryinfo','mytable'); break; case 'add': - cjgl.add('添加荣誉册','/jsry/create','500','350'); + cjgl.add('添加荣誉','/jsryinfo/create','','',true); break; }; }); @@ -165,14 +175,11 @@ layui.use(['table','laypage','form','cjgl'], function(){ var tr = obj.tr; //获得当前行 tr 的DOM对象 switch(layEvent){ - case 'detail':// 查看 - parent.x_admin_add_to_tab('荣誉列表','rylist/'+obj.data.id+'/'+obj.data.title,true); - break; case 'del':// 删除 - cjgl.del(obj,"/jsry"); + cjgl.del(obj,"/jsryinfo"); break; case 'edit':// 编辑 - cjgl.add('编辑荣誉册','/jsry/'+obj.data.id+'/edit','500','350'); + cjgl.add('编辑荣誉','/jsryinfo/'+obj.data.id+'/edit','','',true); break; case 'status':// 状态 cjgl.status(obj,"{:url('setstatus')}"); diff --git a/application/rongyu/view/js_rongyu_info/rongyu_list.html b/application/rongyu/view/js_rongyu_info/rongyu_list.html index e2d21a72..d4dc1d68 100644 --- a/application/rongyu/view/js_rongyu_info/rongyu_list.html +++ b/application/rongyu/view/js_rongyu_info/rongyu_list.html @@ -21,12 +21,30 @@ autocomplete="off" class="layui-input">
-
- +
+
- {php} $category = getCategory(101);{/php} + {php} $category = getCategory(112);{/php} {volist name="category" id="vo"} - + + {/volist} +
+
+
+ +
+ {php} $school = schlist('区级','其它级'); {/php} + {volist name="school" id="vo"} + + {/volist} +
+
+
+ +
+ {php} $school = schlist('校级','区级'); {/php} + {volist name="school" id="vo"} + {/volist}
@@ -49,7 +67,6 @@ @@ -68,6 +85,9 @@ layui.use(['table','laypage','form','cjgl'], function(){ elem: '#tabledemo', toolbar: '#toolbarDemo', url:"{:url('ajaxdata')}", + where:{ + rongyuce:"{$list.rongyuce}" + }, method:"POST", //数据接口 page: true, //开启分页 loading:true, @@ -77,24 +97,52 @@ layui.use(['table','laypage','form','cjgl'], function(){ cols: [[ //表头 {type:'checkbox', fixed: 'left'}, {field: 'title', title: '荣誉名称',sort: true, minWidth:240}, - {field: 'fzschool', title: '颁奖单位',sort: true,templet:function(d){ + {field: 'bianhao', title: '获奖编号 ',sort: true}, + {title: '获奖人',templet:function(d){ var str=''; - if(d.fz_school) + if(d.hj_jsry) { - str = d.fz_school.jiancheng; + for (var k = 0, length = d.hj_jsry.length; k < length; k++) { + if(k == 0){ + str = d.hj_jsry[k].teacher.xingming; + }else{ + str =str+'、'+d.hj_jsry[k].teacher.xingming; + } + } } return str; }}, - {field: "category",title: '荣誉类别',sort: true,templet:function(d){ + {title: '参与人',templet:function(d){ var str=''; - if(d.lx_category) + if(d.cy_jsry) { - str = d.lx_category.title; + for (var k = 0, length = d.cy_jsry.length; k < length; k++) { + if(k == 0){ + str = d.cy_jsry[k].teacher.xingming; + }else{ + str =str+'、'+d.cy_jsry[k].teacher.xingming; + } + } } return str; }}, - {field: 'count', title: '荣誉数', sort: true}, - {field: 'fzshijian', title: '颁奖时间', sort: true}, + {field: "subject",title: '所属学科',sort: true,templet:function(d){ + var str=''; + if(d.ry_subject) + { + str = d.ry_subject.title; + } + return str; + }}, + {field: "jiangxiang",title: '奖项',sort: true,templet:function(d){ + var str=''; + if(d.jx_category) + { + str = d.jx_category.title; + } + return str; + }}, + {field: 'hjshijian', title: '获奖时间', sort: true}, {field: 'status', title: '状态',templet:'#status', sort: true}, {field: 'id', title: '操作',toolbar: '#barDemo',minWidth:140} ]], @@ -132,10 +180,10 @@ layui.use(['table','laypage','form','cjgl'], function(){ switch(obj.event){ case 'dels': var checkStatus = table.checkStatus('mytable'); //idmytable 即为基础参数 id 对应的值 - cjgl.delAll(checkStatus,'/jsry','mytable'); + cjgl.delAll(checkStatus,'/jsryinfo','mytable'); break; case 'add': - cjgl.add('添加荣誉册','/jsry/create','500','350'); + cjgl.add('添加荣誉','/jsryinfo/create','','',true); break; }; }); @@ -148,14 +196,11 @@ layui.use(['table','laypage','form','cjgl'], function(){ var tr = obj.tr; //获得当前行 tr 的DOM对象 switch(layEvent){ - case 'detail':// 查看 - parent.x_admin_add_to_tab('荣誉列表','rylist/'+obj.data.id+'/'+obj.data.title,true); - break; case 'del':// 删除 - cjgl.del(obj,"/jsry"); + cjgl.del(obj,"/jsryinfo"); break; case 'edit':// 编辑 - cjgl.add('编辑荣誉册','/jsry/'+obj.data.id+'/edit','500','350'); + cjgl.add('编辑荣誉','/jsryinfo/'+obj.data.id+'/edit','','',true); break; case 'status':// 状态 cjgl.status(obj,"{:url('setstatus')}"); diff --git a/application/teach/view/banji/index.html b/application/teach/view/banji/index.html index e84cf5c1..7f5f5e98 100644 --- a/application/teach/view/banji/index.html +++ b/application/teach/view/banji/index.html @@ -21,7 +21,7 @@ autocomplete="off" class="layui-input">
-
+
{php} diff --git a/application/teach/view/subject/index.html b/application/teach/view/subject/index.html index 39bdbff9..82803710 100644 --- a/application/teach/view/subject/index.html +++ b/application/teach/view/subject/index.html @@ -12,7 +12,7 @@ {/block} {block name="search"}