|
@@ -226,7 +226,7 @@ class Repair extends Controller
|
|
|
->where('patrol_mode',4)
|
|
->where('patrol_mode',4)
|
|
|
->where('patrol_addr_id',$addr['id'])
|
|
->where('patrol_addr_id',$addr['id'])
|
|
|
->order('id desc')
|
|
->order('id desc')
|
|
|
- ->paginate(10,true)
|
|
|
|
|
|
|
+ ->paginate(10)
|
|
|
->each(function($item,$key){
|
|
->each(function($item,$key){
|
|
|
$item['addrName'] = Db::name('address')->where('id',$item['patrol_addr_id'])->value('title');
|
|
$item['addrName'] = Db::name('address')->where('id',$item['patrol_addr_id'])->value('title');
|
|
|
$item['userName'] = Db::name('user')->where('id',$item['user_id'])->value('real_name');
|
|
$item['userName'] = Db::name('user')->where('id',$item['user_id'])->value('real_name');
|
|
@@ -250,38 +250,76 @@ class Repair extends Controller
|
|
|
$item['statusTxt'] = $statusTxt;
|
|
$item['statusTxt'] = $statusTxt;
|
|
|
return $item;
|
|
return $item;
|
|
|
});
|
|
});
|
|
|
- $page = $list->render();
|
|
|
|
|
-// foreach ($list as $k=>$v){
|
|
|
|
|
-// $list[$k]['addrName'] = Db::name('address')->where('id',$v['patrol_addr_id'])->value('title');
|
|
|
|
|
-// $list[$k]['userName'] = Db::name('user')->where('id',$v['user_id'])->value('real_name');
|
|
|
|
|
-// $status = Db::name('patrol_task')->where('id',$v['patrol_task_id'])->value('status');
|
|
|
|
|
-// $statusTxt = '';
|
|
|
|
|
-// if($status == 0){
|
|
|
|
|
-// $statusTxt = '待完成';
|
|
|
|
|
-// }elseif ($status == 1){
|
|
|
|
|
-// $statusTxt = '执行中';
|
|
|
|
|
-// }elseif ($status == 2){
|
|
|
|
|
-// $statusTxt = '已完成';
|
|
|
|
|
-// }elseif ($status == 3){
|
|
|
|
|
-// $statusTxt = '未完成';
|
|
|
|
|
-// }elseif ($status == 5){
|
|
|
|
|
-// $statusTxt = '中断';
|
|
|
|
|
-// }elseif ($status == 6){
|
|
|
|
|
-// $statusTxt = '已关闭';
|
|
|
|
|
-// }
|
|
|
|
|
-// $list[$k]['statusTxt'] = $statusTxt;
|
|
|
|
|
-// $list[$k]['status'] = $status;
|
|
|
|
|
-// $list[$k]['create_time'] = date('m-d H:i:s',strtotime($v['create_time']));
|
|
|
|
|
-// }
|
|
|
|
|
-
|
|
|
|
|
$this->assign('list',$list);
|
|
$this->assign('list',$list);
|
|
|
- $this->assign('page',$page);
|
|
|
|
|
|
|
+ $this->assign('currentPage',$list->currentPage());
|
|
|
|
|
+ $this->assign('lastPage',$list->lastPage());
|
|
|
|
|
+ $this->assign('total',$list->total());
|
|
|
$this->assign('title','巡检记录');
|
|
$this->assign('title','巡检记录');
|
|
|
return $this->fetch();
|
|
return $this->fetch();
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+ public function recordDetail()
|
|
|
|
|
+ {
|
|
|
|
|
+ $id = input('id', 0, 'intval');
|
|
|
|
|
+ if (!$id) {
|
|
|
|
|
+ $this->error('参数错误');
|
|
|
|
|
+ }
|
|
|
|
|
+ $info = Db::name('patrol_record')->where('id', $id)->find();
|
|
|
|
|
+ if (!$info) {
|
|
|
|
|
+ $this->error('记录不存在');
|
|
|
|
|
+ }
|
|
|
|
|
+ $info['addr'] = Db::name('address')->where('id', $info['patrol_addr_id'])->value('title');
|
|
|
|
|
+ $info['task_name'] = Db::name('patrol_task')->where('id', $info['patrol_task_id'])->value('title');
|
|
|
|
|
+ $info['in_order'] = Db::name('patrol_task')->where('id', $info['patrol_task_id'])->value('in_order');
|
|
|
|
|
+ $info['task_addr_form'] = Db::name('patrol_addr_form')
|
|
|
|
|
+ ->alias('a')
|
|
|
|
|
+ ->join('patrol_task_addr b', 'a.id = b.patrol_form_id')
|
|
|
|
|
+ ->where('b.id', $info['patrol_addr_form_id'])->value('a.title');
|
|
|
|
|
+ $info['task_user'] = Db::name('user')->where('id', $info['user_id'])->value('real_name');
|
|
|
|
|
+ $info['check_json'] = json_decode($info['check_json'], true);
|
|
|
|
|
+ $info['images'] = $info['images'] ? array_filter(explode(',', $info['images'])) : [];
|
|
|
|
|
+
|
|
|
|
|
+ // 整改状态:关联工单是否存在
|
|
|
|
|
+ $zgType = 0;
|
|
|
|
|
+ if ($info['order_id'] > 0) {
|
|
|
|
|
+ $order = Db::name('orders')
|
|
|
|
|
+ ->where('id', $info['order_id'])
|
|
|
|
|
+ ->where('quality_type', $info['patrol_mode'] + 1)
|
|
|
|
|
+ ->whereIn('order_mode', [5, 6])
|
|
|
|
|
+ ->where('del', 0)
|
|
|
|
|
+ ->find();
|
|
|
|
|
+ $zgType = $order ? 2 : 1;
|
|
|
|
|
+ }
|
|
|
|
|
+ $info['zg_type'] = $zgType;
|
|
|
|
|
+
|
|
|
|
|
+ // 任务状态(与列表页保持一致)
|
|
|
|
|
+ $taskStatus = Db::name('patrol_task')->where('id', $info['patrol_task_id'])->value('status');
|
|
|
|
|
+ $statusTxt = '';
|
|
|
|
|
+ if ($taskStatus == 0) {
|
|
|
|
|
+ $statusTxt = '待完成';
|
|
|
|
|
+ } elseif ($taskStatus == 1) {
|
|
|
|
|
+ $statusTxt = '执行中';
|
|
|
|
|
+ } elseif ($taskStatus == 2) {
|
|
|
|
|
+ $statusTxt = '已完成';
|
|
|
|
|
+ } elseif ($taskStatus == 3) {
|
|
|
|
|
+ $statusTxt = '未完成';
|
|
|
|
|
+ } elseif ($taskStatus == 5) {
|
|
|
|
|
+ $statusTxt = '中断';
|
|
|
|
|
+ } elseif ($taskStatus == 6) {
|
|
|
|
|
+ $statusTxt = '已关闭';
|
|
|
|
|
+ }
|
|
|
|
|
+ $info['statusTxt'] = $statusTxt;
|
|
|
|
|
+ $info['status'] = $taskStatus;
|
|
|
|
|
+ $info['create_time'] = date('Y-m-d H:i:s', strtotime($info['create_time']));
|
|
|
|
|
+
|
|
|
|
|
+ $this->assign('info', $info);
|
|
|
|
|
+ $this->assign('title', '记录详情');
|
|
|
|
|
+ return $this->fetch();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|