鑫苑新版本前端代码

workOrderSource.html 4.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  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 + "GDLY/ExportExcel?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. $.ajax({
  97. type: 'get',
  98. url: huayi.config.callcenter_url + "GDLY/GetDataList",
  99. async: true,
  100. dataType: 'json',
  101. beforeSend: function() {
  102. loadindex = layer.load()
  103. },
  104. data: {
  105. stime: stime,
  106. endtime: endtime,
  107. token: token,
  108. },
  109. success: function(data) {
  110. if(data.state.toLowerCase() == "success") {
  111. var res = data.data;
  112. if(res && res.length > 0) {
  113. dataArr = res;
  114. var newArr = [];
  115. var keys = [];
  116. for (var property in res[0]){
  117. keys.push(property);
  118. }
  119. newArr.push({
  120. field: keys[0],
  121. title: keys[0],
  122. align: 'center',
  123. fixed: true,
  124. //sort: true,
  125. width: 150,
  126. });
  127. for(var i = 1, colNL = keys.length; i < colNL; i++) {
  128. newArr.push({
  129. field: keys[i],
  130. title: keys[i],
  131. align: 'center',
  132. //fixed: true,
  133. //sort: true,
  134. //width: 150,
  135. });
  136. }
  137. colsArr.push(newArr);
  138. layui.use('table', function() {
  139. var table = layui.table;
  140. //方法级渲染
  141. table.render({
  142. elem: '#t_callTotal',
  143. skin: 'row', //line (行边框风格) row (列边框风格) nob (无边框风格)
  144. even: true, //开启隔行背景
  145. size: 'lg', //sm,lg尺寸的表格
  146. cellMinWidth: 100,
  147. page: true,
  148. cols: colsArr,
  149. data: dataArr,
  150. height: 'full-150'
  151. });
  152. });
  153. }
  154. }
  155. },
  156. }).then(function() {
  157. layer.close(loadindex);
  158. });
  159. }
  160. </script>
  161. </body>
  162. </html>