oaCheck.js 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655
  1. mbui.define(['form','layer','userPicker','fileupload'], function (exports) {
  2. const layer = mbui.layer;
  3. const form = mbui.form;
  4. const tool = mbui.tool;
  5. const fileupload = mbui.fileupload;
  6. const opts={
  7. "checkBox":"checkBox",//审核容器id
  8. "check_name": "",//审核类型标识
  9. "check_btn":1,//是否显示提交审核按钮
  10. "checking_btn":'',//待审核状态下添加的按钮
  11. "checked_btn":'',//审核通过后添加的按钮
  12. "check_ok":function(){
  13. //审核通过的执行函数
  14. },
  15. "check_no":function(){
  16. //审核拒绝的执行函数
  17. },
  18. "check_back":function(){
  19. //撤回的执行函数
  20. },
  21. "check_reversed":function(){
  22. //反确认的执行函数
  23. }
  24. };
  25. const obj = {
  26. loading:false,
  27. checkStatus: function (status) {
  28. statusArray = ['待提交审批','审批中','审批通过','审批不通过','已撤回'];
  29. return '<span class="check-status-color-'+status+'">'+statusArray[status]+'</span>';
  30. },
  31. statusTemplate: function (status) {
  32. let me = this;
  33. let tem =`
  34. <div class="mbui-list">
  35. <div class="mbui-list-bd">审批状态</div>
  36. <div class="mbui-list-ft">
  37. ${me.checkStatus(status)}
  38. </div>
  39. </div>
  40. `;
  41. return tem;
  42. },
  43. uidsTemplate: function () {
  44. let tem =`
  45. <div class="mbui-form-line">
  46. <label class="mbui-form-label">审 批 人</label>
  47. <input type="text" name="check_uames" value="" placeholder="请选择审批人" data-verify="required" data-errortips="请选择审批人" class="mbui-form-input" readonly><input type="text" name="check_uids" value="" readonly style="display:none;">
  48. </div>
  49. `;
  50. return tem;
  51. },
  52. flowTemplate: function (data) {
  53. let flowtype='<option value="" title="">--请选择--</option>';
  54. if(data && data.length>0){
  55. for(let i=0;i<data.length;i++){
  56. flowtype+='<option value="'+data[i].id+'" title="'+data[i].check_type+'">'+data[i].title+'</option>';
  57. }
  58. }
  59. let tem =`
  60. <div class="mbui-form-line">
  61. <label class="mbui-form-label">审批流程</label>
  62. <div class="mbui-form-select">
  63. <select name="flow_id" data-verify="required" data-errortips="请选择审批流程">
  64. ${flowtype}
  65. </select>
  66. </div>
  67. </div>
  68. `;
  69. return tem;
  70. },
  71. copyTemplate: function (detail) {
  72. let me = this;
  73. let tem =`
  74. <div class="mbui-form-line" style="${detail.is_copy==0?'display:none':''}">
  75. <label class="mbui-form-label">抄 送 人</label>
  76. <input class="mbui-form-input" name="check_copy_unames" value="" readonly placeholder="请选择" placeholder="请选择审批通过后的抄送人" data-type="2">
  77. <input type="text" name="check_copy_uids" value="" readonly style="display:none;">
  78. </div>
  79. `;
  80. return tem;
  81. },
  82. btnTemplate: function () {
  83. let me = this;
  84. let tem =`
  85. <div class="padding-16 center">
  86. <button class="mbui-btn mbui-btn-normal" data-event="submit">提交审批</button>
  87. <button type="reset" class="mbui-btn mbui-btn-primary">重置</button>
  88. ${me.sets.checking_btn}
  89. </div>
  90. `;
  91. if(me.sets.check_btn == 1){
  92. return tem;
  93. }else{
  94. return '';
  95. }
  96. },
  97. recordTemplate: function (record) {
  98. let me = this;
  99. let tem ='';
  100. if(record.length>0){
  101. tem+='<div class="padding-12 border-top">';
  102. tem+='<div class="padding-12-b"><span class="f16 mbui-text-gray">审批记录</span></div>';
  103. tem+='<div class="mbui-steps">';
  104. for(let l=0;l<record.length;l++){
  105. let check_content='';
  106. if(record[l].content!=''){
  107. check_content='审批意见:<span class="text-green">'+record[l].content+'</span>。';
  108. }
  109. tem+='<div class="mbui-steps-item delete-'+record[l].delete_time+'">'+record[l].check_time_str+'<small><span class="text-black">'+record[l].name+'</span><span class="check-status-color-'+(record[l].check_status+1)+'">『'+record[l].status_str+'』</span>了此申请。'+check_content+'</small>';
  110. let file_array= record[l].file_array;
  111. if(file_array.length>0){
  112. tem+='<div style="padding:4px 0; color:#666666">审批附件</div><div class="bg-white"><div class="mbui-file-list" style="padding-bottom:0;">';
  113. for(let f=0;f<file_array.length;f++){
  114. tem+=tool.file_item(file_array[f],1);
  115. }
  116. tem+='</div></div>';
  117. }
  118. tem+='</div>';
  119. }
  120. tem+='</div>';
  121. tem+='</div>';
  122. }
  123. return tem;
  124. },
  125. createTemplate: function (flow) {
  126. let me = this;
  127. let checkHtml = `
  128. <form class="mbui-form" id="formCheckBox">
  129. <div class="mbui-group-title">审批操作</div>
  130. <div class="bg-white">
  131. ${me.flowTemplate(flow)}
  132. <div id="checkTR">${me.uidsTemplate()}</div>
  133. ${me.copyTemplate(flow[0])}
  134. </div>
  135. </form>
  136. `;
  137. return checkHtml;
  138. },
  139. //审批待提交模版
  140. initTemplate: function (detail) {
  141. let me = this;
  142. let checkHtml = `
  143. <form class="mbui-form" id="formCheckBox">
  144. <div class="mbui-group-title">审批操作</div>
  145. <div class="bg-white">
  146. ${me.statusTemplate(detail.check_status)}
  147. ${me.recordTemplate(detail.check_record)}
  148. ${me.flowTemplate(detail.flow)}
  149. <div id="checkTR">${me.uidsTemplate()}</div>
  150. ${me.copyTemplate(detail)}
  151. </div>
  152. ${me.btnTemplate()}
  153. </form>
  154. `;
  155. let viewHtml = `
  156. <form class="mbui-form" id="formCheckBox">
  157. <div class="mbui-group-title">审批操作</div>
  158. <div class="bg-white">
  159. ${me.statusTemplate(detail.check_status)}
  160. ${me.recordTemplate(detail.check_record)}
  161. </div>
  162. </form>
  163. `;
  164. if(detail.is_creater==1){
  165. return checkHtml;
  166. }
  167. else{
  168. return viewHtml;
  169. }
  170. },
  171. //审批中模版
  172. checkTemplate: function (detail) {
  173. let me = this,flowHtml='',list = detail.nodes;
  174. for(var f=0;f<list.length;f++){
  175. //审批流程
  176. let checkUser = '',
  177. iconRight ='<span class="iconfont icon-arrow"></span>',
  178. iconStatus ='<i class="mbui-icon mbui-icon-time"></i>',
  179. strStatus ='<div class="check-item-status">待审批</div>',
  180. check_types= '',
  181. sortClass ='';
  182. if(f == list.length-1){
  183. iconRight ='';
  184. }
  185. if(detail.check_step_sort == list[f].sort){
  186. sortClass ='flow-this';
  187. iconStatus ='<i class="mbui-icon mbui-icon-time"></i>';
  188. strStatus ='<div class="check-item-status">当前审批</div>';
  189. if(list[f].check_uids_info.length>1){
  190. check_types= ' <span class="mbui-badge mbui-bg-blue">会签</span>';
  191. if(list[f].check_types==2){
  192. check_types= ' <span class="mbui-badge mbui-bg-orange">或签</span>';
  193. }
  194. }
  195. }
  196. if(list[f].check_role == 0 || list[f].check_role == 5){
  197. checkUser=list[f].check_uids_info[0].name;
  198. }
  199. if(list[f].check_role == 1 || list[f].check_role == 2 || list[f].check_role == 3 || list[f].check_role == 4){
  200. checkUser=list[f].flow_name;
  201. }
  202. if(list[f].check_list.length>0){
  203. let one=0,two=0,three=0;
  204. for(var m=0;m<list[f].check_uids_info.length;m++){
  205. if(list[f].check_uids_info[m].check_status == 2){
  206. three++
  207. }
  208. if(list[f].check_uids_info[m].check_status == 1){
  209. two++
  210. }
  211. if(list[f].check_uids_info[m].check_status == 0){
  212. one++
  213. }
  214. }
  215. //会签
  216. if(list[f].check_types==1){
  217. if(three > 0){
  218. iconStatus ='<i class="iconfont mbui-icon-close" data-no=""></i>';
  219. strStatus ='<div class="check-item-status">拒绝</div>';
  220. }
  221. else{
  222. if(one > 0){
  223. iconStatus ='<i class="iconfont icon-clock"></i>';
  224. strStatus ='<div class="check-item-status">待审批</div>';
  225. }
  226. else{
  227. iconStatus ='<i class="iconfont icon-kongjian" data-ok=""></i>';
  228. strStatus ='<div class="check-item-status">通过</div>';
  229. }
  230. }
  231. }
  232. //或签
  233. if(list[f].check_types==2){
  234. if(two > 0){
  235. iconStatus ='<i class="iconfont icon-kongjian" data-ok=""></i>';
  236. strStatus ='<div class="check-item-status">通过</div>';
  237. }
  238. else{
  239. iconStatus ='<i class="iconfont mbui-icon-close" data-no=""></i>';
  240. strStatus ='<div class="check-item-status">拒绝</div>';
  241. }
  242. }
  243. }
  244. flowHtml+= '<div class="flow-flexbox check-item flow-flex-row '+sortClass+'" id="flow'+f+'">'+iconStatus+'<div class="check-item-name">'+check_types+checkUser+'</div>'+strStatus+iconRight+'</div>';
  245. }
  246. let checkCopy=`<div class="mbui-list" style="${detail.is_copy==0?'display:none':''}">
  247. <div class="mbui-list-bd">抄 送 人</div>
  248. <div class="mbui-list-ft">
  249. ${detail.copy_unames}
  250. </div>
  251. </div>
  252. `;
  253. let checkNode = `
  254. <div class="mbui-form-line">
  255. <label class="mbui-form-label">审批节点</label>
  256. <div class="mbui-form-radio">
  257. <input class="mbui-input-radio" type="radio" name="check_node" id="check_node1" value="1" /><label for="check_node1">审批结束</label>
  258. <input class="mbui-input-radio" type="radio" name="check_node" id="check_node2" value="2" /><label for="check_node2">下一审批人</label>
  259. </div>
  260. </div>
  261. <div class="mbui-form-line next-admin" style="display:none;">
  262. <label class="mbui-form-label">下一审批人</label>
  263. <input class="mbui-form-input picker-admin" type="text" name="check_uname" value="" placeholder="请选择" readonly>
  264. <input type="hidden" name="check_uids" value="">
  265. </div>
  266. `;
  267. let checkContent = `
  268. <div class="mbui-form-line">
  269. <label class="mbui-form-label">审批意见</label>
  270. <textarea rows="3" name="content" class="mbui-form-input" placeholder="请输入审批意见" data-verify="required" data-errortips="请完善审批意见"></textarea>
  271. </div>
  272. <div class="mbui-form-line" ${detail.is_file==0?'style="display:none;"':''}>
  273. <label class="mbui-form-label">审批附件</label>
  274. <div class="mbui-form-uploader">
  275. <div class="mbui-uploader-btn-border" id="uploadBtnCheck"><i class="iconfont icon-shangchuan"></i></div>
  276. </div>
  277. <div id="uploadBoxCheck" class="mbui-file-list" style="padding:0 12px 2px;">
  278. <input data-type="file" name="check_files" type="hidden" value="">
  279. </div>
  280. </div>
  281. `;
  282. let btnCheck='<span class="mbui-btn mbui-btn-normal btn-check" data-status="1"><i class="mbui-icon mbui-icon-ok"></i> 通过</span><span class="mbui-btn mbui-btn-danger btn-check" data-status="2"><i class="mbui-icon mbui-icon-close"></i> 拒绝</span>';
  283. if(detail.step.check_role==5){
  284. btnCheck='<span class="mbui-btn mbui-btn-normal btn-check" data-status="1"><i class="mbui-icon mbui-icon-ok"></i> 通过</span><span class="mbui-btn mbui-btn-danger btn-check" data-status="2"><i class="mbui-icon mbui-icon-close"></i> 退回</span>';
  285. }
  286. let btnBack='<span class="mbui-btn mbui-btn-primary btn-check" data-status="3"><i class="mbui-icon mbui-icon-reduce-circle"></i> 撤回</span>';
  287. let btnCheckBack='<span class="mbui-btn mbui-btn-danger btn-check" data-event="check" data-status="4">反确认审核</span>';
  288. let checkHtml = `
  289. <form class="mbui-form" id="formCheckBox">
  290. <div class="mbui-group-title">审批操作</div>
  291. <div class="mbui-list">
  292. <div class="mbui-list-bd">审批状态</div>
  293. <div class="mbui-list-ft">
  294. ${me.checkStatus(detail.check_status)}
  295. </div>
  296. </div>
  297. <div class="mbui-list">
  298. <div class="mbui-list-bd">当前审批人</div>
  299. <div class="mbui-list-ft">
  300. ${detail.check_unames}
  301. </div>
  302. </div>
  303. ${checkCopy}
  304. <div class="bg-white">
  305. <div class="padding-12 border-top">
  306. <span class="f16 mbui-text-gray">审批流</span>
  307. </div>
  308. <div class="bg-gray radius-4" style="padding:4px 8px; margin:0 12px 12px;">
  309. <div class="flow-flexbox check-items flow-flex-row" id="flowList">
  310. <div class="flow-flexbox check-item flow-flex-row">
  311. <i class="iconfont icon-fangkuai2" data-ok=""></i>
  312. <div class="check-item-name">${detail.admin_name}</div>
  313. <div class="check-item-status">创建</div>
  314. <span class="iconfont icon-arrow"></span>
  315. </div>
  316. ${flowHtml}
  317. </div>
  318. </div>
  319. ${me.recordTemplate(detail.check_record)}
  320. ${detail.is_checker==1 && detail.step.check_role==0?checkNode:''}
  321. ${detail.is_checker==1?checkContent:''}
  322. </div>
  323. <div class="padding-16 center">
  324. <input type="hidden" name="check_role" value="${detail.step.check_role}">
  325. ${detail.is_checker==1?btnCheck:''}
  326. ${detail.is_creater==1 && detail.is_back==1 && (detail.check_status==1 || detail.check_status==3)?btnBack:''}
  327. ${detail.is_reversed == 1 && typeof me.sets.check_reversed ==='function' && detail.check_status==2?btnCheckBack:''}
  328. ${detail.check_status==2?me.sets.checked_btn:''}
  329. </div>
  330. </form>
  331. `;
  332. return checkHtml;
  333. },
  334. //审批撤回模版
  335. backTemplate: function (detail) {
  336. let me = this;
  337. let btnHtml ='';
  338. if(me.sets.check_btn == 1){
  339. btnHtml ='<div class="padding-16 center"><button class="mbui-btn mbui-btn-normal" data-event="submit">提交审批</button><button type="reset" class="mbui-btn mbui-btn-primary">重置</button></div>';
  340. }
  341. let checkHtml = `
  342. <form class="mbui-form" id="formCheckBox">
  343. <div class="mbui-group-title">审批操作</div>
  344. <div class="bg-white">
  345. ${me.statusTemplate(detail.check_status)}
  346. ${me.recordTemplate(detail.check_record)}
  347. ${me.flowTemplate(detail.flow)}
  348. <div id="checkTR">${me.uidsTemplate()}</div>
  349. ${me.copyTemplate(detail)}
  350. </div>
  351. ${me.btnTemplate()}
  352. </form>
  353. `;
  354. let viewHtml = `
  355. <form class="mbui-form" id="formCheckBox">
  356. <div class="mbui-group-title">审批操作</div>
  357. <div class="bg-white">
  358. ${me.statusTemplate(detail.check_status)}
  359. ${me.recordTemplate(detail.check_record)}
  360. </div>
  361. </form>
  362. `;
  363. if(detail.is_creater==1){
  364. return checkHtml;
  365. }
  366. else{
  367. return viewHtml;
  368. }
  369. },
  370. submit:function(data,callback){
  371. tool.post("/api/check/submit_check", data, callback);
  372. },
  373. init: function (options) {
  374. this.sets = $.extend({}, opts, options);
  375. let me = this;
  376. let checkBox = $('#'+me.sets.checkBox);
  377. let action_id = checkBox.data('id');
  378. let check_status = checkBox.data('status');
  379. let check_flow_id = checkBox.data('checkflowid');
  380. if(action_id === undefined || check_status === undefined || check_flow_id === undefined){
  381. return false;
  382. }
  383. //获取审批信息
  384. $.ajax({
  385. url: "/api/check/get_flow_nodes",
  386. type:'get',
  387. data:{check_name:me.sets.check_name,action_id:action_id,flow_id:check_flow_id},
  388. success: function (e) {
  389. if (e.code == 0) {
  390. if(check_status==0){
  391. if(action_id==0){
  392. if(e.data.length>0){
  393. checkBox.append(me.createTemplate(e.data));
  394. }
  395. else{
  396. let none = '<div class="mbui-group-title">审批操作</div><div class="mbui-form-line">\
  397. <label class="mbui-form-label">审批流程</label>\
  398. <input type="text" name="flow_id" value="" placeholder="未设置审批流程,请联系管理员设置" data-verify="required" data-errortips="未设置审批流程,请联系管理员设置" class="mbui-form-input" readonly>\
  399. </div>';
  400. checkBox.append(none);
  401. }
  402. }
  403. else{
  404. checkBox.append(me.initTemplate(e.data));
  405. }
  406. }
  407. else if(check_status==4){
  408. checkBox.append(me.backTemplate(e.data));
  409. }
  410. else{
  411. checkBox.append(me.checkTemplate(e.data));
  412. //附件上传
  413. fileupload({
  414. uploadBtn: "uploadBtnCheck",
  415. uploadBox: "uploadBoxCheck"
  416. });
  417. }
  418. //提交审批
  419. form({
  420. target: '#formCheckBox',
  421. submit:function(data){
  422. let callback = function (e) {
  423. layer.msg(e.msg);
  424. if (e.code == 0) {
  425. tool.reload(2000);
  426. }
  427. }
  428. data.action_id = action_id;
  429. data.check_name = me.sets.check_name;
  430. tool.post("/api/check/submit_check", data, callback);
  431. return false;
  432. }
  433. });
  434. }
  435. }
  436. })
  437. $('body').on('change','input[name="check_node"]',function() {
  438. var val = this.value;
  439. if(val==2){
  440. $('.next-admin').show();
  441. }
  442. else{
  443. $('.next-admin').hide();
  444. }
  445. });
  446. //选择审批流
  447. $('body').on('change','select[name="flow_id"]', function(data){
  448. var check_type = $('select[name="flow_id"] option:selected').attr('title');
  449. var selectedValue = $(this).val();
  450. if(selectedValue==''){
  451. $('#checkTR').html(me.uidsTemplate());
  452. checkBox.find('[name="check_copy_unames"]').val('');
  453. checkBox.find('[name="check_copy_uids"]').val('');
  454. return false;
  455. }
  456. if(check_type == 1){
  457. $('#checkTR').html(me.uidsTemplate());
  458. checkBox.find('[name="check_uames"]').addClass('picker-admin');
  459. checkBox.find('[name="check_copy_unames"]').addClass('picker-admin');
  460. }
  461. $.ajax({
  462. url: "/api/check/get_flow_users",
  463. type:'get',
  464. data:{id:selectedValue},
  465. success: function (e) {
  466. if (e.code == 0) {
  467. var flow_li='',flow_idx=0;
  468. var flow_data = e.data.flow_data;
  469. checkBox.find('[name="check_copy_unames"]').addClass('picker-admin');
  470. if(e.data.copy_uids && e.data.copy_uids !=''){
  471. checkBox.find('[name="check_copy_unames"]').val(e.data.copy_unames);
  472. checkBox.find('[name="check_copy_uids"]').val(e.data.copy_uids.split(','));
  473. }
  474. if(check_type == 2 || check_type == 3){
  475. for(var a=0;a<flow_data.length;a++){
  476. var check_types = '',check_role = '',user_li='';
  477. if(flow_data[a].check_types==1){
  478. check_types= ' <span class="mbui-badge mbui-bg-blue">会签</span>';
  479. }
  480. if(flow_data[a].check_types==2){
  481. check_types= ' <span class="mbui-badge mbui-bg-orange">或签</span>';
  482. }
  483. if(flow_data[a].check_role==1){
  484. check_role = '当前部门负责人';
  485. }
  486. if(flow_data[a].check_role==2){
  487. check_role = '上级部门负责人';
  488. }
  489. if(flow_data[a].check_role==3){
  490. check_role = '岗位职称:'+flow_data[a].check_position;
  491. }
  492. if(flow_data[a].check_role==4){
  493. check_role = '指定人员';
  494. }
  495. if(flow_data[a].check_role==5){
  496. check_role = flow_data[a].flow_name;
  497. check_types= ' <span class="mbui-badge mbui-bg-text-green">可回退</span>';
  498. }
  499. let check_uids_info=flow_data[a].check_uids_info;
  500. if(check_uids_info.length>0){
  501. flow_idx++;
  502. for(var b=0;b<check_uids_info.length;b++){
  503. user_li+= '<li style="padding:3px 0;line-height:22px"><img src="'+check_uids_info[b].thumb+'" style="width:22px; height:22px; border-radius:50%; vertical-align: bottom; margin-right:8px;" />'+check_uids_info[b].name+'</li>';
  504. }
  505. flow_li+='<div class="mbui-steps-item">第'+flow_idx+'级审批『'+check_role+'』'+check_types+'<small>'+user_li+'</small></div>';
  506. }
  507. }
  508. if(flow_li==''){
  509. flow_li='<span style="color:#999;">审批流程错误,请联系管理员设置</span>';
  510. }
  511. formHtml = '<div class="mbui-form-line">\
  512. <label class="mbui-form-label">审批流</label>\
  513. <ul id="flowList" class="mbui-form-input mbui-steps">'+flow_li+'</ul>\
  514. </div>';
  515. $('#checkTR').html(formHtml);
  516. }
  517. }
  518. }
  519. })
  520. });
  521. //审批操作按钮
  522. checkBox.on('click','.btn-check', function(data){
  523. let content=checkBox.find('[name="content"]').val();
  524. let check_status=$(this).data('status');
  525. let check_role = checkBox.find('input[name="check_role"]').val();
  526. let check_node=0,check_uids='',check_files='';
  527. if(check_role == 0 && check_status==1){
  528. check_node = checkBox.find('input[name="check_node"]:checked').val();
  529. check_uids = checkBox.find('input[name="check_uids"]').val();
  530. if(!check_node){
  531. layer.msg('请选择下一审批节点');
  532. return false;
  533. }
  534. if(check_node == 2 && check_uids==''){
  535. layer.msg('请选择下一审批人');
  536. return false;
  537. }
  538. }
  539. if(check_status ==1 || check_status==2){
  540. check_files = checkBox.find('input[name="check_files"]').val();
  541. let confirmTips='确定通过该审批?';
  542. if(check_status==2){
  543. confirmTips='确定拒绝该审批?';
  544. if(content==''){
  545. layer.msg('请输入审批意见');
  546. return false;
  547. }
  548. }
  549. layer.confirm(confirmTips, function(index){
  550. $.ajax({
  551. url: "/api/check/flow_check",
  552. type:'post',
  553. data:{
  554. action_id:action_id,
  555. check_name:me.sets.check_name,
  556. check_flow_id:check_flow_id,
  557. check_node:check_node,
  558. check_uids:check_uids,
  559. check:check_status,
  560. check_files:check_files,
  561. content:content
  562. },
  563. success: function (e) {
  564. layer.msg(e.msg);
  565. if (e.code == 0) {
  566. if(e.data.check_status==2 && typeof me.sets.check_ok ==='function'){
  567. me.sets.check_ok(e);
  568. }
  569. if(e.data.check_status==3 && typeof me.sets.check_no ==='function'){
  570. me.sets.check_no(e);
  571. }
  572. tool.reload(1000);
  573. }
  574. }
  575. })
  576. layer.close(index);
  577. });
  578. }
  579. else if(check_status ==3){
  580. layer.prompt('请输入撤回理由', function(val, index){
  581. if(val==''){
  582. layer.msg('请输入撤回理由');
  583. return false;
  584. }
  585. $.ajax({
  586. url: "/api/check/flow_check",
  587. type:'post',
  588. data:{
  589. action_id:action_id,
  590. check_name:me.sets.check_name,
  591. check_flow_id:check_flow_id,
  592. check:check_status,
  593. content:val
  594. },
  595. success: function (e) {
  596. layer.msg(e.msg);
  597. if (e.code == 0) {
  598. if(e.data.check_status==4 && typeof me.sets.check_back ==='function'){
  599. me.sets.check_back(e);
  600. }
  601. tool.reload(1000);
  602. }
  603. }
  604. })
  605. layer.close(index);
  606. });
  607. }
  608. else if(check_status ==4){
  609. layer.prompt('请输入反确认理由', function(val, index){
  610. if(val==''){
  611. layer.msg('请输入反确认理由');
  612. return false;
  613. }
  614. $.ajax({
  615. url: "/api/check/flow_check",
  616. type:'post',
  617. data:{
  618. action_id:action_id,
  619. check_name:me.sets.check_name,
  620. check_flow_id:check_flow_id,
  621. check:check_status,
  622. content:val
  623. },
  624. success: function (e) {
  625. layer.msg(e.msg);
  626. if (e.code == 0) {
  627. if(e.data.check_status==0 && typeof me.sets.check_reversed ==='function'){
  628. me.sets.check_reversed(e);
  629. }
  630. tool.reload(1000);
  631. }
  632. }
  633. })
  634. layer.close(index);
  635. });
  636. }
  637. return false;
  638. });
  639. }
  640. };
  641. exports('oaCheck', obj);
  642. });