鑫苑新版本前端代码

orderArea.html 4.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  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 + "GDPos/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 + "GDPos/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) {
  113. var newArr = [];
  114. dataArr = res.dt;
  115. var colname = res.colname;
  116. if(colname && colname.length > 0) {
  117. newArr.push({
  118. field: colname[0],
  119. title: colname[0],
  120. align: 'center',
  121. fixed: true,
  122. sort: true,
  123. width: 150,
  124. });
  125. for(var i = 1, colNL = colname.length; i < colNL - 1; i++){
  126. newArr.push({
  127. field: colname[i],
  128. title: colname[i],
  129. align: 'center',
  130. //fixed: true,
  131. //sort: true,
  132. //width: 150,
  133. });
  134. }
  135. newArr.push({
  136. field: '总计',
  137. title: '总计',
  138. align: 'center',
  139. fixed: 'right',
  140. templet: function(d){
  141. return '<span class="color_73926">'+ d.总计 +'</span>'
  142. },
  143. sort: true,
  144. //width: 150,
  145. });
  146. }
  147. colsArr.push(newArr);
  148. layui.use('table', function() {
  149. var table = layui.table;
  150. //方法级渲染
  151. table.render({
  152. elem: '#t_callTotal',
  153. skin: 'row', //line (行边框风格) row (列边框风格) nob (无边框风格)
  154. even: true, //开启隔行背景
  155. size: 'lg', //sm,lg尺寸的表格
  156. cellMinWidth: 100,
  157. page: true,
  158. data: dataArr,
  159. cols: colsArr,
  160. height: 'full-150'
  161. });
  162. });
  163. }
  164. }
  165. },
  166. }).then(function(){layer.close(loadindex);});
  167. }
  168. </script>
  169. </body>
  170. </html>