开封利通水务前端

workOrderSource.html 4.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  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 clearfix">
  38. <div class="pull-right">
  39. <div class="form-inline">
  40. <div class="time-box form-group">
  41. <i class="tub fa fa-calendar"></i>
  42. <input class="form-control" type="text" id="startTime" placeholder="请选择起止时间" style="width: 228px;">
  43. </div>
  44. <div class="pull-right">
  45. <button class="btns search">搜索</button>
  46. <a href="" class="btns export">导出</a>
  47. </div>
  48. </div>
  49. </div>
  50. </div>
  51. <div class="th-content">
  52. <table class="layui-hide" id="t_callTotal"></table>
  53. </div>
  54. <script src="../js/layui/layui.js"></script>
  55. <script>
  56. var token = $.cookie("token");
  57. var stime = ''; //开始时间
  58. var endtime = ''; //结束时间
  59. $(document).ready(function() {
  60. layui.use('laydate', function() {
  61. var laydate = layui.laydate;
  62. //日期
  63. laydate.render({
  64. elem: '#startTime',
  65. range: '~',
  66. theme: '#1ab394',
  67. calendar: 'true'
  68. });
  69. });
  70. getTableDataList(); //获取表格数据
  71. /*搜索*/
  72. $(".search").click(function() {
  73. stime = $('#startTime').val() && $('#startTime').val().split(' ~ ')[0];
  74. endtime = $('#startTime').val() && $('#startTime').val().split(' ~ ')[1];
  75. getTableDataList(); //获取表格数据
  76. })
  77. //导出
  78. $('.export').click(function() {
  79. stime = $('#startTime').val() && $('#startTime').val().split(' ~ ')[0];
  80. endtime = $('#startTime').val() && $('#startTime').val().split(' ~ ')[1];
  81. dcexcel(this);
  82. });
  83. });
  84. function dcexcel(obj) {
  85. var url = huayi.config.callcenter_url + "GDLY/ExportExcel?token=" + token;
  86. url += "&stime=" + stime + "&endtime=" + endtime;
  87. obj.href = url;
  88. }
  89. //加载表格
  90. function getTableDataList() {
  91. var colsArr = [];
  92. var dataArr = [];
  93. var loadindex;
  94. $.ajax({
  95. type: 'get',
  96. url: huayi.config.callcenter_url + "GDLY/GetDataList",
  97. async: true,
  98. dataType: 'json',
  99. beforeSend: function() {
  100. loadindex = layer.load()
  101. },
  102. data: {
  103. stime: stime,
  104. endtime: endtime,
  105. token: token,
  106. },
  107. success: function(data) {
  108. if(data.state.toLowerCase() == "success") {
  109. var res = data.data;
  110. if(res && res.length > 0) {
  111. dataArr = res;
  112. var newArr = [];
  113. var keys = [];
  114. for(var property in res[0]) {
  115. keys.push(property);
  116. }
  117. newArr.push({
  118. field: keys[0],
  119. title: keys[0],
  120. align: 'center',
  121. fixed: true,
  122. //sort: true,
  123. width: 150,
  124. });
  125. for(var i = 1, colNL = keys.length; i < colNL; i++) {
  126. newArr.push({
  127. field: keys[i],
  128. title: keys[i],
  129. align: 'center',
  130. //fixed: true,
  131. //sort: true,
  132. //width: 150,
  133. });
  134. }
  135. colsArr.push(newArr);
  136. layui.use('table', function() {
  137. var table = layui.table;
  138. //方法级渲染
  139. table.render({
  140. elem: '#t_callTotal',
  141. skin: 'row', //line (行边框风格) row (列边框风格) nob (无边框风格)
  142. even: true, //开启隔行背景
  143. size: 'md', //sm,lg,md尺寸的表格
  144. cellMinWidth: 100,
  145. page: true,
  146. cols: colsArr,
  147. data: dataArr,
  148. //height: 'full-150'
  149. });
  150. });
  151. }
  152. }
  153. },
  154. }).then(function() {
  155. layer.close(loadindex);
  156. });
  157. }
  158. </script>
  159. </body>
  160. </html>