view.html 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. {extend name="common/common2" /}
  2. {block name="main"}
  3. <div class="ibox">
  4. <div class="ibox-content">
  5. <div class="row">
  6. <div class="col-xs-12" style="text-align: right;">
  7. <form action="{:url('WasteStatistics/view')}" method="GET" id='search_form' class="form-inline">
  8. <div class="input-group">
  9. <select name="addr_id" class="form-control">
  10. <option value="">选择地点</option>
  11. {foreach $address as $k=>$v}
  12. <option {if $addr_id==$v['id']} selected {/if} value="{$v['id']}">{$v['title']}</option>
  13. {/foreach}
  14. </select>
  15. </div>
  16. <div class="input-group">
  17. <select name="dep_id" class="form-control">
  18. <option value="">选择科室</option>
  19. {foreach $dep as $k=>$v}
  20. <option {if $dep_id==$v['id']} selected {/if} value="{$v['id']}">{$v['title']}</option>
  21. {/foreach}
  22. </select>
  23. </div>
  24. <div class="input-group">
  25. <select name="type_id" class="form-control">
  26. <option value="">选择类型</option>
  27. {foreach $typeList as $k=>$v}
  28. <option {if $type_id==$v['id']} selected {/if} value="{$v['id']}">{$v['title']}</option>
  29. {/foreach}
  30. </select>
  31. </div>
  32. <div class="input-group" style="width: 200px">
  33. <span class="input-group-addon">月份</span>
  34. <input class="form-control dialog-datetime" id="endTime" name="month" type="text" data-date-format="yyyy-mm" value="{$month}" placeholder="" readonly/>
  35. </div>
  36. <div class="input-group">
  37. <span class="input-group-btn">
  38. <button class="btn-sm btn-primary" type="submit" ><i class="fa fa-search"></i></button>
  39. </span>&nbsp;
  40. <span class="input-group-btn">
  41. <button class="btn-sm btn-warning" type="reset" onclick="empty_search()"><i class="fa fa-undo"></i></button>
  42. </span>
  43. &nbsp;
  44. <span class="input-group-btn">
  45. <button data-url="{:url('viewExport')}" title="导出" class="btn-sm btn-primary" onclick="excel_download(this)" type="button" ><i class="fa fa-cloud-download"></i></button>
  46. </span>
  47. </div>
  48. </form>
  49. </div>
  50. </div>
  51. </div>
  52. <div class="ibox-content">
  53. <div id="charts1" style="height: 300px">
  54. </div>
  55. </div>
  56. <div class="ibox-content">
  57. <div id="charts2" style="height: 400px">
  58. </div>
  59. </div>
  60. <div class="ibox-content">
  61. <div id="charts3" style="height: 300px;">
  62. </div>
  63. </div>
  64. <div class="ibox-content">
  65. <div id="charts4" style="height: 300px;">
  66. </div>
  67. </div>
  68. </div>
  69. {/block}
  70. {block name="script"}
  71. <script src="/static/layDate-v5.0.9/laydate.js"></script>
  72. <script src="/static/browser.js"></script>
  73. <script src="/static/jquery.jqprint-0.3.js"></script>
  74. <script src="/static/echarts.js"></script>
  75. <script>
  76. $(function () {
  77. laydate.render({
  78. elem: '#startTime',
  79. trigger: 'click',
  80. theme: '#1d519c',
  81. type: 'year',
  82. });
  83. laydate.render({
  84. elem: '#endTime',
  85. trigger: 'click',
  86. theme: '#1d519c',
  87. type: 'month',
  88. });
  89. });
  90. function empty_search(){
  91. window.location.href = "{:url('WasteStatistics/view')}";
  92. }
  93. function printer(){
  94. $('#printer').jqprint();
  95. }
  96. //导出
  97. function excel_download(_self){
  98. var url = $(_self).attr('data-url');
  99. var param = $('#form-search').serialize();
  100. window.location.href = url+'?'+param;
  101. }
  102. option = {
  103. title:{
  104. text:"{$month}月各类型废弃物统计(kg)",
  105. left: 'center',//主副标题的水平位置
  106. },
  107. tooltip: {
  108. trigger: 'axis',
  109. axisPointer: {
  110. type: 'shadow'
  111. }
  112. },
  113. xAxis: {
  114. type: 'category',
  115. data: {:json_encode($data['name1'])},
  116. },
  117. yAxis: {
  118. type: 'value'
  119. },
  120. series: [
  121. {
  122. data: {:json_encode($data['data1'])},
  123. type: 'bar'
  124. }
  125. ]
  126. };
  127. var myChart1 = echarts.init(document.getElementById('charts1'));
  128. myChart1.setOption(option);
  129. option = {
  130. title:{
  131. text:"{$month}月各类型废弃物比例",
  132. left: 'center',//主副标题的水平位置
  133. },
  134. legend: {
  135. left: 'left',
  136. x : '46%',
  137. y : '1%',
  138. orient : 'vertical',
  139. },
  140. series: [
  141. {
  142. type: 'pie',
  143. avoidLabelOverlap: false,
  144. itemStyle: {
  145. emphasis: {
  146. shadowBlur: 10,
  147. shadowOffsetX: 0,
  148. shadowColor: 'rgba(0, 0, 0, 0.5)'
  149. },
  150. normal:{
  151. label:{
  152. show: true,
  153. formatter: '{b}:{c}({d}%)'
  154. },
  155. labelLine :{show:true}
  156. }
  157. },
  158. labelLine: {
  159. show: false
  160. },
  161. data: {:json_encode($data['data2'])},
  162. }
  163. ]
  164. };
  165. var myChart2 = echarts.init(document.getElementById('charts2'));
  166. myChart2.setOption(option);
  167. option = {
  168. title:{
  169. text:"{$month}月废弃物各类型数据一览(kg)",
  170. left: 'center',//主副标题的水平位置
  171. },
  172. tooltip: {
  173. trigger: 'axis'
  174. },
  175. legend: {
  176. data: {:json_encode($data['name1'])},
  177. left: 'center',
  178. top:'10%'
  179. },
  180. grid: {
  181. left: '3%',
  182. right: '4%',
  183. bottom: '3%',
  184. containLabel: true
  185. },
  186. xAxis: {
  187. type: 'category',
  188. boundaryGap: false,
  189. data: {:json_encode($data['name2'])}
  190. },
  191. yAxis: {
  192. type: 'value'
  193. },
  194. series: {:json_encode($data['data3'])}
  195. };
  196. var myChart3 = echarts.init(document.getElementById('charts3'));
  197. myChart3.setOption(option);
  198. option = {
  199. title:{
  200. text:"{$month}月科室前10废弃物各类型数据一览(kg)",
  201. left: 'center',//主副标题的水平位置
  202. },
  203. tooltip: {
  204. trigger: 'axis'
  205. },
  206. legend: {
  207. data: {:json_encode($data['name1'])},
  208. left: 'center',
  209. top:'10%'
  210. },
  211. grid: {
  212. left: '3%',
  213. right: '4%',
  214. bottom: '3%',
  215. containLabel: true
  216. },
  217. xAxis: {
  218. type: 'category',
  219. boundaryGap: false,
  220. data: {:json_encode($data['name3'])}
  221. },
  222. yAxis: {
  223. type: 'value'
  224. },
  225. series: {:json_encode($data['data4'])}
  226. };
  227. var myChart4 = echarts.init(document.getElementById('charts4'));
  228. myChart4.setOption(option);
  229. </script>
  230. {/block}