Files
hht-hl-three-uni/pages/modules/SemifinishedOutStore.vue
2023-08-29 17:19:26 +08:00

125 lines
3.1 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">
<uni-data-select v-model="index1" :localdata="options1" @change="selectChange1"></uni-data-select>
</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="index2" :localdata="options2" @change="selectChange2"></uni-data-select>
</view>
</view>
<view class="filter_item filter_item_1">
<view class="filter_label">备注</view>
<view class="filter_input_wraper filter_input_wraper_1">
<textarea class="filter_textarea" v-model="remark"></textarea>
</view>
</view>
</view>
</view>
<view class="submit-bar">
<button class="submit-button" :class="{'btn-disabled': !index1 || !index2}" :disabled="disabled1" @tap="toSure">确认</button>
<button class="submit-button" @tap="toCancle">取消</button>
</view>
</view>
</template>
<script>
import NavBar from '@/components/NavBar.vue'
import SearchBox from '@/components/SearchBox.vue'
import {deviceInfo, deviceStatus, deviceCheckVerify} from '@/utils/getData2.js'
export default {
components: {
NavBar,
SearchBox
},
data() {
return {
options1: [],
index1: '',
options2: [],
index2: '',
remark: '',
disabled1: false
};
},
created () {
this._deviceInfo()
this._deviceStatus()
},
methods: {
/** 选择器 */
selectChange1(e) {
this.index1 = e
},
selectChange2(e) {
this.index2 = e
},
/** 获取设备下拉框 */
async _deviceInfo () {
let res = await deviceInfo()
this.options1 = [...res]
},
/** 获取设备状态下拉框 */
async _deviceStatus () {
let res = await deviceStatus()
this.options2 = [...res]
},
/** 确定 */
async toSure () {
this.disabled1 = true
if (!this.index1) {
uni.showToast({
title: '设备号不能为空',
icon: 'none'
})
this.disabled1 = false
return
}
if (!this.index2) {
uni.showToast({
title: '状态不能为空',
icon: 'none'
})
this.disabled1 = false
return
}
try {
let userName = this.$store.getters.userInfo !== '' ? JSON.parse(this.$store.getters.userInfo).username : ''
let res = await deviceCheckVerify(this.index1, userName,this.remark, this.index2)
this.disabled1 = false
this.index1 = ''
this.index2 = ''
this.remark = ''
uni.showToast({
title: res.message,
icon: 'none'
})
} catch (e) {
this.disabled1 = false
}
},
toCancle () {
this.disabled1 = false
this.index1 = ''
this.index2 = ''
this.remark = false
}
}
}
</script>
<style lang="stylus" scoped>
.filter_item_1, .filter_input_wraper_1
align-items: flex-start
height 210rpx
</style>