123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393 |
- //数据表格使用
- var g;
- // 公司名称数组--X轴数据
- var compIds = "";
- //var series = "";
- var gridData = "";
- var oneCols = [ {
- display : '自然灾害',
- name : 'zrzh',
- width : '7%',
- align : 'center'
- },{
- display : '事故灾难',
- name : 'sgzh',
- width : '7%',
- align : 'center'
- },{
- display : '公共卫生',
- name : 'ggws',
- width : '7%',
- align : 'center'
- },{
- display : '社会安全',
- name : 'shaq',
- width : '7%',
- align : 'center'
- },{
- display : '合计',
- name : 'zxPlan',
- width : '7%',
- align : 'center'
- } ];
- var oneCols2 = [ {
- display : '安全监管部',
- name : 'aqjcb',
- width : '7%',
- align : 'center'
- },{
- display : '国际部',
- name : 'gjb',
- width : '7%',
- align : 'center'
- },{
- display : '设备管理部',
- name : 'scsbglb',
- width : '7%',
- align : 'center'
- },{
- display : '系统运行部',
- name : 'xtyxb',
- width : '7%',
- align : 'center'
- },{
- display : '信息部',
- name : 'xxb',
- width : '7%',
- align : 'center'
- },{
- display : '市场营销部',
- name : 'scyxb',
- width : '7%',
- align : 'center'
- },{
- display : '合计',
- name : 'bmhj',
- width : '7%',
- align : 'center'
- } ];
- var oneCols1 = [ {
- display : '自然灾害',
- name : 'zrzhxc',
- width : '7%',
- align : 'center'
- },{
- display : '事故灾难',
- name : 'sgzhxc',
- width : '7%',
- align : 'center'
- },{
- display : '公共卫生',
- name : 'ggwsxc',
- width : '7%',
- align : 'center'
- },{
- display : '社会安全',
- name : 'shaqxc',
- width : '7%',
- align : 'center'
- },{
- display : '合计',
- name : 'xcczPlan',
- width : '7%',
- align : 'center'
- } ];
-
- //单位ID
- var deptName;
- var loadData;
- // 表格的初始化
- $(function(){
- deptName = (window.location.href).split('?')[1];
- $.post($.pathname()+ "/ws/PlanHuiZong/ContingencyPlanHuiZong/getPlanInfoxb",{id : deptName},function (data){
- //给表格数据赋值
- loadData= data;
- //初始化表格
- initCompletes();
- //初始化图表
- initmyGraphic(data);
- },"json" );
-
- });
- //点击表格实现获取表格具体单元格里面值的方法
- /**
- * 需要传当前这一行所属单位的ID、预案的类型
- * 然后传给弹出窗口,弹出的窗口根据所属单位ID、预案的类型,列表显示该单位、该类型的预案修编情况。
- * **/
- function showMsg(rowdata ,rowindex,value,column){
- return '<a href="javascript:void(0)" '
- + 'onclick=showDetail("'
- + rowdata.dept_id //取这一行所属单位ID
- + '",'+'"'+column.name+ '",'+'"'+value+'")>'+value+'</a>';
- }
- //点击表格单元格后显示该单元格下面对应的相关类型修编的预案
- function showDetail(index,name,val){
- if(val=="0"){
- top.Dialog.alert("该类型预案没有修编过");
- return;
- }else{
-
- var diag = new top.Dialog();//定义一个窗口对象
- diag.Top = 10;
- diag.Title = "应急预案修编明细";//窗口标题
- diag.URL = "/nwyj/page/business/am/contingencyPlan/PlanHanderEdit/ContingencyPlan.jsp?"+index+"?"+name;//窗口对应的页面
- diag.Height = 450;
- diag.Width= 620;
- diag.showOkButton = false;
- diag.showCancelButton = false;
- diag.ShowMaxButton = true;
- diag.show();//显示窗口
- var bodyheight = $(window.document.body).height();
- $(parent.document.body).find("#frmright").height(bodyheight);
- }
- return false;
- }
- function initCompletes() {//gridData
- g = $("#maingrid").quiGrid({
- columns : [ {
-
- display : '所属单位',
- "name" : 'name',
- id : 'name',
- width : '10%',
- dept_id:'dept_id',
- align : 'center',
- render: addStatus,
- frozen: true
- },
- {
- display : '总体预案',
- name : 'ztPlan',
- align : 'center',
- width : '7%'
- }, {
- display : '专项预案',
- columns : oneCols,
- width : "300"
- }, {
- display : '现场处置方案',
- columns : oneCols1,
- width : "300"
- }, {
- display : '部门预案',
- columns : oneCols2,
- width : "300"
- },
- {
- display : '总合计',
- name : 'zTotal',
- align : 'center',
- width : '7%'
- }],
- data:loadData,
- rownumbers : true,
- width : "100%",
- usePager : false,
- // autoCheckChildren : true,
- // tree : {
- // columnId : 'name'
- // },
- // treeAjax : true,
- // treeChildDataPath : $.pathname()
- // + '/ws/PlanHuiZong/ContingencyPlanHuiZong/getPlanInfoListxb?deptId=',
- // treeAutoParam:"dept_id",
- // treeDataFilter:filterHandler
- //onAfterShowData: initmyGraphic
- });
- }
- var one =[];
- var two =[];
- var three =[];
- var four =[] ;
- var deptNames=[];
- var options={
- chart: {
- type: 'column'
- },
- title: {
- text: '预案修编统计图'
- },
- xAxis: {
- categories: deptName,
- crosshair: true
- },
- yAxis: {
- min: 0,
- title: {
- text: '预案修编数量(个)'
- }
- },
- tooltip: {
- headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
- pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' +
- '<td style="padding:0"><b>{point.y:.1f} 个</b></td></tr>',
- footerFormat: '</table>',
- shared: true,
- useHTML: true
- },
- plotOptions: {
- column: {
- pointPadding: 0.2,
- borderWidth: 0
- }
- },
- series: [{
- name: '总体预案',
- data: one
- }, {
- name: '专项预案',
- data: two
- }, {
- name: '现场处置方案',
- data: three
- }, {
- name: '部门预案',
- data: four
- }]
- };
- var chart;
- function initmyGraphic(data){
- //单位的个数
- var unitsNum = data.rows.length-1;
- if(unitsNum>0){
- for(var i=0; i<unitsNum; i++){
- //初始化显示部门名称
- deptNames.push(data.rows[i].name);
- //初始化 各个预案类型的数据
- one.push(parseInt(data.rows[i].ztPlan));
- two.push(parseInt(data.rows[i].zxPlan));
- three.push(parseInt(data.rows[i].xcczPlan));
- four.push(parseInt(data.rows[i].bmhj));
- }
- }
- //初始化chart加载参数
- options = {
- chart: {
- type: 'column'
- },
- title: {
- text: '预案统计图'
- },
- xAxis: {
- categories: deptNames,
- crosshair: true
- },
- yAxis: {
- min: 0,
- title: {
- text: '预案数量(个)'
- }
- },
- tooltip: {
- headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
- pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' +
- '<td style="padding:0"><b>{point.y:.1f} 个</b></td></tr>',
- footerFormat: '</table>',
- shared: true,
- useHTML: true
- },
- plotOptions: {
- column: {
- pointPadding: 0.2,
- borderWidth: 0
- }
- },
- series: [{
- name: '总体预案',
- data: one
- }, {
- name: '专项预案',
- data: two
- }, {
- name: '现场处置方案',
- data: three
- }, {
- name: '部门预案',
- data: four
- }]
- };
- //alert(JSON.stringify(options));
- //创建chart对象
- $('#mycontainer').highcharts(options);
-
-
- }
- function filterHandler(data){
- //alert("异步");
- for(var i=0;i<data.rows.length;i++){
- //跟新每个部门 下预案数量
- one.push(parseInt(data.rows[i].ztPlan));
- two.push(parseInt(data.rows[i].zxPlan));
- three.push(parseInt(data.rows[i].xcczPlan));
- four.push(parseInt(data.rows[i].bmhj));
- //跟新显示部门名称
- deptNames.push(data.rows[i].name);
- }
- //alert(two);
- //alert(deptNames);
- //更新显示的部门名称
- options.xAxis.categories = deptNames;
- //更新每个部门下四个预案的数据
- options.series = [{
- name: '总体预案',
- data: one
- }, {
- name: '专项预案',
- data: two
- }, {
- name: '现场处置方案',
- data: three
- }, {
- name: '部门预案',
- data: four
- }];
- //重建chart对象
- chart = new Highcharts.Chart(options);
- return data;
- }
- /********************************************打开新窗口***********************************************/
- function addStatus(rowdata, rowindex, value, column){
- var comp_id='"'+rowdata.dept_id+'"';
- var name = '"'+value+'"';
- return "<a href='javascript:newHtml("+comp_id+","+name+")'>" + value +" </a>";
- }
- function newHtml(comp_id,name){
- if(name=="总计"){
- return;
- }else if(deptName==comp_id){
- return;
- }else{
- window.open("/nwyj/page/business/am/contingencyPlan/ContingencyPlanXBHuiZong1.jsp?"+comp_id);
- }
-
- }
|