开封利通水务前端

orderSourceStatistics.js 3.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. /**
  2. * 工单来源统计报表
  3. * */
  4. $(function() {
  5. //初始化时间
  6. layui.use('laydate', function() {
  7. var laydate = layui.laydate;
  8. laydate.render({
  9. elem: '#sc_time',
  10. range: '~',
  11. theme: '#1ab394',
  12. calendar: true
  13. });
  14. });
  15. getTableDataList(); //获取表格数据
  16. //获取区域项目期号
  17. helper.getDropList.getProLocations($('#sc_rengin'), $('#sc_pro'), $('#sc_floor'));
  18. //获取工单类型
  19. helper.getDropList.getlistDropByDic($('#sc_type'), 'GDLX');
  20. //搜索
  21. $("#sc_btns").click(function() {
  22. getTableDataList(); //获取表格数据
  23. })
  24. });
  25. function getTableDataList() {
  26. var colsArr = [];
  27. var loadindex;
  28. $.ajax({
  29. type: 'get',
  30. url: huayi.config.callcenter_url + "WorkOrdersSource/GetDataList",
  31. async: true,
  32. dataType: 'json',
  33. beforeSend: function() {
  34. loadindex = layer.load()
  35. },
  36. data: {
  37. iseffective: $('#sc_iseffective').val(), //否 int 是否有效工单
  38. gdlx: $('#sc_type').val(), //否 string 工单类型
  39. stime: $('#sc_time').val() && $('#sc_time').val().split(' ~ ')[0], //否 string 工单起止时间
  40. endtime: $('#sc_time').val() && $('#sc_time').val().split(' ~ ')[1], //否 string 工单起止时间
  41. areaid: $('#sc_rengin').val(), //否 string 区域id
  42. regionid: $('#sc_pro').val(), //否 string 项目id
  43. stageid: $('#sc_floor').val(), //否 string 期号id
  44. token: $.cookie("token"),
  45. },
  46. success: function(data) {
  47. if(data.state.toLowerCase() == "success") {
  48. var res = data.data;
  49. var colsArr1 = [];
  50. if(res && res.length > 0) {
  51. colsArr1.push({
  52. field: '区域',
  53. title: '区域',
  54. align: 'center',
  55. fixed: true,
  56. //sort: true,
  57. width: 150,
  58. });
  59. for(var i in res[0]) {
  60. if(i === "区域" || i === "合计") {
  61. continue;
  62. } else {
  63. colsArr1.push({
  64. field: i,
  65. title: i,
  66. align: 'center',
  67. });
  68. }
  69. }
  70. colsArr1.push({
  71. field: '合计',
  72. title: '合计',
  73. align: 'center',
  74. fixed: 'right',
  75. sort: true,
  76. templet: function(d) {
  77. return '<span class="color_73926">' + d.合计 + '</span>'
  78. },
  79. width: 100,
  80. });
  81. colsArr.push(colsArr1);
  82. layui.use('table', function() {
  83. var table = layui.table;
  84. //方法级渲染
  85. table.render({
  86. elem: '#t_callTotal',
  87. skin: 'row', //line (行边框风格) row (列边框风格) nob (无边框风格)
  88. even: true, //开启隔行背景
  89. size: 'md', //sm,lg,md尺寸的表格
  90. cellMinWidth: 160,
  91. //page: true,
  92. cols: colsArr,
  93. data: res,
  94. limit: res.length,//默认是10
  95. //height: 'full-150'
  96. });
  97. })
  98. }
  99. }
  100. },
  101. }).then(function() {
  102. layer.close(loadindex);
  103. });
  104. }
  105. //格式化序号
  106. function setCode(val, row, index) {
  107. return ++index;
  108. }
  109. //导出
  110. function dcexcel(obj) {
  111. var url = huayi.config.callcenter_url + "WorkOrdersSource/ExportExcel?token=" + $.cookie("token");
  112. url += "&iseffective=" + $('#sc_iseffective').val(); //否 int 是否有效工单
  113. url += "&gdlx=" + $('#sc_type').val(); //否 string 工单类型
  114. url += "&stime=" + ($('#sc_time').val() && $('#sc_time').val().split(' ~ ')[0]); //否 string 工单起止时间
  115. url += "&endtime=" + ($('#sc_time').val() && $('#sc_time').val().split(' ~ ')[1]); //否 string 工单起止时间
  116. url += "&areaid=" + $('#sc_rengin').val(); //否 string 区域id
  117. url += "&regionid=" + $('#sc_pro').val(); //否 string 项目id
  118. url += "&stageid=" + $('#sc_floor').val(); //否 string 期号id
  119. obj.href = url;
  120. }