优化代码

This commit is contained in:
java110 2021-05-15 20:03:51 +08:00
parent 310339b1b9
commit e318644e85
2 changed files with 39 additions and 11 deletions

View File

@ -79,21 +79,21 @@
<th class="text-center">业主名称</th>
<th class="text-center">开始时间</th>
<th class="text-center">结束时间</th>
<th class="text-center">面积</th>
<!-- <th class="text-center">面积</th> -->
<th class="text-center" v-for="(item,index) in listOweFeeInfo.feeConfigNames">{{item.configName}}</th>
<th class="text-center" >合计</th>
<th class="text-center">更新时间</th>
</tr>
</thead>
<tbody>
<tr v-for="fee in listOweFeeInfo.fees">
<td class="text-center">{{index+1}}</td>
<tr v-for="(fee,i) in listOweFeeInfo.fees">
<td class="text-center">{{i+1}}</td>
<td class="text-center">{{fee.payerObjName}}</td>
<td class="text-center">{{fee.ownerName}}</td>
<td class="text-center">{{fee.endTime}}</td>
<td class="text-center">{{fee.deadlineTime}}</td>
<td class="text-center" v-for="(item,index) in listOweFeeInfo.feeConfigNames">{{_getFeeOweAmount(item,fee)}}</td>
<td class="text-center">{{fee.amountOwed}}</td>
<td class="text-center" v-for="item in listOweFeeInfo.feeConfigNames">{{_getFeeOweAmount(item,fee)}}</td>
<td class="text-center">{{_getAllFeeOweAmount(fee)}}</td>
<td class="text-center">{{fee.updateTime}}</td>
</tr>
</tbody>

View File

@ -28,8 +28,8 @@
this.$nextTick(function () {
$('#configIds').selectpicker({
title: '请选择费用项',
styleBase:'form-control',
width:'auto'
styleBase: 'form-control',
width: 'auto'
});
})
}
@ -73,12 +73,12 @@
vc.component.listOweFeeInfo.conditions.row = _row;
vc.component.listOweFeeInfo.conditions.communityId = vc.getCurrentCommunity().communityId;
let _configIds = "";
$that.listOweFeeInfo.feeConfigNames.forEach(item=>{
$that.listOweFeeInfo.feeConfigNames.forEach(item => {
_configIds += (item.configId + ',')
})
if(_configIds.endsWith(',')){
_configIds = _configIds.substring(0,_configIds.length-1);
if (_configIds.endsWith(',')) {
_configIds = _configIds.substring(0, _configIds.length - 1);
}
$that.listOweFeeInfo.conditions.configIds = _configIds;
@ -139,7 +139,35 @@
});
},
_getFeeOweAmount: function (item, fee) {
return "0";
let _items = fee.items;
if (!_items) {
return 0;
}
let _value = 0;
_items.forEach(tmp => {
if (tmp.configId == item.configId) {
_value = tmp.amountOwed
return;
}
})
return _value;
},
_getAllFeeOweAmount: function (_fee) {
let _feeConfigNames = $that.listOweFeeInfo.feeConfigNames;
if (_feeConfigNames.length < 1) {
return _fee.amountOwed;
}
let _amountOwed = 0.0;
let _items = _fee.items;
_feeConfigNames.forEach(_feeItem =>{
_items.forEach(_item=>{
if(_feeItem.configId == _item.configId){
_amountOwed += parseFloat(_item.amountOwed);
}
})
})
return _amountOwed;
}
}