优化代码

This commit is contained in:
wuxw 2022-06-29 00:20:08 +08:00
parent 85a934ffbd
commit 23396a58af
3 changed files with 50 additions and 12 deletions

View File

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

View File

@ -4,7 +4,11 @@
editFeeInfo: {
feeId: '',
startTime: '',
endTime: ''
endTime: '',
computingFormula: '',
rateCycle: '',
rate: '',
rateStartTime: ''
}
},
_initMethod: function () {
@ -63,6 +67,15 @@
vc.component.editFeeInfo.endTime = value;
}
});
vc.initDate('rateStartTime', function (_endTime) {
$that.editFeeInfo.rateStartTime = _endTime;
let start = Date.parse(new Date($that.editFeeInfo.startTime))
let end = Date.parse(new Date($that.editFeeInfo.rateStartTime))
if (start - end >= 0) {
vc.toast("递增开始时间必须大于开始时间")
$that.editFeeInfo.rateStartTime = '';
}
});
//防止多次点击时间插件失去焦点
document.getElementsByClassName("form-control editFeeStartTime")[0].addEventListener('click', myfunc)
@ -78,19 +91,19 @@
},
editFeeValidate() {
return vc.validate.validate({
editFeeInfo: vc.component.editFeeInfo
},
editFeeInfo: vc.component.editFeeInfo
},
{
'editFeeInfo.startTime': [{
limit: "required",
param: "",
errInfo: "建账时间不能为空"
},
{
limit: "dateTime",
param: "",
errInfo: "建账时间不是有效的时间格式"
},
{
limit: "dateTime",
param: "",
errInfo: "建账时间不是有效的时间格式"
},
],
'editFeeInfo.endTime': [{
limit: "required",
@ -107,8 +120,8 @@
}
vc.component.editFeeInfo.communityId = vc.getCurrentCommunity().communityId;
vc.http.apiPost('fee.updateFee', JSON.stringify(vc.component.editFeeInfo), {
emulateJSON: true
},
emulateJSON: true
},
function (json, res) {
//vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
if (res.status == 200) {
@ -134,7 +147,11 @@
vc.component.editFeeInfo = {
feeId: '',
startTime: '',
endTime: ''
endTime: '',
computingFormula: '',
rateCycle: '',
rate: '',
rateStartTime: ''
};
}
}

View File

@ -236,7 +236,10 @@
feeFlag: '',
endTime: '',
computingFormula: '',
amount: ''
amount: '',
rateCycle: '',
rate: '',
rateStartTime: ''
};
$that.roomCreateFeeAddInfo.feeTypeCds = _feeTypeCds;
},