feasure
parent
a7df117a65
commit
11feb967cc
|
|
@ -223,7 +223,7 @@
|
|||
|
||||
<uni-popup ref="sliderDialog" mode="center">
|
||||
<view class="modal-container">
|
||||
<view class="modal-title">{{ `【${selectedText} - 自动化】参数设置` }}</view>
|
||||
<view class="modal-title">{{ `【${selectedText} - 自动化】条件设置` }}</view>
|
||||
<!-- 核心修改:给容器加 flex 布局样式 -->
|
||||
<view class="modal-slider">
|
||||
<text class="slider-label">{{ slider.title }}</text>
|
||||
|
|
|
|||
|
|
@ -402,7 +402,9 @@ export default {
|
|||
ackMessage(topic, payload) {
|
||||
// 1. 先判断是否是目标订阅主题(如frontend/\\w+/control/\\w+")
|
||||
if ((topic !== this.mqttConfig.subscribeTopic+"/ack")
|
||||
&& (topic !== this.mqttConfig.subscribeTopic+"/listener")) return;
|
||||
&& (topic !== this.mqttConfig.subscribeTopic+"/listener")
|
||||
&& topic !== this.mqttConfig.subscribeTopic+"/config") return;
|
||||
const regexWithGroup = /^frontend\/[^/]+\/dtu\/\d+\/(.+)$/;
|
||||
let msgData = {};
|
||||
// 优化:捕获JSON解析异常
|
||||
try {
|
||||
|
|
@ -412,17 +414,22 @@ export default {
|
|||
return;
|
||||
}
|
||||
|
||||
const matchResult = topic.match(regexWithGroup);
|
||||
const tag = matchResult[1]; // 提取结果:'1234567890'
|
||||
|
||||
// 3. 区分“回执”和“其他内容”
|
||||
if (msgData.prop && "suc" in msgData) {
|
||||
if (tag==='ack' && msgData.prop && "suc" in msgData) {
|
||||
this.handleCommandAck(msgData);
|
||||
} else if ("msg" in msgData && "clientId" in msgData) {
|
||||
if (mqttUtil.getMqttState().clientId === msgData.clientId) {
|
||||
this.$modal.msg(
|
||||
`${msgData.msg}`
|
||||
);
|
||||
}
|
||||
} else {
|
||||
this.handleOtherContent(msgData,payload)
|
||||
}
|
||||
// else if (tag==='ack' && "msg" in msgData && "clientId" in msgData) {
|
||||
// if (mqttUtil.getMqttState().clientId === msgData.clientId) {
|
||||
// this.$modal.msg(
|
||||
// `${msgData.msg}`
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
else {
|
||||
this.handleOtherContent(msgData,tag)
|
||||
}
|
||||
},
|
||||
|
||||
|
|
@ -456,10 +463,11 @@ export default {
|
|||
console.log(`指令[${commandField}=${commandValue}]执行${isSuccess ? "成功" : "失败"}`);
|
||||
},
|
||||
|
||||
handleOtherContent(msgData,payload) {
|
||||
handleOtherContent(msgData,tag) {
|
||||
// 业务逻辑:处理传感器数据、设备状态等
|
||||
// 设备状态展示
|
||||
if (this.value !== 1) {
|
||||
if (this.value === 1) return;
|
||||
if (tag === 'listener') {
|
||||
var arr = ['jbk', "jbg", "jm1k", "jm1g", "jm2k", "jm2g", "jm3k", "jm3g","jlk","jlg"]
|
||||
const allKeysNumeric = Object.keys(msgData).some(key => arr.includes(key));
|
||||
if (allKeysNumeric) {
|
||||
|
|
@ -476,7 +484,9 @@ export default {
|
|||
this.fontStyle = 'font-size:16px;'
|
||||
this.makeSpecialData(msgData, true);
|
||||
}
|
||||
} else if (tag === 'config') {
|
||||
if ("ventTotalLen" in msgData) {
|
||||
console.info("参数设置:自动校准风口:",msgData.ventTotalLen)
|
||||
this.ventTotalLen = msgData.ventTotalLen;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue