diff --git a/public/components/property/addMachine/addMachine.html b/public/components/property/addMachine/addMachine.html index 307322ff6..8231ec9ee 100644 --- a/public/components/property/addMachine/addMachine.html +++ b/public/components/property/addMachine/addMachine.html @@ -60,12 +60,10 @@
diff --git a/public/components/property/addMachine/addMachine.js b/public/components/property/addMachine/addMachine.js index 7e5536eee..8d954d0f9 100644 --- a/public/components/property/addMachine/addMachine.js +++ b/public/components/property/addMachine/addMachine.js @@ -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('请求失败处理'); + } + ); } } }); diff --git a/public/components/property/editMachine/editMachine.html b/public/components/property/editMachine/editMachine.html index 56d2700c6..96707758a 100644 --- a/public/components/property/editMachine/editMachine.html +++ b/public/components/property/editMachine/editMachine.html @@ -1,5 +1,4 @@ - - + \ No newline at end of file diff --git a/public/components/property/editMachine/editMachine.js b/public/components/property/editMachine/editMachine.js index 4e25f1aa9..04f331fdd 100644 --- a/public/components/property/editMachine/editMachine.js +++ b/public/components/property/editMachine/editMachine.js @@ -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('请求失败处理'); + } + ); } } });