143 lines
3.9 KiB
Vue
143 lines
3.9 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">库位编码</view>
|
|
<view class="filter_input_wraper">
|
|
<input type="text" placeholder="输入货架号码" class="filter_input" v-model="val1">
|
|
</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="index" :localdata="options" @change="selectChange"></uni-data-select>
|
|
</view>
|
|
</view>
|
|
<view v-show="index === '2' || index === '3'" class="filter_item">
|
|
<view class="filter_label">托盘编码</view>
|
|
<view class="filter_input_wraper">
|
|
<input type="text" class="filter_input" v-model="val2">
|
|
</view>
|
|
</view>
|
|
<view v-show="index === '3'" class="filter_item">
|
|
<view class="filter_label">砖块数量</view>
|
|
<view class="filter_input_wraper">
|
|
<input type="number" class="filter_input" v-model="val3">
|
|
</view>
|
|
</view>
|
|
<view v-show="index === '3'" class="filter_item">
|
|
<view class="filter_label">物料编码</view>
|
|
<view class="filter_input_wraper">
|
|
<input type="text" class="filter_input" v-model="val4">
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view v-show="index === '3'" class="zd_wrapper grid-wraper">
|
|
<view class="slide_new">
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th>物料编码</th>
|
|
<th>物料名称</th>
|
|
<th>物料规格</th>
|
|
<th>物料型号</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr v-for="(e, i) in dataList" :key="i" @tap="toCheck(e)" :class="{'checked': e.material_id === pkId}">
|
|
<td>{{e.material_code}}</td>
|
|
<td>{{e.material_name}}</td>
|
|
<td>{{e.material_spec}}</td>
|
|
<td>{{e.material_model}}</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="submit-bar">
|
|
<button class="submit-button" @tap="_shelfMaterialQuery">查询</button>
|
|
<button class="submit-button" :class="{'btn-disabled': !val1 || !index || (index === '2' && !val2) || (index === '3' && (!val2 || !val3 || !pkId))}" :disabled="disabled" @tap="toSure">确认</button>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import NavBar from '@/components/NavBar.vue'
|
|
import {shelfMaterialQuery, shelfUpdateData} from '@/utils/getData2.js'
|
|
import {dateTimeFtt} from '@/utils/utils.js'
|
|
export default {
|
|
components: {
|
|
NavBar
|
|
},
|
|
data() {
|
|
return {
|
|
val1: '',
|
|
index: '',
|
|
options: [{value: '1', text: '空位'}, {value: '2', text: '空盘'}, {value: '3', text: '有料'}],
|
|
val2: '',
|
|
val3: '',
|
|
val4: '',
|
|
dataList: [],
|
|
pkId: '',
|
|
disabled: false
|
|
};
|
|
},
|
|
methods: {
|
|
selectChange(e) {
|
|
this.index = e
|
|
},
|
|
/** grid查询 */
|
|
async _shelfMaterialQuery () {
|
|
let res = await shelfMaterialQuery(this.val4)
|
|
this.dataList = [...res]
|
|
},
|
|
/** 确认 */
|
|
async toSure () {
|
|
this.disabled = true
|
|
if (!this.val1 || !this.index || (this.index === '2' && !this.val2) || (this.index === '3' && (!this.val2 || !this.val3 || !this.pkId))) {
|
|
this.disabled = false
|
|
return
|
|
}
|
|
try {
|
|
let vcode = ''
|
|
let qty = ''
|
|
let id = ''
|
|
if (this.index === '2') {
|
|
vcode = this.val2
|
|
}
|
|
if (this.index === '3') {
|
|
vcode = this.val2
|
|
qty = this.val3
|
|
id = this.pkId
|
|
}
|
|
let res = await shelfUpdateData(this.val1, this.index, vcode, qty, id)
|
|
this.disabled = false
|
|
this.pkId = ''
|
|
this.val1 = ''
|
|
this.index = ''
|
|
this.val2 = ''
|
|
this.val3 = ''
|
|
this.val4 = ''
|
|
uni.showToast({
|
|
title: res.message,
|
|
icon: 'none'
|
|
})
|
|
} catch (e) {
|
|
this.disabled = false
|
|
}
|
|
},
|
|
toCheck (e) {
|
|
this.pkId = this.pkId === e.material_id ? '' : e.material_id
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="stylus">
|
|
</style>
|