diff --git a/src/api/modules/edgeServer.api.js b/src/api/modules/edgeServer.api.js index 2085635..dc9ea76 100644 --- a/src/api/modules/edgeServer.api.js +++ b/src/api/modules/edgeServer.api.js @@ -93,5 +93,14 @@ export default ({ service, request, serviceForMock, requestForMock, mock, faker, }, url: url + '/Edge/DeviceData?data=__status' }) + }, + GET_DEVICE_POINT_VALUE(url, username, password, deviceName){ + return request({ + auth: { + username: username, + password: password + }, + url: url + '/Edge/BrowseDeviceDataNodes?data=' + deviceName + }) } }) diff --git a/src/views/edgeServer/edgeServerConfigure/device.vue b/src/views/edgeServer/edgeServerConfigure/device.vue index 38506d1..c77cc54 100644 --- a/src/views/edgeServer/edgeServerConfigure/device.vue +++ b/src/views/edgeServer/edgeServerConfigure/device.vue @@ -401,6 +401,7 @@ export default { }, async getDeviceConfigure (e) { this.deviceActiveStatus = e + const devicePointValue = this.getDevicePoint() this.devicePointData = [] // 当切换设备时把保存configure、point的数据清空 this.defaultDeviceName = '' const deviceData = await this.$api.GET_DEVICE_CONFIGURE(this.deviceData[e].id) @@ -413,15 +414,16 @@ export default { } // 获取point信息 if (conf.RequestNode !== undefined && conf.RequestNode.length > 0) { - this.devicePointData = each(conf.RequestNode, (o, i) => ( + this.devicePointData = each(conf.RequestNode, (o, i) => { assign(o, { id: i + 1, showBindButton: true, showSendButton: true, showCopyButton: true, - showRemoveButton: true + showRemoveButton: true, + "@Value": devicePointValue[o['@Name']] }) - )) + }) } } }, @@ -486,15 +488,18 @@ export default { } this.formOptions.saveLoading = false }, - async delDevicePoint ({ index, row }, done) { this.$delete(this.devicePointData, index) done() }, async getDevicePoint () { - const data = { action: 'add_node', server_id: this.serverData.id, device_id: this.deviceData[this.deviceActiveStatus].id } try { - this.devicePointData = await this.$api.GET_DEVICE_POINT(data) + let data = {} + const devicePointValue = await this.$api.GET_DEVICE_POINT_VALUE('http://' + this.serverData.url + ':' + this.serverData.port, 'admin', process.env.VUE_APP_HSLSERVER_PASSWORD, this.deviceData[this.deviceActiveStatus].name) + each(devicePointValue.Content, o=>{ + data[o.Name] = o.value || '' + }) + return data } catch (e) { console.log(e) } @@ -564,7 +569,6 @@ export default { console.log(e) } }, - async getDeviceStatus () { const res = await this.$api.GET_SERVER_DEVICE_STATUS('http://' + this.serverData.url + ':' + this.serverData.port, 'admin', process.env.VUE_APP_HSLSERVER_PASSWORD) if (res) { @@ -584,7 +588,7 @@ export default { } else { this.$emit('changeStatus', false) } - } + }, }, mounted () { this.getDevice()