From b5bcf90f2dfc8972090d7ab8e6a350bd74b460c8 Mon Sep 17 00:00:00 2001 From: schangxiang@126.com <schangxiang@126.com> Date: 周五, 06 9月 2024 10:21:29 +0800 Subject: [PATCH] 入库优化 --- yiqi_pda/pages/outBound/index.vue | 163 +++++++++++++++++++++++++++++++++--------------------- 1 files changed, 100 insertions(+), 63 deletions(-) diff --git a/yiqi_pda/pages/outBound/index.vue b/yiqi_pda/pages/outBound/index.vue index 0e8f82c..39e268a 100644 --- a/yiqi_pda/pages/outBound/index.vue +++ b/yiqi_pda/pages/outBound/index.vue @@ -1,21 +1,22 @@ <template> - <default-header-page-layout ref="page" title="鍑哄簱鎵ц"> - + <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 /> - <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" /> + <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" /> </view> - <modalPwd @reflesh="reflesh" ref="pwdRef"/> + <modalPwd @reflesh="reflesh" ref="pwdRef" /> </view> <template v-slot:footer> <view class="bottom-btns-row"> <view class="btn-frame right-btn-frame"> - <u-button :disabled="workPieceData.length<1" type="primary" text="纭鍑哄簱" @click="outBoundConfirm"></u-button> + <u-button :disabled="workPieceData.length<1" type="primary" text="纭鍏ュ簱" + @click="outBoundConfirm"></u-button> </view> </view> </template> @@ -39,7 +40,9 @@ outBoundWorkPiece, getOutBoundWorkPieceInfoCount } from '@/api/outBound/index.js' - import {listbycode} from '@/api/common/index.js' + import { + listbycode + } from '@/api/common/index.js' export default { name: 'baseInPage', components: { @@ -52,75 +55,97 @@ data() { return { barHeight: '', - ckNumToday:"0",//浠婂ぉ鎬诲嚭搴撴暟 - baseTitile:'鎵弿鎴愬搧鐮�/宸ヤ欢浜岀淮鐮�',//鎵弿鎴愬搧鐮�/宸ヤ欢浜岀淮鐮� - title:'', + ckNumToday: "0", //浠婂ぉ鎬诲叆搴撴暟 + baseTitile: '鎵弿鎴愬搧鐮�/宸ヤ欢浜岀淮鐮�', //鎵弿鎴愬搧鐮�/宸ヤ欢浜岀淮鐮� + title: '', pageBodyHeight: 0, initInterVal: null, myInterval: null, msg: '', msgType: 'error', OP80NewCode: '', - workPieceData:[], + workPieceData: [], workPieceStatus: [], - inputFocus:true, + inputFocus: true, // codeLength:1 } }, onLoad() { - var _this=this; + var _this = this; _this._getOutBoundWorkPieceInfoCount(); - this.myInterval=setInterval(function(){ _this._getOutBoundWorkPieceInfoCount();}, 1000*10); + //涓嶅啀寰幆璇� + /* + 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){ - } + try { + let { + data + } = await getOutBoundWorkPieceInfoCount(null) + this.ckNumToday = data; + } catch (e) {} this.setMsg(); }, // 鑾峰彇宸ヤ欢淇℃伅 async onSearchContainter(OP80NewCode) { - this.inputFocus=false + //debugger + if (OP80NewCode.length != 21) { + this.initFocus(100); + // uni.showToast({ + // title: '宸ヤ欢鐮佹垨鎴愬搧鐮侀暱搴︿笉姝g‘', + // icon: 'error', + // duration: 2000, + // mask: true + // }); + return; + } + + this.inputFocus = false const param = { OP80NewCode: OP80NewCode } - try{ - let {data}=await getWorkPieceByOP80NewCode(param) - if(!this.workPieceData.some(item=>item.workPieceID==data.workPieceID)) { - data.addTime=new Date(); + try { + let data={}; + data.addTime = new Date(); + data.workPieceID=OP80NewCode; + data.oP80NewCode=OP80NewCode; + if (!this.workPieceData.some(item => item.workPieceID == data.workPieceID)) { + data.addTime = new Date(); this.workPieceData.push(data) } //椤哄簭璋冭浆锛屾帓搴� this.workPieceData.sort((a, b) => b.addTime - a.addTime); + this.OP80NewCode = ''; //姣忔鍒峰畬灏辨竻绌鸿緭鍏ユ 銆怑ditby shaocx,2024-06-12銆� this.initFocus(100); //console.log(this.workPieceData,'dsts'); // setTimeout(()=>{ // this.OP80NewCode = '' ;//姣忔鍒峰畬灏辨竻绌鸿緭鍏ユ 銆怑ditby shaocx,2024-06-12銆� // this.inputFocus=true // },100) - }catch(e){ + } catch (e) { //debugger this.initFocus(100); //TODO handle the exception console.log(e); } - //this.msg = " 鎵爜鏁�:"+this.workPieceData.length+" 浠婃棩鍑哄簱鏁�:"; + //this.msg = " 鎵爜鏁�:"+this.workPieceData.length+" 浠婃棩鍏ュ簱鏁�:"; this.setMsg(); }, - setMsg(){ - this.msg = " 鎵爜鏁�:"+this.workPieceData.length+" 浠婃棩鍑哄簱鏁�:"+this.ckNumToday; + setMsg() { + this.msg = " 鎵爜鏁�:" + this.workPieceData.length + " 浠婃棩鍏ュ簱鏁�:" + this.ckNumToday; }, - initFocus(num){ - setTimeout(()=>{ - this.OP80NewCode = '' ;//姣忔鍒峰畬灏辨竻绌鸿緭鍏ユ 銆怑ditby shaocx,2024-06-12銆� - this.inputFocus=true - },num) + initFocus(num) { + setTimeout(() => { + this.OP80NewCode = ''; //姣忔鍒峰畬灏辨竻绌鸿緭鍏ユ 銆怑ditby shaocx,2024-06-12銆� + this.inputFocus = true + }, num) }, // 鑾峰彇鎵爜闀垮害 // async listbycode(){ @@ -131,37 +156,49 @@ // //TODO handle the exception // console.log(e); // } - + // }, onClearContainter() { this.OP80NewCode = '' }, - deleteData(opt){ - this.workPieceData=this.workPieceData.filter(item=>item.workPieceID!=opt.workPieceID) + deleteData(opt) { + this.workPieceData = this.workPieceData.filter(item => item.workPieceID != opt.workPieceID) this.setMsg(); }, - reflesh(){ + reflesh() { this.OP80NewCode = '' - this.workPieceData=[] + this.workPieceData = [] + setTimeout(() => { + this._getOutBoundWorkPieceInfoCount(); + this.setMsg(); + }, 1000) }, - outBoundConfirm(){ + outBoundConfirm() { + this.$refs.pwdRef.showModal(this.workPieceData) + + /* // 瀛樺湪闈炴垚鍝� - const flag=this.workPieceData.some(item=>item.workPieceState!=10) - if(flag) { + const flag = this.workPieceData.some(item => item.workPieceState != 10) + if (flag) { uni.showModal({ - title:'鎻愮ず', - content:'褰撳墠宸ヤ欢瀛樺湪闈炴垚鍝侊紝纭畾寮哄埗鍑哄簱鍚楋紵', - success:(value)=>{ - const {confirm,cancel}=value - if(confirm) { + title: '鎻愮ず', + content: '褰撳墠宸ヤ欢瀛樺湪闈炴垚鍝侊紝纭畾寮哄埗鍏ュ簱鍚楋紵', + success: (value) => { + const { + confirm, + cancel + } = value + if (confirm) { this.$refs.pwdRef.showModal(this.workPieceData) } } }) - }else{ + } else { this.$refs.pwdRef.showModal(this.workPieceData) } + //*/ + }, /* 椤甸潰鍒濆鍖栬幏鍙栭〉闈ody楂樺害鐨勫畾鏃跺櫒 */ startInitInterval(callback) { @@ -196,23 +233,23 @@ comfirmUpdate() { this.$refs.pwdRef.showModal(this.barDetail); }, - myFun(){ + myFun() { console.log('aaaa') } }, onReady() { this.setMsg(); - + this.startInitInterval(() => { /* 椤甸潰鍒濆鍖栧悗闇�瑕佹墽琛岀殑浠g爜鍦ㄨ繖杈硅皟鐢� */ // this.listbycode() - + }) }, mounted() { // 璁剧疆fixed瀹氫綅 //this.barHeight = Vue.prototype.CustomBar || 45 - this.barHeight = Vue.prototype.CustomBar + this.barHeight = Vue.prototype.CustomBar }, onUnload() { //alert(11); 椤甸潰绂诲紑鏃� @@ -222,21 +259,21 @@ //鐩戝惉鍘熺敓杩斿洖閿� onBackPress(e) { // 姝ゅ涓�瀹氳return涓簍rue锛屽惁鍒欓〉闈笉浼氳繑鍥炲埌鎸囧畾璺緞 - if(1!=1){ + if (1 != 1) { return false //鍙繑鍥� - }else{ + } else { uni.showModal({ - title: '鎻愮ず', - content: '鏄惁纭杩斿洖锛�', - showCancel: true, - cancelColor: '#333333', - success: (res => { + title: '鎻愮ず', + content: '鏄惁纭杩斿洖锛�', + showCancel: true, + cancelColor: '#333333', + success: (res => { if (res.confirm) { uni.redirectTo({ url: '/pages/home/index' }) } else if (res.cancel) { - + } }) }); -- Gitblit v1.9.3