You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
113 lines
2.5 KiB
113 lines
2.5 KiB
<template>
|
|
<uni-popup ref="popup" :maskClick='false'>
|
|
<view class="popup_box">
|
|
<view class="pop_title uni-flex space-between">
|
|
<view class="" style="font-size: 35rpx;">
|
|
扫描生产线
|
|
</view>
|
|
<view>
|
|
<image class=" icons_scan_close" src="/static/icons/icons_scan_close.svg" @click="closeScanPopup()">
|
|
</image>
|
|
</view>
|
|
</view>
|
|
<view class="">
|
|
<view class="">
|
|
<win-com-scan ref="scan" @getResultult="getScanResult" placeholder='生产线' :clearResult="false"
|
|
:boxFocus="true" :isShowHistory="false">
|
|
</win-com-scan>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</uni-popup>
|
|
<comMessage ref="comMessage"></comMessage>
|
|
</template>
|
|
|
|
<script>
|
|
import {
|
|
getProductionlineByCode,
|
|
} from '@/api/request.js';
|
|
import {
|
|
getListLocationTypeDesc,
|
|
checkDirectoryItemExist
|
|
} from '@/common/directory.js';
|
|
import winComScan from '@/mycomponents/scan/winComScan.vue'
|
|
import comMessage from '@/mycomponents/common/comMessage.vue'
|
|
export default {
|
|
components: {
|
|
winComScan,
|
|
comMessage
|
|
},
|
|
emits: ["getProdLine"],
|
|
props: {},
|
|
data() {
|
|
return {
|
|
code: '',
|
|
prodLine: {}
|
|
}
|
|
},
|
|
|
|
created() {
|
|
|
|
},
|
|
methods: {
|
|
openScanPopup() {
|
|
this.$refs.popup.open('bottom')
|
|
},
|
|
closeScanPopup() {
|
|
this.$refs.popup.close()
|
|
},
|
|
scanClick() {
|
|
this.$refs.scan.clickScanMsg();
|
|
},
|
|
cancelClick() {
|
|
this.$refs.scan.clearScanValue();
|
|
},
|
|
getScanResult(result) {
|
|
uni.showLoading({
|
|
title: '扫描中...',
|
|
mask: true
|
|
});
|
|
let label = result.label;
|
|
if (label.barType === 'QRCode') {
|
|
this.code = label.ProdLineCode;
|
|
} else if (label.barType === 'BarCode') {
|
|
this.code = label.Code;
|
|
}
|
|
getProductionlineByCode(this.code).then(res => {
|
|
if (res.data.total > 0) {
|
|
this.prodLine = res.data.list[0];
|
|
this.callBack();
|
|
} else {
|
|
this.showErrorMessage('未查询到生产线[' + this.code + ']')
|
|
}
|
|
uni.hideLoading();
|
|
}).catch(error => {
|
|
uni.hideLoading();
|
|
this.showErrorMessage(error)
|
|
})
|
|
},
|
|
callBack() {
|
|
this.closeScanPopup();
|
|
this.$emit("getProdLine", this.prodLine, this.code);
|
|
},
|
|
getfocus() {
|
|
this.$refs.scan.getfocus();
|
|
},
|
|
losefocus() {
|
|
this.$refs.scan.losefocus();
|
|
},
|
|
showErrorMessage(message) {
|
|
setTimeout(r => {
|
|
this.losefocus();
|
|
this.$refs.comMessage.showErrorMessage(message, res => {
|
|
this.code = '';
|
|
this.getfocus();
|
|
})
|
|
})
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style>
|
|
</style>
|
|
|