...
|
...
|
@@ -66,22 +66,16 @@ class CommonController extends RestBaseController |
|
|
$result['service'] = $rule;
|
|
|
if($res['pid'] != 0){
|
|
|
foreach($result['service'] as &$value){
|
|
|
if($value['id'] != 101 && $value['id'] != 102){
|
|
|
if($value['id'] != 100){
|
|
|
$value['name'] = $value['name'].'报表';
|
|
|
if($value['id'] == 4){
|
|
|
$value['name'] = '维修报表';
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
$result['identity'] = config('site.a_leader');
|
|
|
}else{
|
|
|
//乙方
|
|
|
foreach($result['service'] as &$value){
|
|
|
if($value['id'] != 101 && $value['id'] != 102){
|
|
|
if($value['id'] != 100){
|
|
|
$value['name'] = $value['name'].'报表';
|
|
|
if($value['id'] == 4){
|
|
|
$value['name'] = '维修报表';
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
$result['identity'] = config('site.b_leader');
|
...
|
...
|
@@ -120,24 +114,25 @@ class CommonController extends RestBaseController |
|
|
'english_name' => '',
|
|
|
'icon' => $host.'/uploads/20190621/300e16a3ec39a4cc8e536d0b911d9f48.png'
|
|
|
];
|
|
|
if(!empty($mark)){
|
|
|
if($flag == 1){
|
|
|
array_push($rule,$add);
|
|
|
}
|
|
|
}
|
|
|
$identity = $this->user['identity'];
|
|
|
if($identity != 0){
|
|
|
if(empty($leaders)){
|
|
|
//不是总领导,即领导
|
|
|
$information = [
|
|
|
'id' => 101,
|
|
|
'name' => '消息审批',
|
|
|
'english_name' => 'Message approval',
|
|
|
'icon' => $host.'/uploads/20190626/4404bf86c659e82c3d22e5587865bdc4.png'
|
|
|
];
|
|
|
array_push($rule,$information);
|
|
|
}
|
|
|
}
|
|
|
array_push($rule,$add);
|
|
|
// if(!empty($mark)){
|
|
|
// if($flag == 1){
|
|
|
// array_push($rule,$add);
|
|
|
// }
|
|
|
// }
|
|
|
// $identity = $this->user['identity'];
|
|
|
// if($identity != 0){
|
|
|
// if(empty($leaders)){
|
|
|
// //不是总领导,即领导
|
|
|
// $information = [
|
|
|
// 'id' => 101,
|
|
|
// 'name' => '消息审批',
|
|
|
// 'english_name' => 'Message approval',
|
|
|
// 'icon' => $host.'/uploads/20190626/4404bf86c659e82c3d22e5587865bdc4.png'
|
|
|
// ];
|
|
|
// array_push($rule,$information);
|
|
|
// }
|
|
|
// }
|
|
|
return $rule;
|
|
|
}
|
|
|
|
...
|
...
|
@@ -597,6 +592,16 @@ class CommonController extends RestBaseController |
|
|
return $res;
|
|
|
}
|
|
|
|
|
|
//获取独立年检的巡检信息
|
|
|
public function getInsTest($where,$field){
|
|
|
$res = Db::name('years')
|
|
|
->where($where)
|
|
|
->field($field)
|
|
|
->select()
|
|
|
->toArray();
|
|
|
return $res;
|
|
|
}
|
|
|
|
|
|
//查看是否有月检巡检
|
|
|
public function getInspectionCheck($where){
|
|
|
$res = Db::name('ins_check')
|
...
|
...
|
@@ -605,6 +610,50 @@ class CommonController extends RestBaseController |
|
|
return $res;
|
|
|
}
|
|
|
|
|
|
//获取独立年检巡检点详情
|
|
|
public function getTestPoint($where){
|
|
|
//查询项目的月检点
|
|
|
$res_test = Db::name('spot')
|
|
|
->where($where)
|
|
|
->field('id,spot_name')
|
|
|
->select()
|
|
|
->toArray();
|
|
|
if($res_test){
|
|
|
$testIns = $this->getInsTest($where,'status,spot_id,images,uid');
|
|
|
foreach ($res_test as &$value){
|
|
|
$value['status'] = 2;
|
|
|
foreach ($testIns as $ins_value){
|
|
|
if($value['id'] == $ins_value['spot_id']){
|
|
|
$value['status'] = $ins_value['status'];
|
|
|
$user = $this->getUserById(['id'=>$ins_value['uid']]);
|
|
|
if($user){
|
|
|
$value['user_login'] = $user['user_login'];
|
|
|
}else{
|
|
|
$value['user_login'] = '';
|
|
|
}
|
|
|
$images = $this->absolutionUrl($ins_value['images']);
|
|
|
$images = $this->getDayImages($images);
|
|
|
if($images){
|
|
|
$value['images'] = $images;
|
|
|
}else{
|
|
|
$value['images'] = [];
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if(!isset($value['user_login'])){
|
|
|
$value['user_login'] = '';
|
|
|
}
|
|
|
if(!isset($value['images'])){
|
|
|
$value['images'] = [];
|
|
|
}
|
|
|
}
|
|
|
$result = $res_test;
|
|
|
}else{
|
|
|
$result = [];
|
|
|
}
|
|
|
return $result;
|
|
|
}
|
|
|
|
|
|
//查看是否有日检巡检
|
|
|
public function getInspection($where){
|
|
|
$res = Db::name('inspect')
|
...
|
...
|
@@ -928,11 +977,19 @@ class CommonController extends RestBaseController |
|
|
}
|
|
|
|
|
|
//获取年检检测点列表
|
|
|
public function getTestList($page){
|
|
|
public function getTestList($page,$title_id){
|
|
|
$u_s_id_s = $this->getUidB();
|
|
|
//获取登录人所在的项目
|
|
|
$limit = config('site.limit');
|
|
|
$res = Db::name('test')
|
|
|
->where('uid',$this->userId)
|
|
|
->whereIn('uid',$u_s_id_s)
|
|
|
->where(function ($query) use ($title_id) {
|
|
|
//标题id
|
|
|
$title_id = !empty($title_id)&&isset($title_id)?$title_id:'';
|
|
|
if (!empty($title_id)) {
|
|
|
$query->where('id', $title_id);
|
|
|
}
|
|
|
})
|
|
|
->field('id,title,test_time,address,remark')
|
|
|
->page($page,$limit)
|
|
|
->order('id desc')
|
...
|
...
|
@@ -942,14 +999,41 @@ class CommonController extends RestBaseController |
|
|
}
|
|
|
|
|
|
//查询年检检测点总页数
|
|
|
public function getTestPage(){
|
|
|
public function getTestPage($title_id){
|
|
|
$u_s_id_s = $this->getUidB();
|
|
|
$count = Db::name('test')
|
|
|
->where('uid',$this->userId)
|
|
|
->whereIn('uid',$u_s_id_s)
|
|
|
->where(function ($query) use ($title_id) {
|
|
|
//标题id
|
|
|
$title_id = !empty($title_id)&&isset($title_id)?$title_id:'';
|
|
|
if (!empty($title_id)) {
|
|
|
$query->where('id', $title_id);
|
|
|
}
|
|
|
})
|
|
|
->count();
|
|
|
$limit = config('site.limit');
|
|
|
return ceil($count/$limit);
|
|
|
}
|
|
|
|
|
|
//独立年检获取乙方人员
|
|
|
public function getUidB(){
|
|
|
$user = $this->getIdentity();
|
|
|
$u_s_id_s = [];
|
|
|
if($user['identity'] == config('site.b_leader')){
|
|
|
//乙方领导
|
|
|
$uid = ','.$this->userId.',';
|
|
|
$company = $this->getCompanyB($uid);
|
|
|
if($company){
|
|
|
$u_s_id_s = explode(',',trim($company['u_s_id'],','));
|
|
|
}
|
|
|
|
|
|
}else if($user['identity'] == config('site.b_staff')){
|
|
|
//乙方员工
|
|
|
$u_s_id_s = explode(',',$this->userId);
|
|
|
}
|
|
|
return $u_s_id_s;
|
|
|
}
|
|
|
|
|
|
//根据项目id获取甲方公司名称
|
|
|
public function getACompanyName($project_id){
|
|
|
//获取甲方id,乙方id
|
...
|
...
|
@@ -2128,6 +2212,47 @@ class CommonController extends RestBaseController |
|
|
return $arr;
|
|
|
}
|
|
|
|
|
|
//获取独立年检报表详情
|
|
|
public function getTestReportDetail($res,$data){
|
|
|
$arr = [];
|
|
|
//查找乙方发起人所在乙方公司
|
|
|
$uid = ','.$res['uid'].',';
|
|
|
$host = config('site.host');
|
|
|
$b_company = $this->getCompany(['u_s_id'=>['like','%'.$uid.'%']],'id,company_name,logo');
|
|
|
$arr['b_company']['company_name'] = !empty($b_company['company_name'])?$b_company['company_name']:'';
|
|
|
$arr['b_company']['logo'] = !empty($b_company['logo'])?$host.'/'.$b_company['logo']:'';
|
|
|
//报表标题
|
|
|
$arr['title'] = $res['title'].'独立年检报表';
|
|
|
|
|
|
//独立年检时间
|
|
|
$arr['test_time'] = $res['test_time'];
|
|
|
//独立年检点
|
|
|
$arr['test_point'] = $this->getTestPoint(['test_id'=>$res['id']]);
|
|
|
|
|
|
//地点
|
|
|
$arr['address'] = $res['address'];
|
|
|
//单号
|
|
|
$arr['number'] = $res['number'];
|
|
|
//备注
|
|
|
$arr['remark'] = $res['remark'];
|
|
|
|
|
|
//独立年检(乙方发起人)
|
|
|
$user = $this->getUserById(['id'=>$res['uid']]);
|
|
|
if($user){
|
|
|
$arr['user_login'] = $user['user_login'];
|
|
|
}else{
|
|
|
$arr['user_login'] = '';
|
|
|
}
|
|
|
|
|
|
//浏览报表人员
|
|
|
$arr['browse_name'] = $this->getBrowseName($res['id'],7);
|
|
|
$service = config('site.service_test');
|
|
|
//评价内容
|
|
|
$arr['comment'] = $this->getDiscuss($service,$data['id']);
|
|
|
|
|
|
return $arr;
|
|
|
}
|
|
|
|
|
|
//获取日检报表详情
|
|
|
public function getInspectReportDetail($res,$data){
|
|
|
$arr = [];
|
...
|
...
|
@@ -2548,14 +2673,17 @@ class CommonController extends RestBaseController |
|
|
$insUidModel->create($recordData);
|
|
|
}
|
|
|
|
|
|
//记录报表浏览人员 0:日检,1:月检,2:年检,3:维修,4:改造,5:培训,6:演习
|
|
|
//记录报表浏览人员 0:日检,1:月检,2:年检,3:维修,4:改造,5:培训,6:演习,7:独立年检
|
|
|
public function createReportUid($service_id,$type=0){
|
|
|
$recordData['type'] = $type;
|
|
|
$recordData['service_id'] = $service_id;
|
|
|
$recordData['uid'] = $this->userId;
|
|
|
$recordData['create_time'] = time();
|
|
|
$reportUidModel = new ReportBrowseModel();
|
|
|
$reportUidModel->create($recordData);
|
|
|
$identity = $this->getIdentity();
|
|
|
if($identity['identity'] != config('site.a_leaders')){
|
|
|
$reportUidModel = new ReportBrowseModel();
|
|
|
$reportUidModel->create($recordData);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//根据项目id获取日检参与人员
|
...
|
...
|
@@ -2640,4 +2768,26 @@ class CommonController extends RestBaseController |
|
|
return $res;
|
|
|
}
|
|
|
|
|
|
//乙方领导id查询独立年检title
|
|
|
public function getYearsTitle(){
|
|
|
$u_s_id_s = $this->getUidB();
|
|
|
$res = Db::name('test')
|
|
|
->whereIn('uid',$u_s_id_s)
|
|
|
->field('id,title')
|
|
|
->order('id desc')
|
|
|
->select()
|
|
|
->toArray();
|
|
|
return $res;
|
|
|
}
|
|
|
|
|
|
//根据乙方领导uid查询所在乙方企业
|
|
|
public function getCompanyB($u_l_id){
|
|
|
$res = Db::name('company')
|
|
|
->where('u_l_id','like',"%$u_l_id%")
|
|
|
->where('pid',0)
|
|
|
->field('id,u_s_id')
|
|
|
->find();
|
|
|
return $res;
|
|
|
}
|
|
|
|
|
|
} |
...
|
...
|
|