|
@@ -1446,24 +1446,42 @@ class CameraApiController extends BaseController
|
|
|
//地图数据
|
|
|
public function mapData(Request $request){
|
|
|
$coal_washery = DB::connection('task_xixuan')->table('xx_coal_washery')->get();
|
|
|
+ $coal_list = [
|
|
|
+ '灵新洗煤厂'=>'linxing',
|
|
|
+ '红柳洗煤厂'=>'hongliu',
|
|
|
+ '枣泉洗煤厂'=>'zaoquan',
|
|
|
+ '大武口洗煤厂'=>'dawukou',
|
|
|
+ '金凤洗煤厂'=>'jinfeng',
|
|
|
+ '检修车间'=>'jianxiuchejian',
|
|
|
+ '太西洗煤厂'=>'taixi',
|
|
|
+ '清水营洗煤厂'=>'qingshuiying',
|
|
|
+ '梅花井洗煤厂'=>'meihuajing',
|
|
|
+ '石槽村洗煤厂'=>'shicaocun',
|
|
|
+ '双马洗煤厂'=>'shuangma',
|
|
|
+ '羊场湾洗煤厂'=>'yangchangwan',
|
|
|
+ '羊场湾二分区洗煤厂'=>'yangchangwanerfenqu'
|
|
|
+ ];
|
|
|
|
|
|
if(count($coal_washery) > 0){
|
|
|
for($i=0;$i<count($coal_washery);$i++){
|
|
|
- $result[$i]['title'] = $coal_washery[$i]->name;
|
|
|
- $result[$i]['data'] = [
|
|
|
- [
|
|
|
- 'name' => '高风险作业',
|
|
|
- 'value'=> DB::connection('task_xixuan')->table('xx_risk_assignment')->where('coal_washery_id',$coal_washery[$i]->id)->where('risk_level',0)->whereDate('optdt', today())->count()
|
|
|
- ],
|
|
|
- [
|
|
|
- 'name' => '中风险作业',
|
|
|
- 'value'=> DB::connection('task_xixuan')->table('xx_risk_assignment')->where('coal_washery_id',$coal_washery[$i]->id)->where('risk_level',1)->whereDate('optdt', today())->count()
|
|
|
- ],
|
|
|
- [
|
|
|
- 'name' => '低风险作业',
|
|
|
- 'value'=> DB::connection('task_xixuan')->table('xx_risk_assignment')->where('coal_washery_id',$coal_washery[$i]->id)->where('risk_level',2)->whereDate('optdt', today())->count()
|
|
|
- ]
|
|
|
- ];
|
|
|
+ if(array_key_exists($coal_washery[$i]->name, $coal_list)) {
|
|
|
+ $slog = $coal_list[$coal_washery[$i]->name];
|
|
|
+ $result[$slog]['title'] = $coal_washery[$i]->name;
|
|
|
+ $result[$slog]['data'] = [
|
|
|
+ [
|
|
|
+ 'name' => '高风险作业',
|
|
|
+ 'value'=> DB::connection('task_xixuan')->table('xx_risk_assignment')->where('coal_washery_id',$coal_washery[$i]->id)->where('risk_level',0)->whereDate('optdt', today())->count()
|
|
|
+ ],
|
|
|
+ [
|
|
|
+ 'name' => '中风险作业',
|
|
|
+ 'value'=> DB::connection('task_xixuan')->table('xx_risk_assignment')->where('coal_washery_id',$coal_washery[$i]->id)->where('risk_level',1)->whereDate('optdt', today())->count()
|
|
|
+ ],
|
|
|
+ [
|
|
|
+ 'name' => '低风险作业',
|
|
|
+ 'value'=> DB::connection('task_xixuan')->table('xx_risk_assignment')->where('coal_washery_id',$coal_washery[$i]->id)->where('risk_level',2)->whereDate('optdt', today())->count()
|
|
|
+ ]
|
|
|
+ ];
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1568,13 +1586,13 @@ class CameraApiController extends BaseController
|
|
|
'number' => DB::connection('task_xixuan')->table('xx_risk_assignment')->whereIn('coal_washery_id',$coal_washery_id_list)->whereDate('optdt', date('Y-m-d'))->where('risk_level',1)->count(),
|
|
|
'unit' => '项',
|
|
|
'title' => '中风险作业',
|
|
|
- 'color' => '#DA0000'
|
|
|
+ 'color' => '#FFBA00'
|
|
|
],
|
|
|
[
|
|
|
'number' => DB::connection('task_xixuan')->table('xx_risk_assignment')->whereIn('coal_washery_id',$coal_washery_id_list)->whereDate('optdt', date('Y-m-d'))->where('risk_level',2)->count(),
|
|
|
'unit' => '项',
|
|
|
'title' => '低风险作业',
|
|
|
- 'color' => '#DA0000'
|
|
|
+ 'color' => '#2BB200'
|
|
|
]
|
|
|
];
|
|
|
|
|
@@ -1637,12 +1655,12 @@ class CameraApiController extends BaseController
|
|
|
[
|
|
|
'label' => '中',
|
|
|
'value' => DB::connection('task_xixuan')->table('xx_risk_assignment')->where('coal_washery_id',$coal_washery[$i]->id)->where('risk_level',1)->whereDate('optdt', today())->count(),
|
|
|
- 'color' => '#DA0000'
|
|
|
+ 'color' => '#FFBA00'
|
|
|
],
|
|
|
[
|
|
|
'label' => '低',
|
|
|
'value' => DB::connection('task_xixuan')->table('xx_risk_assignment')->where('coal_washery_id',$coal_washery[$i]->id)->where('risk_level',2)->whereDate('optdt', today())->count(),
|
|
|
- 'color' => '#DA0000'
|
|
|
+ 'color' => '#2BB200'
|
|
|
],
|
|
|
];
|
|
|
}
|