设备监控修改

This commit is contained in:
zhujiyan
2024-10-15 15:30:01 +08:00
parent 70666d4c86
commit a05cc2deab
8 changed files with 239 additions and 65 deletions

View File

@@ -133,7 +133,7 @@
<script setup lang="ts">
import DeviceTree from '@/components/tree/govern/deviceTree.vue'
import { mainHeight } from '@/utils/layout'
import { ref, reactive, watch, onMounted, onBeforeUnmount, h } from 'vue'
import { ref, reactive, watch, onMounted, onBeforeUnmount, h, inject } from 'vue'
import { ElMessage, ElMessageBox, ElInput } from 'element-plus'
import {
getDeviceRootPath,
@@ -500,7 +500,7 @@ watch(
}
)
const mqttRef = ref()
const url: any = inject('MQTTURL')
const connectMqtt = () => {
if (mqttRef.value) {
if (mqttRef.value.connected) {
@@ -516,9 +516,6 @@ const connectMqtt = () => {
username: 't_user',
password: 'njcnpqs'
}
// 线上
// const url = 'wss://pqmcn.com:8087/mqtt'
const url = 'ws://192.168.1.24:8085/mqtt'
mqttRef.value = mqtt.connect(url, options)
}
connectMqtt()