Merge branch 'master' of ssh://118.195.187.246:10022/ysun/EdgeManager
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()
|
||||||
|
|||||||
@@ -8,9 +8,9 @@
|
|||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<!-- v-if="choosable === 'true'" -->
|
||||||
<el-form-item label="设备编码" v-if="choosable === 'true'">
|
<el-form-item label="设备编码" >
|
||||||
<el-select v-model="deviceConfigureModelValue.parent_device_code" placeholder="请选择">
|
<el-select filterable allow-create v-model="deviceConfigureModelValue['@ParentDeviceCode']" placeholder="请选择">
|
||||||
<el-option v-for="(item, i) in deviceCodeData" :key="i" :label="item.name" :value="item.code">
|
<el-option v-for="(item, i) in deviceCodeData" :key="i" :label="item.name" :value="item.code">
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
@@ -115,15 +115,17 @@ export default {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
this.rules = rules
|
this.rules = rules
|
||||||
this.deviceConfigureModelValue = this.choosable === 'true' ? assign(deviceConfigureModelValue, { parent_device_code: '' }) : deviceConfigureModelValue
|
this.deviceConfigureModelValue = assign(deviceConfigureModelValue, { '@ParentDeviceCode': '' })
|
||||||
|
//this.deviceConfigureModelValue = this.choosable === 'true' ? assign(deviceConfigureModelValue, { parent_device_code: '' }) : deviceConfigureModelValue
|
||||||
console.log(this.deviceConfigureModelValue)
|
console.log(this.deviceConfigureModelValue)
|
||||||
this.deviceConfigureFormItem = deviceConfigureFormItemData[e]
|
this.deviceConfigureFormItem = deviceConfigureFormItemData[e]
|
||||||
},
|
},
|
||||||
setDeviceDefaultFormItemValue (val) {
|
setDeviceDefaultFormItemValue (val) {
|
||||||
const deviceConfigureModelValue = {}
|
const deviceConfigureModelValue = {}
|
||||||
if (this.choosable === 'true') {
|
// if (this.choosable === 'true') {
|
||||||
deviceConfigureModelValue.parent_device_code = val.parent_device_code
|
// deviceConfigureModelValue["@ParentDeviceCode"] = val["@ParentDeviceCode"]
|
||||||
}
|
// }
|
||||||
|
deviceConfigureModelValue["@ParentDeviceCode"] = val["@ParentDeviceCode"]
|
||||||
each(deviceConfigureFormItemData[this.defaultDeviceTypeNameValue], (item) => {
|
each(deviceConfigureFormItemData[this.defaultDeviceTypeNameValue], (item) => {
|
||||||
if (item.type === 'time') {
|
if (item.type === 'time') {
|
||||||
deviceConfigureModelValue[item.key] = val[item.key] ? val[item.key] : new Date()
|
deviceConfigureModelValue[item.key] = val[item.key] ? val[item.key] : new Date()
|
||||||
|
|||||||
Reference in New Issue
Block a user