Files
hht-shangdianke-uni/pages/manage/back/out-storage.vue
2024-03-12 15:23:12 +08:00

263 lines
6.8 KiB
Vue

<template>
<view class="zd_container">
<nav-bar title="出库"></nav-bar>
<view class="zd_content">
<view class="zd_wrapper">
<view class="filter_item">
<view class="filter_label_wraper">
<span class="filter_label">物料</span>
</view>
<view class="filter_input_wraper">
<input type="text" class="filter_input filter_input_disabled pointer" v-model="val1" @tap="getMater">
</view>
</view>
<view class="filter_item">
<view class="filter_label_wraper">
<span class="filter_label">起点点位</span>
</view>
<view class="filter_input_wraper">
<input type="text" class="filter_input" v-model="val2">
</view>
</view>
<view class="filter_item">
<view class="filter_label_wraper">
<span class="filter_label">终点点位</span>
</view>
<view class="filter_input_wraper">
<uni-data-select v-model="index1" :localdata="options1" @change="selectChange1"></uni-data-select>
</view>
</view>
</view>
<view class="zd_wrapper grid-wraper">
<view class="slide_new">
<table>
<thead>
<tr>
<th>点位编码</th>
<th>点位名称</th>
<th>载具编码</th>
<th>物料编码</th>
<th>物料名称</th>
<th>配盘批次</th>
<th>物料数量</th>
</tr>
</thead>
<tbody>
<tr v-for="(e, i) in dataList" :key="i" @click="toCheck(e)" :class="{'checked': e.group_id === pkId}">
<td>{{e.point_code}}</td>
<td>{{e.point_name}}</td>
<td>{{e.vehicle_code}}</td>
<td>{{e.material_code}}</td>
<td>{{e.material_name}}</td>
<td>{{e.pcsn}}</td>
<td>{{e.material_qty}}</td>
</tr>
</tbody>
</table>
</view>
</view>
</view>
<view class="submit-bar_new">
<button class="zd-col-4 submit-button_new" @tap="clearUp">清空</button>
<button class="zd-col-6 submit-button_new" :class="{'btn-disabled': !val2 || !index1}" :disabled="disabled1" @tap="_fullVehicleOut">满托出库</button>
<button class="zd-col-6 submit-button_new" @tap="popUp(1)">余料回库</button>
<button class="zd-col-7 submit-button_new" @tap="popUp(2)">满托出库确认</button>
</view>
<view class="msg_wrapper" :class="show ? 'popshow' : 'pophide'">
<view class="msg_box">
<view class="filter_item">
<view class="filter_label">当前点位</view>
<view class="filter_input_wraper">
<uni-data-select v-model="index2" :localdata="options1" @change="selectChange2"></uni-data-select>
</view>
</view>
<view class="filter_item">
<view class="filter_label">载具编码</view>
<view class="filter_input_wraper">
<search-box
v-model="val3"
/>
</view>
</view>
<view class="filter_item">
<view class="filter_label">物料数量</view>
<view class="filter_input_wraper">
<input type="number" class="filter_input" v-model="val4">
</view>
</view>
</view>
<view class="zd-row msg_btns">
<button class="zd-col-9 msg_btn_cancle" @tap="toClear">清空</button>
<button class="zd-col-13 msg_btn" :class="{'btn-disabled': !index2 || !val3 || !val4}" :disabled="disabled2" @tap="toConfirm">确认</button>
</view>
</view>
<view v-if="show" class="msg_mask" @click.stop="show = false"></view>
</view>
</template>
<script>
import NavBar from '@/components/NavBar.vue'
import SearchBox from '@/components/SearchBox.vue'
import {queryLinkMaterial, queryPoints, fullVehicleOut, vehicleGoBack, fullVehicleOutConfirm} from '@/utils/getData2.js'
export default {
components: {
NavBar,
SearchBox
},
data() {
return {
val1: '',
val2: '',
options1: [],
index1: '',
index2: '',
val3: '',
val4: '',
dataList: [],
disabled1: false,
disabled2: false,
disabled3: false,
pkId: '',
show: false,
type: ''
};
},
created () {
this._queryPoints()
},
destroyed () {
this.$store.dispatch('setPublicObj', '')
},
onShow() {
if (this.$store.getters.publicObj) {
this.val1 = this.$store.getters.publicObj.material_name
this._queryLinkMaterial(this.$store.getters.publicObj.material_id)
}
},
methods: {
getMater () {
uni.navigateTo({
url: '/pages/manage/search-mater-1'
})
},
/** grid查询 */
async _queryLinkMaterial (e) {
let res = await queryLinkMaterial(e)
this.dataList = [...res]
},
/** 选择器 */
selectChange1(e) {
this.index1 = e
},
selectChange2(e) {
this.index2 = e
},
/** 点位下拉框 */
async _queryPoints () {
let res = await queryPoints('2')
res.map(el => {
this.$set(el, 'value', el.point_code)
this.$set(el, 'text', el.point_name)
})
this.options1 = [...res]
},
toCheck (e) {
this.pkId = this.pkId === e.group_id ? '' : e.group_id
this.val2 = this.pkId === e.group_id ? e.point_code : ''
},
/** 满托出库 */
async _fullVehicleOut () {
this.disabled1 = true
if (!this.val2 || !this.index1) {
this.disabled1 = false
return
}
try {
let res = await fullVehicleOut(this.val2, this.index1)
this.disabled1 = false
this._queryLinkMaterial(this.$store.getters.publicObj.material_id)
uni.showToast({
title: res.message,
icon: 'none'
})
} catch (e) {
this.disabled1 = false
}
},
popUp (type) {
this.show = true
this.type = type
},
toClear () {
this.index2 = ''
this.val3 =''
this.val4 =''
},
toConfirm () {
if (this.type === 1) {
this._vehicleGoBack()
}
if (this.type === 2) {
this._fullVehicleOutConfirm()
}
},
/** 余料回库 */
async _vehicleGoBack () {
this.disabled2 = true
if (!this.index2 || !this.val3 || !this.val4) {
this.disabled2 = false
return
}
try {
let res = await vehicleGoBack(this.index2, this.val3, this.val4)
this.disabled2 = false
this.toClear()
this.show = false
uni.showToast({
title: res.message,
icon: 'none'
})
} catch (e) {
this.disabled2 = false
this.toClear()
this.show = false
}
},
/** 满托出库确认 */
async _fullVehicleOutConfirm () {
this.disabled2 = true
if (!this.index2 || !this.val3 || !this.val4) {
this.disabled2 = false
return
}
try {
let res = await fullVehicleOutConfirm(this.index2, this.val3, this.val4)
this.disabled2 = false
this.toClear()
this.show = false
uni.showToast({
title: res.message,
icon: 'none'
})
} catch (e) {
this.disabled2 = false
this.toClear()
this.show = false
}
},
clearUp () {
this.index1 = ''
this.val1 = ''
this.val2 = ''
this.dataList = []
this.pkId = ''
this.$store.dispatch('setPublicObj', '')
}
}
}
</script>
<style lang="stylus">
</style>