.
This commit is contained in:
parent
18dc5d5795
commit
687ce34f03
@ -46,6 +46,7 @@
|
||||
} from "@/api/controlMpInterface.js"
|
||||
export default {
|
||||
name: "Mp",
|
||||
emits: ["topic"],
|
||||
components: {},
|
||||
props: {},
|
||||
data() {
|
||||
@ -72,16 +73,16 @@
|
||||
this.landId = land.id;
|
||||
this.mpId = mpId;
|
||||
this.open = true;
|
||||
this.getList();
|
||||
this.getList(this.landId, this.mpId);
|
||||
},
|
||||
close() {
|
||||
this.open = false;
|
||||
},
|
||||
getList() {
|
||||
getList(landId, mpId) {
|
||||
this.list = [];
|
||||
const query = {
|
||||
landId: this.landId,
|
||||
id: this.mpId
|
||||
landId: landId,
|
||||
id: mpId
|
||||
}
|
||||
getMpDeviceList(query).then((res) => {
|
||||
let list = {};
|
||||
@ -108,17 +109,22 @@
|
||||
},
|
||||
refreshSoilTilth() {
|
||||
let refresh = [];
|
||||
let topic = [];
|
||||
this.list.forEach(item => {
|
||||
if (refresh.findIndex(x => x.deviceCode == item.deviceCode) == -1) {
|
||||
let mp = {
|
||||
deviceCode: item.deviceCode,
|
||||
lv: item.floors
|
||||
deviceCode: item.data[0].deviceCode,
|
||||
lv: item.data[0].floors
|
||||
};
|
||||
refresh.push(mp);
|
||||
}
|
||||
let _topic = "jsy/iot/mp/" + item.data[0].deviceCode
|
||||
if (!topic.includes(_topic)) {
|
||||
topic.push(_topic);
|
||||
}
|
||||
});
|
||||
mpRefresh(refresh).then((res) => {
|
||||
});
|
||||
this.$emit('topic', topic);
|
||||
mpRefresh(refresh).then((res) => {});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -458,7 +458,7 @@
|
||||
<!--曲线 -->
|
||||
<custom-index-chart ref="adcChartRef" />
|
||||
<!-- 墒情 -->
|
||||
<custom-index-mp ref="mpRef" />
|
||||
<custom-index-mp ref="mpRef" @topic="mpTopic" />
|
||||
</template>
|
||||
<script>
|
||||
import config from '@/config.js'
|
||||
@ -508,7 +508,11 @@
|
||||
if (e.type == "state") {
|
||||
that.mqttConnected = e.connected;
|
||||
} else if (e.type == "msg") {
|
||||
that.mapUpdateMarker(e.data);
|
||||
if (e.topic.includes('jsy/iot/mp/')) {
|
||||
that.$refs.mpRef.getList(that.ijs.land.id);
|
||||
} else {
|
||||
that.mapUpdateMarker(e.data);
|
||||
}
|
||||
}
|
||||
});
|
||||
getApp().on("land", "land_map", function(e) {
|
||||
@ -880,6 +884,9 @@
|
||||
}
|
||||
this.closePopup();
|
||||
},
|
||||
mpTopic(e) {
|
||||
getApp().mqttSubscribes(e);
|
||||
},
|
||||
// 格式化日期
|
||||
formatData(time) {
|
||||
return timestampFormat(time);
|
||||
|
@ -547,7 +547,7 @@
|
||||
<!--曲线 -->
|
||||
<custom-index-chart ref="adcChartRef" />
|
||||
<!-- 墒情 -->
|
||||
<custom-index-mp ref="mpRef" />
|
||||
<custom-index-mp ref="mpRef" @topic="mpTopic" />
|
||||
|
||||
<custom-app-update ref="appUpdate" />
|
||||
</template>
|
||||
@ -589,7 +589,12 @@
|
||||
getApp().on("mqtt", "mqtt_index", function(e) {
|
||||
if (e.type == "state") {
|
||||
that.mqttConnected = e.connected;
|
||||
} else if (e.type == "msg") {}
|
||||
} else if (e.type == "msg") {
|
||||
if (e.topic.includes('jsy/iot/mp/')) {
|
||||
that.$refs.mpRef.getList(that.ijs.land.id);
|
||||
return
|
||||
}
|
||||
}
|
||||
});
|
||||
getApp().on("land", "land_index", function(e) {
|
||||
if (e.type == "wo") {
|
||||
@ -752,6 +757,9 @@
|
||||
swiperConfirm(e) {
|
||||
this.dc.buildCommand(e.item, e.index, e.value, e.other);
|
||||
},
|
||||
mpTopic(e) {
|
||||
getApp().mqttSubscribes(e);
|
||||
},
|
||||
// 折叠面板点击
|
||||
handleCollapseClick(index) {
|
||||
if (!this.woloaded) {
|
||||
|
Loading…
Reference in New Issue
Block a user