优化 设备添加页面

This commit is contained in:
java110 2020-06-04 19:20:15 +08:00
parent d0f603d26b
commit f904aca34a
4 changed files with 81 additions and 50 deletions

View File

@ -60,12 +60,10 @@
<div class="col-sm-10">
<select class="custom-select" v-model="addMachineInfo.locationTypeCd">
<option selected disabled value="">必填,请选择设备位置</option>
<option value="1000">东大门</option>
<option value="1001">西大门</option>
<option value="1002">北大门</option>
<option value="1003">南大门</option>
<option value="2000">单元门</option>
<option value="3000">房屋门</option>
<option v-for="item in addMachineInfo.locations"
:label="item.locationName"
:value="item.locationId">{{item.locationName}}
</option>
</select>
</div>
</div>

View File

@ -24,7 +24,8 @@
locationTypeCd: '',
locationObjId: '',
roomName: '',
direction:''
direction: '',
locations: []
}
},
_initMethod: function () {
@ -32,6 +33,7 @@
},
_initEvent: function () {
vc.on('addMachine', 'openAddMachineModal', function () {
$that._loadLocation();
$('#addMachineModel').modal('show');
});
@ -44,7 +46,7 @@
vc.component.addMachineInfo.unitId = _param.unitId;
}
if(_param.hasOwnProperty("roomId")){
if (_param.hasOwnProperty("roomId")) {
vc.component.addMachineInfo.roomId = _param.roomId;
}
});
@ -92,7 +94,7 @@
errInfo: "设备类型格式错误"
},
],
'addMachineInfo.direction':
'addMachineInfo.direction':
[
{
limit: "required",
@ -207,6 +209,7 @@
});
},
clearAddMachineInfo: function () {
let _locations = $that.addMachineInfo.locations;
vc.component.addMachineInfo = {
machineCode: '',
machineVersion: '',
@ -215,7 +218,8 @@
authCode: '',
machineIp: '',
machineMac: '',
direction:''
direction: '',
locations: _locations
};
},
_initAddMachineData: function () {
@ -240,6 +244,25 @@
},
minimumInputLength: 2
});
},
_loadLocation: function () {
var param = {
params: {
communityId: vc.getCurrentCommunity().communityId,
page: 1,
row: 50
}
};
//发送get请求
vc.http.apiGet('communityLocation.listCommunityLocations',
param,
function (json, res) {
var _locationManageInfo = JSON.parse(json);
vc.component.addMachineInfo.locations = _locationManageInfo.data;
}, function (errInfo, error) {
console.log('请求失败处理');
}
);
}
}
});

View File

