schangxiang@126.com
2024-06-19 f2d05ad289280fec72e58372723db68c6d72a866
yiqi_pda/pages/outBound/index.vue
@@ -1,12 +1,14 @@
<template>
   <default-header-page-layout ref="page" title="出库执行">
      <view class="page-frame with-action-user-row" :style="{height:pageBodyHeight+'px'}" v-if="pageBodyHeight">
         <action-user-row />
         <view class="with-action-user-row-page-content">
            <scan-input-form-item  :inputFocus="inputFocus" v-model="OP80NewCode" class="forma-item" label="OP80成品码/工件二维码"  :msg="msg" :msg-type="msgType"
               @search="onSearchContainter" @clear="onClearContainter" />
         <scan-input-form-item  :inputFocus="inputFocus" v-model="OP80NewCode" class="forma-item" :label="baseTitile"  :msg="msg" :msg-type="msgType"
            @search="onSearchContainter" @clear="onClearContainter" />
         <view class="with-action-user-row-page-content"  >
         
         <Content @deleteData="deleteData" :workPieceData="workPieceData" />
         <Content @deleteData="deleteData" :workPieceData="workPieceData"  />
         </view>
         <modalPwd  @reflesh="reflesh" ref="pwdRef"/>
      </view>
@@ -26,6 +28,7 @@
   import ScanInputFormItem from './modules/ScanInputFormItem.vue'
   import Content from './modules/content.vue'
   import modalPwd from './modules/modalPwd.vue'
   import Vue from 'vue'
   import {
      parseDic,
      $alert,
@@ -33,7 +36,8 @@
   } from '@/static/js/utils/index.js'
   import {
      getWorkPieceByOP80NewCode,
      outBoundWorkPiece
      outBoundWorkPiece,
      getOutBoundWorkPieceInfoCount
   } from '@/api/outBound/index.js'
   import {listbycode} from '@/api/common/index.js'
   export default {
@@ -47,8 +51,13 @@
      },
      data() {
         return {
            barHeight: '',
            ckNumToday:"0",//今天总出库数
            baseTitile:'扫描成品码/工件二维码',//扫描成品码/工件二维码
            title:'',
            pageBodyHeight: 0,
            initInterVal: null,
            myInterval: null,
            msg: '',
            msgType: 'error',
            OP80NewCode: '',
@@ -59,8 +68,21 @@
         }
      },
      onLoad() {
         var _this=this;
         _this._getOutBoundWorkPieceInfoCount();
         this.myInterval=setInterval(function(){ _this._getOutBoundWorkPieceInfoCount();}, 1000*10);
         //this.myInterval=setInterval(this.myFun(), 3000);
      },
      methods: {
         // 获取工件信息
         async _getOutBoundWorkPieceInfoCount(OP80NewCode) {
            try{
               let {data}=await getOutBoundWorkPieceInfoCount(null)
               this.ckNumToday =data;
            }catch(e){
            }
            this.setMsg();
         },
         // 获取工件信息
         async onSearchContainter(OP80NewCode) {
            this.inputFocus=false
@@ -84,6 +106,11 @@
               //TODO handle the exception
               console.log(e);
            }
            //this.msg = " 扫码数:"+this.workPieceData.length+"    今日出库数:";
            this.setMsg();
         },
         setMsg(){
            this.msg = " 扫码数:"+this.workPieceData.length+"    今日出库数:"+this.ckNumToday;
         },
         initFocus(num){
            setTimeout(()=>{
@@ -107,6 +134,7 @@
         },
         deleteData(opt){
            this.workPieceData=this.workPieceData.filter(item=>item.workPieceID!=opt.workPieceID)
            this.setMsg();
         },
         reflesh(){
            this.OP80NewCode = ''
@@ -134,6 +162,7 @@
         /* 页面初始化获取页面body高度的定时器 */
         startInitInterval(callback) {
            this.initInterVal = setInterval(() => {
               //console.log('bbb')
               if (this.pageBodyHeight) {
                  this.clearInitInterval()
                  callback && callback()
@@ -145,25 +174,71 @@
         /* 清除定时器 */
         clearInitInterval() {
            try {
               //alert('执行');
               clearInterval(this.initInterVal)
               this.initInterVal = null
            } catch (e) {
               //TODO handle the exception
            }
         },
         clearInitInterval2() {
            try {
               clearInterval(this.myInterval)
               this.myInterval = null
            } catch (e) {
               //TODO handle the exception
            }
         },
         comfirmUpdate() {
            this.$refs.pwdRef.showModal(this.barDetail);
         },
         myFun(){
            console.log('aaaa')
         }
      },
      onReady() {
         this.setMsg();
         this.startInitInterval(() => {
            /* 页面初始化后需要执行的代码在这边调用 */
            // this.listbycode()
         })
      },
      mounted() {
         // 设置fixed定位
         //this.barHeight = Vue.prototype.CustomBar || 45
         this.barHeight =  Vue.prototype.CustomBar
      },
      onUnload() {
         //alert(11); 页面离开时
         this.clearInitInterval()
      }
         this.clearInitInterval2();
      },
      //监听原生返回键
      onBackPress(e) {
         // 此处一定要return为true,否则页面不会返回到指定路径
         if(1!=1){
            return false //可返回
         }else{
            uni.showModal({
            title: '提示',
            content: '是否确认返回?',
            showCancel: true,
            cancelColor: '#333333',
            success: (res => {
                  if (res.confirm) {
                     uni.redirectTo({
                        url: '/pages/home/index'
                     })
                  } else if (res.cancel) {
                  }
               })
            });
            return true
         }
      },
   }
</script>