This commit is contained in:
Iruka 2024-11-28 11:34:08 +08:00
parent 691c7a0d78
commit 71033c2f8e

View File

@ -8,7 +8,9 @@
<view class="fixed"> <view class="fixed">
<!-- <view align="right" class="icon iconfont icon-liebiao" @click="toList"></view> --> <!-- <view align="right" class="icon iconfont icon-liebiao" @click="toList"></view> -->
<view align="right" class="icon iconfont icon-scan" @click="toQRCode"></view> <view align="right" class="icon iconfont icon-scan" @click="toQRCode"></view>
<!-- #ifdef H5 -->
<view align="right" class="icon iconfont icon-liebiao" @click="mqttshow = true"></view> <view align="right" class="icon iconfont icon-liebiao" @click="mqttshow = true"></view>
<!-- #endif -->
</view> </view>
</template> </template>
</custom-nav-bar> </custom-nav-bar>
@ -107,7 +109,7 @@
</view> </view>
<view class="fixed" style="width:calc(100% - 30%); justify-content: flex-end;"> <view class="fixed" style="width:calc(100% - 30%); justify-content: flex-end;">
<view class="iconfont icon-xh icon" style="float: left;" <view class="iconfont icon-xh icon" style="float: left;"
:class="[ mqtt.connected ? 'font-green':'font-red' ]"> :class="[ mqttConnected ? 'font-green':'font-red' ]">
</view> </view>
<view @click.stop="" style="margin-left: 5px;"> <view @click.stop="" style="margin-left: 5px;">
<u-button type="success" size="small" text="一键刷新" /> <u-button type="success" size="small" text="一键刷新" />
@ -149,11 +151,10 @@
</u-collapse-item> </u-collapse-item>
</u-collapse> </u-collapse>
</view> </view>
<!-- 阀门列表 --> <!-- 阀门列表 -->
<view class="card"> <view class="card">
<u-collapse ref="collapseRef" :accordion="false" :value="collapse" @change="handleCollapseChange"> <u-collapse ref="collapseRef" :accordion="false" :value="collapse" @change="handleCollapseChange">
<u-collapse-item v-for="(item,index) in dc.wo" :id="`collapseItem${index}`"> <u-collapse-item v-for="(item,index) in dc.wo" :id="`collapseItem${index}`" :name="index">
<template #title> <template #title>
<view class="sf-title fixed"> <view class="sf-title fixed">
<view class="iconfont icon-diefa icon"></view> <view class="iconfont icon-diefa icon"></view>
@ -628,31 +629,33 @@
export default { export default {
data() { data() {
return { return {
user: store.state.user.user,
title: "", title: "",
ijs: getApp().ijs, // js
dc: getApp().dc, //
mqttshow: false, // h5mqtt
mqttConnected: false, // mqtt
isSticky: false, //
stateScreen: { // click stateScreen: { // click
all: "click", all: null,
online: null, online: null,
offline: null offline: null
}, },
collapse: [], collapse: [],
mqttshow: false,
user: store.state.user.user,
isSticky: false, //
value: false, value: false,
ijs: getApp().ijs,
dc: getApp().dc,
mqtt: getApp().mqtt,
isLandChange: false,
} }
}, },
onLoad() { onLoad() {
console.error("onLoad") console.error("onLoad")
this.ijs.getCompany(this.user.userId); // mqtt
// uni.$emit("mqtt-link", this.user.userId); uni.$off("mqtt-connected");
// getApp().mqttLink(this.user.userId); uni.$on("mqtt-connected", (e) => {
this.mqttConnected = e;
});
this.ijs.getCompany(this.user.userId);
this.ijs.getWoList({ this.ijs.getWoList({
id: 10, id: 10,
landName: "西安测试地块" landName: "西安测试地块"
@ -716,7 +719,10 @@
// //
valveStateScreen(type) { valveStateScreen(type) {
this.stateScreen[type] const collapse = this.collapse;
if (this.stateScreen[type] == 'click') {
type = "";
}
this.dc.showType(type); this.dc.showType(type);
for (var key in this.stateScreen) { for (var key in this.stateScreen) {
if (key == type) { if (key == type) {
@ -728,6 +734,7 @@
this.$nextTick(() => { this.$nextTick(() => {
setTimeout(() => { setTimeout(() => {
this.$refs.collapseRef.init(); this.$refs.collapseRef.init();
this.collapse = collapse;
}, 500) }, 500)
}) })
}, },
@ -748,9 +755,8 @@
handleCollapseChange(e) { handleCollapseChange(e) {
let collapse = [], let collapse = [],
clickName = null; clickName = null;
e.forEach(item => { e.forEach((item, index) => {
if (item.status == "open") { if (item.status == "open") {
collapse.push(item.name);
if (this.collapse.length) { if (this.collapse.length) {
if (this.collapse.includes(item.name)) { if (this.collapse.includes(item.name)) {
clickName = item.name; clickName = item.name;
@ -758,6 +764,7 @@
} else { } else {
clickName = item.name; clickName = item.name;
} }
collapse.push(item.name);
} }
}); });
this.collapse = collapse; this.collapse = collapse;