|
@@ -66,6 +66,83 @@ class Index extends Apic
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
+ //大屏幕
|
|
|
|
+ public function dashboard(){
|
|
|
|
+ //左侧上面条状
|
|
|
|
+ $list = Db::name('user_company')->field('id,projectname,starttime,endtime,longitude,latitude')->where('company_id',$this->auth->company_id)->order('endtime asc')->select();
|
|
|
|
+ if(!empty($list)){
|
|
|
|
+ foreach($list as $key => $val){
|
|
|
|
+ $total_month = intval(ceil(($val['endtime'] - $val['starttime']) / 2592000)); //总月份
|
|
|
|
+ $total_month = $total_month < 0 ? 0 : $total_month;
|
|
|
|
+
|
|
|
|
+ $end_month = intval(ceil(($val['endtime'] - time()) / 2592000)); //剩余月份
|
|
|
|
+ $end_month = $end_month < 0 ? 0 : $end_month;
|
|
|
|
+
|
|
|
|
+ $bili = 100;
|
|
|
|
+ if($total_month > 0 && $total_month > $end_month){
|
|
|
|
+ $bili = bcdiv(($total_month - $end_month) * 100 , $total_month,0);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ $list[$key]['total_month'] = $total_month;
|
|
|
|
+ $list[$key]['bili'] = $bili;
|
|
|
|
+ $list[$key]['end_month'] = $end_month;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //左侧下面扇形
|
|
|
|
+ $wancheng = Db::name('maintain')->where('company_id',$this->auth->company_id)->where('status',100)->count();
|
|
|
|
+ $weiwancheng = Db::name('maintain')->where('company_id',$this->auth->company_id)->where('status',2)->count();
|
|
|
|
+ $jinxingzhong = Db::name('maintain')->where('company_id',$this->auth->company_id)->where('status','NOTIN',[2,100])->count();
|
|
|
|
+ $shanxing = [
|
|
|
|
+ ['name'=>'完成数','value'=>$wancheng,'itemStyle'=>['color'=>'#FABA26']],
|
|
|
|
+ ['name'=>'未完成数','value'=>$weiwancheng,'itemStyle'=>['color'=>'#15DB92']],
|
|
|
|
+ ['name'=>'进行中','value'=>$jinxingzhong,'itemStyle'=>['color'=>'#2AA1FF']],
|
|
|
|
+ ];
|
|
|
|
+ $shanxing_number = $wancheng + $weiwancheng + $jinxingzhong;
|
|
|
|
+
|
|
|
|
+ //中间地图
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ //中间底部
|
|
|
|
+ $maintainlist = Db::name('maintain')->field('id,DATE(FROM_UNIXTIME(createtime)) as createdate')->where('company_id',$this->auth->company_id)->whereTime('createtime','week')->select();
|
|
|
|
+ $maindate = array_column($maintainlist,'createdate');
|
|
|
|
+ $maindate = array_count_values($maindate);
|
|
|
|
+
|
|
|
|
+ $maindate = [
|
|
|
|
+ 'date' => array_keys($maindate),
|
|
|
|
+ 'value'=> array_values($maindate),
|
|
|
|
+ ];
|
|
|
|
+// dump($maindate);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ //导航
|
|
|
|
+ $menus = $this->auth->get_menus_simple();
|
|
|
|
+
|
|
|
|
+ //结果
|
|
|
|
+ $week = [
|
|
|
|
+ 1 => '星期一',
|
|
|
|
+ 2 => '星期二',
|
|
|
|
+ 3 => '星期三',
|
|
|
|
+ 4 => '星期四',
|
|
|
|
+ 5 => '星期五',
|
|
|
|
+ 6 => '星期六',
|
|
|
|
+ 0 => '星期天',
|
|
|
|
+ ];
|
|
|
|
+ $rs = [
|
|
|
|
+ 'date' => date('Y.m.d'),
|
|
|
|
+ 'week' => $week[date('w')],
|
|
|
|
+ 'time' => date('H:i:s'),
|
|
|
|
+ 'project' => $list,
|
|
|
|
+ 'shanxing' => $shanxing,
|
|
|
|
+ 'shanxing_number' => $shanxing_number,
|
|
|
|
+ 'maindate' => $maindate,
|
|
|
|
+ 'menus' => $menus,
|
|
|
|
+ ];
|
|
|
|
+
|
|
|
|
+ $this->success(1,$rs);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
|
|
/**
|
|
/**
|
|
* 退出登录
|
|
* 退出登录
|