|
@@ -12,6 +12,8 @@ namespace app\portal\controller; |
|
@@ -12,6 +12,8 @@ namespace app\portal\controller; |
12
|
use app\portal\model\EquipmentModel;
|
12
|
use app\portal\model\EquipmentModel;
|
13
|
use app\portal\model\OrderModel;
|
13
|
use app\portal\model\OrderModel;
|
14
|
use cmf\controller\AdminBaseController;
|
14
|
use cmf\controller\AdminBaseController;
|
|
|
15
|
+use think\Db;
|
|
|
16
|
+
|
15
|
/**
|
17
|
/**
|
16
|
* Class AdminAllStatisticsController
|
18
|
* Class AdminAllStatisticsController
|
17
|
* @package app\portal\controller
|
19
|
* @package app\portal\controller
|
|
@@ -36,8 +38,21 @@ class AdminAllStatisticsController extends AdminBaseController{ |
|
@@ -36,8 +38,21 @@ class AdminAllStatisticsController extends AdminBaseController{ |
36
|
->order('start_time','desc')
|
38
|
->order('start_time','desc')
|
37
|
->paginate(10)->each(function ($item){
|
39
|
->paginate(10)->each(function ($item){
|
38
|
$item['average']=round($item['sumTime']/$item['num']);
|
40
|
$item['average']=round($item['sumTime']/$item['num']);
|
|
|
41
|
+ //计费故障次数
|
|
|
42
|
+ $item['fault_time']=Db::name('fault')->where(['eq_name'=>$item['eq_name'],'fault_type'=>1])->count();
|
|
|
43
|
+ //锁故障次数
|
|
|
44
|
+ $item['fault_lock']=Db::name('fault')->where(['eq_name'=>$item['eq_name'],'fault_type'=>5])->count();
|
|
|
45
|
+ //床故障次数
|
|
|
46
|
+ $item['fault_bed']=Db::name('fault')->where(['eq_name'=>$item['eq_name'],'fault_type'=>['in',[2,3,4]]])->count();
|
|
|
47
|
+ //其他故障次数
|
|
|
48
|
+ $item['fault_other']=Db::name('fault')->where(['eq_name'=>$item['eq_name'],'fault_type'=>6])->count();
|
|
|
49
|
+ //故障总数
|
|
|
50
|
+ $item['fault']=Db::name('fault')->where(['eq_name'=>$item['eq_name']])->count();
|
39
|
return $item;
|
51
|
return $item;
|
40
|
});
|
52
|
});
|
|
|
53
|
+
|
|
|
54
|
+
|
|
|
55
|
+
|
41
|
$this->assign('data',$data);
|
56
|
$this->assign('data',$data);
|
42
|
return $this->fetch();
|
57
|
return $this->fetch();
|
43
|
}
|
58
|
}
|