...
|
...
|
@@ -11,6 +11,87 @@ use think\Db; |
|
|
*/
|
|
|
class ReportController extends RestBaseController
|
|
|
{
|
|
|
/**
|
|
|
* @title 获取项目标题列表
|
|
|
* @description 接口说明
|
|
|
* @author 开发者
|
|
|
* @url /api/home/report/getTitleList
|
|
|
* @method GET
|
|
|
*
|
|
|
* @header name:token require:1 default: desc:header
|
|
|
*
|
|
|
* @param name:project_id type:inter require:0 default: other desc:项目id
|
|
|
* @param name:type type:inter require:0 default: other desc:类型(1:月检,2:年检,3:维修,4:改造,5:培训,6:演习 )
|
|
|
*
|
|
|
* @return title_a:字母排序['b','c']
|
|
|
* @return title_n:项目名称@
|
|
|
* @title_n acronym:字母 title_l:项目列表@
|
|
|
* @title_l id:列表标题id title:标题名称
|
|
|
*/
|
|
|
public function getTitleList(){
|
|
|
if($this->request->isGet()){
|
|
|
$project_id = $this->request->get('project_id');
|
|
|
$type = $this->request->get('type');
|
|
|
|
|
|
$rule = config('site.project_ids');
|
|
|
$validate = new Validate($rule['rule'],$rule['msg']);
|
|
|
if (!$validate->check(['project_id'=>$project_id,'type'=>$type])) {
|
|
|
$this->error($validate->getError());
|
|
|
}
|
|
|
|
|
|
$res = [];
|
|
|
$common = new CommonController();
|
|
|
if($type == 1){
|
|
|
//月检
|
|
|
$res = $common->getTitleById('check',$project_id);
|
|
|
}else if($type == 2){
|
|
|
//年检
|
|
|
$res = $common->getTitleById('pro_check',$project_id);
|
|
|
}else if($type == 3){
|
|
|
//维修
|
|
|
$res = $common->getTitleById('repair',$project_id);
|
|
|
}else if($type == 4){
|
|
|
//改造
|
|
|
$res = $common->getTitleById('reform',$project_id);
|
|
|
}else if($type == 5){
|
|
|
//培训
|
|
|
$res = $common->getTitleById('train',$project_id);
|
|
|
}else if($type == 6){
|
|
|
//演习
|
|
|
$res = $common->getTitleById('exercise',$project_id);
|
|
|
}
|
|
|
|
|
|
$arr2 = [];
|
|
|
if($res){
|
|
|
$acronym = [];
|
|
|
foreach($res as $key=>$value){
|
|
|
$acronym[$key] = $common->getFirstCharter($value['title']);
|
|
|
}
|
|
|
$acronym =array_values(array_unique($acronym));
|
|
|
sort($acronym);
|
|
|
$arr1 = [];
|
|
|
foreach($acronym as $a_key=>$a_value){
|
|
|
$k = 0;
|
|
|
$arr1[$a_key]['acronym'] = $a_value;
|
|
|
foreach($res as $r_value){
|
|
|
$k+=0;
|
|
|
$first = $common->getFirstCharter($r_value['title']);
|
|
|
if($first == $a_value){
|
|
|
$arr1[$a_key]['title_l'][$k] = $r_value;
|
|
|
$k++;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
$arr2['title_a'] = $acronym;
|
|
|
$arr2['title_n'] = $arr1;
|
|
|
}
|
|
|
|
|
|
$this->success('成功',$arr2);
|
|
|
}else{
|
|
|
$this->error('请求方式错误!');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* @title 月检年检项目状态
|
...
|
...
|
@@ -159,6 +240,7 @@ class ReportController extends RestBaseController |
|
|
*
|
|
|
* @param name:company_id type:inter require:0 default: other desc:企业id(总领导传此字段)
|
|
|
* @param name:project_id type:inter require:0 default: other desc:项目id(检索)
|
|
|
* @param name:title_id type:inter require:0 default: other desc:标题id(检索)
|
|
|
* @param name:status type:inter require:0 default: other desc:状态(检索状态:-1:全部,0:待确认,1:已驳回,2:进行中,3:申请中,4:已完成)
|
|
|
* @param name:start_time type:inter require:0 default: other desc:开始日期(检索开始日期)
|
|
|
* @param name:end_time type:inter require:0 default: other desc:开始日期(检索结束日期)
|
...
|
...
|
@@ -226,6 +308,7 @@ class ReportController extends RestBaseController |
|
|
*
|
|
|
* @param name:company_id type:inter require:0 default: other desc:企业id(总领导传此字段)
|
|
|
* @param name:project_id type:inter require:0 default: other desc:项目id(检索)
|
|
|
* @param name:title_id type:inter require:0 default: other desc:标题id(检索)
|
|
|
* @param name:status type:inter require:0 default: other desc:状态(检索状态:-1:全部,0:待确认,1:进行中,2:申请中,3:已完成)
|
|
|
* @param name:start_time type:inter require:0 default: other desc:开始日期(检索开始日期)
|
|
|
* @param name:end_time type:inter require:0 default: other desc:开始日期(检索结束日期)
|
...
|
...
|
@@ -293,6 +376,7 @@ class ReportController extends RestBaseController |
|
|
*
|
|
|
* @param name:company_id type:inter require:0 default: other desc:企业id(总领导传此字段)
|
|
|
* @param name:project_id type:inter require:0 default: other desc:项目id(检索)
|
|
|
* @param name:title_id type:inter require:0 default: other desc:标题id(检索)
|
|
|
* @param name:status type:inter require:0 default: other desc:状态(检索状态:-1:全部,0:待确认,1:进行中,2:已完成)
|
|
|
* @param name:start_time type:inter require:0 default: other desc:开始日期(检索开始日期)
|
|
|
* @param name:end_time type:inter require:0 default: other desc:开始日期(检索结束日期)
|
...
|
...
|
|