优化代码

This commit is contained in:
java110 2021-11-19 11:23:08 +08:00
parent c75cfbcbc0
commit 5665117df3
8 changed files with 79 additions and 45 deletions

View File

@ -21,7 +21,8 @@
<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="addMeterWaterInfo.configId">
<select class="custom-select" v-model="addMeterWaterInfo.configId"
@change="changeFeeConfig()">
<option selected disabled value="">必填,请选择收费项目</option>
<option v-for="(item,index) in addMeterWaterInfo.feeConfigs" :key="index"
v-bind:value="item.configId">{{item.feeName}}
@ -85,7 +86,7 @@
<label class="col-sm-2 col-form-label">本期度数</label>
<div class="col-sm-10">
<input v-model="addMeterWaterInfo.curDegrees" type="text" placeholder="必填,请填写本期度数"
class="form-control addCurDegrees" @change="_getChange()">
class="form-control addCurDegrees" @change="_getChange()">
</div>
</div>
<div class="form-group row">
@ -102,6 +103,13 @@
placeholder="必填,请填写本期读表时间" class="form-control addCurReadingTime">
</div>
</div>
<div class="form-group row" v-if="addMeterWaterInfo.computingFormula == '9009'">
<label class="col-sm-2 col-form-label">单价</label>
<div class="col-sm-10">
<input v-model="addMeterWaterInfo.price" 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">
@ -109,6 +117,7 @@
class="form-control">
</div>
</div>
<div class="ibox-content">
<span>单元选择为0表示为商铺</span>
<button class="btn btn-primary float-right" type="button"

View File

@ -23,7 +23,8 @@
hasRoom: false,
ownerName: '',
objType: '3333',
meterTypes: []
meterTypes: [],
computingFormula:''
}
},
_initMethod: function () {
@ -289,6 +290,7 @@
}
$that.addMeterWaterInfo.preDegrees = _meterWaterInfo.data[0].curDegrees;
$that.addMeterWaterInfo.preReadingTime = _meterWaterInfo.data[0].curReadingTime;
$that.addMeterWaterInfo.price = _meterWaterInfo.data[0].price;
},
function (errInfo, error) {
console.log('请求失败处理');
@ -343,8 +345,17 @@
hasRoom: false,
ownerName: '',
objType: '3333',
meterTypes: []
meterTypes: [],
computingFormula:''
};
},
changeFeeConfig:function(){
let _configId = $that.addMeterWaterInfo.configId;
$that.addMeterWaterInfo.feeConfigs.forEach(item => {
if(_configId == item.configId){
$that.addMeterWaterInfo.computingFormula = item.computingFormula;
}
});
}
}
});

View File

@ -56,9 +56,7 @@
<div class="col-sm-10">
<select class="custom-select" v-model="addRoomViewInfo.roomSubType">
<option selected disabled value="">必填,请选择房屋类型</option>
<option value="110">住宅</option>
<option value="120">办公</option>
<option value="119">宿舍</option>
<option :value="item.statusCd" v-for="(item,index) in addRoomViewInfo.roomSubTypes">{{item.name}}</option>
</select>
</div>
</div>

View File

