更改设备配置json文件、添加数字输入框、修复设备监控页面BUG
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user