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.

212 lines
5.2 KiB

12 months ago
<template>
<view>
12 months ago
<uni-popup ref="popup" @maskClick="closeScanPopup()">
12 months ago
<view class="popup_box">
<view class="pop_title uni-flex space-between">
<view class="" style="font-size: 35rpx;">
扫描{{title}}
</view>
<view class="">
<image class="fr icons_scan_close" src="/static/icons/icons_scan_close.svg"
@click="closeScanPopup()"></image>
</view>
</view>
<view class="uni-flex uni-row" style="align-items: center;
background-color: #fff;
margin-left: 20rpx;
margin-right: 20rpx;
border-radius: 8rpx;
height: 30px;">
<view class="uni-center" style="width: 25%; ">
位置
</view>
<view class="" style="width: 75%;padding: 8rpx">
<view class="uni-flex u-col-center uni-row" @click="showSelect">
<view class="" style="margin-left: 20rpx;">
{{positionInfo}}
</view>
<u-select v-model="show" mode="mutil-column-auto" :list="positionList"
@confirm="confirmSelect"></u-select>
</view>
</view>
</view>
<view class="">
<view class="">
12 months ago
<win-com-scan ref="comscan" :placeholder="title" @getResult="getScanResult"
:headerType="headerType" :isShowHistory="isShowHistory" :clearResult="true"></win-com-scan>
12 months ago
</view>
</view>
</view>
</uni-popup>
</view>
<com-message ref="comMessage" @afterClose="getfocus"></com-message>
</template>
<script>
import winComScan from '@/mycomponents/scan/winComScan.vue'
import comMessage from '@/mycomponents/common/comMessage.vue'
import {
getWorkShopLineStation
} from '@/api/request2.js';
export default {
name: 'winScanPack',
emits: ["getResult", "close"],
components: {
winComScan,
comMessage,
},
props: {
title: {
type: String,
default: '箱标签'
},
isShowHistory: {
type: Boolean,
default: true
},
12 months ago
headerType: {
12 months ago
type: String,
default: 'HPQ,HMQ'
}
},
data() {
return {
show: false,
positionInfo: "请选择位置",
positionList: [],
productionLineCode: '',
rawLocationCode: "",
fgLocationCode: "",
workshopCode: "",
workStationCode: "",
workShopName: "",
productionLineName: "",
workStationName: "",
12 months ago
isEditPosition: true
12 months ago
}
},
created() {
},
methods: {
openScanPopup() {
12 months ago
if (this.positionList.length == 0) {
12 months ago
uni.showLoading({
title: "数据加载中....",
mask: true
});
getWorkShopLineStation().then(res => {
uni.hideLoading()
this.positionList = res.data
}).catch(error => {
uni.hideLoading()
this.showErrorMessage(error)
})
}
12 months ago
12 months ago
this.$refs.popup.open('bottom');
},
12 months ago
12 months ago
closeScanPopup() {
this.$refs.popup.close();
this.$emit("close", '');
},
12 months ago
12 months ago
scanClick() {
this.$refs.comscan.clickScanMsg();
},
12 months ago
12 months ago
cancelClick() {
this.$refs.comscan.clearScanValue();
},
getScanResult(result) {
12 months ago
if (this.positionInfo == "请选择位置") {
12 months ago
this.showErrorMessage("请先选择位置")
return
}
var param = {
12 months ago
positionInfo: this.positionInfo,
workshopCode: this.workshopCode,
productionLineCode: this.productionLineCode,
workStationCode: this.workStationCode,
rawLocationCode: this.rawLocationCode,
fgLocationCode: this.fgLocationCode,
12 months ago
}
if (result.success) {
this.isEditPosition = false
12 months ago
this.$emit("getResult", result, param);
12 months ago
} else {
this.showErrorMessage(result.message)
}
},
12 months ago
12 months ago
getfocus() {
if (this.$refs.comscan != undefined) {
this.$refs.comscan.getfocus();
}
},
12 months ago
12 months ago
losefocus() {
if (this.$refs.comscan != undefined) {
this.$refs.comscan.losefocus();
}
},
showErrorMessage(message) {
this.$refs.comMessage.showErrorMessage(message, res => {
12 months ago
if (res) {}
12 months ago
});
},
12 months ago
12 months ago
showSelect() {
12 months ago
if (this.isEditPosition) {
12 months ago
this.show = !this.show
}
12 months ago
12 months ago
},
confirmSelect(e) {
this.positionInfo = e[0].label + "-" + e[1].label + "-" + e[2].label
console.log("位置", this.positionInfo)
this.workshopCode = e[0].value
this.productionLineCode = e[1].value
this.workStationCode = e[2].value
this.workShopName = e[0].label
this.productionLineName = e[1].label
this.workStationName = e[2].label
12 months ago
let shop = this.positionList.find(shop => shop.value == this.workshopCode);
if (shop != undefined && shop.children != undefined) {
let prodLine = shop.children.find(line => line.value == this.productionLineCode);
if (prodLine != undefined && prodLine.children != undefined) {
let station = prodLine.children.find(r => r.value == this.workStationCode);
if (station.rawLocationCode == '' && station.rawLocationCode == null) {
this.showErrorMessage(this.workStationName + "的原材料库位为空,请重新选择")
return;
} else {
this.rawLocationCode = station.rawLocationCode;
this.fgLocationCode = station.fgLocationCode;
}
} else {
this.showErrorMessage("生产线-工位基础信息维护错误")
}
} else {
this.showErrorMessage("车间-生产线基础信息维护错误")
}
12 months ago
},
}
}
</script>
<style lang="scss">
.scroll-view {
overflow-y: scroll;
height: auto;
max-height: 300rpx;
}
</style>