Files
hht-longdianningxin-uni/pages/manage/bake-process.vue
2024-09-13 17:48:33 +08:00

198 lines
5.5 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">
<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"
/>
</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_picker">
<picker @change="pickerChange" :value="index1" :range="options1" range-key="text">
<view class="uni-input">{{index1 !== '' ? options1[index1].text : ''}}</view>
</picker>
</view>
<uni-icons type="right" size="14" color="#999"></uni-icons>
</view>
<view class="zd-row border-bottom">
<view class="zd-col-7">
<span class="filter_label">是否烘烤</span>
</view>
<view class="relative zd-col-17">
<switch :checked="isChecked" color="#6798ef" style="transform:scale(0.8)"/>
<text @tap="setWStatus" style="position: absolute;display: inline-block;width: 52px; height: 32px;left: 0;"></text>
</view>
</view>
<view class="zd-row border-bottom">
<view class="zd-col-7">
<span class="filter_label">温度</span>
</view>
<view class="zd-col-17">
<input v-model="val3" type="number" class="filter_input">
</view>
<view class="zd-col-2 filter_label"></view>
</view>
<view class="zd-row">
<view class="zd-col-7">
<span class="filter_label">时间</span>
</view>
<view class="zd-col-17">
<input v-model="val4" type="number" class="filter_input">
</view>
<view class="zd-col-2 filter_label"></view>
</view>
</view>
<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_msg">{{obj.container_name}}</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_msg">{{obj.status}}</view>
</view>
<view class="zd-row">
<view class="zd-col-7">
<span class="filter_label">提示</span>
</view>
<view class="zd-col-17 filter_msg">{{obj.tip}}</view>
</view>
</view>
</view>
<view class="zd-row submit-bar">
<button class="zd-col-4 button-default" @tap="clearUp">清空</button>
<button class="zd-col-6 button-primary" :class="{'button-info': !val1 || !val2 || index1 === '' || !val3 || !val4}" :disabled="disabled" @tap="_doModifyRawInfos">修改信息</button>
<button class="zd-col-6 button-primary" :class="{'button-info': !val1}" :disabled="disabled" @tap="_bakingQuality('1')">质检合格</button>
<button class="zd-col-6 button-primary" :class="{'button-info': !val1}" :disabled="disabled" @tap="_bakingQuality('0')">再次烘烤</button>
</view>
</view>
</template>
<script>
import NavBar from '@/components/NavBar.vue'
import SearchBox from '@/components/SearchBox.vue'
import {getHotTempPointInfo, bakingQuality, doModifyRawInfos} from '@/utils/getData2.js'
export default {
components: {
NavBar,
SearchBox
},
data() {
return {
title: '',
val1: '',
val2: '',
options1: [{value: '1', text: '大卷'}, {value: '2', text: '小卷'}],
index1: '',
isChecked: false,
val3: '',
val4: '',
obj: {container_name: '-', status: '-', tip: '-'},
disabled: false
};
},
watch: {
val1(value) {
this.checkInputs(value, this.val2);
},
val2(value) {
this.checkInputs(this.val1, value);
}
},
onLoad (options) {
this.title = options.title
},
methods: {
async _getHotTempPointInfo () {
let res = await getHotTempPointInfo(this.val1, this.val2)
this.obj = res
},
checkInputs(val1, val2) {
if (val1 && val2) {
this._getHotTempPointInfo()
}
},
pickerChange (e) {
this.index1 = e.detail.value
},
setWStatus () {
this.isChecked = !this.isChecked
},
clearUp () {
this.val1 = ''
this.val2 = ''
this.index1 = ''
this.isChecked = false
this.val3 = ''
this.val4 = ''
this.obj = {container_name: '-', status: '-', tip: '-'}
this.disabled = false
},
async _bakingQuality (type) {
this.disabled = true
if (!this.val1) {
this.disabled = false
return
}
try {
let res = await bakingQuality(this.val1, type)
this.clearUp()
uni.showToast({
title: res.message,
icon: 'none'
})
} catch (e) {
this.disabled = false
}
},
async _doModifyRawInfos () {
this.disabled = true
if (!this.val1 || !this.val2 || this.index1 === '' || !this.val3 || !this.val4) {
this.disabled = false
return
}
try {
let checked = this.isChecked ? '1' : '0'
let res = await doModifyRawInfos(this.val1, this.val2, this.options1[this.index1].value, checked, this.val3, this.val4)
this.clearUp()
uni.showToast({
title: res.message,
icon: 'none'
})
} catch (e) {
this.disabled = false
}
}
}
}
</script>
<style lang="stylus" scoped>
>>>.uni-date-x--border
border-color: transparent;
</style>