Commit 319b0c99 authored by Hagsn3's avatar Hagsn3

提交代码

parent c3884ada
......@@ -7,7 +7,7 @@
<span>{{ form.ptype && getDictLabelByValue(typeList, form.ptype.trim()) || '-' }}</span>
</el-form-item>
<el-form-item label="code:">
<span>{{ form.appCode || '-' }}</span>
<span>{{ form.orderCode || '-' }}</span>
</el-form-item>
</div>
<el-form-item label="pn:">
......@@ -30,10 +30,10 @@
<div class="disposeTable">
<div class="searchInput">
<el-form ref="formRef" :model="searchForm" :rules="rules" label-width="80px" class="formClass" label-position="right">
<el-form-item label="位置">
<el-form-item label="位置" prop="search">
<el-input ref="input1" v-model="searchForm.search" clearable @keyup.enter.native="handleSearch" />
</el-form-item>
<el-form-item label="YY">
<el-form-item label="YY" prop="value2">
<el-input ref="input2" v-model="searchForm.value2" clearable @keyup.enter.native="handleSearchLot" />
</el-form-item>
</el-form>
......@@ -93,9 +93,20 @@ export default {
SearchKeyword: '',
businessId: null,
form: {
ptype: null,
orderCode: null,
pn: null,
lot: null,
qty: null,
rank: null
},
rules: {
search: [
{ pattern: /^.*,.*/ | /^.*$/, message: '输入值不符合格式要求,请重新输入', trigger: 'blur' }
],
value2: [
{ pattern: /^[^:]+:[^:]+:[^:]+:\d+$/, message: '输入值不符合格式要求,请重新输入', trigger: 'blur' }
]
},
tableList: [],
......@@ -280,45 +291,67 @@ export default {
// 查询回
handleSearch() {
// 获取位置输入框的数据
if (this.searchForm.search && this.searchForm.search !== '') {
this.$refs.formRef.validateField('search', (error) => {
if (error) {
playAudio(true)
this.$message.error({
message: '输入值不符合格式要求,请重新输入',
duration: 2000,
onClose: () => {
playAudio(false)
}
}, () => {})
this.searchForm.search = null
} else {
if (this.searchForm.search.includes(',')) {
this.search = this.searchForm.search.split(',')[0]
this.judgePush(this.search)
} else {
this.search = this.searchForm.search
this.judgePush(this.search)
}
console.log('this.search', this.search)
}
})
},
/** 判断是否可以输入*/
judgePush(data) {
let isLegalLocation = false
this.tableList.forEach(item => {
if (item.location === data) {
isLegalLocation = true
}
})
if (isLegalLocation) {
successAudio(true)
this.$nextTick().then(() => {
this.$refs.input2.focus()
})
} else {
playAudio(true)
this.$message.error({
message: '输入的格式不符合要求,请重新输入',
message: '请输入正确的location值!',
duration: 2000,
onClose: () => {
playAudio(false)
}
})
}
console.log('this.search', this.search)
if (this.search != null) {
this.$nextTick().then(() => {
this.$refs.input2.focus()
})
this.searchForm.search = null
}
},
handleSearchLot() {
const pattern = /^[^:]+:[^:]+:[^:]+:\d+$/
const inputLot = this.searchForm.value2.trim()
if (!pattern.test(inputLot)) {
this.$refs.formRef.validateField('value2', (error) => {
if (error) {
playAudio(true)
this.$message.error({
message: '输入格式不正确,请按照指定格式输入!',
duration: 3000,
message: '输入值不符合格式要求,请重新输入',
duration: 2000,
onClose: () => {
playAudio(false)
}
})
}, () => {})
// 清空输入框
this.searchForm.value2 = ''
// 或者保留原来的输入
// this.$refs.input2.$refs.input.value = '';
} else {
const values = this.searchForm.value2.split(':')
const obj = {
......@@ -341,12 +374,10 @@ export default {
} else {
// 获取LOT输入框的数据
this.lot = obj.lot
if (this.search && this.lot) {
var lot = this.lot
var search = this.search
// 调用方法,并传入位置和LOT作为参数
const abj = this.getIndexAndNeedNumber(search, lot)
if (abj) {
const { index, needNumber } = abj
if (!this.rowIndexList.includes(index)) {
......@@ -362,22 +393,9 @@ export default {
this.searchForm.search = ''
this.searchForm.value2 = '' // 清空LOT输入框数据
}
} else {
playAudio(true)
this.$message.error({
message: '输入不符合要求请重新输入!',
duration: 2000,
onClose: () => {
playAudio(false)
}
})
}
}
// if (this.searchForm.value2 && this.searchForm.value2 !== '') {
// this.lot = this.searchForm.value2
// }
}
})
},
// 出库
handleSave() {
......@@ -393,7 +411,7 @@ export default {
console.log('res', res)
if (res.code === 200) {
this.$router.push({
path: '/setup/applicationTable'
path: '/setup/inspectionRequestProcessing'
})
this.$message.success({
message: '出库成功!',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment