var corpId = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids(); var deptLevel = getThing($.pathname() +"/ws/xianlutingyun/XianlutingyunService/getDeptLevel",{"comp_id":corpId},"text"); function intClick(){ var report_type = $(this).parent().siblings().find("span").eq(0).data("report_type"); if("2"==report_type){ if("2"==deptLevel || "1"==deptLevel){ report_type = "101"; } } var dbtype = $(this).data("data-dbtype"); var report_time = $(this).data("data-time"); var affair = $(this).data("data-affair"); var goTime=null; var min = null; if(report_time.indexOf(" ")==-1){ if(report_time.indexOf(":")>-1){ var check = report_time.substring(0, report_time.indexOf(":")); goTime = check; /*if(0===parseInt(check,10)){ check = "24"; }*/ min = report_time.substring(report_time.indexOf(":")+1); report_time = check+":"+min; }else{ goTime = report_time; } }else{ goTime = report_time; } var nowDateTime = getServerTime().replace(/-/g,"/"); var nowTime = parseInt(new Date(nowDateTime).getTime()); var year = nowDateTime.substring(0, 10); if(report_time.indexOf(" ")==-1){ report_time = year+" "+report_time; } if(report_time.indexOf("-")>-1){ report_time = report_time.replace(new RegExp("-","gm"),"/"); } report_time = parseInt(new Date(report_time).getTime()); if((nowTime-60*60*1000<=report_time)&&(nowTime+60*60*1000>=report_time)){ var reports = $(this).parent().parent().parent().parent().find("tbody").find(".input1[type='"+report_type+"']");//当前角色激活状态的报表 var reportNum = ""; for(var i=0;i=1&&month<=9){ month = "0"+month; } //获取日期 var day=now.getDate(); if(day>=1&&day<=9){ day = "0"+day; } //获取小时 var hours=now.getHours(); if(hours>=1&&hours<=9){ hours = "0"+hours; } //获取分钟 var minutes=now.getMinutes(); if(minutes>=1&&minutes<=9){ minutes = "0"+minutes; } var seconds = now.getSeconds(); if(seconds>=1&&seconds<=9){ seconds = "0"+seconds; } var currentTime =year+"/"+month+"/"+day+" "+hours+":"+minutes+":"+seconds; return currentTime; } function getRequire(params,roleId){ $("body").eq(0).showLoading(); $.ajax({ url : $.pathname()+ "/ws/xianlutingyun/XianlutingyunService/getReportTask", type : 'post', // timeout : 15000, async : false, data : params, dataType : 'json', success : function(data) { if(data==null || data.length==0){ $("#requireForm").append("没有要填写的报表数据"); $("body").eq(0).hideLoading(); return; } for(var m in data){ var role = data[m]["roleId"]; var roleName = data[m]["roleName"]; var totalNum = data[m]["totalNum"]; var writeNum = data[m]["writeNum"]; var roleTable = $("
"+roleName+"---"+writeNum+"/"+totalNum+"

"); var contentTable = $(""); var tableData = data[m]["data"]; if(tableData.length==0){ contentTable.append("没有要填写的报表数据"); roleTable.append(contentTable); $("#requireForm").append(roleTable); continue; } for (var i = 0; i < tableData.length; i++) { var table = $("
"); var th = $(""); var tbody = $(""); var schedule = tableData[i].schedule; var cfData = tableData[i].cfRole; var db_type = tableData[i].report_type; var reportContent = tableData[i].reportContent; var scheduleName = schedule.split("|"); var scheduleNum = tableData[i].fdIds; var affair = tableData[i].affair; var tr_h = $(""); var sch_span = $(""); for(var n=0;n"+scheduleName[n]+""); sch_span.append(sch_div); } sch_span.data("data-num",scheduleNum); sch_span.data("data-schedule",scheduleName); tr_h.find("td").eq(0).append(sch_span); if(deptLevel!="true" && cfData!="no"){ tr_h.find("td").eq(0).attr("colspan","2"); var td = $(""); //cfRole只要不为no都可以拆分 var cf_input = $("拆分计划"); cf_input.data("data-role",role); cf_input.on("click",cfClick); td.append(cf_input); tr_h.append(td); }else{ tr_h.find("td").eq(0).attr("colspan","3"); } th.append(tr_h); var tr_h1 = $("填报时间段需要填报的报表操作"); th.append(tr_h1); table.append(th); for (var j = 0; j < reportContent.length; j++) { var time = reportContent[j].time; var reports = reportContent[j].report; var flag = reportContent[j].flag;//任务状态 var fdId = reportContent[j].fdId;//任务id var report = reports.split(","); var len = report.length; var $td1 = $(""+time+""); for (var k = 0; k < len; k++) { var reportName = report[k].split("_")[0]; var reportType = report[k].split("_")[1]; var tr1 = $(""); var span = $(""); var tb_input = ""; var $td2 = $(""); var $td_btn = $(" "); if(flag=="true"){ span.addClass("yes_write"); tb_input = $("填报"); tb_input.data("data-time",time); tb_input.data("data-dbtype",db_type); tb_input.data("data-affair",affair); tb_input.data("data-fdId",fdId.split("_")[k]); tb_input.on("click",intClick); }else{ if(flag=="cg"){ tb_input = $("未按时填报"); }else{ tb_input = $("未到填报时间"); } } span.data("report_type",reportType); span.text(reportName); $td2.append(span); $td_btn.append(tb_input); if(len==1){ tr1.addClass("td_border2"); }else{ if(k==len-1){ tr1.addClass("tr_border2"); } } if (k == 0) { tr1.append($td1).append($td2).append($td_btn); } else { tr1.append($td2).append($td_btn); } tbody.append(tr1); table.append(tbody); } } contentTable.append(table); roleTable.append(contentTable); } $("#requireForm").append(roleTable); } $("body").eq(0).hideLoading(); }, error : function(e) { $.messager.alert('查询行失败!', '访问服务失败!', 'error'); } }); } function getRoleSel(userId,zyRoleId){ $.ajax({ url : $.pathname() +"/ws/getUserRole/GetRoleService/getUserRole", type : 'post', timeout : 15000, async : false, data : { userId:userId, roleId:zyRoleId }, dataType : 'json', success : function(data) { $("#roleSel").data("data",data); $("#roleSel").render(); }, error : function(e) { $.messager.alert('查询报表类型失败', '访问服务失败!', 'error'); } }); } /* function hideLoad(){ $(".idxModule-loading-bg").hide(); $(".idxModule-loading-box").hide(); } function showLoad(){ $(".idxModule-loading-bg").show(); $(".idxModule-loading-box").show(); }*/ /** * 拆分计划 */ function cfClick(){ var roleId = $(this).data("data-role"); var fd_ids = $(this).parents().find("thead").find("tr").first().find("td").eq(0).find("span").data("data-num"); // var cfRole = $(this).parents().find("thead").find("tr").first().find("td").eq(0).find("span").data("data-cfRole"); var fd_id = ""; if(fd_ids.length==1){ fd_id = fd_ids[0]; }else{ fd_id = fd_ids.join(","); } window.parent.document.getElementById("frmright").setAttribute("src", "/nwyj/page/business/em/report/reportDept/addReportRequire.html?fd_id="+fd_id+"&role_Id="+roleId+"&db=db"); }