From 66dcd16ea3b1df99bd5b765ad6eb085fddfbaf5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=A3=E5=9C=A3=E5=8D=8E?= <752718920@qq.com> Date: Thu, 18 Jun 2020 23:16:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=8D=95=E6=8D=AE=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E6=96=B0=E5=A2=9E=E8=B4=A6=E6=88=B7=E5=92=8C=E4=BB=93?= =?UTF-8?q?=E5=BA=93=E7=9A=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- erp_web/js/pages/materials/add_temp.js | 45 +++++++++++++++----------- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/erp_web/js/pages/materials/add_temp.js b/erp_web/js/pages/materials/add_temp.js index 3268b7d1..ed865e0e 100644 --- a/erp_web/js/pages/materials/add_temp.js +++ b/erp_web/js/pages/materials/add_temp.js @@ -50,7 +50,7 @@ $.get("../../pages/template/base.html?7891", function(tem) { collapsible: false, closable: true }); - $("#depotDlg #name,#depotDlg #address").textbox({ + $("#depotDlg #name").textbox({ required: true, validType: 'length[2,30]' }); @@ -232,6 +232,9 @@ function bindDepotEvent() { return flag; } $("#saveDepot").off("click").on("click", function () { + if(!$('#depotFM').form('validate')){ + return; + } var infoObj = $("#depotFM").serializeObject(); infoObj.type = 0; if (checkDepotName()) { @@ -300,24 +303,28 @@ function bindAccountEvent() { if (checkAccountName()) { return; } - $.ajax({ - url: '/account/add', - type: "post", - dataType: "json", - data: ({ - info: JSON.stringify($("#accountFM").serializeObject()) - }), - success: function(res) { - if(res && res.code === 200) { - $('#accountDlg').dialog('close'); - initSystemData_account(); //刷新账户 + if(!$('#accountFM').form('validate')){ + return; + } else { + $.ajax({ + url: '/account/add', + type: "post", + dataType: "json", + data: ({ + info: JSON.stringify($("#accountFM").serializeObject()) + }), + success: function(res) { + if(res && res.code === 200) { + $('#accountDlg').dialog('close'); + initSystemData_account(); //刷新账户 + } + }, + //此处添加错误处理 + error: function () { + $.messager.alert('提示', '保存结算账户异常,请稍后再试!', 'error'); + return; } - }, - //此处添加错误处理 - error: function () { - $.messager.alert('提示', '保存结算账户异常,请稍后再试!', 'error'); - return; - } - }); + }); + } }); } \ No newline at end of file