优化代码

This commit is contained in:
java110 2022-06-24 18:30:00 +08:00
parent 233931349d
commit 537ebbe7ba
5 changed files with 170 additions and 28 deletions

View File

@ -0,0 +1,5 @@
<div class="vc-input-search text-left" v-if="inputSearchRoomByOwnerInfo.rooms && inputSearchRoomByOwnerInfo.rooms.length>0">
<div class="padding-left-sm padding-top-sm" style="cursor:pointer;" v-for="(item,index) in inputSearchRoomByOwnerInfo.rooms" @click="_inputSearchRoomChooseRoomByOwner(item)">
<span>{{item.floorNum}}-{{item.unitNum}}-{{item.roomNum}}({{item.ownerName}})</span>
</div>
</div>

View File

@ -0,0 +1,51 @@
(function(vc, vm) {
vc.extends({
data: {
inputSearchRoomByOwnerInfo: {
rooms: [],
callComponent: ''
}
},
_initMethod: function() {
},
_initEvent: function() {
vc.on('inputSearchRoomByOwner', 'searchRoom', function(_param) {
if (!_param.ownerName) {
return;
}
$that._loadRoomByOwnerInfo(_param.ownerName);
$that.inputSearchRoomByOwnerInfo.callComponent = _param.callComponent;
});
},
methods: {
_loadRoomByOwnerInfo: function(_ownerName) {
let param = {
params: {
page: 1,
row: 10,
ownerNameLike: _ownerName,
communityId: vc.getCurrentCommunity().communityId
}
}
vc.http.apiGet('/room.queryRoomsByOwner',
param,
function(json, res) {
let listRoomData = JSON.parse(json);
$that.inputSearchRoomByOwnerInfo.rooms = listRoomData.rooms;
},
function(errInfo, error) {
console.log('请求失败处理');
}
);
},
_inputSearchRoomChooseRoomByOwner: function(_room) {
vc.emit($that.inputSearchRoomByOwnerInfo.callComponent, "notifyRoomByOwner", _room);
$that.inputSearchRoomByOwnerInfo.rooms = [];
}
}
});
})(window.vc, window.vc.component);

View File

@ -18,6 +18,49 @@
<vc:create path="property/roomTreeDiv" callBackListener="roomCreateFee"></vc:create>
</div>
<div class="col-md-10 margin-top-xs">
<div class="row">
<div class="col-lg-12">
<div class="ibox ">
<div class="ibox-title">
<h5>
<span>
<vc:i18n name="查询条件" namespace="room"></vc:i18n>
</span>
</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 type="text" :placeholder="vc.i18n('请填写房屋编号,如1-1-1123','roomCreateFeeInfo')" @input="_inputRoom()" v-model="roomCreateFeeInfo.conditions.roomNum" class=" form-control">
<vc:create path="property/inputSearchRoom"></vc:create>
</div>
</div>
<div class="col-sm-3">
<select class="form-control-sm form-control input-s-sm inline" v-model="roomCreateFeeInfo.conditions.state">
<option selected value="">{{vc.i18n('请选择状态','roomCreateFee')}}</option>
<option value="2008001">{{vc.i18n('收费中','roomCreateFee')}}</option>
<option value="2009001">{{vc.i18n('收费结束','roomCreateFee')}}</option>
</select>
</div>
<div class="col-sm-3">
<input type="text" :placeholder="vc.i18n('请填写业主名称','roomCreateFeeInfo')" @input="_inputRoomByOwner()" v-model="roomCreateFeeInfo.conditions.ownerName" class=" form-control">
<vc:create path="property/inputSearchRoomByOwner"></vc:create>
</div>
<div class="col-sm-2">
<button type="button" class="btn btn-primary btn-sm" v-on:click="_queryRoomCreateFeeMethod()">
<i class="fa fa-search"></i> <span>
<vc:i18n name="查询" namespace="room"></vc:i18n>
</span>
</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<div class="ibox">

View File

