123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337 |
- 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<reports.length;i++){
- if(reportNum.indexOf(reports.eq(i))==-1){
- reportNum += reports.eq(i).data("data-fdId")+",";
- }
- }
- console.log("报表填报任务id=========="+reportNum);
- var scheduleName = $(this).parent().parent().parent().parent().find("thead").find("tr").first().find("td").eq(0).find("span").data("data-schedule");
- window.parent.parent.document.getElementById("frmright").setAttribute("src", $.pathname()+"/page/business/em/report/Report_Add.html?"+report_type+"?"+reportNum+"?"+dbtype+"?"+affair+"?"+scheduleName);
-
- }else{
- var starTime = "";
- var endTime ="";
- if(goTime.indexOf(" ")==-1){
- if(0<parseInt(goTime,10)&&parseInt(goTime,10)<23){
-
- starTime = parseInt(goTime,10)-1;
- endTime = parseInt(goTime,10)+1;
- }else if(0===parseInt(goTime,10)){
- starTime = 23;
- endTime = 1;
- }else if(23===parseInt(goTime)){
- starTime = 22;
- endTime =0;
- }
- if(min!=null){
- starTime = starTime+":"+min;
- endTime = endTime+":"+min;
- }
-
- }else{
-
- goTime = goTime.replace(new RegExp("-","gm"),"/");
- var seconds = (new Date(goTime)).getTime();
- var hS = 60*60*1000;
- starTime = getNowDateTime((parseInt(seconds,10)-parseInt(hS,10)));//new Date((parseInt(seconds,10)-parseInt(hS,10)));
- endTime= getNowDateTime((parseInt(seconds,10)+parseInt(hS,10)));
- starTime = starTime.replace(new RegExp("/","gm"),"-");
- endTime = endTime.replace(new RegExp("/","gm"),"-");
- }
- top.Dialog.alert("该报表请在"+starTime+"~"+endTime+"时填报");
- }
- }
- function init(params,roleId){
- $("#requireForm").empty();
-
- getRequire(params,roleId);
- }
- function getNowDateTime(time){
-
- var now=null;
- if(time){
- now = new Date(time);
- }else{
-
- now=allGetServerTime();
- }
-
- //获取年份
- var year=now.getFullYear();
- //获取月份
- var month=now.getMonth()+1;
- if(month>=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("<span class='spantip'>没有要填写的报表数据</span>");
- $("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 = $("<div style='width : 99.2%'><div class='bgd_title bgd_hide' id='"+role+"'>"+roleName+"---"+writeNum+"/"+totalNum+"</div><hr/></div>");
- var contentTable = $("<div id='content_"+role+"' style='Width:100%;display:none'></div>");
- var tableData = data[m]["data"];
- if(tableData.length==0){
- contentTable.append("<span class='spantip'>没有要填写的报表数据</span>");
- roleTable.append(contentTable);
- $("#requireForm").append(roleTable);
- continue;
- }
- for (var i = 0; i < tableData.length; i++) {
- var table = $("<table class='table'></table>");
- var th = $("<thead></thead>");
- var tbody = $("<tbody></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 = $("<tr><td class='cententCenter'></td></tr>");
-
- var sch_span = $("<span></span>");
- for(var n=0;n<scheduleName.length;n++){
- var sch_div = $("<div class='TitleHeads'>"+scheduleName[n]+"</div>");
- 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 = $("<td class='cententCenter'></td>");
- //cfRole只要不为no都可以拆分
- var cf_input = $("<span class='cfSpan'>拆分计划</span>");
- 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 = $("<tr><td class='cententCenter td_head'>填报时间段</td><td class='cententCenter td_head'>需要填报的报表</td><td class='cententCenter td_head'>操作</td></tr>");
- 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 = $("<td rowspan=" + len
- + " class='cententCenter_t td_border2'>"+time+"</td>");
- for (var k = 0; k < len; k++) {
- var reportName = report[k].split("_")[0];
- var reportType = report[k].split("_")[1];
- var tr1 = $("<tr></tr>");
- var span = $("<span></span>");
- var tb_input = "";
- var $td2 = $("<td class='cententCenter td_border1' ></td>");
- var $td_btn = $("<td class='cententCenter_btn td_border1'> </td>");
- if(flag=="true"){
- span.addClass("yes_write");
- tb_input = $("<span class='input1' type='"+reportType+"'>填报</span>");
- 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 = $("<span>未按时填报</span>");
- }else{
- tb_input = $("<span>未到填报时间</span>");
- }
- }
-
- 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");
-
- }
|