mirror of
https://gitee.com/beecue/fastbee.git
synced 2025-12-17 16:36:03 +08:00
修复新增设备报错
This commit is contained in:
@@ -444,7 +444,8 @@ export default {
|
|||||||
} else {
|
} else {
|
||||||
addDevice(this.form).then(response => {
|
addDevice(this.form).then(response => {
|
||||||
this.form = response.data;
|
this.form = response.data;
|
||||||
this.oldDeviceStatus = this.from.status;
|
console.log(response);
|
||||||
|
this.oldDeviceStatus = this.form.status;
|
||||||
if (this.form.deviceId == null || this.form.deviceId == 0) {
|
if (this.form.deviceId == null || this.form.deviceId == 0) {
|
||||||
this.$modal.alertError("设备编号已经存在,添加设备失败");
|
this.$modal.alertError("设备编号已经存在,添加设备失败");
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -217,6 +217,7 @@ export default {
|
|||||||
this.MonitorChart();
|
this.MonitorChart();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
this.connectMqtt();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -259,10 +260,16 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
// 回调处理
|
|
||||||
this.mqttCallback();
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
/* 连接Mqtt消息服务器 */
|
||||||
|
async connectMqtt() {
|
||||||
|
if (this.$mqttTool.client == null) {
|
||||||
|
await this.$mqttTool.connect(this.vuex_token);
|
||||||
|
}
|
||||||
|
this.mqttCallback();
|
||||||
|
},
|
||||||
/* Mqtt回调处理 */
|
/* Mqtt回调处理 */
|
||||||
mqttCallback() {
|
mqttCallback() {
|
||||||
this.$mqttTool.client.on('message', (topic, message, buffer) => {
|
this.$mqttTool.client.on('message', (topic, message, buffer) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user