From 0ac6bfcf18e7365af6a1abfbc9fb7e4555ccf158 Mon Sep 17 00:00:00 2001 From: qianhy Date: Tue, 14 Mar 2023 17:05:06 +0800 Subject: [PATCH] cost lists add aggs --- admin/controllers/items/Cost.php | 5 ++++- admin/views/items/cost/lists.php | 13 +++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/admin/controllers/items/Cost.php b/admin/controllers/items/Cost.php index 0ac777f8..7fa6942a 100644 --- a/admin/controllers/items/Cost.php +++ b/admin/controllers/items/Cost.php @@ -156,7 +156,9 @@ class Cost extends HD_Controller{ $autoList[3] = $this->auto_attr_model->select(array('status > -1' => null, 'type' => 1, 's_id' => $params['s_id']), 'id desc', 0, 0, 'id,title as name'); } - $count = $this->items_cost_model->count($where); + #$count = $this->items_cost_model->count($where);var_dump($count); + $aggs = $this->items_cost_model->get($where, 'count(*) as doc_count, sum(srv_price) as srv_price_sum, sum(car_price) as car_price_sum'); + $count = $aggs['doc_count']; $lists = []; if($count){ $rows = $this->items_cost_model->select($where,'id desc',$page,$size); @@ -232,6 +234,7 @@ class Cost extends HD_Controller{ #$autoList[1] = $this->mdAutoBrand->select(array('status' => 1), 'id desc', 0, 0, 'id,name'); $autoList[1] = $this->mdAutoBrand->map_brand(array('status > -1' => null), false); $this->data['lists'] = $lists; + $this->data['aggs'] = $aggs; $this->data['pager'] = array('count' => ceil($count / $size), 'curr' => $page, 'totle' => $count); $this->data['autoList'] = $autoList; $this->data['params'] = $params; diff --git a/admin/views/items/cost/lists.php b/admin/views/items/cost/lists.php index 0d819ba5..aa985628 100644 --- a/admin/views/items/cost/lists.php +++ b/admin/views/items/cost/lists.php @@ -129,7 +129,18 @@ + + + + +
共有条数据
@@ -318,6 +329,7 @@ data: { params: [], lists: [], + aggs: [], show_info: [], // modal_fine: {title: '', lists: [], selected: [], page: 1, size: 10, total: 0}, admins: {cityAry: [], countyAry: [], bizAry: [], list: []}, @@ -326,6 +338,7 @@ var vm = this; vm.params = ; vm.lists = ; + vm.aggs = ; vm.show_info = ; vm.set_sery(); vm.init_citys();