|
@@ -103,9 +103,13 @@ export default {
|
|
|
// isFinite(this.tableData[currentIndex].actualityFloor) //判断是否在 JavaScript 的安全整数范围内
|
|
|
const currentIndex = this.currentIndex;
|
|
|
const inputValue = this.tableData[currentIndex].actualityFloor;
|
|
|
- if (/^[a-zA-Z0-9]+$/.test(inputValue)) {
|
|
|
+ if (/^-?[1-9a-zA-Z]{1,}\d*$/.test(inputValue)) {
|
|
|
// 判断当前楼层是否可以转换为数值类型
|
|
|
- if (!isNaN(parseFloat(inputValue)) && isFinite(inputValue)) {
|
|
|
+ if (
|
|
|
+ !isNaN(parseFloat(inputValue)) &&
|
|
|
+ isFinite(inputValue) &&
|
|
|
+ Number(inputValue) > 0
|
|
|
+ ) {
|
|
|
for (let i = currentIndex + 1; i < this.tableData.length; i++) {
|
|
|
this.tableData[i].actualityFloor = String(
|
|
|
Number(inputValue) + i - currentIndex
|
|
@@ -120,7 +124,7 @@ export default {
|
|
|
async submit() {
|
|
|
const currentIndex = this.currentIndex;
|
|
|
const inputValue = this.tableData[currentIndex].actualityFloor;
|
|
|
- if (/^[a-zA-Z0-9]+$/.test(inputValue)) {
|
|
|
+ if (/^-?[1-9a-zA-Z]{1,}\d*$/.test(inputValue)) {
|
|
|
} else {
|
|
|
this.$message.error("实际楼层只能为整数或英文字母组合,请重新输入");
|
|
|
return;
|