From 9cc59c17892a7e69de54e06b5931e78c9b05551c Mon Sep 17 00:00:00 2001
From: zhuguifei <zhuguifei@zhuguifeideiMac.local>
Date: 星期二, 02 九月 2025 09:24:34 +0800
Subject: [PATCH] 添加mqtt登出
---
pages/tabBar/warning.vue | 6
pages/tabBar/general.vue | 487 +++++++++++++++++++++-----------------------
mqtt/MqttView.vue | 95 ++++----
pages/tabBar/device.vue | 37 ++
packageA/pages/device/control.vue | 13 +
pages/tabBar/me.vue | 6
6 files changed, 333 insertions(+), 311 deletions(-)
diff --git a/mqtt/MqttView.vue b/mqtt/MqttView.vue
index 0064474..33c97d2 100644
--- a/mqtt/MqttView.vue
+++ b/mqtt/MqttView.vue
@@ -15,6 +15,12 @@
},
+ destroyed() {
+ console.error("MQTT缁勪欢閿�姣�")
+ this.$mqttTool.end().then(res => {
+ console.error(res)
+ })
+ },
methods: {
initMqtt() {
uni.getSystemInfo({
@@ -43,11 +49,11 @@
// #ifdef H5
url: 'wss://' + this.$api.mqttBaseUrl + ':8084/mqtt',
// #endif
- // #ifdef MP-WEIXIN
- url: 'wxs://' + this.$api.mqttBaseUrl + ':8084/mqtt',// 寰俊灏忕▼搴忓己鍒� WSS
- // #endif
- // #ifdef APP-PLUS
- url: 'wxs://' + this.$api.mqttBaseUrl + ':8084/mqtt', // Android/iOS 鐢ㄦ櫘閫� WebSocket
+ // #ifdef MP-WEIXIN
+ url: 'wxs://' + this.$api.mqttBaseUrl + ':8084/mqtt', // 寰俊灏忕▼搴忓己鍒� WSS
+ // #endif
+ // #ifdef APP-PLUS
+ url: 'wxs://' + this.$api.mqttBaseUrl + ':8084/mqtt', // Android/iOS 鐢ㄦ櫘閫� WebSocket
// #endif
clientId: deviceid,
username: account.username,
@@ -70,39 +76,40 @@
qos: 0
}).then(res => {
console.error(res)
- })
-
- //璁㈤槄璁惧瀹炴椂鏁呴殰锛堜富鍔ㄨ姹傚彧鍙戠粰璇锋眰璁惧锛�
- this.$mqttTool.subscribe({
- topic: this.$constant.SERVICE_ONECE_TENANT_REAL_FAULT.replace('%s', deviceid),
- qos: 0
- }).then(res => {
- console.error(res)
- })
-
- //璁㈤槄骞茬嚗璁惧杩炴帴鏂紑鐘舵�佹洿鏂�-绉熸埛鍐呮墍鏈夎澶�
- this.$mqttTool.subscribe({
- topic: this.$constant.SERVICE_BROADCAST_TENANT_UPDATE_EQU_STATU.replace('%s', this.tenantId),
- qos: 0
- }).then(res => {
- console.error(res)
- })
- //璁㈤槄鏌ヨ骞茬嚗璁惧杩炴帴鐘舵��-鍗曚釜璁惧
- this.$mqttTool.subscribe({
- topic: this.$constant.SERVICE_RES_EQU_STATU.replace('%s', deviceid),
- qos: 0
- }).then(res => {
- console.error(res)
- })
-
- //璁㈤槄骞茬嚗璁惧瀹炴椂鏁版嵁
- this.$mqttTool.subscribe({
- topic: this.$constant.SERVICE_BROADCAST_TENANT_REAL_DATA.replace('%s', this.tenantId),
- qos: 0
- }).then(res => {
- console.error(res)
- })
-
+ })
+
+ //璁㈤槄璁惧瀹炴椂鏁呴殰锛堜富鍔ㄨ姹傚彧鍙戠粰璇锋眰璁惧锛�
+ this.$mqttTool.subscribe({
+ topic: this.$constant.SERVICE_ONECE_TENANT_REAL_FAULT.replace('%s', deviceid),
+ qos: 0
+ }).then(res => {
+ console.error(res)
+ })
+
+ //璁㈤槄骞茬嚗璁惧杩炴帴鏂紑鐘舵�佹洿鏂�-绉熸埛鍐呮墍鏈夎澶�
+ this.$mqttTool.subscribe({
+ topic: this.$constant.SERVICE_BROADCAST_TENANT_UPDATE_EQU_STATU.replace('%s', this
+ .tenantId),
+ qos: 0
+ }).then(res => {
+ console.error(res)
+ })
+ //璁㈤槄鏌ヨ骞茬嚗璁惧杩炴帴鐘舵��-鍗曚釜璁惧
+ this.$mqttTool.subscribe({
+ topic: this.$constant.SERVICE_RES_EQU_STATU.replace('%s', deviceid),
+ qos: 0
+ }).then(res => {
+ console.error(res)
+ })
+
+ //璁㈤槄骞茬嚗璁惧瀹炴椂鏁版嵁
+ this.$mqttTool.subscribe({
+ topic: this.$constant.SERVICE_BROADCAST_TENANT_REAL_DATA.replace('%s', this.tenantId),
+ qos: 0
+ }).then(res => {
+ console.error(res)
+ })
+
//璁㈤槄鍙戦�佹寚浠よ繑鍥炵粨鏋�
// this.$mqttTool.subscribe({
// topic: this.$constant.SERVICE_RES_EQU_CMD,
@@ -113,30 +120,30 @@
// if (!client) {
// return false
// }
- let that = this
+ let that = this
let client = this.$mqttTool.client
client.on('connect', function(res) {
- console.error('杩炴帴鎴愬姛')
+ console.error('杩炴帴鎴愬姛')
console.error(res)
})
client.on('reconnect', function(res) {
- console.error('閲嶆柊杩炴帴')
+ console.error('閲嶆柊杩炴帴')
console.error(res)
})
client.on('error', function(res) {
- console.info('杩炴帴閿欒')
+ console.info('杩炴帴閿欒')
console.error(res)
})
client.on('close', function(res) {
- console.error('鍏抽棴鎴愬姛')
+ console.error('鍏抽棴鎴愬姛')
console.error(res)
})
client.on('message', function(topic, message, buffer) {
uni.$emit(that.$constant.MQTT_TOPIC_MESSAGE, message);
- console.error("鏀跺埌message锛堟�伙級锛�"+topic)
+ //console.error("鏀跺埌message锛堟�伙級锛�"+topic)
})
diff --git a/packageA/pages/device/control.vue b/packageA/pages/device/control.vue
index 818c962..e4394da 100644
--- a/packageA/pages/device/control.vue
+++ b/packageA/pages/device/control.vue
@@ -244,6 +244,15 @@
timer: null,
realFaults: [],
allFaults: [{
+ id: 0,
+ name: '鎬ュ仠鎶ヨ锛堟�伙級',
+ type: 1,
+ position: {
+ top: 40,
+ left: 230
+ },
+ show: false
+ },{
id: 1,
name: '璁惧鎬ュ仠锛堟�伙級',
type: 1,
@@ -623,7 +632,7 @@
break;
//topic 瀹炴椂鎶ヨ
case topics.realFaultTopic:
- case topics.oneceFaultTopic:
+ case topics.oneceFaultTopic:
if (!this.model.connected) {
return false
}
@@ -770,7 +779,7 @@
}
this.$mqttTool.publish(opts).then(res => {
- console.error(res)
+ //console.error(res)
})
},
diff --git a/pages/tabBar/device.vue b/pages/tabBar/device.vue
index 70339eb..f5526b2 100644
--- a/pages/tabBar/device.vue
+++ b/pages/tabBar/device.vue
@@ -169,15 +169,22 @@
</view>
<view class="info-box">
- <view class="left flex-sub">
+ <view class="left flex-sub" style="width: 60%;">
<view class="title text-sm text-cut">鎶ヨ淇℃伅:</view>
<template v-if="item.errorData">
- <view class="title text-sm text-red">鏁呴殰 {{item.errorData.length}}</view>
+ <view class="title text-sm text-red text-cut">{{ (item.errorData.length > 0) ? item.errorData[0]:'' }}</view>
</template>
- <template v-if="item.warnData">
- <view class="title text-sm text-yellow">鍛婅 {{item.warnData.length}}</view>
- </template>
+ <template v-else-if="item.warnData">
+ <view class="title text-sm text-yellow text-cut"> {{(item.warnData.length > 0) ? item.warnData[0]:''}}</view>
+ </template>
+ <view v-if="getErrorCount(item) > 0">
+ <u-tag size="mini" :text="getErrorCount(item)" type="error" plain></u-tag>
+ </view>
+ <view style="width: 20rpx;"></view>
+ <view v-if="getWarnCount(item) > 0">
+ <u-tag size="mini" :text="getWarnCount(item)" type="warning" plain></u-tag>
+ </view>
</view>
<view class="right" style="min-width: 240rpx;">
@@ -266,9 +273,25 @@
},
+
+ getErrorCount(item){
+ let count = 0;
+ if(item.errorData){
+ count += item.errorData.length
+ }
+ return count;
+ },
+ getWarnCount(item){
+ let count = 0;
+ if(item.warnData){
+ count += item.warnData.length
+ }
+ return count;
+ },
+
startTimer() {
this.timer = setInterval(() => {
- this.queryRealFaultData();
+ //this.queryRealFaultData();
}, 3000);
},
stopTimer() {
@@ -323,7 +346,7 @@
this.mergeMqttRealData(wdata);
break;
case topics.realFaultTopic:
- case topics.oneceFaultTopic:
+ case topics.oneceFaultTopic:
this.handleFaultData(wdata);
break;
}
diff --git a/pages/tabBar/general.vue b/pages/tabBar/general.vue
index ffbf736..615b700 100644
--- a/pages/tabBar/general.vue
+++ b/pages/tabBar/general.vue
@@ -1,224 +1,199 @@
<template>
<view class="app">
- <cu-custom bgColor="bg-gradual-blue" :isBack="false">
- <block slot="content">鍏版郸鏅鸿兘骞茬嚗</block>
- </cu-custom>
-
<u-toast ref="uToast"></u-toast>
- <view class="card-box dynamic shadow">
- <view class="title-box margin-bottom-sm">
- <view class="left justify-between">
- <view class="flex align-center">
- <uni-text class="cuIcon-titles text-blue"></uni-text>
- <view class="title">鎬昏</view>
- </view>
- <view>
- <text class="text-gray">{{model.date}}</text>
- </view>
-
- </view>
-
- </view>
- <view class="flex flex-direction padding-xs">
- <view class="flex">
- <view class="flex-sub flex flex-direction">
- <text class="text-df">鐑樺共鏁伴噺</text>
- <text class="text-bold text-sl margin-top-xs text-cyan margin-top-sm">{{showValue(model.feed)}}
- <text class="text-gray text-sm margin-left-xs">绛�</text></text>
- </view>
- <view class="flex-twice flex flex-direction justify-between">
- <view class="flex-sub flex">
- <view class="flex flex-direction flex-sub">
- <text class="text-gray text-xs">鎵规淇℃伅</text>
- <text class="text-black">
- <text class="text-black">绉嶇被:</text>
- <text class="margin-lr-xs">{{showValue(model.group)}}</text>
- <text class="text-gray text-xs"></text>
- </text>
-
- </view>
- <view class="flex flex-direction flex-sub">
- <text class="text-white text-xs">鎵规</text>
- <text class="text-black">
- <text class="text-black">鎵规:</text>
- <text class="margin-lr-xs">{{showValue(model.batch)}}</text>
- <text class="text-gray text-xs"></text>
- </text>
-
- </view>
-
- </view>
- <view class="flex-sub flex margin-top-sm">
- <view class="flex flex-direction flex-sub">
- <text class="text-gray text-xs">鐑樺共淇℃伅</text>
- <text class="text-cyan">
- <text class="text-black">閲嶉噺:</text>
- <text class="margin-lr-xs">{{showValue(model.weight)}}</text>
- <text class="text-gray text-xs">kg</text>
- </text>
-
- </view>
- <view class="flex flex-direction flex-sub">
- <text class="text-white text-xs">鏃堕棿</text>
- <text class="text-cyan">
- <text class="text-black">鏃堕棿:</text>
- <text class="margin-lr-xs">{{showValue(model.dryTime)}}</text>
- <text class="text-gray text-xs">min</text>
- </text>
- </view>
-
- </view>
-
- </view>
-
- </view>
- <view class="margin-top">
- <u-scroll-list>
-
- </u-scroll-list>
-
- </view>
-
- </view>
-
-
- </view>
-
-
- <view class="card-box dynamic shadow">
- <view class="title-box">
- <view class="left">
- <uni-text class="cuIcon-titles text-blue"></uni-text>
- <view class="title">鏃ユ湡</view>
- </view>
- </view>
-
- <lunc-calendar ref="calendar" @dayChange="dayChange" weekType="鏄熸湡" @monthChange="monthChange"
- :showShrink="true" shrinkState="week" :signList="monthList"></lunc-calendar>
- </view>
-
-
-
- <view class="card-box dynamic shadow" >
- <view class="title-box">
- <view class="left">
- <uni-text class="cuIcon-titles text-blue"></uni-text>
- <view class="title">鏄庣粏</view>
- </view>
- </view>
- <u-skeleton rows="20" :loading="loading" :title="false">
- <view class="data-item" v-for="(item, index) in herbList" :key="item.id" style="padding: 0 10rpx;">
- <view class="flex justify-between text-lg align-center padding-tb-xs">
- <view class="flex">
- <text>涓崏鑽�</text>
- <text>涓�</text>
- <text @click="showLongName(showValue(item.herbName))"
- class="text-cut flex-twice">{{showValue(item.herbName)}}</text>
- <!-- <view class="margin-lr-sm">
- <u-tag text="鎶ヨ涓�娆�" plain size="mini" type="warning"></u-tag>
- </view> -->
- <view class="margin-lr-sm">
- <u-tag text="姝e父" plain size="mini" type="success"></u-tag>
- </view>
- </view>
- <view style="width:160rpx;" class="flex align-center text-xs ">
- <text>杩涘害:</text>
- <view style="width: 100rpx;">
- <u-line-progress :percentage="calcProgress(item.dryTime,item.et)"
- height="10"></u-line-progress>
- </view>
- </view>
- </view>
-
- <view style="display: flex;flex-direction: row;height: 120rpx;">
- <view class="image">
- <image :src="dataList[0].goodsUrl" mode="aspectFill"></image>
- </view>
-
- <view class="flex flex-direction margin-left-xl margin-left-sm justify-center">
- <view>
- <text class="text-xxl text-green">{{showValue(item.target)}}%</text>
- <text
- class="text-xs margin-top-xs text-grey margin-left-xs text-line-through">{{showValue(item.initial)}}%</text>
- </view>
- <text class="text-xs margin-top-xs text-grey">鍚按鐜�</text>
- </view>
-
- <view class="flex flex-direction margin-left-xl margin-left-10p justify-center">
- <view>
- <text class="text-xxl">{{showValue(item.yield )}}kg</text>
- <text
- class="text-xs margin-top-xs text-grey margin-left-xs text-line-through">{{showValue(item.originWeight)}}kg</text>
- </view>
-
- <view class="text-xs margin-top-xs text-grey">
- <text>{{showValue(item.feed)}}绛�</text>
- <text style="margin: 0 10rpx;"> l </text>
- <text>{{showValue(item.windTemp)}}鈩�</text>
- <text style="margin: 0 10rpx;"> l </text>
- <text>{{showValue(item.dryTime)}}min</text>
- </view>
- </view>
- </view>
- <u-gap height="10"></u-gap>
- <view class="text-grey text-sm flex justify-between">
- <text>{{showValue(item.code)}}</text>
- <text>{{showValue(item.orderTime)}}</text>
- </view>
- <u-line color="#f1f1f1" margin="15rpx 0 15rpx 0"></u-line>
- </view>
-
-
-
- </u-skeleton>
- </view>
-
-
<mqtt-view ref="mqttView"></mqtt-view>
- <!--
- <view class="page-box" v-show="false">
- <view class="order" v-for="(res, index) in dataList" :key="res.id">
- <view class="top">
- <view class="left">
- <uni-text class="cuIcon-titles text-blue"></uni-text>
- <view class="store">{{ res.store }}</view>
- <u-icon name="arrow-right" color="rgb(203,203,203)" :size="12"></u-icon>
- </view>
- <view class="right">
- <view class='cu-tag radius light bg-blue'>{{res.id}}</view>
- </view>
- </view>
- <view class="item">
- <view class="left">
- <image :src="res.goodsUrl" mode="aspectFill"></image>
- </view>
- <view class="content">
- <view>
- <view class="title u-line-2 text-bold">褰撳綊锛�12:00-13:00锛�</view>
- <view class="type">閲嶉噺锛�200kg</view>
- <view class="type">鍚按鐜囷細30% <text style="color: green;">(13%)</text></view>
- <view class="delivery-time">鏃堕棿锛� 60min</view>
+ <z-paging ref="paging" v-model="herbList" :auto-show-back-to-top="true" :loading-more-enabled="false" show-refresher-update-time @query="queryList">
+ <template #top>
+ <cu-custom bgColor="bg-gradual-blue" :isBack="false">
+ <block slot="content">鍏版郸鏅鸿兘骞茬嚗</block>
+ </cu-custom>
+
+ <view class="card-box dynamic shadow">
+ <view class="title-box margin-bottom-sm">
+ <view class="left justify-between">
+ <view class="flex align-center">
+ <uni-text class="cuIcon-titles text-blue"></uni-text>
+ <view class="title">鎬昏</view>
+ </view>
+ <view>
+ <text class="text-gray">{{model.date}}</text>
+ </view>
+
</view>
+
</view>
+ <view class="flex flex-direction padding-xs">
+ <view class="flex">
+ <view class="flex-sub flex flex-direction">
+ <text class="text-df">鐑樺共鏁伴噺</text>
+ <text
+ class="text-bold text-sl margin-top-xs text-cyan margin-top-sm">{{showValue(model.feed)}}
+ <text class="text-gray text-sm margin-left-xs">绛�</text></text>
+ </view>
+ <view class="flex-twice flex flex-direction justify-between">
+ <view class="flex-sub flex">
+ <view class="flex flex-direction flex-sub">
+ <text class="text-gray text-xs">鎵规淇℃伅</text>
+ <text class="text-black">
+ <text class="text-black">绉嶇被:</text>
+ <text class="margin-lr-xs">{{showValue(model.group)}}</text>
+ <text class="text-gray text-xs"></text>
+ </text>
+
+ </view>
+ <view class="flex flex-direction flex-sub">
+ <text class="text-white text-xs">鎵规</text>
+ <text class="text-black">
+ <text class="text-black">鎵规:</text>
+ <text class="margin-lr-xs">{{showValue(model.batch)}}</text>
+ <text class="text-gray text-xs"></text>
+ </text>
+
+ </view>
+
+ </view>
+ <view class="flex-sub flex margin-top-sm">
+ <view class="flex flex-direction flex-sub">
+ <text class="text-gray text-xs">鐑樺共淇℃伅</text>
+ <text class="text-cyan">
+ <text class="text-black">閲嶉噺:</text>
+ <text class="margin-lr-xs">{{showValue(model.weight)}}</text>
+ <text class="text-gray text-xs">kg</text>
+ </text>
+
+ </view>
+ <view class="flex flex-direction flex-sub">
+ <text class="text-white text-xs">鏃堕棿</text>
+ <text class="text-cyan">
+ <text class="text-black">鏃堕棿:</text>
+ <text class="margin-lr-xs">{{showValue(model.dryTime)}}</text>
+ <text class="text-gray text-xs">min</text>
+ </text>
+ </view>
+
+ </view>
+
+ </view>
+
+ </view>
+ <view class="margin-top">
+ <u-scroll-list>
+
+ </u-scroll-list>
+
+ </view>
+
+ </view>
+
+
</view>
- <u-line color="#f1f1f1" margin="24rpx 0 15rpx 0"></u-line>
- <view class="bottom">
- <view class="bottom_left">
- <text class="text-blue">骞茬嚗杩涘害锛�</text>
- <view class="progressBox">
- <u-line-progress :percentage="res.progre" height="8" :active-color="activeColor"
- :striped="true" :stripedActive="true"></u-line-progress>
+
+
+ </template>
+
+ <template>
+
+ <view class="card-box dynamic shadow">
+ <view class="title-box">
+ <view class="left">
+ <uni-text class="cuIcon-titles text-blue"></uni-text>
+ <view class="title">鏃ユ湡</view>
</view>
</view>
- <view class="btnBox">
-
- <view @click="goCharts" class="evaluate btn">鏌ョ湅鍥捐〃</view>
- </view>
+ <lunc-calendar ref="calendar" @dayChange="dayChange" weekType="鏄熸湡" @monthChange="monthChange"
+ :showShrink="true" shrinkState="week" :signList="monthList"></lunc-calendar>
</view>
- </view>
- </view> -->
+
+
+
+ <view class="card-box dynamic shadow">
+ <view class="title-box">
+ <view class="left">
+ <uni-text class="cuIcon-titles text-blue"></uni-text>
+ <view class="title">宸ュ崟</view>
+ </view>
+ </view>
+ <u-skeleton rows="20" :loading="loading" :title="false">
+ <view class="data-item" v-for="(item, index) in herbList" :key="item.id"
+ style="padding: 0 10rpx;">
+ <view class="flex justify-between text-lg align-center padding-tb-xs">
+ <view class="flex">
+ <text>涓崏鑽�</text>
+ <text>涓�</text>
+ <text @click="showLongName(showValue(item.herbName))"
+ class="text-cut flex-twice">{{showValue(item.herbName)}}</text>
+
+ <view class="margin-lr-sm">
+ <u-tag v-if="item.orderStatus == 0" text="鍑嗗" plain size="mini"
+ type="warning"></u-tag>
+ <u-tag v-else-if="item.orderStatus == 1" text="涓婃枡" plain size="mini"
+ type="warning"></u-tag>
+ <u-tag v-else-if="item.orderStatus == 2" text="鐢熶骇" plain size="mini"
+ type="primary"></u-tag>
+ <u-tag v-else-if="item.orderStatus == 3" text="鏆傚仠" plain size="mini"
+ type="warning"></u-tag>
+ <u-tag v-else-if="item.orderStatus == 4" text="瀹屾垚" plain size="mini"
+ type="success"></u-tag>
+ </view>
+ </view>
+ <view style="width:160rpx;" class="flex align-center text-xs ">
+ <text>杩涘害:</text>
+ <view style="width: 100rpx;">
+ <u-line-progress :percentage="calcProgress(item.dryTime,item.et)"
+ height="10"></u-line-progress>
+ </view>
+ </view>
+ </view>
+
+ <view style="display: flex;flex-direction: row;height: 120rpx;">
+ <view class="image">
+ <image :src="dataList[0].goodsUrl" mode="aspectFill"></image>
+ </view>
+
+ <view class="flex flex-direction margin-left-xl margin-left-sm justify-center">
+ <view>
+ <text class="text-xxl text-green">{{showValue(item.target)}}%</text>
+ <text
+ class="text-xs margin-top-xs text-grey margin-left-xs text-line-through">{{showValue(item.initial)}}%</text>
+ </view>
+ <text class="text-xs margin-top-xs text-grey">鍚按鐜�</text>
+ </view>
+
+ <view class="flex flex-direction margin-left-xl margin-left-10p justify-center">
+ <view>
+ <text class="text-xxl">{{showValue(item.yield )}}kg</text>
+ <text
+ class="text-xs margin-top-xs text-grey margin-left-xs text-line-through">{{showValue(item.originWeight)}}kg</text>
+ </view>
+
+ <view class="text-xs margin-top-xs text-grey">
+ <text>{{showValue(item.feed)}}绛�</text>
+ <text style="margin: 0 10rpx;"> l </text>
+ <text>{{showValue(item.windTemp)}}鈩�</text>
+ <text style="margin: 0 10rpx;"> l </text>
+ <text>{{showValue(item.dryTime)}}min</text>
+ </view>
+ </view>
+ </view>
+ <u-gap height="10"></u-gap>
+ <view class="text-grey text-sm flex justify-between">
+ <text>{{showValue(item.code)}}</text>
+ <text>{{showValue(item.orderTime)}}</text>
+ </view>
+ <u-line color="#f1f1f1" margin="15rpx 0 15rpx 0"></u-line>
+ </view>
+
+
+
+ </u-skeleton>
+ </view>
+
+
+ </template>
+
+ </z-paging>
</view>
</template>
@@ -293,6 +268,7 @@
],
model: {
date: uni.$u.timeFormat(new Date(), 'yyyy-mm-dd'),
+ month: uni.$u.timeFormat(new Date(), 'yyyy-mm')
},
herbList: []
}
@@ -300,11 +276,7 @@
onShow() {
},
- mounted() {
-
-
-
- },
+ mounted() {},
onReady() {
//鎺ユ敹鎶ヨ淇℃伅锛屾暟鎹澶勭悊锛堟湭鎵撳紑tab鏃犳硶鎺ユ敹鏁版嵁锛�
uni.$on(this.$constant.MQTT_TOPIC_MESSAGE, (data) => {
@@ -340,10 +312,6 @@
let month = uni.$u.timeFormat(new Date(), 'yyyy-mm')
this.getMonth(month)
- let day = uni.$u.timeFormat(new Date(), 'yyyy-mm-dd')
- this.getOrderList(day, day);
-
-
},
onLoad() {},
onTabItemTap: function(e) {
@@ -367,9 +335,9 @@
// #endif
// #ifdef APP-PLUS
url: 'wx://' + this.$api.mqttBaseUrl + ':8083/mqtt',
- // #endif
- // #ifdef MP-WEIXIN
- url: 'wss://' + this.$api.mqttBaseUrl + '/mqtt', // 蹇呴』鐢� wss锛岀鍙i�氬父涓�443鍙渷鐣�
+ // #endif
+ // #ifdef MP-WEIXIN
+ url: 'wss://' + this.$api.mqttBaseUrl + '/mqtt', // 蹇呴』鐢� wss锛岀鍙i�氬父涓�443鍙渷鐣�
// #endif
clientId: this.deviceId,
username: account.username,
@@ -400,8 +368,8 @@
qos: 0
}).then(res => {
console.error(res)
- })
-
+ })
+
//璁㈤槄鍙戦�佹寚浠よ繑鍥炵粨鏋�
// this.$mqttTool.subscribe({
@@ -443,7 +411,7 @@
},
dayChange(dayInfo) { // 鐐瑰嚮鏃ユ湡
this.model.date = dayInfo.date
- this.getOrderList(dayInfo.date, dayInfo.date);
+ this.$refs.paging.refresh();
},
monthChange(monthInfo) { // 鍒囨崲鏈堜唤
let m = monthInfo.month
@@ -464,41 +432,54 @@
url: "/packageA/pages/charts/charts"
})
},
- getOrderList(date1, date2) {
- let params = {
- "orderTime_begin": date1 + " 00:00:00",
- "orderTime_end": date2 + " 23:59:59",
- }
+ queryList(pageNo, pageSize) {
this.loading = true;
+ const params = {
+ pageNo: 1,
+ pageSize: 30,
+ "orderTime_begin": this.model.date + " 00:00:00",
+ "orderTime_end": this.model.date + " 23:59:59",
+ }
+
this.$api.getOrderList(params).then((res) => {
- setTimeout(()=>{
- this.loading = false
- },200)
- if (res.success) {
- this.herbList = res.result.records
+ this.$refs.paging.complete(res.result.records);
+ this.loading = false
- let feed = this.countTotal(this.herbList, "feed");
- let weight = this.countTotal(this.herbList, "originWeight");
- let dryTime = this.countTotal(this.herbList, "dryTime");
-
- let gList = [];
- this.herbList.forEach(item => {
- if (!gList.includes(item.herbName)) {
- gList.push(item.herbName)
- }
- });
-
- if (weight) {
- weight = weight.toFixed(1)
- }
- this.model.feed = feed
- this.model.group = gList.length
- this.model.batch = this.herbList.length
- this.model.weight = weight
- this.model.dryTime = dryTime
+ const records = res.result.records
+ if (!records) {
+ return false;
}
+
+
+ let feed = this.countTotal(records, "feed");
+ let weight = this.countTotal(records, "originWeight");
+ let dryTime = this.countTotal(records, "dryTime");
+
+ let gList = [];
+ records.forEach(item => {
+ if (!gList.includes(item.herbName)) {
+ gList.push(item.herbName)
+ }
+ });
+
+ if (weight) {
+ weight = weight.toFixed(1)
+ }
+ this.model.feed = feed
+ this.model.group = gList.length
+ this.model.batch = records.length
+ this.model.weight = weight
+ this.model.dryTime = dryTime
+
+ }).catch(res => {
+ this.$refs.paging.complete(false);
+ this.loading = false
})
+
+
+
},
+
getMonth(month) {
let params = {
month: month
diff --git a/pages/tabBar/me.vue b/pages/tabBar/me.vue
index ad010a9..35ac329 100644
--- a/pages/tabBar/me.vue
+++ b/pages/tabBar/me.vue
@@ -253,9 +253,9 @@
uni.reLaunch({
url: '/pages/login/login'
});
- this.$mqttTool.end().then(res => {
- console.error(res)
- })
+ // this.$mqttTool.end().then(res => {
+ // console.error(res)
+ // })
},
cancel() {
this.show = false
diff --git a/pages/tabBar/warning.vue b/pages/tabBar/warning.vue
index c6e6b9e..7ecc874 100644
--- a/pages/tabBar/warning.vue
+++ b/pages/tabBar/warning.vue
@@ -116,9 +116,11 @@
<!-- 濡傛灉甯屾湜鍏朵粬view璺熺潃椤甸潰婊氬姩锛屽彲浠ユ斁鍦▃-paging鏍囩鍐� -->
<!-- <real-warning ref="realWarining" v-if="tabCurrent === 0" @handleData="realHandleData"></real-warning> -->
- <his-warning ref="hisWarining" v-if="tabCurrent === 0" @handleData="hisHandleData"></his-warning>
+ <!-- <his-warning ref="hisWarining" v-if="tabCurrent === 0" @handleData="hisHandleData"></his-warning> -->
-
+ <view style="z-index: 1;">
+ <his-warning ref="hisWarining" v-if="tabCurrent === 0" @handleData="hisHandleData"></his-warning>
+ </view>
</z-paging>
</view>
</template>
--
Gitblit v1.9.3