Files
hht-ynhl-one-uni/pages/SecondPhase/production/BakeProcess.vue
2025-06-17 13:19:30 +08:00

169 lines
4.9 KiB
Vue

<template>
<view class="zd_container">
<!-- <nav-bar title="烘烤工序"></nav-bar> -->
<nav-bar :title="title"></nav-bar>
<view class="zd_content">
<view class="zd_wrapper">
<view class="filter_item">
<view class="filter_label_wraper">
<span class="filter_label">{{$t('grid.point-code')}}</span>
</view>
<view class="filter_input_wraper">
<search-box v-model="val1" @handleChange="handleChange1"/>
</view>
</view>
<view class="filter_item">
<view class="filter_label_wraper">
<span class="filter_label">{{$t('filter.mother-roll')}}</span>
</view>
<view class="filter_input_wraper">
<search-box v-model="val2" />
</view>
</view>
<view class="filter_item">
<view class="filter_label">{{$t('filter.temperature')}}</view>
<view class="filter_input_wraper">
<input type="number" class="filter_input" v-model="val3">
</view>
</view>
<view class="filter_item">
<view class="filter_label">{{$t('filter.time')}}({{$t('unit.minute')}})</view>
<view class="filter_input_wraper">
<input type="number" class="filter_input" v-model="val4">
</view>
</view>
<view class="filter_item">
<view class="filter_label">{{$t('filter.type')}}</view>
<view class="filter_input_wraper">
<uni-data-select v-model="index" :placeholder="$t('uni.dataSelect.placeholder')" :emptyTips="$t('uni.dataSelect.emptyTips')" :localdata="options"></uni-data-select>
</view>
</view>
</view>
</view>
<view class="zd-row submitbar">
<button class="zd-col-5 btn-submit btn-success letter-30" :class="{'btn-info': !val1 || !val2 || !val3 || !val4}" :disabled="disabled" @tap="_ovenInAndOut1('1')">{{$t('button.enter-box')}}</button>
<button class="zd-col-5 btn-submit btn-success letter-30" :class="{'btn-info': !val1}" :disabled="disabled" @tap="_ovenInAndOut2('2')">{{$t('button.out-box')}}</button>
<button class="zd-col-5 btn-submit btn-success" :class="{'btn-info': !val1 || !val2}" :disabled="disabled3" @tap="_inCoolIvt">{{$t('button.quality-approved')}}</button>
<button class="zd-col-5 btn-submit btn-success letter-30" :class="{'btn-info': !((val1 && val2 && index === '1') || (val1 && val2 && val3 && val4 && index === '2'))}" :disabled="disabled4" @tap="_inCoolOrOven">质检不合格</button>
</view>
</view>
</template>
<script>
import NavBar from '@/components/NavBar.vue'
import SearchBox from '@/components/SearchBox.vue'
import {ovenInAndOut, inCoolIvt, bakingquery, inCoolOrOven} from '@/utils/getData1.js'
export default {
components: {
NavBar,
SearchBox
},
data() {
return {
title: '',
val1: '',
val2: '',
val3: '',
val4: '',
index: '',
options: [{value: '1', text: '入冷却'}, {value: '2', text: '入烘箱'}],
disabled: false,
disabled3: false,
disabled4: false
};
},
onLoad (options) {
this.title = options.title
},
methods: {
handleChange1 (e) {
this._bakingquery(e)
},
/** 查询 */
async _bakingquery (val1) {
if (!val1) {
return
}
let res = await bakingquery(val1)
this.val2 = res.data.container_name
},
async _ovenInAndOut1 (type) {
this.disabled = true
if (!this.val1 || !this.val2 ||!this.val3 || !this.val4) {
this.disabled = false
return
}
try {
let res = await ovenInAndOut(this.val1, this.val2,this.val3, this.val4, type)
uni.showToast({
title: res.message,
icon: 'none'
})
this.val1 = ''
this.val2 = ''
this.val3 = ''
this.val4 = ''
this.disabled = false
} catch (e) {
this.disabled = false
}
},
async _ovenInAndOut2 (type) {
this.disabled = true
if (!this.val1) {
this.disabled = false
return
}
try {
let res = await ovenInAndOut(this.val1, '','', '', type)
uni.showToast({
title: res.message,
icon: 'none'
})
this.val1 = ''
this.val2 = ''
this.val3 = ''
this.val4 = ''
this.disabled = false
} catch (e) {
this.disabled = false
}
},
async _inCoolIvt () {
this.disabled3 = true
if (!this.val1 || !this.val2) {
this.disabled3 = false
return
}
try {
let res = await inCoolIvt(this.val1, this.val2)
uni.showToast({
title: res.message,
icon: 'none'
})
this.disabled3 = false
} catch (e) {
this.disabled3 = false
}
},
// 质检不合格
async _inCoolOrOven () {
this.disabled4 = true
if (!((this.val1 && this.val2 && this.index === '1') || (this.val1 && this.val2 && this.val3 && this.val4 && this.index === '2'))) {
this.disabled4 = false
return
}
try {
let res = await inCoolOrOven(this.val1, this.val2, this.val3, this.val4, this.index)
uni.showToast({
title: res.message,
icon: 'none'
})
this.disabled4 = false
} catch (e) {
this.disabled4 = false
}
}
}
}
</script>