调整评分量化表

This commit is contained in:
2026-08-25 13:44:20 +08:00
parent 8955ef16c7
commit f3c29ef2bf
2 changed files with 37 additions and 16 deletions
@@ -232,7 +232,7 @@
<el-form-item label="分值" required>
<el-input-number
v-model="itemForm.score"
:min="0.01"
:min="0"
:precision="2"
:step="0.01"
:controls="false"
@@ -821,10 +821,10 @@ export default {
!this.isPositiveDecimal(option.changeValue) ||
!option.changeUnit ||
!option.scoreType ||
!this.isPositiveDecimal(option.score)
!this.isNonNegativeDecimal(option.score)
);
if (invalidScoreOption) {
this.$message.warning('请完整填写基础分值,并确保数值为正数且最多两位小数');
this.$message.warning('请完整填写基础分值,并确保数值不能为负数且最多两位小数');
return;
}
} else {
@@ -987,15 +987,15 @@ export default {
},
isPositiveDecimal(value) {
const number = Number(value);
console.log(
value,
Number.isFinite(number),
number,
Math.abs(number * 100 - Math.round(number * 100))
);
if (!Number.isFinite(number) || number <= 0) return false;
return Math.abs(number * 100 - Math.round(number * 100)) < 1e-8;
},
isNonNegativeDecimal(value) {
if (value === undefined || value === null || String(value).trim() === '') return false;
const number = Number(value);
if (!Number.isFinite(number) || number < 0) return false;
return Math.abs(number * 100 - Math.round(number * 100)) < 1e-8;
},
isAnyNumber(value) {
const text = String(value ?? '').trim();
return /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)$/.test(text) && Number.isFinite(Number(text));
@@ -1051,7 +1051,7 @@ export default {
!this.isPositiveDecimal(option.changeValue) ||
!this.scoreUnitOptions.includes(option.changeUnit) ||
!option.scoreType ||
!this.isPositiveDecimal(option.score)
!this.isNonNegativeDecimal(option.score)
)
) {
this.$message.warning(`${item.itemName || '评分项目'}的基础分值配置不完整`);
@@ -1106,7 +1106,7 @@ export default {
!this.isPositiveDecimal(option.changeValue) ||
!this.scoreUnitOptions.includes(option.changeUnit) ||
!option.scoreType ||
!this.isPositiveDecimal(option.score)
!this.isNonNegativeDecimal(option.score)
)
) {
this.$message.warning(`${item.itemName || '评分项目'}的基础分值配置不完整`);