|
@@ -643,14 +643,43 @@ class Map extends Base_Controller{
|
|
|
|
|
|
// 故障详情
|
|
|
public function fault_info(){
|
|
|
- $lampid = $this->input->post('lampid',true);
|
|
|
+ $alarmid = $this->input->post('lampid',true);
|
|
|
$userid = $this->get_user_info('id');
|
|
|
|
|
|
- if (empty($lampid)) {
|
|
|
+ if (empty($alarmid)) {
|
|
|
exit(json_result('0007',$this->response['0007'],array()));
|
|
|
}
|
|
|
|
|
|
- $data = $this->Alarm_model->get_fault_info($lampid);
|
|
|
+ // $field = "P.projectname,L.number,AI.stralarmtype,AI.id as alarmid,AI.updatetime,AI.status,RU.id as userid";
|
|
|
+ // $sql = "select {$field} FROM
|
|
|
+ // lampinfo as L LEFT join {$this->table} as AI on L.id=AI.lampid
|
|
|
+ // LEFT join project as P on P.id=L.projectid
|
|
|
+ // LEFT join repair_dispatch as RD on RD.lampid=L.id
|
|
|
+ // LEFT join repair_user as RU on RU.id=RD.repair_userid
|
|
|
+ // where L.id={$lampid} order by AI.updatetime desc limit 1";
|
|
|
+
|
|
|
+ // $data = $this->Alarm_model->get_fault_info($lampid);
|
|
|
+ $join = array();
|
|
|
+ $join[] = ['table'=>'lampinfo as L','cond'=>'L.id = AI.lampid','type'=>'inner'];
|
|
|
+ $join[] = ['table'=>'project as P','cond'=>'P.id = L.projectid','type'=>'inner'];
|
|
|
+ $join[] = ['table'=>'global_location as G','cond'=>'G.id = P.cityid','type'=>'inner'];
|
|
|
+ $data = $this->Alarm_model->get_list_by_multi_join(['AI.id'=>$alarmid], 'L.number,AI.updatetime,AI.panelstatus,AI.lampstatus,AI.id as alarmid,AI.tempstatus,AI.batstatus,G.timezone,AI.status,P.projectname',NULL, NULL, $join, NULL, NUll, 'AI', true);
|
|
|
+
|
|
|
+ $batstatus = $this->config->item('batstatus');
|
|
|
+ $panelstatus = $this->config->item('panelstatus');
|
|
|
+ $lampstatus = $this->config->item('lampstatus');
|
|
|
+ $tempstatus = $this->config->item('tempstatus');
|
|
|
+ $temp2 = array();
|
|
|
+ if (isset($batstatus[$data['batstatus']])) $temp2[] = $batstatus[$data['batstatus']];
|
|
|
+ if (isset($panelstatus[$data['panelstatus']])) $temp2[] = $panelstatus[$data['panelstatus']];
|
|
|
+ if (isset($lampstatus[$data['lampstatus']])) $temp2[] = $lampstatus[$data['lampstatus']];
|
|
|
+ if (isset($tempstatus[$data['tempstatus']])) $temp2[] = $tempstatus[$data['tempstatus']];
|
|
|
+ if (!empty($temp2)) {
|
|
|
+ $data['stralarmtype'] = implode(',', $temp2);
|
|
|
+ }else{
|
|
|
+ $data['stralarmtype'] = '';
|
|
|
+ }
|
|
|
+
|
|
|
$data['userid'] = empty($data['userid']) ? 0 : $data['userid'];
|
|
|
|
|
|
// 获取维修人员列表
|