优化公摊

This commit is contained in:
java110 2020-09-10 19:30:13 +08:00
parent 45e284f15a
commit ea90ba9ad1
4 changed files with 344 additions and 0 deletions

View File

@ -0,0 +1,102 @@
<div id="feeSharingModel" class="modal fade" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-body">
<h3 class="m-t-none m-b ">费用公摊</h3>
<div class="ibox-content">
<div>
<div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">费用名称</label>
<div class="col-sm-10">
<input v-model="feeSharingInfo.feeName" type="text" placeholder="必填,请填写费用名称"
class="form-control ">
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">费用类型</label>
<div class="col-sm-10">
<select class="custom-select" v-model="feeSharingInfo.feeTypeCd">
<option selected disabled value="">必填,请选择费用类型</option>
<option value="888800010017" >公摊费</option>
</select></div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">使用量</label>
<div class="col-sm-10">
<input v-model="feeSharingInfo.totalDegrees" type="text" placeholder="必填,请填写当期使用量"
class="form-control ">
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">公摊范围</label>
<div class="col-sm-10">
<select class="custom-select" v-model="feeSharingInfo.scope">
<option selected disabled value="">必填,请选择公摊范围</option>
<option value="1001">当前小区</option>
<option value="2002">楼栋</option>
<option value="3003">单元</option>
</select>
</div>
</div>
<div class="form-group row" v-show="feeSharingInfo.scope != '1001'">
<label class="col-sm-2 col-form-label">楼栋</label>
<div class="col-sm-10">
<vc:create path="property/floorSelect2" parentModal="feeSharingModel" namespace="feeSharing">
</vc:create>
</div>
</div>
<div class="form-group row" v-show="feeSharingInfo.scope == '3003'">
<label class="col-sm-2 col-form-label">单元</label>
<div class="col-sm-10">
<vc:create path="property/unitSelect2" parentModal="feeSharingModel"
callBackListener="feeSharing" callBackFunction="notify" namespace="feeSharing">
</vc:create>
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">公摊公式</label>
<div class="col-sm-10">
<select class="custom-select" v-model="feeSharingInfo.formulaId">
<option selected disabled value="">必填,请选择收费项目</option>
<option v-for="(item,index) in feeSharingInfo.formulas" :key="index"
v-bind:value="item.formulaId">{{item.formulaValue}}
</option>
</select>
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">开始时间</label>
<div class="col-sm-10">
<input v-model="feeSharingInfo.startTime" type="text" placeholder="必填,请填写费用开始时间"
class="form-control feeSharingStartTime">
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">结束时间</label>
<div class="col-sm-10">
<input v-model="feeSharingInfo.endTIme" type="text" placeholder="必填,请填写费用结束时间"
class="form-control feeSharingEndTime">
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">备注</label>
<div class="col-sm-10">
<input v-model="feeSharingInfo.remark" type="text" placeholder="选填,请填写备注" class="form-control">
</div>
</div>
<div class="ibox-content">
<button class="btn btn-primary float-right" type="button" v-on:click="saveFeeSharingInfo()"><i
class="fa fa-check"></i>&nbsp;保存</button>
<button type="button" class="btn btn-warning float-right" style="margin-right:20px;"
data-dismiss="modal">取消</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,233 @@
(function (vc) {
vc.extends({
data: {
feeSharingInfo: {
totalDegrees: '',
scope: '1001',
formulaId: '',
floorId: '',
unitId: '',
objId: '',
feeTypeCd: '',
startTime: '',
endTime: '',
feeName: '',
formulas: [],
remark:''
}
},
_initMethod: function () {
$that._initFeeSharingDateInfo();
$that._loadFormula();
},
_initEvent: function () {
vc.on('feeSharing', 'openFeeSharingModal', function (_param) {
$('#feeSharingModel').modal('show');
});
vc.on("feeSharing", "notify", function (_param) {
if (_param.hasOwnProperty("floorId")) {
vc.component.feeSharingInfo.floorId = _param.floorId;
}
if (_param.hasOwnProperty("unitId")) {
vc.component.feeSharingInfo.unitId = _param.unitId;
}
});
},
methods: {
_initFeeSharingDateInfo: function () {
$('.feeSharingStartTime').datetimepicker({
language: 'zh-CN',
fontAwesome: 'fa',
format: 'yyyy-mm-dd hh:ii:ss',
initTime: true,
initialDate: new Date(),
autoClose: 1,
todayBtn: true
});
$('.feeSharingStartTime').datetimepicker()
.on('changeDate', function (ev) {
var value = $(".feeSharingStartTime").val();
vc.component.feeSharingInfo.startTime = value;
});
$('.feeSharingEndTime').datetimepicker({
language: 'zh-CN',
fontAwesome: 'fa',
format: 'yyyy-mm-dd hh:ii:ss',
initTime: true,
initialDate: new Date(),
autoClose: 1,
todayBtn: true
});
$('.feeSharingEndTime').datetimepicker()
.on('changeDate', function (ev) {
var value = $(".feeSharingEndTime").val();
var start = Date.parse(new Date(vc.component.feeSharingInfo.startTime))
var end = Date.parse(new Date(value))
if (start - end >= 0) {
vc.toast("结束时间必须大于开始时间")
$(".addCurReadingTime").val('')
} else {
vc.component.feeSharingInfo.endTime = value;
}
});
},
feeSharingValidate() {
return vc.validate.validate({
feeSharingInfo: vc.component.feeSharingInfo
}, {
'feeSharingInfo.totalDegrees': [
{
limit: "required",
param: "",
errInfo: "使用量不能为空"
},
{
limit: "money",
param: "",
errInfo: "使用量格式错误如100.00"
}
],
'feeSharingInfo.scope': [
{
limit: "required",
param: "",
errInfo: "使用范围不能为空"
}
],
'feeSharingInfo.formulaId': [
{
limit: "required",
param: "",
errInfo: "公摊公式不能为空"
}
],
'feeSharingInfo.startTime': [
{
limit: "required",
param: "",
errInfo: "开始时间不能为空"
},
{
limit: "dateTime",
param: "",
errInfo: "开始时间格式错误"
},
], 'feeSharingInfo.endTime': [
{
limit: "required",
param: "",
errInfo: "结束时间不能为空"
},
{
limit: "dateTime",
param: "",
errInfo: "结束时间格式错误"
},
],
'feeSharingInfo.feeName': [
{
limit: "required",
param: "",
errInfo: "费用名称必填"
}
]
});
},
saveFeeSharingInfo: function () {
if($that.feeSharingInfo.scope == '1001'){
$that.feeSharingInfo.objId = vc.getCurrentCommunity().communityId;
}else if($that.feeSharingInfo.scope == '1001'){
$that.feeSharingInfo.objId = $that.feeSharingInfo.floorId;
}else{
$that.feeSharingInfo.objId = $that.feeSharingInfo.unitId;
}
if (!vc.component.feeSharingValidate()) {
vc.toast(vc.validate.errInfo);
return;
}
let _objId = $that.feeSharingInfo.objId;
if(_objId == '' || _objId == '-1'){
vc.toast("请选择公摊楼栋或者单元");
return ;
}
vc.component.feeSharingInfo.communityId = vc.getCurrentCommunity().communityId;
vc.http.apiPost(
'/importFee/feeSharing',
JSON.stringify(vc.component.feeSharingInfo),
{
emulateJSON: true
},
function (json, res) {
//vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
let _json = JSON.parse(json);
if (_json.code == 0) {
//关闭model
$('#feeSharingModel').modal('hide');
vc.component.clearFeeSharingInfo();
vc.emit('roomFeeImport', 'listFee', {});
return;
}
vc.message(_json.msg);
},
function (errInfo, error) {
console.log('请求失败处理');
vc.message(errInfo);
});
},
_loadFormula: function (_roomId) {
var param = {
params: {
communityId: vc.getCurrentCommunity().communityId,
page: 1,
row: 50
}
};
//发送get请求
vc.http.apiGet('/feeFormula/queryFeeFormula', param,
function (json, res) {
let _formulas = JSON.parse(json);
let _total = _formulas.total;
if (_total < 1) {
return;
}
$that.feeSharingInfo.formulas = _formulas.data;
},
function (errInfo, error) {
console.log('请求失败处理');
});
},
clearFeeSharingInfo: function () {
let _formulas = $that.feeSharingInfo.formulas;
vc.component.feeSharingInfo = {
totalDegrees: '',
scope: '1001',
formulaId: '',
floorId: '',
unitId: '',
objId: '',
feeTypeCd: '',
startTime: '',
endTime: '',
feeName: '',
formulas: _formulas,
remark:''
};
}
}
});
})(window.vc);

View File

@ -44,6 +44,10 @@
<div class="ibox-title">
<h5>费用导入</h5>
<div class="ibox-tools" style="top:10px;">
<button type="button" class="btn btn-primary btn-sm" style="margin-left:10px"
v-on:click="_openFeeSharing(null,true)">
费用公摊
</button>
<button type="button" class="btn btn-primary btn-sm" style="margin-left:10px"
v-on:click="_openRoomFeeImport(null,true)">
费用导入
@ -93,4 +97,6 @@
</div>
</div>
<vc:create path="property/importRoomFee"></vc:create>
<vc:create path="property/feeSharing"></vc:create>
</div>

View File

@ -78,6 +78,9 @@
} else {
vc.component.roomFeeImport.moreCondition = true;
}
},
_openFeeSharing:function(){
vc.emit('feeSharing', 'openFeeSharingModal',{});
}
}
});