优化 设备添加页面

This commit is contained in:
java110 2020-06-04 19:37:31 +08:00
parent 595b3c3665
commit 8af7a67397
4 changed files with 41 additions and 24 deletions

View File

@ -58,7 +58,7 @@
<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="addMachineInfo.locationTypeCd" @change="onChangeLocation">
<select class="custom-select" v-model="addMachineInfo.locationTypeCd" @change="onAddChangeLocation">
<option selected disabled value="">必填,请选择设备位置</option>
<option v-for="item in addMachineInfo.locations"
:label="item.locationName"

View File

@ -25,6 +25,7 @@
locationObjId: '',
roomName: '',
direction: '',
locationType: '',
locations: []
}
},
@ -219,6 +220,7 @@
machineIp: '',
machineMac: '',
direction: '',
locationType: '',
locations: _locations
};
},
@ -263,6 +265,15 @@
console.log('请求失败处理');
}
);
},
onAddChangeLocation: function (e) {
let _locationTypeCd = $that.addMachineInfo.locationTypeCd;
$that.addMachineInfo.locations.forEach(item => {
if (item.locationId == _locationTypeCd) {
$that.addMachineInfo.locationType = item.locationType;
}
});
}
}
});

View File

@ -56,7 +56,7 @@
<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="editMachineInfo.locationTypeCd">
<select class="custom-select" v-model="editMachineInfo.locationTypeCd" @change="onAddChangeLocation">
<option selected disabled value="">必填,请选择设备位置</option>
<option v-for="item in editMachineInfo.locations" :label="item.locationName"
:value="item.locationId">{{item.locationName}}
@ -66,7 +66,7 @@
</div>
</div>
<div class="form-group row"
v-show="editMachineInfo.locationTypeCd == '2000' || editMachineInfo.locationTypeCd == '3000' ">
v-show="editMachineInfo.locationType == '2000' || editMachineInfo.locationType == '3000' ">
<label class="col-sm-2 col-form-label">归属楼栋</label>
<div class="col-sm-10">
<vc:create path="property/floorSelect2" parentModal="editMachineModel"
@ -74,7 +74,7 @@
</div>
</div>
<div class="form-group row"
v-show="editMachineInfo.locationTypeCd == '2000' || editMachineInfo.locationTypeCd == '3000' ">
v-show="editMachineInfo.locationType == '2000' || editMachineInfo.locationType == '3000' ">
<label class="col-sm-2 col-form-label">归属单元</label>
<div class="col-sm-10">
<vc:create path="property/unitSelect2" parentModal="editMachineModel"
@ -82,7 +82,7 @@
</vc:create>
</div>
</div>
<div class="form-group row" v-show="editMachineInfo.locationTypeCd == '3000' ">
<div class="form-group row" v-show="editMachineInfo.locationType == '3000' ">
<label class="col-sm-2 col-form-label">归属房屋</label>
<div class="col-sm-10">
<vc:create path="property/roomSelect2" parentModal="editMachineModel"

View File

@ -21,8 +21,8 @@
locationObjId: '',
roomNum: '',
machineUrl: '',
direction:'',
locationType:'',
direction: '',
locationType: '',
locations: []
}
@ -143,18 +143,18 @@
},
],
'editMachineInfo.direction':
[
{
limit: "required",
param: "",
errInfo: "设备方向不能为空"
},
{
limit: "num",
param: "",
errInfo: "设备方向格式错误"
},
],
[
{
limit: "required",
param: "",
errInfo: "设备方向不能为空"
},
{
limit: "num",
param: "",
errInfo: "设备方向格式错误"
},
],
'editMachineInfo.authCode':
[
{
@ -272,9 +272,9 @@
locationObjId: '',
roomNum: '',
machineUrl: '',
direction:'',
locationType:'',
locations: _locations
direction: '',
locationType: '',
locations: _locations
}
},
@ -297,8 +297,14 @@
}
);
},
onChangeLocation:function(e){
console.log(e);
onChangeLocation: function (e) {
let _locationTypeCd = $that.editMachineInfo.locationTypeCd;
$that.editMachineInfo.locations.forEach(item => {
if (item.locationId == _locationTypeCd) {
$that.editMachineInfo.locationType = item.locationType;
}
});
}
}
});