修改mqtt连接方式

This commit is contained in:
GGJ
2024-12-30 10:07:26 +08:00
parent 0f57e4b746
commit 6a06652532
19 changed files with 173 additions and 93 deletions

View File

@@ -790,7 +790,7 @@ const trendRef: any = ref()
//暂态事件组件
const eventRef: any = ref()
const mqttRef = ref()
const url: any = inject('MQTTURL')
const url: any = window.localStorage.getItem('MQTTURL')
const connectMqtt = () => {
if (mqttRef.value) {
if (mqttRef.value.connected) {
@@ -806,6 +806,8 @@ const connectMqtt = () => {
username: 't_user',
password: 'njcnpqs'
}
mqttRef.value = mqtt.connect(url, options)
}
const getRealDataMqttMsg = async () => {

View File

@@ -152,7 +152,7 @@ const clearRadioRowEvent = () => {
}
}
const mqttRef = ref()
const url: any = inject('MQTTURL')
const url: any = window.localStorage.getItem('MQTTURL')
const connectMqtt = () => {
if (mqttRef.value) {
if (mqttRef.value.connected) {

View File

@@ -1,4 +1,4 @@
<!-- 暂态事件-波形析组件 -->
<!-- 暂态事件-波形析组件 -->
<template>
<div class="home">
<div class="home_header">
@@ -132,8 +132,10 @@ const handleBack = () => {
emit('handleHideCharts')
}
const setHeight = (h: any, vh: any) => {
if (h != false) {
parentHeight.value = h
}
parentHeight.value = h
setTimeout(() => {
bxecharts.value = mainHeight(vh).height
}, 100)

View File

@@ -2,8 +2,8 @@
<div class="view">
<TableHeader datePicker ref="headerRef" v-if="!isWaveCharts" :showReset="false"></TableHeader>
<Table ref="tableRef" v-if="!isWaveCharts" />
<waveFormAnalysis v-loading="loading" v-if="isWaveCharts" ref="waveFormAnalysisRef" @handleHideCharts="isWaveCharts = false"
:wp="wp" />
<waveFormAnalysis v-loading="loading" v-if="isWaveCharts" ref="waveFormAnalysisRef"
@handleHideCharts="isWaveCharts = false" :wp="wp" />
</div>
</template>
<script lang="ts" setup>
@@ -79,7 +79,7 @@ const tableStore: any = new TableStore({
buttons: [
{
name: 'edit',
title: '波形析',
title: '波形析',
type: 'primary',
icon: 'el-icon-Check',
render: 'basicButton',

View File

@@ -523,7 +523,7 @@ watch(
}
)
const mqttRef = ref()
const url: any = inject('MQTTURL')
const url: any = window.localStorage.getItem('MQTTURL')
const connectMqtt = () => {
if (mqttRef.value) {
if (mqttRef.value.connected) {

View File

@@ -83,7 +83,7 @@ const tableStore = new TableStore({
buttons: [
{
name: 'edit',
title: '波形析',
title: '波形析',
type: 'primary',
icon: 'el-icon-Check',
render: 'basicButton',
@@ -103,7 +103,7 @@ const tableStore = new TableStore({
boxoList.value = row
boxoList.value.systemType = 'WX'
wp.value = res.data
}
loading.value = false