audit_modal.ejs 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422
  1. <% if (tender.ledger_status === auditConst.status.checking && curAuditor.audit_id === ctx.session.sessionUser.accountId) { %>
  2. <!--审批通过-->
  3. <div class="modal fade sp-location-list" id="sp-done" data-backdrop="static">
  4. <div class="modal-dialog modal-lg" role="document">
  5. <form class="modal-content" action="<%- preUrl %>/ledger/audit/check" method="post" onsubmit="return auditCheck(0);">
  6. <div class="modal-header">
  7. <h5 class="modal-title">审批通过</h5>
  8. </div>
  9. <div class="modal-body">
  10. <div class="row">
  11. <div class="col-4">
  12. <div class="card mt-3">
  13. <ul class="list-group list-group-flush">
  14. <% auditors.forEach((item, idx) => { %>
  15. <% if (idx === 0) { %>
  16. <li class="list-group-item" data-auditorId="<%- item.audit_id %>">
  17. <i class="fa fa fa-play-circle fa-rotate-90"></i> <%- item.name %>
  18. <small class="text-muted"><%- item.role %></small>
  19. <span class="pull-right">原报</span>
  20. </li>
  21. <% } else if(idx === auditors.length -1 && idx !== 0) { %>
  22. <li class="list-group-item" data-auditorId="<%- item.audit_id %>">
  23. <i class="fa fa fa-stop-circle"></i> <%- item.name %>
  24. <small class="text-muted"><%- item.role %></small>
  25. <span class="pull-right">终审</span>
  26. </li>
  27. <% } else {%>
  28. <li class="list-group-item" data-auditorId="<%- item.audit_id %>">
  29. <i class="fa fa-chevron-circle-down"></i> <%- item.name %>
  30. <small class="text-muted"><%- item.role %></small>
  31. <span class="pull-right"><%= ctx.helper.transFormToChinese(idx) %>审</span>
  32. </li>
  33. <% } %>
  34. <% }) %>
  35. </ul>
  36. </div>
  37. </div>
  38. <div class="col-8 modal-height-500" style="overflow: auto">
  39. <% auditHistory.forEach((auditors, idx) => { %>
  40. <!-- 展开/收起历史流程 -->
  41. <% if(idx === auditHistory.length - 1 && auditHistory.length !== 1) { %>
  42. <div class="text-right">
  43. <a href="javascript: void(0);" id="fold-btn" data-target="show">展开历史审批流程</a>
  44. </div>
  45. <% } %>
  46. <div class="<%- idx < auditHistory.length - 1 ? 'fold-card' : '' %>">
  47. <div class="text-center text-muted"><%- idx+1 %>#</div>
  48. <ul class="timeline-list list-unstyled mt-2">
  49. <% auditors.forEach((auditor, index) => { %>
  50. <% if (index === 0) { %>
  51. <li class="timeline-list-item pb-2">
  52. <div class="timeline-item-date">
  53. <%- ctx.helper.formatDate(auditor.begin_time) %>
  54. </div>
  55. <div class="timeline-item-tail"></div>
  56. <div class="timeline-item-icon bg-success text-light">
  57. <i class="fa fa-caret-down"></i>
  58. </div>
  59. <div class="timeline-item-content">
  60. <div class="card">
  61. <div class="card-body p-3">
  62. <div class="card-text">
  63. <p class="mb-1"><span
  64. class="h5"><%- user.name %></span><span
  65. class="pull-right text-success"><%- idx !== 0 ? '重新' : '' %>上报审批</span>
  66. </p>
  67. <p class="text-muted mb-0"><%- user.role %></p>
  68. </div>
  69. </div>
  70. </div>
  71. </div>
  72. </li>
  73. <li class="timeline-list-item pb-2">
  74. <div class="timeline-item-date">
  75. <%- ctx.helper.formatDate(auditor.end_time) %>
  76. </div>
  77. <% if(index < auditors.length - 1) { %>
  78. <div class="timeline-item-tail"></div>
  79. <% } %>
  80. <% if(auditor.status === auditConst.status.checked) { %>
  81. <div class="timeline-item-icon bg-success text-light">
  82. <i class="fa fa-check"></i>
  83. </div>
  84. <% } else if(auditor.status === auditConst.status.checkNo || auditor.status === auditConst.status.checkNoPre) {%>
  85. <div class="timeline-item-icon bg-warning text-light">
  86. <i class="fa fa-level-up"></i>
  87. </div>
  88. <% } else if(auditor.status === auditConst.status.checking) { %>
  89. <div class="timeline-item-icon bg-warning text-light">
  90. <i class="fa fa-ellipsis-h"></i>
  91. </div>
  92. <% } else {%>
  93. <div class="timeline-item-icon bg-secondary text-light">
  94. </div>
  95. <% } %>
  96. <div class="timeline-item-content">
  97. <div class="card">
  98. <div class="card-body p-3">
  99. <div class="card-text">
  100. <p class="mb-1"><span class="h5"><%- auditor.name %></span><span
  101. class="pull-right <%- auditConst.statusClass[auditor.status] %>"><%- auditConst.statusString[auditor.status] %></span>
  102. </p>
  103. <p class="text-muted mb-0"><%- auditor.role %></p>
  104. </div>
  105. </div>
  106. <!--审批意见-->
  107. <% if(auditor.status !== auditConst.status.uncheck) { %>
  108. <div class="card-body p-3 border-top">
  109. <% if (tender.ledger_times === idx + 1 && auditor.status === auditConst.status.checking) { %>
  110. <label>审批意见<b class="text-danger">*</b></label>
  111. <textarea class="form-control form-control-sm"
  112. name="opinion">同意</textarea>
  113. <% } else { %>
  114. <p style="margin: 0;"><%- auditor.opinion %></p>
  115. <% } %>
  116. </div>
  117. <% } %>
  118. </div>
  119. </div>
  120. </li>
  121. <% } else {%>
  122. <li class="timeline-list-item pb-2">
  123. <div class="timeline-item-date">
  124. <%- ctx.helper.formatDate(auditor.end_time) %>
  125. </div>
  126. <% if(index < auditors.length - 1) { %>
  127. <div class="timeline-item-tail"></div>
  128. <% } %>
  129. <% if(auditor.status === auditConst.status.checked) { %>
  130. <div class="timeline-item-icon bg-success text-light">
  131. <i class="fa fa-check"></i>
  132. </div>
  133. <% } else if(auditor.status === auditConst.status.checkNo || auditor.status === auditConst.status.checkNoPre) {%>
  134. <div class="timeline-item-icon bg-warning text-light">
  135. <i class="fa fa-level-up"></i>
  136. </div>
  137. <% } else if(auditor.status === auditConst.status.checking) { %>
  138. <div class="timeline-item-icon bg-warning text-light">
  139. <i class="fa fa-ellipsis-h"></i>
  140. </div>
  141. <% } else { %>
  142. <div class="timeline-item-icon bg-secondary text-light">
  143. </div>
  144. <% } %>
  145. <div class="timeline-item-content">
  146. <div class="card">
  147. <div class="card-body p-3">
  148. <div class="card-text">
  149. <p class="mb-1"><span class="h5"><%- auditor.name %></span>
  150. <span
  151. class="pull-right
  152. <%- auditConst.statusClass[auditor.status] %>"><%- auditor.status !== auditConst.status.uncheck ? auditConst.statusString[auditor.status] : ''%>
  153. <%- auditor.status === auditConst.status.checkNo ? user.name : '' %>
  154. <%- auditor.status === auditConst.status.checkNoPre ? auditors[index-1].name : '' %>
  155. </span>
  156. </p>
  157. <p class="text-muted mb-0"><%- auditor.role %></p>
  158. </div>
  159. </div>
  160. <!--审批意见-->
  161. <% if(auditor.status !== auditConst.status.uncheck) { %>
  162. <div class="card-body p-3 border-top">
  163. <% if (tender.ledger_times === idx + 1 && auditor.status === auditConst.status.checking) { %>
  164. <label>审批意见<b class="text-danger">*</b></label>
  165. <textarea class="form-control form-control-sm"
  166. name="opinion">同意</textarea>
  167. <% } else { %>
  168. <p style="margin: 0;"><%- auditor.opinion %></p>
  169. <% } %>
  170. </div>
  171. <% } %>
  172. </div>
  173. </div>
  174. </li>
  175. <% } %>
  176. <% }) %>
  177. </ul>
  178. </div>
  179. <% }) %>
  180. </div>
  181. </div>
  182. </div>
  183. <div class="modal-footer">
  184. <button type="button" class="btn btn-secondary btn-sm" data-dismiss="modal">关闭</button>
  185. <input type="hidden" name="_csrf_j" value="<%= ctx.csrf %>" />
  186. <input type="hidden" name="checkType" value="<%= auditConst.status.checked %>" />
  187. <button type="submit" class="btn btn-success btn-sm">确认通过</button>
  188. </div>
  189. </form>
  190. </div>
  191. </div>
  192. <!--审批退回-->
  193. <div class="modal fade sp-location-list" id="sp-back" data-backdrop="static">
  194. <div class="modal-dialog modal-lg" role="document">
  195. <form class="modal-content modal-lg" action="<%- preUrl %>/ledger/audit/check" method="post"
  196. onsubmit="return auditCheck(1);">
  197. <div class="modal-header">
  198. <h5 class="modal-title">审批退回</h5>
  199. </div>
  200. <div class="modal-body">
  201. <div class="row">
  202. <div class="col-4">
  203. <div class="card mt-3">
  204. <ul class="list-group list-group-flush">
  205. <% auditors.forEach((item, idx) => { %>
  206. <% if (idx === 0) { %>
  207. <li class="list-group-item" data-auditorId="<%- item.audit_id %>">
  208. <i class="fa fa fa-play-circle fa-rotate-90"></i> <%- item.name %>
  209. <small class="text-muted"><%- item.role %></small>
  210. <span class="pull-right">原报</span>
  211. </li>
  212. <% } else if(idx === auditors.length -1 && idx !== 0) { %>
  213. <li class="list-group-item" data-auditorId="<%- item.audit_id %>">
  214. <i class="fa fa fa-stop-circle"></i> <%- item.name %>
  215. <small class="text-muted"><%- item.role %></small>
  216. <span class="pull-right">终审</span>
  217. </li>
  218. <% } else {%>
  219. <li class="list-group-item" data-auditorId="<%- item.audit_id %>">
  220. <i class="fa fa-chevron-circle-down"></i> <%- item.name %>
  221. <small class="text-muted"><%- item.role %></small>
  222. <span class="pull-right"><%= ctx.helper.transFormToChinese(idx) %>审</span>
  223. </li>
  224. <% } %>
  225. <% }) %>
  226. </ul>
  227. </div>
  228. </div>
  229. <div class="col-8 modal-height-500" style="overflow: auto">
  230. <% auditHistory.forEach((auditors, idx) => { %>
  231. <!-- 展开/收起历史流程 -->
  232. <% if(idx === auditHistory.length - 1 && auditHistory.length !== 1) { %>
  233. <div class="text-right">
  234. <a href="javascript: void(0);" id="fold-btn" data-target="show">展开历史审批流程</a>
  235. </div>
  236. <% } %>
  237. <div class="<%- idx < auditHistory.length - 1 ? 'fold-card' : '' %>">
  238. <div class="text-center text-muted"><%- idx+1 %>#</div>
  239. <ul class="timeline-list list-unstyled mt-2">
  240. <% auditors.forEach((auditor, index) => { %>
  241. <% if (index === 0) { %>
  242. <li class="timeline-list-item pb-2">
  243. <div class="timeline-item-date">
  244. <%- ctx.helper.formatDate(auditor.begin_time) %>
  245. </div>
  246. <div class="timeline-item-tail"></div>
  247. <div class="timeline-item-icon bg-success text-light">
  248. <i class="fa fa-caret-down"></i>
  249. </div>
  250. <div class="timeline-item-content">
  251. <div class="card">
  252. <div class="card-body p-3">
  253. <div class="card-text">
  254. <p class="mb-1"><span
  255. class="h5"><%- user.name %></span><span
  256. class="pull-right text-success"><%- idx !== 0 ? '重新' : '' %>上报审批</span>
  257. </p>
  258. <p class="text-muted mb-0"><%- user.role %></p>
  259. </div>
  260. </div>
  261. </div>
  262. </div>
  263. </li>
  264. <li class="timeline-list-item pb-2">
  265. <div class="timeline-item-date">
  266. <%- ctx.helper.formatDate(auditor.end_time) %>
  267. </div>
  268. <% if(index < auditors.length - 1) { %>
  269. <div class="timeline-item-tail"></div>
  270. <% } %>
  271. <% if(auditor.status === auditConst.status.checked) { %>
  272. <div class="timeline-item-icon bg-success text-light">
  273. <i class="fa fa-check"></i>
  274. </div>
  275. <% } else if(auditor.status === auditConst.status.checkNo || auditor.status === auditConst.status.checkNoPre) {%>
  276. <div class="timeline-item-icon bg-warning text-light">
  277. <i class="fa fa-level-up"></i>
  278. </div>
  279. <% } else if(auditor.status === auditConst.status.checking) { %>
  280. <div class="timeline-item-icon bg-warning text-light">
  281. <i class="fa fa-ellipsis-h"></i>
  282. </div>
  283. <% } else {%>
  284. <div class="timeline-item-icon bg-secondary text-light">
  285. </div>
  286. <% } %>
  287. <div class="timeline-item-content">
  288. <div class="card">
  289. <div class="card-body p-3">
  290. <div class="card-text">
  291. <p class="mb-1"><span class="h5"><%- auditor.name %></span><span
  292. class="pull-right <%- auditConst.statusClass[auditor.status] %>"><%- auditConst.statusString[auditor.status] %></span>
  293. </p>
  294. <p class="text-muted mb-0"><%- auditor.role %></p>
  295. </div>
  296. </div>
  297. <!--审批意见-->
  298. <% if(auditor.times === tender.ledger_times && auditor.status !== auditConst.status.uncheck) { %>
  299. <div class="card-body p-3 border-top">
  300. <% if (tender.ledger_times === idx + 1 && auditor.status === auditConst.status.checking) { %>
  301. <label>审批意见<b class="text-danger">*</b></label>
  302. <textarea class="form-control form-control-sm"
  303. name="opinion">不同意</textarea>
  304. <% } else if(auditor.status === auditConst.status.checked){ %>
  305. <p style="margin: 0;"><%- auditor.opinion %></p>
  306. <% } %>
  307. </div>
  308. <% } %>
  309. </div>
  310. </div>
  311. </li>
  312. <% } else {%>
  313. <li class="timeline-list-item pb-2">
  314. <div class="timeline-item-date">
  315. <%- ctx.helper.formatDate(auditor.end_time) %>
  316. </div>
  317. <% if(index < auditors.length - 1) { %>
  318. <div class="timeline-item-tail"></div>
  319. <% } %>
  320. <% if(auditor.status === auditConst.status.checked) { %>
  321. <div class="timeline-item-icon bg-success text-light">
  322. <i class="fa fa-check"></i>
  323. </div>
  324. <% } else if(auditor.status === auditConst.status.checkNo || auditor.status === auditConst.status.checkNoPre) {%>
  325. <div class="timeline-item-icon bg-warning text-light">
  326. <i class="fa fa-level-up"></i>
  327. </div>
  328. <% } else if(auditor.status === auditConst.status.checking) { %>
  329. <div class="timeline-item-icon bg-warning text-light">
  330. <i class="fa fa-ellipsis-h"></i>
  331. </div>
  332. <% } else { %>
  333. <div class="timeline-item-icon bg-secondary text-light">
  334. </div>
  335. <% } %>
  336. <div class="timeline-item-content">
  337. <div class="card">
  338. <div class="card-body p-3">
  339. <div class="card-text">
  340. <p class="mb-1"><span class="h5"><%- auditor.name %></span>
  341. <span
  342. class="pull-right
  343. <%- auditConst.statusClass[auditor.status] %>"><%- auditor.status !== auditConst.status.uncheck ? auditConst.statusString[auditor.status] : ''%>
  344. <%- auditor.status === auditConst.status.checkNo ? user.name : '' %>
  345. <%- auditor.status === auditConst.status.checkNoPre ? auditors[index-1].name : '' %>
  346. </span>
  347. </p>
  348. <p class="text-muted mb-0"><%- auditor.role %></p>
  349. </div>
  350. </div>
  351. <!--审批意见-->
  352. <% if(auditor.times === tender.ledger_times && auditor.status !== auditConst.status.uncheck) { %>
  353. <div class="card-body p-3 border-top">
  354. <% if (tender.ledger_times === idx + 1 && auditor.status === auditConst.status.checking) { %>
  355. <label>审批意见<b class="text-danger">*</b></label>
  356. <textarea class="form-control form-control-sm"
  357. name="opinion">不同意</textarea>
  358. <% } else { %>
  359. <p style="margin: 0;"><%- auditor.opinion %></p>
  360. <% } %>
  361. </div>
  362. <% } %>
  363. </div>
  364. </div>
  365. </li>
  366. <% } %>
  367. <% }) %>
  368. </ul>
  369. </div>
  370. <% }) %>
  371. </div>
  372. </div>
  373. </div>
  374. <div class="modal-footer">
  375. <button type="button" class="btn btn-secondary btn-sm" data-dismiss="modal">关闭</button>
  376. <input type="hidden" name="_csrf_j" value="<%= ctx.csrf %>" />
  377. <input type="hidden" name="checkType" value="<%= auditConst.status.checkNo %>" />
  378. <button type="submit" class="btn btn-warning btn-sm">确认退回</button>
  379. </div>
  380. </form>
  381. </div>
  382. </div>
  383. <% } %>
  384. <script>
  385. const cur_uid = parseInt('<%- ctx.session.sessionUser.accountId %>');
  386. $('.sp-location-list').on('shown.bs.modal', function () {
  387. const scrollBox = $(this).find('div[class="col-8 modal-height-500"]');
  388. const bdiv = (scrollBox.offset() && scrollBox.offset().top) || 0;
  389. scrollBox.scrollTop(0);
  390. const hdiv = divSearch($(this).find('textarea')) ? $(this).find('textarea') : null;
  391. const hdheight = hdiv ? hdiv.parents('.timeline-item-content').offset().top : null;
  392. if (hdiv && scrollBox.length && scrollBox[0].scrollHeight > 200 && hdheight - bdiv > 200) {
  393. scrollBox.scrollTop(hdheight - bdiv);
  394. }
  395. });
  396. function divSearch(div) {
  397. if (div.length > 0) {
  398. return true;
  399. }
  400. return false;
  401. }
  402. // 展开历史审核记录
  403. $('.modal-body #fold-btn').click(function () {
  404. const type = $(this).data('target')
  405. const auditCard = $(this).parent().parent()
  406. if (type === 'show') {
  407. $(this).data('target', 'hide')
  408. auditCard.find('.fold-card').slideDown('swing', () => {
  409. auditCard.find('#fold-btn').text('收起历史审核记录')
  410. })
  411. } else {
  412. $(this).data('target', 'show')
  413. auditCard.find('.fold-card').slideUp('swing', () => {
  414. auditCard.find('#fold-btn').text('展开历史审核记录')
  415. })
  416. }
  417. });
  418. </script>