This commit is contained in:
Iruka 2025-02-20 17:46:20 +08:00
parent e791a00f58
commit b867eb5cf3

View File

@ -41,17 +41,17 @@
<view class="content-section">
<view class="grey-box normal">
<u-grid :border="false" col="4">
<u-grid-item :class="dc.screenKey == 'all' ? 'click':''" @click="valveStateScreen('all')">
<u-grid-item :class="dc.screenKey == 'all' ? 'click' : ''" @click="valveStateScreen('all')">
<view class="iconfont icon-threshold"></view>
<u-badge numberType="overflow" type="success" max="999" :value="dc.screen.all" />
<text class="text">总设备</text>
</u-grid-item>
<u-grid-item :class="dc.screenKey == 'online' ? 'click':''" @click="valveStateScreen('online')">
<u-grid-item :class="dc.screenKey == 'online' ? 'click' : ''" @click="valveStateScreen('online')">
<view class="iconfont icon-jizhan"></view>
<u-badge numberType="overflow" type="success" max="999" :value="dc.screen.online" />
<text class="text">在线设备</text>
</u-grid-item>
<u-grid-item :class="dc.screenKey == 'error' ? 'click':''" @click="valveStateScreen('error')">
<u-grid-item :class="dc.screenKey == 'error' ? 'click' : ''" @click="valveStateScreen('error')">
<view class="iconfont icon-guzhang"></view>
<u-badge numberType="overflow" type="success" max="999" :value="dc.screen.error" />
<text class="text">异常设备</text>
@ -64,21 +64,21 @@
</u-grid>
</view>
<!-- 统计吸顶效果 -->
<view class="grey-box ceiling" :style="[isSticky ? '':'display: none;','opacity: 0;']">
<view class="grey-box ceiling" :style="[isSticky ? '' : 'display: none;', 'opacity: 0;']">
<u-grid :border="false" col="4">
<u-grid-item :class="dc.screenKey == 'all' ? 'click':''" @click="valveStateScreen('all')">
<u-grid-item :class="dc.screenKey == 'all' ? 'click' : ''" @click="valveStateScreen('all')">
<view class="flex">
<view class="iconfont icon-threshold"></view>
<u-badge numberType="overflow" type="success" max="999" :value="dc.screen.all" />
</view>
</u-grid-item>
<u-grid-item :class="dc.screenKey == 'online' ? 'click':''" @click="valveStateScreen('online')">
<u-grid-item :class="dc.screenKey == 'online' ? 'click' : ''" @click="valveStateScreen('online')">
<view class="flex">
<view class="iconfont icon-jizhan"></view>
<u-badge numberType="overflow" type="success" max="999" :value="dc.screen.online" />
</view>
</u-grid-item>
<u-grid-item :class="dc.screenKey == 'error' ? 'click':''" @click="valveStateScreen('error')">
<u-grid-item :class="dc.screenKey == 'error' ? 'click' : ''" @click="valveStateScreen('error')">
<view class="flex">
<view class="iconfont icon-guzhang"></view>
<u-badge numberType="overflow" type="success" max="999" :value="dc.screen.error" />
@ -106,7 +106,7 @@
</view>
<view class="fixed" style="width:calc(100% - 30%); justify-content: flex-end;">
<view class="iconfont icon-xh icon" style="float: left;"
:class="[ mqttConnected ? 'font-green':'font-red' ]">
:class="[mqttConnected ? 'font-green' : 'font-red']">
</view>
<view @click.stop="refreshAll" style="margin-left: 5px;">
<u-button type="success" size="small" text="一键刷新"
@ -124,12 +124,12 @@
<u-col span="3">
<view class="fixed" @click="stationLeftClickCode(item)">
<text
:class="[dc.dataObj[item.deviceCode]?.online ? 'font-green':'font-red']"></text>
:class="[dc.dataObj[item.deviceCode]?.online ? 'font-green' : 'font-red']"></text>
<view>{{ item.deviceCode }}</view>
</view>
</u-col>
<u-col span="4" style="align-items: center;">
<view class="fixed" @click="openDialog('chart',item)">
<view class="fixed" @click="openDialog('chart', item)">
<custom-signal :online="dc.dataObj[item.deviceCode]?.online"
:isp="dc.dataObj[item.deviceCode]?.isp"
:value="dc.dataObj[item.deviceCode]?.rssi" />
@ -155,17 +155,18 @@
<view class="card" style="margin-bottom: 0;">
<uni-collapse ref="collapseRef" v-if="dc.wo.length">
<uni-collapse-item class="collapseItem" title-border="auto" :show-animation="true"
:show-arrow="false" v-for="(item,index) in dc.wo" :open="woloaded && woloaded[index].open"
v-show="(dc.forward && item.isOpened) || ( !dc.forward && !item.isHidden)">
:show-arrow="false" v-for="(item, index) in dc.wo" :open="woloaded && woloaded[index].open"
v-show="(dc.forward && item.isOpened) || (!dc.forward && !item.isHidden)">
<template v-slot:title>
<view class="sf-title fixed" @click.stop="handleCollapseClick(index)">
<view class="sf-title fixed" @click.stop="handleCollapseClick($event, index)"
:ref="`item${index}`">
<view class="iconfont icon-diefa icon"></view>
<view class="text" style="min-width: 25px;">
{{ item.showName || item.branchCanalCode }}
{{ item.showName || item.branchCanalCode }}
</view>
<view style="margin:0 10px;">出水口数量</view>
<u-badge numberType="overflow" type="info" showZero max="999"
:value="item.children ? item.children.length:0" />
:value="item.children ? item.children.length : 0" />
</view>
</template>
<view class="u-collapse-content" v-if="woloaded && woloaded[index].loaded">
@ -174,7 +175,7 @@
<u-col span="2">
<view class="fixed" @click="openDialog('adc', item)">
<text
:class="[dc.dataObj[item.dataKey]?.online ? 'font-green':'font-red']"></text>
:class="[dc.dataObj[item.dataKey]?.online ? 'font-green' : 'font-red']"></text>
{{ item.showName }}
</view>
</u-col>
@ -217,14 +218,14 @@
<!-- 阀门 -->
<view v-for="child in item.children">
<view v-show="(dc.forward && child.isOpened) || ( !dc.forward && !child.isHidden)">
<view v-show="(dc.forward && child.isOpened) || (!dc.forward && !child.isHidden)">
<view v-if="child.id && child.device" class="card-grey">
<view class="card-title">
<u-row>
<u-col span="2">
<view @click="openDialog('adc', child)">
<text
:class="[dc.dataObj[child.dataKey]?.online ? 'font-green':'font-red']"></text>
:class="[dc.dataObj[child.dataKey]?.online ? 'font-green' : 'font-red']"></text>
{{ child.showName }}
</view>
</u-col>
@ -239,7 +240,7 @@
<view>
<view class="iconfont icon-wendu icon"
style="float: left;margin-left: 5px;" />
{{ dc.dataObj[child.dataKey]?.adc.t}}
{{ dc.dataObj[child.dataKey]?.adc.t }}
</view>
</view>
</u-col>
@ -254,7 +255,7 @@
</view>
<view class="control" v-if="dc.dataObj[child.dataKey]">
<view class="icon iconfont icon-tubiao"
@click="openDialog('chart',child)" />
@click="openDialog('chart', child)" />
<u-row v-if="child.device.deviceTypeKey == 'valve'">
<u-col span="3" style="margin-top: -10px;">
<u-button :disabled="child.device.disable?.open1"
@ -271,7 +272,7 @@
</span>
<span class="name"
v-if="child.device.disable.show && !child.device.disable.open1">
{{user.userName}}
{{ user.userName }}
</span>
</u-button>
<u-line-progress height="8" :showText="false"
@ -296,7 +297,7 @@
</span>
<span class="name"
v-if="child.device.disable.show && !child.device.disable.open">
{{user.userName}}
{{ user.userName }}
</span>
</u-button>
</view>
@ -335,7 +336,7 @@
</span>
<span class="name"
v-if="child.device.disable.show && !child.device.disable.close">
{{user.userName}}
{{ user.userName }}
</span>
</u-button>
</view>
@ -356,7 +357,7 @@
</span>
<span class="name"
v-if="child.device.disable.show && !child.device.disable.open2">
{{user.userName}}
{{ user.userName }}
</span>
</u-button>
<u-line-progress height="8" :showText="false"
@ -380,7 +381,7 @@
</span>
<span class="name"
v-if="child.device.disable.show && !child.device.disable.open1">
{{user.userName}}
{{ user.userName }}
</span>
</u-button>
<u-line-progress height="8" :showText="false"
@ -398,15 +399,18 @@
v-if="dc.dataObj[child.dataKey].btnObj.open2.work">
<span
v-if="dc.countdownObj[`${child.dataKey}_open2`]">
({{ dc.countdownObj[`${child.dataKey}_open2`] }})
({{
dc.countdownObj[`${child.dataKey}_open2`]
}})
</span>
<span v-else class="timeout">
{{ dc.timeoutObj[`${child.dataKey}_open2`] }}
{{ dc.timeoutObj[`${child.dataKey}_open2`]
}}
</span>
</span>
<span class="name"
v-if="child.device.disable.show && !child.device.disable.open2">
{{user.userName}}
{{ user.userName }}
</span>
</u-button>
<u-line-progress height="8" :showText="false"
@ -445,15 +449,18 @@
v-if="dc.dataObj[child.dataKey].btnObj.open4.work">
<span
v-if="dc.countdownObj[`${child.dataKey}_open4`]">
({{ dc.countdownObj[`${child.dataKey}_open4`] }})
({{
dc.countdownObj[`${child.dataKey}_open4`]
}})
</span>
<span v-else class="timeout">
{{ dc.timeoutObj[`${child.dataKey}_open4`] }}
{{ dc.timeoutObj[`${child.dataKey}_open4`]
}}
</span>
</span>
<span class="name"
v-if="child.device.disable.show && !child.device.disable.open4">
{{user.userName}}
{{ user.userName }}
</span>
</u-button>
<u-line-progress height="8" :showText="false"
@ -477,7 +484,7 @@
</span>
<span class="name"
v-if="child.device.disable.show && !child.device.disable.open3">
{{user.userName}}
{{ user.userName }}
</span>
</u-button>
<u-line-progress height="8" :showText="false"
@ -762,13 +769,13 @@
getApp().mqttSubscribes(e);
},
//
handleCollapseClick(index) {
handleCollapseClick(e, index) {
if (!this.woloaded) {
let woloaded = {};
this.dc.wo.forEach((_item, _index) => {
let time = 10;
let time = 20;
if (_item.children && _item.children.length) {
time = _item.children.length * 10
time = _item.children.length * 20
}
woloaded[_index] = {
loaded: false,
@ -791,13 +798,18 @@
this.woloaded[index].loaded = true;
}
this.woloaded[index].open = true;
this.$nextTick(() => {
setTimeout(() => {
this.$refs.collapseRef.resize();
setTimeout(() => {
this.$refs.collapseRef.resize();
this.$nextTick(() => {
uni.hideLoading();
this.scrollToCollapseItem(index);
}, this.woloaded[index].time)
});
uni.pageScrollTo({
scrollTop: e.touches[0].pageY - 150,
duration: 50 //
});
});
// this.scrollToCollapseItem(index);
}, this.woloaded[index].time)
},
//
scrollToCollapseItem(index) {