3 changed files with 237 additions and 49 deletions
@ -0,0 +1,64 @@ |
|||||
|
<template> |
||||
|
<view class="uni-flex u-col-center" style="padding-top: 15rpx; |
||||
|
padding-bottom: 15rpx; |
||||
|
padding-left: 10rpx; |
||||
|
padding-right: 10rpx; |
||||
|
font-size:32rpx;"> |
||||
|
<view class="uni-flex uni-row u-col-center" @click="showProductionLine"> |
||||
|
<view> |
||||
|
{{title}} |
||||
|
<text style="font-size: 35rpx;color:#3FBAFF;" v-if="!productionLine&&isShowEdit==true">  请扫描</text> |
||||
|
<text style="font-size: 35rpx;color:#3FBAFF;">  {{productionLine}}</text> |
||||
|
</view> |
||||
|
<image v-if="isShowEdit" style="width:45rpx;height: 45rpx;" src="/static/icons/icons_edit.svg"></image> |
||||
|
</view> |
||||
|
<win-scan-production-line ref="scanProductionLineRef" :title="title+'标签'" @getProductionLine='getProductionLine'></win-scan-production-line> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import winScanProductionLine from "@/mycomponents/scan/winScanProductionLine.vue" |
||||
|
|
||||
|
export default { |
||||
|
components: { |
||||
|
winScanProductionLine |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
defaultproductionLine: "" |
||||
|
} |
||||
|
}, |
||||
|
props: { |
||||
|
title: { |
||||
|
type: String, |
||||
|
default: "生产线" |
||||
|
}, |
||||
|
productionLine: { |
||||
|
type: String, |
||||
|
default: "" |
||||
|
}, |
||||
|
isShowEdit: { |
||||
|
type: Boolean, |
||||
|
default: true |
||||
|
}, |
||||
|
}, |
||||
|
|
||||
|
watch: { |
||||
|
}, |
||||
|
methods: { |
||||
|
showProductionLine() { |
||||
|
if (this.isShowEdit) { |
||||
|
this.$refs.scanProductionLineRef.openScanPopup(); |
||||
|
} |
||||
|
|
||||
|
}, |
||||
|
//扫描源库位 |
||||
|
getProductionLine(productionLine, code) { |
||||
|
this.$emit("getProductionLine", productionLine, code) |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style> |
||||
|
</style> |
@ -0,0 +1,155 @@ |
|||||
|
<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;"> |
||||
|
扫描{{title}} |
||||
|
</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" @getResult="getScanResult" :placeholder='title' :clearResult="true" |
||||
|
:isShowHistory="isShowHistory" headerType=""> |
||||
|
</win-com-scan> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</uni-popup> |
||||
|
<!-- 模拟扫描功能 --> |
||||
|
<win-com-scan v-show="false" ref="comscansimulate" @getResult="getScanResult" :clearResult="true" :boxFocus="true" :isShowHistory="false" headerType=""></win-com-scan> |
||||
|
<comMessage ref="comMessage"></comMessage> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import { |
||||
|
workstationByLocation, |
||||
|
} from '@/api/request2.js'; |
||||
|
import { |
||||
|
checkDirectoryItemExist |
||||
|
} from '@/common/directory.js'; |
||||
|
import winComScan from '@/mycomponents/scan/winComScan.vue' |
||||
|
export default { |
||||
|
components: { |
||||
|
winComScan, |
||||
|
}, |
||||
|
emits: ["getProductionLine","clearProductionLine"], |
||||
|
props: { |
||||
|
title: { |
||||
|
type: String, |
||||
|
default: '' |
||||
|
}, |
||||
|
isShowHistory: { |
||||
|
type: Boolean, |
||||
|
default: false |
||||
|
} |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
code: '', |
||||
|
productionLine: {} |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
created() { |
||||
|
|
||||
|
}, |
||||
|
methods: { |
||||
|
openScanPopup() { |
||||
|
this.$refs.popup.open('bottom') |
||||
|
setTimeout(res => { |
||||
|
this.getfocus() |
||||
|
}, 500) |
||||
|
}, |
||||
|
closeScanPopup() { |
||||
|
this.losefocus() |
||||
|
if(this.$refs.popup){ |
||||
|
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.locationCode; |
||||
|
} else if (label.barType === 'BarCode') { |
||||
|
this.code = label.code; |
||||
|
} |
||||
|
if(this.code==undefined){ |
||||
|
uni.hideLoading(); |
||||
|
this.showErrorMessage("扫描库位为空,请输入正确的库位") |
||||
|
return |
||||
|
} |
||||
|
const params={ |
||||
|
pageNo: 1, |
||||
|
pageSize: 20, |
||||
|
sort: "", |
||||
|
by: "ASC", |
||||
|
filters : [{ |
||||
|
action: "like", |
||||
|
column: "productionLineCode", |
||||
|
value: this.code |
||||
|
},{ |
||||
|
action: "==", |
||||
|
column: "available", |
||||
|
value: 'TRUE' |
||||
|
}] |
||||
|
} |
||||
|
workstationByLocation(params).then(res => { |
||||
|
uni.hideLoading(); |
||||
|
if (res.data.total > 0) { |
||||
|
let result = res.data.list[0]; |
||||
|
this.productionLine = result; |
||||
|
this.callBack(); |
||||
|
} else { |
||||
|
this.showErrorMessage('未查询到生产线[' + this.code + '],请重新扫描') |
||||
|
this.$emit('clearProductionLine',this.code) |
||||
|
} |
||||
|
|
||||
|
}).catch(error => { |
||||
|
uni.hideLoading(); |
||||
|
this.showErrorMessage(error) |
||||
|
}) |
||||
|
}, |
||||
|
callBack() { |
||||
|
this.closeScanPopup(); |
||||
|
this.$emit("getProductionLine", this.productionLine, this.code); |
||||
|
}, |
||||
|
getfocus() { |
||||
|
if(this.$refs.scan){ |
||||
|
this.$refs.scan.getfocus(); |
||||
|
} |
||||
|
}, |
||||
|
losefocus() { |
||||
|
if(this.$refs.scan){ |
||||
|
this.$refs.scan.losefocus(); |
||||
|
} |
||||
|
}, |
||||
|
showErrorMessage(message) { |
||||
|
setTimeout(r => { |
||||
|
this.losefocus(); |
||||
|
this.$refs.comMessage.showErrorMessage(message, res => { |
||||
|
this.code = ''; |
||||
|
this.getfocus(); |
||||
|
}) |
||||
|
}) |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style> |
||||
|
</style> |
Loading…
Reference in new issue