appeal.js 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. var layer1 = null;
  2. var datatable = null;
  3. var p_deptid = null;
  4. var p_name = null;
  5. var p_status = null
  6. var pageindex = 1
  7. $(function() {
  8. // 设置滚动表格的高度
  9. $("#scrollTable").height($(window).height() - 360);
  10. setVisit();
  11. var road_manager;
  12. if (roleContains("STATION")) {
  13. road_manager = getCurrentUser().road_manager_id;
  14. }
  15. if (roleContains("ROAD_MANAGER")) {
  16. road_manager = getCurrentUser().organid;
  17. }
  18. setRoadManagerSelect("#center_manage", road_manager, true);
  19. // 当前月份初始化
  20. // $("#sel_month").val(getM()-1);
  21. $.jeDate("#sel_month", {
  22. isinitVal: true,
  23. format: 'YYYY/MM' // 分隔符可以任意定义,该例子表示只显示年月
  24. });
  25. $("#month_name").html($("#sel_month").val());
  26. var pdata = $.zui.store.get('store_param_' + current_url);
  27. if (pdata != null) {
  28. $.zui.store.set('store_param_' + current_url, null);
  29. $("#sel_month").val(pdata.sel_month);
  30. $("#fs_station").val(pdata.fs_station);
  31. $("#center_manage").val(pdata.center_manage);
  32. p_deptid = pdata.deptid;
  33. p_name = pdata.name;
  34. p_status = pdata.status;
  35. pageindex = pdata.p_cur;
  36. getappleTaskList(p_deptid, p_name, p_status)
  37. }
  38. if (road_manager) {
  39. getFsStationList(road_manager, function(obj) {
  40. $("#fs_station").html(obj);
  41. var dept;
  42. if (roleContains("STATION")) {
  43. dept = getCurrentUser().organid;
  44. }
  45. $("#fs_station").val(dept);
  46. // 初始化查询
  47. getFsWorkInfo();
  48. });
  49. } else {
  50. // 初始化查询
  51. getFsWorkInfo();
  52. }
  53. // 导管中心选择
  54. $("#center_manage").change(function() {
  55. var center_manage_id = GV(this);
  56. if (center_manage_id == '') {
  57. $("#fs_station,#fs_employee").html('');
  58. } else {
  59. getFsStationList(center_manage_id, function(obj) {
  60. $("#fs_station").html(obj);
  61. var dept;
  62. if (roleContains("STATION")) {
  63. dept = getCurrentUser().organid;
  64. }
  65. $("#fs_station").val(dept);
  66. });
  67. }
  68. })
  69. // 查询
  70. $("#searchBtn").click(function() {
  71. $("#month_name").html($("#sel_month").val())
  72. getFsWorkInfo();
  73. })
  74. // 导出excel
  75. $("#exportExcel").click(function() {
  76. var param = '';
  77. if (GV("#fs_station") != '' && GV("#fs_station") != null) {
  78. param = "&deptId=" + GV("#fs_station");
  79. } else if (GV("#center_manage") != '') {
  80. param = "&centerId=" + GV("#center_manage");
  81. }
  82. window.location.href = getserveraddr() + "/file/appeal/info?month=" + GV("#sel_month") + param;
  83. })
  84. // end
  85. })
  86. /**
  87. * 检索出勤明细数据
  88. * @param {*} param
  89. */
  90. function getFsWorkInfo() {
  91. var param = {
  92. "start_time": timeTranslate(GV("#sel_month")),
  93. "end_time": (GV("#sel_month") + "/25 23:00:00").replace("/", "-").replace("/", "-")
  94. }
  95. if (GV("#fs_station") != '') {
  96. param['dept_id'] = GV("#fs_station");
  97. } else if (GV("#center_manage") != '') {
  98. param['parent_dept_id'] = GV("#center_manage");
  99. }
  100. post_common_service("statistics/check/appeal", param, function(data) {
  101. $(".table-tbody").empty();
  102. if (data.length > 0) {
  103. for (var i = 0; i < data.length; i++) {
  104. $(".table-tbody").append(getTableContent(data[i], i + 1));
  105. }
  106. }
  107. }, function(error) {});
  108. }
  109. /**
  110. * 拼接表格内容
  111. * @param {*} obj
  112. * @param {*} seq
  113. */
  114. function getTableContent(obj, seq) {
  115. var content = "<tr><td width='8%'>" + seq + "</td> <td width='16%'>" + obj.fee_station_name + "</td> <td width='16%'>" + GDV(obj.appeal_num, 0) + "&nbsp;&nbsp;&nbsp;" + (GDV(obj.appeal_num, 0) > 0 ? ("<a href='javascript:void(0)' onclick='getappleTaskList(" + obj.dept_id + ",\"" + obj.fee_station_name + "\",0)'>" + "<i class=\"icon icon-th-list\"></i>" + "</a>") : "") +
  116. "</td> <td >" + GDV(obj.appeal_success_num, 0) + "&nbsp;&nbsp;&nbsp;" + (GDV(obj.appeal_success_num, 0) > 0 ? ("<a href='javascript:void(0)' onclick='getappleTaskList(" + obj.dept_id + ",\"" + obj.fee_station_name + "\",1)'>" + "<i class=\"icon icon-th-list\"></i>" + "</a>") : "") + "</td><td>" +
  117. GDV(obj.appeal_fail_num, 0) + "&nbsp;&nbsp;&nbsp;" + (GDV(obj.appeal_fail_num, 0) > 0 ? ("<a href='javascript:void(0)' onclick='getappleTaskList(" + obj.dept_id + ",\"" + obj.fee_station_name + "\",2)'>" + "<i class=\"icon icon-th-list\"></i>" + "</a>") : "") +
  118. "</td> </tr>";
  119. return content;
  120. }
  121. function setVisit() {
  122. if (roleContains("STATION")) {
  123. $("#center_manage").attr("disabled", "disabled");
  124. $("#fs_station").attr("disabled", "disabled");
  125. }
  126. if (roleContains("ROAD_MANAGER")) {
  127. $("#center_manage").attr("disabled", "disabled");
  128. }
  129. }
  130. //获取任务列表 status 为检索条件 0 为全部 1 为成功 2 为失败
  131. function getappleTaskList(deptid, name, status) {
  132. p_deptid = deptid;
  133. p_name = name;
  134. p_status = status
  135. var title = name + " " + $("#sel_month").val() + "月份" + (status == 0 ? "所有" : status == 1 ? "成功" : "失败") + "申诉任务列表"
  136. var isshownumber = false;
  137. if (hasRole(ROLE_JICHA_ADMIN) || hasRole(ROLE_ADMIN)) {
  138. isshownumber = true;
  139. }
  140. var cols = [
  141. { width: 80, text: '序号', type: 'number', flex: true, colClass: 'text-center', field: 'num' },
  142. { width: 160, text: '任务名称', type: 'href_link', flex: true, sort: 'down', field: '<a href=\"javascript:void(0);\" onclick=\"jumptodetail(\'$field=id$\')\">$field=name$</a>' },
  143. { width: 80, text: '考核人员', type: 'string', flex: true, colClass: '', field: 'checked_person_name' },
  144. { width: 160, text: '考核部门', type: 'string', flex: true, sort: 'down', field: 'checked_dept_name' },
  145. { width: 80, text: '稽查人员', type: 'href_link', flex: true, hide: false, colClass: '', field: isshownumber ? '$field=checkman_name$' : '-' },
  146. { width: 160, text: '稽查时间段', type: 'string', flex: true, sort: 'down', field: 'check_period' }
  147. ];
  148. var data = {
  149. "deptId": deptid,
  150. "start_time": timeTranslate(GV("#sel_month")),
  151. "end_time": (GV("#sel_month") + "/25 23:00:00").replace("/", "-").replace("/", "-"),
  152. "status": status == 0 ? null : status
  153. }
  154. layer1 = layer.open({
  155. area: ['50%', '50%'],
  156. type: 1,
  157. title: title,
  158. closeBtn: 1,
  159. shadeClose: true,
  160. content: "<div id='tasktable' style='padding:10px'></div>",
  161. success: function() {
  162. datatable = $('#tasktable').mytable({
  163. 'cols': cols,
  164. 'url': "/task/gettasklistbydept",
  165. 'param': data,
  166. 'pager': {
  167. 'page_size': 10,
  168. 'p_cur': pageindex
  169. }
  170. });
  171. pageindex = 1;
  172. console.log(datatable)
  173. }
  174. });
  175. }
  176. function jumptodetail(id) {
  177. if (layer1 != null) {
  178. layer.close(layer1)
  179. }
  180. post_common_service("task/getById", { "id": id }, function(data) {
  181. $.checkTask = data;
  182. if (typeof($.checkTask) != "undefined" && typeof($.checkTask.appeal) != "undefined") {
  183. $.checkTask.appeal = null;
  184. }
  185. var sel_month = $("#sel_month").val();
  186. var fs_station = $("#fs_station").val();
  187. var center_manage = $("#center_manage").val();
  188. var pdata = {
  189. "sel_month": sel_month,
  190. "fs_station": fs_station,
  191. "center_manage": center_manage,
  192. "deptid": p_deptid,
  193. "name": p_name,
  194. "status": p_status,
  195. "p_cur": datatable.options.pager.p_cur
  196. }
  197. $.zui.store.set('store_param_' + current_url, pdata);
  198. url = "/view/mytask/taskDetail.html"
  199. changePage(url);
  200. }, function(error) {
  201. });
  202. }