@ -22,7 +22,13 @@
ownerName: '',
roomType: '',
hireOwnerFee: '0',
urlOwnerId: ''
urlOwnerId: '',
conditions: {
state: '2008001',
roomNum: '',
roomId: '',
ownerName: ''
}
},
currentPage: 1,
},
@ -34,9 +40,24 @@
_initEvent: function() {
vc.on('roomCreateFee', 'selectRoom', function(_param) {
vc.component.roomCreateFeeInfo.roomId = _param.roomId;
$that.roomCreateFeeInfo.conditions.roomId = _param.roomId;
$that.roomCreateFeeInfo.conditions.roomNum = ''
vc.component.roomCreateFeeInfo.roomName = _param.roomName;
vc.component._loadListRoomCreateFeeInfo(DEFAULT_PAGE, DEFAULT_ROW);
});
vc.on('roomCreateFee', 'notifyRoom', function(_room) {
$that.roomCreateFeeInfo.conditions.roomId = _room.roomId;
$that.roomCreateFeeInfo.conditions.roomNum = _room.floorNum + "-" + _room.unitNum + "-" + _room.roomNum;
$that.roomCreateFeeInfo.roomName = $that.roomCreateFeeInfo.conditions.roomNum;
vc.component._loadListRoomCreateFeeInfo(DEFAULT_PAGE, DEFAULT_ROW);
});
vc.on('roomCreateFee', 'notifyRoomByOwner', function(_room) {
$that.roomCreateFeeInfo.conditions.roomId = _room.roomId;
$that.roomCreateFeeInfo.conditions.ownerName = _room.ownerName;
$that.roomCreateFeeInfo.roomName = _room.floorNum + "-" + _room.unitNum + "-" + _room.roomNum;
vc.component._loadListRoomCreateFeeInfo(DEFAULT_PAGE, DEFAULT_ROW);
});
vc.on('pagination', 'page_event', function(_currentPage) {
$that.updateCurrentPage(_currentPage);
vc.component.listRoom(_currentPage, DEFAULT_ROW);
@ -127,12 +148,14 @@
return fee.squarePrice;
},
_loadListRoomCreateFeeInfo: function(_page, _row) {
var param = {
let param = {
params: {
page: _page,
row: _row,
communityId: vc.getCurrentCommunity().communityId,
payerObjId: vc.component.roomCreateFeeInfo.roomId
payerObjId: $that.roomCreateFeeInfo.conditions.roomId,
state: $that.roomCreateFeeInfo.conditions.state
// ownerId: $that.roomCreateFeeInfo.urlOwnerId
}
};
@ -234,6 +257,31 @@
ownerName: $that.roomCreateFeeInfo.ownerName
});
},
_inputRoom: function() {
if ($that.roomCreateFeeInfo.timer) {
clearTimeout($that.roomCreateFeeInfo.timer)
}
$that.roomCreateFeeInfo.timer = setTimeout(() => {
vc.emit('inputSearchRoomInfo', 'searchRoom', {
callComponent: 'roomCreateFee',
roomName: $that.roomCreateFeeInfo.conditions.roomNum
});
}, 1500)
},
_inputRoomByOwner: function() {
if ($that.roomCreateFeeInfo.timer) {
clearTimeout($that.roomCreateFeeInfo.timer)
}
$that.roomCreateFeeInfo.timer = setTimeout(() => {
vc.emit('inputSearchRoomByOwner', 'searchRoom', {
callComponent: 'roomCreateFee',
ownerName: $that.roomCreateFeeInfo.conditions.ownerName
});
}, 1500)
},
_queryRoomCreateFeeMethod: function() {
vc.component._loadListRoomCreateFeeInfo(DEFAULT_PAGE, DEFAULT_ROW);
}
}
});
})(window.vc);

View File

@ -129,31 +129,26 @@
</td>
<td class="text-center">
{{room.link}}
<td class="text-center">
{{room.idCard}}
</td>
<td class="text-center">
{{room.roomId}}
</td>
<td class="text-center">
<div class="btn-group" v-if="room.state != '2002'">
<button class="btn-white btn btn-xs" v-on:click="_toOwnerPayFee(room)"><span><vc:i18n name="欠费" namespace="roomCreateFee"></vc:i18n></span></button>
</div>
<!-- <div class="btn-group" v-if="room.state != '2002'">
<button class="btn-white btn btn-xs"
v-on:click="_openTranslateFeeManualCollectionDetailModel(room)"><span><vc:i18n name="人工托收" namespace="roomCreateFee"></vc:i18n></span>
</button>
</div> -->
<div class="btn-group" v-if="room.state != '2002'">
<button class="btn-white btn btn-xs" v-on:click="_downloadRoomCollectionLetterOrder(room)"><span><vc:i18n name="催缴单" namespace="roomCreateFee"></vc:i18n></span>
</button>
</div>
<div class="btn-group">
<button class="btn-white btn btn-xs" v-on:click="_openViewRoomCreateFee(room)"><span><vc:i18n name="费用" namespace="roomCreateFee"></vc:i18n></span>
</button>
</div>
</td>
</td>
<td class="text-center">
{{room.idCard}}
</td>
<td class="text-center">
{{room.roomId}}
</td>
<td class="text-center">
<div class="btn-group" v-if="room.state != '2002'">
<button class="btn-white btn btn-xs" v-on:click="_toOwnerPayFee(room)"><span><vc:i18n name="欠费" namespace="roomCreateFee"></vc:i18n></span></button>
</div>
<div class="btn-group" v-if="room.state != '2002'">
<button class="btn-white btn btn-xs" v-on:click="_downloadRoomCollectionLetterOrder(room)"><span><vc:i18n name="催缴单" namespace="roomCreateFee"></vc:i18n></span>
</button>
</div>
<div class="btn-group">
<button class="btn-white btn btn-xs" v-on:click="_openViewRoomCreateFee(room)"><span><vc:i18n name="费用" namespace="roomCreateFee"></vc:i18n></span>
</button>
</div>
</td>
</tr>
</tbody>
<tfoot>