$(function(){var t=$.trim($("#cid").val()),e=$("#tablelist").removeAttr("width").DataTable({columnDefs:[{className:"allwidth1",width:150,targets:[0,2]},{className:"allwidth2",width:200,targets:1},{className:"allwidth3",width:100,targets:"_all"}],fixedColumns:{leftColumns:4}});if(""!=$("#changelist").val()){var l=$("#changelist").val().split(",");$.each(l,function(e,l){var i=l.split("_");localStorage.setItem("update_"+t+"_clistid_"+i[0],i[1])})}if(""!=$("#changewhitelist").val()){var i=$("#changewhitelist").val().split(",");$.each(i,function(e,l){var i=l.split("->");localStorage.setItem("update_"+t+"_new_clistid_"+i[0],i[1])})}$(".addlistbtn").on("click",function(){var l=$("#changedecimalnum").val().split("_"),i=l[0],a=makedecimalzero(l[1]),s=makedecimalzero(i),r="",n=new Array,d=new Array;$(".checklist").find(".listcheckbox").each(function(){if($(this).prop("checked")){var e=$(this).parents(".checklist").children("td").eq(0).attr("list_id"),o=$(this).parents(".checklist").children("td").eq(1).text(),c=$(this).parents(".checklist").children("td").eq(2).text(),u=$(this).parents(".checklist").children("td").eq(3).text(),m=$(this).parents(".checklist").children("td").eq(4).text(),p=$(this).parents(".checklist").children("td").eq(5).text(),h=$(this).parents(".checklist").children("td").eq(6).text(),v=0,f=0;localStorage.hasOwnProperty("update_"+t+"_clistid_"+e)?(v=localStorage.getItem("update_"+t+"_clistid_"+e),f=roundnum(parseFloat(m).mul(parseFloat(v)),i),n.push(e+"_"+v)):(v=a,localStorage.setItem("update_"+t+"_clistid_"+e,a),n.push(e+"_"+a)),d.push(e),f=0!=parseFloat(f)?roundnum(f,i):s,r+='
| '+o+' | '+c+' | '+u+' | '+m+' | '+p+' | '+h+' | | '+f+" |
"}}),$("#changelist").val(n.join(",")),$("#reductionList").val(d.join(","));for(var o=1,c=new Array,u=window.localStorage,m=20+t.toString().length,p=0;p"+w.join(";"));for(var I=""!=q&&""!=F?roundnum(parseFloat(q).mul(parseFloat(F)),2):"",N=""!=q&&""!=b?roundnum(parseFloat(q).mul(parseFloat(b)),i):"",S="",A=0;A'+g[A]+"":"";r+=' | | | | | '+I+' | | '+N+" |
"}}if($("#changewhitelist").val(f.join(",")),$(this).hasClass("btn-default")){var R="";for(A=0;A"+g[A]+"";var j=' | | | | | '+s+' | | '+s+" |
";r+=j}e.destroy(),$("#list").html(r),e=$("#tablelist").removeAttr("width").DataTable({columnDefs:[{className:"allwidth1",width:150,targets:[0,2]},{className:"allwidth2",width:200,targets:1},{className:"allwidth3",width:100,targets:"_all"}],fixedColumns:{leftColumns:4}}),totalamount(i),$("#addlist").modal("hide")}),$("body").on("valuechange",".clist input",function(e,l){var i=$("#changedecimalnum").val().split("_")[0],a=$(this).parents("td").attr("sortnum");if(6==a){var s=$(this).val(),r=$(this).parents(".clist").children("td").eq(3).text()||$(this).parents(".clist").children("td").eq(3).children("input").val(),n=""!=$.trim(s)&&""!=$.trim(r)?roundnum(parseFloat(r).mul(parseFloat(s)),i):"";$(this).parents(".clist").children("td").eq(7).text(n)}else if(3==a){r=$(this).val();var d=$(this).parents("tr").attr("newlist_tid");(h=$('#list tr[newlist_tid="'+d+'"]')).children("td").eq(a).children("input").val(r);var o=h.children("td").eq(4).children("input").val(),c=(s=h.children("td").eq(6).children("input").val(),""!=$.trim(o)&&""!=$.trim(r)?roundnum(parseFloat(r).mul(parseFloat(o)),2):"");n=""!=$.trim(s)&&""!=$.trim(r)?roundnum(parseFloat(r).mul(parseFloat(s)),i):"";h.children("td").eq(5).text(c),h.children("td").eq(7).text(n)}else if(4==a){o=$(this).val(),r=$(this).parents(".clist").children("td").eq(3).children("input").val(),c=""!=$.trim(o)&&""!=$.trim(r)?roundnum(parseFloat(r).mul(parseFloat(o)),2):"";$(this).parents(".clist").children("td").eq(5).text(c)}else{d=$(this).parents("tr").attr("newlist_tid");(h=$('#list tr[newlist_tid="'+d+'"]')).children("td").eq(a).children("input").val($(this).val())}if(totalamount(i),$(this).parents(".clist").hasClass("clid")){var u=$(this).parents(".clist").attr("list_id");if(""!=$.trim($(this).val())){localStorage.setItem("update_"+t+"_clistid_"+u,$.trim($(this).val()));var m=$.trim($(this).val());updatelist(u,m)}else localStorage.removeItem("update_"+t+"_clistid_"+u),removelist(u)}else{var p=$(this).parents(".clist").attr("newlist_tid"),h=$('#list tr[newlist_tid="'+p+'"]'),v=updateandgetwhitelist(p,h);localStorage.setItem("update_"+t+"_new_clistid_"+p,v)}}),$("body").on("change",".clist select",function(){var e=$(this).parents(".clist").attr("newlist_tid"),l=$('#list tr[newlist_tid="'+e+'"]');l.children("td").eq(2).children("select").val($(this).val());var i=updateandgetwhitelist(e,l);localStorage.setItem("update_"+t+"_new_clistid_"+e,i)}),$("#setdnum").click(function(){if(/^[0-6]$/.test(parseInt($("#costdnum").val()))&&/^[0-6]$/.test(parseInt($("#numberdnum").val()))){var t=parseInt($("#costdnum").val()),e=parseInt($("#numberdnum").val());decimalnumsetmodal(t,e,"update")}else toastr.error("请输入范围内正确的位数要求")})});var updateflag=0,cid=$.trim($("#cid").val());function checkform(){if(""==$.trim($("#pnum").val())){var t=0==updateflag?"至少":"";return toastr.error("请"+t+"输入申请编号"),!1}if(""==$("#pname").val()){t=0==updateflag?"至少":"";return toastr.error("请"+t+"输入工程名称"),!1}if(1==updateflag){if(""==$("#description").val())return toastr.error("请输入工程变更理由及内容"),!1;if(""==$("#changelist").val()&&""==$("#changewhitelist").val())return toastr.error("请至少添加一项变更清单或空白清单"),!1;if(""!=$("#changelist").val()||$("#list .clid").length/2!=0){var e=$("#list .clid").length/2;if(""==$("#changelist").val()||$("#changelist").val().split(",").length!=e)return toastr.error("请输入所有所需变更的签约清单的申报变更数量"),!1}if(""!=$("#changewhitelist").val()){var l=$("#changewhitelist").val().split(","),i=0,a=0,s="";if($.each(l,function(t,e){var l=e.split("->")[1].split(";");if(1==i)return!1;$.each(l,function(e,r){if(""==r&&2!=e)return i=1,a=t+1,s=l[0],!1})}),i){var r=a+$("#list .clid").length/2;return toastr.error("变更清单第"+r+"行,清单编号为:"+s+" 存在未填写的内容,请填写完整。若不需要此空白清单请把整行填写过的内容清除"),!1}}if(""==$("#changeaudit").val())return toastr.error("请添加审批人"),!1;for(var n=new Array,d=window.localStorage,o=cid.toString().length,c=0;c