<template>
|
<view class="">
|
<view class="line space-between" @click="pncode">
|
<text class="col7">零件号:</text>
|
<view class="">
|
<text class="ml10 col7">{{pn}}</text>
|
<u-icon name="arrow-right"></u-icon>
|
</view>
|
|
</view>
|
<u-collapse :arrow="false">
|
<u-collapse-item title="" :open="open" v-for="(item,index) in pnOpen" :key="index"
|
style="border-bottom: 1px solid #eaeaea;padding-bottom: 20px;background-color: #fff;margin-top: -11px;">
|
<view class="collapse-item" style="padding: 0 48px;">
|
零件号:{{item.itemName}}
|
零件数量:{{item.itemNum}}
|
</view>
|
</u-collapse-item>
|
</u-collapse>
|
<view class="line space-between" @click="bourn">
|
<text class="col7">器具号:</text>
|
<view class="">
|
<text class="ml10 col7">{{destination.containerName}}</text>
|
<u-icon name="arrow-right"></u-icon>
|
</view>
|
</view>
|
<view>
|
<u-select :list="state" mode="single-column" v-model="dialogVisible" @confirm="target">
|
</u-select>
|
</view>
|
|
<view class="line space-between" @click="place">
|
<text class="col7">起始位置:</text>
|
<view class="">
|
<text class="ml10 col7">{{type}}</text>
|
<u-icon name="arrow-right"></u-icon>
|
</view>
|
</view>
|
<view class="line space-between" @click="dialogVisible=true">
|
<text class="col7">目标位置:</text>
|
<view class="">
|
<text class="ml10 col7">{{stateText}}</text>
|
<u-icon name="arrow-right"></u-icon>
|
</view>
|
</view>
|
<view>
|
<u-select :list="stateType" mode="single-column" v-model="dialogType" @confirm="stateLable">
|
</u-select>
|
</view>
|
<view class="fix">
|
<u-button type="success" @click="add">出库</u-button>
|
<u-button type="success" plain @click="clear">取消</u-button>
|
</view>
|
<u-popup v-model="dialogShow" mode="bottom" height="350px">
|
<view class="title">
|
<text>零件号</text>
|
</view>
|
<view class="search">
|
<u-search placeholder="搜索零件编号" @search="pncode" v-model="keyword" input-align="center" bg-color="#fff"
|
shape="square" :show-action="false"></u-search>
|
</view>
|
<view class="line3" v-for="(item,index) in pnList" :key="index" @click="picker(item, $event)">
|
<text style="color:#000">{{item.itemName}}</text>
|
<text class="col7 ml10">{{item.itemDes}}</text>
|
</view>
|
</u-popup>
|
<u-popup v-model="dialogShowGoal" mode="bottom" height="350px">
|
<view class="title">
|
<text>器具号</text>
|
</view>
|
<view class="search">
|
<u-search placeholder="搜索器具号" @search="bourn" v-model="keyword2" input-align="center" bg-color="#fff"
|
shape="square" :show-action="false"></u-search>
|
</view>
|
<view class="line3" v-for="(item,index) in destination" :key="index" @click="pickerB(item, $event)">
|
<text style="color:#000">{{item.containerName}}</text>
|
</view>
|
|
</u-popup>
|
</view>
|
</template>
|
<script>
|
import {
|
PlaceVsContainer,
|
Task
|
} from '../../../api/operation.js'
|
export default {
|
data() {
|
return {
|
dialogVisible: false, //目标位置弹窗
|
dialogType: false, //起始位置弹窗
|
dialogShow: false, //零件号弹窗
|
dialogShowGoal: false, //器具号弹窗
|
open: false, //零件号折叠
|
pn: '', //零件号
|
keyword: '', //零件号搜索
|
keyword2: '', //器具号搜索
|
type: '', //起始位置回显
|
stateText: '', //目标位置回显
|
destination: [], //目的地列表
|
shipping: '', //目标位置传参
|
list: [], //库位列表
|
pnList: [], //零件列表
|
pnOpen: [], //选择零件号后回显
|
itemList: [{
|
head: "零件号",
|
open: true,
|
disabled: true
|
}],
|
state: [{
|
num: 51,
|
label: '2号口'
|
}, {
|
num: 64,
|
label: '3号口'
|
}, {
|
num: 67,
|
label: '4号口'
|
}, {
|
num: 34,
|
label: '5号口'
|
}, {
|
num: 30,
|
label: '6号口'
|
}, {
|
num: 19,
|
label: '7号口'
|
}, {
|
num: 12,
|
label: '8号口'
|
}, {
|
num: 997,
|
label: '冲压出口'
|
}, {
|
num: 999,
|
label: '焊装出口'
|
}],
|
stateType: [],
|
};
|
},
|
created() {
|
this.PlaceVsContainer()
|
},
|
onBackPress(options) {
|
if (options.from == 'navigateBack') {
|
uni.switchTab({
|
url: '../../Home/index'
|
});
|
}
|
if (options.from == 'backbutton') {
|
uni.switchTab({
|
url: '../../Home/index'
|
});
|
}
|
return true
|
},
|
methods: {
|
//库存列表
|
PlaceVsContainer() {
|
let params = {
|
page: 1,
|
onePageNum: 20
|
}
|
PlaceVsContainer(params).then((res) => {
|
if (res.code == 0) {
|
this.list = res.data
|
}
|
})
|
},
|
|
//出库
|
add() {
|
this.state.forEach(i => {
|
if (this.stateText == i.label) {
|
this.shipping = i.num
|
}
|
})
|
let params = {
|
sourcePlace: this.type, //起始位置
|
toPlace: this.shipping, //目标位置
|
containerName: this.destination.containerName,
|
taskType: 2,
|
taskStatus: '新建',
|
taskLevel: 0,
|
hasReaded: 0
|
}
|
Task(params).then((res) => {
|
if (res.code == 1) {
|
this.$u.toast(res.msg)
|
} else {
|
this.$u.toast('出库成功')
|
uni.switchTab({
|
url: '../../Home/index'
|
});
|
}
|
})
|
|
},
|
clear() {
|
this.pn = ''
|
this.destination.containerName = ''
|
this.type = ''
|
this.pnOpen = []
|
this.stateText = ''
|
},
|
//零件列表
|
pncode() {
|
this.pnList = []
|
let params = {
|
page: '1',
|
itemName: this.keyword,
|
onePageNum: 20
|
}
|
PlaceVsContainer(params).then((res) => {
|
if (res.code == 0) {
|
this.list = res.data
|
}
|
this.pnList = this.list.filter(function(s) {
|
return s.itemName && s.itemName.trim();
|
})
|
})
|
this.dialogShow = true
|
},
|
//零件号回显
|
picker(val, event) {
|
this.pn = val.itemName
|
this.dialogShow = false
|
this.pnOpen = []
|
},
|
//器具号列表
|
bourn() {
|
this.destination = []
|
if (this.pn === '') {
|
let params = {
|
page: '1',
|
containerName: this.keyword2,
|
onePageNum: 20
|
}
|
PlaceVsContainer(params).then((res) => {
|
if (res.code == 0) {
|
this.list = res.data
|
}
|
this.destination = this.list.filter(function(s) {
|
return s.containerName && s.containerName.trim();
|
})
|
})
|
} else {
|
let params = {
|
page: '1',
|
itemName: this.pn,
|
onePageNum: 20
|
}
|
PlaceVsContainer(params).then((res) => {
|
if (res.code == 0) {
|
this.list = res.data
|
}
|
this.destination = this.list.filter(function(s) {
|
return s.containerName && s.containerName.trim();
|
})
|
})
|
}
|
this.dialogShowGoal = true
|
},
|
//器具号回显
|
pickerB(val, event) {
|
this.destination.containerName = val.containerName
|
let params = {
|
page: '1',
|
onePageNum: 20,
|
containerName: this.destination.containerName
|
}
|
PlaceVsContainer(params).then((res) => {
|
if (res.code == 0) {
|
this.list = res.data
|
}
|
this.pnOpen = this.list.filter(function(s) {
|
return s.itemName && s.itemName.trim();
|
})
|
this.type = this.list[0].place
|
this.open = true
|
this.pn = ''
|
})
|
|
this.dialogShowGoal = false
|
},
|
//起始位置列表
|
place() {
|
this.stateType = [{}]
|
this.dialogType = true
|
|
let params = {
|
page: '1',
|
itemName: this.pn,
|
onePageNum: 20
|
}
|
PlaceVsContainer(params).then((res) => {
|
if (res.code == 0) {
|
this.list = res.data
|
}
|
let data = this.list.filter(function(s) {
|
return s.place && s.place.trim();
|
})
|
data.forEach((item, index) => {
|
this.stateType.push({
|
value: JSON.stringify(index + 1),
|
label: item.place
|
})
|
})
|
})
|
|
},
|
//起始位置回显
|
stateLable(e) {
|
this.type = e[0].label
|
|
let params = {
|
page: '1',
|
place: this.type,
|
onePageNum: 20
|
}
|
PlaceVsContainer(params).then((res) => {
|
if (res.code == 0) {
|
this.list = res.data
|
this.pnOpen = this.list.filter(function(s) {
|
return s.itemName && s.itemName.trim();
|
})
|
this.destination.containerName = this.list[0].containerName
|
this.pn = ''
|
this.open = true
|
}
|
})
|
|
},
|
//目标位置回显
|
target(e) {
|
this.stateText = e[0].label
|
}
|
}
|
};
|
</script>
|
|
<style lang="scss" scoped>
|
page {
|
background-color: #f5f5f9;
|
}
|
|
.search {
|
background-color: #f2f2f2;
|
padding: 5px;
|
}
|
|
.title {
|
display: flex;
|
height: 2.2rem;
|
font-size: 1rem;
|
align-items: center;
|
justify-content: center;
|
/* padding-right: 9px; */
|
}
|
|
.fix {
|
position: fixed;
|
bottom: 0;
|
width: 100%;
|
height: 100px;
|
padding: 0 3px;
|
|
>.u-btn {
|
margin: 5px 0;
|
}
|
}
|
|
.line {
|
height: 50px;
|
border-bottom: 1px solid #eaeaea;
|
padding-left: 3rem;
|
font-size: 1rem;
|
padding-right: 10px;
|
display: flex;
|
align-items: center;
|
background-color: #fff;
|
margin: 10px 0;
|
}
|
|
.line2 {
|
line-height: 2.3rem;
|
padding: 8px 10px 8px 3rem;
|
font-size: 0.93rem;
|
}
|
|
.line3 {
|
line-height: 1.8rem;
|
padding: 8px 3px;
|
font-size: 0.93rem;
|
border-bottom: 1px solid #eaeaea;
|
text-align: center;
|
}
|
|
.pl2 {
|
padding-left: 2rem !important;
|
}
|
|
.col7 {
|
color: #777;
|
}
|
|
.ml10 {
|
margin-left: 10px;
|
}
|
|
.tr {
|
text-align: right;
|
}
|
|
.btn {
|
font-size: 0.8rem;
|
position: absolute !important;
|
right: 10px;
|
height: 30px !important;
|
}
|
|
.center {
|
display: flex;
|
align-items: center;
|
justify-content: flex-end;
|
}
|
|
.space-between {
|
display: flex;
|
align-items: center;
|
justify-content: space-between;
|
}
|
</style>
|