$(function () { $("#form-landApply-edit").validate({ rules: { "companyInfo.industry_code" :{ required : true }, "companyInfo.registration_address" :{ required : true }, "companyInfo.contact" :{ required : true }, "companyInfo.contact_phone" :{ required : true, isTel : true } }, messages: { }, onkeyup: false, focusCleanup: true, success: "valid" /*submitHandler: function (form) { // $(form).find(":submit").attr("disabled", true); if(!($("#isDraft").val()==1)){ var validateFile = true; $("#applyMaterials").find(".uploadFileName").each(function(){ if($(this).val()==""){ errorMessage('请上传所有基准材料!'); validateFile = false; } }); if(validateFile){ if($("#summaryProcedureType").find("input:checked").length>0){ //简易程序材料必填 $("#summaryMaterials").find(".uploadFileName").each(function(){ if($(this).val()==""){ errorMessage('请上传所有简易程序相关材料!'); validateFile = false; } }); } } if(validateFile){ if($("#otherMaterials").find(".td_material").length>1){ //已经添加材料,不能有空行 $("#otherMaterials").find(".uploadFileName").each(function(){ if($(this).val()==""){ errorMessage('请上传所有其他材料!'); validateFile = false; } }); } } if(!validateFile){ return false; } } setDocName(); $("#deleteMaterialIds").val(deleteMaterialIds); $(form).ajaxSubmit({ type: 'post', url: pagePath + "/stockLand/applySave", dataType: "json", success: function (data) { if (data.success) { succeedMessage(data.message); setTimeClose(); } else { // $(form).find(":submit").attr("disabled", false); errorMessage(data.message); } }, error: function () { errorMessage('系统错误!'); } }); return false; // 非常重要,如果是false,则表明是不跳转,在本页上处理,也就是ajax,如果是非false,则传统的form跳转。 }*/ }); }); //添加文件 function addFile(title,url,w,h,obj){ var fileName = $(obj).val(); if(fileName!=""){ errorMessage('请先点击右侧按钮删除文件,再重新添加!'); }else{ layer_show(title,pagePath+url,w,h); } } function changeType(obj){ var type = $(obj).val(); var url = pagePath+"/stockLand/add/"+type; location.replace(url); } //添加相应name的文件 function addFileByName(url,obj){ var name = $(obj).next().attr("name"); url += "?fileIdName="+name; layer_show('添加文件',pagePath+url,800,350); } function saveDraft(isSaveDraft) { $("#isDraft").val(isSaveDraft); // $(form).find(":submit").attr("disabled", true); if(!($("#isDraft").val()==1)){ if(!$("#form-landApply-edit").valid()){ return false; } var validateFile = true; $("#applyMaterials").find(".uploadFileName").each(function(){ if($(this).val()==""){ errorMessage('请上传所有基准材料!'); validateFile = false; } }); if(validateFile){ if($("#summaryProcedureType").find("input:checked").length>0){ //简易程序材料必填 $("#summaryMaterials").find(".uploadFileName").each(function(){ if($(this).val()==""){ errorMessage('请上传所有简易程序相关材料!'); validateFile = false; } }); } } if(validateFile){ if($("#otherMaterials").find(".td_material").length>1){ //已经添加材料,不能有空行 $("#otherMaterials").find(".uploadFileName").each(function(){ if($(this).val()==""){ errorMessage('请上传所有其他材料!'); validateFile = false; } }); } } if(!validateFile){ return false; } } setDocName(); $("#deleteMaterialIds").val(deleteMaterialIds); $("#form-landApply-edit").ajaxSubmit({ type: 'post', url: pagePath + "/stockLand/applySave", dataType: "json", success: function (data) { if (data.success) { succeedMessage(data.message); setTimeClose(); } else { // $(form).find(":submit").attr("disabled", false); errorMessage(data.message); } }, error: function () { errorMessage('系统错误!'); } }); return false; // 非常重要,如果是false,则表明是不跳转,在本页上处理,也就是ajax,如果是非false,则传统的form跳转。 } //弹出框 function open_dialog(title, url, w, h) { var index = layer_show(title, pagePath + url, w, h); layer.full(index); }