优化结算账户报表的统计

This commit is contained in:
季圣华
2020-04-30 22:50:55 +08:00
parent 5b6950f39f
commit 1cdc79618b
3 changed files with 88 additions and 21 deletions

View File

@@ -41,7 +41,8 @@
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-print" id="printBtn">打印</a>
</div>
<div class="form-group">
当前总余额:<span class="first-total">0</span>&nbsp;&nbsp;
本月发生总额:<span id="allMonthAmount">0</span>&nbsp;&nbsp;
当前总余额:<span id="allCurrentAmount">0</span>
</div>
</div>
<table id="tableData" style="top:300px;border-bottom-color:#FFFFFF"></table>
@@ -181,13 +182,25 @@
if(res && res.code === 200){
if(res.data && res.data.page) {
$("#tableData").datagrid('loadData', res.data.page);
var total = 0;
res.data.page.rows.forEach(function(value, index, array){
//执行某些操作
total += value.currentamount;
})
}
}
},
//此处添加错误处理
error: function () {
$.messager.alert('查询提示', '查询数据后台异常,请稍后再试!', 'error');
return;
}
});
$(".first-total").text(total); //当前总余额
$.ajax({
type: "get",
url: "/account/getStatistics",
dataType: "json",
success: function (res) {
if (res && res.code === 200) {
if(res.data) {
$("#allMonthAmount").text(res.data.allMonthAmount);
$("#allCurrentAmount").text(res.data.allCurrentAmount);
}
}
},
@@ -258,7 +271,7 @@
}
},
{title: '余额', field: 'balance', width: 80},
{title: '入库出库日期', field: 'operTime', width: 180}
{title: '日期', field: 'operTime', width: 180}
]],
onLoadError: function () {
$.messager.alert('页面加载提示', '页面加载异常,请稍后再试!', 'error');