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.

226 lines
5.6 KiB

11 months ago
<template>
<view>
11 months ago
<uni-popup ref="popup" @maskClick="closeScanPopup()">
11 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="">
11 months ago
<win-com-scan ref="comscan" :placeholder="title" @getResult="getScanResult"
:headerType="headerType" :isShowHistory="isShowHistory" :clearResult="true"></win-com-scan>
11 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
},
11 months ago
headerType: {
11 months ago
type: String,
default: 'HPQ,HMQ'
}
},
data() {
return {
show: false,
positionInfo: "请选择位置",
positionList: [],
productionLineCode: '',
rawLocationCode: "",
fgLocationCode: "",
workshopCode: "",
workStationCode: "",
workShopName: "",
productionLineName: "",
workStationName: "",
11 months ago
isEditPosition: true
11 months ago
}
},
created() {
},
methods: {
openScanPopup() {
11 months ago
if (this.positionList.length == 0) {
11 months ago
uni.showLoading({
title: "数据加载中....",
mask: true
});
getWorkShopLineStation().then(res => {
uni.hideLoading()
this.positionList = res.data
}).catch(error => {
uni.hideLoading()
this.showErrorMessage(error)
})
}
11 months ago
11 months ago
this.$refs.popup.open('bottom');
},
initData(){
this.positionInfo = "请选择位置";
this.positionList = [];
this.productionLineCode = '';
this.rawLocationCode = "";
this.fgLocationCode = "";
this.workshopCode = "";
this.workStationCode ="";
this.workShopName = "";
this.productionLineName="";
this.workStationName="";
this.show = false;
this.isEditPosition = true
},
11 months ago
11 months ago
closeScanPopup() {
this.$refs.popup.close();
this.$emit("close", '');
},
11 months ago
11 months ago
scanClick() {
this.$refs.comscan.clickScanMsg();
},
11 months ago
11 months ago
cancelClick() {
this.$refs.comscan.clearScanValue();
},
getScanResult(result) {
11 months ago
if (this.positionInfo == "请选择位置") {
11 months ago
this.showErrorMessage("请先选择位置")
return
}
var param = {
11 months ago
positionInfo: this.positionInfo,
workshopCode: this.workshopCode,
productionLineCode: this.productionLineCode,
workStationCode: this.workStationCode,
rawLocationCode: this.rawLocationCode,
fgLocationCode: this.fgLocationCode,
11 months ago
}
if (result.success) {
this.isEditPosition = false
11 months ago
this.$emit("getResult", result, param);
11 months ago
} else {
this.showErrorMessage(result.message)
}
},
11 months ago
11 months ago
getfocus() {
if (this.$refs.comscan != undefined) {
this.$refs.comscan.getfocus();
}
},
11 months ago
11 months ago
losefocus() {
if (this.$refs.comscan != undefined) {
this.$refs.comscan.losefocus();
}
},
showErrorMessage(message) {
this.$refs.comMessage.showErrorMessage(message, res => {
11 months ago
if (res) {}
11 months ago
});
},
11 months ago
11 months ago
showSelect() {
11 months ago
if (this.isEditPosition) {
11 months ago
this.show = !this.show
}
11 months ago
11 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
11 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("车间-生产线基础信息维护错误")
}
11 months ago
},
}
}
</script>
<style lang="scss">
.scroll-view {
overflow-y: scroll;
height: auto;
max-height: 300rpx;
}
</style>