bebecf0e41f36c06f516edee368140cbd9c07096.svn-base 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. Date.prototype.format = function(format){
  2. var o = {
  3. "M+":this.getMonth()+1,
  4. "d+":this.getDate(),
  5. "h+":this.getHours(),
  6. "m+":this.getMinutes(),
  7. "s+":this.getSeconds(),
  8. "q+":Math.floor((this.getMonth()+3)/3),
  9. "S":this.getMilliseconds()
  10. }
  11. if(/(y+)/.test(format)){
  12. format = format.replace(RegExp.$1,(this.getFullYear()+"").substr(4-RegExp.$1.length));
  13. }
  14. for(var k in o){
  15. if(new RegExp("("+k+")").test(format)){
  16. format = format.replace(RegExp.$1,RegExp.$1.length==1
  17. ?o[k]:("00"+o[k]).substr((""+o[k]).length));
  18. }
  19. }
  20. return format;
  21. }
  22. var pageId = 0;
  23. var last_page = function(){
  24. pageId--;
  25. if(pageId<1)
  26. pageId=5;
  27. show_page();
  28. };
  29. var next_page = function(){
  30. if($("#show_detail").val()=='false'){
  31. pageId++;
  32. if(pageId>5)
  33. pageId=1;
  34. show_page();
  35. }
  36. }
  37. var show_back = function(){
  38. if($("#show_detail").val()=='true'){
  39. $("#show_detail").val('false');
  40. show_page();
  41. return;
  42. }else{
  43. window.location.href="main.html";
  44. }
  45. }
  46. var show_iot_time=function(){
  47. var time = new Date();
  48. $("#time_label").html(time.format("yyyy-MM-dd hh:mm"));
  49. setInterval(show_iot_time,5000);
  50. }
  51. var init = function(){
  52. show_page();
  53. show_iot_time();
  54. }
  55. var show_page = function(){
  56. $("#data_div").html('');
  57. for(var i=1;i<6;i++){
  58. if($("#pager_"+i).hasClass("current_page"))
  59. $("#pager_"+i).removeClass("current_page");
  60. }
  61. if(pageId==0){
  62. if(!($("#back_div").hasClass("hidden")))
  63. $("#back_div").addClass("hidden");
  64. for(var i=1;i<6;i++){
  65. if(!($("#pager_"+i).hasClass("hidden")))
  66. $("#pager_"+i).addClass("hidden");
  67. }
  68. show_frontpage();
  69. }else{
  70. if($("#back_div").hasClass("hidden"))
  71. $("#back_div").removeClass("hidden");
  72. for(var i=1;i<6;i++){
  73. if($("#pager_"+i).hasClass("hidden"))
  74. $("#pager_"+i).removeClass("hidden");
  75. }
  76. $("#pager_"+pageId).addClass("current_page");
  77. show_page_at(pageId);
  78. }
  79. };
  80. var show_detail_at=function(page){
  81. $("#show_detail").val('true');
  82. $("#data_div").html('');
  83. alert('hello'+page);
  84. }
  85. var show_page_at = function(page){
  86. $('#data_div').highcharts({
  87. chart:{
  88. type:'pie',
  89. options3d:{
  90. enabled:true,
  91. alpha:45,
  92. beta:0
  93. },
  94. backgroundColor:'rgba(0,0,0,0)',
  95. animation:false
  96. },
  97. credits:{
  98. enabled:false
  99. },
  100. exporting:{
  101. enabled:false
  102. },
  103. pane:{
  104. size:'80%'
  105. },
  106. title:{
  107. text: page==1?'火灾监控实时信息'
  108. :page==2?'电气火灾监控实时信息'
  109. :page==3?'消防水系统监控实时信息'
  110. :page==4?'通道监控实时信息'
  111. :'消防电源监控实时信息',
  112. style:{
  113. color:'#ffffff',fontSize:'18pt',x:-30,y:30
  114. }
  115. },
  116. tooltip: {
  117. pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
  118. },
  119. legend:{
  120. itemStyle:{
  121. color:'#ffffff',fontSize:'14pt'
  122. },
  123. itemWidth:160,
  124. align:'right',
  125. verticalAlign:'top',
  126. y:70,
  127. layout:'vertical',
  128. labelFormat:'{name}: <b>{y:.1f}%</b>'
  129. },
  130. plotOptions: {
  131. pie: {
  132. events:{
  133. click:function(event){
  134. show_detail_at(page);
  135. }
  136. },
  137. allowPointSelect: true,
  138. cursor: 'pointer',
  139. depth: 35,
  140. dataLabels: {
  141. enabled: true,
  142. style:{
  143. color:'#ffffff',fontSize:'14pt'
  144. }
  145. },
  146. showInLegend:true
  147. },
  148. series:{animation:false}
  149. },
  150. colors:['#ffa400','#ff4646','#60ff4d'],
  151. series: [{
  152. type: 'pie',
  153. name: '占比',
  154. data: [
  155. ['离线', page==1?0.0
  156. :page==2?25.0
  157. :page==3?0.0
  158. :page==4?0.0
  159. :0.0],
  160. ['告警', page==1?0.0
  161. :page==2?0.0
  162. :page==3?20.0
  163. :page==4?0.0
  164. :12.5],
  165. [ '正常',page==1?100.0
  166. :page==2?75.0
  167. :page==3?80.0
  168. :page==4?100.0
  169. :87.5]
  170. ],
  171. pointPlacement:'on'
  172. }]
  173. });
  174. }
  175. var show_frontpage = function(){
  176. $('#data_div').highcharts({
  177. chart:{
  178. polar:true,
  179. color:'#ffffff',
  180. backgroundColor:'rgba(0,0,0,0)',
  181. type:'line',
  182. animation:false
  183. },
  184. credits:{
  185. enabled:false
  186. },
  187. exporting:{
  188. enabled:false
  189. },
  190. plotOptions:{
  191. series:{animation:false}
  192. },
  193. colors:['#4dffff','#ffa400','#ff4646','#60ff4d'],
  194. title:{
  195. style:{
  196. color:'#ffffff',
  197. fontSize:'20pt'
  198. },
  199. text:'本地消防信息汇总',
  200. x: -80,y:30
  201. },
  202. pane:{
  203. size:'80%'
  204. },
  205. xAxis:{
  206. labels:{
  207. style:{
  208. color:'#ffffff',
  209. fontSize:'14pt'
  210. }
  211. },
  212. categories:['火灾监控','电气火灾监控','消防水系统监控','通道监控','消防电源监控'],
  213. tickmarkPlacement:'on',
  214. lineWidth:0
  215. },
  216. yAxis:{
  217. labels:{
  218. style:{
  219. color:'#ffffff'
  220. }
  221. },
  222. gridLineInterpolation:'polygon',
  223. lineWidth:0,
  224. min:0
  225. },
  226. legend:{
  227. itemStyle:{
  228. color:'#ffffff',
  229. fontSize:'14pt'
  230. },
  231. align:'right',
  232. verticalAlign:'top',
  233. y:50,
  234. layout:'vertical'
  235. },
  236. series:[{
  237. name:'监控点数量',
  238. data:[8,4,5,3,8],
  239. pointPlacement:'on'
  240. },{
  241. name:'监控点离线数量',
  242. data:[0,1,0,0,0],
  243. pointPlacement:'on'
  244. },{
  245. name:'监控点告警数量',
  246. data:[0,0,1,0,1],
  247. pointPlacement:'on'
  248. },{
  249. name:'监控点正常数量',
  250. data:[8,3,4,3,7],
  251. pointPlacement:'on'
  252. }]
  253. });
  254. }