三元财务UI

orderCloseRateStatistics.js 4.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  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. done: function(){
  14. $('#sc_year').val('');
  15. $('#sc_season').selectpicker('val', '');
  16. }
  17. });
  18. laydate.render({
  19. elem: '#sc_year',
  20. theme: '#1ab394',
  21. type: 'year',
  22. done: function(){
  23. $('#sc_time').val('');
  24. }
  25. });
  26. });
  27. $('#sc_season').on('change', function(){
  28. $('#sc_time').val('');
  29. });
  30. getTableDataList(); //获取表格数据
  31. //获取区域项目期号
  32. helper.getDropList.getProLocations($('#sc_rengin'), $('#sc_pro'), $('#sc_floor'));
  33. //获取工单来源
  34. helper.getDropList.getlistDropByDic($('#sc_source'), 'GDLY');
  35. //搜索
  36. $("#sc_btns").click(function() {
  37. getTableDataList(); //获取表格数据
  38. })
  39. });
  40. function getTableDataList() {
  41. var colsArr = [];
  42. var loadindex;
  43. if ($('#sc_season').val() && !$('#sc_year').val()) {
  44. layer.confirm('请选择年度!', {
  45. icon: 2,
  46. btn: ['确定']
  47. });
  48. return;
  49. }
  50. $.ajax({
  51. type: 'get',
  52. url: huayi.config.callcenter_url + "WorkOrdersCloseRate/GetDataList",
  53. async: true,
  54. dataType: 'json',
  55. beforeSend: function() {
  56. loadindex = layer.load()
  57. },
  58. data: {
  59. iseffective: $('#sc_iseffective').val(), //否 int 是否有效工单
  60. gdly: $('#sc_source').val(),// 否 int 工单来源id
  61. stime: $('#sc_time').val() && $('#sc_time').val().split(' ~ ')[0], //否 string 工单起止时间
  62. endtime: $('#sc_time').val() && $('#sc_time').val().split(' ~ ')[1], //否 string 工单起止时间
  63. years: $('#sc_year').val(), //年度
  64. season: $('#sc_season').val(), //季度
  65. areaid: $('#sc_rengin').val(), //否 string 区域id
  66. // regionid: $('#sc_pro').val(), //否 string 项目id
  67. // stageid: $('#sc_floor').val(), //否 string 期号id
  68. token: $.cookie("token"),
  69. },
  70. success: function(data) {
  71. if(data.state.toLowerCase() == "success") {
  72. var res = data.data;
  73. var colsArr1 = [];
  74. if(res && res.length > 0) {
  75. colsArr1.push({
  76. field: '区域',
  77. title: '区域',
  78. align: 'center',
  79. fixed: true,
  80. //sort: true,
  81. width: 200,
  82. });
  83. for(var i in res[0]) {
  84. if(i === "区域" || i === "结案率") {
  85. continue;
  86. } else {
  87. colsArr1.push({
  88. field: i,
  89. title: i,
  90. align: 'center',
  91. });
  92. }
  93. }
  94. colsArr1.push({
  95. field: '结案率',
  96. title: '结案率',
  97. align: 'center',
  98. fixed: 'right',
  99. //sort: true,
  100. templet: function(d) {
  101. return '<span class="color_73926">' + d.结案率 + '</span>'
  102. },
  103. width: 318,
  104. });
  105. colsArr.push(colsArr1);
  106. layui.use('table', function() {
  107. var table = layui.table;
  108. //方法级渲染
  109. table.render({
  110. elem: '#t_callTotal',
  111. skin: 'row', //line (行边框风格) row (列边框风格) nob (无边框风格)
  112. even: true, //开启隔行背景
  113. size: 'md', //sm,lg,md尺寸的表格
  114. cellMinWidth: 160,
  115. //page: true,
  116. cols: colsArr,
  117. data: res,
  118. limit: res.length,//默认是10
  119. //height: 'full-150'
  120. });
  121. })
  122. }
  123. }
  124. },
  125. }).then(function() {
  126. layer.close(loadindex);
  127. });
  128. }
  129. //格式化序号
  130. function setCode(val, row, index) {
  131. return ++index;
  132. }
  133. //导出
  134. function dcexcel(obj) {
  135. var url = huayi.config.callcenter_url + "WorkOrdersCloseRate/ExportExcel?token=" + $.cookie("token");
  136. // url += "&iseffective=" + $('#sc_iseffective').val(); //否 int 是否有效工单
  137. url += "&gdlx=" + $('#sc_type').val(); //否 string 工单类型
  138. url += "&stime=" + ($('#sc_time').val() && $('#sc_time').val().split(' ~ ')[0]); //否 string 工单起止时间
  139. url += "&endtime=" + ($('#sc_time').val() && $('#sc_time').val().split(' ~ ')[1]); //否 string 工单起止时间
  140. url += "&areaid=" + $('#sc_rengin').val(); //否 string 区域id
  141. url += "&years=" + $('#sc_year').val(); //否 年度
  142. url += "&season=" + $('#sc_season').val(); //否 季度
  143. // url += "&regionid=" + $('#sc_pro').val(); //否 string 项目id
  144. // url += "&stageid=" + $('#sc_floor').val(); //否 string 期号id
  145. obj.href = url;
  146. }