function addIframeData(){
var str="[";
$(window.frames["dialog-modal-iframe"].document).find("input[type='checkbox'][checked]").each(function(){
str+=$(this).val()+",";
})
if(str.indexOf(",")!=-1)
str=str.substring(0,str.length-1);
str+="]";
var yjTable_tr= $("#yjTable tr");
var addindex=yjTable_tr.length-1;
$.each(eval('('+str+')'),function(idx,item){
// alert($("#yjTable").data(item.yjbh+item.ph));
if($("#yjTable").data(item.yjbh+item.ph)==null){
$("#yjTable").data(item.yjbh+item.ph, "key");
$("#yjTable").append('<tr>'
+'<td align="center"><input type="hidden" name="yjbsd.yjbsdSet.makeNew['+addindex+'].bsdh" >'
+'<input type="text" name="yjbsd.yjbsdSet.makeNew['+addindex+'].xh" value="'+(addindex+1)+'" class="text" size=5 readOnly="true"/></td>'
+'<td align="center"><input type="text" name="yjbsd.yjbsdSet.makeNew['+addindex+'].yjbmb.yjbh" value="'+item.yjbh+'" class="text" size=15 readOnly="true"/></td>'
+'<td align="center"><input type="text" value="'+item.yjmc+'" class="text" size=15 readOnly="true"/></td>'
+'<td align="center"><input type="text" name="yjbsd.yjbsdSet.makeNew['+addindex+'].ph" value="'+item.ph+'" class="text" size=10/></td>'
+'<td align="center"><input type="text" name="yjbsd.yjbsdSet.makeNew['+addindex+'].yxrq" value="'+item.yxq+'" class="text" size=12 οnclick= WdatePicker({dateFmt:"yyyy-MM-dd",qsEnabled:true,quickSel:["2000-10-01","%y-%M-01","%y-%M-%ld"]}) /></td>'
+'<td align="center"><input type="text" name="yjbsd.yjbsdSet.makeNew['+addindex+'].dj" value="'+item.dj+'" class="text" size=8/></td>'
+'<td align="center"><input type="text" name="yjbsd.yjbsdSet.makeNew['+addindex+'].dw" value="'+item.dw+'" class="text" size=4 /></td>'
+'<td align="center"><input type="text" name="yjbsd.yjbsdSet.makeNew['+addindex+'].bsyy" value="" class="text" size=30/></td>'
+'<td align="center"><input type="text" name="yjbsd.yjbsdSet.makeNew['+addindex+'].sl" value="'+item.kcsl+'" class="text" size=15/></td>'
+'<td align="center"><input type="button" value="删除" οnclick="deleteRow(this)"/></td>'
+'</tr>');
addindex++;
}
});
}
function deleteRow(obj){
var trObj=$(obj).parent().parent();
var tablelength= $("#yjTable tr").length;
var delIndex=trObj.index("#yjTable tr")+1;
//$("#yjTable").data(trObj.find("input[name*=yjbh]").val()+trObj.find("input[name*=ph]").val(), null);
$("#yjTable").removeData(trObj.find("input[name*=yjbh]").val());
for(var i=delIndex;i<tablelength;i++){
$("#yjTable tr").eq(i).find("input[type=text]").each(function(idx){
if($(this).attr("name")==('yjbsd.yjbsdSet.makeNew['+(i-1)+'].xh'))
$(this).val($(this).val()-1);
$(this).attr("name", $(this).attr("name").replace("makeNew["+(i-1)+"]","makeNew["+(i-2)+"]"));
})
}
trObj.empty().remove();
}
研究
最新推荐文章于 2024-07-01 13:56:17 发布