//提交处罚完整内容
function submitPunish(){
//1、获取需要提交的内容 项目id 表格行id 处罚对象id 处罚方式id
projectId = $("#punishProjectId").val();
var rowId = $("#warningTable").datagrid("getSelected").id;//alertId
var punishUlLength = $("#punish>ul").length;
//2、循环有多少个处罚$("#punish>ul").length;
var handler = "[";
var objectsId = "";
var objectsName = "";
for(var i = 0 ; i <punishUlLength ; i++){
var remark = $("#punish .punishUl"+i+">.punishRemark"+i+" textarea").val();
var punishWayId = $("#punish .punishUl"+i+" .dealWay"+i+" option:selected").attr("value");
return false;
var punishMoney = $(".punishMoney"+i+" input").val();
var punishLiLength = $("#punish>.punishUl"+i+">.punishObjects"+i+">ul").length;
//3、循环每个处罚对象里面有多少个处罚对象$("#punish>.punishUl"+i+">.punishObjects"+i+">ul").length;
for(var j = 0;j <punishLiLength ; j++ ){
alert("每个处罚对象里面有多少个处罚对象:"+punishLiLength);
var objectId =$("#punish>.punishUl"+i+">.punishObjects"+i+">ul").eq(j).find("input[type='hidden']").val();
var objectName =$("#punish>.punishUl"+i+">.punishObjects"+i+">ul").eq(j).find("input[type='hidden']").next().html();
alert("处罚对象id:"+objectId + "对象名称:"+objectName);
objectsId = objectsId + objectId + ",";
objectsName = objectName + ","+ objectsName;
console.log("所有处罚对象id:"+objectsId);
console.log("所有处罚对象名称:"+objectsName);
}
objectsName = objectsName.substr(0, objectsName.length - 1);
objectsId = objectsId.substr(0, objectsId.length - 1);
handler += '{"projectId":"' + projectId + '","pbraName":"' + objectsName + '","pbraId":"'+ objectsId + '","category":"'+ punishWayId + '","alertId":"'+ rowId + '","description":"'+ remark + '","result":"'+punishMoney+'"},';
console.log("处罚数据:"+handler);
}
handler = handler.substr(0, handler.length - 1);
handler += "]";
//2、将所选对象传给后台
$.ajax({
url:"warning/addhandle",
type:"post",
dataType:"json",
data:{
"handler":handler
},
success:function(data){
if(data === true){
$.messager.alert("温馨提示","已处理!");
setSelected("dealState","05");
/*$("#dealWin").window("close");*/
}
}
});
}