mirror of
https://gitee.com/java110/MicroCommunityWeb.git
synced 2026-02-24 05:46:03 +08:00
优化代码
This commit is contained in:
parent
d4276868c2
commit
768fbf2057
@ -1,63 +1,64 @@
|
||||
/**
|
||||
入驻小区
|
||||
**/
|
||||
(function(vc){
|
||||
(function(vc) {
|
||||
var DEFAULT_PAGE = 1;
|
||||
var DEFAULT_ROWS = 1;
|
||||
vc.extends({
|
||||
data:{
|
||||
noticeDetailInfo:{
|
||||
noticeId:'',
|
||||
title:'',
|
||||
context:'',
|
||||
startTime:'',
|
||||
endTime:'',
|
||||
createTime:''
|
||||
data: {
|
||||
noticeDetailInfo: {
|
||||
noticeId: '',
|
||||
title: '',
|
||||
context: '',
|
||||
startTime: '',
|
||||
endTime: '',
|
||||
createTime: ''
|
||||
}
|
||||
},
|
||||
_initMethod:function(){
|
||||
_initMethod: function() {
|
||||
var tmpNoticeId = vc.getParam('noticeId');
|
||||
if(!vc.notNull(tmpNoticeId)){
|
||||
return ;
|
||||
if (!vc.notNull(tmpNoticeId)) {
|
||||
return;
|
||||
}
|
||||
vc.component.noticeDetailInfo.noticeId = tmpNoticeId;
|
||||
vc.component._listNotices(DEFAULT_PAGE, DEFAULT_ROWS);
|
||||
},
|
||||
_initEvent:function(){
|
||||
_initEvent: function() {
|
||||
|
||||
},
|
||||
methods:{
|
||||
_listNotices:function(_page, _rows){
|
||||
methods: {
|
||||
_listNotices: function(_page, _rows) {
|
||||
|
||||
var param = {
|
||||
params:{
|
||||
page:_page,
|
||||
row:_rows,
|
||||
communityId:vc.getCurrentCommunity().communityId,
|
||||
noticeId:vc.component.noticeDetailInfo.noticeId
|
||||
params: {
|
||||
page: _page,
|
||||
row: _rows,
|
||||
communityId: vc.getCurrentCommunity().communityId,
|
||||
noticeId: vc.component.noticeDetailInfo.noticeId
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
//发送get请求
|
||||
vc.http.get('noticeDetail',
|
||||
'get',
|
||||
param,
|
||||
function(json,res){
|
||||
var _noticeDetailInfo=JSON.parse(json);
|
||||
//发送get请求
|
||||
vc.http.get('noticeDetail',
|
||||
'get',
|
||||
param,
|
||||
function(json, res) {
|
||||
var _noticeDetailInfo = JSON.parse(json);
|
||||
|
||||
var _notices = _noticeDetailInfo.notices;
|
||||
if(_notices.length >0){
|
||||
//filterXSS
|
||||
_notices[0].context = filterXSS(_notices[0].context);
|
||||
vc.copyObject(_notices[0], vc.component.noticeDetailInfo);
|
||||
}
|
||||
var _notices = _noticeDetailInfo.notices;
|
||||
if (_notices.length > 0) {
|
||||
//filterXSS
|
||||
_notices[0].context = filterXSS(_notices[0].context);
|
||||
vc.copyObject(_notices[0], vc.component.noticeDetailInfo);
|
||||
}
|
||||
|
||||
},function(errInfo,error){
|
||||
console.log('请求失败处理');
|
||||
}
|
||||
);
|
||||
},
|
||||
function(errInfo, error) {
|
||||
console.log('请求失败处理');
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
})(window.vc);
|
||||
})(window.vc);
|
||||
@ -5,18 +5,16 @@
|
||||
<div class="ibox-title">
|
||||
<h5>查询条件</h5>
|
||||
<div class="ibox-tools" style="top:10px;">
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="ibox-content">
|
||||
<div class="row">
|
||||
<div class="col-sm-4">
|
||||
<div class="form-group input-group">
|
||||
<input type="text" placeholder="请选择楼栋" v-model="reportFeeSummaryInfo.conditions.floorId"
|
||||
class=" form-control">
|
||||
<input type="text" placeholder="请选择楼栋" v-model="reportFeeSummaryInfo.conditions.floorId" class=" form-control">
|
||||
<div class="input-group-prepend">
|
||||
<button type="button" class="btn btn-primary btn-sm"
|
||||
v-on:click="_openChooseFloorMethod()">
|
||||
<button type="button" class="btn btn-primary btn-sm" v-on:click="_openChooseFloorMethod()">
|
||||
<i class="fa fa-search"></i> 选择
|
||||
</button>
|
||||
</div>
|
||||
@ -24,8 +22,7 @@
|
||||
</div>
|
||||
<div class="col-sm-3">
|
||||
<div class="form-group">
|
||||
<select class="form-control-md form-control input-s-sm inline"
|
||||
v-model="reportFeeSummaryInfo.conditions.unitId">
|
||||
<select class="form-control-md form-control input-s-sm inline" v-model="reportFeeSummaryInfo.conditions.unitId">
|
||||
<option selected value="">请选择单元</option>
|
||||
<option v-for="(unit,index) in reportFeeSummaryInfo.roomUnits" :key="index"
|
||||
v-bind:value="unit.unitId">
|
||||
@ -36,16 +33,14 @@
|
||||
</div>
|
||||
<div class="col-sm-3">
|
||||
<div class="form-group">
|
||||
<input type="text" placeholder="请填写房屋编号" class="form-control form-control-md"
|
||||
v-model="reportFeeSummaryInfo.conditions.roomNum">
|
||||
<input type="text" placeholder="请填写房屋编号" class="form-control form-control-md" v-model="reportFeeSummaryInfo.conditions.roomNum">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-2">
|
||||
<button type="button" class="btn btn-primary btn-md" v-on:click="_queryMethod()">
|
||||
<i class="fa fa-search"></i>查询
|
||||
</button>
|
||||
<button type="button" class="btn btn-info btn-md" v-on:click="_resetMethod()"
|
||||
style="margin-left: 20px;">
|
||||
<button type="button" class="btn btn-info btn-md" v-on:click="_resetMethod()" style="margin-left: 20px;">
|
||||
<i class="fa fa-repeat"></i>重置
|
||||
</button>
|
||||
</div>
|
||||
@ -53,14 +48,12 @@
|
||||
<div class="row">
|
||||
<div class="col-sm-4">
|
||||
<div class="form-group input-group">
|
||||
<input type="text" placeholder="请选择缴费开始时间"
|
||||
v-model="reportFeeSummaryInfo.conditions.startTime" class=" form-control startTime">
|
||||
<input type="text" placeholder="请选择缴费开始时间" v-model="reportFeeSummaryInfo.conditions.startTime" class=" form-control startTime">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-3">
|
||||
<div class="form-group input-group">
|
||||
<input type="text" placeholder="请选择缴费结束时间"
|
||||
v-model="reportFeeSummaryInfo.conditions.endTime" class=" form-control endTime">
|
||||
<input type="text" placeholder="请选择缴费结束时间" v-model="reportFeeSummaryInfo.conditions.endTime" class=" form-control endTime">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-3">
|
||||
@ -151,7 +144,7 @@
|
||||
<div class="row">实收: {{reportFeeSummaryInfo.allReceivedAmount}}元</div>
|
||||
</span>
|
||||
<span class="col-md-2">
|
||||
<div class="row">欠费: {{reportFeeSummaryInfo.totalPreferentialAmount}}元</div>
|
||||
<div class="row">欠费: {{_computeTotalOweAmount()}}元</div>
|
||||
<div class="row">欠费: {{reportFeeSummaryInfo.allOweAmount}}元</div>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/**
|
||||
入驻小区
|
||||
**/
|
||||
(function (vc) {
|
||||
(function(vc) {
|
||||
var DEFAULT_PAGE = 1;
|
||||
var DEFAULT_ROWS = 10;
|
||||
vc.extends({
|
||||
@ -33,8 +33,8 @@
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
'reportFeeSummaryInfo.feeConfigs': function () {//'goodList'是我要渲染的对象,也就是我要等到它渲染完才能调用函数
|
||||
this.$nextTick(function () {
|
||||
'reportFeeSummaryInfo.feeConfigs': function() { //'goodList'是我要渲染的对象,也就是我要等到它渲染完才能调用函数
|
||||
this.$nextTick(function() {
|
||||
$('#configIds').selectpicker({
|
||||
title: '请选择费用项',
|
||||
styleBase: 'form-control',
|
||||
@ -43,13 +43,13 @@
|
||||
})
|
||||
}
|
||||
},
|
||||
_initMethod: function () {
|
||||
_initMethod: function() {
|
||||
vc.component._initDate();
|
||||
$that._listFeeConfigs();
|
||||
vc.component._listFees(DEFAULT_PAGE, DEFAULT_ROWS);
|
||||
},
|
||||
_initEvent: function () {
|
||||
$('#configIds').on('changed.bs.select', function (e, clickedIndex, isSelected, previousValue) {
|
||||
_initEvent: function() {
|
||||
$('#configIds').on('changed.bs.select', function(e, clickedIndex, isSelected, previousValue) {
|
||||
// do something...
|
||||
if (isSelected) {
|
||||
$that.reportFeeSummaryInfo.feeConfigNames.push({
|
||||
@ -67,17 +67,17 @@
|
||||
$that.reportFeeSummaryInfo.feeConfigNames = _feeConfigNames;
|
||||
}
|
||||
});
|
||||
vc.on('reportFeeSummary', 'chooseFloor', function (_param) {
|
||||
vc.on('reportFeeSummary', 'chooseFloor', function(_param) {
|
||||
vc.component.reportFeeSummaryInfo.conditions.floorId = _param.floorId;
|
||||
vc.component.reportFeeSummaryInfo.conditions.floorName = _param.floorName;
|
||||
vc.component.loadUnits(_param.floorId);
|
||||
});
|
||||
vc.on('pagination', 'page_event', function (_currentPage) {
|
||||
vc.on('pagination', 'page_event', function(_currentPage) {
|
||||
vc.component._listFees(_currentPage, DEFAULT_ROWS);
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
_initDate: function () {
|
||||
_initDate: function() {
|
||||
$(".startTime").datetimepicker({
|
||||
minView: "month",
|
||||
language: 'zh-CN',
|
||||
@ -99,12 +99,12 @@
|
||||
todayBtn: true
|
||||
});
|
||||
$('.startTime').datetimepicker()
|
||||
.on('changeDate', function (ev) {
|
||||
.on('changeDate', function(ev) {
|
||||
var value = $(".startTime").val();
|
||||
vc.component.reportFeeSummaryInfo.conditions.startTime = value;
|
||||
});
|
||||
$('.endTime').datetimepicker()
|
||||
.on('changeDate', function (ev) {
|
||||
.on('changeDate', function(ev) {
|
||||
var value = $(".endTime").val();
|
||||
vc.component.reportFeeSummaryInfo.conditions.endTime = value;
|
||||
let start = Date.parse(new Date($that.reportFeeSummaryInfo.conditions.startTime))
|
||||
@ -128,11 +128,11 @@
|
||||
}
|
||||
},
|
||||
//查询
|
||||
_queryMethod: function () {
|
||||
_queryMethod: function() {
|
||||
vc.component._listFees(DEFAULT_PAGE, DEFAULT_ROWS);
|
||||
},
|
||||
//查询方法
|
||||
_listFees: function (_page, _rows) {
|
||||
_listFees: function(_page, _rows) {
|
||||
vc.component.reportFeeSummaryInfo.conditions.page = _page;
|
||||
vc.component.reportFeeSummaryInfo.conditions.row = _rows;
|
||||
vc.component.reportFeeSummaryInfo.conditions.communityId = vc.getCurrentCommunity().communityId;
|
||||
@ -143,7 +143,7 @@
|
||||
//发送get请求
|
||||
vc.http.apiGet('/reportFeeMonthStatistics/queryReportFeeSummary',
|
||||
param,
|
||||
function (json, res) {
|
||||
function(json, res) {
|
||||
var _reportFeeSummaryInfo = JSON.parse(json);
|
||||
vc.component.reportFeeSummaryInfo.total = _reportFeeSummaryInfo.total;
|
||||
vc.component.reportFeeSummaryInfo.records = _reportFeeSummaryInfo.records;
|
||||
@ -174,13 +174,14 @@
|
||||
dataCount: vc.component.reportFeeSummaryInfo.total,
|
||||
currentPage: _page
|
||||
});
|
||||
}, function (errInfo, error) {
|
||||
},
|
||||
function(errInfo, error) {
|
||||
console.log('请求失败处理');
|
||||
}
|
||||
);
|
||||
},
|
||||
//重置
|
||||
_resetMethod: function (_page, _rows) {
|
||||
_resetMethod: function(_page, _rows) {
|
||||
vc.component.reportFeeSummaryInfo.conditions.floorName = "";
|
||||
vc.component.reportFeeSummaryInfo.conditions.floorId = "";
|
||||
vc.component.reportFeeSummaryInfo.conditions.unitId = "";
|
||||
@ -189,7 +190,7 @@
|
||||
vc.component.reportFeeSummaryInfo.conditions.endTime = "";
|
||||
$that._listFees(DEFAULT_PAGE, DEFAULT_ROWS);
|
||||
},
|
||||
loadUnits: function (_floorId) {
|
||||
loadUnits: function(_floorId) {
|
||||
var param = {
|
||||
params: {
|
||||
floorId: _floorId,
|
||||
@ -200,7 +201,7 @@
|
||||
'room',
|
||||
'loadUnits',
|
||||
param,
|
||||
function (json, res) {
|
||||
function(json, res) {
|
||||
//vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
|
||||
if (res.status == 200) {
|
||||
let tmpUnits = JSON.parse(json);
|
||||
@ -209,22 +210,22 @@
|
||||
}
|
||||
vc.toast(json);
|
||||
},
|
||||
function (errInfo, error) {
|
||||
function(errInfo, error) {
|
||||
console.log('请求失败处理');
|
||||
vc.toast(errInfo);
|
||||
});
|
||||
},
|
||||
_openChooseFloorMethod: function () {
|
||||
_openChooseFloorMethod: function() {
|
||||
vc.emit('searchFloor', 'openSearchFloorModel', {});
|
||||
},
|
||||
_moreCondition: function () {
|
||||
_moreCondition: function() {
|
||||
if (vc.component.reportFeeSummaryInfo.moreCondition) {
|
||||
vc.component.reportFeeSummaryInfo.moreCondition = false;
|
||||
} else {
|
||||
vc.component.reportFeeSummaryInfo.moreCondition = true;
|
||||
}
|
||||
},
|
||||
_listFeeConfigs: function () {
|
||||
_listFeeConfigs: function() {
|
||||
var param = {
|
||||
params: {
|
||||
page: 1,
|
||||
@ -234,15 +235,15 @@
|
||||
};
|
||||
//发送get请求
|
||||
vc.http.get('feeConfigManage', 'list', param,
|
||||
function (json, res) {
|
||||
function(json, res) {
|
||||
var _feeConfigManageInfo = JSON.parse(json);
|
||||
vc.component.reportFeeSummaryInfo.feeConfigs = _feeConfigManageInfo.feeConfigs;
|
||||
},
|
||||
function (errInfo, error) {
|
||||
function(errInfo, error) {
|
||||
console.log('请求失败处理');
|
||||
});
|
||||
},
|
||||
_getFeeReceivedAmountAmount: function (item, fee) {
|
||||
_getFeeReceivedAmountAmount: function(item, fee) {
|
||||
let _items = fee.items;
|
||||
if (!_items) {
|
||||
return 0;
|
||||
@ -256,19 +257,29 @@
|
||||
})
|
||||
return _value;
|
||||
},
|
||||
_exportExcel: function () {
|
||||
_exportExcel: function() {
|
||||
vc.jumpToPage('/callComponent/exportReportFee/exportData?pagePath=reportFeeSummary&' + vc.objToGetParam($that.reportFeeSummaryInfo.conditions));
|
||||
},
|
||||
_computeSum: function (a, b) {
|
||||
_computeSum: function(a, b) {
|
||||
return (parseFloat(a) + parseFloat(b)).toFixed(2)
|
||||
},
|
||||
_computeOweFee: function (fee) {
|
||||
_computeOweFee: function(fee) {
|
||||
let _oweFee = (parseFloat(fee.hisOweAmount) + parseFloat(fee.curReceivableAmount) - parseFloat(fee.curReceivedAmount) - parseFloat(fee.hisOweReceivedAmount)).toFixed(2);
|
||||
if (_oweFee < 0) {
|
||||
return _oweFee;
|
||||
}
|
||||
return _oweFee;
|
||||
},
|
||||
_computeTotalOweAmount: function() {
|
||||
if (!window.$that) {
|
||||
return 0;
|
||||
}
|
||||
let _amount = 0;
|
||||
$that.reportFeeSummaryInfo.fees.forEach(item => {
|
||||
_amount += parseFloat($that._computeOweFee(item));
|
||||
})
|
||||
return _amount.toFixed(2);
|
||||
}
|
||||
}
|
||||
});
|
||||
})(window.vc);
|
||||
})(window.vc);
|
||||
Loading…
Reference in New Issue
Block a user