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

140 lines
3.4 KiB
Vue

<template>
<view class="zd_container">
<nav-bar :title="title"></nav-bar>
<view class="zd_content">
<view class="zd_wrapper">
<view class="zd-row border-bottom">
<view class="zd-col-5">
<span class="filter_label">物料</span>
</view>
<view class="zd-col-19 filter_select">
<zxz-uni-data-select v-model="index1" filterable :localdata="options1" @change="selectChange"></zxz-uni-data-select>
</view>
</view>
<view class="zd-row">
<view class="zd-col-5">
<span class="filter_label">出库点位</span>
</view>
<view class="zd-col-19">
<search-box
v-model="val1"
/>
</view>
</view>
</view>
<view class="zd_wrapper grid-wraper">
<view class="slide_new">
<table>
<thead>
<tr>
<th class="fontcol1">点位编码</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="toChose(e)" :class="{'checked': e.point_code === pkId}">
<td class="fontcol1">{{e.point_code}}</td>
<td class="fontcol2">{{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="zd-row submit-bar">
<button class="zd-col-11 button-default" @tap="clearUp">清空</button>
<button class="zd-col-11 button-primary" :class="{'button-info': !pkId || !val1}" :disabled="disabled" @tap="_fullVehicleOut">出库</button>
</view>
</view>
</template>
<script>
import NavBar from '@/components/NavBar.vue'
import SearchBox from '@/components/SearchBox.vue'
import {queryMaterial, queryLinkMaterial, fullVehicleOut} from '@/utils/getData2.js'
export default {
components: {
NavBar,
SearchBox
},
data() {
return {
title: '',
options1: [],
index1: '',
val1: '',
dataList: [],
pkId: '',
disabled: false
};
},
onLoad (options) {
this.title = options.title
},
created () {
this._queryMaterial()
},
methods: {
/** 物料下拉框*/
async _queryMaterial (e) {
let res = await queryMaterial(e)
res.map(el => {
this.$set(el, 'value', el.material_id)
this.$set(el, 'text', el.material_name)
})
this.options1 = [...res]
},
selectChange (e) {
this._queryLinkMaterial(e)
},
/** grid */
async _queryLinkMaterial (e) {
let res = await queryLinkMaterial(e)
this.dataList = [...res]
},
toChose (e) {
this.pkId = this.pkId === e.point_code ? '' : e.point_code
},
async _fullVehicleOut () {
this.disabled = true
if (!this.pkId || !this.val1) {
this.disabled = false
return
}
try {
let res = await fullVehicleOut(this.pkId, this.val1)
this.pkId = ''
this.disabled = false
this._queryLinkMaterial(this.index1)
uni.showToast({
title: res.message,
icon: 'none'
})
} catch (e) {
this.disabled = false
}
},
clearUp () {
this.index1 = ''
this.dataList = []
this.val1 = ''
this.disabled = false
}
}
}
</script>
<style lang="stylus">
@import '../../common/style/mixin.styl';
</style>