diff --git a/app/middleware/Auth.php b/app/middleware/Auth.php index 996c57e7..e71f6a3f 100755 --- a/app/middleware/Auth.php +++ b/app/middleware/Auth.php @@ -88,6 +88,9 @@ class Auth 'keti/tongji/qugedanweilixiang', # 全区各单位立项课题统计表 'keti/tongji/qugejijieti', # 全区各级结题课题统计表 'keti/tongji/qugedanweijieti', # 全区各单位结题课题统计表 + // Rongyu荣誉 + 'rongyu/tongji/qugeji', # 全区各级教师荣誉统计表 + 'rongyu/tongji/qugedanwei', # 全区各单位教师荣誉统计表 // Renshi应用 'student/index/ajaxdataby', # 获取毕业学生列表 'student/index/ajaxdatadel', # 获取删除学生列表 diff --git a/app/rongyu/controller/Tongji.php b/app/rongyu/controller/Tongji.php new file mode 100644 index 00000000..02bd4495 --- /dev/null +++ b/app/rongyu/controller/Tongji.php @@ -0,0 +1,62 @@ +view->assign('list', $list); + // 渲染模板 + return $this->view->fetch(); + } + + + // 获取区各级立项课题数 + public function quGeji(){ + // 获取参数 + $src = $this->request + ->only([ + 'searchval' => array() + ,'betweentime' + ,'category_ryc' + ], 'POST'); + // 获取课题列表 + $tj = new tj(); + $data = $tj->quGeji($src); + return json($data); + } + + + // 获取区各单位立项课题数 + public function quGeDanwei(){ + // 获取参数 + $src = $this->request + ->only([ + 'searchval' => array() + ,'betweentime' + ,'category_ryc' + ], 'POST'); + // 获取课题列表 + $tj = new tj(); + $data = $tj->quGeDanwei($src); + return json($data); + } +} diff --git a/app/rongyu/model/JsRongyuInfo.php b/app/rongyu/model/JsRongyuInfo.php index e27c3f35..dd692987 100755 --- a/app/rongyu/model/JsRongyuInfo.php +++ b/app/rongyu/model/JsRongyuInfo.php @@ -208,6 +208,48 @@ class JsRongyuInfo extends BaseModel } + // 根据获取荣誉时间查询荣誉 + public function searchRySj($srcfrom) { + $src = [ + 'searchval' => '' + ,'betweentime' => date('Y').'-01-01~' . date('Y-m-d') + ,'category_ryc' => array() + ]; + + $src = array_cover($srcfrom, $src); + $src['time'] = explode('~', $src['betweentime']); + + $data = $this + ->whereBetweenTime('hjshijian', $src['time'][0], $src['time'][1]) + ->when(count($src['category_ryc']) > 0, function ($query) use($src) { + $query + ->where('rongyuce_id', 'in', function ($q) use($src) { + $q->name('JsRongyu') + ->where('category_id', 'in', $src['category_ryc']) + ->where('status', 1) + ->field('id'); + }); + }) + ->field('id, hjschool_id, rongyuce_id, hjshijian') + ->with([ + 'hjSchool' => function($query){ + $query->field('id, jiancheng'); + }, + 'ryTuce' => function($query){ + $query->field('id, title, fzschool_id') + ->with([ + 'fzSchool' => function($q){ + $q->field('id, title, jibie_id'); + } + ]); + }, + ]) + ->where('status', 1) + ->select(); + return $data; + } + + // 荣誉图册关联 public function ryTuce() { diff --git a/app/rongyu/model/Tongji.php b/app/rongyu/model/Tongji.php new file mode 100644 index 00000000..0baea33a --- /dev/null +++ b/app/rongyu/model/Tongji.php @@ -0,0 +1,152 @@ +srcBetweenID(10204, 10208); + // 查询课题 + $info = new info(); + $list = $info->searchRySj($srcfrom); + + // 创建统计结果数组 + $tongji = array(); + foreach ($categoryList as $key => $value) { + $tongji[$value->id] = 0; + } + // 统计荣誉数 + foreach ($list as $key => $value) { + if(isset($value->ryTuce->fzSchool)) + { + if(isset($tongji[$value->ryTuce->fzSchool->jibie_id])){ + $tongji[$value->ryTuce->fzSchool->jibie_id]++; + } + } + } + + $data = [ + 'xAxis'=>array('总课教师荣誉数') + ,'fuzhu'=>array(0) + ,'data'=>array(array_sum($tongji)) + ,'dataname'=>'教师荣誉数' + ]; + foreach ($categoryList as $key => $value) { + $data['xAxis'][] = $value->title; + } + + $fuzhu = 0; + foreach ($tongji as $key => $value) { + $data['fuzhu'][] = $fuzhu; + $fuzhu = $fuzhu + $value; + $data['data'][] = $value; + } + return $data; + } + + + // 获取全区各级特别是立项数 + public function quGeDanwei($srcfrom) + { + + // 获取级别ID + $school = new \app\system\model\School; + $src = [ + 'low' => '校级' + ,'high' => '区级' + ,'order' => 'asc' + ]; + $schoolList = $school->srcJibie($src)->column('jiancheng','id'); + $schoolList['qt'] = '其它'; + // 获取级别ID + $category = new \app\system\model\Category; + $categoryList = $category->srcBetweenID(10204, 10208)->column('title','id'); + $categoryList['qt'] = '其它'; + // 查询课题 + $info = new info(); + $list = $info->searchRySj($srcfrom); + + // 创建统计结果数组 + $tongji = array(); + foreach ($schoolList as $key => $value) { + foreach ($categoryList as $k => $val) { + $tongji[$key]['name'] = $value; + $tongji[$key][$k] = 0; + } + } + + // 循环计算已知级别和负责单位的课题 + foreach ($list as $key => $value) { + if(isset($value->hjschool_id)) + { + if(isset($value->ryTuce->fzSchool->jibie_id)){ + $tongji[$value->hjschool_id][$value->ryTuce->fzSchool->jibie_id] ++; + }else{ + $tongji[$value->hjschool_id]['qt'] ++; + } + }else{ + if(isset($value->ryTuce->fzSchool->jibie_id)){ + $tongji['qt'][$value->ryTuce->fzSchool->jibie_id] ++; + }else{ + $tongji['qt']['qt'] ++; + } + } + } + + $tjdata = array(); + $x = 0; + foreach ($tongji as $key => $value) { + foreach ($value as $k => $val) { + $tjdata[$x][] = $val; + } + $x++; + } + + $series = array(); + foreach ($categoryList as $catk => $catval) { + $series[] = [ + 'name' => $catval + ,'type' => 'bar' + ,'stack' => 'total' + ,'label' => [ + 'show' => true + ] + ,'emphasis' => [ + 'focus' => 'series' + ] + ]; + } + + // 结果赋值 + $data = [ + 'legend' => array_values($categoryList) + ,'xAxis' => [ + 'type' => 'value' + ,'data' => '' + ] + ,'yAxis' => [ + 'type' => 'category' + ,'data' => array_values($schoolList) + ] + ,'series' => $series + ,'data' => $tjdata + ]; + + return $data; + } + +} diff --git a/app/rongyu/route/rongyu.php b/app/rongyu/route/rongyu.php index 777ad43c..0bbdfe85 100755 --- a/app/rongyu/route/rongyu.php +++ b/app/rongyu/route/rongyu.php @@ -57,3 +57,10 @@ Route::group('jsryinfo', function () { Route::rule('outxlsx/','JsRongyuInfo/outXlsx','get'); # 批量保存 Route::rule('srccy','JsRongyuInfo/srcCy','post'); # 获取数据 }); + +// 荣誉统计 +Route::group('tongji', function () { + Route::rule('','Tongji/index','get'); # 信息列表 + Route::rule('qgj','Tongji/quGeji','post'); # 获取数据 + Route::rule('qgdw','Tongji/quGeDanwei','post'); # 获取数据 + }); diff --git a/app/rongyu/view/jiaoshi/create.html b/app/rongyu/view/jiaoshi/create.html index fd583db4..1acf8c77 100755 --- a/app/rongyu/view/jiaoshi/create.html +++ b/app/rongyu/view/jiaoshi/create.html @@ -51,7 +51,7 @@ layui.use(['laydate', 'createInput'], function() { var laydate = layui.laydate, cInput = layui.createInput; - cInput.categorySelect('category_id', 112, "{$list.data.category_id|default=''}"); + cInput.categorySelect('category_id', 114, "{$list.data.category_id|default=''}"); cInput.schoolSelect('fzschool_id', '区级', '其它级', "{$list.data.fzschool_id|default=''}"); //执行一个laydate实例 diff --git a/app/rongyu/view/js_rongyu_info/create.html b/app/rongyu/view/js_rongyu_info/create.html index ffa4eef8..970a9128 100755 --- a/app/rongyu/view/js_rongyu_info/create.html +++ b/app/rongyu/view/js_rongyu_info/create.html @@ -44,7 +44,7 @@
diff --git a/app/rongyu/view/tongji/index.html b/app/rongyu/view/tongji/index.html new file mode 100644 index 00000000..a4836620 --- /dev/null +++ b/app/rongyu/view/tongji/index.html @@ -0,0 +1,105 @@ +{extend name=".././view/list.html" /} +{block name="jsset"} +{/block} +{block name="nav"} + + 教务管理 + 班级管理 + {$list['webtitle']} + +{/block} +{block name="search"} +
+ +
+ +
+
+
+
+ +
+ +
+
+
+
+ +
+{/block} +{block name="table"} +
+{/block} +{block name="echart"} +
+
+
+
+
+
+{/block} +{block name="myjs"} + + + + + + +{/block} diff --git a/database/seeds/Rule.php b/database/seeds/Rule.php index 9accefed..37f1b00b 100755 --- a/database/seeds/Rule.php +++ b/database/seeds/Rule.php @@ -1586,7 +1586,14 @@ class Rule extends Seeder ,'paixu' => 9 ,'pid' => 803 ], - + ['id' => 804 + ,'title' => '荣誉统计' + ,'name' => 'rongyu/tongji/index' + ,'paixu' => 4 + ,'ismenu' => 1 + ,'pid' => 8 + ,'url' => '/rongyu/tongji' + ], /*======================================================================