Commit 319b0c99 authored by Hagsn3's avatar Hagsn3

提交代码

parent c3884ada
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<span>{{ form.ptype && getDictLabelByValue(typeList, form.ptype.trim()) || '-' }}</span> <span>{{ form.ptype && getDictLabelByValue(typeList, form.ptype.trim()) || '-' }}</span>
</el-form-item> </el-form-item>
<el-form-item label="code:"> <el-form-item label="code:">
<span>{{ form.appCode || '-' }}</span> <span>{{ form.orderCode || '-' }}</span>
</el-form-item> </el-form-item>
</div> </div>
<el-form-item label="pn:"> <el-form-item label="pn:">
...@@ -30,10 +30,10 @@ ...@@ -30,10 +30,10 @@
<div class="disposeTable"> <div class="disposeTable">
<div class="searchInput"> <div class="searchInput">
<el-form ref="formRef" :model="searchForm" :rules="rules" label-width="80px" class="formClass" label-position="right"> <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-input ref="input1" v-model="searchForm.search" clearable @keyup.enter.native="handleSearch" />
</el-form-item> </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-input ref="input2" v-model="searchForm.value2" clearable @keyup.enter.native="handleSearchLot" />
</el-form-item> </el-form-item>
</el-form> </el-form>
...@@ -93,9 +93,20 @@ export default { ...@@ -93,9 +93,20 @@ export default {
SearchKeyword: '', SearchKeyword: '',
businessId: null, businessId: null,
form: { form: {
ptype: null,
orderCode: null,
pn: null,
lot: null,
qty: null,
rank: null
}, },
rules: { rules: {
search: [
{ pattern: /^.*,.*/ | /^.*$/, message: '输入值不符合格式要求,请重新输入', trigger: 'blur' }
],
value2: [
{ pattern: /^[^:]+:[^:]+:[^:]+:\d+$/, message: '输入值不符合格式要求,请重新输入', trigger: 'blur' }
]
}, },
tableList: [], tableList: [],
...@@ -280,73 +291,93 @@ export default { ...@@ -280,73 +291,93 @@ export default {
// 查询回 // 查询回
handleSearch() { handleSearch() {
// 获取位置输入框的数据 // 获取位置输入框的数据
if (this.searchForm.search && this.searchForm.search !== '') { this.$refs.formRef.validateField('search', (error) => {
if (this.searchForm.search.includes(',')) { if (error) {
this.search = this.searchForm.search.split(',')[0] playAudio(true)
this.$message.error({
message: '输入值不符合格式要求,请重新输入',
duration: 2000,
onClose: () => {
playAudio(false)
}
}, () => {})
this.searchForm.search = null
} else { } else {
this.search = this.searchForm.search 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 { } else {
playAudio(true) playAudio(true)
this.$message.error({ this.$message.error({
message: '输入的格式不符合要求,请重新输入', message: '请输入正确的location值!',
duration: 2000, duration: 2000,
onClose: () => { onClose: () => {
playAudio(false) playAudio(false)
} }
}) })
} this.searchForm.search = null
console.log('this.search', this.search)
if (this.search != null) {
this.$nextTick().then(() => {
this.$refs.input2.focus()
})
} }
}, },
handleSearchLot() { handleSearchLot() {
const pattern = /^[^:]+:[^:]+:[^:]+:\d+$/ this.$refs.formRef.validateField('value2', (error) => {
const inputLot = this.searchForm.value2.trim() if (error) {
if (!pattern.test(inputLot)) {
playAudio(true)
this.$message.error({
message: '输入格式不正确,请按照指定格式输入!',
duration: 3000,
onClose: () => {
playAudio(false)
}
})
// 清空输入框
this.searchForm.value2 = ''
// 或者保留原来的输入
// this.$refs.input2.$refs.input.value = '';
} else {
const values = this.searchForm.value2.split(':')
const obj = {
lot: values[0],
pn: values[1],
qty: parseInt(values[3]),
rank: values[2]
}
console.log(obj)
if (obj.pn !== this.form.pn || obj.lot !== this.form.lot) {
playAudio(true) playAudio(true)
this.$message.error({ this.$message.error({
message: '输入不符合要求请重新输入!', message: '输入值不符合格式要求,请重新输入',
duration: 2000, duration: 2000,
onClose: () => { onClose: () => {
playAudio(false) playAudio(false)
} }
}) }, () => {})
this.searchForm.value2 = null // 清空输入框
this.searchForm.value2 = ''
} else { } else {
// 获取LOT输入框的数据 const values = this.searchForm.value2.split(':')
this.lot = obj.lot const obj = {
if (this.search && this.lot) { lot: values[0],
pn: values[1],
qty: parseInt(values[3]),
rank: values[2]
}
console.log(obj)
if (obj.pn !== this.form.pn || obj.lot !== this.form.lot) {
playAudio(true)
this.$message.error({
message: '输入不符合要求请重新输入!',
duration: 2000,
onClose: () => {
playAudio(false)
}
})
this.searchForm.value2 = null
} else {
// 获取LOT输入框的数据
this.lot = obj.lot
var lot = this.lot var lot = this.lot
var search = this.search var search = this.search
// 调用方法,并传入位置和LOT作为参数 // 调用方法,并传入位置和LOT作为参数
const abj = this.getIndexAndNeedNumber(search, lot) const abj = this.getIndexAndNeedNumber(search, lot)
if (abj) { if (abj) {
const { index, needNumber } = abj const { index, needNumber } = abj
if (!this.rowIndexList.includes(index)) { if (!this.rowIndexList.includes(index)) {
...@@ -362,22 +393,9 @@ export default { ...@@ -362,22 +393,9 @@ export default {
this.searchForm.search = '' this.searchForm.search = ''
this.searchForm.value2 = '' // 清空LOT输入框数据 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() { handleSave() {
...@@ -393,7 +411,7 @@ export default { ...@@ -393,7 +411,7 @@ export default {
console.log('res', res) console.log('res', res)
if (res.code === 200) { if (res.code === 200) {
this.$router.push({ this.$router.push({
path: '/setup/applicationTable' path: '/setup/inspectionRequestProcessing'
}) })
this.$message.success({ this.$message.success({
message: '出库成功!', 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