apply_task.js 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. var cur_page;
  2. function initApplyPage() {
  3. // 仅选择日期
  4. $.jeDate("#start_time", {
  5. isinitVal: true,
  6. format: 'YYYY/MM' // 分隔符可以任意定义,该例子表示只显示年月
  7. });
  8. $("#start_time").val(getCurrentRealTimeFormat());
  9. setSASelect("#fsList");
  10. var store_params = $.zui.store.get('store_param_' + current_url);
  11. var checked_dept = null;
  12. if (store_params) {
  13. checked_dept = store_params.checked_dept;
  14. // $("#start_time").val(store_params.end_time.substr(0, 7));
  15. $("#start_time").val(store_params.end_time.substr(0, 7));
  16. if(store_params.invalidFrom == -2){
  17. $("#check_zc").attr("checked", false);
  18. $("#check_ss").attr("checked", false);
  19. }else if(store_params.invalidFrom == 1){
  20. $("#check_zc").attr("checked", false);
  21. $("#check_ss").attr("checked", true);
  22. }else if(store_params.invalidFrom == 0){
  23. $("#check_zc").attr("checked", true);
  24. $("#check_ss").attr("checked", false);
  25. }else if(store_params.invalidFrom == -1){
  26. $("#check_zc").attr("checked", true);
  27. $("#check_ss").attr("checked", true);
  28. }
  29. console.log(store_params);
  30. var pager = $.zui.store.get("pager");
  31. console.log(pager);
  32. cur_page = pager.p_cur;
  33. } else {
  34. $("#start_time").val(getCurrentTimeFormat());
  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. if (cur_status == 21) {
  41. $("#agreePatchBtn").show();
  42. }
  43. $("#check_zc").attr("checked", true);
  44. $("#check_ss").attr("checked", true);
  45. queryUnexaminedTask();
  46. }
  47. //初始化表行按钮
  48. function initTableRowBtn() {
  49. $.zui.store.set("task_table_btn_21_" + ROLE_JICHA_ADMIN, [{ func: 'showCheck', text: '复查', icon_class: 'icon-eye-open' },
  50. { func: 'showApplyDetail', text: '处理', icon_class: 'icon-eye-open' }
  51. ]);
  52. $.zui.store.set("task_table_btn_21_" + ROLE_JICHA, [{ func: 'showApplyDetail1', text: '详情', icon_class: 'icon-eye-open' }]);
  53. $.zui.store.set("task_table_btn_22", [{ func: 'showApplyDetail1', text: '详情', icon_class: 'icon-tasks' }]);
  54. $.zui.store.set("task_table_btn_23", [{ func: 'showApplyDetail1', text: '详情', icon_class: 'icon-tasks' }]);
  55. }
  56. function queryUnexaminedTask() {
  57. initTableRowBtn();
  58. var t = getTimeByMonth($("#start_time").val());
  59. var check_ss = $("#check_ss").prop("checked");
  60. var check_zc = $("#check_zc").prop("checked");
  61. var data = {
  62. "start_time": getMomentTimeFormat(t.starttime),
  63. "end_time": getMomentTimeFormat(t.endtime),
  64. "checked_dept": $("#fsList").val(),
  65. "checked_person": $("#feePersonList").val(),
  66. "check_status": cur_status,
  67. "invalidFrom": (check_ss && check_zc) ? -1 : (check_ss ? 1 : (check_zc ? 0 : -2))
  68. };
  69. var hide = false;
  70. if (hasRole(ROLE_FWQ_ADMIN) || hasRole(ROLE_FWQ) || hasRole(ROLE_JICHA) || roleContains('FWQ')) {
  71. hide = true;
  72. }
  73. var cols = [
  74. { width: 80, text: '序号', type: 'number', flex: true, colClass: 'text-center', field: 'num' },
  75. { width: 160, text: '任务名称', type: 'string', flex: true, sort: 'down', field: 'name' },
  76. { width: 160, text: '考核部门', type: 'string', flex: true, sort: 'down', field: 'checked_dept_name' },
  77. { width: 80, text: '稽查人员', type: 'string', flex: true, hide: hide, field: 'checkman_name' },
  78. { width: 160, text: '稽查时间段', type: 'string', flex: true, sort: 'down', field: 'check_period' }
  79. // {width: 120, text: '状态', type: 'string', flex: true, colClass: '',field: 'check_status_name'},
  80. // {width: 100, text: '操作', type: 'string', flex: true, field: 'id',
  81. // oper:[
  82. // {func:'showApplyDetail',text:'处理',icon_class:'icon-hand-up'}
  83. // ]
  84. // }
  85. ];
  86. var colFunc = { width: 120, text: '操作', type: 'string', flex: true, field: 'id' };
  87. if (cur_status == 21) {
  88. if (hasRole(ROLE_JICHA)) {
  89. colFunc.oper = $.zui.store.get("task_table_btn_" + cur_status + "_" + ROLE_JICHA);
  90. } else if (ROLE_JICHA_ADMIN) {
  91. colFunc.oper = $.zui.store.get("task_table_btn_" + cur_status + "_" + ROLE_JICHA_ADMIN);
  92. }
  93. } else {
  94. colFunc.oper = $.zui.store.get("task_table_btn_" + cur_status);
  95. }
  96. cols.push(colFunc);
  97. var checkable = false;
  98. if (cur_status == 21 && hasRole(ROLE_JICHA_ADMIN)) {
  99. checkable = true;
  100. }
  101. $('#unexamined_datatable').mytable({
  102. 'cols': cols,
  103. 'checkable': checkable,
  104. 'url': "/f/task/getall/",
  105. 'param': data,
  106. 'pager': {
  107. 'p_cur': cur_page
  108. }
  109. });
  110. $.zui.store.set('store_param_' + current_url, data);
  111. }
  112. //进入稽查页面
  113. function showCheck(id) {
  114. $.checkTask = getItemByIdFromArr(id, $('#unexamined_datatable').mytable('getTableData'));
  115. if (typeof($.checkTask) != "undefined" && typeof($.checkTask.appeal) != "undefined") {
  116. $.checkTask.appeal = null;
  117. }
  118. //开始稽查
  119. no_return_common_service('/f/task/update', { "id": $.checkTask.id, "check_status": 21, "record_status": 1, "check_status_name": "复查" });
  120. changePage("/fwq/view/task/check.html");
  121. }
  122. function showApplyDetail1(id) {
  123. layer.open({
  124. type: 1,
  125. area: ['400px', '500px'],
  126. title: '申请处理',
  127. closeBtn: 1,
  128. shadeClose: true,
  129. skin: 'layui-layer-lan',
  130. content: $('#apply_detail_div'),
  131. btn: ['关闭'],
  132. btnAlign: 'c', //按钮居中
  133. shade: 0, //不显示遮罩
  134. yes: function(index) {
  135. layer.close(index);
  136. }
  137. });
  138. var param = {
  139. 'id': id
  140. };
  141. $('#apply_man').val("");
  142. $('#apply_time').val("");
  143. $('#apply_reason').val("");
  144. $('#apply_id').val("");
  145. post_common_service('/f/checkApply/getByTaskId', param, function(data) {
  146. $('#apply_man').val(data.apply_man_name);
  147. $('#apply_time').val(data.apply_time);
  148. $('#apply_reason').val(data.apply_reason);
  149. $('#apply_id').val(data.id);
  150. });
  151. }
  152. function showApplyDetail(id) {
  153. layer.open({
  154. type: 1,
  155. area: ['400px', '500px'],
  156. title: '申请处理',
  157. closeBtn: 1,
  158. shadeClose: true,
  159. skin: 'layui-layer-lan',
  160. content: $('#apply_detail_div'),
  161. btn: ['同意', '拒绝'],
  162. btnAlign: 'c', //按钮居中
  163. shade: 0, //不显示遮罩
  164. yes: function(index) {
  165. aggreeApply(id);
  166. layer.close(index);
  167. },
  168. btn2: function(index) {
  169. refuseApply(id)
  170. layer.close(index);
  171. }
  172. });
  173. var param = {
  174. 'id': id
  175. };
  176. $('#apply_man').val("");
  177. $('#apply_time').val("");
  178. $('#apply_reason').val("");
  179. $('#apply_id').val("");
  180. post_common_service('/f/checkApply/getByTaskId', param, function(data) {
  181. $('#apply_man').val(data.apply_man_name);
  182. $('#apply_time').val(data.apply_time);
  183. $('#apply_reason').val(data.apply_reason);
  184. $('#apply_id').val(data.id);
  185. });
  186. }
  187. function aggreeApply(taskId) {
  188. var param = {
  189. 'id': $('#apply_id').val(),
  190. 'task_id': taskId
  191. };
  192. addOrUpdateItem4Common(param, '/f/checkApply/agree', queryUnexaminedTask);
  193. }
  194. function refuseApply(taskId) {
  195. var param = {
  196. 'id': $('#apply_id').val(),
  197. 'task_id': taskId
  198. };
  199. addOrUpdateItem4Common(param, '/f/checkApply/refuse', queryUnexaminedTask);
  200. }
  201. function agreeApplyTaskPatch() {
  202. var check_ss = $("#check_ss").prop("checked");
  203. var check_zc = $("#check_zc").prop("checked");
  204. var t = getTimeByMonth($("#start_time").val());
  205. var param = {
  206. "start_time": new Date(t.starttime),
  207. "end_time": new Date(t.endtime),
  208. "checked_dept": $("#fsList").val(),
  209. "invalidFrom": (check_ss && check_zc) ? -1 : (check_ss ? 1 : (check_zc ? 0 : -2))
  210. // 'apply_ids': $('#unexamined_datatable').mytable('getTableCheckedIds')
  211. };
  212. con=confirm("确定全部无效?");
  213. if(con == true){
  214. addOrUpdateItem4Common(param, '/f/checkApply/agreePatch', queryUnexaminedTask);
  215. }
  216. }