微调
This commit is contained in:
@@ -90,7 +90,7 @@ const init = async () => {
|
||||
}
|
||||
})
|
||||
} catch (error) {
|
||||
console.error('MQTT 初始化失败:', error)
|
||||
// console.error('MQTT 初始化失败:', error)
|
||||
}
|
||||
}
|
||||
onMounted(() => {
|
||||
|
||||
@@ -50,15 +50,17 @@ class MQTT {
|
||||
if (this.client) {
|
||||
throw new Error('MQTT 客户端已初始化')
|
||||
}
|
||||
|
||||
const mqttUrl = localStorage.getItem('MqttUrl')
|
||||
console.log('MQTT URL:', mqttUrl)
|
||||
if (!mqttUrl || mqttUrl === 'null') {
|
||||
return Promise.resolve()
|
||||
}
|
||||
try {
|
||||
// const mqttUrl =
|
||||
// localStorage.getItem('MqttUrl') == 'null'
|
||||
// ? 'ws://192.168.1.68:8083/mqtt'
|
||||
// : localStorage.getItem('MqttUrl')
|
||||
const mqttUrl = localStorage.getItem('MqttUrl')
|
||||
console.log('MQTT URL:', mqttUrl)
|
||||
if (mqttUrl == 'null' || mqttUrl == null) return
|
||||
|
||||
this.client = mqtt.connect(mqttUrl, this.defaultOptions as IClientOptions)
|
||||
this.setupEventListeners()
|
||||
|
||||
@@ -79,12 +81,12 @@ class MQTT {
|
||||
|
||||
this.client?.on('error', error => {
|
||||
clearTimeout(timeout)
|
||||
console.error('MQTT 连接错误:', error)
|
||||
console.log('MQTT 连接错误:', error)
|
||||
reject(error)
|
||||
})
|
||||
})
|
||||
} catch (error) {
|
||||
console.error('初始化 MQTT 失败:', error)
|
||||
// console.log('初始化 MQTT 失败:', error)
|
||||
throw error
|
||||
}
|
||||
}
|
||||
@@ -133,7 +135,7 @@ class MQTT {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.client?.subscribe(this.topic, { qos: this.defaultOptions.qos, ...subscribeOptions }, error => {
|
||||
if (error) {
|
||||
console.error('订阅失败:', error)
|
||||
console.log('订阅失败:', error)
|
||||
reject(error)
|
||||
} else {
|
||||
console.log('订阅成功')
|
||||
@@ -155,7 +157,7 @@ class MQTT {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.client?.unsubscribe(this.topic, error => {
|
||||
if (error) {
|
||||
console.error('取消订阅失败:', error)
|
||||
console.log('取消订阅失败:', error)
|
||||
reject(error)
|
||||
} else {
|
||||
console.log('取消订阅成功')
|
||||
@@ -190,7 +192,7 @@ class MQTT {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.client?.publish(this.topic, message, { qos: this.defaultOptions.qos, ...options }, error => {
|
||||
if (error) {
|
||||
console.error('消息发布失败:', error)
|
||||
console.log('消息发布失败:', error)
|
||||
reject(error)
|
||||
} else {
|
||||
console.log('消息发布成功')
|
||||
|
||||
@@ -1740,7 +1740,7 @@ const optionarr = ref([
|
||||
])
|
||||
/**母线类型 */
|
||||
const busBarType = ref([
|
||||
{ name: '实际母线', value: 1 },
|
||||
{ name: '真实母线', value: 1 },
|
||||
{ name: '虚拟母线', value: 0 }
|
||||
])
|
||||
const bigList: any = ref([])
|
||||
@@ -1811,7 +1811,7 @@ const busBarDetail = ref({
|
||||
/**电压等级 */
|
||||
scale: '',
|
||||
/**母线类型 */
|
||||
model: 0,
|
||||
model: 1,
|
||||
/**母线id */
|
||||
subvIndex: '',
|
||||
/**监测点 */
|
||||
|
||||
@@ -467,8 +467,7 @@ const makeUpSubmit = () => {
|
||||
reCallEndTime: timeData.value[1],
|
||||
reCallStartTime: timeData.value[0]
|
||||
}
|
||||
console.log('2222',form)
|
||||
return
|
||||
|
||||
socket(form)
|
||||
timePopUp.value = false
|
||||
logPopUp.value = true
|
||||
|
||||
Reference in New Issue
Block a user