鑫苑新版本前端代码

sayBusyStatistics.html 5.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>置忙统计报表</title>
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <script src="../Script/Common/huayi.load.js"></script>
  8. <script src="../Script/Common/huayi.config.js"></script>
  9. <link rel="stylesheet" href="../js/layui/css/layui.css" />
  10. <link rel="stylesheet" href="../css/init.css" />
  11. <style>
  12. .toolBox {
  13. background: #f3f3f4;
  14. height: 60px;
  15. padding: 10px 20px;
  16. }
  17. .th-content {
  18. width: 90%;
  19. margin: 0 auto;
  20. }
  21. </style>
  22. </head>
  23. <body class="gray-bg" style="background: #fefefe;">
  24. <div class="daoHang clearfix">
  25. <div class="dhLeft">
  26. <sapn><i class="syIcon"></i>位置:
  27. <a href="javaScript:;" id="ReIndex">首页</a>&gt;
  28. <a href="javaScript:;">报表分析</a>&gt;
  29. <a href="javaScript:;">报表统计</a>&gt;
  30. <a href="" style="color: #000;">置忙统计报表</a>
  31. </sapn>
  32. </div>
  33. <div class="dhRight">
  34. <a href="#" title="刷新"><i class="fa fa-refresh"></i></a>
  35. </div>
  36. </div>
  37. <div class="toolBox">
  38. <div class="th-bar clearfix">
  39. <div class="pull-right">
  40. <div class="form-inline">
  41. <div class="time-box form-group">
  42. <i class="tub fa fa-calendar"></i>
  43. <input class="form-control" type="text" id="startTime" placeholder="请选择起止时间" style="width: 228px;">
  44. </div>
  45. <div class="pull-right">
  46. <button class="btns search">搜索</button>
  47. <a href="" class="btns export">导出</a>
  48. </div>
  49. </div>
  50. </div>
  51. </div>
  52. </div>
  53. <div class="th-content">
  54. <table class="layui-hide" id="t_callTotal"></table>
  55. </div>
  56. <script src="../js/layui/layui.js"></script>
  57. <script>
  58. var token = $.cookie("token");
  59. var stime = ''; //开始时间
  60. var endtime = ''; //结束时间
  61. $(document).ready(function() {
  62. layui.use('laydate', function() {
  63. var laydate = layui.laydate;
  64. //日期
  65. laydate.render({
  66. elem: '#startTime',
  67. range: '~',
  68. theme: '#1ab394',
  69. calendar: 'true'
  70. });
  71. });
  72. getTableDataList(); //获取表格数据
  73. /*搜索*/
  74. $(".search").click(function() {
  75. stime = $('#startTime').val() && $('#startTime').val().split(' ~ ')[0];
  76. endtime = $('#startTime').val() && $('#startTime').val().split(' ~ ')[1];
  77. getTableDataList(); //获取表格数据
  78. })
  79. //导出
  80. $('.export').click(function() {
  81. stime = $('#startTime').val() && $('#startTime').val().split(' ~ ')[0];
  82. endtime = $('#startTime').val() && $('#startTime').val().split(' ~ ')[1];
  83. dcexcel(this);
  84. });
  85. });
  86. function dcexcel(obj) {
  87. var url = huayi.config.callcenter_url + "CallBusy/ExptList?token=" + token;
  88. url += "&stime=" + stime + "&endtime=" + endtime;
  89. obj.href = url;
  90. }
  91. //加载表格
  92. function getTableDataList() {
  93. var colsArr = [];
  94. var dataArr = [];
  95. var loadindex;
  96. //表头
  97. $.ajax({
  98. type:"get",
  99. url:huayi.config.callcenter_url + "CallBusy/GetColumnList",
  100. async:true,
  101. dataType: 'json',
  102. beforeSend:function(){
  103. loadindex = layer.load()
  104. },
  105. data: {
  106. token: token,
  107. },
  108. success:function(data){
  109. if(data.state.toLowerCase() == "success") {
  110. var res = data.data;
  111. if(res) {
  112. var newArr = [];
  113. if(res && res.length > 0) {
  114. newArr.push({
  115. field: res[0],
  116. title: res[0],
  117. align: 'center',
  118. fixed: true,
  119. sort: true,
  120. width: 150,
  121. });
  122. for(var i = 1, colNL = res.length; i < colNL; i++){
  123. if(res[i].indexOf('/') !=-1){
  124. // res[i]=res[i].replace('/', "与");
  125. res[i]='时间比';
  126. }
  127. newArr.push({
  128. field: res[i],
  129. title: res[i],
  130. align: 'center',
  131. //fixed: true,
  132. //sort: true,
  133. //width: 150,
  134. });
  135. }
  136. // newArr.push({
  137. // field: '总计',
  138. // title: '总计',
  139. // align: 'center',
  140. // fixed: 'right',
  141. // templet: function(d){
  142. // return '<span class="color_73926">'+ d.总计 +'</span>'
  143. // },
  144. // sort: true,
  145. // //width: 150,
  146. // });
  147. }
  148. colsArr.push(newArr);
  149. }
  150. }
  151. }
  152. });
  153. //表格
  154. $.ajax({
  155. type: 'get',
  156. url: huayi.config.callcenter_url + "CallBusy/GetDataList",
  157. async: true,
  158. dataType: 'json',
  159. beforeSend:function(){
  160. loadindex = layer.load()
  161. },
  162. data: {
  163. stime: stime,
  164. endtime: endtime,
  165. token: token,
  166. },
  167. success: function(data) {
  168. if(data.state.toLowerCase() == "success") {
  169. var res = data.data;
  170. if(res) {
  171. dataArr = res;
  172. layui.use('table', function() {
  173. var table = layui.table;
  174. //方法级渲染
  175. table.render({
  176. elem: '#t_callTotal',
  177. skin: 'row', //line (行边框风格) row (列边框风格) nob (无边框风格)
  178. even: true, //开启隔行背景
  179. size: 'lg', //sm,lg尺寸的表格
  180. cellMinWidth: 100,
  181. page: true,
  182. data: dataArr,
  183. cols: colsArr,
  184. height: 'full-150'
  185. });
  186. });
  187. }
  188. }
  189. },
  190. }).then(function(){layer.close(loadindex);});
  191. }
  192. </script>
  193. </body>
  194. </html>