@ -1,5 +1,4 @@
<div id="editMachineModel" class="modal fade" role="dialog" aria-labelledby="exampleModalLabel"
aria-hidden="true">
<div id="editMachineModel" 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">
@ -11,21 +10,21 @@
<label class="col-sm-2 col-form-label">设备编码</label>
<div class="col-sm-10">
<input v-model="editMachineInfo.machineCode" type="text" placeholder="必填,请填写设备编码"
class="form-control">
class="form-control">
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">版本号</label>
<div class="col-sm-10">
<input v-model="editMachineInfo.machineVersion" type="text" placeholder="必填,请填写版本号"
class="form-control">
class="form-control">
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">设备名称</label>
<div class="col-sm-10">
<input v-model="editMachineInfo.machineName" type="text" placeholder="必填,请填写设备名称"
class="form-control">
class="form-control">
</div>
</div>
<div class="form-group row">
@ -51,7 +50,7 @@
<label class="col-sm-2 col-form-label">鉴权编码</label>
<div class="col-sm-10">
<input v-model="editMachineInfo.authCode" type="text" placeholder="必填,请填写鉴权编码"
class="form-control">
class="form-control">
</div>
</div>
<div class="form-group row">
@ -59,69 +58,57 @@
<div class="col-sm-10">
<select class="custom-select" v-model="editMachineInfo.locationTypeCd">
<option selected disabled value="">必填,请选择设备位置</option>
<option value="1000">东大门</option>
<option value="1001">西大门</option>
<option value="1002">北大门</option>
<option value="1003">南大门</option>
<option value="2000">单元门</option>
<option value="3000">房屋门</option>
<option v-for="item in editMachineInfo.locations" :label="item.locationName"
:value="item.locationId">{{item.locationName}}
</option>
</select>
</div>
</div>
</div>
<div class="form-group row"
v-show="editMachineInfo.locationTypeCd == '2000' || editMachineInfo.locationTypeCd == '3000' ">
v-show="editMachineInfo.locationTypeCd == '2000' || editMachineInfo.locationTypeCd == '3000' ">
<label class="col-sm-2 col-form-label">归属楼栋</label>
<div class="col-sm-10">
<vc:create path="property/floorSelect2"
parentModal="editMachineModel"
namespace="editMachine"
></vc:create>
<vc:create path="property/floorSelect2" parentModal="editMachineModel"
namespace="editMachine"></vc:create>
</div>
</div>
<div class="form-group row"
v-show="editMachineInfo.locationTypeCd == '2000' || editMachineInfo.locationTypeCd == '3000' ">
v-show="editMachineInfo.locationTypeCd == '2000' || editMachineInfo.locationTypeCd == '3000' ">
<label class="col-sm-2 col-form-label">归属单元</label>
<div class="col-sm-10">
<vc:create path="property/unitSelect2"
parentModal="editMachineModel"
callBackListener="editMachine"
callBackFunction="notify"
namespace="editMachine"
></vc:create>
<vc:create path="property/unitSelect2" parentModal="editMachineModel"
callBackListener="editMachine" callBackFunction="notify" namespace="editMachine">
</vc:create>
</div>
</div>
<div class="form-group row"
v-show="editMachineInfo.locationTypeCd == '3000' ">
<div class="form-group row" v-show="editMachineInfo.locationTypeCd == '3000' ">
<label class="col-sm-2 col-form-label">归属房屋</label>
<div class="col-sm-10">
<vc:create path="property/roomSelect2"
parentModal="editMachineModel"
callBackListener="editMachine"
callBackFunction="notify"
namespace="editMachine"
></vc:create>
<vc:create path="property/roomSelect2" parentModal="editMachineModel"
callBackListener="editMachine" callBackFunction="notify" namespace="editMachine">
</vc:create>
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">设备IP</label>
<div class="col-sm-10">
<input v-model="editMachineInfo.machineIp" type="text" placeholder="选填请填写设备IP"
class="form-control">
class="form-control">
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">设备MAC</label>
<div class="col-sm-10">
<input v-model="editMachineInfo.machineMac" type="text" placeholder="选填请填写设备MAC"
class="form-control">
class="form-control">
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">设备访问url</label>
<div class="col-sm-10">
<input v-model="editMachineInfo.machineUrl" readonly type="text" placeholder="选填请填写设备MAC"
class="form-control">
<input v-model="editMachineInfo.machineUrl" readonly type="text"
placeholder="选填请填写设备MAC" class="form-control">
</div>
</div>
@ -130,7 +117,7 @@
class="fa fa-check"></i>&nbsp;保存
</button>
<button type="button" class="btn btn-warning float-right" style="margin-right:20px;"
data-dismiss="modal">取消
data-dismiss="modal">取消
</button>
</div>
</div>
@ -139,4 +126,4 @@
</div>
</div>
</div>
</div>
</div>

View File

@ -21,7 +21,8 @@
locationObjId: '',
roomNum: '',
machineUrl: '',
direction:''
direction:'',
locations: []
}
},
@ -31,6 +32,7 @@
_initEvent: function () {
vc.on('editMachine', 'openEditMachineModal', function (_params) {
vc.component.refreshEditMachineInfo();
$that._loadEditLocation()
$('#editMachineModel').modal('show');
vc.copyObject(_params, vc.component.editMachineInfo);
vc.component._initMachineUrl();
@ -249,6 +251,7 @@
});
},
refreshEditMachineInfo: function () {
let _locations = $that.addMachineInfo.locations;
vc.component.editMachineInfo = {
machineId: '',
machineCode: '',
@ -268,9 +271,29 @@
locationObjId: '',
roomNum: '',
machineUrl: '',
direction:''
direction:'',
locations: _locations
}
},
_loadEditLocation: function () {
var param = {
params: {
communityId: vc.getCurrentCommunity().communityId,
page: 1,
row: 50
}
};
//发送get请求
vc.http.apiGet('communityLocation.listCommunityLocations',
param,
function (json, res) {
var _locationManageInfo = JSON.parse(json);
vc.component.editMachineInfo.locations = _locationManageInfo.data;
}, function (errInfo, error) {
console.log('请求失败处理');
}
);
}
}
});