修改工资核定标准可以为小数,最多两个小数点

This commit is contained in:
BianLzhaoMin 2025-12-01 16:07:37 +08:00
parent 3200945615
commit 8e141943e1
3 changed files with 60 additions and 18 deletions

View File

@ -1836,7 +1836,12 @@ export default {
this.Base64Photo = '' this.Base64Photo = ''
}, },
// /**
* 初始化工资核定标准正则表达式
* 业务背景用于验证工资核定标准输入确保输入值大于等于最低工资标准且小于等于999999
* 设计决策支持最多2位小数的数字保持原有整数验证逻辑在整数部分基础上添加可选小数部分
* @param {Number} num - 最低工资标准整数
*/
initSalaryRegexp(num) { initSalaryRegexp(num) {
// num1-999999 // num1-999999
const n = Math.min(Math.max(Number(num) || 1, 1), 999999) const n = Math.min(Math.max(Number(num) || 1, 1), 999999)
@ -1850,7 +1855,8 @@ export default {
// num31234-61000-999999 // num31234-61000-999999
for (let i = len + 1; i <= maxLen; i++) { for (let i = len + 1; i <= maxLen; i++) {
// 1-9i-10-9 // 1-9i-10-9
regexParts.push(`[1-9]\\d{${i - 1}}`) // 2
regexParts.push(`[1-9]\\d{${i - 1}}(\\.\\d{1,2})?`)
} }
} }
@ -1861,19 +1867,29 @@ export default {
if (str === maxSameLen) { if (str === maxSameLen) {
// num999 // num999
regexParts.push(str) // 2
regexParts.push(`${str}(\\.\\d{1,2})?`)
} else { } else {
// //
// a. numnum=3454-9 // a. numnum=3454-9
if (firstDigit < 9) { if (firstDigit < 9) {
regexParts.push(`[${firstDigit + 1}-9]\\d{${len - 1}}`) // num
regexParts.push(
`[${firstDigit + 1}-9]\\d{${len - 1}}(\\.\\d{1,2})?`,
)
} }
// b. numnum // b. numnum
// num=345345 // num=345345
const restRegex = this.getRestRegex(rest) const restRegex = this.getRestRegex(rest)
if (restRegex) { if (restRegex) {
regexParts.push(`${firstDigit}${restRegex}`) // num
regexParts.push(`${firstDigit}${restRegex}(\\.\\d{1,2})?`)
// num = num
regexParts.push(`${firstDigit}${rest}(\\.\\d{1,2})?`)
} else {
// 1num
regexParts.push(`${firstDigit}(\\.\\d{1,2})?`)
} }
} }
@ -1919,10 +1935,14 @@ export default {
return result return result
}, },
// /**
* 初始化工资核定标准提示信息
* 业务背景提示用户输入符合要求的工资核定标准
* 设计决策更新提示信息以反映支持最多2位小数的数字
* @param {Number} num - 最低工资标准
*/
initSalaryMessage(num) { initSalaryMessage(num) {
// return `${num}-999999` this.contractInfoFormRules.wageCriterion[1].message = `请输入${num}-999999之间的数字最多2位小数`
this.contractInfoFormRules.wageCriterion[1].message = `请输入${num}-999999之间的正整数`
}, },
}, },

View File

@ -968,7 +968,8 @@ export default {
// num31234-61000-999999 // num31234-61000-999999
for (let i = len + 1; i <= maxLen; i++) { for (let i = len + 1; i <= maxLen; i++) {
// 1-9i-10-9 // 1-9i-10-9
regexParts.push(`[1-9]\\d{${i - 1}}`) // 2
regexParts.push(`[1-9]\\d{${i - 1}}(\\.\\d{1,2})?`)
} }
} }
@ -979,19 +980,29 @@ export default {
if (str === maxSameLen) { if (str === maxSameLen) {
// num999 // num999
regexParts.push(str) // 2
regexParts.push(`${str}(\\.\\d{1,2})?`)
} else { } else {
// //
// a. numnum=3454-9 // a. numnum=3454-9
if (firstDigit < 9) { if (firstDigit < 9) {
regexParts.push(`[${firstDigit + 1}-9]\\d{${len - 1}}`) // num
regexParts.push(
`[${firstDigit + 1}-9]\\d{${len - 1}}(\\.\\d{1,2})?`,
)
} }
// b. numnum // b. numnum
// num=345345 // num=345345
const restRegex = this.getRestRegex(rest) const restRegex = this.getRestRegex(rest)
if (restRegex) { if (restRegex) {
regexParts.push(`${firstDigit}${restRegex}`) // num
regexParts.push(`${firstDigit}${restRegex}(\\.\\d{1,2})?`)
// num = num
regexParts.push(`${firstDigit}${rest}(\\.\\d{1,2})?`)
} else {
// 1num
regexParts.push(`${firstDigit}(\\.\\d{1,2})?`)
} }
} }
@ -1040,7 +1051,7 @@ export default {
// //
initSalaryMessage(num) { initSalaryMessage(num) {
// return `${num}-999999` // return `${num}-999999`
this.addEntryProjectFormRules.wageCriterion[1].message = `请输入${num}-999999之间的正整数` this.addEntryProjectFormRules.wageCriterion[1].message = `请输入${num}-999999之间的数字最多2位小数`
}, },
}, },

View File

@ -475,7 +475,8 @@ export default {
// num31234-61000-999999 // num31234-61000-999999
for (let i = len + 1; i <= maxLen; i++) { for (let i = len + 1; i <= maxLen; i++) {
// 1-9i-10-9 // 1-9i-10-9
regexParts.push(`[1-9]\\d{${i - 1}}`) // 2
regexParts.push(`[1-9]\\d{${i - 1}}(\\.\\d{1,2})?`)
} }
} }
@ -486,19 +487,29 @@ export default {
if (str === maxSameLen) { if (str === maxSameLen) {
// num999 // num999
regexParts.push(str) // 2
regexParts.push(`${str}(\\.\\d{1,2})?`)
} else { } else {
// //
// a. numnum=3454-9 // a. numnum=3454-9
if (firstDigit < 9) { if (firstDigit < 9) {
regexParts.push(`[${firstDigit + 1}-9]\\d{${len - 1}}`) // num
regexParts.push(
`[${firstDigit + 1}-9]\\d{${len - 1}}(\\.\\d{1,2})?`,
)
} }
// b. numnum // b. numnum
// num=345345 // num=345345
const restRegex = this.getRestRegex(rest) const restRegex = this.getRestRegex(rest)
if (restRegex) { if (restRegex) {
regexParts.push(`${firstDigit}${restRegex}`) // num
regexParts.push(`${firstDigit}${restRegex}(\\.\\d{1,2})?`)
// num = num
regexParts.push(`${firstDigit}${rest}(\\.\\d{1,2})?`)
} else {
// 1num
regexParts.push(`${firstDigit}(\\.\\d{1,2})?`)
} }
} }
@ -547,7 +558,7 @@ export default {
// //
initSalaryMessage(num) { initSalaryMessage(num) {
// return `${num}-999999` // return `${num}-999999`
this.contractInfoFormRules.wageCriterion[1].message = `请输入${num}-999999之间的正整数` this.contractInfoFormRules.wageCriterion[1].message = `请输入${num}-999999之间的数字最多2位小数`
}, },
}, },
} }