增加如果有备注,就必须填写才能提交

Change-Id: Ifca252c770685ddafe536f11c9501f1ecc671872
This commit is contained in:
vguanyiwgd 2024-04-09 16:07:31 +08:00
parent 88f78c9db1
commit 1b09bcbf64
1 changed files with 16 additions and 0 deletions

View File

@ -10624,6 +10624,7 @@ $(function () {
$(page).on('click', '.xhl', function () { $(page).on('click', '.xhl', function () {
if (!$(this).hasClass('btnDisabled')) { if (!$(this).hasClass('btnDisabled')) {
var notesObj = {}; var notesObj = {};
var is_notes = 1;
$("input[class*='notes']").each(function() { $("input[class*='notes']").each(function() {
// 获取类名并尝试匹配正则表达式以提取 date_id // 获取类名并尝试匹配正则表达式以提取 date_id
var className = $(this).attr("class"); var className = $(this).attr("class");
@ -10631,9 +10632,16 @@ $(function () {
if (match) { if (match) {
var dateId = match[1]; var dateId = match[1];
var text = $(this).val(); // 获取placeholder文本 var text = $(this).val(); // 获取placeholder文本
if(text === ''){
is_notes = 0;
}
notesObj[dateId] = $.trim(text); // 创建对象,使用 date_id 作为键placeholder文本作为值 notesObj[dateId] = $.trim(text); // 创建对象,使用 date_id 作为键placeholder文本作为值
} }
}); });
if(is_notes == 0){
$.alert('请先填写备注');
return;
}
$.showIndicator(); $.showIndicator();
var token = user.token; var token = user.token;
$.ajax({ $.ajax({
@ -10749,6 +10757,7 @@ $(function () {
$(page).on('click', '.order_yzf', function () { $(page).on('click', '.order_yzf', function () {
if (!$(this).hasClass('btnDisabled')) { if (!$(this).hasClass('btnDisabled')) {
var notesObj = {}; var notesObj = {};
var is_notes = 1;
$("input[class*='notes']").each(function() { $("input[class*='notes']").each(function() {
// 获取类名并尝试匹配正则表达式以提取 date_id // 获取类名并尝试匹配正则表达式以提取 date_id
var className = $(this).attr("class"); var className = $(this).attr("class");
@ -10756,9 +10765,16 @@ $(function () {
if (match) { if (match) {
var dateId = match[1]; var dateId = match[1];
var text = $(this).val(); // 获取placeholder文本 var text = $(this).val(); // 获取placeholder文本
if(text === ''){
is_notes = 0;
}
notesObj[dateId] = $.trim(text); // 创建对象,使用 date_id 作为键placeholder文本作为值 notesObj[dateId] = $.trim(text); // 创建对象,使用 date_id 作为键placeholder文本作为值
} }
}); });
if(is_notes == 0){
$.alert('请先填写备注');
return;
}
$.showIndicator(); $.showIndicator();
var token = user.token; var token = user.token;
$.ajax({ $.ajax({