|
...
|
...
|
@@ -4,6 +4,7 @@ namespace app\school\controller; |
|
|
|
|
|
|
|
use app\common\controller\DoubleBase;
|
|
|
|
use app\school\controller\project_common\ProjectData;
|
|
|
|
use app\school\model\basic\College;
|
|
|
|
use app\school\model\project_common\ProjectRegister;
|
|
|
|
use think\Db;
|
|
|
|
use fast\Export;
|
|
...
|
...
|
@@ -97,4 +98,67 @@ class ProjectSummary extends DoubleBase |
|
|
|
$this->error('导出失败,稍后请重新尝试');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function statistics()
|
|
|
|
{
|
|
|
|
if($this->request->isAjax()) {
|
|
|
|
// dump($this->containerId);die;
|
|
|
|
$matchInfo = Db::name('project_container')->where(['id' => $this->containerId])->find();
|
|
|
|
$responseData = ['match_title'=>$matchInfo['container_name'],'group'=>['title' => [],'value'=>[]],'college_people' => [],'people'=>['title' => [],'value'=>[]]];
|
|
|
|
$collegeModel = new \app\school\model\basic\College();
|
|
|
|
|
|
|
|
$typeGroup = Db::name('project_type')->alias('a')
|
|
|
|
->field('a.name as title,count(b.id) as value')
|
|
|
|
->join('project_register b','a.id = b.project_type','left')
|
|
|
|
->where(['a.container_id' => $this->containerId])
|
|
|
|
->group('a.id')
|
|
|
|
->select();
|
|
|
|
|
|
|
|
if($typeGroup) {
|
|
|
|
$responseData['group']['title'] = array_column($typeGroup,'title');
|
|
|
|
$responseData['group']['value'] = array_column($typeGroup,'value');
|
|
|
|
}
|
|
|
|
|
|
|
|
$peopleData = Db::name('project_type')->alias('a')
|
|
|
|
->field('a.name as title,count(c.id) as value')
|
|
|
|
->join('project_register b','a.id = b.project_type','left')
|
|
|
|
->join('members c','b.id = c.item_id and c.member_source = 2 and member_type = 1','left')
|
|
|
|
->where(['a.container_id' => $this->containerId])
|
|
|
|
->group('a.id')
|
|
|
|
->select();
|
|
|
|
// dump(collection($peopleData)->toArray());die;
|
|
|
|
if($peopleData) {
|
|
|
|
$responseData['people']['title'] = array_column($peopleData,'title');
|
|
|
|
$responseData['people']['value'] = array_column($peopleData,'value');
|
|
|
|
}
|
|
|
|
$this->success('',null,$responseData);
|
|
|
|
}
|
|
|
|
$collegeList = (new College())->field('college_name,id')->where(['school_id' => SCHOOL_ID,'is_college' => 1])->select();
|
|
|
|
$this->assignconfig('collegeList',$collegeList);
|
|
|
|
return $this->view->fetch();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function getCollegeData()
|
|
|
|
{
|
|
|
|
$collegeId = request()->param('college_id');
|
|
|
|
$result = ['match_title' => '','title' => [],'val' => []];
|
|
|
|
$data = Db::name('project_type')->alias('a')
|
|
|
|
->field('a.name as title,count(b.id) as value')
|
|
|
|
->join('project_register b','a.id = b.project_type','left')
|
|
|
|
->join('user c','b.user_id = c.id and c.college = '.$collegeId,'left')
|
|
|
|
->where(['a.container_id' => $this->containerId])
|
|
|
|
->group('a.id')
|
|
|
|
->select();
|
|
|
|
if($data) {
|
|
|
|
$result['title'] = array_column($data,'title');
|
|
|
|
$result['val'] = array_column($data,'value');
|
|
|
|
}
|
|
|
|
|
|
|
|
$this->success('',null,$result);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
\ No newline at end of file |
...
|
...
|
|