apply_task.js 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  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. setFeePersonSelect("#feePersonList",null,null);
  30. $('#fsList').change(function(){
  31. setFeePersonSelect("#feePersonList",null,$("#fsList").val());
  32. })
  33. //获取页面参数
  34. var page_params = $.zui.store.get("page_params");
  35. if(page_params && page_params.status) {
  36. cur_status = page_params.status;
  37. }
  38. if(cur_status==21){
  39. $("#agreePatchBtn").show();
  40. }
  41. queryUnexaminedTask();
  42. }
  43. //初始化表行按钮
  44. function initTableRowBtn() {
  45. $.zui.store.set("task_table_btn_21_"+ROLE_JICHA_ADMIN,[{func:'showCheck',text:'复查',icon_class:'icon-eye-open'},
  46. {func:'showApplyDetail',text:'处理',icon_class:'icon-eye-open'}
  47. ]);
  48. $.zui.store.set("task_table_btn_21_"+ROLE_JICHA,[{func:'showApplyDetail1',text:'详情',icon_class:'icon-eye-open'}]);
  49. $.zui.store.set("task_table_btn_22",[{func:'showApplyDetail1',text:'详情',icon_class:'icon-tasks'}]);
  50. $.zui.store.set("task_table_btn_23",[{func:'showApplyDetail1',text:'详情',icon_class:'icon-tasks'}]);
  51. }
  52. function queryUnexaminedTask(){
  53. initTableRowBtn();
  54. var start_time = "";
  55. if($("#start_time").val()) start_time = $("#start_time").val()+" 00:00:00";
  56. var end_time = "";
  57. if($("#end_time").val()) end_time = $("#end_time").val()+" 23:59:59";
  58. var data = {
  59. "start_time": start_time,
  60. "end_time": end_time,
  61. "checked_dept": $("#fsList").val(),
  62. "checked_person": $("#feePersonList").val(),
  63. "check_status":cur_status
  64. }
  65. var hide = false;
  66. if(hasRole(ROLE_STATION_ADMIN) || hasRole(ROLE_STATION) || hasRole(ROLE_JICHA)|| roleContains('STATION')) {
  67. hide = true;
  68. }
  69. var cols = [
  70. {width: 80, text: '序号', type: 'number', flex: true, colClass: 'text-center',field: 'num'},
  71. {width: 160, text: '任务名称', type: 'string', flex: true, sort: 'down',field: 'name'},
  72. {width: 80, text: '考核人员', type: 'string', flex: true, colClass: '',field: 'checked_person_name'},
  73. {width: 160, text: '考核部门', type: 'string', flex: true, sort: 'down',field: 'checked_dept_name'},
  74. {width: 80, text: '稽查人员', type: 'string', flex: true, hide:hide,field: 'checkman_name'},
  75. {width: 160, text: '稽查时间段', type: 'string', flex: true, sort: 'down',field: 'check_period'}
  76. // {width: 120, text: '状态', type: 'string', flex: true, colClass: '',field: 'check_status_name'},
  77. // {width: 100, text: '操作', type: 'string', flex: true, field: 'id',
  78. // oper:[
  79. // {func:'showApplyDetail',text:'处理',icon_class:'icon-hand-up'}
  80. // ]
  81. // }
  82. ];
  83. var colFunc = {width: 120, text: '操作', type: 'string', flex: true, field: 'id'};
  84. if(cur_status==21){
  85. if(hasRole(ROLE_JICHA)){
  86. colFunc.oper = $.zui.store.get("task_table_btn_"+cur_status+"_"+ROLE_JICHA);
  87. }else if(ROLE_JICHA_ADMIN){
  88. colFunc.oper = $.zui.store.get("task_table_btn_"+cur_status+"_"+ROLE_JICHA_ADMIN);
  89. }
  90. }else{
  91. colFunc.oper = $.zui.store.get("task_table_btn_"+cur_status);
  92. }
  93. console.log(colFunc.oper);
  94. cols.push(colFunc);
  95. var checkable = false;
  96. if(cur_status==21){
  97. checkable = true;
  98. }
  99. $('#unexamined_datatable').mytable({'cols':cols,
  100. 'checkable':checkable,
  101. 'url':"/task/getTaskList/",
  102. 'param':data}
  103. );
  104. }
  105. //进入稽查页面
  106. function showCheck(id){
  107. $.checkTask =getItemByIdFromArr(id,$('#unexamined_datatable').mytable('getTableData'));
  108. if(typeof($.checkTask)!="undefined" && typeof($.checkTask.appeal) != "undefined"){
  109. $.checkTask.appeal = null;
  110. }
  111. //开始稽查
  112. no_return_common_service('/task/update', {"id":$.checkTask.id,"check_status":21,"record_status":1,"check_status_name":"复查"});
  113. changePage("/view/mytask/check.html");
  114. }
  115. function showApplyDetail1(id){
  116. layer.open({
  117. type: 1,
  118. area: ['400px','500px'],
  119. title: '申请处理',
  120. closeBtn: 1,
  121. shadeClose: true,
  122. skin: 'layui-layer-lan',
  123. content: $('#apply_detail_div'),
  124. btn: ['关闭'],
  125. btnAlign: 'c', //按钮居中
  126. shade: 0 ,//不显示遮罩
  127. yes: function(index){
  128. layer.close(index);
  129. }
  130. });
  131. var param = {
  132. 'id':id
  133. };
  134. $('#apply_man').val("");
  135. $('#apply_time').val("");
  136. $('#apply_reason').val("");
  137. $('#apply_id').val("");
  138. post_common_service('/checkApply/getByTaskId', param, function(data) {
  139. $('#apply_man').val(data.apply_man_name);
  140. $('#apply_time').val(data.apply_time);
  141. $('#apply_reason').val(data.apply_reason);
  142. $('#apply_id').val(data.id);
  143. });
  144. }
  145. function showApplyDetail(id){
  146. layer.open({
  147. type: 1,
  148. area: ['400px','500px'],
  149. title: '申请处理',
  150. closeBtn: 1,
  151. shadeClose: true,
  152. skin: 'layui-layer-lan',
  153. content: $('#apply_detail_div'),
  154. btn: ['同意', '拒绝'],
  155. btnAlign: 'c', //按钮居中
  156. shade: 0 ,//不显示遮罩
  157. yes: function(index){
  158. aggreeApply(id);
  159. layer.close(index);
  160. },
  161. btn2: function(index){
  162. refuseApply(id)
  163. layer.close(index);
  164. }
  165. });
  166. var param = {
  167. 'id':id
  168. };
  169. $('#apply_man').val("");
  170. $('#apply_time').val("");
  171. $('#apply_reason').val("");
  172. $('#apply_id').val("");
  173. post_common_service('/checkApply/getByTaskId', param, function(data) {
  174. $('#apply_man').val(data.apply_man_name);
  175. $('#apply_time').val(data.apply_time);
  176. $('#apply_reason').val(data.apply_reason);
  177. $('#apply_id').val(data.id);
  178. });
  179. }
  180. function aggreeApply(taskId){
  181. var param = {
  182. 'id':$('#apply_id').val(),
  183. 'task_id':taskId
  184. };
  185. addOrUpdateItem4Common(param,'/checkApply/agree',queryUnexaminedTask);
  186. }
  187. function refuseApply(taskId){
  188. var param = {
  189. 'id':$('#apply_id').val(),
  190. 'task_id':taskId
  191. };
  192. addOrUpdateItem4Common(param,'/checkApply/refuse',queryUnexaminedTask);
  193. }
  194. function agreeApplyTaskPatch(){
  195. var param = {
  196. 'apply_ids':$('#unexamined_datatable').mytable('getTableCheckedIds')
  197. };
  198. addOrUpdateItem4Common(param,'/checkApply/agreePatch',queryUnexaminedTask);
  199. }