优化代码

This commit is contained in:
Your Name 2023-06-02 13:43:58 +08:00
parent c97954d9b8
commit 9b188b57be

View File

@ -9,6 +9,7 @@
dataReportFeeStatisticsInfo: { dataReportFeeStatisticsInfo: {
fees: [], fees: [],
feeTypeCds: [], feeTypeCds: [],
floors:[],
ownerId: '', ownerId: '',
roomNum: '', roomNum: '',
startDate: '', startDate: '',
@ -37,45 +38,69 @@
}) })
}, },
methods: { methods: {
_loadDataReportFeeStatisticsData: function(_page, _row) { _loadDataReportFeeStatisticsData: function(_page, _row,_floorIds) {
let param = { let param = {
params: { params: {
communityId: vc.getCurrentCommunity().communityId, communityId: vc.getCurrentCommunity().communityId,
startDate: $that.dataReportFeeStatisticsInfo.startDate, startDate: $that.dataReportFeeStatisticsInfo.startDate,
endDate: $that.dataReportFeeStatisticsInfo.endDate, endDate: $that.dataReportFeeStatisticsInfo.endDate,
objName: $that.dataReportFeeStatisticsInfo.objName, floorIds: _floorIds,
ownerName: $that.dataReportFeeStatisticsInfo.ownerName,
link: $that.dataReportFeeStatisticsInfo.link,
page: _page, page: _page,
row: _row row: _row
} }
}; };
//发送get请求 //发送get请求
vc.http.apiGet('/dataReport.queryOweDetailStatistics', vc.http.apiGet('/dataReport.queryDataReportFeeStatistics',
param, param,
function(json) { function(json) {
let _json = JSON.parse(json); let _json = JSON.parse(json);
$that.dataReportFeeStatisticsInfo.fees = _json.data; $that.dataReportFeeStatisticsInfo.fees = _json.data;
vc.emit('dataReportFeeStatistics', 'paginationPlus', 'init', {
total: _json.records,
dataCount: _json.total,
currentPage: _page
});
let _feeAmount = 0.0;
if (_json.data && _json.data.length > 0) {
_json.data.forEach(item => {
_feeAmount += parseFloat(item.receivedFee);
});
}
$that.dataReportFeeStatisticsInfo.feeAmount = _feeAmount.toFixed(2); // let _feeAmount = 0.0;
// if (_json.data && _json.data.length > 0) {
// _json.data.forEach(item => {
// _feeAmount += parseFloat(item.receivedFee);
// });
// }
// $that.dataReportFeeStatisticsInfo.feeAmount = _feeAmount.toFixed(2);
}, },
function() { function() {
console.log('请求失败处理'); console.log('请求失败处理');
} }
); );
}, },
_loadFloors:function(){
var param = {
params: {
page:1,
row:100,
communityId:vc.getCurrentCommunity().communityId
}
};
//发送get请求
vc.http.apiGet('/floor.queryFloors',
param,
function(json, res) {
var listFloorData = JSON.parse(json);
vc.component.listFloorInfo.total = listFloorData.total;
vc.component.listFloorInfo.records = listFloorData.records;
vc.component.listFloorInfo.floors = listFloorData.apiFloorDataVoList;
vc.emit('pagination', 'init', {
total: vc.component.listFloorInfo.records,
dataCount: vc.component.listFloorInfo.total,
currentPage: _page
});
},
function(errInfo, error) {
console.log('请求失败处理');
}
);
},
//查询 //查询
_qureyDataReportFeeStatistics: function() { _qureyDataReportFeeStatistics: function() {
$that._loadDataReportFeeStatisticsData(DEFAULT_PAGE, DEFAULT_ROWS); $that._loadDataReportFeeStatisticsData(DEFAULT_PAGE, DEFAULT_ROWS);