问题修复

This commit is contained in:
hongchao 2025-12-28 10:45:31 +08:00
parent 4382f72f5e
commit 609b442b4c
2 changed files with 27 additions and 42 deletions

View File

@ -981,8 +981,8 @@ export default {
trigger: 'blur', trigger: 'blur',
}, },
{ {
pattern: /^[1-9][0-9]*$/, pattern: /^[0-9]+[1-9][0-9]*$|^[1-9][0-9]*$|^0+[1-9][0-9]*$/,
message: '请输入大于0且不能以0开头的正整数', message: '请输入有效的数字串不能只输入0',
}, },
], ],
putInType: [ putInType: [
@ -1122,22 +1122,25 @@ export default {
} else { } else {
// this.codeForm.num, this.codeTableListthis.codeForm // this.codeForm.num, this.codeTableListthis.codeForm
for (let i = 0; i < this.codeForm.num; i++) { for (let i = 0; i < this.codeForm.num; i++) {
// : //
let suffix = parseInt(this.codeForm.codeSuffixStart) + i const prefixLength = this.codeForm.codeSuffixStart?.length || 1
if (suffix > parseInt(this.codeForm.codeSuffixEnd)) { //
suffix = parseInt(this.codeForm.codeSuffixEnd) const originalNum = parseInt(this.codeForm.codeSuffixStart)
const currentNum = originalNum + i
//
let suffix = currentNum.toString().padStart(prefixLength, '0')
//
if (this.codeForm.codeSuffixEnd) {
const endNum = parseInt(this.codeForm.codeSuffixEnd)
if (currentNum > endNum) {
suffix = endNum.toString().padStart(prefixLength, '0')
}
} }
suffix = suffix
.toString() //
.padStart( const maCode = `${this.codeForm.codePrefix || ''}${suffix}`
this.codeForm.codeSuffixStart?.length,
'0',
)
// console.log('🚀 ~ fillCodeForm ~ suffix:', suffix);
suffix = isNaN(suffix) ? '' : suffix
const maCode = `${
this.codeForm.codePrefix || ''
}${suffix}`
// //
const outFacCode = '' const outFacCode = ''
// //
@ -1154,7 +1157,7 @@ export default {
// : codeForm.buyPrice // : codeForm.buyPrice
const buyPrice = this.codeForm.buyPrice || 0 const buyPrice = this.codeForm.buyPrice || 0
this.codeTableList.push({ this.codeTableList.push({
maCode: this.codeForm.codeSuffixStart * 1 + i, maCode: maCode,
outFacCode, outFacCode,
maVender, maVender,
thisCheckTime, thisCheckTime,
@ -1162,20 +1165,6 @@ export default {
buyPrice, buyPrice,
}) })
} }
this.codeTableList.forEach((e) => {
if (e.maCode < 10) {
e.maCode = `000${e.maCode}`
} else if (e.maCode < 100) {
e.maCode = `00${e.maCode}`
} else if (e.maCode < 1000) {
e.maCode = `0${e.maCode}`
} else {
}
})
this.codeTableList.forEach((e) => {
e.maCode = this.codeForm.codePrefix + e.maCode
})
} }
}) })
}, },
@ -1183,16 +1172,12 @@ export default {
changeSuffixStart(num) { changeSuffixStart(num) {
if (isNaN(num)) { if (isNaN(num)) {
this.$message.error('后缀范围请输入数字类型') this.$message.error('后缀范围请输入数字类型')
this.codeForm.codeSuffixStart =
this.codeForm.codeSuffixStart.replace(/[^\d]/g, '')
}
if (
isNaN(this.codeForm.codeSuffixStart) ||
this.codeForm.codeSuffixStart.includes('.')
) {
this.$message.error('后缀范围请输入整数类型')
this.codeForm.codeSuffixStart = '' this.codeForm.codeSuffixStart = ''
} }
//
if (num) {
this.codeForm.codeSuffixStart = num.replace(/[^\d]/g, '')
}
}, },
changeSuffixEnd() { changeSuffixEnd() {
if (!this.codeForm.codeSuffixStart) { if (!this.codeForm.codeSuffixStart) {

View File

@ -35,9 +35,9 @@ module.exports = {
open: true, open: true,
proxy: { proxy: {
[process.env.VUE_APP_BASE_API]: { [process.env.VUE_APP_BASE_API]: {
// target: `http://112.29.103.165:21626`, //线上环境-重庆 target: `http://112.29.103.165:21626`, //线上环境-重庆
// target: `http://112.29.103.165:21624`,//线上环境-宁夏 打包前放开数据大屏的路由 // target: `http://112.29.103.165:21624`,//线上环境-宁夏 打包前放开数据大屏的路由
target: `http://192.168.0.56:39080`, //测试环境 // target: `http://192.168.0.56:39080`, //测试环境
// target: `http://1.12.248.179:23028`,//线上环境-南网 // target: `http://1.12.248.179:23028`,//线上环境-南网
// target: `https://test-cc.zhgkxt.com`,//线上环境-南网 // target: `https://test-cc.zhgkxt.com`,//线上环境-南网
// target: `https://z.csgmall.com.cn`, // target: `https://z.csgmall.com.cn`,