diff --git a/app/Admin/Actions/Exporter/ReportCommunity.php b/app/Admin/Actions/Exporter/ReportCommunity.php index 589c9a3..8fbf4b7 100644 --- a/app/Admin/Actions/Exporter/ReportCommunity.php +++ b/app/Admin/Actions/Exporter/ReportCommunity.php @@ -67,6 +67,9 @@ class ReportCommunity implements FromArray, WithStrictNullComparison, ShouldAuto '平台新增用户线上订单数' ]]; $data = $this->getData($this->params); + if(!isset($data['data']) ){ + $data['data'] = []; + } $markets = MarketModel::getMarketArray(); foreach ($data['data'] as $value){ @@ -96,7 +99,7 @@ class ReportCommunity implements FromArray, WithStrictNullComparison, ShouldAuto $repository = new ReportCommunityRepository(); $selects = 'id,user_id,market_id,name'; $data = $repository->getDataModel($selects,$params,false); - + return $data; } diff --git a/app/Admin/Actions/Grid/v3/DataReportOption.php b/app/Admin/Actions/Grid/v3/DataReportOption.php index 36f7253..9076084 100644 --- a/app/Admin/Actions/Grid/v3/DataReportOption.php +++ b/app/Admin/Actions/Grid/v3/DataReportOption.php @@ -11,13 +11,15 @@ class DataReportOption extends AbstractTool { protected $url; protected $option; - protected $title = ''; + protected $title = ''; + protected $moreOption = []; - public function __construct($option = '', $url = '', $title = '') + public function __construct($option = '', $url = '', $title = '', $more = []) { $this->option = $option; $this->url = $url; $this->title = $title; + $this->moreOption = $more; } /** @@ -46,6 +48,11 @@ class DataReportOption extends AbstractTool $startTime = $date['start'] ?? ''; $endTime = $date['end'] ?? ''; $url = 'admin/'.$this->url.'?start_time='.$startTime.'&end_time='.$endTime; + if(!empty($this->moreOption) && is_array($this->moreOption)){ + foreach($this->moreOption as $key => $value){ + $url .= '&'. $key .'='. $value; + } + } $this->defaultHtmlAttribute('href', url($url)); return <<get('status', 0); + $status = $request->get('status', null); $name = $request->get('name', ''); $marketId = $request->get('market_id',0); $storeId = $request->get('user_id',0); diff --git a/app/Admin/Controllers/v3/ReportCommunityController.php b/app/Admin/Controllers/v3/ReportCommunityController.php index 29760fa..cd7f3b8 100644 --- a/app/Admin/Controllers/v3/ReportCommunityController.php +++ b/app/Admin/Controllers/v3/ReportCommunityController.php @@ -83,17 +83,17 @@ class ReportCommunityController extends AdminController $filter->equal('name','姓名')->width(2); if(!$this->marketId){ $filter->equal('market_id','市场')->select($marketList)->width(2); - $filter->equal('status','状态')->select(EmployeesModel::$_STATUS)->width(2); + $filter->equal('status','状态')->select(EmployeesModel::$_STATUS)->default(1)->width(2); } }); $grid->tools([ - new DataReportOption('today','report_community','今日'), - new DataReportOption('yesterday','report_community','昨日'), - new DataReportOption('this_week','report_community','本周'), - new DataReportOption('last_week','report_community','上周'), - new DataReportOption('this_month','report_community','本月'), - new DataReportOption('last_month','report_community','上月'), + new DataReportOption('today','report_community','今日', $this->newParams), + new DataReportOption('yesterday','report_community','昨日', $this->newParams), + new DataReportOption('this_week','report_community','本周', $this->newParams), + new DataReportOption('last_week','report_community','上周', $this->newParams), + new DataReportOption('this_month','report_community','本月', $this->newParams), + new DataReportOption('last_month','report_community','上月', $this->newParams), new ReportCommunityExport() ]); @@ -140,7 +140,7 @@ class ReportCommunityController extends AdminController { $this->marketId = Auth::getMarket(); $params = [ - 'status' => $request->input('status',1), + 'status' => $request->input('status',null), 'name' => $request->input('name',false), 'market_id' => $this->marketId ? $this->marketId : $request->input('market_id',null), 'user_id' => $request->input('user_id',null), diff --git a/app/Admin/Repositories/v3/ReportCommunity.php b/app/Admin/Repositories/v3/ReportCommunity.php index 0b1de08..4755723 100644 --- a/app/Admin/Repositories/v3/ReportCommunity.php +++ b/app/Admin/Repositories/v3/ReportCommunity.php @@ -57,7 +57,7 @@ class ReportCommunity extends EloquentRepository $endTime = $params['end_time'] ?? request()->input('end_time',''); $status = request()->input('status',false); $params = [ - 'status' => $status !== false ? $status : $params['status'] ?? 1, + 'status' => $status !== false ? $status : $params['status'] ?? null, 'user_id' => $params['user_id'] ?? request()->input('user_id', null), 'market_id' => $params['market_id'] ?? request()->input('market_id',null), 'name' => $params['name'] ?? request()->input('name',false), @@ -76,7 +76,7 @@ class ReportCommunity extends EloquentRepository }else{ $endTime = $endTime . '23:59:59'; } - + // 获取懒族员工 $employeesData = $this->getEmployeesData($selectsEmp,$params); $employeesData->orderBy('id','desc'); @@ -90,7 +90,7 @@ class ReportCommunity extends EloquentRepository 'data' => $list ]; } - + if(!isset($employeeList['data']) || count($employeeList['data']) <= 0 ) { return $employeeList; }