public_dep_total.html 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. {extend name="common/common2" /}
  2. {block name="main"}
  3. <style>
  4. .table th{
  5. text-align: center;
  6. background: #ffffff;
  7. }
  8. .table tr{
  9. background: #ffffff;
  10. }
  11. .table td{
  12. text-align: center;
  13. max-width:100px ;
  14. }
  15. /* 基本表格元素 */
  16. table {
  17. border-collapse: collapse;
  18. }
  19. th,td {
  20. border: 1px solid #666;
  21. padding: 5px;
  22. }
  23. .split {
  24. height: 50px;
  25. }
  26. /* th单元格 */
  27. .slash-wrap {
  28. position: relative;
  29. box-sizing: border-box;
  30. width: 150px;
  31. height: 80px;
  32. }
  33. /* 斜线 */
  34. .slash {
  35. position: absolute;
  36. display: block;
  37. top: 0;
  38. left: 0;
  39. /* 斜边边长 */
  40. /* Math.sqrt(Math.pow(width, 2) + Math.pow(height, 2)) */
  41. /* Math.sqrt(Math.pow(150, 2) + Math.pow(80, 2)) = 170 */
  42. width: 234px;
  43. height: 1px;
  44. background-color:#666;
  45. /* 旋转角度计算公式 */
  46. /* Math.atan(height / width) * 180 / Math.PI */
  47. /* Math.atan(80 / 150) * 180 / Math.PI = 28.072486935852954 */
  48. transform: rotate(12.072486935852954deg);
  49. transform-origin: top left;
  50. }
  51. .slash2 {
  52. position: absolute;
  53. display: block;
  54. top: 0;
  55. left: 0;
  56. width: 158px;
  57. height: 1px;
  58. background-color:#666;
  59. transform: rotate(30.5deg);
  60. transform-origin: top left;
  61. }
  62. /* 左下角文字 */
  63. .left {
  64. position: absolute;
  65. /* 左下角 left:0; bottom: 0; */
  66. left: 15px;
  67. bottom: 15px;
  68. }
  69. /* 中间文字 */
  70. .middle {
  71. position: absolute;
  72. /* 左下角 left:0; bottom: 0; */
  73. left: 148px;
  74. bottom: 10px;
  75. }
  76. /* 右上角文字 */
  77. .right {
  78. position: absolute;
  79. /* 右上角 right:0; top: 0; */
  80. right: 15px;
  81. top: 15px;
  82. }
  83. </style>
  84. <div class="ibox-content">
  85. <div class="ibox">
  86. <div class="alert">
  87. <form action="publicDepTotal" method="GET" id='search_form' class="form-inline">
  88. <div class="input-group" style="width: 200px">
  89. <span class="input-group-addon">选择日期</span>
  90. <input class="form-control dialog-datetime" id="startTime" name="start" type="text" data-date-format="yyyy-mm-dd" value="{$start}" placeholder="" readonly/>
  91. </div>
  92. <div class="input-group" style="width: 200px">
  93. <span class="input-group-addon">分摊方式</span>
  94. <select name="type" class="form-control">
  95. <option value="0" {if $type =='0'}selected {/if}>面积占比</option>
  96. <option value="1" {if $type =='1'}selected {/if}>电量能耗占比</option>
  97. </select>
  98. </div>
  99. <div class="input-group">
  100. <span class="input-group-btn">
  101. <button class="btn-sm btn-danger" type="submit" ><i class="fa fa-search"></i></button>
  102. </span>&nbsp;
  103. <span class="input-group-btn">
  104. <button class="btn-sm btn-warning" type="reset" onclick="empty_search()"><i class="fa fa-undo"></i></button>
  105. </span>
  106. </div>
  107. </form>
  108. </div>
  109. <div class="panel-group">
  110. <div class="panel panel-default">
  111. <div class="panel-heading clearfix">
  112. <div class="btn-group pull-left">
  113. 科室水、电总使用量
  114. </div>
  115. <div class="btn-group pull-right">
  116. <a href="javascript:;" onclick="printer()" class="btn btn-sm btn btn-primary"><i class="glyphicon glyphicon-print"></i>打印</a>
  117. <a href="javascript:;" onclick="excel_download(this)" class="btn btn-other btn-sm"><i class="glyphicon glyphicon-download"></i>导出</a>
  118. </div>
  119. </div>
  120. <div class="panel-body" id="printer">
  121. <table class="table table-bordered">
  122. <thead>
  123. <th class="slash-wrap" colspan="2">
  124. <span class="left">科室</span>
  125. <span class="slash"></span>
  126. <span class="middle">水、电量</span>
  127. <span class="slash2"></span>
  128. <span class="right">月份</span>
  129. </th>
  130. {foreach $monthList as $v}
  131. <th>{$v}</th>
  132. {/foreach}
  133. <th>总计</th>
  134. </thead>
  135. <tbody>
  136. {if empty($data)}
  137. <tr>
  138. <td colspan="15">暂无数据</td>
  139. </tr>
  140. {/if}
  141. {foreach $data as $k=>$v}
  142. <tr>
  143. <td rowspan="4">{$v['name']}</td>
  144. <td>合计水量</td>
  145. {foreach $monthList as $k2 =>$v2}
  146. <td>{$v['water'][$k2]|default=0}</td>
  147. {/foreach}
  148. <td rowspan="2">{$v['totalWater']}</td>
  149. </tr>
  150. <tr>
  151. <td>分摊水量</td>
  152. {foreach $monthList as $k3 =>$v3}
  153. <td>{$v['splitWater'][$k3]|default=0}</td>
  154. {/foreach}
  155. </tr>
  156. <tr>
  157. <td>合计电量</td>
  158. {foreach $monthList as $k4=>$v4}
  159. <td>{$v['electricity'][$k4]|default=0}</td>
  160. {/foreach}
  161. <td rowspan="2">{$v['totalElectricity']}</td>
  162. </tr>
  163. <tr>
  164. <td>分摊电量</td>
  165. {foreach $monthList as $k5 => $v5}
  166. <td>{$v['splitElectricity'][$k5]|default=0}</td>
  167. {/foreach}
  168. </tr>
  169. {/foreach}
  170. </tbody>
  171. </table>
  172. </div>
  173. </div>
  174. </div>
  175. </div>
  176. </div>
  177. {/block}
  178. {block name="script"}
  179. <script src="/static/layDate-v5.0.9/laydate.js"></script>
  180. <script src="/static/browser.js"></script>
  181. <script src="/static/jquery.jqprint-0.3.js"></script>
  182. <script>
  183. $(function () {
  184. laydate.render({
  185. elem: '#startTime',
  186. trigger: 'click',
  187. theme: '#0F3A87',
  188. type:'year'
  189. });
  190. laydate.render({
  191. elem: '#endTime',
  192. trigger: 'click',
  193. theme: '#0F3A87'
  194. });
  195. });
  196. function empty_search(){
  197. window.location.href = 'publicDepTotal';
  198. }
  199. function printer(){
  200. $('#printer').jqprint();
  201. }
  202. function excel_download(_self){
  203. $("#printer").table2excel({
  204. // table2excel插件的可用配置参数有:
  205. exclude: ".noExl",// exclude:不被导出的表格行的CSS class类。
  206. name: "科室水、电总使用量",// name:导出的Excel文档的名称
  207. filename: "科室水、电总使用量",// filename:Excel文件的名称。
  208. exclude_img: true,// exclude_img:是否导出图片。
  209. exclude_links: true,// exclude_links:是否导出超链接
  210. exclude_inputs: true// exclude_inputs:是否导出输入框中的内容
  211. });
  212. }
  213. </script>
  214. {/block}