diff --git a/pages/dev-ops/station.vue b/pages/dev-ops/station.vue index 6b235af..979d457 100644 --- a/pages/dev-ops/station.vue +++ b/pages/dev-ops/station.vue @@ -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); diff --git a/pages/index.vue b/pages/index.vue index 5d93506..c1ca4c2 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -18,7 +18,7 @@ - +