更改设备配置json文件、添加数字输入框、修复设备监控页面BUG
This commit is contained in:
@@ -85,5 +85,5 @@ export default ({ service, request, serviceForMock, requestForMock, mock, faker,
|
||||
GET_ALL_DEVICES () {
|
||||
return request({ url: '?query=all_devices' })
|
||||
},
|
||||
SET_SERVER_EXEC: (data) => handlePost(request, data),
|
||||
SET_SERVER_EXEC: (data) => handlePost(request, data)
|
||||
})
|
||||
|
||||
@@ -74,7 +74,7 @@ export default {
|
||||
components: {
|
||||
DeviceConfigure: () => import('./deviceConfigure')
|
||||
},
|
||||
data() {
|
||||
data () {
|
||||
return {
|
||||
active: '',
|
||||
columns: [
|
||||
@@ -173,7 +173,7 @@ export default {
|
||||
text: '绑定',
|
||||
size: 'mini',
|
||||
emit: 'banding',
|
||||
show(index, row) {
|
||||
show (index, row) {
|
||||
if (row.showBindButton) {
|
||||
return true
|
||||
}
|
||||
@@ -183,7 +183,7 @@ export default {
|
||||
{
|
||||
text: '发送',
|
||||
size: 'mini',
|
||||
show(index, row) {
|
||||
show (index, row) {
|
||||
if (row.showSendButton) {
|
||||
return true
|
||||
}
|
||||
@@ -193,7 +193,7 @@ export default {
|
||||
{
|
||||
text: '复制',
|
||||
size: 'mini',
|
||||
show(index, row) {
|
||||
show (index, row) {
|
||||
if (row.showCopyButton) {
|
||||
return true
|
||||
}
|
||||
@@ -205,7 +205,7 @@ export default {
|
||||
size: 'mini',
|
||||
|
||||
confirm: true,
|
||||
show(index, row) {
|
||||
show (index, row) {
|
||||
if (row.showRemoveButton) {
|
||||
return true
|
||||
}
|
||||
@@ -298,7 +298,7 @@ export default {
|
||||
},
|
||||
watch: {
|
||||
server: {
|
||||
handler(val) {
|
||||
handler (val) {
|
||||
this.serverData = val
|
||||
this.getDevice()
|
||||
},
|
||||
@@ -306,23 +306,23 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
addRow() {
|
||||
addRow () {
|
||||
this.$refs.d2Crud.showDialog({
|
||||
mode: 'add'
|
||||
})
|
||||
},
|
||||
handleFormDataChange({ key }) {
|
||||
handleFormDataChange ({ key }) {
|
||||
if (key === 'workingSubclass') {
|
||||
const { workingSubclass } = this.$refs.d2Crud.formData
|
||||
this.getCodesByWorkingSubclass(workingSubclass)
|
||||
this.$refs.d2Crud.$forceUpdate()
|
||||
}
|
||||
},
|
||||
handleCellDataChange({ rowIndex, row }) {
|
||||
handleCellDataChange ({ rowIndex, row }) {
|
||||
this.devicePointData[rowIndex] = row
|
||||
this.setDeviceConfigure()
|
||||
},
|
||||
bandingNodeTemplate({ index }) {
|
||||
bandingNodeTemplate ({ index }) {
|
||||
this.$refs.d2Crud.showDialog({
|
||||
mode: 'edit',
|
||||
rowIndex: index,
|
||||
@@ -349,14 +349,14 @@ export default {
|
||||
}
|
||||
})
|
||||
},
|
||||
handleDialogCancel(done) {
|
||||
handleDialogCancel (done) {
|
||||
this.$message({
|
||||
message: '用户取消保存',
|
||||
type: 'warning'
|
||||
})
|
||||
done()
|
||||
},
|
||||
handleCommand(command) {
|
||||
handleCommand (command) {
|
||||
switch (command) {
|
||||
case 'add':
|
||||
this.addDevice()
|
||||
@@ -366,7 +366,7 @@ export default {
|
||||
break
|
||||
}
|
||||
},
|
||||
async getCodesByWorkingSubclass(workingSubclass) {
|
||||
async getCodesByWorkingSubclass (workingSubclass) {
|
||||
try {
|
||||
const nodeCode = await this.$api.QUERY_CODES(workingSubclass)
|
||||
const nodeCodeData = []
|
||||
@@ -383,7 +383,7 @@ export default {
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async getworkingSubclasses() {
|
||||
async getworkingSubclasses () {
|
||||
try {
|
||||
const workingSubclasses = await this.$api.QUERY_WORKING_SUBCLASSES()
|
||||
const workingSubclassesData = []
|
||||
@@ -396,7 +396,7 @@ export default {
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async getDevice() {
|
||||
async getDevice () {
|
||||
try {
|
||||
this.deviceData = await this.$api.GET_DEVICE(this.serverData.id)
|
||||
if (this.deviceData.length > 0) {
|
||||
@@ -406,7 +406,7 @@ export default {
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async getDeviceConfigure(e) {
|
||||
async getDeviceConfigure (e) {
|
||||
this.deviceActiveStatus = e
|
||||
this.devicePointData = [] // 当切换设备时把保存configure、point的数据清空
|
||||
this.defaultDeviceName = ''
|
||||
@@ -432,7 +432,7 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
addDevice() {
|
||||
addDevice () {
|
||||
const that = this
|
||||
this.$prompt('输入设备名称', '新加设备', {
|
||||
confirmButtonText: '确定',
|
||||
@@ -447,8 +447,8 @@ export default {
|
||||
})
|
||||
})
|
||||
},
|
||||
async delDevice() {
|
||||
let deviceConfigure = await this.$api.GET_HSLSERVER_CONFIGURE('http://' + this.serverData.url + ':' + this.serverData.port, 'admin', '123456')
|
||||
async delDevice () {
|
||||
const deviceConfigure = await this.$api.GET_HSLSERVER_CONFIGURE('http://' + this.serverData.url + ':' + this.serverData.port, 'admin', '123456')
|
||||
let deviceNode = deviceConfigure.Content.Settings.GroupNode[0].DeviceNode
|
||||
if (deviceNode !== undefined && isArray(deviceNode)) {
|
||||
deviceNode = filter(deviceNode, item => {
|
||||
@@ -471,7 +471,7 @@ export default {
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async addDevicePoint(row, done) {
|
||||
async addDevicePoint (row, done) {
|
||||
this.formOptions.saveLoading = true
|
||||
if (!this.$refs.deviceConfigure.defaultDeviceTypeNameValue) {
|
||||
this.$message({
|
||||
@@ -487,14 +487,14 @@ export default {
|
||||
}
|
||||
this.formOptions.saveLoading = false
|
||||
},
|
||||
async delDevicePoint({ index, row }, done) {
|
||||
async delDevicePoint ({ index, row }, done) {
|
||||
this.devicePointData.splice(index, 1)
|
||||
this.$refs.deviceConfigure.deviceConfigureModelValue.RequestNode = this.devicePointData
|
||||
|
||||
await this.setDeviceConfigure()
|
||||
done()
|
||||
},
|
||||
async getDevicePoint() {
|
||||
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)
|
||||
@@ -502,12 +502,12 @@ export default {
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async devicePointBandingNode({ index, row }, done) {
|
||||
async devicePointBandingNode ({ index, row }, done) {
|
||||
this.devicePointData[index]['@Binding'] = row.nodeCode
|
||||
this.setDeviceConfigure()
|
||||
done()
|
||||
},
|
||||
async setDeviceConfigure() {
|
||||
async setDeviceConfigure () {
|
||||
try {
|
||||
// 验证表单
|
||||
this.$refs.deviceConfigure.$refs.form.validate((valid) => {
|
||||
@@ -562,7 +562,7 @@ export default {
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
getDeviceStatus() {
|
||||
getDeviceStatus () {
|
||||
this.$api.GET_DEVICE_STATUS(this.serverData.id).then(res => {
|
||||
each(this.deviceData, (item) => {
|
||||
if (item.id in res.device_status) {
|
||||
@@ -573,7 +573,7 @@ export default {
|
||||
})
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
mounted () {
|
||||
this.getDevice()
|
||||
this.getworkingSubclasses()
|
||||
// setInterval(this.getDeviceStatus, 2000)
|
||||
|
||||
@@ -15,6 +15,10 @@
|
||||
<el-input v-model='deviceConfigureModelValue[item.key]' :disabled="item.disabled"
|
||||
:placeholder="item.placeholder"></el-input>
|
||||
</template>
|
||||
<template v-if="item.type === 'number'">
|
||||
<el-input-number v-model='deviceConfigureModelValue[item.key]' :disabled="item.disabled" :controls="false"
|
||||
:placeholder="item.placeholder"></el-input-number>
|
||||
</template>
|
||||
|
||||
<template v-if="item.type === 'select'">
|
||||
<el-select v-model='deviceConfigureModelValue[item.key]' style="width:80px" :disabled="item.disabled"
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -33,7 +33,7 @@
|
||||
>
|
||||
{{serveStatus[selectedServerData.status].name}}
|
||||
</el-tag>
|
||||
<el-alert title="设备配置已更改,请在服务配置界面重启对应服务生效" type="warning" style="width:400px;display: inline-block;vertical-align: middle; margin-left: 5px;" :closable="false" />
|
||||
<el-alert v-if="this.selectedServerData.updated === 't'" title="设备配置已更改,请在服务配置界面重启对应服务生效" type="warning" style="width:400px;display: inline-block;vertical-align: middle; margin-left: 5px;" :closable="false" />
|
||||
</div>
|
||||
<device :server='server' @changeStatus='changeSelectedServerStatus'/>
|
||||
</el-drawer>
|
||||
@@ -131,6 +131,7 @@ export default {
|
||||
name: '',
|
||||
url: '',
|
||||
port: '',
|
||||
updated: 'f',
|
||||
status: 'offline'
|
||||
},
|
||||
data: [],
|
||||
@@ -397,6 +398,7 @@ export default {
|
||||
name: row.name,
|
||||
url: row.url,
|
||||
port: row.port,
|
||||
updated: row.updated,
|
||||
status: row.status ? row.status : 'offline'
|
||||
}
|
||||
this.server = { id: row.id, url: row.url, port: row.port }
|
||||
|
||||
@@ -95,7 +95,7 @@ export default {
|
||||
this.serverData = Object.values(await this.$api.GET_ALL_DEVICES())
|
||||
this.serverData.forEach((element, index) => {
|
||||
element.devices.forEach((item, i) => {
|
||||
this.$api.GET_SERVE_DEVICE_MONITORING('http://' + item.url + ':' + item.port, 'admin', '123456', item.device_name).then(res => {
|
||||
this.$api.GET_SERVE_DEVICE_MONITORING('http://' + element.url + ':' + element.port, 'admin', '123456', item.device_name).then(res => {
|
||||
if (res.IsSuccess) {
|
||||
const temp = {
|
||||
config: res.Content.__config.split(' '),
|
||||
|
||||
Reference in New Issue
Block a user