|
@@ -265,7 +265,7 @@ class Alarm extends Base_Controller {
|
|
|
public function patrol_list(){
|
|
|
$role = $this->get_user_info('role');
|
|
|
$userid = $this->get_user_info('id');
|
|
|
- $companyid = $this->get_user_info('companyid');
|
|
|
+ $company = $this->get_user_info('company');
|
|
|
$projectid = $this->input->post('projectid',true);
|
|
|
|
|
|
$page = $this->input->post('page',true);
|
|
@@ -278,49 +278,56 @@ class Alarm extends Base_Controller {
|
|
|
$page = !isset($page) ? 1 : $page;
|
|
|
$count = empty($count) ? 20 : $count;
|
|
|
|
|
|
+ $limit = $count;
|
|
|
+ $offset = ($page - 1)*$count;
|
|
|
+
|
|
|
// 信息字段
|
|
|
$field = "L.id,
|
|
|
- N.id as networkid,
|
|
|
P.id as projectid,
|
|
|
- N.networkname as network_name,
|
|
|
P.projectname as project_name,
|
|
|
L.number,
|
|
|
- cmd.patroltype,
|
|
|
- cmd.patrolinterval,
|
|
|
- cmd.updatetime";
|
|
|
+ L.patrolinterval";
|
|
|
|
|
|
- $fiter =array();
|
|
|
+ $where =array();
|
|
|
$section = $this->input->post('section',true);
|
|
|
+ $projectid = intval($this->input->post('projectid',true));
|
|
|
|
|
|
- if (!empty($section)) $fiter['section'] = $section;
|
|
|
- if (!empty($keyword)) $fiter['keyword'] = $keyword;
|
|
|
- if (isset($status)) $fiter['status'] = $status;
|
|
|
+ if (!empty($section)) $where['L.section'] = $section;
|
|
|
+ if (!empty($projectid)) $where['L.projectid'] = $projectid;
|
|
|
+ if (!empty($keyword)) $where['L.number|'] = $keyword;
|
|
|
+ if ($role != SYSTEM_ADMIN) $where['P.company'] = $company;
|
|
|
|
|
|
+ $join = [];
|
|
|
+ $join[] = ['table'=>'project as P','cond'=>'P.id = L.projectid','type'=>'left'];
|
|
|
|
|
|
if (empty($download)) {
|
|
|
+
|
|
|
// 获取巡检信息列表
|
|
|
if (isset($print) && !empty($print)) {
|
|
|
- $data = $this->Patrol_model->getList($role,$companyid,$projectid,$userid,$fiter,$field,$page,$count,1);
|
|
|
+ // $data = $this->Patrol_model->getList($role,$companyid,$projectid,$userid,$fiter,$field,$page,$count,1);
|
|
|
+ $data = $this->Lamp_model->get_list_by_join($where, $field,$limit, $offset, $join, 'L.number ASC,L.id DESC', NUll, 'L');
|
|
|
}else{
|
|
|
- $data = $this->Patrol_model->getList($role,$companyid,$projectid,$userid,$fiter,$field,$page,$count);
|
|
|
+ $data = $this->Lamp_model->get_list_by_join($where, $field,$limit, $offset, $join, 'L.number ASC,L.id DESC', NUll, 'L');
|
|
|
}
|
|
|
|
|
|
// 获取巡检信息总数
|
|
|
- $total = $this->Patrol_model->getTotal($role,$companyid,$projectid,$userid,$fiter);
|
|
|
+ $total = $this->Lamp_model->get_list_by_multi_join($where, 'count(*) as total', null, null, $join, 'L.number ASC,L.id DESC', NUll, 'L',true);
|
|
|
+ $total = $total['total'];
|
|
|
|
|
|
json_result('0000',$this->response['0000'],array('patrol_list'=>$data,'total'=>ceil($total/$count)));
|
|
|
}else{
|
|
|
// 获取巡检信息列表
|
|
|
- $data = $this->Patrol_model->getList($role,$companyid,$projectid,$userid,$fiter,$field,($page-1)*$count,3000);
|
|
|
+ $data = $this->Lamp_model->get_list_by_join($where, $field,3000, 0, $join, 'L.number ASC,id DESC', NUll, 'L');
|
|
|
+ // $data = $this->Patrol_model->getList($role,$companyid,$projectid,$userid,$fiter,$field,($page-1)*$count,3000);
|
|
|
|
|
|
$version = $this->session->userdata('version');
|
|
|
if (empty($version)) {
|
|
|
$title = array(
|
|
|
- array('编号','项目名称','网络名称','路灯编号','巡检命令','巡检间隔时间(min)','参数设置时间'),
|
|
|
+ array('编号','项目名称','路灯编号','巡检间隔时间(min)'),
|
|
|
);
|
|
|
}else{
|
|
|
$title = array(
|
|
|
- array('Number','Project name','Network name','Lamp Number','Patrol order','Inspection interval time(min)','Parameter setting time'),
|
|
|
+ array('Number','Project name','Lamp Number','Inspection interval time(min)'),
|
|
|
);
|
|
|
}
|
|
|
|
|
@@ -329,16 +336,8 @@ class Alarm extends Base_Controller {
|
|
|
foreach ($data as $k=>$v) {
|
|
|
$temp[$k][] = $i;
|
|
|
$temp[$k][] = $v['project_name'];
|
|
|
- $temp[$k][] = $v['network_name'];
|
|
|
$temp[$k][] = $v['number'];
|
|
|
- if (empty($version)) {
|
|
|
- $temp[$k][] = $v['patroltype'] == 1 ? '开' : '关';
|
|
|
- }else{
|
|
|
- $temp[$k][] = $v['patroltype'] == 1 ? 'on' : 'off';
|
|
|
- }
|
|
|
-
|
|
|
$temp[$k][] = $v['patrolinterval'];
|
|
|
- $temp[$k][] = $v['updatetime'];
|
|
|
$i ++;
|
|
|
}
|
|
|
|