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