Files
aio-hl-new/src/pages/modules/clean/man-pour.vue

205 lines
6.9 KiB
Vue
Raw Normal View History

2023-07-13 11:09:54 +08:00
<template>
<div class="order-wraper">
<div class="search-confirm-wrap">
<div class="search-wrap">
<div class="search-item">
2023-07-13 11:24:23 +08:00
<div class="search-label">车间</div>
2023-07-13 11:09:54 +08:00
<div class="filter_input_wraper">
2023-07-13 17:39:11 +08:00
<el-select v-model="value1" filterable clearable placeholder="请选择" @change="changeValue">
2023-07-13 11:09:54 +08:00
<el-option
v-for="item in options1"
2023-07-13 16:52:19 +08:00
:key="item.value"
:label="item.label"
:value="item.value">
2023-07-13 11:09:54 +08:00
</el-option>
</el-select>
</div>
</div>
<div class="search-item">
2023-07-13 11:24:23 +08:00
<div class="search-label">设备</div>
2023-07-13 11:09:54 +08:00
<div class="filter_input_wraper">
2023-07-13 17:39:11 +08:00
<el-select v-model="value2" filterable clearable placeholder="请选择" @change="changeValue">
2023-07-13 11:09:54 +08:00
<el-option
v-for="item in options2"
2023-07-13 17:39:11 +08:00
:key="item.device_code"
:label="item.device_name"
:value="item.device_code">
2023-07-13 11:09:54 +08:00
</el-option>
</el-select>
</div>
</div>
<div class="search-item">
2023-07-13 11:24:23 +08:00
<div class="search-label">规格</div>
2023-07-13 11:09:54 +08:00
<div class="filter_input_wraper pointer" @click="searchMater">
2023-07-13 16:52:19 +08:00
<input type="text" class="filter-input" v-model="material_spec" disabled>
2023-07-13 11:09:54 +08:00
</div>
</div>
<div class="search-item">
2023-07-13 11:24:23 +08:00
<div class="search-label">编码</div>
2023-07-13 11:09:54 +08:00
<div class="filter_input_wraper">
2023-07-13 16:52:19 +08:00
<input type="text" class="filter-input" v-model="material_code" disabled>
2023-07-13 11:09:54 +08:00
</div>
</div>
<div class="search-item">
2023-07-13 11:24:23 +08:00
<div class="search-label">名称</div>
2023-07-13 11:09:54 +08:00
<div class="filter_input_wraper">
2023-07-18 13:49:57 +08:00
<input type="text" class="filter-input" v-model="material_name" disabled>
2023-07-13 11:09:54 +08:00
</div>
</div>
<div class="search-item">
2023-07-13 11:24:23 +08:00
<div class="search-label">重量(g)</div>
2023-07-13 11:09:54 +08:00
<div class="filter_input_wraper">
2023-07-13 16:52:19 +08:00
<input type="number" class="filter-input" v-model="deviceinstor_weight" disabled>
2023-07-13 11:09:54 +08:00
</div>
</div>
<div class="search-item_2">
2023-07-13 16:52:19 +08:00
<button class="button button--primary" :disabled="disabled1" @click="_washweighing">称重</button>
2023-07-18 16:16:43 +08:00
<button class="button button--primary" :disabled="disabled2" :class="{'button--defalut': value2 === '' || deviceinstor_weight === '' || material_code === '' || material_spec === '' || material_name === ''}" @click="toSure">确认</button>
2023-07-13 16:52:19 +08:00
<button class="button button--primary" @click="toCancel">取消</button>
2023-07-13 11:09:54 +08:00
</div>
</div>
</div>
</div>
</template>
<script>
2023-07-13 17:39:11 +08:00
import {dictall, washdevicelist, washquery, washweighing, washweighingFinish} from '@config/getData1.js'
2023-07-13 11:09:54 +08:00
export default {
2023-07-13 16:52:19 +08:00
name: 'manpour',
2023-07-13 11:09:54 +08:00
data () {
return {
options1: [],
value1: '',
options2: [],
value2: '',
material_id: '',
material_spec: '',
2023-07-13 16:52:19 +08:00
material_code: '',
material_name: '',
deviceinstor_weight: '',
2023-07-13 11:09:54 +08:00
disabled1: false,
disabled2: false
}
},
beforeRouteLeave (to, from, next) {
if (to.path === '/home' || to.path === '/login') {
this.$store.dispatch('setKeepAlive', [])
}
next()
},
activated () {
2023-07-18 09:45:35 +08:00
console.log(this.$store.getters.materObj, 666)
2023-07-13 11:09:54 +08:00
if (this.$store.getters.materObj !== '') {
this.material_spec = JSON.parse(this.$store.getters.materObj).material_spec
2023-07-13 16:52:19 +08:00
this.material_code = JSON.parse(this.$store.getters.materObj).material_code
this.material_name = JSON.parse(this.$store.getters.materObj).material_name
2023-07-13 11:09:54 +08:00
}
},
created () {
2023-07-18 09:25:05 +08:00
this._dictall()
this._washdevicelist()
2023-07-13 11:09:54 +08:00
},
methods: {
2023-07-13 16:52:19 +08:00
// 车间下拉框
async _dictall () {
let res = await dictall()
if (res.code === 200) {
this.options1 = [...res.content]
} else {
this.toast(res.msg)
}
2023-07-13 11:09:54 +08:00
},
2023-07-13 16:52:19 +08:00
// 设备下拉框
async _washdevicelist () {
2023-07-18 09:03:43 +08:00
let res = await washdevicelist('1535144552481034240')
2023-07-13 16:52:19 +08:00
if (res.code === 200) {
this.options2 = [...res.content]
} else {
this.toast(res.msg)
}
2023-07-13 11:09:54 +08:00
},
2023-07-13 17:39:11 +08:00
changeValue () {
if (this.value1 && this.value2) {
this._washquery()
}
},
// 1.2根据设备列表获取物料信息
async _washquery () {
let res = await washquery(this.value1, this.value2)
if (res.code === 200) {
this.material_spec = res.content[0].material_spec
this.material_code = res.content[0].material_code
this.material_name = res.content[0].material_name
} else {
this.toast(res.msg)
}
},
2023-07-13 16:52:19 +08:00
// 称重
async _washweighing () {
2023-07-13 11:09:54 +08:00
this.disabled1 = true
2023-07-13 16:52:19 +08:00
let list = []
list.push(this.value2)
2023-07-13 11:09:54 +08:00
try {
2023-07-13 16:52:19 +08:00
let res = await washweighing(list)
2023-07-13 17:39:11 +08:00
if (res.code === 200) {
this.deviceinstor_weight = res.content[0].deviceinstor_weight
}
2023-07-13 11:09:54 +08:00
this.disabled1 = false
} catch (e) {
this.disabled1 = false
}
},
2023-07-13 16:52:19 +08:00
// 确认
2023-07-13 11:09:54 +08:00
async toSure () {
this.disabled2 = true
2023-07-18 16:16:43 +08:00
if (this.value2 === '' || this.deviceinstor_weight === '' || this.material_code === '' || this.material_spec === '' || this.material_name === '') {
2023-07-13 11:09:54 +08:00
this.disabled2 = false
return
}
try {
2023-07-18 16:16:43 +08:00
let res = await washweighingFinish(this.value2, this.deviceinstor_weight, this.material_code, this.material_spec, this.material_name)
2023-07-13 17:39:11 +08:00
if (res.code === 200) {
this.toast(res.msg)
this.value1 = ''
this.value2 = ''
2023-07-18 16:16:43 +08:00
this.deviceinstor_weight = ''
2023-07-13 17:39:11 +08:00
this.material_code = ''
2023-07-18 16:16:43 +08:00
this.material_spec = ''
2023-07-13 17:39:11 +08:00
this.material_name = ''
this.$store.dispatch('setMaterObj', '')
}
2023-07-13 11:09:54 +08:00
this.disabled2 = false
} catch (e) {
this.disabled2 = false
}
},
searchMater () {
this.$store.dispatch('setMaterObj', '')
2023-07-13 16:52:19 +08:00
this.$router.push('/selectmater')
2023-07-13 11:09:54 +08:00
},
2023-07-13 16:52:19 +08:00
toCancel () {
this.$router.push('/home')
2023-07-13 11:09:54 +08:00
}
}
}
</script>
<style lang="stylus" scoped>
.search-item
width 49%
&:nth-child(3n+2)
margin-left 0
margin-right 0
&:nth-child(2n)
margin-left 2%
.search-item_2
width 100%
margin-left 0
.filter_button
width 96px
height 30px
.filter_input_wraper_1
width calc(100% - 156px)
padding-right 10px
</style>