123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471 |
- var fb_sTime = $("#beginTime").val();//发布时间 start
- var fb_eTime = $("#endTime").val(); //发布时间 end
- var zt = $("#tzdzt").attr("relvalue");//状态
- var fbTime = $("#fbTime").val(); //发布时间
- var eventType = $("#eventType").attr("relvalue"); //突发事件类型
- var eventName = $("#eventType").attr("reltext"); //突发事件类型名称
- var compId = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();
- //数据表格使用
- var g1 =null;
- var g2 =null;
- var g3 =null;
- var columns = [ {
-
- display : '发布单位',
- name : 'unitName',
- width : '20%',
- id:"dept",
- align : 'left',
- render: addStatus
- },
- {
- display : '预警发布情况',
- name : 'ztplan',
- align : 'center',
- columns : [
- {
- display : '红色',
- name : 'YJ_H1',
- width : '6%',
- align : 'center'
- },{
- display : '橙色',
- name : 'YJ_C',
- width : '6%',
- align : 'center'
- },{
- display : '黄色',
- name : 'YJ_H2',
- width : '6%',
- align : 'center'
- },{
- display : '蓝色',
- name : 'YJ_L',
- width : '6%',
- align : 'center'
- },{
- display : '合计',
- name : 'YJ_HJ',
- width : '6%',
- align : 'center'
-
- }
- ]
- }, {
- display : '响应启动情况',
- align : 'center',
- columns : [
- {
- display : 'Ⅰ级',
- name : 'XY_I',
- width : '6%',
- align : 'center'
- },{
- display : 'Ⅱ级',
- name : 'XY_II',
- width : '6%',
- align : 'center'
- },{
- display : 'Ⅲ级',
- name : 'XY_III',
- width : '6%',
- align : 'center'
- },{
- display : 'Ⅳ级',
- name : 'XY_IV',
- width : '6%',
- align : 'center'
- },{
- display : '合计',
- name : 'XY_HJ',
- width : '6%',
- align : 'center'
- }
- ]
- }, {
- display : '总计',
- name : 'HJ',
- width : '10%',
- align : 'center',
- }];
- $(function(){
- //初始化表格
- // _initGrid(g1);
- //加载数据
- // getCount1();
- //tab页签绑定点击事件,切换不同的统计视角
- $("#tabHuiBtnCon").live("actived",function(e,index){
- if(index==0){
- getCount1();
- }else if(index==1){
- getCount2();
- }else if(index==2){
- getCount3();
- }
- });
-
- //绑定筛选单选框点击事件
- $(".radioDiv input:radio").live("change",function(){
-
- var name = $(this).parent().find("input").attr("name");
- if(name=="xxsj2"){
- getCount2();
- }else if(name=="xxsj3"){
- getCount3();
- }
- });
-
- //点击查询事件
- $("#searchBtn").on("click",function(){
- var index = $("#tabHuiBtnCon").attr("selectedIdx");
- if(index==0){
- getCount1();
- }else if(index==1){
- getCount2();
- }else if(index==2){
- getCount3();
- }
- });
- //根据单位层级创建tab页签
- renderTabCon();
- });
- $(window).load(function(){
- getCount1();
- });
- /**
- * 初始化表格
- */
- function _initGrid(index,options,id){
- var g = null;
- if(index==1){
- g = g1 = $("#"+id).quiGrid(options);
- }else if(index==2){
- g = g2 = $("#"+id).quiGrid(options);
- }else if(index==3){
- g = g3 = $("#"+id).quiGrid(options);
- }
- return g;
- }
- function addStatus(rowdata, rowindex, value, column){
- var comp_id='"'+rowdata.unitId+'"';
- var name = '"'+value+'"';
- if("总计"==rowdata.unitName){
- return value;
- }else{
- // return "<a href='javascript:newHtml("+comp_id+","+name+")'>" + value +" </a>";
- return "<div class='pading_left15'>" + value +" </div>";
- }
- }
- function newHtml(comp_id,name){
- if(name=="总计"){
- return;
- }else if(unitId==comp_id){
- return;
- }else{
- // window.open("/nwyj/page/business/am/contingencyPlan/ContingencyPlanHuiZong1.jsp?"+comp_id);
- $.indexOpenNextWindow("/nwyj/page/business/em/alert/warning/WarningHuiZong.jsp?unitId="+comp_id);
- }
- }
- function getCount1(){
- var url = "/nwyj/ws/alertToImpl_queryEquip/AlertToImplService_queryEquip/getNoticeNum1";
- var col1 = $.extend(true, [], columns);
- col1.splice(1,0,{
-
- display : '单位数量',
- name : 'unitNum',
- width : '6%',
- align : 'center'
- });
- var options = {
- columns : col1,
- data:{rows:[]},
- height: '260px',
- rownumbers : false,
- usePager : false
- };
- getCount(url ,col1,1,options,"maingrid1");
- }
- function getCount2(){
-
- var url = "/nwyj/ws/alertToImpl_queryEquip/AlertToImplService_queryEquip/getNoticeNum2";
- var col1 = $.extend(true, [], columns);
- col1[3].width = "16%";
- var options = {
- columns : col1,
- data:{rows:[]},
- height: '500px',
- rownumbers : false,
- usePager : false
- };
-
- var value = $("input:radio[name=xxsj2]").filter("[checked]").val();
- getCount(url ,columns,2,options,"maingrid2",value);
- }
- function getCount3(){
-
- var url = "/nwyj/ws/alertToImpl_queryEquip/AlertToImplService_queryEquip/getNoticeNum3";
- var col1 = $.extend(true, [], columns);
- col1[3].width = "16%";
- // col1[0].id = "unitName";
- var value = $("input:radio[name=xxsj3]").filter("[checked]").val();
- var options = {
- columns : col1,
- data:{rows:[]},
- height: '500px',
- rownumbers : false,
- usePager : false,
- autoCheckChildren : true,
- tree : { columnId : 'dept'},
- treeAjax : true,
- treeChildDataPath : "/nwyj/ws/alertToImpl_queryEquip/AlertToImplService_queryEquip/getNoticeNum2?fb_sTime="+fb_sTime+"&fb_eTime="+fb_eTime+"&tongjiType="+zt+"&eventType="+eventType+"&issueTime="+fbTime+"&value="+value+"&async=1"+"&thisUnit=",
- treeAutoParam : "id"
- };
- getCount(url ,col1,3,options,"maingrid3",value);
- }
- /**
- * 统计
- */
- function getCount(url ,col,index,options,id,value){
- fb_sTime = $("#beginTime").val();//发布时间 start
- fb_eTime = $("#endTime").val(); //发布时间 end
- zt = $("#tzdzt").attr("relvalue");//状态
- fbTime = $("#fbTime").val(); //发布时间
- eventType = $("#eventType").attr("relvalue"); //突发事件类型
- eventName = $("#eventType").attr("reltext"); //突发事件类型名称
- if(zt==1){
- if(fbTime==""){
- top.Dialog.alert("请选择时间!");
- return ;
- }
- $(".GridtitleStyle").empty();
- $(".GridtitleStyle").append("<div class='conStyle'>统计范围: <div>"+getNowTimeForTimeStr(fbTime,1)+",因“"+eventName+"”类突发事件仍处于预警状态或响应状态的情况。</div></div>");
- }else{
- if(fb_sTime=="" || fb_eTime==""){
- top.Dialog.alert("请选择时间!");
- return ;
- }
- $(".GridtitleStyle").empty();
- $(".GridtitleStyle").append("<div class='conStyle'>统计范围: <div>"+getTimeArea(fb_sTime,fb_eTime)+",因“"+eventName+"”类突发事件发布预警或启动响应的情况。</div></div>");
- }
-
- var params = {
- fb_sTime:fb_sTime,
- fb_eTime:fb_eTime,
- tongjiType:zt,
- thisUnit:unitId,
- eventType:eventType,
- issueTime:fbTime,
- value:value,//用于判断是筛选全量单位的数据还是只看有数据的
- comp_id:compId
- };
- $("body").eq(0).showLoading();
- $.ajax({
- url :url,
- type : 'post',
- data : params,
- dataType : 'json',
- success : function(data){
- $("body").eq(0).hideLoading();
- var g = null;
- if(index==1){
- g = g1;
- }else if(index==2){
- g = g2;
- }else if(index==3){
- g = g3;
- }
- if(!g){
- g = _initGrid(index, options,id);
- }
- g.setOptions({data:data,columns:col,treeChildDataPath:"/nwyj/ws/alertToImpl_queryEquip/AlertToImplService_queryEquip/getNoticeNum2?fb_sTime="+fb_sTime+"&fb_eTime="+fb_eTime+"&tongjiType="+zt+"&eventType="+eventType+"&value="+value+"&issueTime="+fbTime+"&async=1"+"&thisUnit="});
- g.loadData();
- setHight();
- $("body").eq(0).hideLoading();
- },
- error : function(e){
- $("body").eq(0).hideLoading();
- top.Dialog.alert("查询失败!");
- }
-
- });
- }
- //重置
- function resetSearch(){
- document.location.reload();
- }
- function export_report() {
- var sql = {
- "report_type" : "yuanhz",
- "json" : JSON.stringify(g.getData())
- };
- excelExport("", sql, "预警/响应统计", "", "预警/响应统计", 'zjdaochu');
-
- }
- /**
- * 通过日期时间字符串获取下一秒时间
- * 返回字符串
- * @param timeStr
- */
- function getNowTimeForTimeStr(timeStr,index){
- var re = "yyyy年MM月dd日";
- if(index==1){
- re += "hh时mm分";
- }
- timeStr = timeStr.stringToDate();
- var newDate = Date.parse(timeStr);
- var result = getFormatDateByLong(newDate,re);
- return result;
- }
- //扩展Date的format方法
- Date.prototype.format = function (format) {
- var o = {
- "M+": this.getMonth() + 1,
- "d+": this.getDate(),
- "h+": this.getHours(),
- "m+": this.getMinutes(),
- "s+": this.getSeconds(),
- "q+": Math.floor((this.getMonth() + 3) / 3),
- "S": this.getMilliseconds()
- };
- if (/(y+)/.test(format)) {
- format = format.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
- }
- for (var k in o) {
- if (new RegExp("(" + k + ")").test(format)) {
- format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length));
- }
- }
- return format;
- };
-
- /**
- *转换long值为日期字符串
- * @param l long值
- * @param pattern 格式字符串,例如:yyyy-MM-dd hh:mm:ss
- * @return 符合要求的日期字符串
- */
- function getFormatDateByLong(l, pattern) {
- return getFormatDate(new Date(l), pattern);
- }
- /**
- *转换日期对象为日期字符串
- * @param l long值
- * @param pattern 格式字符串,例如:yyyy-MM-dd hh:mm:ss
- * @return 符合要求的日期字符串
- */
- function getFormatDate(date, pattern) {
- if (date == undefined) {
- date = new Date();
- }
- if (pattern == undefined) {
- pattern = "yyyy-MM-dd hh:mm:ss";
- }
- return date.format(pattern);
- }
- /**
- * 判断两个日期的重复部分,返回简洁的显示形式
- * 如:2017-06-01,2017-06-17
- * 结果:2017年6月1日~17日
- * @param time1
- * @param time2
- */
- function getTimeArea(time1,time2){
- var yearFlag = false;
- var monthFlag = false;
- var dayFlag = false;
- var time2Arr = time2.split("-");
- if(time1.indexOf(time2Arr[0])>-1){//如果年份相同
- yearFlag = true;
- if(time1.indexOf(time2Arr[0]+"-"+time2Arr[1])>-1){//在年份相同的基础上,月份相同
- monthFlag = true;
- if(time1.indexOf(time2Arr[0]+"-"+time2Arr[1]+"-"+time2Arr[2])>-1){//同一天
- dayFlag = true;
- }
- }
- }
-
- time1 = getNowTimeForTimeStr(time1,2);
- if(dayFlag){
- return time1;
- }
- if(yearFlag){
- if(monthFlag){
- time2 = time2Arr[2]+"日";
- }else{
- time2 = time2Arr[1]+"月"+time2Arr[2]+"日";
- }
- }else{
- time2 = getNowTimeForTimeStr(time2,2);
- }
- return time1+"~"+time2;
- }
- function renderTabCon(){
- var url = "/nwyj/ws/alertToImpl_queryEquip/AlertToImplService_queryEquip/getDeptLevel";
- $.ajax({
- url :url,
- type : 'post',
- data : {thisUnit:unitId},
- dataType : 'text',
- success : function(data){
- var con = $("#tabHuiBtnCon");
- var str = "";
- var beizhu1 = "";
- if(data==1){
- beizhu1 = "按网、省、地、县四个维度统计。";
- }else if(data==2){
- beizhu1 = "按省、地、县三个维度统计。";
- }else if(data==3){
- beizhu1 = "按地、县两个维度统计。";
- }
- str+="<div name='各层级情况' >";
- str+="<div>"+beizhu1+"</div>";
- str+="<div style='margin:0px 20px 10px 20px;'>";
- str+="<div id='maingrid1'></div>";
- str+="</div>";
- str+="</div>";
- if(data<=3){//网省地
- str+="<div name='直属下级' >";
- str+="<div class='radioDiv'>";
- str+="<input type='radio' name='xxsj2' id='allUnit' value='1' checked='checked' class='radioBtn' /><label for='allUnit' class='radioBtn'>显示所有单位</label>";
- str+="<input type='radio' name='xxsj2' value='2' id='hasData' class='radioBtn'/ ><label for='hasData' class='radioBtn' >仅显示有数据单位</label>";
- str+="</div>";
- str+="<div>表中的数据均为该单位本部的数据。</div>";
- str+="<div style='margin:0px 20px 10px 20px;'>";
- str+="<div id='maingrid2'></div>";
- str+="</div>";
- str+="</div>";
- }
- if(data<=2){//网省
- str+="<div name='所属各级单位' >";
- str+="<div class='radioDiv'>";
- str+="<input type='radio' name='xxsj3' id='allUnit3' value='1' checked='checked' class='radioBtn'/><label for='allUnit3' class='radioBtn'>显示所有单位</label>";
- str+="<input type='radio' name='xxsj3' id='hasData3' value='2' class='radioBtn'/><label for='hasData3' class='radioBtn'>仅显示有数据单位</label>";
- str+="</div>";
- str+="<div>单位名称前有“+”或“-”的,代表该行的数据为该单位本部及所属下级单位的合计。</div>";
- str+="<div style='margin:0px 20px 10px 20px;'>";
- str+="<div id='maingrid3'></div>";
- str+="</div>";
- str+="</div>";
- }
- con.append(str);
- con.render();
- },
- error:function(e){
-
- }});
-
- }
- $.messager=top.Dialog;
|