优化代码

This commit is contained in:
java110 2022-06-27 19:08:14 +08:00
parent 5009feb470
commit 06467824dc
4 changed files with 32 additions and 445 deletions

View File

@ -152,6 +152,24 @@
<input v-model="roomCreateFeeAddInfo.endTime" type="text" :placeholder="vc.i18n('必填,请填写计费结束时间','roomCreateFeeAdd')" class="form-control roomCreateFeeEndTime">
</div>
</div>
<div class="form-group row" v-show="roomCreateFeeAddInfo.computingFormula == '1102'">
<label class="col-sm-2 col-form-label"><span><vc:i18n name="递增周期" namespace="roomCreateFeeAdd"></vc:i18n></span></label>
<div class="col-sm-10">
<input v-model="roomCreateFeeAddInfo.rateCycle" type="text" :placeholder="vc.i18n('必填,请填写递增周期,请填写月份','roomCreateFeeAdd')" class="form-control roomCreateFeeEndTime">
</div>
</div>
<div class="form-group row" v-show="roomCreateFeeAddInfo.computingFormula == '1102'">
<label class="col-sm-2 col-form-label"><span><vc:i18n name="计费递增率" namespace="roomCreateFeeAdd"></vc:i18n></span></label>
<div class="col-sm-10">
<input v-model="roomCreateFeeAddInfo.rate" type="text" :placeholder="vc.i18n('必填,请填写递增率','roomCreateFeeAdd')" class="form-control roomCreateFeeEndTime">
</div>
</div>
<div class="form-group row" v-show="roomCreateFeeAddInfo.computingFormula == '1102'">
<label class="col-sm-2 col-form-label"><span><vc:i18n name="递增开始时间" namespace="roomCreateFeeAdd"></vc:i18n></span></label>
<div class="col-sm-10">
<input v-model="roomCreateFeeAddInfo.rateStartTime" type="text" :placeholder="vc.i18n('必填,请填写递增开始时间','roomCreateFeeAdd')" class="form-control roomRateStartTime">
</div>
</div>
<div class="ibox-content">
<button class="btn btn-primary float-right" type="button" v-on:click="saveRoomCreateFeeInfo()">
<i class="fa fa-check"></i>&nbsp;提交

View File

@ -23,7 +23,10 @@
feeFlag: '',
endTime: '',
computingFormula: '',
amount: ''
amount: '',
rateCycle: '',
rate: '',
rateStartTime: ''
}
},
_initMethod: function() {
@ -93,6 +96,16 @@
$that.roomCreateFeeAddInfo.endTime = '';
}
});
vc.initDate('rateStartTime', function(_endTime) {
$that.roomCreateFeeAddInfo.rateStartTime = _endTime;
let start = Date.parse(new Date($that.roomCreateFeeAddInfo.startTime))
let end = Date.parse(new Date($that.roomCreateFeeAddInfo.rateStartTime))
if (start - end >= 0) {
vc.toast("递增开始时间必须大于开始时间")
$that.roomCreateFeeAddInfo.rateStartTime = '';
}
});
//防止多次点击时间插件失去焦点
document.getElementsByClassName('form-control roomCreateFeeStartTime')[0].addEventListener('click', myfunc)

View File

