apply_task.js 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. function initApplyPage(){
  2. // 仅选择日期
  3. $("#start_time").datetimepicker(
  4. {
  5. language: "zh-CN",
  6. weekStart: 1,
  7. todayBtn: 1,
  8. autoclose: 1,
  9. todayHighlight: 1,
  10. startView: 2,
  11. minView: 2,
  12. forceParse: 0,
  13. format: "yyyy-mm-dd"
  14. });
  15. // 仅选择日期
  16. $("#end_time").datetimepicker(
  17. {
  18. language: "zh-CN",
  19. weekStart: 1,
  20. todayBtn: 1,
  21. autoclose: 1,
  22. todayHighlight: 1,
  23. startView: 2,
  24. minView: 2,
  25. forceParse: 0,
  26. format: "yyyy-mm-dd"
  27. });
  28. setFeSelect("#fsList");
  29. //获取页面参数
  30. var page_params = $.zui.store.get("page_params");
  31. if(page_params && page_params.status) {
  32. cur_status = page_params.status;
  33. }
  34. queryUnexaminedTask();
  35. }
  36. //初始化表行按钮
  37. function initTableRowBtn() {
  38. $.zui.store.set("task_table_btn_21_"+ROLE_JICHA_ADMIN,[{func:'showApplyDetail',text:'处理',icon_class:'icon-eye-open'}]);
  39. $.zui.store.set("task_table_btn_21_"+ROLE_JICHA,[{func:'showApplyDetail1',text:'详情',icon_class:'icon-eye-open'}]);
  40. $.zui.store.set("task_table_btn_22",[{func:'showApplyDetail1',text:'详情',icon_class:'icon-tasks'}]);
  41. $.zui.store.set("task_table_btn_23",[{func:'showApplyDetail1',text:'详情',icon_class:'icon-tasks'}]);
  42. }
  43. function queryUnexaminedTask(){
  44. initTableRowBtn();
  45. var start_time = "";
  46. if($("#start_time").val()) start_time = $("#start_time").val()+" 00:00:00";
  47. var end_time = "";
  48. if($("#end_time").val()) end_time = $("#end_time").val()+" 23:59:59";
  49. var data = {
  50. "start_time": start_time,
  51. "end_time": end_time,
  52. "checked_dept": $("#fsList").val(),
  53. "check_status":cur_status
  54. }
  55. var cols = [
  56. {width: 80, text: '序号', type: 'number', flex: true, colClass: 'text-center',field: 'num'},
  57. {width: 160, text: '任务名称', type: 'string', flex: true, sort: 'down',field: 'name'},
  58. {width: 80, text: '考核人员', type: 'string', flex: true, colClass: '',field: 'checked_person_name'},
  59. {width: 160, text: '考核部门', type: 'string', flex: true, sort: 'down',field: 'checked_dept_name'},
  60. {width: 80, text: '稽查人员', type: 'string', flex: true, colClass: '',field: 'checkman_name'},
  61. {width: 160, text: '稽查时间段', type: 'string', flex: true, sort: 'down',field: 'check_period'}
  62. // {width: 120, text: '状态', type: 'string', flex: true, colClass: '',field: 'check_status_name'},
  63. // {width: 100, text: '操作', type: 'string', flex: true, field: 'id',
  64. // oper:[
  65. // {func:'showApplyDetail',text:'处理',icon_class:'icon-hand-up'}
  66. // ]
  67. // }
  68. ];
  69. var colFunc = {width: 120, text: '操作', type: 'string', flex: true, field: 'id'};
  70. if(cur_status==21){
  71. if(hasRole(ROLE_JICHA)){
  72. colFunc.oper = $.zui.store.get("task_table_btn_"+cur_status+"_"+ROLE_JICHA);
  73. }else if(ROLE_JICHA_ADMIN){
  74. colFunc.oper = $.zui.store.get("task_table_btn_"+cur_status+"_"+ROLE_JICHA_ADMIN);
  75. }
  76. }else{
  77. colFunc.oper = $.zui.store.get("task_table_btn_"+cur_status);
  78. }
  79. console.log(colFunc.oper);
  80. cols.push(colFunc);
  81. // var pager = {
  82. // page_size:10
  83. // }
  84. $('#unexamined_datatable').mytable({'cols':cols,
  85. 'url':"/task/getTaskList/",
  86. 'param':data}
  87. );
  88. }
  89. function showApplyDetail1(id){
  90. layer.open({
  91. type: 1,
  92. area: ['400px','500px'],
  93. title: '申请处理',
  94. closeBtn: 1,
  95. shadeClose: true,
  96. skin: 'layui-layer-lan',
  97. content: $('#apply_detail_div'),
  98. btn: ['关闭'],
  99. btnAlign: 'c', //按钮居中
  100. shade: 0 ,//不显示遮罩
  101. yes: function(index){
  102. layer.close(index);
  103. }
  104. });
  105. var param = {
  106. 'id':id
  107. };
  108. $('#apply_man').val("");
  109. $('#apply_time').val("");
  110. $('#apply_reason').val("");
  111. $('#apply_id').val("");
  112. post_common_service('/checkApply/getByTaskId', param, function(data) {
  113. $('#apply_man').val(data.apply_man_name);
  114. $('#apply_time').val(data.apply_time);
  115. $('#apply_reason').val(data.apply_reason);
  116. $('#apply_id').val(data.id);
  117. });
  118. }
  119. function showApplyDetail(id){
  120. layer.open({
  121. type: 1,
  122. area: ['400px','500px'],
  123. title: '申请处理',
  124. closeBtn: 1,
  125. shadeClose: true,
  126. skin: 'layui-layer-lan',
  127. content: $('#apply_detail_div'),
  128. btn: ['同意', '拒绝'],
  129. btnAlign: 'c', //按钮居中
  130. shade: 0 ,//不显示遮罩
  131. yes: function(index){
  132. aggreeApply(id);
  133. layer.close(index);
  134. },
  135. btn2: function(index){
  136. refuseApply(id)
  137. layer.close(index);
  138. }
  139. });
  140. var param = {
  141. 'id':id
  142. };
  143. $('#apply_man').val("");
  144. $('#apply_time').val("");
  145. $('#apply_reason').val("");
  146. $('#apply_id').val("");
  147. post_common_service('/checkApply/getByTaskId', param, function(data) {
  148. $('#apply_man').val(data.apply_man_name);
  149. $('#apply_time').val(data.apply_time);
  150. $('#apply_reason').val(data.apply_reason);
  151. $('#apply_id').val(data.id);
  152. });
  153. }
  154. function aggreeApply(taskId){
  155. var param = {
  156. 'id':$('#apply_id').val(),
  157. 'task_id':taskId
  158. };
  159. addOrUpdateItem4Common(param,'/checkApply/agree',queryUnexaminedTask);
  160. }
  161. function refuseApply(taskId){
  162. var param = {
  163. 'id':$('#apply_id').val(),
  164. 'task_id':taskId
  165. };
  166. addOrUpdateItem4Common(param,'/checkApply/refuse',queryUnexaminedTask);
  167. }