185 lines
4.6 KiB
Vue
185 lines
4.6 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-17 filter_select">
|
|
<uni-data-select v-model="index2" :localdata="options2" @change="selectChange2"></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 filter_select">
|
|
<uni-data-select v-model="index4" :localdata="options4" @change="selectChange4"></uni-data-select>
|
|
</view>
|
|
</view>
|
|
<view v-show="index4 !== '2'" class="zd-row border-bottom">
|
|
<view class="zd-col-6">
|
|
<span class="filter_label">物料数量</span>
|
|
</view>
|
|
<view class="zd-col-16">
|
|
<input type="text" class="filter_input" v-model="qty">
|
|
</view>
|
|
<view class="zd-col-2"><span class="filter_unit">KG</span></view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="zd-row submit-bar">
|
|
<button class="zd-col-6 button-default" @tap="clearUp">清空</button>
|
|
<button class="zd-col-16 button-primary" :class="{'button-info': !index2 || (!qty && index4 === '1') || !index4}" :disabled="disabled" @tap="toSure">确认</button>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import NavBar from '@/components/NavBar.vue'
|
|
import SearchBox from '@/components/SearchBox.vue'
|
|
import NumberInput from '@/components/NumberInput.vue'
|
|
import {getPdaCallEquipment, checkoutbillBackMaterial} from '@/utils/getData4.js'
|
|
export default {
|
|
components: {
|
|
NavBar,
|
|
SearchBox,
|
|
NumberInput
|
|
},
|
|
data() {
|
|
return {
|
|
title: '',
|
|
options2: [],
|
|
index2: '',
|
|
options4: [{text:'退料', value:'1'}, {text:'退空桶', value: '2'}],
|
|
index4: '',
|
|
qty: null,
|
|
disabled: false
|
|
};
|
|
},
|
|
onLoad (options) {
|
|
this.title = options.title
|
|
this._getPdaCallEquipment()
|
|
},
|
|
methods: {
|
|
async _getPdaCallEquipment () {
|
|
try {
|
|
let res = await getPdaCallEquipment()
|
|
if (res) {
|
|
this.options2 = res.data
|
|
} else {
|
|
this.options2 = []
|
|
}
|
|
} catch (e) {
|
|
this.options2 = []
|
|
}
|
|
},
|
|
selectChange2 (e) {
|
|
if (e) {
|
|
this.index2 = e
|
|
}
|
|
},
|
|
selectChange4 (e) {
|
|
this.index4 = e
|
|
},
|
|
clearUp () {
|
|
this.index4 = ''
|
|
this.index2 = ''
|
|
this.qty = null
|
|
this.disabled = false
|
|
},
|
|
async _getMaterialSuppByVehicleCode () {
|
|
try {
|
|
let res = await getMaterialSuppByVehicleCode(this.val2)
|
|
if (res.code === '200') {
|
|
this.currentData = res.data
|
|
} else {
|
|
uni.showToast({
|
|
title: res.message,
|
|
icon: 'none'
|
|
})
|
|
}
|
|
} catch (e) {
|
|
}
|
|
},
|
|
// async _checkoutbillBackMaterial () {
|
|
// this.disabled = true
|
|
// if (!this.index2 || (!this.qty && this.index4 === '1') || !this.index4) {
|
|
// this.disabled = false
|
|
// return
|
|
// }
|
|
// try {
|
|
// const qty = this.index4 !== '2' ? this.qty : null
|
|
// let res = await checkoutbillBackMaterial(this.index2, this.index4, qty)
|
|
// 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
|
|
// }
|
|
// }
|
|
toSure () {
|
|
this.disabled = true
|
|
if (!this.index2 || (!this.qty && this.index4 === '1') || !this.index4) {
|
|
this.disabled = false
|
|
return
|
|
}
|
|
if (Number(this.qty) > 2000) {
|
|
uni.showModal({
|
|
title: '提示',
|
|
content: '输入的重量'+ Number(this.qty) +'过大,是否继续?',
|
|
confirmColor: '#ff6a00',
|
|
success: (res) => {
|
|
if (res.confirm) {
|
|
this._checkoutbillBackMaterial()
|
|
} else if (res.cancel) {
|
|
this.disabled = false
|
|
}
|
|
}
|
|
})
|
|
} else {
|
|
this._checkoutbillBackMaterial()
|
|
}
|
|
},
|
|
async _checkoutbillBackMaterial () {
|
|
try {
|
|
const qty = this.index4 !== '2' ? this.qty : null
|
|
let res = await checkoutbillBackMaterial(this.index2, this.index4, qty)
|
|
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>
|
|
|
|
<style lang="stylus">
|
|
|
|
</style>
|