问题修复
This commit is contained in:
parent
4382f72f5e
commit
609b442b4c
|
|
@ -981,8 +981,8 @@ export default {
|
|||
trigger: 'blur',
|
||||
},
|
||||
{
|
||||
pattern: /^[1-9][0-9]*$/,
|
||||
message: '请输入大于0且不能以0开头的正整数',
|
||||
pattern: /^[0-9]+[1-9][0-9]*$|^[1-9][0-9]*$|^0+[1-9][0-9]*$/,
|
||||
message: '请输入有效的数字串(不能只输入0)',
|
||||
},
|
||||
],
|
||||
putInType: [
|
||||
|
|
@ -1122,22 +1122,25 @@ export default {
|
|||
} else {
|
||||
// 根据this.codeForm.num的数量, 往this.codeTableList中添加this.codeForm的数据
|
||||
for (let i = 0; i < this.codeForm.num; i++) {
|
||||
// 设备编码: 前缀 拼接 后缀
|
||||
let suffix = parseInt(this.codeForm.codeSuffixStart) + i
|
||||
if (suffix > parseInt(this.codeForm.codeSuffixEnd)) {
|
||||
suffix = parseInt(this.codeForm.codeSuffixEnd)
|
||||
// 保留原始格式的前缀长度
|
||||
const prefixLength = this.codeForm.codeSuffixStart?.length || 1
|
||||
// 计算当前序号,保留原始数字值
|
||||
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(
|
||||
this.codeForm.codeSuffixStart?.length,
|
||||
'0',
|
||||
)
|
||||
// console.log('🚀 ~ fillCodeForm ~ suffix:', suffix);
|
||||
suffix = isNaN(suffix) ? '' : suffix
|
||||
const maCode = `${
|
||||
this.codeForm.codePrefix || ''
|
||||
}${suffix}`
|
||||
|
||||
// 生成设备编码
|
||||
const maCode = `${this.codeForm.codePrefix || ''}${suffix}`
|
||||
// 出厂编码
|
||||
const outFacCode = ''
|
||||
// 生产厂家
|
||||
|
|
@ -1154,7 +1157,7 @@ export default {
|
|||
// 单价: codeForm.buyPrice
|
||||
const buyPrice = this.codeForm.buyPrice || 0
|
||||
this.codeTableList.push({
|
||||
maCode: this.codeForm.codeSuffixStart * 1 + i,
|
||||
maCode: maCode,
|
||||
outFacCode,
|
||||
maVender,
|
||||
thisCheckTime,
|
||||
|
|
@ -1162,20 +1165,6 @@ export default {
|
|||
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) {
|
||||
if (isNaN(num)) {
|
||||
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 = ''
|
||||
}
|
||||
// 只保留数字字符,允许前导零
|
||||
if (num) {
|
||||
this.codeForm.codeSuffixStart = num.replace(/[^\d]/g, '')
|
||||
}
|
||||
},
|
||||
changeSuffixEnd() {
|
||||
if (!this.codeForm.codeSuffixStart) {
|
||||
|
|
|
|||
|
|
@ -35,9 +35,9 @@ module.exports = {
|
|||
open: true,
|
||||
proxy: {
|
||||
[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://192.168.0.56:39080`, //测试环境
|
||||
// target: `http://192.168.0.56:39080`, //测试环境
|
||||
// target: `http://1.12.248.179:23028`,//线上环境-南网
|
||||
// target: `https://test-cc.zhgkxt.com`,//线上环境-南网
|
||||
// target: `https://z.csgmall.com.cn`,
|
||||
|
|
|
|||
Loading…
Reference in New Issue