增加设备节点当前值获取HslServer的设备节点值功能
This commit is contained in:
@@ -93,5 +93,14 @@ export default ({ service, request, serviceForMock, requestForMock, mock, faker,
|
|||||||
},
|
},
|
||||||
url: url + '/Edge/DeviceData?data=__status'
|
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
|
||||||
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -401,6 +401,7 @@ export default {
|
|||||||
},
|
},
|
||||||
async getDeviceConfigure (e) {
|
async getDeviceConfigure (e) {
|
||||||
this.deviceActiveStatus = e
|
this.deviceActiveStatus = e
|
||||||
|
const devicePointValue = this.getDevicePoint()
|
||||||
this.devicePointData = [] // 当切换设备时把保存configure、point的数据清空
|
this.devicePointData = [] // 当切换设备时把保存configure、point的数据清空
|
||||||
this.defaultDeviceName = ''
|
this.defaultDeviceName = ''
|
||||||
const deviceData = await this.$api.GET_DEVICE_CONFIGURE(this.deviceData[e].id)
|
const deviceData = await this.$api.GET_DEVICE_CONFIGURE(this.deviceData[e].id)
|
||||||
@@ -413,15 +414,16 @@ export default {
|
|||||||
}
|
}
|
||||||
// 获取point信息
|
// 获取point信息
|
||||||
if (conf.RequestNode !== undefined && conf.RequestNode.length > 0) {
|
if (conf.RequestNode !== undefined && conf.RequestNode.length > 0) {
|
||||||
this.devicePointData = each(conf.RequestNode, (o, i) => (
|
this.devicePointData = each(conf.RequestNode, (o, i) => {
|
||||||
assign(o, {
|
assign(o, {
|
||||||
id: i + 1,
|
id: i + 1,
|
||||||
showBindButton: true,
|
showBindButton: true,
|
||||||
showSendButton: true,
|
showSendButton: true,
|
||||||
showCopyButton: true,
|
showCopyButton: true,
|
||||||
showRemoveButton: true
|
showRemoveButton: true,
|
||||||
|
"@Value": devicePointValue[o['@Name']]
|
||||||
|
})
|
||||||
})
|
})
|
||||||
))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -486,15 +488,18 @@ export default {
|
|||||||
}
|
}
|
||||||
this.formOptions.saveLoading = false
|
this.formOptions.saveLoading = false
|
||||||
},
|
},
|
||||||
|
|
||||||
async delDevicePoint ({ index, row }, done) {
|
async delDevicePoint ({ index, row }, done) {
|
||||||
this.$delete(this.devicePointData, index)
|
this.$delete(this.devicePointData, index)
|
||||||
done()
|
done()
|
||||||
},
|
},
|
||||||
async getDevicePoint () {
|
async getDevicePoint () {
|
||||||
const data = { action: 'add_node', server_id: this.serverData.id, device_id: this.deviceData[this.deviceActiveStatus].id }
|
|
||||||
try {
|
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) {
|
} catch (e) {
|
||||||
console.log(e)
|
console.log(e)
|
||||||
}
|
}
|
||||||
@@ -564,7 +569,6 @@ export default {
|
|||||||
console.log(e)
|
console.log(e)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
async getDeviceStatus () {
|
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)
|
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) {
|
if (res) {
|
||||||
@@ -584,7 +588,7 @@ export default {
|
|||||||
} else {
|
} else {
|
||||||
this.$emit('changeStatus', false)
|
this.$emit('changeStatus', false)
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
mounted () {
|
mounted () {
|
||||||
this.getDevice()
|
this.getDevice()
|
||||||
|
|||||||
Reference in New Issue
Block a user