optimize batch create room fee

This commit is contained in:
wuxw 2023-10-19 02:10:55 +08:00
parent 05d3672bb6
commit 58095315b3
4 changed files with 373 additions and 10 deletions

View File

@ -7,7 +7,6 @@
</h3>
<div class="ibox-content">
<div>
<div class="form-group row" v-show="roomCreateFeeAddInfo.isMore == true">
<label class="col-sm-2 col-form-label">
<vc:i18n name="房屋类型" namespace="roomCreateFeeAdd"></vc:i18n>
@ -260,4 +259,3 @@
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,151 @@
<div class="row">
<div class="col-lg-12">
<div class="ibox">
<div class="ibox-title">
<h5>
<vc:i18n name="房屋创建费用" namespace="roomCreatePayFee"></vc:i18n>
</h5>
<div class="ibox-tools" style="top:10px;">
</div>
</div>
<div class="ibox-content">
<div class="row">
<div class="col-sm-12">
<div class="form-group row">
<label class="col-sm-2 col-form-label text-right">
<vc:i18n name="费用类型" namespace="roomCreatePayFee"></vc:i18n>
</label>
<div class="col-sm-4">
<select class="custom-select" v-model="roomCreatePayFeeInfo.feeTypeCd"
@change="_changeFeeTypeCdX(roomCreatePayFeeInfo.feeTypeCd)">
<option selected disabled value="">
{{vc.i18n('必填,请选择费用类型','roomCreatePayFee')}}
</option>
<option v-for="(item,index) in roomCreatePayFeeInfo.feeTypeCds" :key="index"
v-bind:value="item.statusCd" v-if="item.statusCd != '888800010017'">
{{item.name}}
</option>
</select>
</div>
<label class="col-sm-2 col-form-label text-right">
<vc:i18n name="收费项目" namespace="roomCreatePayFee"></vc:i18n>
</label>
<div class="col-sm-4">
<select class="custom-select" v-model="roomCreatePayFeeInfo.configId"
@change="_roomCreatePayFeeIfOnceFee(roomCreatePayFeeInfo.configId)">
<option selected disabled value="">
{{vc.i18n('必填,请选择收费项目','roomCreatePayFee')}}
</option>
<option v-for="(item,index) in roomCreatePayFeeInfo.feeConfigs" :key="index"
v-bind:value="item.configId">{{item.feeName}}
</option>
</select>
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label text-right">
<vc:i18n name="计费起始时间" namespace="roomCreatePayFee"></vc:i18n>
</label>
<div class="col-sm-4">
<input v-model="roomCreatePayFeeInfo.startTime" type="text"
:placeholder="vc.i18n('必填,请填写计费起始时间','roomCreatePayFee')"
class="form-control roomCreateFeeStartTime">
</div>
<label class="col-sm-2 col-form-label text-right" v-show=" roomCreatePayFeeInfo.feeFlag != '1003006'">
<vc:i18n name="计费结束时间" namespace="roomCreatePayFee"></vc:i18n>
</label>
<div class="col-sm-4" v-show=" roomCreatePayFeeInfo.feeFlag != '1003006'">
<input v-model="roomCreatePayFeeInfo.endTime" type="text"
:placeholder="vc.i18n('必填,请填写计费结束时间','roomCreatePayFee')"
class="form-control roomCreateFeeEndTime">
</div>
</div>
<div class="form-group row" v-if="roomCreatePayFeeInfo.computingFormula == '4004'">
<label class="col-sm-2 col-form-label text-right">
<vc:i18n name="收费金额" namespace="roomCreatePayFee"></vc:i18n>
</label>
<div class="col-sm-4">
<input v-model="roomCreatePayFeeInfo.amount" type="text"
:placeholder="vc.i18n('必填,请填写收费金额','roomCreatePayFee')" class="form-control">
</div>
</div>
<div class="form-group row" v-if="roomCreatePayFeeInfo.computingFormula == '1102'">
<label class="col-sm-2 col-form-label text-right">
<vc:i18n name="递增周期" namespace="roomCreatePayFee"></vc:i18n>
</label>
<div class="col-sm-4">
<input v-model="roomCreatePayFeeInfo.rateCycle" type="text"
:placeholder="vc.i18n('必填,请填写递增周期,请填写月份','roomCreatePayFee')" class="form-control ">
</div>
<label class="col-sm-2 col-form-label text-right">
<vc:i18n name="计费递增率" namespace="roomCreatePayFee"></vc:i18n>
</label>
<div class="col-sm-4">
<input v-model="roomCreatePayFeeInfo.rate" type="text"
:placeholder="vc.i18n('必填,请填写递增率','roomCreatePayFee')" class="form-control ">
</div>
</div>
<div class="form-group row" v-show="roomCreatePayFeeInfo.computingFormula == '1102'">
<label class="col-sm-2 col-form-label text-right">
<vc:i18n name="递增开始时间" namespace="roomCreatePayFee"></vc:i18n>
</label>
<div class="col-sm-4">
<input v-model="roomCreatePayFeeInfo.rateStartTime" type="text"
:placeholder="vc.i18n('必填,请填写递增开始时间','roomCreatePayFee')"
class="form-control addRoomRateStartTime">
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label text-right">
<vc:i18n name="楼栋" namespace="roomCreatePayFee"></vc:i18n>
</label>
<div class="col-sm-4">
<select class="custom-select" v-model="roomCreatePayFeeInfo.floorId"
@change="_loadFloorRooms()">
<option selected disabled value="">{{vc.i18n('请选择楼栋','oweFeeCallable')}}</option>
<option :value="item.floorId" v-for="(item,index) in roomCreatePayFeeInfo.floors"
:key="index">{{item.floorNum}}</option>
</select>
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label text-right">
<vc:i18n name="房屋" namespace="roomCreatePayFee"></vc:i18n>
</label>
<div class="col-sm-10 padding-top-sm"
v-show="roomCreatePayFeeInfo.rooms && roomCreatePayFeeInfo.rooms.length >0 ">
<span class="margin-right">
<input type="checkbox" class="i-checks all-check" value=""
@click="checkAll($event)"> 全选
</span><br/>
<span class="margin-right" v-for="(item,index) in roomCreatePayFeeInfo.rooms">
<input type="checkbox" class="i-checks checkItem" v-bind:value="item.roomId"
v-model="roomCreatePayFeeInfo.roomIds">
<span v-if="item.unitNum != '0'">{{item.roomName}}</span>
<span v-else>{{item.floorNum}}-{{item.roomNum}}</span>
({{item.stateName}})
</span>
</div>
<div class="col-sm-8 padding-top-sm"
v-show="!roomCreatePayFeeInfo.rooms || roomCreatePayFeeInfo.rooms.length <1 ">
<span class="margin-right">
没有房屋
</span>
</div>
</div>
</div>
</div>
<div class="ibox-content">
<button class="btn btn-primary float-right" type="button" v-on:click="_saveRoomCreatePayFee()">
<i class="fa fa-check"></i>&nbsp;提交
</button>
<button type="button" class="btn btn-warning float-right" style="margin-right:20px;"
@click="vc.goBack()">
<vc:i18n name="返回" namespace="roomCreatePayFee"></vc:i18n>
</button>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,217 @@
(function (vc) {
vc.extends({
data: {
roomCreatePayFeeInfo: {
feeTypeCds: [],
feeConfigs: [],
remark: '',
floorId: '',
communityId: vc.getCurrentCommunity().communityId,
feeTypeCd: '',
configId: '',
roomIds: [],
rooms: [],
hasTime: 'OFF',
startTime: '',
endTime: '',
feeFlag: '',
computingFormula: '',
amount: '',
rateCycle: '',
rate: '',
rateStartTime: '',
floors: []
}
},
watch: {
'roomCreatePayFeeInfo.roomIds': {
deep: true,
handler: function () {
let checkObj = document.querySelectorAll('.all-check'); // 获取所有checkbox项
if ($that.roomCreatePayFeeInfo.roomIds.length < $that.roomCreatePayFeeInfo.rooms.length) {
checkObj[0].checked = false;
} else {
checkObj[0].checked = true;
}
}
}
},
_initMethod: function () {
vc.getDict('pay_fee_config', "fee_type_cd", function (_data) {
let _datanew = [];
_data.forEach((item, index) => {
if (item.statusCd != "888800010015" && item.statusCd != "888800010016") {
_datanew.push(item);
}
});
$that.roomCreatePayFeeInfo.feeTypeCds = _datanew;
});
vc.initDate('roomCreateFeeStartTime', function (_value) {
$that.roomCreatePayFeeInfo.startTime = _value;
});
vc.initDate('roomCreateFeeEndTime', function (_value) {
$that.roomCreatePayFeeInfo.endTime = _value;
});
vc.initDate('addRoomRateStartTime', function (_value) {
$that.roomCreatePayFeeInfo.rateStartTime = _value;
});
$that._loadFloors();
},
_initEvent: function () {
vc.on('roomCreatePayFee', 'notifySelectRooms', function (_selectRooms) {
let _roomIds = [];
_selectRooms.forEach(item => {
_roomIds.push(item.roomId);
})
$that.roomCreatePayFeeInfo.roomIds = _roomIds;
});
},
methods: {
roomCreatePayFeeValidate() {
return vc.validate.validate({
roomCreatePayFeeInfo: $that.roomCreatePayFeeInfo
}, {
'roomCreatePayFeeInfo.configId': [{
limit: "required",
param: "",
errInfo: "费用项不存在"
},],
});
},
_saveRoomCreatePayFee: function () {
if (!$that.roomCreatePayFeeValidate()) {
//侦听回传
vc.toast(vc.validate.errInfo);
return;
}
let _roomIds = $that.roomCreatePayFeeInfo.roomIds;
if (!_roomIds || _roomIds.length < 1) {
vc.toast('未包含房屋');
return;
}
vc.http.apiPost('/fee.roomCreatePayFee',
JSON.stringify($that.roomCreatePayFeeInfo),
{
emulateJSON: true
},
function (json, res) {
//vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
let _json = JSON.parse(json);
if (_json.code == 0) {
//关闭model
vc.goBack();
return;
} else {
vc.toast(_json.msg);
}
},
function (errInfo, error) {
console.log('请求失败处理');
vc.toast(errInfo);
});
},
_changeFeeTypeCdX: function (_feeTypeCd) {
// 押金默认开始时间为当前时间,结束时间+1月
if (_feeTypeCd == '888800010006' || _feeTypeCd == '888800010014') {
$that.roomCreatePayFeeInfo.startTime = vc.dateFormat(new Date());
$that.roomCreatePayFeeInfo.endTime = vc.addMonthDate(new Date(), 1);
}
$that.roomCreatePayFeeInfo.configId = '';
let param = {
params: {
page: 1,
row: 500,
communityId: vc.getCurrentCommunity().communityId,
feeTypeCd: _feeTypeCd,
isDefault: 'F',
valid: '1'
}
};
//发送get请求
vc.http.apiGet('/feeConfig.listFeeConfigs', param,
function (json, res) {
let _feeConfigManageInfo = JSON.parse(json);
$that.roomCreatePayFeeInfo.feeConfigs = _feeConfigManageInfo.feeConfigs;
},
function (errInfo, error) {
console.log('请求失败处理');
});
},
_loadFloors: function () {
let param = {
params: {
page: 1,
row: 100,
communityId: vc.getCurrentCommunity().communityId,
}
}
vc.http.apiGet(
'/floor.queryFloors',
param,
function (json, res) {
let _json = JSON.parse(json);
$that.roomCreatePayFeeInfo.floors = _json.apiFloorDataVoList;
},
function (errInfo, error) {
console.log('请求失败处理');
vc.toast(errInfo);
});
},
_loadFloorRooms: function () {
$that.roomCreatePayFeeInfo.rooms = [];
$that.roomCreatePayFeeInfo.roomIds = [];
if (!$that.roomCreatePayFeeInfo.floorId) {
return;
}
let param = {
params: {
page: 1,
row: 500,
communityId: vc.getCurrentCommunity().communityId,
floorId: $that.roomCreatePayFeeInfo.floorId
}
};
//发送get请求
vc.http.apiGet('/room.queryRooms',
param,
function (json) {
let _feeConfigInfo = JSON.parse(json);
$that.roomCreatePayFeeInfo.rooms = _feeConfigInfo.rooms;
if (_feeConfigInfo.rooms && _feeConfigInfo.rooms.length > 0) {
_feeConfigInfo.rooms.forEach(_room => {
$that.roomCreatePayFeeInfo.roomIds.push(_room.roomId);
})
}
},
function () {
console.log('请求失败处理');
}
);
},
_roomCreatePayFeeIfOnceFee(_configId) {
// 当费用类型不是押金/其他类型,并且是周期性费用时, 将结束时间清空
if ($that.roomCreatePayFeeInfo.feeTypeCd != '888800010006'
&& $that.roomCreatePayFeeInfo.feeTypeCd != '888800010014'
&& $that.roomCreatePayFeeInfo.feeFlag == '1003006') {
$that.roomCreatePayFeeInfo.endTime = '';
}
$that.roomCreatePayFeeInfo.feeConfigs.forEach(item => {
if (_configId == item.configId) {
$that.roomCreatePayFeeInfo.feeFlag = item.feeFlag;
$that.roomCreatePayFeeInfo.computingFormula = item.computingFormula;
return;
}
});
},
checkAll: function (e) {
let checkObj = document.querySelectorAll('.checkItem'); // 获取所有checkbox项
$that.roomCreatePayFeeInfo.roomIds = [];
if (e.target.checked) { // 判定全选checkbox的勾选状态
for (var i = 0; i < checkObj.length; i++) {
$that.roomCreatePayFeeInfo.roomIds.push(checkObj[i].value);
}
}
}
}
});
})(window.vc);

View File

@ -35,10 +35,6 @@
currentPage: 1,
},
_initMethod: function () {
/*if (vc.isBack()) {
console.log('back and select');
vc.component._loadListRoomCreateFeeInfo(DEFAULT_PAGE, DEFAULT_ROW);
}*/
vc.emit('roomTreeDiv', 'initRoomTreeDiv', {
callName: 'roomCreateFee'
});
@ -107,10 +103,11 @@
},
methods: {
_openRoomCreateFeeAddModal: function (_room, _isMore) {
vc.emit('roomCreateFeeAdd', 'openRoomCreateFeeAddModal', {
isMore: _isMore,
room: _room
});
// vc.emit('roomCreateFeeAdd', 'openRoomCreateFeeAddModal', {
// isMore: _isMore,
// room: _room
// });
vc.jumpToPage('/#/pages/fee/roomCreatePayFee')
},
listRoomInRoomCreateFee: function (_page, _row) {
let param = {