Browse Source

优化扫描

lijuncheng0816
lijuncheng 3 months ago
parent
commit
1395fb7523
  1. 49
      src/mycomponents/scan/winComScan.vue
  2. 4
      src/pages/package/coms/comScanPackagePack.vue

49
src/mycomponents/scan/winComScan.vue

@ -4,15 +4,11 @@
<view> <view>
<view class="pop_tab"> <view class="pop_tab">
<view class="tab_info"> <view class="tab_info">
<view class="conbox" > <view class="conbox">
<textarea <textarea v-model="scanMsg" trim="all" maxlength="1000" style="margin-left: 5px;width: 90%;"
v-model="scanMsg" trim="all" maxlength="1000" style="margin-left: 5px;width: 90%;" :placeholder="placeholderValue" :focus="boxfocus" @blur="handleBlur" @focus="handleFocus"
:placeholder="placeholderValue" @input="handelScanMsg" ></textarea>
:focus="boxfocus" </view>
@blur="handleBlur"
@focus="handleFocus"
@input="handelScanMsg" :cursor="cursorIndex" ></textarea>
</view>
<view class="uni-flex uni-row space-between u-col-center"> <view class="uni-flex uni-row space-between u-col-center">
<!-- <view class="paizhao" @click="scanQRCode()" v-if="true"> <!-- <view class="paizhao" @click="scanQRCode()" v-if="true">
@ -20,7 +16,7 @@
</view> --> </view> -->
<view class="uni-flex"> <view class="uni-flex">
<button class="clean_scan_btn" @touchend.prevent="clearScanValue()">清空</button> <button class="clean_scan_btn" @touchend.prevent="clearScanValue()">清空</button>
<button class="scan_btn" @click="clickScanMsg()">扫描</button> <button class="scan_btn" @click="clickScanMsg()">扫描</button>
</view> </view>
</view> </view>
@ -37,8 +33,7 @@
</view> </view>
</view> </view>
<u-line class='line_color' style='padding-top: 10rpx;padding-bottom: 20rpx;'></u-line> <u-line class='line_color' style='padding-top: 10rpx;padding-bottom: 20rpx;'></u-line>
<scroll-view scroll-y="true" class="scroll-view" v-if="expand" <scroll-view scroll-y="true" class="scroll-view" v-if="expand" style="height: 70px;">
style="height: 70px;">
<view class="uni-flex u-col" v-for="(item,index) in scanList"> <view class="uni-flex u-col" v-for="(item,index) in scanList">
<view style="width: 100%;max-height: 100px;"> <view style="width: 100%;max-height: 100px;">
<view class="uni-flex u-row space-between u-col-center" @click="showItem(item)"> <view class="uni-flex u-row space-between u-col-center" @click="showItem(item)">
@ -59,7 +54,7 @@
<comMessage ref="comMessage"></comMessage> <comMessage ref="comMessage"></comMessage>
</view> </view>
</template> </template>
<script > <script>
import { import {
getLabelInfo getLabelInfo
} from '../../common/label.js'; } from '../../common/label.js';
@ -139,7 +134,7 @@
}, },
clearScanValue() { clearScanValue() {
this.scanMsg = '' this.scanMsg = ''
this.cursorIndex =0 // this.cursorIndex = 0
this.getfocus(); this.getfocus();
}, },
clickScanMsg() { clickScanMsg() {
@ -153,11 +148,13 @@
// mask: true // mask: true
// }) // })
let that = this; let that = this;
let index = that.scanMsg.indexOf('\n'); // if(index==-1){
if (index >= 0) { // that.scanMsg =that.scanMsg + "\n";
// }
if (that.scanMsg.includes('\n')) {
// that.scanMsg = 'HPQ;V1.0;ICE115F11161AG;PP20230427000027;B20230427002;Q50'; // that.scanMsg = 'HPQ;V1.0;ICE115F11161AG;PP20230427000027;B20230427002;Q50';
setTimeout(() => { setTimeout(() => {
that.losefocus(); that.losefocus();
let content = uni.$u.trim(that.scanMsg) let content = uni.$u.trim(that.scanMsg)
if (content == "") { if (content == "") {
// that.getfocus(); // that.getfocus();
@ -176,7 +173,7 @@
getLabelInfo(content, this.headerType, callback => { getLabelInfo(content, this.headerType, callback => {
// uni.hideLoading(); // uni.hideLoading();
let scanResult = callback; let scanResult = callback;
scanResult.scanMessage=content scanResult.scanMessage = content
if (scanResult.success) { if (scanResult.success) {
that.clear(); that.clear();
// that.getfocus();// // that.getfocus();//
@ -191,14 +188,13 @@
}) })
} }
}); });
}, 500); }, 200);
} }
}, },
handleFocus(){ handleFocus() {},
},
handleBlur(){ handleBlur() {
// setTimeout(res=>{ // setTimeout(res=>{
// uni.hideKeyboard(); // uni.hideKeyboard();
// },200) // },200)
@ -216,14 +212,13 @@
}); });
}, },
clear() { clear() {
if(this.clearResult) if (this.clearResult) {
{ this.scanMsg = ""
this.cursorIndex = 0; // this.cursorIndex = 0;
this.scanMsg = ''
} }
}, },
iconClick(type) { iconClick(type) {
this.$emit("clearResult", this.scanMsgk); this.$emit("clearResult", this.scanMsg);
}, },
expands() { expands() {
this.expand = !this.expand; this.expand = !this.expand;

4
src/pages/package/coms/comScanPackagePack.vue

@ -353,8 +353,10 @@ import { getDirectoryItemArray } from '@/common/directory';
let record = this.creatRecord(label, balance, packageInfo); let record = this.creatRecord(label, balance, packageInfo);
batch.Records.push(record); batch.Records.push(record);
this.calcBatchHandleQty(batch); this.calcBatchHandleQty(batch);
this.packGetFocus();
this.$emit('refresh'); this.$emit('refresh');
setTimeout(res=>{
this.packGetFocus();
},100)
}, },
swipeClick(e, item, index) { swipeClick(e, item, index) {

Loading…
Cancel
Save