var role_id= top.com.sinosoft.lz.system.user.LoginInfo.getRoleids(); var userId = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id(); //单位id var deptId = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids(); //保存单位id var corpId = deptId; //部门id var compId = top.com.sinosoft.lz.system.user.LoginInfo.getDept_id(); //班组人员 var deptFlag = getThing($.pathname() + "/ws/getRepotDept/ReportDeptService/getDictionaryRole", { "corpId" : deptId, "deptId" : compId }, "text"); var grid; var tbzt = "tbzt="; var thisparams = {}; var plan_id_g = ""; var comp_id_g = ""; var _thisUrl = window.location.href;//请求路径地址 var roleObj = {"R002105430210":"系统运行部", "R002105430211":"生产设备部", "R002105430213":"安全监管部", "R002105430212":"市场营销部", "R002105430205":"应急办成员", "R002105430222":"专业管理部门(抢修中心)", }; $(function() { var role = getRSCRole(role_id);//没有判断公司等级 if(role.length>1){ var yqRoleId = getUserZyRole(role); showRole(userId,yqRoleId); $("#roleDiv").find(".roleDiv").show(); $("#searchPanel").removeClass("box2"); } $("#msgSend").on("click",function(){ if(len===0){ top.Dialog.alert("没有计划需要填报,无需催报"); return; } var allData = grid.options.data["rows"]; var roleId=""; if(role.length===1){ roleId = role[0]; }else{ roleId = $("#roleSel").val(); } var wtData = getWtData(allData,roleId); var wtDeptData = wtData.split("_")[0]; var wtTime = wtData.split("_")[1]; if(wtDeptData==""){ top.Dialog.alert("此时间节点内,没有需要催报的人员"); return; } //班组人员角色 传入部门id if(deptFlag!="false"&&deptFlag.indexOf(role)>-1){ deptId = compId; }else{ deptId = corpId; } var data = getThing( $.pathname() + '/ws/bbjk/QueryReportProgrammeServiceForReport/getSendPeople',{roleId:roleId,corpId:deptId,wtData:wtDeptData}); var mobile = ""; var name = ""; if(data.length>0){ for(var i=0;i-1 && _thisUrl.split("?").length==5){//报表汇总查询进入 var date = _thisUrl.split("?")[4]; $("#riqi").val(date); //设置角色 var unitFlag = _thisUrl.split("?")[1]; var roleId = _thisUrl.split("?")[2]; var data = unitFlag=="true"?{"list":[{"value":"R002105430205","key":roleObj["R002105430205"]}]}:{"list":[{"value":roleId,"key":roleObj[roleId]}]}; $("#roleSel").data("data",data); $("#roleSel").attr("disabled",true); $("#roleSel").render(); $(".l-layout-header-inner").text(roleObj[roleId]); var task_id = _thisUrl.split("?")[3]; initShow(roleId,unitFlag,task_id); }else{ initShow(role[0],"",""); $(".l-layout-header-inner").text(roleObj[role[0]]); } if($("#riqi").val()==""){ currtime = currtime.split(" ")[0]; $("#beginTime").val(currtime); renderDate(); $("#riqi").val(currtime); } //点击筛选已填报或未填报 $("input[type=checkbox]").bind("click",function(){ var tbzt1 = "tbzt="; if($("#yitian").attr("checked")=="checked"){ tbzt1 += "0"; } if($("#weitian").attr("checked")=="checked"){ tbzt1 += "1"; } thisparams.tbzt = tbzt1; setDeptDataByCondition(thisparams); }); $("#roleSel").on("change",function(){ $("#singleNav").empty(); var roleId = $(this).val(); $(".l-layout-header-inner").text(roleObj[roleId]); initShow(roleId,"",""); }); }); function showDeptGrid() { var myCols = [{name : 'RESPONSIBLE_NAME_322', width : "30%",align : 'left',render :_addStatus,isSort:false, headerRender:function(rowdata, rowindex, value, column){ return '
报表
'; } }, {display : '计划时间',name : 'PROGRAMME_TIME_322',width : "20%",type : 'int',align : 'center', render:function(rowdata,rowindex, value, column){ if(rowdata.IS_OVERTIME_322=="是"){ value = "
"+value+"
"; } return value; }}, {display : '填报时间',name : 'updateTime',width : "20%",showTitle:true,align : 'center'}, {display : '填报人',name : 'WRITER_322',width : "10%",showTitle:true,align : 'center'}, {display : '是否填报',name : 'WRITER_STATE_322',width : "10%",align : 'center', render : function(rowdata,rowindex, value, column) { return "未填报" == value ? "" + value + "" : value; } }, {display : '是否超时',name : 'IS_OVERTIME_322',width : "10%",align : 'center', render : function(rowdata,rowindex, value, column) { return "是" == value ? "" + value + "" : value; } } ]; grid = $("#maingrid").quiGrid({ columns:myCols, width : '100%', checkbox : false, usePager : false, data : "", groupColumnName: "deptName", groupColumnDisplay: "填报部门" }); //收缩按钮 $("#openAllTreeDom").on("click",function(){ var status = $("#openAllTreeDom").attr("data_stat"); if(status=="open"){ $(".l-grid-group-togglebtn").each(function(){ $(this).removeClass("l-grid-group-togglebtn-close"); }); $(".l-grid-group-togglebtn").click(); $(this).attr("data_stat","close").attr("class","icon_btn_up"); }else if(status=="close"){ $(".l-grid-group-togglebtn").each(function(){ $(this).addClass("l-grid-group-togglebtn-close"); }); $(".l-grid-group-togglebtn-close").click(); $(this).attr("data_stat","open").attr("class","icon_btn_down"); } }); }; //点击计划,加载该计划下所有部门 var nameText = ""; var currtime = getServerTime(); function checkedCurrent(is_date) { var roleArr = getYqRole(role_id); var roleId = ""; var _this =""; var obj = $("#singleNav .current"); if(obj.length===0){ return; } if(!is_date){ _this = obj.eq(0); }else{ _this = $(this); $(this).parent().parent().find(".current").removeClass("current"); $(this).addClass("current"); } if(roleArr.length==1){ roleId = roleArr[0]; }else{ roleId = $("#roleSel").attr("relValue"); } if(!_this.hasClass("current")){ //设置该菜单选中 _this.siblings().removeClass("current"); _this.addClass("current"); } nameText = _this.text(); var tbzt = "tbzt="; if($("#yitian").attr("checked")=="checked"){ tbzt += "0"; } if($("#weitian").attr("checked")=="checked"){ tbzt += "1"; } var rowdata = _this.data("rowdata"); if(!is_date){ }else{ currtime = currtime.split(" ")[0]; var time = rowdata.START_TIME.split(" ")[0]; $("#beginTime").val(time); renderDate(); if(_thisUrl.indexOf("?")>-1 && _thisUrl.split("?").length==5){ $("#riqi").val(_thisUrl.split("?")[4]); }else{ $("#riqi").val(currtime); } } var selectDate = $("#riqi").val(); var stat = _this.data("data-stat"); thisparams = { "tbzt": tbzt, "planId" : rowdata.FD_OBJECTID, "EARLY_WARNING_ID" : rowdata.WARNING_NUMBER, "START_TIME" : rowdata.START_TIME, "CIRCLE_TIME" : rowdata.ROUND_TIME, "WRITE_DATE_TYPE" : rowdata.FILL_IN_SCHEDULE, "TEMPORARY_TIME" : rowdata.TEMPORARY_TIME, "WRITE_DEPT_ID" : rowdata.REPORT_DEPT, "REPORT_TYPE" : rowdata.REPORT_TYPE, "UPDATEDATE":rowdata.SEND_TIME, "corp_id":deptId, "role_id":roleId, "selectDate":selectDate }; if(stat){ thisparams["plan_stat"] = stat; } setDeptDataByCondition(thisparams); } //显示计划下所有部门填报情况 function setDeptDataByCondition(params) { $("body").eq(0).showLoading(); $.ajax({ url : $.pathname() + '/ws/bbjk/QueryReportProgrammeServiceForReport/loadReportInputDetail', type : 'post', //timeout : 15000, data : params, dataType : 'json', async :false, success : function(data) { $("body").eq(0).hideLoading(); // alert(JSON.stringify(data)); grid.setOptions({ "data" : data }); //grid.loadData(); setHt(); }, error : function(e) { $.messager.alert('访问服务失败!', 'error'); } }); } function _canDownload(rowdata,rowindex, value, column){ var returndata = "下载"; var fd_id = rowdata.fd_object_id; var params ={ listId : 110, condition : "is_Del = '0' and MainId ='"+ fd_id + "'" }; var url1 = $.pathname() + "/ws/uploadForm/FileUpDownService/queryFiles"; var url = ""; $.ajax({ url : url1, data : params, type : 'post', dataType : 'json', async :false, success : function(result){ if(result.rows.length==0){ }else if(result.rows.length==1){ url = $.pathname() + '/page/common/getFileExc.jsp?objectID=' + result.rows[0].FD_OBJECTID110 + "&filename=" + encodeURI(encodeURI(result.rows[0].SAVENAME_110)) + "." + result.rows[0].FILEEXT_110 + "&downfilename=" + encodeURI(encodeURI(result.rows[0].NAME_110))+ "." + result.rows[0].FILEEXT_110; returndata = '下载  '; }else{ var downfilename = ""; var filenames = ""; for (var i = 0; i < result.rows.length; i++) { downfilename += result.rows[i].NAME_110+ "." + result.rows[i].FILEEXT_110 +";"; filenames += result.rows[i].SAVENAME_110+ "." + result.rows[i].FILEEXT_110 +";"; } var url = "/nwyj/page/business/am/org/query/downZipFile.jsp?downfilename="+encodeURI(encodeURI(filenames))+"&filenames="+encodeURI(encodeURI(downfilename)); returndata = '下载  '; } }, error : function(e) { $.messager.alert('查询附件失败'); } }); return returndata; } //对填报部门列进行渲染 function _addStatus(rowdata, rowindex, value, column){ //if(value=="预警行动信息报告" || value=="预警总结报告"){ var now = getServerTime().replace(/-/g,"/");//allGetServerTime(); var timestr = rowdata.PROGRAMME_TIME_322.replace(/-/g,"/"); var progressTime = new Date(timestr); if(rowdata.IS_OVERTIME_322=="是"){ //超时,红色 if(rowdata.WRITER_STATE_322=="已填报"){ var object_id = '"'+rowdata.fd_object_id+'"'; var comp_id='"'+rowdata.deptId+'"'; var report_type=rowdata.report_type; var reporterId = '"'+rowdata.WRITER_ID_322+'"'; return "
" + value + "
"; }else{ return "
" + value + "
"; } //return "
" + value + "
"; }else if(rowdata.WRITER_STATE_322=="已填报"){ //否则,已填报,绿色 var object_id = '"'+rowdata.fd_object_id+'"'; var comp_id='"'+rowdata.deptId+'"'; var report_type=rowdata.report_type; var reporterId = '"'+rowdata.WRITER_ID_322+'"'; return "
" + value + "
"; }else if(rowdata.WRITER_STATE_322=="未填报"){ if(Date.parse(now)+1000*60*15>Date.parse(progressTime) && Date.parse(now) < Date.parse(progressTime)){ //若时间将近(在1小时之内了),则黄色 return "
" + value + "
"; }else{ //绿色 return "
" + value + "
"; } } //} else{ return value; } } function setHt(){ $(window.document.body).height($("#layout1 .padding_right5").height()+$("._statusBar").height()+$("#searchPanel").height()+30); $(parent.document.body).find("iframe").height($(window.document.body).height()); } function openbaobiao(object_id,comp_id,report_type,reporterId){ //alert(object_id); var deptLevel = getThing($.pathname() +"/ws/xianlutingyun/XianlutingyunService/getDeptLevel",{"comp_id":comp_id},"text"); var roleId = ""; var roleArr = getYqRole(role_id); if(roleArr.length==1){ roleId = roleArr[0]; }else{ roleId = $("#roleSel").attr("relValue"); if("R002105430205"==roleId){ roleId = getThing($.pathname() +"/ws/xianlutingyun/XianlutingyunService/getRoleIdByReportType",{"report_type":report_type},"text"); } } //parent.parent.window.open("/nwyj/page/business/em/report/Report_View.html?监控"+"?"+object_id+"?"+report_type+"?"+comp_id+"?"+roleId+"?"+deptLevel+"?"+reporterId, "_blank"); $.indexOpenNextWindow("/nwyj/page/business/em/report/Report_View.html?监控"+"?"+object_id+"?"+report_type+"?"+comp_id+"?"+roleId+"?"+deptLevel+"?"+reporterId, "_blank"); } var len = 0; function initShow(role,flag,task_id){ $.ajax({ url : $.pathname()+ '/ws/bbjk/QueryReportProgrammeServiceForReport/loadReportPlan', type : 'post', //timeout : 15000, data : {'deptId':deptId,'role_id':role,"flag":flag,"task_id":task_id}, dataType : 'json', async :false, success : function(data) { debugger; // alert(JSON.stringify(data)); //调用方法加载右边的表格 showDeptGrid(); len = data.length; //console.log(JSON.stringify(data)); if(data.length>0){ for (var i = 0; i < data.length; i++) { var name = data[i].name; var projectData = data[i].list; var $pdom = $(''+ name+''); $("#singleNav").append($pdom); var $dd = $(""); $("#singleNav").append($dd); for(var k=0;k'+projectData[k]["PROJECT_NAME"]+''); if(name=="上级计划"){ $cdom.data("data-stat",'sj'); } $cdom.data("rowdata",projectData[k]); $cdom.bind("click",checkedCurrent); $dd.append($cdom); } } if(_thisUrl.indexOf("?")>-1 && _thisUrl.split("?").length==5){ var $selectDom = $(".leftnav").each(function(){ var _this = $(this); if(task_id.indexOf(_this.attr("id"))>-1){ return this; } }); var $titlebar = null; if(flag=="true"){ if($selectDom.data("data-stat")=="sj"){ $titlebar = $("#singleNav").find("a[title='上级计划']"); }else{ $titlebar = $("#singleNav").find("a[title='本级计划']"); } }else{ $titlebar = $("#singleNav").find("a[title='下级计划']"); } $titlebar.click(); $(".current").removeClass("current"); $selectDom.addClass("current"); $selectDom.click(); }else{ $("#singleNav").find("a").eq(0).click(); $("#singleNav").find(".parentNavDiv").eq(0).find(".leftnav").eq(0).addClass("current"); $("#singleNav").find(".parentNavDiv").eq(0).find(".leftnav").eq(0).click(); } } }, error : function(e) { $.messager.alert('系统提示信息', '访问服务失败!', 'error'); } }); } function showRole(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 getWtData(data,role){ var arr = []; var returnData = ""; var nowWriteTime = ""; var now = getServerTime().replace(/-/g,"/"); now = new Date(now).getTime(); var hourSecond = 60*60*1000; var time1 = now+hourSecond; var time2 = now-hourSecond; for(var i=0;i=planTime && time2<=planTime)){ nowWriteTime = dataObj["PROGRAMME_TIME_322"]; if("R002105430205"==role){ if($.inArray(dataObj["report_type"],arr)==-1){ arr.push(dataObj["report_type"]); returnData += dataObj["report_type"]+","; } }else{ if($.inArray(dataObj["deptId"],arr)==-1){ arr.push(dataObj["deptId"]); returnData += dataObj["deptId"]+","; } } } } returnData = returnData.substring(0, returnData.lastIndexOf(",")); returnData += "_"+nowWriteTime; return returnData; } /***重置日期框***/ function renderDate(){ //获取当前主题风格,用于设置日期控件的皮肤 try { dateSkin=themeColor; } catch(e){}; document.getElementById('riqi').onfocus=function(){ var $riqi=$dp.$('riqi'); //这里设置了最大日期为当前日期,如果不需要则把maxDate:'%y-%M-%d'去掉 WdatePicker({skin:dateSkin,onpicked:function(){$riqi.blur();checkedCurrent(false);},maxDate:'%y-%M-%d',minDate:'#F{$dp.$D(\'beginTime\')}'}); }; } 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; }