|
@@ -100,6 +100,196 @@ class Index extends Auth
|
|
|
|
|
|
$this->assign('orderNums',$endCount);
|
|
|
|
|
|
+
|
|
|
+ //今日看板
|
|
|
+ $dayOrderNums1 = Db::name('orders')
|
|
|
+ ->where('org_id',$this->orgId)
|
|
|
+ ->where('del',0)
|
|
|
+ ->where('order_mode',1)
|
|
|
+ ->where('create_time','>=',date('Y-m-d').' 00:00:00')
|
|
|
+ ->where('create_time','<=',date('Y-m-d').' 23:59:59')
|
|
|
+ ->count();
|
|
|
+ $dayOrderNums2 = Db::name('orders')
|
|
|
+ ->where('org_id',$this->orgId)
|
|
|
+ ->where('del',0)
|
|
|
+ ->where('order_mode',4)
|
|
|
+ ->where('create_time','>=',date('Y-m-d').' 00:00:00')
|
|
|
+ ->where('create_time','<=',date('Y-m-d').' 23:59:59')
|
|
|
+ ->count();
|
|
|
+ $dayOrderNums3 = Db::name('orders')
|
|
|
+ ->where('org_id',$this->orgId)
|
|
|
+ ->where('del',0)
|
|
|
+ ->where('order_mode',5)
|
|
|
+ ->where('create_time','>=',date('Y-m-d').' 00:00:00')
|
|
|
+ ->where('create_time','<=',date('Y-m-d').' 23:59:59')
|
|
|
+ ->count();
|
|
|
+ $dayOrderNums4 = Db::name('orders')
|
|
|
+ ->where('org_id',$this->orgId)
|
|
|
+ ->where('del',0)
|
|
|
+ ->where('order_mode',6)
|
|
|
+ ->where('create_time','>=',date('Y-m-d').' 00:00:00')
|
|
|
+ ->where('create_time','<=',date('Y-m-d').' 23:59:59')
|
|
|
+ ->count();
|
|
|
+ $dayOrderNums5 = Db::name('orders')
|
|
|
+ ->where('org_id',$this->orgId)
|
|
|
+ ->where('del',0)
|
|
|
+ ->where('order_mode',2)
|
|
|
+ ->where('create_time','>=',date('Y-m-d').' 00:00:00')
|
|
|
+ ->where('create_time','<=',date('Y-m-d').' 23:59:59')
|
|
|
+ ->count();
|
|
|
+ $dayOrderNums6 = Db::name('orders')
|
|
|
+ ->where('org_id',$this->orgId)
|
|
|
+ ->where('del',0)
|
|
|
+ ->where('order_mode',3)
|
|
|
+ ->where('create_time','>=',date('Y-m-d').' 00:00:00')
|
|
|
+ ->where('create_time','<=',date('Y-m-d').' 23:59:59')
|
|
|
+ ->count();
|
|
|
+ $dayOrderCount =[
|
|
|
+ 'count1'=> $dayOrderNums1,
|
|
|
+ 'count2'=> $dayOrderNums2,
|
|
|
+ 'count3'=> $dayOrderNums3,
|
|
|
+ 'count4'=> $dayOrderNums4,
|
|
|
+ 'count5'=> $dayOrderNums5,
|
|
|
+ 'count6'=> $dayOrderNums6,
|
|
|
+ ];
|
|
|
+ $this->assign('dayOrderCount',$dayOrderCount);
|
|
|
+
|
|
|
+ $notice = Db::name('notice')
|
|
|
+ ->where('org_id',$this->orgId)
|
|
|
+ ->where('del',0)
|
|
|
+ ->where('user_id',$this->userId)
|
|
|
+ ->field('id,title,create_time')
|
|
|
+ ->order('id desc')
|
|
|
+ ->limit(2)
|
|
|
+ ->select();
|
|
|
+ $this->assign('notice',$notice);
|
|
|
+
|
|
|
+ //常用模块
|
|
|
+ $module = Db::name('user_menu')->where('user_id',$this->userId)->order('count desc')->select();
|
|
|
+ $id = 500;
|
|
|
+ $menus = model('Menu')->getMenuTree($this->rolesId,$this->orgId);
|
|
|
+ $submenus = [];
|
|
|
+ foreach ($menus as $k=>$v){
|
|
|
+ if($v['id'] == $id){
|
|
|
+ $submenus = $v['child'];
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $lists11 = [];
|
|
|
+ foreach ($submenus as $k=>$v){
|
|
|
+// if(!$v['url']){
|
|
|
+// $v['url'] = url('Index/submenu',['id'=>$v['id'],'t'=>1]);
|
|
|
+// }
|
|
|
+ $lists11[] = $v;
|
|
|
+ }
|
|
|
+
|
|
|
+ $limit = 8;
|
|
|
+ $modules = [];
|
|
|
+ foreach ($module as $k=>$v){
|
|
|
+ foreach ($lists11 as $kk=>$vv){
|
|
|
+ if(count($modules) == $limit){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if($vv['id'] == $v['menu_id']){
|
|
|
+ $v['title'] = $vv['title'];
|
|
|
+ $v['url'] = $vv['url'];
|
|
|
+ $v['img'] = $vv['img'];
|
|
|
+ $modules[] = $v;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ $this->assign('module',$modules);
|
|
|
+
|
|
|
+ $threeMenu = model('Menu')->getMenuTree1($this->rolesId,$this->orgId,'');
|
|
|
+ $userEndMenu = [];
|
|
|
+ foreach ($threeMenu as $k=>$v){
|
|
|
+ if($v['url']){
|
|
|
+ $userEndMenu[] = $v;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ $this->assign('userEndMenu',$userEndMenu);
|
|
|
+
|
|
|
+ $authMenuIds = array_column($threeMenu,'id');
|
|
|
+
|
|
|
+ //固定模块
|
|
|
+ $fixedModule = Db::name('menu')
|
|
|
+ ->where('id',500)
|
|
|
+ ->where('del',0)
|
|
|
+ ->find();
|
|
|
+
|
|
|
+
|
|
|
+ $fixedModule1 = Db::name('menu')
|
|
|
+ ->where('id',1)
|
|
|
+ ->where('del',0)
|
|
|
+ ->find();
|
|
|
+
|
|
|
+ $fixedModule2 = Db::name('menu')
|
|
|
+ ->where('id',144)
|
|
|
+ ->where('del',0)
|
|
|
+ ->find();
|
|
|
+
|
|
|
+ $fixedModule3 = Db::name('menu')
|
|
|
+ ->where('id',163)
|
|
|
+ ->where('del',0)
|
|
|
+ ->find();
|
|
|
+
|
|
|
+ $fixedModule4 = Db::name('menu')
|
|
|
+ ->where('id',28)
|
|
|
+ ->where('del',0)
|
|
|
+ ->find();
|
|
|
+ $fixedModuleAuth = $fixedModuleAuth1 = $fixedModuleAuth2 = $fixedModuleAuth3 = $fixedModuleAuth4 = 0 ;
|
|
|
+ if(in_array($fixedModule['id'],$authMenuIds)){
|
|
|
+ $fixedModuleAuth = 1 ;
|
|
|
+ }
|
|
|
+ if(in_array($fixedModule1['id'],$authMenuIds)){
|
|
|
+ $fixedModuleAuth1 = 1 ;
|
|
|
+ }
|
|
|
+ if(in_array($fixedModule2['id'],$authMenuIds)){
|
|
|
+ $fixedModuleAuth2 = 1 ;
|
|
|
+ }
|
|
|
+ if(in_array($fixedModule3['id'],$authMenuIds)){
|
|
|
+ $fixedModuleAuth3 = 1 ;
|
|
|
+ }
|
|
|
+ if(in_array($fixedModule4['id'],$authMenuIds)){
|
|
|
+ $fixedModuleAuth4 = 1 ;
|
|
|
+ }
|
|
|
+
|
|
|
+ $this->assign('fixedModule',$fixedModule);
|
|
|
+ $this->assign('fixedModule1',$fixedModule1);
|
|
|
+ $this->assign('fixedModule2',$fixedModule2);
|
|
|
+ $this->assign('fixedModule3',$fixedModule3);
|
|
|
+ $this->assign('fixedModule4',$fixedModule4);
|
|
|
+
|
|
|
+ $this->assign('fixedModuleAuth',$fixedModuleAuth);
|
|
|
+ $this->assign('fixedModuleAuth1',$fixedModuleAuth1);
|
|
|
+ $this->assign('fixedModuleAuth2',$fixedModuleAuth2);
|
|
|
+ $this->assign('fixedModuleAuth3',$fixedModuleAuth3);
|
|
|
+ $this->assign('fixedModuleAuth4',$fixedModuleAuth4);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ // APP下载二维码
|
|
|
+ $download = think_encrypt(url('h5/Index/download','',true,true));
|
|
|
+ $this->assign('download',$download);
|
|
|
+ // 小程序二维码
|
|
|
+ $wxcode = Db::name('org')->where('id',$this->orgId)->value('wxqrcode');
|
|
|
+ $this->assign('wxcode',$wxcode);
|
|
|
+ // 陪护h5
|
|
|
+ $phcode = think_encrypt(config('app.ph_url').'?orgId='.$this->orgId);
|
|
|
+ $this->assign('phcode',$phcode);
|
|
|
+ // 点餐h5
|
|
|
+ $shopcode = think_encrypt(config('app.shop_url').'?orgId='.$this->orgId);
|
|
|
+ $this->assign('shopcode',$shopcode);
|
|
|
+
|
|
|
+ // 商城h5
|
|
|
+ $xshopcode = think_encrypt(config('app.xshop_url').'?orgId='.$this->orgId);
|
|
|
+ $this->assign('xshopcode',$xshopcode);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
return $this->fetch();
|
|
|
}
|
|
|
|
|
@@ -184,277 +374,90 @@ class Index extends Auth
|
|
|
}
|
|
|
|
|
|
public function def(){
|
|
|
- // APP下载二维码
|
|
|
- $download = think_encrypt(url('h5/Index/download','',true,true));
|
|
|
- $this->assign('download',$download);
|
|
|
- // 小程序二维码
|
|
|
- $wxcode = Db::name('org')->where('id',$this->orgId)->value('wxqrcode');
|
|
|
- $this->assign('wxcode',$wxcode);
|
|
|
- // 陪护h5
|
|
|
- $phcode = think_encrypt(config('app.ph_url').'?orgId='.$this->orgId);
|
|
|
- $this->assign('phcode',$phcode);
|
|
|
- // 点餐h5
|
|
|
- $shopcode = think_encrypt(config('app.shop_url').'?orgId='.$this->orgId);
|
|
|
- $this->assign('shopcode',$shopcode);
|
|
|
-
|
|
|
- // 商城h5
|
|
|
- $xshopcode = think_encrypt(config('app.xshop_url').'?orgId='.$this->orgId);
|
|
|
- $this->assign('xshopcode',$xshopcode);
|
|
|
-
|
|
|
- //本月
|
|
|
- $month = date('Y-m');
|
|
|
- $sMonth = $month.'-1 00:00:00';
|
|
|
- $eMonth = $month.'31 23:59:59';
|
|
|
-
|
|
|
- //上月
|
|
|
- $tmp_year=substr($month,0,4);
|
|
|
- //切割出月份
|
|
|
- $tmp_mon =substr($month,5,2);
|
|
|
-
|
|
|
- $tmp_forwardmonth=mktime(0,0,0,$tmp_mon-1,1,$tmp_year);
|
|
|
- $lastMonth=date("Y-m",$tmp_forwardmonth);
|
|
|
-
|
|
|
- $sLastMonth = $lastMonth.'-1 00:00:00';
|
|
|
- $eLastMonth = $lastMonth.'31 23:59:59';
|
|
|
-
|
|
|
- $userNums = Db::name('user')
|
|
|
- ->alias('u')
|
|
|
- ->join('user_org uo','uo.user_id=u.id')
|
|
|
- ->where('uo.org_id',$this->orgId)
|
|
|
- ->where('u.del',0)
|
|
|
- ->where('u.enable',1)
|
|
|
- ->count();
|
|
|
-
|
|
|
- $monthUserNums = Db::name('user')
|
|
|
- ->alias('u')
|
|
|
- ->join('user_org uo','uo.user_id=u.id')
|
|
|
- ->where('uo.org_id',$this->orgId)
|
|
|
- ->where('u.del',0)
|
|
|
- ->where('u.enable',1)
|
|
|
- ->where('u.create_time','>=',$sMonth)
|
|
|
- ->where('u.create_time','<=',$eMonth)
|
|
|
- ->count();
|
|
|
- $lastMonthUserNums = Db::name('user')
|
|
|
- ->alias('u')
|
|
|
- ->join('user_org uo','uo.user_id=u.id')
|
|
|
- ->where('uo.org_id',$this->orgId)
|
|
|
- ->where('u.del',0)
|
|
|
- ->where('u.enable',1)
|
|
|
- ->where('u.create_time','>=',$sLastMonth)
|
|
|
- ->where('u.create_time','<=',$eLastMonth)
|
|
|
- ->count();
|
|
|
-
|
|
|
- $userLastNums = $monthUserNums-$lastMonthUserNums;
|
|
|
- $userCount = [
|
|
|
- 'userNums'=>$userNums,
|
|
|
- 'userLastNums'=>$userLastNums,
|
|
|
- ];
|
|
|
- $this->assign('userCount',$userCount);
|
|
|
-
|
|
|
- $monthOrderNums = Db::name('orders')
|
|
|
- ->where('org_id',$this->orgId)
|
|
|
- ->where('create_yyyymm',date('Ym'))
|
|
|
- ->where('del',0)
|
|
|
- ->count();
|
|
|
- $lastMonthOrderNums = Db::name('orders')
|
|
|
- ->where('org_id',$this->orgId)
|
|
|
- ->where('create_yyyymm',date('Ym',strtotime('-1 month')))
|
|
|
- ->where('del',0)
|
|
|
- ->count();
|
|
|
- $orderLastNums = $monthOrderNums -$lastMonthOrderNums;
|
|
|
- $orderCount = [
|
|
|
- 'orderNums'=>$monthOrderNums,
|
|
|
- 'orderLastNums'=>$orderLastNums,
|
|
|
- ];
|
|
|
- $this->assign('orderCount',$orderCount);
|
|
|
-
|
|
|
- $yearOrderNums = Db::name('orders')
|
|
|
- ->where('org_id',$this->orgId)
|
|
|
- ->where('create_yyyy',date('Y'))
|
|
|
- ->where('del',0)
|
|
|
- ->count();
|
|
|
- $lastYearOrderNums = Db::name('orders')
|
|
|
- ->where('org_id',$this->orgId)
|
|
|
- ->where('create_yyyy',date('Y',strtotime('-1 year')))
|
|
|
- ->where('del',0)
|
|
|
- ->count();
|
|
|
- $endYearOrderCount = $yearOrderNums - $lastYearOrderNums;
|
|
|
- if($lastYearOrderNums < 1){
|
|
|
- $orderLastYearNums = 100;
|
|
|
- }else{
|
|
|
- $orderLastYearNums = round($endYearOrderCount/$lastYearOrderNums,2)*100;
|
|
|
+ $id = 500;
|
|
|
+ $menus = model('Menu')->getMenuTree($this->rolesId,$this->orgId);
|
|
|
+ $submenus = [];
|
|
|
+ foreach ($menus as $k=>$v){
|
|
|
+ if($v['id'] == $id){
|
|
|
+ $submenus = $v['child'];
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
- $orderYearCount = [
|
|
|
- 'orderYearNums'=>$yearOrderNums,
|
|
|
- 'orderLastYearNums'=>$orderLastYearNums,
|
|
|
- ];
|
|
|
- $this->assign('orderYearCount',$orderYearCount);
|
|
|
-
|
|
|
- $activeUserNums = Db::name('user')
|
|
|
- ->alias('u')
|
|
|
- ->join('user_org uo','uo.user_id=u.id')
|
|
|
- ->where('uo.org_id',$this->orgId)
|
|
|
- ->where('u.del',0)
|
|
|
- ->where('u.enable',1)
|
|
|
- ->where('u.last_login_time','>=',$sMonth)
|
|
|
- ->where('u.last_login_time','<=',$eMonth)
|
|
|
- ->count();
|
|
|
- $lastActiveUserNums = Db::name('user')
|
|
|
- ->alias('u')
|
|
|
- ->join('user_org uo','uo.user_id=u.id')
|
|
|
- ->where('uo.org_id',$this->orgId)
|
|
|
- ->where('u.del',0)
|
|
|
- ->where('u.enable',1)
|
|
|
- ->where('u.last_login_time','>=',$sLastMonth)
|
|
|
- ->where('u.last_login_time','<=',$eLastMonth)
|
|
|
- ->count();
|
|
|
- $activeUserLastNums = $activeUserNums-$lastActiveUserNums;
|
|
|
- $activeUserCount = [
|
|
|
- 'activeUserNums'=>$activeUserNums,
|
|
|
- 'activeUserLastNums'=>$activeUserLastNums,
|
|
|
- ];
|
|
|
- $this->assign('activeUserCount',$activeUserCount);
|
|
|
-
|
|
|
- $dayOrderNums1 = Db::name('orders')
|
|
|
- ->where('org_id',$this->orgId)
|
|
|
- ->where('del',0)
|
|
|
- ->where('order_mode',1)
|
|
|
- ->where('create_time','>=',date('Y-m-d').' 00:00:00')
|
|
|
- ->where('create_time','<=',date('Y-m-d').' 23:59:59')
|
|
|
- ->count();
|
|
|
- $dayOrderNums2 = Db::name('orders')
|
|
|
- ->where('org_id',$this->orgId)
|
|
|
- ->where('del',0)
|
|
|
- ->where('order_mode',4)
|
|
|
- ->where('create_time','>=',date('Y-m-d').' 00:00:00')
|
|
|
- ->where('create_time','<=',date('Y-m-d').' 23:59:59')
|
|
|
- ->count();
|
|
|
- $dayOrderNums3 = Db::name('orders')
|
|
|
- ->where('org_id',$this->orgId)
|
|
|
- ->where('del',0)
|
|
|
- ->where('order_mode',5)
|
|
|
- ->where('create_time','>=',date('Y-m-d').' 00:00:00')
|
|
|
- ->where('create_time','<=',date('Y-m-d').' 23:59:59')
|
|
|
- ->count();
|
|
|
- $dayOrderNums4 = Db::name('orders')
|
|
|
- ->where('org_id',$this->orgId)
|
|
|
- ->where('del',0)
|
|
|
- ->where('order_mode',6)
|
|
|
- ->where('create_time','>=',date('Y-m-d').' 00:00:00')
|
|
|
- ->where('create_time','<=',date('Y-m-d').' 23:59:59')
|
|
|
- ->count();
|
|
|
- $dayOrderNums5 = Db::name('orders')
|
|
|
- ->where('org_id',$this->orgId)
|
|
|
- ->where('del',0)
|
|
|
- ->where('order_mode',2)
|
|
|
- ->where('create_time','>=',date('Y-m-d').' 00:00:00')
|
|
|
- ->where('create_time','<=',date('Y-m-d').' 23:59:59')
|
|
|
- ->count();
|
|
|
- $dayOrderNums6 = Db::name('orders')
|
|
|
- ->where('org_id',$this->orgId)
|
|
|
- ->where('del',0)
|
|
|
- ->where('order_mode',3)
|
|
|
- ->where('create_time','>=',date('Y-m-d').' 00:00:00')
|
|
|
- ->where('create_time','<=',date('Y-m-d').' 23:59:59')
|
|
|
- ->count();
|
|
|
- $dayOrderCount =[
|
|
|
- 'count1'=> $dayOrderNums1,
|
|
|
- 'count2'=> $dayOrderNums2,
|
|
|
- 'count3'=> $dayOrderNums3,
|
|
|
- 'count4'=> $dayOrderNums4,
|
|
|
- 'count5'=> $dayOrderNums5,
|
|
|
- 'count6'=> $dayOrderNums6,
|
|
|
- ];
|
|
|
- $this->assign('dayOrderCount',$dayOrderCount);
|
|
|
-
|
|
|
- $mode = input('mode',1);
|
|
|
- $todoList = Db::name('todo')
|
|
|
- ->where('org_id',$this->orgId)
|
|
|
- ->where('del',0)
|
|
|
- ->where('work_type_mode',$mode)
|
|
|
- ->limit(11)
|
|
|
- ->order('id desc')
|
|
|
- ->select();
|
|
|
- foreach ($todoList as $k=>$v){
|
|
|
- $todoList[$k]['user_name'] = Db::name('user')->where('id',$v['to_user_id'])->value('real_name');
|
|
|
- $todoList[$k]['create_user_name'] = Db::name('user')->where('id',$v['create_user_id'])->value('real_name');
|
|
|
- $todoList[$k]['content'] = Db::name('orders')->where('id',$v['order_id'])->value('content');
|
|
|
+ $lists = [];
|
|
|
+ foreach ($submenus as $k=>$v){
|
|
|
+ if(!$v['url']){
|
|
|
+// $v['url'] = url('Index/indexsub',['id'=>$v['id'],'t'=>1]);
|
|
|
+ }
|
|
|
+ $lists[] = $v;
|
|
|
}
|
|
|
+ $this->assign('lists',$lists);
|
|
|
|
|
|
- $this->assign('mode',$mode);
|
|
|
- $this->assign('todoList',$todoList);
|
|
|
-
|
|
|
- $group = Db::name('attendance_group')
|
|
|
- ->where('del',0)
|
|
|
- ->where('org_id',$this->orgId)
|
|
|
+ // 获取常用模块
|
|
|
+ $cys = Db::name('user_menu')
|
|
|
+ ->where('user_id',$this->userId)
|
|
|
+ ->order('count desc,id asc')
|
|
|
->select();
|
|
|
|
|
|
- $groupsId = [];
|
|
|
- $groupsId2 = [];
|
|
|
- $week = date('w');
|
|
|
- foreach ($group as $k=>$v){
|
|
|
- $content = json_decode($v['content'],true);
|
|
|
- if($v['type'] == 1){
|
|
|
- foreach ($content['week'] as $kk=>$vv){
|
|
|
- if($vv['week'] == $week && $vv['class_id'] > 0){
|
|
|
- $groupsId[] = $v['id'];
|
|
|
- }
|
|
|
+ $cys = $cys?$cys:[];
|
|
|
+ $ncys = [];
|
|
|
+ foreach ($cys as $k=>$v){
|
|
|
+ foreach ($lists as $kk=>$vv){
|
|
|
+ if(count($ncys) == 5){
|
|
|
+ continue;
|
|
|
}
|
|
|
- }
|
|
|
- if($v['type'] == 2){
|
|
|
- $groupClass = Db::name('attendance_group_class')
|
|
|
- ->where('group_id',$v['id'])
|
|
|
- ->where('org_id',$this->orgId)
|
|
|
- ->where('day',date('Y-m-d'))
|
|
|
- ->find();
|
|
|
- if($groupClass){
|
|
|
- $groupsId2[] = $v['id'];
|
|
|
+ if($vv['id'] == $v['menu_id']){
|
|
|
+ $v['title'] = $vv['title'];
|
|
|
+ $v['url'] = $vv['url'];
|
|
|
+ $v['img'] = $vv['img'];
|
|
|
+ $ncys[] = $v;
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- $endGroupIds = array_unique(array_merge($groupsId,$groupsId2));
|
|
|
- $userCount = Db::name('attendance_group_user')
|
|
|
- ->where('org_id',$this->orgId)
|
|
|
- ->whereIn('group_id',$endGroupIds)
|
|
|
- ->count();
|
|
|
- $userIds = Db::name('attendance_group_user')
|
|
|
- ->where('org_id',$this->orgId)
|
|
|
- ->whereIn('group_id',$endGroupIds)
|
|
|
- ->column('user_id');
|
|
|
- $attendanceNums = 0;
|
|
|
- foreach ($userIds as $k=>$v){
|
|
|
- $attendanceRecord = Db::name('attendance_record')
|
|
|
- ->where('user_id',$v)
|
|
|
- ->where('org_id',$this->orgId)
|
|
|
-// ->where('status',1)
|
|
|
- ->where('create_time','>=',date('Y-m-d').' 00:00:00')
|
|
|
- ->where('create_time','<=',date('Y-m-d').' 23:59:59')
|
|
|
- ->select();
|
|
|
- $flag = 0;
|
|
|
- if($attendanceRecord){
|
|
|
- foreach ($attendanceRecord as $kk=>$vv){
|
|
|
- if($vv['status'] == 1){
|
|
|
-
|
|
|
- }else{
|
|
|
- $flag = 1;
|
|
|
+ $this->assign('cys',$ncys);
|
|
|
+
|
|
|
+ // 自定义模块
|
|
|
+ $usermenus = Db::name('user_menu_group')->where('user_id',$this->userId)->order('sort asc,id asc')->select();
|
|
|
+
|
|
|
+ $usermenus = $usermenus?$usermenus:[];
|
|
|
+
|
|
|
+ $groupMenuList = $usermenus;
|
|
|
+ $allmenus = [];
|
|
|
+ foreach ($usermenus as $k=>$v){
|
|
|
+ $menus = [];
|
|
|
+ if($v['menus']){
|
|
|
+ $menuids = explode(',',$v['menus']);
|
|
|
+ $allmenus = array_merge($allmenus,$menuids);
|
|
|
+ foreach ($lists as $kk=>$vv){
|
|
|
+ if(in_array($vv['id'],$menuids)){
|
|
|
+ $menus[] = $vv;
|
|
|
}
|
|
|
}
|
|
|
- if($flag == 0){
|
|
|
- $attendanceNums +=1;
|
|
|
- }
|
|
|
}
|
|
|
-
|
|
|
+ $usermenus[$k]['menus'] = $menus;
|
|
|
}
|
|
|
- $attendanceNums3 = $userCount-$attendanceNums;
|
|
|
- $attendanceCount1 = [
|
|
|
- 'count1' => $userCount, //总人数
|
|
|
- 'count2' => $attendanceNums, //在职人数
|
|
|
- 'count3' => $attendanceNums3>0?$attendanceNums3:0, //缺勤人数
|
|
|
- 'bl' => $userCount>0?round($attendanceNums/$userCount,2)*100:0,
|
|
|
- 'bl2' => $userCount>0?round($attendanceNums3/$userCount,2)*100:0,
|
|
|
+ $menus = [];
|
|
|
+ foreach ($lists as $kk=>$vv){
|
|
|
+ if(!$allmenus || !in_array($vv['id'],$allmenus)){
|
|
|
+ $menus[] = $vv;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ $usermenus[] = [
|
|
|
+ 'id' => 0,
|
|
|
+ 'title' => '综合模块',
|
|
|
+ 'menus' => $menus
|
|
|
];
|
|
|
|
|
|
- $this->assign('attendanceCount1',$attendanceCount1);
|
|
|
+
|
|
|
+
|
|
|
+ $arr[] = [
|
|
|
+ 'id'=>0,
|
|
|
+ 'title'=>'综合模块',
|
|
|
+ ];
|
|
|
+
|
|
|
+ $this->assign('usermenusgroup',array_merge($arr,$groupMenuList));
|
|
|
+ $this->assign('usermenus',$usermenus);
|
|
|
|
|
|
|
|
|
|
|
@@ -1190,6 +1193,166 @@ class Index extends Auth
|
|
|
|
|
|
return $this->fetch();
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ public function searchMenu(){
|
|
|
+ $menuName = input('menu_name');
|
|
|
+ $list = model('Menu')->getMenuTree1($this->rolesId,$this->orgId,$menuName);
|
|
|
+
|
|
|
+ $tlist = [];
|
|
|
+ foreach ($list as $k=>$v){
|
|
|
+ if($v['url']){
|
|
|
+ $tlist[] = $v;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ $this->success('','',$tlist);
|
|
|
+ }
|
|
|
+ public function indexsub(){
|
|
|
+
|
|
|
+ $userInfo = Db::name('user')
|
|
|
+ ->where('id',$this->userId)
|
|
|
+ ->find();
|
|
|
+ $this->assign('userInfo',$userInfo);
|
|
|
+
|
|
|
+
|
|
|
+ $menus = model('Menu')->getMenuTree($this->rolesId,$this->orgId);
|
|
|
+ $this->assign('menus',$menus);
|
|
|
+ $userInfo = Db::name('user')
|
|
|
+ ->where('id',$this->userId)
|
|
|
+ ->find();
|
|
|
+ $this->assign('userInfo',$userInfo);
|
|
|
+
|
|
|
+ // 判断用户是否是调度
|
|
|
+ $isDispatch = 0;
|
|
|
+ if(check_is_dispatch($this->userId) || check_two_dispatch($this->userId)){
|
|
|
+ $isDispatch = 1;
|
|
|
+ }
|
|
|
+ $this->assign('isDispatch',$isDispatch);
|
|
|
+
|
|
|
+ $order = 0;
|
|
|
+ // 判断用户是否是调度
|
|
|
+ $level1 = check_is_dispatch($this->userId);
|
|
|
+ $level2 = check_two_dispatch($this->userId);
|
|
|
+ $level2onoff = two_dispatch_off($this->orgId);
|
|
|
+ if(!$level1 && !$level2){
|
|
|
+ $order = -1;
|
|
|
+ }else{
|
|
|
+ // 一级调度
|
|
|
+ if($level1 || (!$level2onoff && $level2)){
|
|
|
+ $map[] = ['org_id','=',$this->orgId];
|
|
|
+ $map[] = ['del','=',0];
|
|
|
+ $map[] = ['order_mode','=',1];
|
|
|
+ if($level2onoff){
|
|
|
+ $map[] = ['is_deal','=',0];
|
|
|
+ }
|
|
|
+ if(!is_admin($this->userId)){
|
|
|
+ $auth = get_dispatch_auth($this->userId);
|
|
|
+ if($auth){
|
|
|
+ $map[] = ['work_type_mode', 'in', $auth];
|
|
|
+ $where[] = ['o.work_type_mode', 'in', $auth];
|
|
|
+ }else{
|
|
|
+ $map[] = ['work_type_mode', '=', -1];
|
|
|
+ $where[] = ['o.work_type_mode', '=', -1];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $order = Db::name('orders')->where($map)->count();
|
|
|
+
|
|
|
+ //$驳回的订单
|
|
|
+ $where[] = ['o.del','=',0];
|
|
|
+ $where[] = ['t.del','=',0];
|
|
|
+ $bh = Db::name('orders')
|
|
|
+ ->alias('o')
|
|
|
+ ->join('todo t','t.order_id=o.id')
|
|
|
+ ->where('t.todo_mode',4)
|
|
|
+ ->where('t.org_id',$this->orgId)
|
|
|
+ ->where('o.order_mode',4)
|
|
|
+ ->where('o.org_id',$this->orgId)
|
|
|
+ ->where($where)
|
|
|
+ ->group('o.id')
|
|
|
+ ->count();
|
|
|
+
|
|
|
+ $order = $order + $bh;
|
|
|
+
|
|
|
+ } else if($level2 && $level2onoff) { // 二级调度
|
|
|
+ $rolesId = Db::name('user_roles')->where('user_id',$this->userId)->value('roles_id');
|
|
|
+ if(!$rolesId){
|
|
|
+ $order = 0;
|
|
|
+ }else{
|
|
|
+ $map[] = ['b.org_id','=',$this->orgId];
|
|
|
+ $map[] = ['b.del','=',0];
|
|
|
+ $map[] = ['b.order_mode','=',1];
|
|
|
+ $map[] = ['b.is_deal','=',1];
|
|
|
+ $map[] = ['a.roles_id','=',$rolesId];
|
|
|
+ if(!is_admin($this->userId)){
|
|
|
+ $auth = get_dispatch_auth($this->userId);
|
|
|
+ if($auth){
|
|
|
+ $map[] = ['b.work_type_mode', 'in', $auth];
|
|
|
+ }else{
|
|
|
+ $map[] = ['b.work_type_mode', '=', -1];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $order = Db::name('dispatch_log')
|
|
|
+ ->alias('a')
|
|
|
+ ->join('orders b','b.id = a.order_id')
|
|
|
+ ->where($map)
|
|
|
+ ->field('a.*')
|
|
|
+ ->count();
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $complainCount = Db::name('complain')->where('del',0)->where('org_id',$this->orgId)->where('status',0)->where('order_id',0)->count();
|
|
|
+ $hiddendangerCount = Db::name('hiddendanger')->where('del',0)->where('org_id',$this->orgId)->where('status',0)->where('order_id',0)->count();
|
|
|
+ $endCount = $order+$complainCount+$hiddendangerCount;
|
|
|
+
|
|
|
+ $this->assign('orderNums',$endCount);
|
|
|
+
|
|
|
+
|
|
|
+ return $this->fetch();
|
|
|
+ }
|
|
|
+
|
|
|
+ public function menugroup($id = 0){
|
|
|
+ if(request()->isPost()){
|
|
|
+ $res = model('UserMenuGroup')->updates($this->userId);
|
|
|
+ if($res){
|
|
|
+ $this->success('操作成功');
|
|
|
+ }else{
|
|
|
+ $this->error(model('UserMenuGroup')->getError());
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ if($id){
|
|
|
+ $info = db('user_menu_group')->where('id',$id)->find();
|
|
|
+ if($info){
|
|
|
+ $info['menus'] = $info['menus']?explode(',',$info['menus']):[];
|
|
|
+ }
|
|
|
+ $this->assign('info',$info);
|
|
|
+ }
|
|
|
+
|
|
|
+ $id = 500;
|
|
|
+ $menus = model('Menu')->getMenuTree($this->rolesId,$this->orgId);
|
|
|
+ $submenus = [];
|
|
|
+ foreach ($menus as $k=>$v){
|
|
|
+ if($v['id'] == $id){
|
|
|
+ $submenus = $v['child'];
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $this->assign('submenus',$submenus);
|
|
|
+ return $this->fetch();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public function menugroupdel(){
|
|
|
+ $id = input('id',0);
|
|
|
+ $ret = Db::name('user_menu_group')->where('id',$id)->where('user_id',$this->userId)->delete();
|
|
|
+ if($ret){
|
|
|
+ $this->success('操作成功');
|
|
|
+ }else{
|
|
|
+ $this->error('操作失败');
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|