Management.php 7.2 KB
<?php

namespace app\school\controller\project_mid_check;

use app\common\controller\DoubleBase;
use app\school\controller\project_common\ProjectData;
use app\school\model\project_common\ProjectRegister;
use app\school\model\project_common\ProjectReview;
use think\Db;

class Management extends DoubleBase
{
    protected $containerId = null;
    protected $model = null;
    // 评审阶段(0:立项评审;1:中期检查;2:项目结题)
    protected $reviewStage = 1;
    protected $shopIdAutoCondition = false;

    public function _initialize()
    {
        parent::_initialize();
        $this->containerId = $_COOKIE['container_id'];
        $this->model = new ProjectRegister();
        $school = session("school");
        $this->assignconfig('review_stage', $this->reviewStage);
        $this->assign('login_type', $school["rule_type"]);
        $this->assignconfig('login_type', $school["rule_type"]);

    }

    use ProjectData;

    public function index() {
        $stageWhere = [
            'container_id' => $this->containerId,
            'review_stage' => $this->reviewStage
        ];
        $reviewStageIds = (new ProjectReview())->where($stageWhere)->column('id');

        $this->assignconfig('review_stage_ids', $reviewStageIds);
        return $this->view->fetch();
    }

    /**
     * 全部项目(未淘汰&已通过学校审核)
     * @return array
     */
    public function all()
    {
        if ($this->request->isAjax()) {
            $map = [];
            $filter = json_decode($this->request->get('filter'), true);
            //自定义搜索条件
            if(isset($filter['project_type'])) {
                $map['a.project_type'] =  $filter['project_type'];
            }
            if(isset($filter['project_level'])) {
                $map['a.project_level'] =  $filter['project_level'];
            }
            if(isset($filter['college_id'])) {
                $map['u.college'] =  $filter['college_id'];
            }
            if(isset($filter['username'])) {
                $map['u.nickname'] = ['like',"%{$filter['username']}%"];
            }
            if ($this->auth->rule_type == 1){
                //所属学院或部门
                $map['a.project_college'] =  $this->auth->college_id;
            }
            $map['a.review_stage'] =  2;
            if ($this->auth->rule_type == 1){
                //所属学院或部门
                $map['a.project_college'] =  $this->auth->college_id;
            }
            return $this->midProjectData($map);
        }
    }

    /**
     * 学校未审核
     * @return array
     */
    public function schoolNoAudit()
    {
        if ($this->request->isAjax()) {
            $filter = json_decode($this->request->get('filter'), true);
            //自定义搜索条件
            if(isset($filter['project_type'])) {
                $map['a.project_type'] =  $filter['project_type'];
            }
            if(isset($filter['project_level'])) {
                $map['a.project_level'] =  $filter['project_level'];
            }
            if(isset($filter['college_id'])) {
                $map['u.college'] =  $filter['college_id'];
            }
            if(isset($filter['username'])) {
                $map['u.nickname'] = ['like',"%{$filter['username']}%"];
            }
            if ($this->auth->rule_type == 1){
                //所属学院或部门
                $map['a.project_college'] =  $this->auth->college_id;
            }
            $map['a.project_metaphase_status'] = 2;
            $map['a.mid_attachment'] = ['EXP',Db::raw('IS NOT NULL')];
            $map['a.mid_attachment'] = ['<>', ''];
            return $this->midProjectData($map);
//            return $this->midProjectData(['a.project_metaphase_status' => 2, 'a.mid_attachment' => ['EXP',Db::raw('IS NOT NULL')], 'a.mid_attachment' => ['<>', '']]);
        }
    }

    /**
     * 学院未审核
     * @return array
     */
    public function collegeNoAudit()
    {
        if ($this->request->isAjax()) {
            $filter = json_decode($this->request->get('filter'), true);
            //自定义搜索条件
            if(isset($filter['project_type'])) {
                $map['a.project_type'] =  $filter['project_type'];
            }
            if(isset($filter['project_level'])) {
                $map['a.project_level'] =  $filter['project_level'];
            }
            if(isset($filter['college_id'])) {
                $map['u.college'] =  $filter['college_id'];
            }
            if(isset($filter['username'])) {
                $map['u.nickname'] = ['like',"%{$filter['username']}%"];
            }
            if ($this->auth->rule_type == 1){
                //所属学院或部门
                $map['a.project_college'] =  $this->auth->college_id;
            }
            $map['a.project_metaphase_status'] = ['IN', '0,1'];
            $map['a.mid_attachment'] = ['EXP',Db::raw('IS NOT NULL')];
            $map['a.mid_attachment'] = ['<>', ''];
            return $this->midProjectData($map);
//            return $this->midProjectData(['a.project_metaphase_status' => ['IN', '0,1'], 'a.mid_attachment' => ['EXP',Db::raw('IS NOT NULL')], 'a.mid_attachment' => ['<>', '']]);
        }
    }

    /**
     * 填报不完整
     * @return array
     */
    public function incomplete()
    {
        if ($this->request->isAjax()) {
            $filter = json_decode($this->request->get('filter'), true);
            //自定义搜索条件
            if(isset($filter['project_type'])) {
                $map['a.project_type'] =  $filter['project_type'];
            }
            if(isset($filter['project_level'])) {
                $map['a.project_level'] =  $filter['project_level'];
            }
            if(isset($filter['college_id'])) {
                $map['u.college'] =  $filter['college_id'];
            }
            if(isset($filter['username'])) {
                $map['u.nickname'] = ['like',"%{$filter['username']}%"];
            }
            if ($this->auth->rule_type == 1){
                //所属学院或部门
                $map['a.project_college'] =  $this->auth->college_id;
            }
            $map['a.mid_attachment'] = [['EXP',Db::raw('IS NULL')], ['=', ''], 'or'];
            return $this->midProjectData($map);
//            return $this->midProjectData(['a.mid_attachment' => [['EXP',Db::raw('IS NULL')], ['=', ''], 'or']]);
        }
    }

    /**
     * 淘汰
     * @return array
     */
    public function out()
    {
        if ($this->request->isAjax()) {
            $filter = json_decode($this->request->get('filter'), true);
            //自定义搜索条件
            if(isset($filter['project_type'])) {
                $map['a.project_type'] =  $filter['project_type'];
            }
            if(isset($filter['project_level'])) {
                $map['a.project_level'] =  $filter['project_level'];
            }
            if(isset($filter['college_id'])) {
                $map['u.college'] =  $filter['college_id'];
            }
            if(isset($filter['username'])) {
                $map['u.nickname'] = ['like',"%{$filter['username']}%"];
            }
            $map['a.project_status'] = 1;
            return $this->midProjectData($map);
//            return $this->midProjectData(['a.project_status' => 1]);
        }
    }


}