231 lines
6.0 KiB
Vue
231 lines
6.0 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-7">
|
|
<span class="filter_label">单据</span>
|
|
</view>
|
|
<view class="zd-col-24 filter_select">
|
|
<uni-data-select v-model="index" :localdata="options" @change="selectChange"></uni-data-select>
|
|
</view>
|
|
</view>
|
|
<view class="zd-row border-bottom">
|
|
<view class="zd-col-7">
|
|
<span class="filter_label">托盘码</span>
|
|
</view>
|
|
<view class="zd-col-17">
|
|
<search-box v-model="val1"/>
|
|
</view>
|
|
</view>
|
|
<view class="zd-row border-bottom">
|
|
<view class="zd-col-7">
|
|
<span class="filter_label">点位码</span>
|
|
</view>
|
|
<view class="zd-col-17">
|
|
<search-box
|
|
v-model="val2"
|
|
@handleChange="handleChange"
|
|
/>
|
|
</view>
|
|
</view>
|
|
<!-- <view class="zd-row">
|
|
<view class="zd-col-19">
|
|
</view>
|
|
<view class="zd-col-4">
|
|
<button class="mini-btn" size="mini" style="display: block; margin-top: 9px;" type="primary" @tap="handleAdd">添加</button>
|
|
</view>
|
|
</view> -->
|
|
</view>
|
|
<view class="zd_wrapper" v-if="flag">
|
|
<view class="zd-row border-bottom">
|
|
<view class="zd-col-7">
|
|
<span class="filter_label filter_input_disabled">载具编码</span>
|
|
</view>
|
|
<view class="zd-col-17">
|
|
<input type="text" class="filter_input filter_input_disabled" v-model="currentData.storagevehicle_code" disabled>
|
|
</view>
|
|
</view>
|
|
<view class="zd-row border-bottom">
|
|
<view class="zd-col-7">
|
|
<span class="filter_label filter_input_disabled">物料编码</span>
|
|
</view>
|
|
<view class="zd-col-17">
|
|
<input type="text" class="filter_input filter_input_disabled" v-model="currentData.material_code" disabled>
|
|
</view>
|
|
</view>
|
|
<view class="zd-row border-bottom">
|
|
<view class="zd-col-7">
|
|
<span class="filter_label filter_input_disabled">物料名称</span>
|
|
</view>
|
|
<view class="zd-col-17">
|
|
<input type="text" class="filter_input filter_input_disabled" v-model="currentData.material_name" disabled>
|
|
</view>
|
|
</view>
|
|
<view class="zd-row border-bottom">
|
|
<view class="zd-col-7">
|
|
<span class="filter_label filter_input_disabled">批次</span>
|
|
</view>
|
|
<view class="zd-col-17">
|
|
<input type="text" class="filter_input filter_input_disabled" v-model="currentData.pcsn" disabled>
|
|
</view>
|
|
</view>
|
|
<view class="zd-row border-bottom">
|
|
<view class="zd-col-7">
|
|
<span class="filter_label filter_input_disabled">可用数</span>
|
|
</view>
|
|
<view class="zd-col-17">
|
|
<input type="text" class="filter_input filter_input_disabled" v-model="currentData.qty" disabled>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="zd_wrapper grid-wraper">
|
|
<view class="slide_new">
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th>选择</th>
|
|
<th>托盘码</th>
|
|
<th>点位码</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr v-for="(e, i) in dataList" :key="i" @tap="toChek(e)" :class="{'checked': pkId === e.vid}">
|
|
<td @tap="toCheck(e)"><uni-icons :type="e.checked ? 'checkbox' : 'circle'" size="24" color="#4e6ef2"></uni-icons></td>
|
|
<td>{{e.vehicle_code}}</td>
|
|
<td>{{e.site_code}}</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="zd-row submit-bar">
|
|
<button class="zd-col-11 button-primary" :class="{'button-info': !pkId}" @tap="toDel()">删除选中行</button>
|
|
<button class="zd-col-11 button-primary" :class="{'button-info': !index || !dataList.length}" @tap="_zwConfirmIn">全部提交</button>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import NavBar from '@/components/NavBar.vue'
|
|
import SearchBox from '@/components/SearchBox.vue'
|
|
import {getFormDataList, getPlate, zwConfirmIn} from '@/utils/getData4.js'
|
|
export default {
|
|
components: {
|
|
NavBar,
|
|
SearchBox
|
|
},
|
|
data() {
|
|
return {
|
|
title: '',
|
|
options: [],
|
|
index: '',
|
|
id: '',
|
|
code: '',
|
|
val1: '',
|
|
val2: '',
|
|
dataList: [],
|
|
pkId: '',
|
|
currentData: {},
|
|
flag: false,
|
|
disabled: false
|
|
};
|
|
},
|
|
onLoad (options) {
|
|
this.title = options.title
|
|
this.id = options.id
|
|
},
|
|
created () {
|
|
// this._getFormDataList()
|
|
},
|
|
methods: {
|
|
handleChange (e) {
|
|
if (e) {
|
|
this.handleAdd()
|
|
}
|
|
},
|
|
handleAdd () {
|
|
if (!this.val1 || !this.val2) {
|
|
return
|
|
}
|
|
this.dataList.push({vehicle_code: this.val1, site_code: this.val2})
|
|
this.dataList.map(el => {
|
|
this.$set(el, 'checked', false)
|
|
})
|
|
},
|
|
async _getPlate () {
|
|
try {
|
|
let res = await getPlate(this.val1)
|
|
if (res.code === '200') {
|
|
this.flag = true
|
|
this.currentData = res.data
|
|
setTimeout(() => {
|
|
this.flag = false
|
|
},1000)
|
|
this.handleAdd()
|
|
} else {
|
|
uni.showToast({
|
|
title: res.message,
|
|
icon: 'none'
|
|
})
|
|
}
|
|
} catch (e) {
|
|
}
|
|
},
|
|
toDel () {
|
|
this.dataList = this.dataList.filter(el => el.checked === true)
|
|
},
|
|
async _getFormDataList () {
|
|
try {
|
|
let res = await getFormDataList()
|
|
if (res) {
|
|
this.options = res.data
|
|
} else {
|
|
this.options = []
|
|
}
|
|
} catch (e) {
|
|
this.options = []
|
|
}
|
|
},
|
|
selectChange (e) {
|
|
this.index = e
|
|
},
|
|
toCheck (e) {
|
|
e.checked = !e.checked
|
|
let arr = this.dataList.filter(el => el.checked === true)
|
|
},
|
|
clearUp () {
|
|
this.pkId = ''
|
|
},
|
|
async _zwConfirmIn () {
|
|
this.disabled = true
|
|
if (!this.index || !this.dataList.length) {
|
|
this.disabled = false
|
|
return
|
|
}
|
|
try {
|
|
let res = await zwConfirmIn(this.index, this.dataList)
|
|
if (res.code === '200') {
|
|
uni.showToast({
|
|
title: res.message,
|
|
icon: 'none'
|
|
})
|
|
this.clearUp()
|
|
} else {
|
|
uni.showToast({
|
|
title: res.message,
|
|
icon: 'none'
|
|
})
|
|
this.disabled = false
|
|
}
|
|
} catch (e) {
|
|
this.disabled = false
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</script>
|