From fd060438bfa5d964e31dd6dfe1005478773353af Mon Sep 17 00:00:00 2001
From: wu <2468489804@qq.com>
Date: Thu, 18 Aug 2022 23:09:51 +0800
Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=94=B9=E8=AE=BE=E5=A4=87=E9=85=8D?=
=?UTF-8?q?=E7=BD=AEjson=E6=96=87=E4=BB=B6=E3=80=81=E6=B7=BB=E5=8A=A0?=
=?UTF-8?q?=E6=95=B0=E5=AD=97=E8=BE=93=E5=85=A5=E6=A1=86=E3=80=81=E4=BF=AE?=
=?UTF-8?q?=E5=A4=8D=E8=AE=BE=E5=A4=87=E7=9B=91=E6=8E=A7=E9=A1=B5=E9=9D=A2?=
=?UTF-8?q?BUG?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/api/modules/edgeServer.api.js | 2 +-
.../edgeServer/edgeServerConfigure/device.vue | 52 +-
.../edgeServerConfigure/deviceConfigure.vue | 4 +
.../deviceSetting/index.json | 1534 ++++++++++++++++-
.../edgeServer/edgeServerConfigure/index.vue | 4 +-
.../edgeServer/edgeServerMonitor/index.vue | 2 +-
6 files changed, 1564 insertions(+), 34 deletions(-)
diff --git a/src/api/modules/edgeServer.api.js b/src/api/modules/edgeServer.api.js
index 0a65581..8fb9591 100644
--- a/src/api/modules/edgeServer.api.js
+++ b/src/api/modules/edgeServer.api.js
@@ -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)
})
diff --git a/src/views/edgeServer/edgeServerConfigure/device.vue b/src/views/edgeServer/edgeServerConfigure/device.vue
index 554aa47..4597285 100644
--- a/src/views/edgeServer/edgeServerConfigure/device.vue
+++ b/src/views/edgeServer/edgeServerConfigure/device.vue
@@ -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)
diff --git a/src/views/edgeServer/edgeServerConfigure/deviceConfigure.vue b/src/views/edgeServer/edgeServerConfigure/deviceConfigure.vue
index f495563..20f10d9 100644
--- a/src/views/edgeServer/edgeServerConfigure/deviceConfigure.vue
+++ b/src/views/edgeServer/edgeServerConfigure/deviceConfigure.vue
@@ -15,6 +15,10 @@
+
+
+
{{serveStatus[selectedServerData.status].name}}
-
+
@@ -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 }
diff --git a/src/views/edgeServer/edgeServerMonitor/index.vue b/src/views/edgeServer/edgeServerMonitor/index.vue
index e634ded..96e3fa3 100644
--- a/src/views/edgeServer/edgeServerMonitor/index.vue
+++ b/src/views/edgeServer/edgeServerMonitor/index.vue
@@ -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(' '),