diff --git a/application/admin/controller/statistics/Item.php b/application/admin/controller/statistics/Item.php index d5ba0e4..6084985 100644 --- a/application/admin/controller/statistics/Item.php +++ b/application/admin/controller/statistics/Item.php @@ -106,6 +106,21 @@ class Item extends Backend $build->where('area_id', 'like', $area_id . '%'); } + //来源 + if(!empty(request()->get('source',null))){ + $build->where('source',request()->get('source')); + } + //城市 + /* if(!empty(request()->post('area_id',null))){ + $build->where('area_id','LIKE',request()->post('source').'%'); + }*/ + + if(!empty(request()->get('item_id',null))){ + $item_id =request()->get('item_id'); + $item_ids = $this->getItemsById($item_id); + $item_ids [] = $item_id; + $build->whereIn('item_id', $item_ids); + } $build->whereBetween('create_time', [$start, $end_at]) ->field([ diff --git a/application/admin/view/statistics/item/index.html b/application/admin/view/statistics/item/index.html index da9d918..a1a97d1 100644 --- a/application/admin/view/statistics/item/index.html +++ b/application/admin/view/statistics/item/index.html @@ -29,7 +29,7 @@ -
+ @@ -69,15 +69,34 @@
+ +
+ +
+
+ +
+
+ + +
+
+
+ +
diff --git a/public/assets/js/backend/statistics/item.js b/public/assets/js/backend/statistics/item.js index 7b8cca5..e69f912 100644 --- a/public/assets/js/backend/statistics/item.js +++ b/public/assets/js/backend/statistics/item.js @@ -76,6 +76,11 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'echarts', 'echarts-t const area_id = $('#area_id').val(); const range = $('#daterange-table').val(); + + const source1 = $('#source').val(); + var item_id = $('#item_id').val(); + + let data = ''; if (area_id !== ''){ data += 'area_id=' + area_id+'&'; @@ -83,6 +88,14 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'echarts', 'echarts-t if (range !== ''){ data += 'range=' + range; } + + if (source1!== ''){ + data += 'source=' + source1; + } + if (item_id !== ''){ + data +='item_id=' + item_id; + } + // data = encodeURIComponent(data); $("#table2").bootstrapTable('refresh',{ url:'statistics/item/list?' + data, @@ -207,16 +220,16 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'echarts', 'echarts-t getChartData: function () { // 获取日期范围值 var daterange = $('#daterange').val(); - var source = $('#source').val(); + /* var source = $('#source').val(); var city_id = $('#area_id').val(); var item_id = $('#item_id').val(); - +*/ // 构建查询参数 var params = { 'daterange': daterange, - 'source': source, + /* 'source': source, 'area_id': city_id, - 'item_id': item_id, + 'item_id': item_id,*/ }; $.ajax({