diff --git a/application/keti/controller/Index.php b/application/keti/controller/Index.php index f3b262d1..a22dc209 100644 --- a/application/keti/controller/Index.php +++ b/application/keti/controller/Index.php @@ -36,54 +36,40 @@ class Index extends Base */ public function ajaxData() { - // 获取DT的传值 - $getdt = request()->param(); + // 获取参数 + $src = $this->request + ->only([ + 'page'=>'1', + 'limit'=>'10', + 'field'=>'update_time', + 'order'=>'desc', + 'lxdanweiid'=>array(), + 'category'=>array(), + 'searchval'=>'' + ],'POST'); - //得到排序的方式 - $order = $getdt['order'][0]['dir']; - //得到排序字段的下标 - $order_column = $getdt['order'][0]['column']; - //根据排序字段的下标得到排序字段 - $order_field = $getdt['columns'][$order_column]['name']; - if($order_field=='') - { - $order_field = $getdt['columns'][$order_column]['data']; - } - //得到limit参数 - $limit_start = $getdt['start']; - $limit_length = $getdt['length']; - - //得到搜索的关键词 - $search = [ - 'lxdanweiid'=>$getdt['lxdanweiid'], - 'category'=>$getdt['category'], - 'search'=>$getdt['search']['value'], - 'order'=>$order, - 'order_field'=>$order_field - ]; // 实例化 $keti = new keti; - // 获取荣誉总数 - $cnt = $keti->select()->count(); - - // 查询数据 - $data = $keti->search($search); - $datacnt = $data->count(); - + // 查询要显示的数据 + $data = $keti->search($src); + // 获取符合条件记录总数 + $cnt = $data->count(); // 获取当前页数据 + $limit_start = $src['page'] * $src['limit'] - $src['limit']; + $limit_length = $src['limit']; $data = $data->slice($limit_start,$limit_length); - - + // 重组返回内容 $data = [ - 'draw'=> $getdt["draw"] , // ajax请求次数,作为标识符 - 'recordsTotal'=>$cnt, // 获取到的结果数(每页显示数量) - 'recordsFiltered'=>$datacnt, // 符合条件的总数据量 + 'code'=> 0 , // ajax请求次数,作为标识符 + 'msg'=>"", // 获取到的结果数(每页显示数量) + 'count'=>$cnt, // 符合条件的总数据量 'data'=>$data, //获取到的数据结果 ]; + return json($data); } @@ -97,13 +83,17 @@ class Index extends Base public function create() { // 设置页面标题 - $list['title'] = '添加课题册'; + $list['set'] = array( + 'webtitle'=>'添加课题册', + 'butname'=>'添加', + 'formpost'=>'POST', + 'url'=>'/kt', + ); // 模板赋值 $this->assign('list',$list); - // 渲染 - return $this->fetch(); + return $this->fetch('create'); } /** @@ -157,14 +147,22 @@ class Index extends Base public function edit($id) { // 获取荣誉册信息 - $list = keti::where('id',$id) + $list['data'] = keti::where('id',$id) ->field('id,title,category,lxshijian,lxdanweiid') ->find(); + // 设置页面标题 + $list['set'] = array( + 'webtitle'=>'编辑课题册', + 'butname'=>'修改', + 'formpost'=>'PUT', + 'url'=>'/kt/'.$id, + ); + // 模板赋值 $this->assign('list',$list); - - return $this->fetch(); + // 渲染 + return $this->fetch('create'); } /** diff --git a/application/keti/controller/KetiInfo.php b/application/keti/controller/KetiInfo.php index 3eb27955..c22471b5 100644 --- a/application/keti/controller/KetiInfo.php +++ b/application/keti/controller/KetiInfo.php @@ -18,7 +18,7 @@ class KetiInfo extends Base public function index() { // 设置要给模板赋值的信息 - $list['webtitle'] = '课题信息列表'; + $list['webtitle'] = '课题列表'; // 模板赋值 $this->assign('list',$list); @@ -34,20 +34,18 @@ class KetiInfo extends Base * @param int $id * @return \think\Response */ - public function ketiList($id) + public function ketiList($id,$title) { - - // 获取变量 + + // 设置要给模板赋值的信息 + $list['webtitle'] = $title.' 列表'; $list['id'] = $id; - // 设置页面标题 - $list['title'] = '课题信息'; - // 设置数据总数 - $list['count'] = ktinfo::where('ketice',$id)->count(); // 模板赋值 $this->assign('list',$list); - return $this->fetch(''); + // 渲染模板 + return $this->fetch(); } @@ -59,59 +57,44 @@ class KetiInfo extends Base */ public function ajaxData() { - // 获取DT的传值 - $getdt = request()->param(); + // 获取参数 + $src = $this->request + ->only([ + 'page'=>'1', + 'limit'=>'10', + 'field'=>'update_time', + 'order'=>'desc', + 'lxdanweiid'=>array(), + 'lxcategory'=>array(), + 'fzdanweiid'=>array(), + 'subject'=>array(), + 'category'=>array(), + 'jddengji'=>array(), + 'searchval'=>'' + ],'POST'); - //得到排序的方式 - $order = $getdt['order'][0]['dir']; - //得到排序字段的下标 - $order_column = $getdt['order'][0]['column']; - //根据排序字段的下标得到排序字段 - $order_field = $getdt['columns'][$order_column]['name']; - if($order_field=='') - { - $order_field = $getdt['columns'][$order_column]['data']; - } - //得到limit参数 - $limit_start = $getdt['start']; - $limit_length = $getdt['length']; - - //得到搜索的关键词 - $search = [ - 'lxdanweiid'=>$getdt['lxdanweiid'], - 'lxcategory'=>$getdt['lxcategory'], - 'fzdanweiid'=>$getdt['fzdanweiid'], - 'subject'=>$getdt['subject'], - 'category'=>$getdt['category'], - 'jddengji'=>$getdt['jddengji'], - 'ketice'=>$getdt['ketice'], - 'search'=>$getdt['search']['value'], - 'order'=>$order, - 'order_field'=>$order_field - ]; // 实例化 - $keti = new ktinfo; - - // 获取荣誉总数 - $cnt = $keti->select()->count(); - - // 查询数据 - $data = $keti->search($search); - $datacnt = $data->count(); + $ktinfo = new ktinfo; + // 查询要显示的数据 + $data = $ktinfo->search($src); + // 获取符合条件记录总数 + $cnt = $data->count(); // 获取当前页数据 + $limit_start = $src['page'] * $src['limit'] - $src['limit']; + $limit_length = $src['limit']; $data = $data->slice($limit_start,$limit_length); - - + // 重组返回内容 $data = [ - 'draw'=> $getdt["draw"] , // ajax请求次数,作为标识符 - 'recordsTotal'=>$cnt, // 获取到的结果数(每页显示数量) - 'recordsFiltered'=>$datacnt, // 符合条件的总数据量 + 'code'=> 0 , // ajax请求次数,作为标识符 + 'msg'=>"", // 获取到的结果数(每页显示数量) + 'count'=>$cnt, // 符合条件的总数据量 'data'=>$data, //获取到的数据结果 ]; + return json($data); } @@ -126,14 +109,18 @@ class KetiInfo extends Base public function create($id=0) { // 设置页面标题 - $list['title'] = '添加课题信息'; - $list['ketice'] = $id; + $list['set'] = array( + 'webtitle'=>'添加课题册', + 'butname'=>'添加', + 'formpost'=>'POST', + 'url'=>'/ktinfo', + 'ketice'=>$id + ); // 模板赋值 $this->assign('list',$list); - // 渲染 - return $this->fetch(); + return $this->fetch('create'); } /** @@ -266,7 +253,7 @@ class KetiInfo extends Base public function edit($id) { // 获取课题信息 - $list = ktinfo::where('id',$id) + $list['id'] = ktinfo::where('id',$id) ->field('id,title,fzdanweiid,bianhao,subject,category,jhjtshijian,lxpic') ->with([ 'ktZcr'=>function($query){ @@ -279,11 +266,18 @@ class KetiInfo extends Base ->find(); + // 设置页面标题 + $list['set'] = array( + 'webtitle'=>'编辑课题', + 'butname'=>'修改', + 'formpost'=>'PUT', + 'url'=>'/ktinfo/'.$id, + ); + // 模板赋值 $this->assign('list',$list); - - // 渲染模板 - return $this->fetch(); + // 渲染 + return $this->fetch('create'); } /** @@ -386,7 +380,7 @@ class KetiInfo extends Base public function jieTi($id) { // 获取课题信息 - $list = ktinfo::where('id',$id) + $list['data'] = ktinfo::where('id',$id) ->field('id,title,jddengji,jtshijian,jtpic') ->with([ 'ktCy'=>function($query){ @@ -398,11 +392,18 @@ class KetiInfo extends Base ]) ->find(); + // 设置页面标题 + $list['set'] = array( + 'webtitle'=>'编辑结题', + 'butname'=>'修改', + 'formpost'=>'PUT', + 'url'=>'/ktjt/'.$id, + ); + // 模板赋值 $this->assign('list',$list); - - // 渲染模板 - return $this->fetch(); + // 渲染 + return $this->fetch('create'); } diff --git a/application/keti/model/Keti.php b/application/keti/model/Keti.php index 63fa88a3..400421a5 100644 --- a/application/keti/model/Keti.php +++ b/application/keti/model/Keti.php @@ -9,25 +9,23 @@ use app\common\model\Base; class Keti extends Base { //搜索课题册 - public function search($search) + public function search($src) { - // 获取参数 - $lxdanweiid = $search['lxdanweiid']; - $category = $search['category']; - $order_field = $search['order_field']; - $order = $search['order']; - $category = $search['category']; - $search = $search['search']; + // 整理参数 + $lxdanweiid = $src['lxdanweiid']; + $category = $src['category']; + $searchval = $src['searchval']; - $data = $this->order([$order_field =>$order]) - ->when(strlen($lxdanweiid)>0,function($query) use($lxdanweiid){ + $data = $this + ->order([$src['field'] =>$src['order']]) + ->when(count($lxdanweiid)>0,function($query) use($lxdanweiid){ $query->where('lxdanweiid','in',$lxdanweiid); }) - ->when(strlen($category)>0,function($query) use($category){ + ->when(count($category)>0,function($query) use($category){ $query->where('category','in',$category); }) - ->when(strlen($search)>0,function($query) use($search){ - $query->where('title','like',$search); + ->when(strlen( $searchval)>0,function($query) use( $searchval){ + $query->where('title','like', $searchval); }) ->with( [ @@ -39,7 +37,10 @@ class Keti extends Base }, ] ) - ->append(['ktcnt','jtcnt']) + ->withCount(['ktInfo'=>'lxcount'],'id') + ->withCount(['ktInfo'=>function($query){ + $query->where('id','between',[1,1000]); + }]) ->select(); diff --git a/application/keti/model/KetiInfo.php b/application/keti/model/KetiInfo.php index 08cc2ee8..5d5b05fc 100644 --- a/application/keti/model/KetiInfo.php +++ b/application/keti/model/KetiInfo.php @@ -8,48 +8,43 @@ use app\common\model\Base; class KetiInfo extends Base { //搜索课题册 - public function search($search) + public function search($src) { // 获取参数 - $lxdanweiid = $search['lxdanweiid']; - $lxcategory = $search['lxcategory']; - $fzdanweiid = $search['fzdanweiid']; - $subject = $search['subject']; - $category = $search['category']; - $jddengji = $search['jddengji']; - $ketice = $search['ketice']; - $order_field = $search['order_field']; - $order = $search['order']; - $search = $search['search']; + $lxdanweiid = $src['lxdanweiid']; + $lxcategory = $src['lxcategory']; + $fzdanweiid = $src['fzdanweiid']; + $subject = $src['subject']; + $category = $src['category']; + $jddengji = $src['jddengji']; + $searchval = $src['searchval']; - $data = $this->order([$order_field =>$order]) - ->when(strlen($lxdanweiid)>0,function($query) use($lxdanweiid){ + $data = $this + ->order([$src['field'] =>$src['order']]) + ->when(count($lxdanweiid)>0,function($query) use($lxdanweiid){ $query->where('ketice','in',function ($q) use($lxdanweiid){ $q->name('keti')->where('lxdanweiid','in',$lxdanweiid)->field('id'); }); }) - ->when(strlen($lxcategory)>0,function($query) use($lxcategory){ + ->when(count($lxcategory)>0,function($query) use($lxcategory){ $query->where('ketice','in',function($q) use($lxcategory){ $q->name('keti')->where('category','in',$lxcategory)->field('id'); }); }) - ->when(strlen($fzdanweiid)>0,function($query) use($fzdanweiid){ + ->when(count($fzdanweiid)>0,function($query) use($fzdanweiid){ $query->where('fzdanweiid','in',$fzdanweiid); }) - ->when(strlen($subject)>0,function($query) use($subject){ + ->when(count($subject)>0,function($query) use($subject){ $query->where('subject','in',$subject); }) - ->when(strlen($category)>0,function($query) use($category){ + ->when(count($category)>0,function($query) use($category){ $query->where('category','in',$category); }) - ->when(strlen($ketice)>0,function($query) use($ketice){ - $query->where('ketice','in',$ketice); - }) - ->when(strlen($jddengji)>0,function($query) use($jddengji){ + ->when(count($jddengji)>0,function($query) use($jddengji){ $query->where('jddengji','in',$jddengji); }) - ->when(strlen($search)>0,function($query) use($search){ - $query->where('title','like',$search); + ->when(strlen($searchval)>0,function($query) use($searchval){ + $query->where('title','like',$searchval); }) ->with( [ diff --git a/application/keti/view/index/create.html b/application/keti/view/index/create.html index b4c30cdc..f00f31e8 100644 --- a/application/keti/view/index/create.html +++ b/application/keti/view/index/create.html @@ -1,78 +1,84 @@ {extend name="common@create" /} -{block name="mycss"} +{block name="jscss"} {/block} -{block name="formaa"} -
-
- -
- -
-
-
- -
- - {php}$category = getCategory(115);{/php} - - -
-
-
- -
- - {php} $school = schlist('区级','其它级');{/php} - - -
-
-
- -
- -
-
-
-
- -
-
-
+{block name="form"} +
+
+ +
+ +
+
+
+ +
+ {php} $category = getCategory(115);{/php} + +
+
+
+ +
+ {php} $school = schlist('区级','其它级');{/php} + +
+
+
+ +
+ +
+
+
+ +
+
{/block} -{block name="yanzheng"} - +{/block} - - -{/block} \ No newline at end of file diff --git a/application/keti/view/index/edit.html b/application/keti/view/index/edit.html deleted file mode 100644 index c7c09184..00000000 --- a/application/keti/view/index/edit.html +++ /dev/null @@ -1,78 +0,0 @@ -{extend name="common@create" /} -{block name="mycss"} -{/block} -{block name="formaa"} -
-
- -
- -
-
-
- -
- - {php}$category = getCategory(115);{/php} - - -
-
-
- -
- - {php} $school = schlist('区级','其它级');{/php} - - -
-
-
- -
- -
-
-
-
- -
-
-
-{/block} -{block name="yanzheng"} - -{/block} \ No newline at end of file diff --git a/application/keti/view/index/index.html b/application/keti/view/index/index.html index 724c0d3b..1a53ae74 100644 --- a/application/keti/view/index/index.html +++ b/application/keti/view/index/index.html @@ -1,206 +1,180 @@ + {extend name="common@list" /} -{block name="topnav"} - +{block name="jsset"} + {/block} -{block name="bouttons"} -
- - - - - 批量删除 - - - - - 添加课题册 - - - - 共有数据:{$list.count} 条 - -
-
-
筛选课题册
-
-
- {php} - $school = schlist('区级','部级'); - {/php} - -
-
- {foreach $school as $key=>$vo } - - {/foreach} -
- -
-
- {php}$category = getCategory(115);{/php} - -
-
- {foreach $category as $key=>$vo } - - {/foreach} -
- -
+{block name="nav"} + + 课题管理 + 课题册 + +{/block} +{block name="search"} + {/block} -{block name="tables"} - - - - - - - - - - - - - - - - -
课题册名称立项单位课题类别课题数量结题数量立项时间状态操作
- - +{block name="table"} +
{/block} {block name="myjs"} - + + + + {/block} \ No newline at end of file diff --git a/application/keti/view/keti_info/create.html b/application/keti/view/keti_info/create.html index 6e27fd9e..dafa63ee 100644 --- a/application/keti/view/keti_info/create.html +++ b/application/keti/view/keti_info/create.html @@ -1,306 +1,265 @@ {extend name="common@create" /} -{block name="mycss"} -{css href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/lib/webuploader/0.1.5/webuploader.css" /} +{block name="jscss"} + {/block} -{block name="formaa"} -
-
- -
-
-
-
选择文件
- -
-
-
-
-
- - - -
- -
- -
-
-
- -
- -
-
-
-
-
- -
- -
-
-
- -
- - {php} $school = schlist('校级','区级');{/php} - - -
-
-
- -
- - {php}$category = getCategory(116);{/php} - - -
-
-
- -
- - {php}$category = getCategory(117);{/php} - - -
-
-
- -
- -
-
-
-
- -
-
-
+{block name="form"} +
+ {eq name="$list.set.formpost" value="PUT" } + {if strlen($list.data.pic)>0} + + {else /} + + {/if} + {/eq} +
+
+
+ +
+
+ +
+
+ +
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+
+ +
+ {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} + +
+
+
+ +
+ {php} + $subject = new \app\teach\model\Subject; + $subjectlist = $subject->where('status',1)->order(['paixu'])->select(); + {/php} + +
+
+
+ +
+ {php} $jiangxiang = getCategory(113);{/php} + +
+
+
+ +
+ +
+
+ +
+ +
+
{/block} -{block name="yanzheng"} -{js href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/lib/webuploader/0.1.5/webuploader.js"} - +{/block} - // 添加参与人 - function addHj(obj,teacherId) - { - $('#hjteacher').val(''); - $(obj).attr('class','btn btn-warning radius mr-5 size-MINI'); - $(obj).attr('onclick','delCy(this)'); - var myhtml = ""; - myhtml = ""; - $('#addHj').append(myhtml); - $('#addHj').children("span").last().append(obj); - } - - // 删除参与人 - function delCy(obj) - { - $(obj).parent().remove(); - } - - - // 匹配用户名 - $.validator.addMethod("zh",function(value,element){ - var tel = /^[\u4e00-\u9fa5]*$/; - return this.optional(element) || tel.test(value); - }, "请输入中文"); - - - - - -{/block} \ No newline at end of file diff --git a/application/keti/view/keti_info/create_all.html b/application/keti/view/keti_info/create_all.html new file mode 100644 index 00000000..7f2101f1 --- /dev/null +++ b/application/keti/view/keti_info/create_all.html @@ -0,0 +1,43 @@ +{extend name="common@create" /} + +{block name="form"} +
+ +
+{/block} + +{block name="myjs"} + +{/block} + diff --git a/application/keti/view/keti_info/createall.html b/application/keti/view/keti_info/createall.html deleted file mode 100644 index 865db032..00000000 --- a/application/keti/view/keti_info/createall.html +++ /dev/null @@ -1,603 +0,0 @@ -{extend name="common@create" /} -{block name="mycss"} -{css href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/lib/webuploader/0.1.5/webuploader.css" /} -{/block} -{block name="formaa"} -
- -
-
-
-
-
-

或将照片拖到这里,单次最多可选300张

-
-
- -
-
-
-{/block} -{block name="yanzheng"} -{js href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/lib/webuploader/0.1.5/webuploader.js"} - -{/block} \ No newline at end of file diff --git a/application/keti/view/keti_info/edit.html b/application/keti/view/keti_info/edit.html deleted file mode 100644 index be763c18..00000000 --- a/application/keti/view/keti_info/edit.html +++ /dev/null @@ -1,175 +0,0 @@ -{extend name="common@create" /} -{block name="mycss"} -{css href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/lib/webuploader/0.1.5/webuploader.css" /} -{/block} -{block name="formaa"} -
- -
-
-
- -
- -
-
-
- -
- -
- {volist name="list.kt_zcr" id="vo"} - - - - - {/volist} -
-
-
-
-
- -
- -
-
-
- -
- - {php} $school = schlist('校级','区级');{/php} - - -
-
-
- -
- - {php}$category = getCategory(116);{/php} - - -
-
-
- -
- - {php}$category = getCategory(117);{/php} - - -
-
-
- -
- -
-
-
-
- -
-
-
-{/block} -{block name="yanzheng"} -{js href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/lib/webuploader/0.1.5/webuploader.js"} - -{/block} \ No newline at end of file diff --git a/application/keti/view/keti_info/index.html b/application/keti/view/keti_info/index.html index 33f3f816..3b17948c 100644 --- a/application/keti/view/keti_info/index.html +++ b/application/keti/view/keti_info/index.html @@ -1,313 +1,219 @@ + {extend name="common@list" /} -{block name="topnav"} - +{block name="jsset"} + {/block} -{block name="bouttons"} -
- - - - - 批量删除 - - - - - 共有数据:{$list.count} 条 - -
-
-
筛选课题册信息
-
-
- {php} - $school = schlist('区级','部级'); - {/php} - -
-
- {foreach $school as $key=>$vo } - - {/foreach} -
- -
-
- {php}$category = getCategory(115);{/php} - -
-
- {foreach $category as $key=>$vo } - - {/foreach} -
- -
-
- {php} - $school = schlist('校级','区级'); - {/php} - -
-
- {foreach $school as $key=>$vo } - - {/foreach} -
- -
-
- {php}$category = getCategory(116);{/php} - -
-
- {foreach $category as $key=>$vo } - - {/foreach} -
- -
-
- {php}$category = getCategory(117);{/php} - -
-
- {foreach $category as $key=>$vo } - - {/foreach} -
- -
-
- {php}$category = getCategory(117);{/php} - -
-
- - - - -
- -
+{block name="nav"} + + 荣誉管理 + 荣誉册 + 荣誉列表 + +{/block} +{block name="search"} + {/block} -{block name="tables"} - - - - - - - - - - - - - - - - - - -
主持人课题名称课题编号立项单位负责单位立项类型鉴定结果立项时间状态操作
- - +{block name="table"} +
{/block} {block name="myjs"} - + + + + {/block} \ No newline at end of file diff --git a/application/keti/view/keti_info/keti_list.html b/application/keti/view/keti_info/kt_list.html similarity index 100% rename from application/keti/view/keti_info/keti_list.html rename to application/keti/view/keti_info/kt_list.html