17c33b45281ca651d784f03b51c70c29d3c7af3e.svn-base 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383
  1. var deptName = top.com.sinosoft.lz.system.user.LoginInfo.getDeptids();
  2. //数据表格
  3. var g;
  4. var myCols = [{
  5. display: '法律法规', name: 'law', width: "20%", align: 'center'
  6. },{
  7. display: '政府公文', name: 'administrationReg', width: "20%", align: 'center'
  8. },{
  9. display: '国标行标', name: 'localReg', width: "20%", align: 'center'
  10. },{
  11. display: '企业公文', name: 'administrationRul', width: "20%", align: 'center'
  12. }];
  13. var columns = [
  14. {display: '制度文件分类', columns: myCols, width: "80%"},
  15. {display: '合计', name: 'num', width: "20%", align: 'center'}
  16. ];
  17. var json ="";
  18. var loadData;
  19. //柱状图
  20. var option = {
  21. title : {
  22. text: '应急制度文件汇总统计图',
  23. subtext: '/个'
  24. },
  25. tooltip : {
  26. trigger: 'axis'
  27. },
  28. legend: {
  29. y : 'bottom',
  30. data:['法律法规','政府公文','国标行标','企业公文']
  31. },
  32. toolbox: {
  33. show : true,
  34. feature : {
  35. mark : {show: true},
  36. dataView : {show: false, readOnly: false},
  37. magicType : {show: false, type: ['line', 'bar']},
  38. restore : {show: true},
  39. saveAsImage : {show: true}
  40. }
  41. },
  42. calculable : true,
  43. xAxis : [
  44. {
  45. type : 'category',
  46. data : ['应急制度文件汇总']
  47. }
  48. ],
  49. yAxis : [
  50. {
  51. type : 'value'
  52. }
  53. ],
  54. series : [
  55. {
  56. name:'法律法规',
  57. type:'bar',
  58. data:[4]
  59. },
  60. {
  61. name:'政府公文',
  62. type:'bar',
  63. data:[5]
  64. },
  65. {
  66. name:'国标行标',
  67. type:'bar',
  68. data:[6]
  69. },
  70. {
  71. name:'企业公文',
  72. type:'bar',
  73. data:[7]
  74. }
  75. ]
  76. };
  77. function changeBarOption(data){
  78. var seriesData=[];
  79. var data1=[];
  80. var data2=[];
  81. var data3=[];
  82. var data4=[];
  83. for(var i=0;i<data.rows.length;i++){
  84. data1[i]=data.rows[i].law;
  85. data2[i]=data.rows[i].administrationReg;
  86. data3[i]=data.rows[i].localReg;
  87. data4[i]=data.rows[i].administrationRul;
  88. }
  89. var series1={ name:'法律法规',
  90. type:'bar',
  91. data:data1
  92. };
  93. var series2={ name:'政府公文',
  94. type:'bar',
  95. data:data2
  96. };
  97. var series3={ name:'国标行标',
  98. type:'bar',
  99. data:data3
  100. };
  101. var series4={ name:'企业公文',
  102. type:'bar',
  103. data:data4
  104. };
  105. seriesData=[series1,series2,series3,series4];
  106. option.series=seriesData;
  107. }
  108. //折线图option1
  109. var option1 = {
  110. title : {
  111. text: '应急制度文件汇总统计图',
  112. subtext: '/个'
  113. },
  114. tooltip : {
  115. trigger: 'axis'
  116. },
  117. legend: {
  118. y:'bottom',
  119. data:['应急制度文件汇总']
  120. },
  121. toolbox: {
  122. show : true,
  123. feature : {
  124. mark : {show: true},
  125. dataView : {show: false, readOnly: false},
  126. magicType : {show: false, type: ['line', 'bar', 'stack', 'tiled']},
  127. restore : {show: true},
  128. saveAsImage : {show: true}
  129. }
  130. },
  131. calculable : true,
  132. xAxis : [
  133. {
  134. type : 'category',
  135. boundaryGap : false,
  136. data : ['法律法规','政府公文','国标行标','企业公文']
  137. }
  138. ],
  139. yAxis : [
  140. {
  141. type : 'value'
  142. }
  143. ],
  144. series : [
  145. {
  146. name:'应急制度文件汇总',
  147. type:'line',
  148. data:[20, 30, 50,40]
  149. }
  150. ]
  151. };
  152. function changeLineOption(data){
  153. var seriesData=[];
  154. var data1=[data.rows[0].law,data.rows[0].administrationReg,data.rows[0].localReg,data.rows[0].administrationRul,];
  155. var series1={ name:'应急制度文件汇总',
  156. type:'line',
  157. data:data1
  158. };
  159. seriesData=[series1];
  160. option1.series=seriesData;
  161. }
  162. //饼图option2
  163. var option2 = {
  164. title : {
  165. text: '应急制度文件汇总统计图',
  166. subtext: '/个'
  167. },
  168. tooltip : {
  169. trigger: 'item',
  170. formatter: "{a} <br/>{b} : {c} ({d}%)"
  171. },
  172. legend: {
  173. y : 'bottom',
  174. data:['法律法规','政府公文','国标行标','企业公文']
  175. },
  176. toolbox: {
  177. show : true,
  178. feature : {
  179. mark : {show: true},
  180. dataView : {show: false, readOnly: false},
  181. magicType : {
  182. show: false,
  183. type: ['pie', 'funnel'],
  184. option: {
  185. funnel: {
  186. x: '25%',
  187. width: '50%',
  188. funnelAlign: 'left',
  189. max: 1548
  190. }
  191. }
  192. },
  193. restore : {show: true},
  194. saveAsImage : {show: true}
  195. }
  196. },
  197. calculable : true,
  198. series : [
  199. {
  200. name:'应急制度文件汇总',
  201. type:'pie',
  202. radius : '55%',
  203. center: ['50%', '55%'],
  204. data:[
  205. {value:335, name:'法律法规'},
  206. {value:310, name:'政府公文'},
  207. {value:234, name:'国标行标'},
  208. {value:135, name:'企业公文'}
  209. ]
  210. }
  211. ]
  212. };
  213. function changePieOption2(data){
  214. /*************************************************** 初始化解析饼图数据 start**********************************************************/
  215. //option2.legend.data=['总体预案','专项预案','现场处置方案','部门预案'];
  216. var index=data.rows.length-1;
  217. var seriesJson=[];
  218. var j=0;
  219. if(data.rows[index]["law"]!=undefined){
  220. var json={value:data.rows[index]["law"],name:'法律法规'};
  221. seriesJson[j]=json;
  222. j++;
  223. }
  224. if(data.rows[index]["administrationReg"]!=undefined){
  225. var json={value:data.rows[index]["administrationReg"],name:'政府公文'};
  226. seriesJson[j]=json;
  227. j++;
  228. }
  229. if(data.rows[index]["localReg"]!=undefined){
  230. var json={value:data.rows[index]["localReg"],name:'国标行标'};
  231. seriesJson[j]=json;
  232. j++;
  233. }
  234. if(data.rows[index]["administrationRul"]!=undefined){
  235. var json={value:data.rows[index]["administrationRul"],name:'企业公文'};
  236. seriesJson[j]=json;
  237. j++;
  238. }
  239. option2.series[0].data=seriesJson;
  240. /*************************************************** 初始化解析饼图数据 end **********************************************************/
  241. }
  242. //初始化方法
  243. $(function(){
  244. $("body").eq(0).showLoading();
  245. $.post($.pathname()+ "/ws/LAWSPOLL/LawsService/getTotalFile",{id : deptName},function (data){
  246. json = data;
  247. //给表格数据赋值
  248. loadData= data;
  249. //初始化表格
  250. initCompletes(json);
  251. $("body").eq(0).hideLoading();
  252. changeBarOption(data);
  253. changeLineOption(data);
  254. changePieOption2(data);
  255. var myChart1 = echarts.init(document.getElementById('main1'));
  256. myChart1.setOption(option);
  257. $(".basicTab").bind('actived',function(e,i){
  258. if(i==0){
  259. /***************************************** 加载柱状图 *********************************************************/
  260. var myChart1 = echarts.init(document.getElementById('main1'));
  261. myChart1.setOption(option);
  262. // initmyGraphic(data);
  263. }else if(i == 1){
  264. /***************************************** 加载折线图 *********************************************************/
  265. var myChart5 = echarts.init(document.getElementById('main2'));
  266. myChart5.setOption(option1);
  267. }else if(i==2){
  268. /***************************************** 加载饼图 *********************************************************/
  269. var myChart2 = echarts.init(document.getElementById('main3'));
  270. myChart2.setOption(option2);
  271. }
  272. });
  273. /***************************************** 加载图表 End *********************************************************/
  274. },"json" );
  275. });
  276. //发送请求,从后台获取数据
  277. function getNewValue(){
  278. //发布日期
  279. var pushStartTime = $('#beginTime1').val();
  280. var pushEndTime = $('#endTime1').val();
  281. $.post($.pathname()+ "/ws/LAWSPOLL/LawsService/getTotalFile",
  282. {id : deptName,StartTime:pushStartTime,EndTime:pushEndTime},
  283. function (data){
  284. json = data;
  285. //给表格数据赋值
  286. loadData= data;
  287. //初始化表格
  288. initCompletes(json);
  289. },"json" );
  290. }
  291. //点击统计按钮触发的事件
  292. function getCount(){
  293. getNewValue();
  294. }
  295. function initCompletes(json){
  296. g = $("#maingrid").quiGrid({
  297. columns: columns,
  298. data:json,
  299. rownumbers : true,
  300. usePager : false
  301. });
  302. /* //重设高度
  303. $(parent.document.body).find("iframe").height(480);
  304. $(top.document.body).find("#frmright").height(480);*/
  305. /*重新绑定父页面事件方法*/
  306. //绑定点击时样式变化事件
  307. $(parent.document.body).find(".leftnav").live("click",parent.checkedCurrent);
  308. //定期报送组点击事件
  309. $(parent.document.body).find(".baosong").live("click",parent.changebaosong);
  310. //定期维护组点击事件
  311. $(parent.document.body).find(".weihu").live("click",parent.changeweihu);
  312. $(parent.document.body).find(".weihu1").live("click",parent.changeweihu1);
  313. /*重新绑定父页面事件方法*/
  314. }
  315. function addStatus(rowdata, rowindex, value, column){
  316. var comp_id='"'+rowdata.dept_id+'"';
  317. var name = '"'+value+'"';
  318. return "<a href='javascript:newHtml("+comp_id+","+name+")'>" + value +" </a>";
  319. }
  320. function newHtml(comp_id,name){
  321. if(name=="总计"){
  322. return;
  323. }else if(deptName==comp_id){
  324. return;
  325. }else{
  326. window.open("/nwyj/page/business/am/fileManager/laws/laws_poll1.jsp?"+comp_id);
  327. // window.location.href = "/nwyj/page/business/am/resource/expert/expert-poll.jsp?"+comp_id;
  328. // alert(comp_id);
  329. }
  330. }
  331. //返回
  332. function goBack() {
  333. window.location.href="laws.jsp";
  334. }
  335. //打印
  336. function print(){
  337. //alert(1111);
  338. $("#maingrid").jqprint();
  339. }
  340. $.messager=top.Dialog;