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/weighingDevice/weighingDevice.vue | 23 ++++++++++++++++------- 1 files changed, 16 insertions(+), 7 deletions(-) diff --git a/pages/driver-page/driver-index/bill-of-lading-details/weighingDevice/weighingDevice.vue b/pages/driver-page/driver-index/bill-of-lading-details/weighingDevice/weighingDevice.vue index 47564df..cea97c8 100644 --- a/pages/driver-page/driver-index/bill-of-lading-details/weighingDevice/weighingDevice.vue +++ b/pages/driver-page/driver-index/bill-of-lading-details/weighingDevice/weighingDevice.vue @@ -12,7 +12,7 @@ </view> <view class=""> 绾㈠: - <u--text :type="infraredStatus ? 'error' : 'success'" :text="infraredStatus ? '寮傚父' : '姝e父'" size="34"></u--text> + <u--text :type="globalinfraredStatus ? 'error' : 'success'" :text="globalinfraredStatus ? '寮傚父' : '姝e父'" size="34"></u--text> </view> <!-- <view class=""> 闆疯揪: @@ -40,9 +40,9 @@ <u-button type="primary" text="纭畾绉伴噸" - :disabled="realTimeWeigh == 0 || infraredStatus" + :disabled="realTimeWeigh == 0 || globalinfraredStatus" :loading="isConfirmWeighLoading" - loadingText="鍔犺浇涓�" + loadingText="纭" @click="confirmWeigh" ></u-button> <u-button type="primary" text="杩斿洖鍔犲噺鍚�" :disabled="addAndSubtractCoalDisabled" @click="addAndSubtractCoal" class="jiajian"></u-button> @@ -65,14 +65,16 @@ <script> let socket = null; import { webSocketUrl } from '@/api/request.js'; +import { mapState, mapMutations } from 'vuex'; +import toast from '../../../../../uni_modules/uview-ui/libs/config/props/toast'; export default { onLoad(params) { - console.log(params, '绗簩娆℃斁绌哄弬鏁�'); this.takeCoalId = params.takeCoalId; this.weighData.sceneId = params.sceneId; this.weighData.gateCameraId = params.gateCameraId; this.weighData.equipmentCode = params.gateCameraCode; this.weighHouseCode = params.weighHouseCode; + this.changeweighHouseCode(params.weighHouseCode); }, data() { return { @@ -118,6 +120,7 @@ }, watch: { realTimeWeigh(newV, oldV) { + console.log(newV); if (this.weighList.orderType == '澶栭攢' || this.weighList.orderType == '鍐呴攢') { if (this.weighList.skin == 0) { // this.temporaryWeighObj.skin = this.realTimeWeigh; @@ -137,13 +140,18 @@ this.temporaryWeighObj.clean = (this.weighList.hair - this.temporaryWeighObj.skin).toFixed(2); } } + }, + // 鐩戝惉閲嶉噺鍙樺寲 + globalweigh(v) { + this.weighData.weigh = this.realTimeWeigh = v; } }, onShow() { this.init(); - this.initWebSocket(); + // this.initWebSocket(); }, computed: { + ...mapState(['globalweigh', 'globalinfraredStatus']), token() { return uni.getStorageSync('token'); }, @@ -167,6 +175,7 @@ } }, methods: { + ...mapMutations(['changeweighHouseCode']), init() { // 鑾峰彇绉伴噸淇℃伅 this.$reqGet('weighList', { id: this.takeCoalId }).then(res => { @@ -216,6 +225,8 @@ }); this.isConfirmWeighLoading = false; }, 1000); + } else { + this.$u.toast('绉伴噸澶辫触锛岃绋嶅悗閲嶈瘯'); } }) .catch(err => { @@ -259,8 +270,6 @@ socket.onMessage(res => { console.log('socketWeigh', res); let nowWeighObj = JSON.parse(res.data.slice(7)); - console.log(nowWeighObj); - // 涓�寮�濮嬫槸weighHouseCode if (nowWeighObj.eqCode == this.weighHouseCode) { if (nowWeighObj.eqInfraredStatus) { this.infraredStatus = true; -- Gitblit v1.9.1