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'
|
||||
})
|
||||
},
|
||||
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) {
|
||||
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()
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="设备编码" v-if="choosable === 'true'">
|
||||
<el-select v-model="deviceConfigureModelValue.parent_device_code" placeholder="请选择">
|
||||
<!-- v-if="choosable === 'true'" -->
|
||||
<el-form-item label="设备编码" >
|
||||
<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>
|
||||
</el-select>
|
||||
@@ -115,15 +115,17 @@ export default {
|
||||
}
|
||||
})
|
||||
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)
|
||||
this.deviceConfigureFormItem = deviceConfigureFormItemData[e]
|
||||
},
|
||||
setDeviceDefaultFormItemValue (val) {
|
||||
const deviceConfigureModelValue = {}
|
||||
if (this.choosable === 'true') {
|
||||
deviceConfigureModelValue.parent_device_code = val.parent_device_code
|
||||
}
|
||||
// if (this.choosable === 'true') {
|
||||
// deviceConfigureModelValue["@ParentDeviceCode"] = val["@ParentDeviceCode"]
|
||||
// }
|
||||
deviceConfigureModelValue["@ParentDeviceCode"] = val["@ParentDeviceCode"]
|
||||
each(deviceConfigureFormItemData[this.defaultDeviceTypeNameValue], (item) => {
|
||||
if (item.type === 'time') {
|
||||
deviceConfigureModelValue[item.key] = val[item.key] ? val[item.key] : new Date()
|
||||
|
||||
Reference in New Issue
Block a user