qingyiay
2023-04-14 0becab45282781f281ad5aa04202b83039ab275e
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 ? '异常' : '正常'" size="34"></u--text>
                  <u--text :type="globalinfraredStatus ? 'error' : 'success'" :text="globalinfraredStatus ? '异常' : '正常'" 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;