task_list.js 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. var cur_status;
  2. function initTaskPage() {
  3. initQueryParams();
  4. initTableRowBtn();
  5. queryTask();
  6. }
  7. function initQueryParams() {
  8. // 仅选择日期
  9. $("#start-time").datetimepicker(
  10. {
  11. language: "zh-CN",
  12. weekStart: 1,
  13. todayBtn: 1,
  14. autoclose: 1,
  15. todayHighlight: 1,
  16. startView: 2,
  17. minView: 2,
  18. forceParse: 0,
  19. format: "yyyy-mm-dd"
  20. });
  21. // 仅选择日期
  22. $("#end-time").datetimepicker(
  23. {
  24. language: "zh-CN",
  25. weekStart: 1,
  26. todayBtn: 1,
  27. autoclose: 1,
  28. todayHighlight: 1,
  29. startView: 2,
  30. minView: 2,
  31. forceParse: 0,
  32. format: "yyyy-mm-dd"
  33. });
  34. setFeSelect("#fsList");
  35. //获取页面参数
  36. var page_params = $.zui.store.get("page_params");
  37. if(page_params && page_params.status) {
  38. cur_status = page_params.status;
  39. }
  40. }
  41. //初始化表行按钮
  42. function initTableRowBtn() {
  43. $.zui.store.set("task_table_btn_2",[{func:'showCheck',text:'开始稽查',icon_class:'icon-eye-open'}]);
  44. $.zui.store.set("task_table_btn_3",[{func:'showContinueCheck',text:'继续稽查',icon_class:'icon-eye-open'}]);
  45. $.zui.store.set("task_table_btn_4",[{func:'showTaskDetail',text:'详情',icon_class:'icon-tasks'},
  46. {func:'dispatchTaskById',text:'下发',icon_class:'icon-signin'}]);
  47. $.zui.store.set("task_table_btn_5",[{func:'showTaskDetail',text:'详情',icon_class:'icon-tasks'}]);
  48. $.zui.store.set("task_table_btn_6",[{func:'showTaskDetail',text:'详情',icon_class:'icon-tasks'}]);
  49. $.zui.store.set("task_table_btn_21",[{func:'showApplyDetail',text:'处理',icon_class:'icon-hand-up'}]);
  50. }
  51. //查询任务
  52. function queryTask(){
  53. var data = {
  54. "start_time": $("#start_time").val(),
  55. "end_time": $("#end_time").val(),
  56. "checked_dept": $("#fsList").val(),
  57. "check_status":cur_status
  58. }
  59. var hide = false;
  60. if(hasRole(ROLE_STATION_ADMIN) || hasRole(ROLE_STATION)) {
  61. hide = true;
  62. }
  63. var cols = [
  64. {width: 80, text: '序号', type: 'number', flex: true, colClass: 'text-center',field: 'num'},
  65. {width: 160, text: '任务名称', type: 'string', flex: true, sort: 'down',field: 'name'},
  66. {width: 80, text: '考核人员', type: 'string', flex: true, colClass: '',field: 'checked_person_name'},
  67. {width: 160, text: '考核部门', type: 'string', flex: true, sort: 'down',field: 'checked_dept_name'},
  68. {width: 80, text: '稽查人员', type: 'string', flex: true, hide:true,colClass: '',field: 'checkman_name'},
  69. {width: 160, text: '稽查时间段', type: 'string', flex: true, sort: 'down',field: 'check_period'},
  70. // {width: 120, text: '状态', type: 'string', flex: true, colClass: '',field: 'check_status_name'}
  71. ];
  72. var colFunc = {width: 120, text: '操作', type: 'string', flex: true, field: 'id'};
  73. colFunc.oper = $.zui.store.get("task_table_btn_"+cur_status);
  74. cols.push(colFunc);
  75. // var pager = {
  76. // page_size:10
  77. // }
  78. $('.datatable').mytable({'cols':cols,
  79. 'url':"/task/getTaskList/",
  80. 'param':data}
  81. );
  82. }
  83. //进入稽查页面
  84. function showCheck(id){
  85. // $('#myModal').modal({name:"dd"});
  86. $.checkTask =getItemByIdFromArr(id,$('.datatable').mytable('getTableData'));
  87. no_return_common_service('/task/update', {"id":id,"check_status":3})
  88. changePage("/view/mytask/check.html");
  89. }
  90. //进入继续稽查页面
  91. function showContinueCheck(id){
  92. // $('#myModal').modal({name:"dd"});
  93. $.checkTask =getItemByIdFromArr(id,$('.datatable').mytable('getTableData'));
  94. changePage("/view/mytask/check.html");
  95. }
  96. //处置无效任务申请
  97. function showApplyDetail(id){
  98. layer.open({
  99. type: 1,
  100. area: ['400px','500px'],
  101. title: '申请处理',
  102. closeBtn: 1,
  103. shadeClose: true,
  104. skin: 'layui-layer-lan',
  105. content: $('#apply_detail_div'),
  106. btn: ['同意', '拒绝'],
  107. btnAlign: 'c', //按钮居中
  108. shade: 0 ,//不显示遮罩
  109. yes: function(index){
  110. aggreeApply(id);
  111. layer.close(index);
  112. },
  113. btn2: function(index){
  114. refuseApply(id)
  115. layer.close(index);
  116. }
  117. });
  118. var param = {
  119. 'id':id
  120. };
  121. post_common_service('/checkApply/getByTaskId', param, function(data) {
  122. $('#apply_man').val(data.apply_man);
  123. $('#apply_time').val(data.apply_time);
  124. $('#apply_reason').val(data.apply_reason);
  125. $('#apply_id').val(data.id);
  126. });
  127. }
  128. //同意申请
  129. function aggreeApply(taskId){
  130. var param = {
  131. 'id':$('#apply_id').val(),
  132. 'task_id':taskId
  133. };
  134. addOrUpdateItem4Common(param,'/checkApply/agree',queryTask);
  135. }
  136. //拒绝申请
  137. function refuseApply(taskId){
  138. var param = {
  139. 'id':$('#apply_id').val(),
  140. 'task_id':taskId
  141. };
  142. addOrUpdateItem4Common(param,'/checkApply/refuse',queryTask);
  143. }
  144. //任务详情页面
  145. function showTaskDetail(id){
  146. var rowData=getItemByIdFromArr(id,$('.datatable').mytable('getTableData'));
  147. $.checkTask = rowData;
  148. changePage("/view/mytask/taskDetail.html");
  149. }
  150. //下发所有任务
  151. function dispatchTaskPatch(){
  152. layer.confirm('确定下发全部任务?', {
  153. btn: ['确定','取消'] //按钮
  154. }, function(){
  155. var param = {
  156. "start_time": $("#start_time").val(),
  157. "end_time": $("#end_time").val(),
  158. "checked_dept": $("#dept").val(),
  159. "check_status":4
  160. }
  161. no_return_common_service('/task/dispatch', param, function(data){
  162. queryTask();
  163. layer.msg(data, {
  164. time: 2000//20s后自动关闭
  165. });
  166. });
  167. }, function(index){
  168. layer.close(index);
  169. });
  170. }
  171. //下发单条任务
  172. function dispatchTaskById(id){
  173. layer.confirm('确定下发任务?', {
  174. btn: ['确定','取消'] //按钮
  175. }, function(){
  176. var param = {
  177. "id": id,
  178. "check_status":5
  179. }
  180. no_return_common_service('/task/dispatchById', param, function(data){
  181. queryTask();
  182. layer.msg(data, {
  183. time: 2000//20s后自动关闭
  184. });
  185. });
  186. }, function(index){
  187. layer.close(index);
  188. });
  189. }