$value) { if ($key == 0) { $personnel_id_list .= $personnel_data[$key]['id']; } else { $personnel_id_list .= ',' . $personnel_data[$key]['id']; } } if (!empty($Data['cl_type'])){ $where=" and cl_type=".$Data['cl_type']; }else{ $where=""; } $state_res = query_187_ytIoT("select * from ytiot_xj_event_processing where person_liable in(" . $personnel_id_list . ") and cl_type!=0 ".$where." order by id desc"); foreach ($state_res as $key => $value) { if ($state_res[$key]['sj_type'] == 1) { $state_res[$key]['event_type_name'] = '故障'; } elseif ($state_res[$key]['sj_type'] == 2) { $state_res[$key]['event_type_name'] = '隐患'; } elseif ($state_res[$key]['sj_type'] == 3) { $state_res[$key]['event_type_name'] = '其他'; } $state_res[$key]['repair_name'] = $state_res[$key]['wx_name']; $state_res[$key]['audit_status'] = $state_res[$key]['cl_type']; } $unprocessed_data = query_187_ytIoT("select count(*) as wclsl from ytiot_xj_event_processing where person_liable in(" . $personnel_id_list . ") and cl_type=1"); if (empty($unprocessed_data)) { $unprocessed_data[0]['wclsl'] = 0; } $not_reviewed_data = query_187_ytIoT("select count(*) as wshsl from ytiot_xj_event_processing where person_liable in(" . $personnel_id_list . ") and cl_type=2"); if (empty($not_reviewed_data)) { $not_reviewed_data[0]['wshsl'] = 0; } $failed_data = query_187_ytIoT("select count(*) as shwtgsl from ytiot_xj_event_processing where person_liable in(" . $personnel_id_list . ") and cl_type=3"); if (empty($failed_data)) { $failed_data[0]['shwtgsl'] = 0; } // $completed_data = query_187_ytIoT("select count(*) as ywcsl from ytiot_xj_event_processing where person_liable in(" . $personnel_id_list . ") and cl_type=4 and sh_time='%" . $date . "%'"); $completed_data = query_187_ytIoT("select count(*) as ywcsl from ytiot_xj_event_processing where person_liable in(" . $personnel_id_list . ") and cl_type=4"); if (empty($completed_data)) { $completed_data[0]['ywcsl'] = 0; } // $overtime_data = query_187_ytIoT("select count(*) as cswcsl from ytiot_xj_event_processing where person_liable in(" . $personnel_id_list . ") and cl_type=5 and sh_time='%" . $date . "%'"); $overtime_data = query_187_ytIoT("select count(*) as cswcsl from ytiot_xj_event_processing where person_liable in(" . $personnel_id_list . ") and cl_type=5"); if (empty($overtime_data)) { $overtime_data[0]['cswcsl'] = 0; } $repair_count = (int)$unprocessed_data[0]['wclsl'] + (int)$not_reviewed_data[0]['wshsl'] + (int)$failed_data[0]['shwtgsl'] + (int)$completed_data[0]['ywcsl'] + (int)$overtime_data[0]['cswcsl']; $res['msg'] = '操作成功'; $res['flag'] = true; $res['unprocessed_count'] = (int)$unprocessed_data[0]['wclsl']; $res['not_reviewed_count'] = (int)$not_reviewed_data[0]['wshsl']; $res['failed_count'] = (int)$failed_data[0]['shwtgsl']; $res['completed_count'] = (int)$completed_data[0]['ywcsl']; $res['overtime_count'] = (int)$overtime_data[0]['cswcsl']; $res['repair_count'] = (int)$repair_count; $res['data'] = $state_res; echo json_encode($res); } public function getFormData() { $Data = I(); $id = $Data['id']; $record_data = query_187_ytIoT("select dwjl_id,sj_type,id from ytiot_xj_event_processing where id=" . $id); if (empty($record_data)) { $res['msg'] = '操作失败,系统内部查询出现错误'; $res['flag'] = false; echo json_encode($res); exit(); } if ($record_data[0]['sj_type'] == 1) { $sj_type_name = '故障'; } elseif ($record_data[0]['sj_type'] == 2) { $sj_type_name = '隐患'; } elseif ($record_data[0]['sj_type'] == 3) { $sj_type_name = '其他'; } $point_data = query_187_ytIoT("select spot_id from ytiot_xj_spot_operation_record where id=" . $record_data[0]['dwjl_id']); if (empty($point_data)) { $res['msg'] = '操作失败,系统内部查询出现错误'; $res['flag'] = false; echo json_encode($res); exit(); } $address_data = query_187_ytIoT("select spot_address from ytiot_xj_inspection_points where id=" . $point_data[0]['spot_id']); if (empty($address_data)) { $res['msg'] = '操作失败,系统内部查询出现错误'; $res['flag'] = false; echo json_encode($res); exit(); } $arr[0]['address']=$address_data[0]['spot_address']; $arr[0]['id']=$record_data[0]['id']; $arr[0]['type_name']=$sj_type_name; $arr[0]['type']=$record_data[0]['sj_type']; $res['msg'] = '操作成功'; $res['flag'] = true; $res['data'] = $arr; echo json_encode($res); } public function setRepair(){ $Data=I(); $time=date('Y-m-d h:i:s',time()); $newFilePath1=$Data['img']; $val=insert_187_ytIoT("update ytiot_xj_event_processing set data1='1',jg_remarks='".$Data['remarks']."',cl_time='".$time."',picture_path='".$newFilePath1."',cl_type=2 where id=".$Data['id']); if($val){ $res['msg'] = '保存成功'; $res['flag'] = true; echo json_encode($res); }else{ $res['msg'] = '保存失败'; $res['flag'] = false; echo json_encode($res); } } }