month_view.html 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456
  1. {extend name="common/common2" /}
  2. {block name="main"}
  3. <div class="ibox-content">
  4. <div class="row">
  5. <div class="col-xs-12" >
  6. <form action="{:url('energyStatistics/monthView')}" method="POST" id='search_form' class="form-inline">
  7. <div class="input-group" style="width: 200px">
  8. <span class="input-group-addon">年份</span>
  9. <input class="form-control dialog-datetime" id="start" name="month" type="text" data-date-format="yyyy-mm" value="{$month}" placeholder="" readonly/>
  10. </div>
  11. <div class="input-group " style="width: 200px">
  12. <span class="input-group-addon">科室</span>
  13. <select name="depId" class="form-control">
  14. {foreach $dep as $k => $v}
  15. <option value="{$v.id}" {if $depId == $v.id} selected {/if}>{$v.name}</option>
  16. {/foreach}
  17. </select>
  18. </div>
  19. <div class="input-group">
  20. <span class="input-group-btn">
  21. <button class="btn-sm btn-danger" type="submit" ><i class="fa fa-search"></i></button>
  22. </span>&nbsp;
  23. <span class="input-group-btn">
  24. <button class="btn-sm btn-warning" type="reset" onclick="empty_search()"><i class="fa fa-undo"></i></button>
  25. </span>
  26. </div>
  27. </form>
  28. </div>
  29. </div>
  30. <br>
  31. <div class="ibox">
  32. <div class="panel-group">
  33. <div class="panel panel-default">
  34. <div class="panel-heading clearfix">
  35. <div class="btn-group pull-left">
  36. {$depName}每月能耗数据分析
  37. </div>
  38. <div class="btn-group pull-right">
  39. </div>
  40. </div>
  41. <div class="panel-body" id="printer">
  42. <div id="echarts1" style="width: 100%;height: 350px">
  43. </div>
  44. <div id="echarts2" style="width: 100%;height: 350px">
  45. </div>
  46. <div id="echarts3" style="width: 100%;height: 350px">
  47. </div>
  48. </div>
  49. </div>
  50. </div>
  51. </div>
  52. </div>
  53. {/block}
  54. {block name="script"}
  55. <script src="/static/browser.js"></script>
  56. <script src="/static/jquery.jqprint-0.3.js"></script>
  57. <script src="/static/data/js/echarts.js"></script>
  58. <script>
  59. $(function () {
  60. laydate.render({
  61. elem: '#start',
  62. trigger: 'click',
  63. theme: '#1d519c',
  64. type: 'year',
  65. });
  66. });
  67. function printer(){
  68. $('#printer').jqprint();
  69. }
  70. function empty_search(){
  71. window.location.href = "{:url('energyStatistics/monthView')}";
  72. }
  73. var colors = [ '#d14a61','#5793f3', '#91c7ae'];
  74. var option = {
  75. tooltip: {
  76. trigger: 'axis',
  77. axisPointer: {
  78. type: 'cross',
  79. crossStyle: {
  80. color: '#999'
  81. }
  82. }
  83. },
  84. legend: {
  85. data: [
  86. '{$month-1}用电量', '{$month}用电量',
  87. '{$month}月度平均最高温度','{$month}月度平均最低温度',
  88. '{$month-1}月度平均最高温度','{$month-1}月度平均最低温度',
  89. '床位数量'
  90. ]
  91. },
  92. xAxis: [
  93. {
  94. type: 'category',
  95. data: {:json_encode($monthList)},
  96. axisPointer: {
  97. type: 'shadow'
  98. }
  99. }
  100. ],
  101. yAxis: [
  102. {
  103. type: 'value',
  104. name: '使用量',
  105. offset: 5,
  106. splitLine:{
  107. show:false
  108. },
  109. axisLine: {
  110. show: true,
  111. lineStyle: {
  112. color: colors[0],
  113. }
  114. },
  115. axisLabel: {
  116. formatter: '{value} kWh'
  117. }
  118. },
  119. {
  120. type: 'value',
  121. name: '温度',
  122. splitLine:{
  123. show:false
  124. },
  125. axisLine: {
  126. show: true,
  127. lineStyle: {
  128. color: colors[1],
  129. }
  130. },
  131. axisLabel: {
  132. formatter: '{value} ℃'
  133. }
  134. },
  135. {
  136. type: 'value',
  137. name: '床位数量',
  138. position: 'right',
  139. alignTicks: true,
  140. offset: 60,
  141. splitLine:{
  142. show:false
  143. },
  144. axisLine: {
  145. show: true,
  146. lineStyle: {
  147. color: colors[2],
  148. }
  149. },
  150. axisLabel: {
  151. formatter: '{value} 个'
  152. }
  153. }
  154. ],
  155. series: [
  156. {
  157. name: '{$month-1}用电量',
  158. type: 'bar',
  159. barWidth: 12,
  160. data: {:json_encode($data['lastElectricity'])},
  161. },
  162. {
  163. name: '{$month}用电量',
  164. type: 'bar',
  165. barWidth: 12,
  166. data: {:json_encode($data['electricity'])},
  167. },
  168. {
  169. name: '{$month}月度平均最高温度',
  170. type: 'line',
  171. yAxisIndex: 1,
  172. data: {:json_encode($data['tempMax'])},
  173. },
  174. {
  175. name: '{$month}月度平均最低温度',
  176. type: 'line',
  177. yAxisIndex: 1,
  178. data: {:json_encode($data['tempMin'])},
  179. },
  180. {
  181. name: '{$month-1}月度平均最高温度',
  182. type: 'line',
  183. yAxisIndex: 1,
  184. data: {:json_encode($data['LastTempMax'])},
  185. lineStyle: {
  186. type: 'dashed'
  187. },
  188. },
  189. {
  190. name: '{$month-1}月度平均最低温度',
  191. type: 'line',
  192. yAxisIndex: 1,
  193. data: {:json_encode($data['LastTempMin'])},
  194. lineStyle: {
  195. type: 'dashed'
  196. },
  197. itemStyle: {
  198. color: '#5470C6' // 绿色
  199. }
  200. },
  201. {
  202. name: '床位数量',
  203. type: 'line',
  204. yAxisIndex: 2,
  205. data: {:json_encode($data['beds'])},
  206. itemStyle: {
  207. color: '#ee6666'
  208. }
  209. },
  210. ]
  211. };
  212. var myChart = echarts.init(document.getElementById('echarts1'));
  213. myChart.setOption(option);
  214. var option2 = {
  215. tooltip: {
  216. trigger: 'axis',
  217. axisPointer: {
  218. type: 'cross',
  219. crossStyle: {
  220. color: '#999'
  221. }
  222. }
  223. },
  224. legend: {
  225. data: ['{$month-1}用水量', '{$month-1}用水量', '{$month}月度平均最高温度','{$month}月度平均最低温度','床位数量']
  226. },
  227. xAxis: [
  228. {
  229. type: 'category',
  230. data: {:json_encode($monthList)},
  231. axisPointer: {
  232. type: 'shadow'
  233. }
  234. }
  235. ],
  236. yAxis: [
  237. {
  238. type: 'value',
  239. name: '使用量',
  240. offset: 5,
  241. splitLine:{
  242. show:false
  243. },
  244. axisLine: {
  245. show: true,
  246. lineStyle: {
  247. color: colors[0],
  248. }
  249. },
  250. axisLabel: {
  251. formatter: '{value} m³'
  252. }
  253. },
  254. {
  255. type: 'value',
  256. name: '温度',
  257. splitLine:{
  258. show:false
  259. },
  260. axisLine: {
  261. show: true,
  262. lineStyle: {
  263. color: colors[1],
  264. }
  265. },
  266. axisLabel: {
  267. formatter: '{value} ℃'
  268. }
  269. },
  270. {
  271. type: 'value',
  272. name: '床位数量',
  273. position: 'right',
  274. alignTicks: true,
  275. offset: 60,
  276. splitLine:{
  277. show:false
  278. },
  279. axisLine: {
  280. show: true,
  281. lineStyle: {
  282. color: colors[2],
  283. }
  284. },
  285. axisLabel: {
  286. formatter: '{value} 个'
  287. }
  288. }
  289. ],
  290. series: [
  291. {
  292. name: '{$month-1}用水量',
  293. type: 'bar',
  294. barWidth: 12,
  295. data: {:json_encode($data['lastWater'])},
  296. },
  297. {
  298. name: '{$month}用水量',
  299. type: 'bar',
  300. barWidth: 12,
  301. data: {:json_encode($data['water'])},
  302. },
  303. {
  304. name: '{$month}月度平均最高温度',
  305. type: 'line',
  306. yAxisIndex: 1,
  307. data: {:json_encode($data['tempMax'])},
  308. },
  309. {
  310. name: '{$month}月度平均最低温度',
  311. type: 'line',
  312. yAxisIndex: 1,
  313. data: {:json_encode($data['tempMin'])},
  314. },
  315. {
  316. name: '床位数量',
  317. type: 'line',
  318. yAxisIndex: 2,
  319. data: {:json_encode($data['beds'])},
  320. },
  321. ]
  322. };
  323. var myChart2 = echarts.init(document.getElementById('echarts2'));
  324. myChart2.setOption(option2);
  325. var option3 = {
  326. tooltip: {
  327. trigger: 'axis',
  328. axisPointer: {
  329. type: 'cross',
  330. crossStyle: {
  331. color: '#999'
  332. }
  333. }
  334. },
  335. legend: {
  336. data: ['{$month-1}燃气用量', '{$month}燃气用量', '{$month}月度平均最高温度','{$month}月度平均最低温度','床位数量']
  337. },
  338. xAxis: [
  339. {
  340. type: 'category',
  341. data: {:json_encode($monthList)},
  342. axisPointer: {
  343. type: 'shadow'
  344. }
  345. }
  346. ],
  347. yAxis: [
  348. {
  349. type: 'value',
  350. name: '使用量 ',
  351. offset: 5,
  352. splitLine:{
  353. show:false
  354. },
  355. axisLine: {
  356. show: true,
  357. lineStyle: {
  358. color: colors[0],
  359. }
  360. },
  361. axisLabel: {
  362. formatter: '{value} m³'
  363. }
  364. },
  365. {
  366. type: 'value',
  367. name: '温度',
  368. splitLine:{
  369. show:false
  370. },
  371. axisLine: {
  372. show: true,
  373. lineStyle: {
  374. color: colors[1],
  375. }
  376. },
  377. axisLabel: {
  378. formatter: '{value} ℃'
  379. }
  380. },
  381. {
  382. type: 'value',
  383. name: '床位数量',
  384. position: 'right',
  385. alignTicks: true,
  386. offset: 60,
  387. splitLine:{
  388. show:false
  389. },
  390. axisLine: {
  391. show: true,
  392. lineStyle: {
  393. color: colors[2],
  394. }
  395. },
  396. axisLabel: {
  397. formatter: '{value} 个'
  398. }
  399. }
  400. ],
  401. series: [
  402. {
  403. name: '{$month-1}燃气用量',
  404. type: 'bar',
  405. barWidth: 12,
  406. data: {:json_encode($data['lastGas'])},
  407. },
  408. {
  409. name: '{$month}燃气用量',
  410. type: 'bar',
  411. barWidth: 12,
  412. data: {:json_encode($data['gas'])},
  413. },
  414. {
  415. name: '{$month}月度平均最高温度',
  416. type: 'line',
  417. yAxisIndex: 1,
  418. data: {:json_encode($data['tempMax'])},
  419. },
  420. {
  421. name: '{$month}月度平均最低温度',
  422. type: 'line',
  423. yAxisIndex: 1,
  424. data: {:json_encode($data['tempMin'])},
  425. },
  426. {
  427. name: '床位数量',
  428. type: 'line',
  429. yAxisIndex: 2,
  430. data: {:json_encode($data['beds'])},
  431. },
  432. ]
  433. };
  434. var myChart3 = echarts.init(document.getElementById('echarts3'));
  435. myChart3.setOption(option3);
  436. </script>
  437. {/block}