1.函数调用方式:
常用调用方式:函数名(【参数列表】)
2.函数式调用方法:
function A(a,b){
return a+b;
}
var a = A(a,b);
console.log(a);
3.对象序列化
对象转字符串
JSON.stringify(object)
字符串转对象
JSON.parse(JSONStr)
4.Jquery选择器
function doSubmit(){
var result = true;
$("#form input[name^='tyZjNotice108']").each(function(){
if(($(this).val() == null || $(this).val().trim() == "") && $(this).attr("type") != "hidden" && $(this).attr("type") != "file"){
if($(this).attr("nameValue") != null && $(this).attr("nameValue") != ""){
alert($(this).attr("nameValue"));
$(this).focus();
result = false;
return false;
}
}
});
if(!result){
return false;
}
var result2 = true;
$("#form textarea[name^='tyZjNotice108']").each(function(){
if($(this).val() == null || $(this).val().trim() == ""){
if($(this).attr("nameValue") != null && $(this).attr("nameValue") != ""){
alert($(this).attr("nameValue"));
$(this).focus();
result2 = false;
return false;
}
}
});
if(!result2){
return false;
}
var resultA = true;
$("#form input[name^='tyZjNoticeItemLA'],select[name^='tyZjNoticeItemLA']").each(function(){
var nameNew = $(this).attr("name");
if($(this).attr("type") != "hidden" && !$(this).prop("disabled")){
if($(this).val() == null || $(this).val().trim() == ""){
if(nameNew.indexOf("surveys") == -1 && nameNew.indexOf("jnhbzsbh") == -1 && nameNew.indexOf("jnhbzsEndTime") == -1 && nameNew.indexOf("hbzsbh") == -1 && nameNew.indexOf("hbzsEndTime") == -1 ){
alert("请完善标的信息!");
$(this).focus();
resultA = false;
return false;
}
}
if(nameNew.indexOf("flagJnhb") > 0){
if($(this).val() == "1"){
var num = $(this).attr("num");
var selector = "input[name='tyZjNoticeItemLA[" + num + "].jnhbzsbh']";
var jnhbzsVal = $(selector).val();
var jnhbEndTime = $("input[name='tyZjNoticeItemLA["+num+"].jnhbzsEndTime']").val();
if(jnhbzsVal == null || jnhbzsVal == ""){
alert("请完节能产品认证证书编号的信息!");
resultA = false;
return false;
}
if(jnhbEndTime == null || jnhbEndTime == ""){
alert("请完节能产品认证证书有效截止期的信息!");
resultA = false;
return false;
}
}
}
if(nameNew.indexOf("flagHb") > 0){
if($(this).val() == "1"){
var num = $(this).attr("num");
var hbzsVal = $("input[name='tyZjNoticeItemLA["+num+"].hbzsbh']").val();
var hbEndTime = $("input[name='tyZjNoticeItemLA["+num+"].hbzsEndTime']").val();
if(hbzsVal == null || hbzsVal == ""){
alert("请完环境标志产品认证证书编号的信息!");
resultA = false;
return false;
}
if(hbEndTime == null || hbEndTime == ""){
alert("请完环境标志产品认证证书有效截止期的信息");
resultA = false;
return false;
}
}
}
}
});
if(!resultA){
return false;
}
var resultB = true;
$("#form input[name^='tyZjNoticeItemLB']").each(function(){
var nameNew = $(this).attr("name");
if($(this).attr("type") != "hidden"){
if($(this).val() == null || $(this).val().trim() == ""){
alert("请完善标的信息!");
$(this).focus();
resultB = false;
return false;
}
}
});
if(!resultB){
return false;
}
var resultC = true;
$("#form input[name^='tyZjNoticeItemLC']").each(function(){
var nameNew = $(this).attr("name");
if($(this).attr("type") != "hidden"){
if($(this).val() == null || $(this).val().trim() == "" ){
alert("请完善标的信息!");
$(this).focus();
resultC = false;
return false;
}
}
});
if(!resultC){
return false;
}
var result5 = true;
$("#form input[name^='tyZjNotice108WinL']").each(function(){
if($(this).attr("type") != "hidden"){
if($(this).val() == null || $(this).val().trim() == ""){
$(this).focus();
result5 = false;
return false;
}
}
});
if(!result5){
alert("请填写中标供应商信息!");
return false;
}
// 评审得分排名必填校验
let ratingFalg = checkRating();
if (!ratingFalg) {
return false;
}
if(checkTime()){
return false;
}
var op = "save";
var page = "2";
var dataJson = {page:page,op:op,expertIds:fileIds,isDisable:isDisable};
$("#form input,select").each(function(){
dataJson[$(this).attr("name")] = $(this).val();
});
$("#form textarea").each(function(){
dataJson[$(this).attr("name")] = $(this).val();
});
let index = 0;
$("table[id='tyZjNotice108Score']").find("tr[class='addRow']").each(function () {
$(this).find("td").find("input").each(function () {
let name = $(this).attr("name");
let val = $(this).val();
dataJson["tyZjNoticeRatingList[" + index + "]."+name+""] = val;
});
index++;
});
var filesArr = new Array();
var num1 = 0;
$("input[name='files']").each(function(){
var id = "#" + $(this).attr("id");
if($(id).css("display") != 'none'){
filesArr[num1] = $(this).attr("id");
num1 = num1 + 1;
}
});
$("input[name='files2']").each(function(){
var id = "#" + $(this).attr("id");
if($(id).css("display") != 'none'){
filesArr[num1] = $(this).attr("id");
num1 = num1 + 1;
}
});
$("input[name='files3']").each(function(){
var id = "#" + $(this).attr("id");
if($(id).css("display") != 'none'){
filesArr[num1] = $(this).attr("id");
num1 = num1 + 1;
}
});
$("input[name='files4']").each(function(){
var id = "#" + $(this).attr("id");
if($(id).css("display") != 'none'){
filesArr[num1] = $(this).attr("id");
num1 = num1 + 1;
}
});
$("input[name='files5']").each(function(){
var id = "#" + $(this).attr("id");
if($(id).css("display") != 'none'){
filesArr[num1] = $(this).attr("id");
num1 = num1 + 1;
}
});
a.progressOn();
var url="<%=basePath%>tszy/NoticeTemplate_doSave.do";
$.ajaxFileUpload({
url : url,
type : 'post',
data :dataJson,
secureuri : false, //一般设置为false
fileElementId : filesArr ,// 上传文件控件的id
dataType : 'js', //返回值类型,一般设置为json、application/json
success : function(data, status) {
if(data == "no") {
alert("提交采购人确认失败!");
a.progressOff();
}else if(data == "noSection") {
alert("请完善标段信息!");
a.progressOff();
return false;
} else {
var mgcRes = doCheckContentMgc();
if(mgcRes == "No") {
alert("发布失败!");
onLoadNext();//调用刷新方法
}else if(mgcRes == "NoContent") {
alert("发布失败,未取到公告内容!");
onLoadNext();//调用刷新方法
}else if(mgcRes == "errCheckMgc") {
alert("系统异常!");
onLoadNext();//调用刷新方法
}else if(mgcRes.indexOf("CHECK_GGCGFS") > -1) {
var mgcResArr = mgcRes.split("@");
layer.confirm("<p style='font-size: 18px;'>"+mgcResArr[1]+"提交采购人确认?</p>", {
btn: ['确定', '取消'],
skin: 'layui-layer-lan',//蓝色外框皮肤
title: "<img alt='' src='<%=basePath%>images/tz.png' class='imgcss' /> <span class='fontP'>提示</span>",
cancel: function(index, layero){
layer.close(layer.index);
onLoadNext();//调用刷新方法
}
},function(index){
layer.close(layer.index);
creatWindow();
},function(){
onLoadNext();//调用刷新方法
});
}else if(mgcRes == "Yes") {
creatWindow();
}else{
alert(mgcRes);
onLoadNext();
}
}
},
error:function(state) {
alert("系统异常");
a.progressOff();
}
});
}