cost lists add aggs

This commit is contained in:
qianhy
2023-03-14 17:05:06 +08:00
committed by lccsw
parent a44de4e540
commit 0ac6bfcf18
2 changed files with 17 additions and 1 deletions
+4 -1
View File
@@ -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;
+13
View File
@@ -129,7 +129,18 @@
<button type="button" id="import" class="am-btn am-btn-success am-btn-sm w100">导入</button>
</div>
</div>
<template v-if="aggs.doc_count>0">
<div class="am-form-group" style="margin-bottom: 0px;"></div>
<div class="am-form-group fl">
<label class="am-para-label w200 fl"><b>水平业务总毛利:</b>{{aggs.srv_price_sum}}</label>
<label class="am-para-label w200 fl"><b>单车总毛利:</b>{{aggs.car_price_sum}}</label>
</div>
</template>
</div>
</form>
<div class="coms-table-bd">
<div class="fr">共有<?= $pager['totle'] ?>条数据</div>
@@ -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 = <?=json_encode($params)?>;
vm.lists = <?=json_encode($lists)?>;
vm.aggs = <?=json_encode($aggs)?>;
vm.show_info = <?=json_encode($show_info)?>;
vm.set_sery();
vm.init_citys();