@ -22,7 +22,8 @@
roomArea: '',
roomRent: '0',
communityId: vc.getCurrentCommunity().communityId,
attrs: []
attrs: [],
roomSubTypes: []
}
},
watch: {
@ -35,63 +36,68 @@
},
_initMethod: function () {
$that._loadRoomAttrSpec();
//与字典表关联
vc.getDict('building_room', "room_sub_type", function (_data) {
vc.component.addRoomViewInfo.roomSubTypes = _data;
});
},
_initEvent: function () {
vc.on('addRoomViewInfo', 'onIndex',
function (_index) {
vc.component.addRoomViewInfo.index = _index;
});
},
methods: {
addRoomValidate() {
vc.component.addRoomViewInfo.apartment = vc.component.addRoomViewInfo.apartment1 + vc.component.addRoomViewInfo.apartment2;
return vc.validate.validate({
addRoomViewInfo: vc.component.addRoomViewInfo
},
addRoomViewInfo: vc.component.addRoomViewInfo
},
{
'addRoomViewInfo.roomNum': [{
limit: "required",
param: "",
errInfo: "房屋编号不能为空"
},
{
limit: "maxLength",
param: "12",
errInfo: "房屋编号长度不能超过12位"
},
{
limit: "maxLength",
param: "12",
errInfo: "房屋编号长度不能超过12位"
},
],
'addRoomViewInfo.layer': [{
limit: "required",
param: "",
errInfo: "房屋楼层不能为空"
},
{
limit: "num",
param: "",
errInfo: "房屋楼层高度必须为数字"
},
{
limit: "num",
param: "",
errInfo: "房屋楼层高度必须为数字"
},
],
'addRoomViewInfo.apartment': [{
limit: "required",
param: "",
errInfo: "房屋户型不能为空"
},
{
limit: "maxLength",
param: "50",
errInfo: "房屋户型不能大于50"
},
{
limit: "maxLength",
param: "50",
errInfo: "房屋户型不能大于50"
},
],
'addRoomViewInfo.builtUpArea': [{
limit: "required",
param: "",
errInfo: "建筑面积不能为空"
},
{
limit: "money",
param: "",
errInfo: "建筑面积错误,如 300.00"
},
{
limit: "money",
param: "",
errInfo: "建筑面积错误,如 300.00"
},
],
'addRoomViewInfo.roomArea': [{
limit: "required",
@ -121,11 +127,11 @@
param: "",
errInfo: "房屋状态不能为空"
},
{
limit: "maxLength",
param: "12",
errInfo: "房屋状态 不能超过12位"
},
{
limit: "maxLength",
param: "12",
errInfo: "房屋状态 不能超过12位"
},
],
'addRoomViewInfo.roomSubType': [{
limit: "required",
@ -150,7 +156,7 @@
$that._loadAttrValue(item.specCd, item.values);
$that.addRoomViewInfo.attrs.push(item);
}
console.log('attrs : ',$that.addRoomViewInfo.attrs);
console.log('attrs : ', $that.addRoomViewInfo.attrs);
});
});
},
@ -168,11 +174,11 @@
// 验证attr必填项
let msg = '';
vc.component.addRoomViewInfo.attrs.forEach((item) => {
if (item.required == 'Y' && item.value == ""){
if (item.required == 'Y' && item.value == "") {
msg = item.specHoldplace;
}
})
if(msg){
if (msg) {
return;
}
//侦听回传

View File

@ -69,9 +69,8 @@
<div class="col-sm-10">
<select class="custom-select" v-model="editRoomInfo.roomSubType">
<option selected disabled value="">必填,请选择房屋类型</option>
<option value="110">住宅</option>
<option value="120">办公</option>
<option value="119">宿舍</option>
<option :value="item.statusCd" v-for="(item,index) in editRoomInfo.roomSubTypes">{{item.name}}</option>
</select>
</div>
</div>

View File

@ -21,14 +21,20 @@
roomSubType: '110',
roomArea: '',
roomRent: '0',
roomSubTypes: []
}
},
_initMethod: function () {
$that._loadRoomAttrSpec();
},
_initEvent: function () {
vc.on('editRoom', 'openEditRoomModal', function (_room) {
$that.refreshEditRoomInfo();
//与字典表关联
vc.getDict('building_room', "room_sub_type", function (_data) {
vc.component.editRoomInfo.roomSubTypes = _data;
});
vc.copyObject(_room, vc.component.editRoomInfo);
vc.component.loadUnitsFromEditRoom(_room.floorId);
$('#editRoomModel').modal('show');
@ -282,6 +288,7 @@
roomSubType: '110',
roomArea: '',
roomRent: '0',
roomSubTypes: []
}
}
}

View File

@ -71,9 +71,7 @@
<select class="form-control-sm form-control input-s-sm inline"
v-model="roomInfo.conditions.roomSubType">
<option selected disabled value="">必填,请选择房屋类型</option>
<option value="110">住宅</option>
<option value="120">办公</option>
<option value="119">宿舍</option>
<option :value="item.statusCd" v-for="(item,index) in roomInfo.roomSubTypes">{{item.name}}</option>
</select>
</div>
</div>

View File

@ -28,7 +28,8 @@
roomSubType: ''
},
currentPage: DEFAULT_PAGE,
listColumns: []
listColumns: [],
roomSubTypes: []
}
},
_initMethod: function () {
@ -39,6 +40,11 @@
vc.getDict('building_room', "state", function (_data) {
vc.component.roomInfo.states = _data;
});
//与字典表关联
vc.getDict('building_room', "room_sub_type", function (_data) {
vc.component.roomInfo.roomSubTypes = _data;
});
//根据 参数查询相应数据
//vc.component._loadDataByParam();
},