|
@@ -218,15 +218,15 @@ export default {
|
|
|
],
|
|
|
ranking: [
|
|
|
{ required: true, message: "全国进出口值排名不能为空", trigger: "blur" },
|
|
|
- { trigger: 'blur', validator: this.validator }
|
|
|
+ { trigger: 'blur', validator: this.validateNumber }
|
|
|
],
|
|
|
midwestRanking: [
|
|
|
{ required: true, message: "中西部绩效排名不能为空", trigger: "blur" },
|
|
|
- { trigger: 'blur', validator: this.validator }
|
|
|
+ { trigger: 'blur', validator: this.validateNumber }
|
|
|
],
|
|
|
nationalPerformanceRanking: [
|
|
|
{ required: true, message: "全国绩效排名不能为空", trigger: "blur" },
|
|
|
- { trigger: 'blur', validator: this.validator }
|
|
|
+ { trigger: 'blur', validator: this.validateNumber }
|
|
|
]
|
|
|
}
|
|
|
};
|
|
@@ -355,11 +355,15 @@ export default {
|
|
|
}, `RANK_${new Date().getTime()}.xlsx`)
|
|
|
},
|
|
|
// 校验参数
|
|
|
- validator(rule, value, callback) {
|
|
|
- if (Number.isInteger(Number(value)) && Number(value) > 0 && Number(value) < 999) {
|
|
|
- callback()
|
|
|
+ validateNumber(rule, value, callback) {
|
|
|
+ if (value === '') {
|
|
|
+ callback(new Error('请输入整数'));
|
|
|
+ } else if (!Number.isInteger(Number(value))) {
|
|
|
+ callback(new Error('请输入整数'));
|
|
|
+ } else if (Number(value) < 0) {
|
|
|
+ callback(new Error('不能小于0'));
|
|
|
} else {
|
|
|
- callback(new Error('请输入1-999的正整数'))
|
|
|
+ callback();
|
|
|
}
|
|
|
}
|
|
|
}
|