安图前端代码

workOrderSource.html 4.5KB

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