2cd1fbf5987d6e3797039b9415edb213bb16ff61.svn-base 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393
  1. //数据表格使用
  2. var g;
  3. // 公司名称数组--X轴数据
  4. var compIds = "";
  5. //var series = "";
  6. var gridData = "";
  7. var oneCols = [ {
  8. display : '自然灾害',
  9. name : 'zrzh',
  10. width : '7%',
  11. align : 'center'
  12. },{
  13. display : '事故灾难',
  14. name : 'sgzh',
  15. width : '7%',
  16. align : 'center'
  17. },{
  18. display : '公共卫生',
  19. name : 'ggws',
  20. width : '7%',
  21. align : 'center'
  22. },{
  23. display : '社会安全',
  24. name : 'shaq',
  25. width : '7%',
  26. align : 'center'
  27. },{
  28. display : '合计',
  29. name : 'zxPlan',
  30. width : '7%',
  31. align : 'center'
  32. } ];
  33. var oneCols2 = [ {
  34. display : '安全监管部',
  35. name : 'aqjcb',
  36. width : '7%',
  37. align : 'center'
  38. },{
  39. display : '国际部',
  40. name : 'gjb',
  41. width : '7%',
  42. align : 'center'
  43. },{
  44. display : '设备管理部',
  45. name : 'scsbglb',
  46. width : '7%',
  47. align : 'center'
  48. },{
  49. display : '系统运行部',
  50. name : 'xtyxb',
  51. width : '7%',
  52. align : 'center'
  53. },{
  54. display : '信息部',
  55. name : 'xxb',
  56. width : '7%',
  57. align : 'center'
  58. },{
  59. display : '市场营销部',
  60. name : 'scyxb',
  61. width : '7%',
  62. align : 'center'
  63. },{
  64. display : '合计',
  65. name : 'bmhj',
  66. width : '7%',
  67. align : 'center'
  68. } ];
  69. var oneCols1 = [ {
  70. display : '自然灾害',
  71. name : 'zrzhxc',
  72. width : '7%',
  73. align : 'center'
  74. },{
  75. display : '事故灾难',
  76. name : 'sgzhxc',
  77. width : '7%',
  78. align : 'center'
  79. },{
  80. display : '公共卫生',
  81. name : 'ggwsxc',
  82. width : '7%',
  83. align : 'center'
  84. },{
  85. display : '社会安全',
  86. name : 'shaqxc',
  87. width : '7%',
  88. align : 'center'
  89. },{
  90. display : '合计',
  91. name : 'xcczPlan',
  92. width : '7%',
  93. align : 'center'
  94. } ];
  95. //单位ID
  96. var deptName;
  97. var loadData;
  98. // 表格的初始化
  99. $(function(){
  100. deptName = (window.location.href).split('?')[1];
  101. $.post($.pathname()+ "/ws/PlanHuiZong/ContingencyPlanHuiZong/getPlanInfoxb",{id : deptName},function (data){
  102. //给表格数据赋值
  103. loadData= data;
  104. //初始化表格
  105. initCompletes();
  106. //初始化图表
  107. initmyGraphic(data);
  108. },"json" );
  109. });
  110. //点击表格实现获取表格具体单元格里面值的方法
  111. /**
  112. * 需要传当前这一行所属单位的ID、预案的类型
  113. * 然后传给弹出窗口,弹出的窗口根据所属单位ID、预案的类型,列表显示该单位、该类型的预案修编情况。
  114. * **/
  115. function showMsg(rowdata ,rowindex,value,column){
  116. return '<a href="javascript:void(0)" '
  117. + 'onclick=showDetail("'
  118. + rowdata.dept_id //取这一行所属单位ID
  119. + '",'+'"'+column.name+ '",'+'"'+value+'")>'+value+'</a>';
  120. }
  121. //点击表格单元格后显示该单元格下面对应的相关类型修编的预案
  122. function showDetail(index,name,val){
  123. if(val=="0"){
  124. top.Dialog.alert("该类型预案没有修编过");
  125. return;
  126. }else{
  127. var diag = new top.Dialog();//定义一个窗口对象
  128. diag.Top = 10;
  129. diag.Title = "应急预案修编明细";//窗口标题
  130. diag.URL = "/nwyj/page/business/am/contingencyPlan/PlanHanderEdit/ContingencyPlan.jsp?"+index+"?"+name;//窗口对应的页面
  131. diag.Height = 450;
  132. diag.Width= 620;
  133. diag.showOkButton = false;
  134. diag.showCancelButton = false;
  135. diag.ShowMaxButton = true;
  136. diag.show();//显示窗口
  137. var bodyheight = $(window.document.body).height();
  138. $(parent.document.body).find("#frmright").height(bodyheight);
  139. }
  140. return false;
  141. }
  142. function initCompletes() {//gridData
  143. g = $("#maingrid").quiGrid({
  144. columns : [ {
  145. display : '所属单位',
  146. "name" : 'name',
  147. id : 'name',
  148. width : '10%',
  149. dept_id:'dept_id',
  150. align : 'center',
  151. render: addStatus,
  152. frozen: true
  153. },
  154. {
  155. display : '总体预案',
  156. name : 'ztPlan',
  157. align : 'center',
  158. width : '7%'
  159. }, {
  160. display : '专项预案',
  161. columns : oneCols,
  162. width : "300"
  163. }, {
  164. display : '现场处置方案',
  165. columns : oneCols1,
  166. width : "300"
  167. }, {
  168. display : '部门预案',
  169. columns : oneCols2,
  170. width : "300"
  171. },
  172. {
  173. display : '总合计',
  174. name : 'zTotal',
  175. align : 'center',
  176. width : '7%'
  177. }],
  178. data:loadData,
  179. rownumbers : true,
  180. width : "100%",
  181. usePager : false,
  182. // autoCheckChildren : true,
  183. // tree : {
  184. // columnId : 'name'
  185. // },
  186. // treeAjax : true,
  187. // treeChildDataPath : $.pathname()
  188. // + '/ws/PlanHuiZong/ContingencyPlanHuiZong/getPlanInfoListxb?deptId=',
  189. // treeAutoParam:"dept_id",
  190. // treeDataFilter:filterHandler
  191. //onAfterShowData: initmyGraphic
  192. });
  193. }
  194. var one =[];
  195. var two =[];
  196. var three =[];
  197. var four =[] ;
  198. var deptNames=[];
  199. var options={
  200. chart: {
  201. type: 'column'
  202. },
  203. title: {
  204. text: '预案修编统计图'
  205. },
  206. xAxis: {
  207. categories: deptName,
  208. crosshair: true
  209. },
  210. yAxis: {
  211. min: 0,
  212. title: {
  213. text: '预案修编数量(个)'
  214. }
  215. },
  216. tooltip: {
  217. headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
  218. pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' +
  219. '<td style="padding:0"><b>{point.y:.1f} 个</b></td></tr>',
  220. footerFormat: '</table>',
  221. shared: true,
  222. useHTML: true
  223. },
  224. plotOptions: {
  225. column: {
  226. pointPadding: 0.2,
  227. borderWidth: 0
  228. }
  229. },
  230. series: [{
  231. name: '总体预案',
  232. data: one
  233. }, {
  234. name: '专项预案',
  235. data: two
  236. }, {
  237. name: '现场处置方案',
  238. data: three
  239. }, {
  240. name: '部门预案',
  241. data: four
  242. }]
  243. };
  244. var chart;
  245. function initmyGraphic(data){
  246. //单位的个数
  247. var unitsNum = data.rows.length-1;
  248. if(unitsNum>0){
  249. for(var i=0; i<unitsNum; i++){
  250. //初始化显示部门名称
  251. deptNames.push(data.rows[i].name);
  252. //初始化 各个预案类型的数据
  253. one.push(parseInt(data.rows[i].ztPlan));
  254. two.push(parseInt(data.rows[i].zxPlan));
  255. three.push(parseInt(data.rows[i].xcczPlan));
  256. four.push(parseInt(data.rows[i].bmhj));
  257. }
  258. }
  259. //初始化chart加载参数
  260. options = {
  261. chart: {
  262. type: 'column'
  263. },
  264. title: {
  265. text: '预案统计图'
  266. },
  267. xAxis: {
  268. categories: deptNames,
  269. crosshair: true
  270. },
  271. yAxis: {
  272. min: 0,
  273. title: {
  274. text: '预案数量(个)'
  275. }
  276. },
  277. tooltip: {
  278. headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
  279. pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' +
  280. '<td style="padding:0"><b>{point.y:.1f} 个</b></td></tr>',
  281. footerFormat: '</table>',
  282. shared: true,
  283. useHTML: true
  284. },
  285. plotOptions: {
  286. column: {
  287. pointPadding: 0.2,
  288. borderWidth: 0
  289. }
  290. },
  291. series: [{
  292. name: '总体预案',
  293. data: one
  294. }, {
  295. name: '专项预案',
  296. data: two
  297. }, {
  298. name: '现场处置方案',
  299. data: three
  300. }, {
  301. name: '部门预案',
  302. data: four
  303. }]
  304. };
  305. //alert(JSON.stringify(options));
  306. //创建chart对象
  307. $('#mycontainer').highcharts(options);
  308. }
  309. function filterHandler(data){
  310. //alert("异步");
  311. for(var i=0;i<data.rows.length;i++){
  312. //跟新每个部门 下预案数量
  313. one.push(parseInt(data.rows[i].ztPlan));
  314. two.push(parseInt(data.rows[i].zxPlan));
  315. three.push(parseInt(data.rows[i].xcczPlan));
  316. four.push(parseInt(data.rows[i].bmhj));
  317. //跟新显示部门名称
  318. deptNames.push(data.rows[i].name);
  319. }
  320. //alert(two);
  321. //alert(deptNames);
  322. //更新显示的部门名称
  323. options.xAxis.categories = deptNames;
  324. //更新每个部门下四个预案的数据
  325. options.series = [{
  326. name: '总体预案',
  327. data: one
  328. }, {
  329. name: '专项预案',
  330. data: two
  331. }, {
  332. name: '现场处置方案',
  333. data: three
  334. }, {
  335. name: '部门预案',
  336. data: four
  337. }];
  338. //重建chart对象
  339. chart = new Highcharts.Chart(options);
  340. return data;
  341. }
  342. /********************************************打开新窗口***********************************************/
  343. function addStatus(rowdata, rowindex, value, column){
  344. var comp_id='"'+rowdata.dept_id+'"';
  345. var name = '"'+value+'"';
  346. return "<a href='javascript:newHtml("+comp_id+","+name+")'>" + value +" </a>";
  347. }
  348. function newHtml(comp_id,name){
  349. if(name=="总计"){
  350. return;
  351. }else if(deptName==comp_id){
  352. return;
  353. }else{
  354. window.open("/nwyj/page/business/am/contingencyPlan/ContingencyPlanXBHuiZong1.jsp?"+comp_id);
  355. }
  356. }