车辆公里数正数问题修改

This commit is contained in:
syruan 2025-03-11 16:50:15 +08:00
parent c18052de45
commit ee6e8d65e0
3 changed files with 25 additions and 25 deletions

View File

@ -53,7 +53,7 @@ function addTableTrData(cjId, item) {
}
}
let html = '';
let num = $('.transVehiclesTr' + cjId).length;;
let num = $('.transVehiclesTr' + cjId).length;
html += "<tr class='transVehiclesTr" + cjId + "' dataId = '" + dataId + "'>";
html += '<td><input onclick="sel2(this.checked,this,' + cjId + ')" name="check' + cjId + '" type="checkbox"></td>';
html += "<td style='vertical-align:middle;' class='center hidden-480'>"
@ -86,10 +86,10 @@ function checkValue2(that, type) {
let value = $(that).val();
if (type === 1) { // 公里数1
const regex = /^\s*\d+\s*$/;
if (!regex.test(value) && value) {
$(that).val('');
return layer.msg('公里数只能输入正整数,请重新输入!', { icon: 5 })
}
// if (!regex.test(value) && value) {
// $(that).val('');
// return layer.msg('公里数只能输入正整数,请重新输入!', { icon: 5 })
// }
let index = $(that).parents('td').prev().html();
if (index === '1' && value !== '0') { // 第一行数据必须从0开始
$(that).val('0');
@ -108,10 +108,10 @@ function checkValue2(that, type) {
}
} else if (type === 2) { // 公里数2
const regex = /^\s*\d+\s*$/;
if (!regex.test(value) && value) {
$(that).val('');
return layer.msg('公里数只能输入正整数,请重新输入!', { icon: 5 })
}
// if (!regex.test(value) && value) {
// $(that).val('');
// return layer.msg('公里数只能输入正整数,请重新输入!', { icon: 5 })
// }
let index = $(that).parents('td').prev().html();
let num = $(that).prev().prev().val();
if (!num) {

View File

@ -81,10 +81,10 @@ function checkValue2(that, type) {
let value = $(that).val();
if (type === 1) { // 公里数1
const regex = /^\s*\d+\s*$/;
if (!regex.test(value) && value) {
$(that).val('');
return layer.msg('公里数只能输入正整数,请重新输入!', { icon: 5 })
}
// if (!regex.test(value) && value) {
// $(that).val('');
// return layer.msg('公里数只能输入正整数,请重新输入!', { icon: 5 })
// }
let index = $(that).parents('td').prev().html();
if (index === '1' && value !== '0') { // 第一行数据必须从0开始
$(that).val('0');
@ -103,10 +103,10 @@ function checkValue2(that, type) {
}
} else if (type === 2) { // 公里数2
const regex = /^\s*\d+\s*$/;
if (!regex.test(value) && value) {
$(that).val('');
return layer.msg('公里数只能输入正整数,请重新输入!', { icon: 5 })
}
// if (!regex.test(value) && value) {
// $(that).val('');
// return layer.msg('公里数只能输入正整数,请重新输入!', { icon: 5 })
// }
let index = $(that).parents('td').prev().html();
let num = $(that).prev().prev().val();
if (!num) {

View File

@ -85,10 +85,10 @@ function checkValue(that, type, isFirst) {
}
if (type === 1) { // 公里数1
const regex = /^\s*\d+\s*$/;
if (!regex.test(value) && value) {
$(that).val('');
return layer.msg('公里数只能输入正整数,请重新输入!', { icon: 5 })
}
// if (!regex.test(value) && value) {
// $(that).val('');
// return layer.msg('公里数只能输入正整数,请重新输入!', { icon: 5 })
// }
if (isFirst === 1 && value !== '0') { // 第一行数据必须从0开始
$(that).val('0');
return layer.msg('第一行前置公里数只能从0开始!', { icon: 5 })
@ -106,10 +106,10 @@ function checkValue(that, type, isFirst) {
}
} else if (type === 2) { // 公里数2
const regex = /^\s*\d+\s*$/;
if (!regex.test(value) && value) {
$(that).val('');
return layer.msg('公里数只能输入正整数,请重新输入!', { icon: 5 })
}
// if (!regex.test(value) && value) {
// $(that).val('');
// return layer.msg('公里数只能输入正整数,请重新输入!', { icon: 5 })
// }
let num = $(that).prev().prev().val();
if (!num) {
$(that).val('');