123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610 |
- 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<data.length;i++){
- mobile += data[i]["MOBILE"]+";";
- name += data[i]["REAL_NAME"]+";";
- }
- mobile = mobile.substring(0, mobile.lastIndexOf(";"));
- name = name.substring(0, name.lastIndexOf(";"));
-
- }
-
- addMsg(name,mobile,'您好,计划'+nameText+'在填报时间段'+wtTime+"您还有没填写上报的报表,请您尽快登陆系统进行填写上报");
- });
-
- //****布局
- var layout = $("#layout1").layout({
- leftWidth : 250,
- space:10
- });
- function customHeightSet(contentHeight) {
- $(".layout_content").height(contentHeight - 30);
- }
- $("#layout1").layout({
- onEndResize : function() {
- grid.resetWidth();
- var wi = $(".layout_content").width();
- wi = wi*0.85;
- $("#singleNav span a").css("width",wi+"px");
- }
- });
- function customHeightSet(contentHeight) {
- $(".cusBoxContent").height(contentHeight - 20);
- }
- $(".l-layout-left").css("overflow","auto");
-
-
- //生成左边面板名称:用户所在部门名称(按需求应是单位名称,这里先用部门名称放着)
- if(_thisUrl.indexOf("?")>-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 '<div class="padding_left2"><span class="icon_btn_down" id="openAllTreeDom" data_stat="open">报表</span></div>';
- }
- },
- {display : '计划时间',name : 'PROGRAMME_TIME_322',width : "20%",type : 'int',align : 'center',
- render:function(rowdata,rowindex, value, column){
- if(rowdata.IS_OVERTIME_322=="是"){
- value = "<div class='bg_red'>"+value+"</div>";
- }
- 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 ? "<font color=blue>"
- + value + "</font>"
- : value;
- }
- },
- {display : '是否超时',name : 'IS_OVERTIME_322',width : "10%",align : 'center',
- render : function(rowdata,rowindex, value, column) {
- return "是" == value ? "<font color=red>"
- + value + "</font>"
- : 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 = "<font class='nodownload'>下载</font>";
- 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 = '<a onclick="javascript:window.open(\'' + url + '\')" class="hasFile">下载</a> ';
- }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 = '<a onclick="javascript:window.open(\'' + url + '\')" class="hasFile">下载</a> ';
- }
- },
- 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 "<div><a href='javascript:openbaobiao("+object_id+","+comp_id+","+report_type+","+reporterId+")'><span style='margin-left:25px;margin-right:5px'><img src='/nwyj/scripts/qui/libs/images/colorball/red1.png'/></span>" + value + "</a></div>";
- }else{
- return "<div><a><span style=' margin-left:25px;margin-right:5px'><img src='/nwyj/scripts/qui/libs/images/colorball/red1.png'/></span>" + value + "</a></div>";
- }
- //return "<div><a><span style='margin-right:5px'><img src='/nwyj/scripts/qui/libs/images/colorball/red1.png'/></span>" + value + "</a></div>";
- }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 "<div><a href='javascript:openbaobiao("+object_id+","+comp_id+","+report_type+","+reporterId+")'><span style='margin-left:25px;margin-right:5px'><img src='/nwyj/scripts/qui/libs/images/colorball/green1.png'/></span>" + value + "</a></div>";
- }else if(rowdata.WRITER_STATE_322=="未填报"){
- if(Date.parse(now)+1000*60*15>Date.parse(progressTime) && Date.parse(now) < Date.parse(progressTime)){
- //若时间将近(在1小时之内了),则黄色
- return "<div><a><span style='margin-left:25px;margin-right:5px'><img src='/nwyj/scripts/qui/libs/images/colorball/yellow1.png'/></span>" + value + "</a></div>";
- }else{
- //绿色
- return "<div><a><span style='margin-left:25px;margin-right:5px'><img src='/nwyj/scripts/qui/libs/images/colorball/green1.png'/></span>" + value + "</a></div>";
- }
- }
- //}
- 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 = $('<a href="javascript:;" title="'+name+'" class="titlebar">'+ name+'</a>');
- $("#singleNav").append($pdom);
- var $dd = $("<div style='display:none;' class='parentNavDiv'></div>");
- $("#singleNav").append($dd);
- for(var k=0;k<projectData.length;k++){
- var $cdom = $('<div title='+projectData[k]["PROJECT_NAME"]+' class="leftnav" id="'+projectData[k]["FD_OBJECTID"]+'">'+projectData[k]["PROJECT_NAME"]+'</div>');
- 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<data.length;i++){
- var dataObj = data[i];
- var stat = dataObj["WRITER_STATE_322"];
- var planTime = new Date(dataObj["PROGRAMME_TIME_322"].replace(/-/g,"/")).getTime();
- if(stat=="未填报" && (time1>=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;
- }
|