From 0becab45282781f281ad5aa04202b83039ab275e Mon Sep 17 00:00:00 2001
From: qingyiay <2386314947@qq.com>
Date: 星期五, 14 四月 2023 17:42:08 +0800
Subject: [PATCH] 增加发运统计页面,修改websocket,增加消息推送
---
pages/driver-page/driver-index/bill-of-lading-details/bill-of-lading-details.vue | 59 ++++++++++++-----------------------------------------------
1 files changed, 12 insertions(+), 47 deletions(-)
diff --git a/pages/driver-page/driver-index/bill-of-lading-details/bill-of-lading-details.vue b/pages/driver-page/driver-index/bill-of-lading-details/bill-of-lading-details.vue
index f4a9bc0..c5bc631 100644
--- a/pages/driver-page/driver-index/bill-of-lading-details/bill-of-lading-details.vue
+++ b/pages/driver-page/driver-index/bill-of-lading-details/bill-of-lading-details.vue
@@ -3,7 +3,7 @@
<view class="bangDanMessage">
<view class="">
<text>瀹㈡埛锛歿{ coalDetailsData.customerName || '' }}</text>
- <text>鐭垮巶锛歿{ coalDetailsData.deptName || '' }}</text>
+ <text>鐭垮満锛歿{ coalDetailsData.deptName || '' }}</text>
</view>
<view class="">
<text>鐨噸锛歿{ coalDetailsData.skin || '' }}</text>
@@ -11,7 +11,7 @@
<text>鍑�閲嶏細{{ coalDetailsData.clean || '' }}</text>
</view>
<view class="">
- <text>纾呭崟绫诲瀷锛歿{ coalDetailsData.orderTye || '' }}</text>
+ <text>纾呭崟绫诲瀷锛歿{ coalDetailsData.orderType || '' }}</text>
<text>鐘舵�侊細{{ coalStatus[coalDetailsData.status] }}</text>
</view>
<view class="">
@@ -48,8 +48,8 @@
</template>
<script>
-let socket = null;
import { webSocketUrl } from '@/api/request.js';
+import { mapState, mapMutations } from 'vuex';
export default {
onLoad(value) {
if (value.orderPlanId && value.yyId) {
@@ -100,7 +100,7 @@
sceneId: '',
gateCameraId: '',
equipmentCode: '',
- weigh: 30
+ weigh: 0
}
};
},
@@ -108,6 +108,7 @@
this.init();
},
computed: {
+ ...mapState(['globalweigh', 'globalinfraredStatus']),
name() {
return uni.getStorageSync('name');
},
@@ -248,51 +249,11 @@
uni.navigateTo({
url: `/pages/driver-page/driver-index/bill-of-lading-details/weighingDevice/weighingDevice?takeCoalId=${this.orderPlanId}&sceneId=${
res.data.id
- }&gateCameraId=${res.data.lastEquipmentId}&gateCameraCode=${res.data.lastEquipmentCode}&weighHouseCode=${res.data.code}&getWeightHouseObj=${JSON.stringify(
- this.getWeightHouseObj
- )}`
+ }&gateCameraId=${res.data.lastEquipmentId}&gateCameraCode=${res.data.lastEquipmentCode}&weighHouseCode=${res.data.code}`
});
} else {
this.$u.toast('鏈湪纾呮埧锛岃鍓嶅線纾呮埧鍚庡啀璇曪紒锛�');
}
- });
- },
- /**
- * 鍒濆鍖� weoSocket
- */
- initWebSocket() {
- let wsUrl = `${webSocketUrl}?access_token=${uni.getStorageSync('token')}`;
- socket = uni.connectSocket({
- url: wsUrl,
- header: {
- CLIENT_TOC: 'Y'
- },
- complete: res => {
- console.log(res, 'socket缁撴灉');
- }
- });
- socket.onOpen(() => {
- console.log('onOpen');
- });
- // 鑾峰彇鏈嶅姟鍣ㄤ紶鏉ョ殑鏁版嵁锛屽仛鐩稿簲澶勭悊
- socket.onMessage(res => {
- console.log('socketWeigh', res);
- let nowWeighObj = JSON.parse(res.data.slice(7));
- if (nowWeighObj.eqCode == this.weighHouseCode) {
- if (nowWeighObj.eqInfraredStatus) {
- this.weighData.weigh = nowWeighObj.weigh;
- } else {
- this.weighData.weigh = nowWeighObj.weigh;
- }
- }
- });
- socket.onClose(() => {
- console.log('webSocketClose');
- this.$u.toast('纾呮埧涓柇');
- });
- socket.onError(err => {
- console.log('socket鎶ラ敊', err);
- this.$u.toast('鍑虹幇閿欒锛岃閲嶆柊杩涘叆璇ラ〉闈紝閲嶈瘯锛侊紒');
});
},
// 鏀剧┖
@@ -301,14 +262,18 @@
},
// 鏀剧┖寮圭獥纭
evacuationConfirm() {
+ this.weighData = {
+ ...this.weighData,
+ weigh: this.globalweigh
+ };
let mix = Object.assign(this.weighData, this.getWeightHouseObj);
this.$reqPost('getOneEvacuation', mix, 'json').then(res => {
console.log(res, '绗竴娆℃斁绌�');
if (res.code == 0) {
- this.$u.toast('宸叉斁绌�');
+ this.$u.toast('鎿嶄綔鎴愬姛');
this.evacuationModalShow = false;
} else {
- this.$u.toast('鏀剧┖澶辫触锛岃绋嶅悗閲嶈瘯');
+ this.$u.toast('鎿嶄綔澶辫触锛岃绋嶅悗閲嶈瘯');
this.evacuationModalShow = false;
}
});
--
Gitblit v1.9.1