Files
hht-tongbo/pages/ProductManage/EmptyPipeInStore.vue

180 lines
4.5 KiB
Vue
Raw Normal View History

2022-10-10 17:08:52 +08:00
<template>
2022-10-15 15:29:58 +08:00
<view class="zd_container">
2022-10-11 17:03:44 +08:00
<nav-bar title="空管入库"></nav-bar>
2022-10-15 15:29:58 +08:00
<view class="zd_content">
<view class="zd_wrapper">
2022-10-11 17:03:44 +08:00
<view class="filter_item">
2023-04-27 16:36:54 +08:00
<view class="filter_label">区域</view>
2022-10-11 17:03:44 +08:00
<view class="filter_input_wraper">
2023-04-27 16:36:54 +08:00
<uni-data-select v-model="index1" :localdata="options1" @change="selectChange1"></uni-data-select>
2022-10-11 17:03:44 +08:00
</view>
</view>
<view class="filter_item">
2023-04-27 16:36:54 +08:00
<view class="filter_label">设备</view>
2022-10-11 17:03:44 +08:00
<view class="filter_input_wraper">
2023-04-27 16:36:54 +08:00
<uni-data-select v-model="index2" :localdata="options2" @change="selectChange2"></uni-data-select>
2022-10-11 17:03:44 +08:00
</view>
</view>
2022-10-12 08:51:05 +08:00
<view class="filter_item">
2023-04-27 16:36:54 +08:00
<view class="filter_label">物料</view>
2022-10-12 08:51:05 +08:00
<view class="filter_input_wraper">
2023-04-27 18:47:58 +08:00
<uni-data-select v-model="index3" :searchInput="true" :localdata="newoptions3" @change="selectChange3" @handleChange="handleChange" @showSelector="showSelector"></uni-data-select>
2022-10-12 08:51:05 +08:00
</view>
</view>
2022-10-12 10:35:42 +08:00
<view class="filter_item">
<view class="filter_label">数量</view>
<view class="filter_input_wraper">
2023-04-27 16:36:54 +08:00
<input type="text" class="filter_input filter_input_disabled" v-model="qty" disabled="disabled">
2022-10-12 10:35:42 +08:00
</view>
</view>
2022-10-11 17:03:44 +08:00
</view>
</view>
2022-10-10 19:58:07 +08:00
<view class="submit-bar">
2023-04-27 18:47:58 +08:00
<button class="submit-button" :class="{'btn-disabled': !index1 || !index3}" :disabled="disabled" @tap="_emptyConfirm">入库设置</button>
2023-04-27 16:36:54 +08:00
<button class="submit-button" :class="{'btn-disabled': !index2}" @tap="_taskQuerydevice">查询</button>
2022-10-10 19:58:07 +08:00
</view>
2022-10-10 17:08:52 +08:00
</view>
</template>
<script>
2022-10-10 19:58:07 +08:00
import NavBar from '@/components/NavBar.vue'
2022-10-12 08:51:05 +08:00
import SearchBox from '@/components/SearchBox.vue'
2023-04-27 16:36:54 +08:00
import {queryProductArea, taskQuerydevice, queryDeviceList, queryPaperMaterial, emptyConfirm} from '@/utils/getData2.js'
2022-10-10 17:08:52 +08:00
export default {
2022-10-11 17:03:44 +08:00
components: {
2022-10-12 08:51:05 +08:00
NavBar,
SearchBox
2022-10-11 17:03:44 +08:00
},
2022-10-10 17:08:52 +08:00
data() {
return {
2023-04-27 16:36:54 +08:00
options1: [],
index1: '',
options2: [],
index2: '1',
options3: [],
index3: '',
2022-10-12 10:35:42 +08:00
qty: '',
2023-04-27 18:47:58 +08:00
disabled: false,
val1: '',
newoptions3: []
2022-10-10 17:08:52 +08:00
};
2022-10-10 19:58:07 +08:00
},
2022-10-12 10:35:42 +08:00
created () {
2022-11-01 14:36:44 +08:00
this._queryProductArea()
2023-04-28 10:28:18 +08:00
this._queryDeviceList('')
2023-04-27 17:23:45 +08:00
this._queryPaperMaterial('')
2022-10-12 10:35:42 +08:00
},
2022-10-10 19:58:07 +08:00
methods: {
2023-04-27 16:36:54 +08:00
/** 选择器1 */
selectChange1(e) {
this.index1 = e
2023-04-28 10:28:18 +08:00
if (e) {
this._queryDeviceList(e)
this.index2 = ''
}
2023-04-27 16:36:54 +08:00
},
/** 选择器2 */
selectChange2(e) {
this.index2 = e
},
/** 选择器3 */
selectChange3(e) {
this.index3 = e
2022-10-12 10:35:42 +08:00
},
2023-04-27 18:47:58 +08:00
/** 模糊匹配 */
selectMatchItem (lists, keyWord) {
let resArr = []
lists.filter((item) => {
if (item.text.indexOf(keyWord) > -1) {
resArr.push(item)
}
})
return resArr
},
handleChange (e) {
if (e){
this.index3 = ''
this.newoptions3 = this.selectMatchItem(this.options3, e)
} else {
this.newoptions3 = this.options3
}
},
showSelector () {
this.newoptions3 = this.options3
},
2022-10-12 10:35:42 +08:00
/** 生产区域下拉框查询 */
async _queryProductArea () {
let res = await queryProductArea()
2023-04-27 16:36:54 +08:00
this.options1 = [...res.data]
2022-10-12 10:35:42 +08:00
},
2023-04-27 16:36:54 +08:00
/** 查询设备下拉框 */
2023-04-28 10:28:18 +08:00
async _queryDeviceList (area) {
let res = await queryDeviceList(area)
2023-04-27 16:36:54 +08:00
this.options2 = [...res.rows]
},
/**查询物料下拉框*/
async _queryPaperMaterial (code) {
2023-04-27 17:23:45 +08:00
let res = await queryPaperMaterial(code)
2023-04-27 16:36:54 +08:00
this.options3 = [...res.rows]
2023-04-27 18:47:58 +08:00
this.newoptions3 = [...res.rows]
2023-04-27 17:23:45 +08:00
res.rows.map(el => {
if (el.value === code) {
this.index3 = res.material_code
}
})
2023-04-27 16:36:54 +08:00
},
/** 查询物料、数量 */
async _taskQuerydevice () {
if (!this.index2) {
uni.showToast({
title: '请选择设备',
icon: 'none'
})
return
}
let res = await taskQuerydevice([{device_code: this.index2}])
2023-04-28 11:02:00 +08:00
let data = res.data[0]
this.qty = data.qty
this._queryPaperMaterial(data.material_code)
2022-10-12 10:35:42 +08:00
},
/** 确认 */
async _emptyConfirm () {
this.disabled = true
2023-04-27 16:36:54 +08:00
if (!this.index2) {
uni.showToast({
title: '设备不能为空',
icon: 'none'
})
this.disabled = false
return
}
if (!this.index3) {
uni.showToast({
title: '物料不能为空',
icon: 'none'
})
this.disabled = false
return
}
2022-10-12 10:35:42 +08:00
try {
2023-04-27 16:36:54 +08:00
let res = await emptyConfirm(this.qty, this.index3, this.index2, '1')
2022-10-12 10:35:42 +08:00
this.disabled = false
2022-11-11 18:22:26 +08:00
uni.showToast({
title: res.message,
icon: 'none'
})
2023-04-27 16:36:54 +08:00
this.index1 = ''
this.index2 = ''
this.index3 = ''
this.qty = ''
2023-04-28 10:28:18 +08:00
this._queryDeviceList('')
this._queryPaperMaterial('')
2022-10-12 10:35:42 +08:00
} catch (e) {
this.disabled = false
}
2022-10-12 08:51:05 +08:00
}
2022-10-10 17:08:52 +08:00
}
}
</script>