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