.
This commit is contained in:
parent
d8dffdf707
commit
3cf88ce75c
@ -90,6 +90,7 @@
|
||||
return {
|
||||
landId: null,
|
||||
dataList: [],
|
||||
topics: [],
|
||||
dc: getApp().dc, // 设备控制公共代码
|
||||
rolaFrequency: {
|
||||
item: null,
|
||||
@ -119,12 +120,36 @@
|
||||
},
|
||||
onShow() {},
|
||||
mounted() {},
|
||||
onUnload(){
|
||||
getApp().mqttUnsubscribes(this.topics);
|
||||
},
|
||||
methods: {
|
||||
queryList(pageNo, pageSize) {
|
||||
DevOpsApi.getStationList(this.landId).then(res => {
|
||||
console.error("res:", res);
|
||||
|
||||
// /${productKey}/${deviceName}/user/postConfig
|
||||
this.$refs.paging.completeByTotal(res.rows);
|
||||
this.mqttSubscribes(res.rows);
|
||||
|
||||
});
|
||||
},
|
||||
mqttSubscribes(rows) {
|
||||
if (rows && rows.length) {
|
||||
const shortTopic = [
|
||||
"/user/postConfig", //频段修改上报
|
||||
]
|
||||
let topic = [];
|
||||
rows.forEach(item => {
|
||||
shortTopic.forEach(i => {
|
||||
topic.push(`/${item.productKey}/${item.deviceCode}${i}`);
|
||||
});
|
||||
});
|
||||
this.topics = topic;
|
||||
getApp().mqttSubscribes(this.topics);
|
||||
}
|
||||
},
|
||||
|
||||
// 刷新
|
||||
refresh(item) {
|
||||
console.error("刷新:", item);
|
||||
|
@ -18,7 +18,7 @@
|
||||
<view style="margin-top: 50px;">
|
||||
<button @click="mqttLink">mqttLink</button>
|
||||
<button @click="mqttEnd">mqttEnd</button>
|
||||
<button @click="mqttSubscribes">订阅</button>
|
||||
<button @click="mqttSubscribes">订阅(会自动订阅,一般不需要手动)</button>
|
||||
</view>
|
||||
</u-popup>
|
||||
<!-- 内容 -->
|
||||
|
Loading…
Reference in New Issue
Block a user