@ -1,174 +0,0 @@
<div>
<div class="row">
<div class="col-lg-12">
<div class="ibox ">
<div class="ibox-title">
<h5><span><vc:i18n name="查询条件" namespace="roomCreateFee"></vc:i18n></span>
</h5>
<div class="ibox-tools" style="top:10px;">
<button type="button" class="btn btn-link btn-sm" style="margin-right:10px;" v-on:click="_moreCondition()">{{roomCreateFeeInfo.moreCondition == true?'隐藏':'更多'}}
</button>
</div>
</div>
<div class="ibox-content">
<div class="row">
<div class="col-sm-3">
<select class="custom-select" v-model="roomCreateFeeInfo.conditions.roomType">
<option selected value="">{{vc.i18n('房屋类型','roomCreateFee')}}</option>
<option value="1010301">{{vc.i18n('普通房屋','roomCreateFee')}}</option>
<option value="2020602">{{vc.i18n('商铺','roomCreateFee')}}</option>
</select>
</div>
<div class="col-sm-3">
<div class="form-group">
<input type="text" :placeholder="roomCreateFeeInfo.conditions.roomType == '2020602'?'请填写楼栋-商铺 如1-1123':'请填写楼栋-单元-房屋 如1-1-1123'" class="form-control " v-model="roomCreateFeeInfo.conditions.allNum" @keyup.enter="_queryRoomMethod">
</div>
</div>
<div class="col-sm-3">
<input type="text" :placeholder="vc.i18n('请填写业主名称','roomCreateFee')" class="form-control " v-model="roomCreateFeeInfo.conditions.ownerNameLike" @keyup.enter="_queryRoomMethod">
</div>
<div class="col-sm-2">
<button type="button" class="btn btn-primary btn-sm" v-on:click="_queryRoomMethod()">
<i class="fa fa-search"></i> <span><vc:i18n name="查询" namespace="roomCreateFee"></vc:i18n></span>
</button>
<button type="button" class="btn btn-white btn-sm" v-on:click="_resetRoomMethod()" style="margin-left: 20px;">
<i class="fa fa-repeat"></i> <span><vc:i18n name="重置" namespace="roomCreateFee"></vc:i18n></span>
</button>
</div>
</div>
<div class="row" v-if="roomCreateFeeInfo.moreCondition == true">
<div class="col-sm-3">
<div class="form-group input-group">
<input type="text" :placeholder="vc.i18n('请选择楼栋','roomCreateFee')" v-model="roomCreateFeeInfo.conditions.floorName" class=" form-control">
<div class="input-group-prepend">
<button type="button" class="btn btn-primary btn-sm" v-on:click="_openChooseFloorMethod()">
<i class="fa fa-search"></i> <span><vc:i18n name="选择" namespace="roomCreateFee"></vc:i18n></span>
</button>
</div>
</div>
</div>
<div class="col-sm-3">
<div class="form-group">
<select class=" form-control input-s-sm inline" v-model="roomCreateFeeInfo.conditions.unitId">
<option selected value="">{{vc.i18n('请选择单元','roomCreateFee')}}</option>
<option v-for="(unit,index) in roomUnits" :key="index" v-bind:value="unit.unitId">
{{unit.unitNum}}{{vc.i18n('单元','roomCreateFee')}}
</option>
</select>
</div>
</div>
<div class="col-sm-3">
<input type="text" :placeholder="vc.i18n('请填写业主身份证号','roomCreateFee')" class="form-control " v-model="roomCreateFeeInfo.conditions.idCard" @keyup.enter="_queryRoomMethod">
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<div class="ibox">
<div class="ibox-title">
<h5><span><vc:i18n name="房屋信息" namespace="roomCreateFee"></vc:i18n></span>
</h5>
<div class="ibox-tools" style="top:10px;">
<button type="button" class="btn btn-white btn-sm" style="margin-left:10px" v-on:click="_openFeeImportExcel()">
<vc:i18n name="自定义模板" namespace="roomCreateFee"></vc:i18n>
</button>
<button type="button" class="btn btn-white btn-sm" style="margin-left:10px" v-on:click="_openDoCreateRoomFee()">
<vc:i18n name="自定义创建" namespace="roomCreateFee"></vc:i18n>
</button>
<button type="button" class="btn btn-white btn-sm" style="margin-left:10px" v-on:click="_openRoomCreateFeeAddModal(null,true)">
<i class="fa fa-plus"></i> <span><vc:i18n name="批量创建" namespace="roomCreateFee"></vc:i18n></span>
</button>
<button type="button" class="btn btn-white btn-sm" style="margin-left:10px" v-on:click="_downloadCollectionLetterOrder()">
<i class="fa fa-download"></i> <span><vc:i18n name="批量催缴单" namespace="roomCreateFee"></vc:i18n></span>
</button>
</div>
</div>
<div class="ibox-content">
<table class="footable table table-stripped toggle-arrow-tiny" style="margin-top:10px" data-page-size="10">
<thead>
<tr>
<th data-hide="phone" class="text-center">{{vc.i18n('房屋类型','roomCreateFee')}}</th>
<th data-hide="phone" class="text-center"><span><vc:i18n name="房屋(栋/单元/室)" namespace="roomCreateFee"></vc:i18n></span></th>
<th data-hide="phone" class="text-center"><span><vc:i18n name="楼层(单位:层)" namespace="roomCreateFee"></vc:i18n></span></th>
<th data-hide="phone" class="text-center"><span><vc:i18n name="房屋状态" namespace="roomCreateFee"></vc:i18n></span>
</th>
<th data-hide="phone" class="text-center"><span><vc:i18n name="业主名称" namespace="roomCreateFee"></vc:i18n></span>
</th>
<th data-hide="phone" class="text-center"><span><vc:i18n name="联系电话" namespace="roomCreateFee"></vc:i18n></span>
</th>
<th data-hide="phone" class="text-center"><span><vc:i18n name="业主身份证号" namespace="roomCreateFee"></vc:i18n></span>
</th>
<th class="text-center"><span><vc:i18n name="房屋ID" namespace="roomCreateFee"></vc:i18n></span></th>
<th class="text-center"><span><vc:i18n name="操作" namespace="roomCreateFee"></vc:i18n></span>
</th>
</tr>
</thead>
<tbody>
<tr v-for="room in roomCreateFeeInfo.rooms">
<td class="text-center">
{{room.roomType=='1010301'?'房屋':'商铺'}}
</td>
<td class="text-center" v-if="room.roomType=='1010301'">
{{room.floorNum}}-{{room.unitNum}}-{{room.roomNum}}
</td>
<td class="text-center" v-else>
{{room.floorNum}}-{{room.roomNum}}
</td>
<td class="text-center">
{{room.layer}}
</td>
<td class="text-center">
{{room.stateName}}
</td>
<td class="text-center">
{{room.ownerName}}
</td>
<td class="text-center">
{{room.link}}
</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>
<tr>
<td colspan="9">
<ul class="pagination float-right"></ul>
</td>
</tr>
</tfoot>
</table>
<!-- 分页 -->
<vc:create path="frame/pagination"></vc:create>
</div>
</div>
</div>
</div>
<vc:create path="property/searchFloor" emitChooseFloor="room" emitLoadData="room"></vc:create>
<vc:create path="property/roomCreateFeeAdd"></vc:create>
<vc:create path="property/exportFeeImportExcel"></vc:create>
<vc:create path="property/doImportCreateFee"></vc:create>
</div>

View File

@ -1,270 +0,0 @@
/**
入驻小区
**/
(function(vc) {
var DEFAULT_PAGE = 1;
var DEFAULT_ROW = 10;
var TEMP_SEARCH = 'roomCreateFeeSearch';
vc.extends({
data: {
roomUnits: [],
roomCreateFeeInfo: {
rooms: [],
total: 0,
records: 1,
floorId: '',
unitId: '',
state: '',
roomNum: '',
moreCondition: false,
conditions: {
floorId: '',
ownerName: '',
ownerNameLike: '',
floorName: '',
unitId: '',
roomNum: '',
roomId: '',
state: '',
section: '',
allNum: '',
idCard: '',
roomType: ''
}
},
currentPage: 1,
},
_initMethod: function() {
//检查是否有缓存数据
let _tempData = vc.getData(TEMP_SEARCH);
if (_tempData == null) {
vc.component.roomCreateFeeInfo.conditions.floorId = vc.getParam("floorId");
vc.component.roomCreateFeeInfo.conditions.floorName = vc.getParam("floorName");
vc.component.listRoom(DEFAULT_PAGE, DEFAULT_ROW);
} else {
console.log('here is tempData : ', _tempData);
vc.component.roomCreateFeeInfo.conditions = _tempData.conditions;
$that.updateCurrentPage(_tempData.currentPage);
vc.component.listRoom(_tempData.currentPage, DEFAULT_ROW);
}
},
_initEvent: function() {
vc.on('room', 'chooseFloor', function(_param) {
vc.component.roomCreateFeeInfo.conditions.floorId = _param.floorId;
vc.component.roomCreateFeeInfo.conditions.floorName = _param.floorName;
vc.component.loadUnits(_param.floorId);
});
vc.on('pagination', 'page_event', function(_currentPage) {
$that.updateCurrentPage(_currentPage);
vc.component.listRoom(_currentPage, DEFAULT_ROW);
});
},
methods: {
listRoom: function(_page, _row) {
if (vc.component.roomCreateFeeInfo.conditions.floorName == '' || vc.component.roomCreateFeeInfo.conditions.floorName == null) {
vc.component.roomCreateFeeInfo.conditions.floorId = ''
}
vc.component.roomCreateFeeInfo.conditions.page = _page;
vc.component.roomCreateFeeInfo.conditions.row = _row;
vc.component.roomCreateFeeInfo.conditions.communityId = vc.getCurrentCommunity().communityId;
let _allNum = $that.roomCreateFeeInfo.conditions.allNum;
let _conditions = JSON.parse(JSON.stringify(vc.component.roomCreateFeeInfo.conditions));
let param = {
params: _conditions
};
if (_allNum.split('-').length == 3) {
let _allNums = _allNum.split('-')
param.params.floorNum = _allNums[0].trim();
param.params.unitNum = _allNums[1].trim();
param.params.roomNum = _allNums[2].trim();
}
if (_allNum.split('-').length == 2) {
let _allNums = _allNum.split('-')
param.params.floorNum = _allNums[0].trim();
param.params.unitNum = '0';
param.params.roomNum = _allNums[1].trim();
}
//业主名称选框去空
param.params.ownerName = param.params.ownerName.trim();
//身份证号选框去空
param.params.idCard = param.params.idCard.trim();
//房屋编号去空
param.params.roomNum = param.params.roomNum.trim();
//发送get请求
vc.http.apiGet('/fee.listRoomsWhereFeeSet',
param,
function(json, res) {
var listRoomData = JSON.parse(json);
vc.component.roomCreateFeeInfo.total = listRoomData.total;
vc.component.roomCreateFeeInfo.records = listRoomData.records;
vc.component.roomCreateFeeInfo.rooms = listRoomData.rooms;
vc.emit('pagination', 'init', {
total: vc.component.roomCreateFeeInfo.records,
dataCount: vc.component.roomCreateFeeInfo.total,
currentPage: _page
});
// 换存搜索条件
$that.saveTempSearchData();
},
function(errInfo, error) {
vc.toast(errInfo);
console.log('请求失败处理');
}
);
},
_openRoomCreateFeeAddModal: function(_room, _isMore) {
vc.emit('roomCreateFeeAdd', 'openRoomCreateFeeAddModal', {
isMore: _isMore,
room: _room
});
},
_openViewRoomCreateFee: function(_room) {
vc.jumpToPage("/#/pages/property/listRoomFee?roomId=" + _room.roomId + '&ownerId=' + _room.ownerId);
},
/**
根据楼ID加载房屋
**/
loadUnits: function(_floorId) {
vc.component.addRoomUnits = [];
var param = {
params: {
floorId: _floorId,
communityId: vc.getCurrentCommunity().communityId
}
}
vc.http.get(
'roomCreateFee',
'loadUnits',
param,
function(json, res) {
//vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
if (res.status == 200) {
var tmpUnits = JSON.parse(json);
vc.component.roomUnits = tmpUnits;
return;
}
vc.toast(json);
},
function(errInfo, error) {
console.log('请求失败处理');
vc.toast(errInfo);
});
},
//查询
_queryRoomMethod: function() {
// 搜索时重置缓存分页
$that.updateCurrentPage(DEFAULT_PAGE);
vc.component.listRoom(DEFAULT_PAGE, DEFAULT_ROW);
},
//重置
_resetRoomMethod: function() {
vc.resetObject(vc.component.roomCreateFeeInfo.conditions);
vc.component.listRoom(DEFAULT_PAGE, DEFAULT_ROW);
},
_loadDataByParam: function() {
vc.component.roomCreateFeeInfo.conditions.floorId = vc.getParam("floorId");
vc.component.roomCreateFeeInfo.conditions.floorId = vc.getParam("floorName");
let param = {
params: {
communityId: vc.getCurrentCommunity().communityId,
floorId: vc.component.roomCreateFeeInfo.conditions.floorId
}
}
vc.http.get(
'roomCreateFee',
'loadFloor',
param,
function(json, res) {
if (res.status == 200) {
var _floorInfo = JSON.parse(json);
var _tmpFloor = _floorInfo.apiFloorDataVoList[0];
/*vc.emit('roomSelectFloor','chooseFloor', _tmpFloor);*/
return;
}
vc.toast(json);
},
function(errInfo, error) {
console.log('请求失败处理');
vc.toast(errInfo);
});
},
_moreCondition: function() {
if (vc.component.roomCreateFeeInfo.moreCondition) {
vc.component.roomCreateFeeInfo.moreCondition = false;
} else {
vc.component.roomCreateFeeInfo.moreCondition = true;
}
},
_openChooseFloorMethod: function() {
vc.emit('searchFloor', 'openSearchFloorModel', {});
},
_toOwnerPayFee: function(_room) {
let roomName = _room.floorNum + "栋" + _room.unitNum + "单元" + _room.roomNum + "室"
vc.jumpToPage('/#/pages/property/owePayFeeOrder?payObjId=' + _room.roomId + "&payObjType=3333&roomName=" + roomName);
},
_printOwnOrder: function(_room) {
//打印催交单
vc.jumpToPage('print.html#/pages/property/printOweFee?roomId=' + _room.roomId)
},
_openTranslateFeeManualCollectionDetailModel: function(_room) {
let _data = {
roomId: _room.roomId,
communityId: vc.getCurrentCommunity().communityId
}
//重新同步房屋欠费
vc.http.apiPost(
'/feeManualCollection/saveFeeManualCollection',
JSON.stringify(_data), {
emulateJSON: true
},
function(json, res) {
//vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
let _json = JSON.parse(json);
if (_json.code == 0) {
//关闭model
vc.toast(_json.msg);
vc.jumpToPage('/#/pages/property/feeManualCollectionManage');
return;
}
vc.toast(_json.msg);
},
function(errInfo, error) {
console.log('请求失败处理');
vc.message(errInfo);
});
},
/**
* 更新当前页码
*/
updateCurrentPage: function(page) {
$that.currentPage = page;
},
/**
* 保存搜索条件页码
*/
saveTempSearchData: function() {
let conditions = $that.roomCreateFeeInfo.conditions;
//缓存起来=
vc.saveData(TEMP_SEARCH, {
conditions: conditions,
currentPage: $that.currentPage
});
},
_downloadCollectionLetterOrder: function() {
vc.jumpToPage('/callComponent/feeManualCollection/downloadCollectionLetterOrder?communityId=' + vc.getCurrentCommunity().communityId);
},
_downloadRoomCollectionLetterOrder: function(_room) {
vc.jumpToPage('/callComponent/feeManualCollection/downloadCollectionLetterOrder?communityId=' + vc.getCurrentCommunity().communityId + "&roomId=" + _room.roomId);
},
_openFeeImportExcel: function() {
vc.emit('exportFeeImportExcel', 'openExportFeeImportExcelModal', {})
},
_openDoCreateRoomFee: function() {
vc.emit('doImportCreateFee', 'openDoImportCreateFeeModal', {})
}
}
});
})(window.vc);