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