Browse Source

Merge branch 'community_report_1130'

master
liangyuyan 5 years ago
parent
commit
282305e1de
  1. 2
      app/Admin/Controllers/v3/OrderDeliveryReportController.php
  2. 29
      app/Admin/Controllers/v3/ReportCommunityController.php
  3. 5
      app/Admin/Repositories/v3/ReportCommunity.php

2
app/Admin/Controllers/v3/OrderDeliveryReportController.php

@ -71,7 +71,7 @@ class OrderDeliveryReportController extends AdminController
'start_time' => request()->input('start_time', ''),
'end_time' => request()->input('end_time', ''),
];
// dd($params);
$table = OrderDeliveryById::make($params);
return $table;
})->help('只统计2020年10月01日之后(包括10月01日)的数据');

29
app/Admin/Controllers/v3/ReportCommunityController.php

@ -27,8 +27,9 @@ class ReportCommunityController extends AdminController
public $marketId = 0;
public $newParams = ['status' => 1];
public $marketList = [];
public $storeList = [];
protected $reportDate = '';
protected $tools = [];
/**
* Make a grid builder.
@ -51,8 +52,8 @@ class ReportCommunityController extends AdminController
return Grid::make($builder, function (Grid $grid) {
$marketList = $this->marketList;
$grid->column('market_id','市场')->display(function($marketId) use($marketList){
return $marketList[$marketId] ?? '';
$grid->column('market_id','市场')->display(function($market_id) use($marketList){
return $marketList[$market_id] ?? '';
});
$grid->column('user_id','懒ID');
@ -79,7 +80,7 @@ class ReportCommunityController extends AdminController
},'开始时间',)->date()->width(2);
$filter->equal('end_time','结束时间')->date()->width(2);
$filter->equal('user_id','懒ID')->width(2);
$filter->equal('user_id','懒ID')->placeholder('多个懒ID使用英文逗号隔开')->width(2);
$filter->equal('name','姓名')->width(2);
if(!$this->marketId){
$filter->equal('market_id','市场')->select($marketList)->width(2);
@ -87,15 +88,7 @@ class ReportCommunityController extends AdminController
$filter->equal('status','状态')->select(EmployeesModel::$_STATUS)->width(2);
});
$grid->tools([
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()
]);
$grid->tools($this->tools);
// 每页1条
$grid->paginate(10);
@ -120,10 +113,20 @@ class ReportCommunityController extends AdminController
*/
public function index(Content $content)
{
$this->tools = [
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)
];
$startTime = request()->get('start_time');
$endTime = request()->get('end_time');
if(empty($startTime) && empty($endTime)){
$content->row(Alert::make('请先选择时间查询!','')->removable());
}else{
$this->tools[] = new ReportCommunityExport();
}
return $content->title('社区代理点统计报表')

5
app/Admin/Repositories/v3/ReportCommunity.php

@ -175,8 +175,9 @@ class ReportCommunity extends EloquentRepository
if(isset($params['status']) && is_numeric($params['status'])){
$model->where('status',$params['status']);
}
if(isset($params['user_id']) && is_numeric($params['user_id'])){
$model->where('user_id', $params['user_id']);
if(isset($params['user_id']) && !empty($params['user_id'])){
$userId = explode(',',$params['user_id']);
$model->whereIn('user_id', $userId);
}
if(isset($params['name']) && $params['name']){
$model->where('name','like','%'.$params['name'].'%');

Loading…
Cancel
Save