var locat = (window.location+'').split('/'); $(function(){if('fhsms'== locat[3]){locat = locat[0]+'//'+locat[2];}else{locat = locat[0]+'//'+locat[2]+'/'+locat[3];};}); $(getTop(globalThis).hangge()); var pd_TABLETYPE = $('#pd_TABLETYPE').html(); var pd_COMPANY = $('#pd_COMPANY').html(); var pd_COMPANY_ID = $('#pd_COMPANY_ID').html(); var pd_YEAR = $('#pd_YEAR').html(); var editflag = 0; var recordData = new Object(); var recordBeforeValue = new Object(); var status = $('.edittr:eq(0) >td >input[name="STATUS"]').val(); var currStatus = status; var rocordInfoList = new Object(); function tableInit(){ //行内小计列 //setRowSumCell(e); //小计行的总计列 var totalcells = $('.totaltr').find('.sumCell'); for(var i=0; itd').length; var recordcount = $('.edittr').length; for(var i=0; itd >.'+data.rocordInfoList[e].TABLE_FIELDS).addClass("highlight " + e); } } }); } function highlightInit(){ $('.editInput').off("mouseover mouseout").on("mouseover mouseout",function(event){ if($(this).attr('class').split(' ').length > 2){ if(event.type == "mouseover"){ var indexClass = $(this).attr('class').split(' ')[3]; var before = rocordInfoList[indexClass].BEFORE_VAL; var after = rocordInfoList[indexClass].AFTER; $(this).parent().append('
'+before+'--'+after+'
'); }else if(event.type == "mouseout"){ $("#recordInfoDiv").remove(); } } }); } //function excelExport(){ // window.location.href=locat+'/annualDailyComp/exportDoc.do?modelName=311_highway_scientific_project_dettable.ftl&COMPANY_ID=001&YEAR=2018&ROAD_ID=111&TABLETYPE=highway_scientific_project_dettable'; //} function excelExport(){ var arry = []; $('.edittr:eq(0)>td>input').each(function(index,e){ var n = $(e).attr('name'); if(n!='SERIAL_NUM'&&n!='STATUS'&&n!='COMPANY'&&n!='YEAR'&&n!='COMPANY_ID'&&n!='ROAD_ID'){ var key = $(e).attr('name'); arry.push(key); } }); var keyStr = arry.join(','); window.location.href=locat+'/annualDailyComp/export.do?TABLETYPE='+pd_TABLETYPE+'&COMPANY_ID='+pd_COMPANY_ID+'&YEAR='+pd_YEAR+'&keyStr='+keyStr; } $(function(){ // importInit(); tableInit(); highlightInit(); }); function setTrPercentCell(tr){ $(tr).find("td>.percentCell").each(function(index,e){ if(e.tagName == "INPUT"){ var num1 = $(tr).find("td>."+$(e).attr("num1")).val(); var num2 = $(tr).find("td>."+$(e).attr("num2")).val(); var result = percentage(num1, num2); $(e).val(result); }else if(e.tagName == "SPAN"){ var num1 = $(tr).find("td>."+$(e).attr("num1")).html(); var num2 = $(tr).find("td>."+$(e).attr("num2")).html(); var result = percentage(num1, num2); $(e).html(result); } }); } function percentage(num1, num2){ var percent = ""; if(!isNaN(Number(num1)) && !isNaN(Number(num2)) && Number(num2) != "0" ) // percent = Math.round(Number(num1) / Number(num2) * 10000) / 100.00 + "%"; percent = Math.round(Number(num1) / Number(num2) * 100); return percent; } //function fileType(obj){ // var fileType=obj.value.substr(obj.value.lastIndexOf(".")).toLowerCase();//获得文件后缀名 // if(fileType != '.xls'){ // $("#excel").tips({ // side:3, // msg:'请上传xls格式的文件', // bg:'#AE81FF', // time:3 // }); // $("#excel").val(''); // document.getElementById("excel").files[0] = '请选择xls格式的文件'; // } //} //function importExcle(){ // if($("#excel").val()=="" || document.getElementById("excel").files[0] =='请选择xls格式的文件'){ // $("#excel").tips({ // side:3, // msg:'请选择文件', // bg:'#AE81FF', // time:3 // }); // return false; // } // $.ajax({ // type : "get", // url : locat+'/annualDailyComp/readExcel.do?TABLE_NAME='+pd_TABLETYPE+'&COMPANY_ID='+pd_COMPANY_ID+'&YEAR='+pd_YEAR+'&COMPANY='+pd_COMPANY+'&excel='+$("#excel").val(), // dataType : 'json', // success : function(data){ // // } // }); //} // //function importInit(){ // //上传 // $('#excel').ace_file_input({ //// style:'well', // no_file:'请选择EXCEL ...', // btn_choose:'选择', // btn_change:'更改', // droppable:false, // onchange:null, // thumbnail:false, //| true | large // whitelist:'xls|xlsx', // blacklist:'gif|png|jpg|jpeg', // allowExt: ['xls','xlsx'] // //onchange:'' // }); //} function numFormat(num){ if(!isNaN(Number(num)) && Number(num) != "0"){ if(num<10) num = Number(num).toFixed(1); else num = Math.round(Number(num)); } return num; } //获取本网站的顶级节点,解决被其他网站iframe引入时发生的跨域问题 function getTop(obj){ var tp = obj; //alert(obj.name); if (tp.mainFrame == undefined) { tp = tp.parent; return getTop(tp); } else { return tp; } }