数量盘点入库-优化

This commit is contained in:
binbin_pan 2024-04-03 16:48:59 +08:00
parent a2cc2bb7c6
commit e5cf171d6d
1 changed files with 28 additions and 7 deletions

View File

@ -229,18 +229,18 @@
<el-input
v-model="codeForm.codeSuffixStart"
clearable
placeholder="请输入后缀范围"
placeholder="请输入后缀范围起始值"
style="width: 185px"
@input="changeInput(codeForm.codeSuffixStart)"
@change="changeSuffixStart(codeForm.codeSuffixStart)"
/>
</el-form-item>
<el-form-item label="~" label-width="auto" prop="codeSuffixEnd" v-if="!isNumCheck">
<el-input
v-model="codeForm.codeSuffixEnd"
clearable
placeholder="请输入后缀范围"
placeholder="请输入后缀范围结束值"
style="width: 185px"
@input="changeInput(codeForm.codeSuffixEnd)"
@change="changeSuffixEnd"
/>
</el-form-item>
</el-col>
@ -734,7 +734,11 @@ export default {
// this.codeForm.num, this.codeTableListthis.codeForm
for (let i = 0; i < this.codeForm.num; i++) {
// :
let suffix = (parseInt(this.codeForm.codeSuffixStart) + i).toString().padStart(this.codeForm.codeSuffixStart?.length, '0')
let suffix = parseInt(this.codeForm.codeSuffixStart) + i
if (suffix > parseInt(this.codeForm.codeSuffixEnd)) {
suffix = parseInt(this.codeForm.codeSuffixEnd)
}
suffix = suffix.toString().padStart(this.codeForm.codeSuffixStart?.length, '0')
// console.log('🚀 ~ fillCodeForm ~ suffix:', suffix);
suffix = isNaN(suffix) ? '' : suffix
const maCode = `${this.codeForm.codePrefix || ''}${suffix}`
@ -761,11 +765,28 @@ export default {
})
},
/** 输入框改变 */
changeInput(num) {
changeSuffixStart(num) {
if (isNaN(num)) {
this.$message.error('请输入数字类型')
this.$message.error('后缀范围请输入数字类型')
this.codeForm.codeSuffixStart = this.codeForm.codeSuffixStart.replace(/[^\d]/g, '')
}
if (!this.codeForm.codeSuffixStart) {
this.codeForm.codeSuffixEnd = ''
}
},
changeSuffixEnd() {
if (!this.codeForm.codeSuffixStart) {
this.$message.error('请输入后缀范围起始值')
this.codeForm.codeSuffixEnd = ''
} else if (isNaN(this.codeForm.codeSuffixEnd)) {
this.$message.error('后缀范围请输入数字类型')
this.codeForm.codeSuffixEnd = this.codeForm.codeSuffixStart.replace(/[^\d]/g, '')
} else {
if (parseInt(this.codeForm.codeSuffixStart) > parseInt(this.codeForm.codeSuffixEnd)) {
this.$message.error('后缀结束值不能小于起始值')
this.codeForm.codeSuffixEnd = +this.codeForm.codeSuffixStart + 1
}
}
},
handleResetRow(row) {