audit_modal.ejs 46 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682
  1. <% if (tender.ledger_status === auditConst.status.checking && tender.curAuditorIds.indexOf(ctx.session.sessionUser.accountId) >= 0) { %>
  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. <% if(tender.ledger_status !== auditConst.status.checked && ctx.session.sessionUser.is_admin) { %>
  13. <a class="sp-list-item" href="#sub-sp2" data-toggle="modal" data-target="#sub-sp2" id="hideSp">修改审批流程</a>
  14. <% } %>
  15. <div class="card modal-height-500 mt-3 scroll-y">
  16. <ul class="list-group list-group-flush auditors-list" id="auditors-list">
  17. <% tender.userGroups.forEach((group, idx) => { %>
  18. <% if (idx === 0) { %>
  19. <li class="list-group-item d-flex justify-content-between align-items-center">
  20. <span class="mr-1"><i class="fa fa fa-play-circle fa-rotate-90"></i></span>
  21. <span class="text-muted">
  22. <% for (const u of group) { %>
  23. <small class="d-inline-block text-dark mx-1" title="<%- u.role %>" data-auditorId="<%- u.audit_id %>"><%- u.name %></small>
  24. <% } %>
  25. </span>
  26. <span class="badge badge-light badge-pill ml-auto"><small>原报</small></span>
  27. </li>
  28. <% } else if(idx === tender.userGroups.length -1 && idx !== 0) { %>
  29. <li class="list-group-item d-flex justify-content-between align-items-center">
  30. <span class="mr-1"><i class="fa fa fa-stop-circle"></i></span>
  31. <span class="text-muted">
  32. <% for (const u of group) { %>
  33. <small class="d-inline-block text-dark mx-1" title="<%- u.role %>" data-auditorId="<%- u.audit_id %>"><%- u.name %></small>
  34. <% } %>
  35. </span>
  36. <div class="d-flex ml-auto">
  37. <% if (group[0].audit_type !== auditType.key.common) { %>
  38. <span class="badge badge-pill badge-<%- auditType.info[group[0].audit_type].class %> p-1"><small><%- auditType.info[group[0].audit_type].short %></small></span>
  39. <% } %>
  40. <span class="badge badge-light badge-pill"><small>终审</small></span>
  41. </div>
  42. </li>
  43. <% } else {%>
  44. <li class="list-group-item d-flex justify-content-between align-items-center">
  45. <span class="mr-1"><i class="fa fa-chevron-circle-down"></i></span>
  46. <span class="text-muted">
  47. <% for (const u of group) { %>
  48. <small class="d-inline-block text-dark mx-1" title="<%- u.role %>" data-auditorId="<%- u.audit_id %>"><%- u.name %></small>
  49. <% } %>
  50. </span>
  51. <div class="d-flex ml-auto">
  52. <% if (group[0].audit_type !== auditType.key.common) { %>
  53. <span class="badge badge-pill badge-<%- auditType.info[group[0].audit_type].class %> p-1"><small><%- auditType.info[group[0].audit_type].short %></small></span>
  54. <% } %>
  55. <span class="badge badge-light badge-pill"><small><%= ctx.helper.transFormToChinese(idx) %>审</small></span>
  56. </div>
  57. </li>
  58. <% } %>
  59. <% }) %>
  60. </ul>
  61. </div>
  62. </div>
  63. <div class="col-8 modal-height-500 scroll-y">
  64. <% tender.auditHistory.forEach((his, idx) => { %>
  65. <!-- 展开/收起历史流程 -->
  66. <% if(idx === tender.auditHistory.length - 1 && tender.auditHistory.length !== 1) { %>
  67. <div class="text-right">
  68. <a href="javascript: void(0);" id="fold-btn" data-target="show">展开历史审批流程</a>
  69. </div>
  70. <% } %>
  71. <div class="<%- idx < tender.auditHistory.length - 1 ? 'fold-card' : '' %>">
  72. <div class="text-center text-muted"><%- idx+1 %>#</div>
  73. <ul class="timeline-list list-unstyled mt-2 <% if (idx === tender.auditHistory.length - 1 && tender.auditHistory.length > 1) { %>last-auditor-list<% } %>">
  74. <% his.forEach((group, index) => { %>
  75. <% if (index === 0) { %>
  76. <li class="timeline-list-item pb-2">
  77. <div class="timeline-item-date">
  78. <%- group.beginYear %>
  79. <span><%- group.beginDate %></span>
  80. <span><%- group.beginTime %></span>
  81. </div>
  82. <div class="timeline-item-tail"></div>
  83. <div class="timeline-item-icon bg-success text-light"><i class="fa fa-caret-down"></i></div>
  84. <div class="timeline-item-content">
  85. <div class="py-1">
  86. <span class="text-black-50">原报</span>
  87. <span class="pull-right text-success"><%- idx !== 0 ? '重新' : '' %>上报审批</span>
  88. </div>
  89. <div class="card">
  90. <div class="card-body px-3 py-0">
  91. <div class="card-text p-2 py-3 row">
  92. <div class="col">
  93. <span class="h6"><%- tender.user.name %></span>
  94. <span class="text-muted ml-1"><%- tender.user.role %></span>
  95. </div>
  96. <div class="col">
  97. <span class="pull-right text-success"><i class="fa fa-check-circle"></i></span>
  98. </div>
  99. </div>
  100. </div>
  101. </div>
  102. </div>
  103. </li>
  104. <% } %>
  105. <li class="timeline-list-item pb-2 <% if (group.status === auditConst.status.uncheck && idx === tender.auditHistory.length - 1 && tender.auditHistory.length > 1) { %>is_uncheck<% } %>">
  106. <% if (group.endYear) { %>
  107. <div class="timeline-item-date">
  108. <%- group.endYear %>
  109. <span><%- group.endDate %></span>
  110. <span><%- group.endTime %></span>
  111. </div>
  112. <% } %>
  113. <% if (index < his.length - 1) { %>
  114. <div class="timeline-item-tail"></div>
  115. <% } %>
  116. <% if (group.status === auditConst.status.checked) { %>
  117. <div class="timeline-item-icon bg-success text-light"><i class="fa fa-check"></i></div>
  118. <% } else if (group.status === auditConst.status.checkNo || group.status === auditConst.status.checkNoPre || group.status === auditConst.status.checkCancel) { %>
  119. <div class="timeline-item-icon bg-warning text-light"><i class="fa fa-level-up"></i></div>
  120. <% } else if (group.status === auditConst.status.checking) { %>
  121. <div class="timeline-item-icon bg-warning text-light"><i class="fa fa-ellipsis-h"></i></div>
  122. <% } else { %>
  123. <div class="timeline-item-icon bg-secondary text-light"></div>
  124. <% } %>
  125. <div class="timeline-item-content">
  126. <div class="py-1">
  127. <span class="text-black-50">
  128. <%- (!group.is_final ? group.audit_order : '终') %>审
  129. <% if (group.audit_type !== auditType.key.common) { %><span class="text-<%- auditType.info[group.audit_type].class %> "><%- auditType.info[group.audit_type].long %></span><% } %>
  130. </span>
  131. <% if (group.status !== auditConst.status.uncheck) { %>
  132. <span class="pull-right <%- auditConst.statusClass[group.status] %>"><%- auditConst.statusString[group.status] %></span>
  133. <% } %>
  134. </div>
  135. <div class="card">
  136. <div class="card-body px-3 py-0">
  137. <% for (const [i, auditor] of group.auditors.entries()) { %>
  138. <div class="card-text p-2 py-3 row <%- ( i > 0 ? 'border-top' : '') %>">
  139. <div class="col">
  140. <span class="h6"><%- auditor.name %></span>
  141. <span class="text-muted ml-1"><%- auditor.role %></span>
  142. </div>
  143. <div class="col">
  144. <% if (auditor.status === auditConst.status.checked) { %>
  145. <span class="pull-right text-success"><i class="fa fa-check-circle"></i></span>
  146. <% } if (auditor.status === auditConst.status.checkNo || auditor.status === auditConst.status.checkNoPre || auditor.status === auditConst.status.checkCancel) { %>
  147. <span class="pull-right text-warning"><i class="fa fa-share-square fa-rotate-270"></i></span>
  148. <% } else if (auditor.status === auditConst.status.checking) { %>
  149. <span class="pull-right text-warning"><i class="fa fa-commenting"></i></span>
  150. <% } %>
  151. </div>
  152. <% if (auditor.status !== auditConst.status.uncheck && auditor.opinion) { %>
  153. <div class="col-12 py-1 bg-light"><i class="fa fa-commenting-o mr-1"></i><%- auditor.opinion%></div>
  154. <% } %>
  155. <% if (auditor.status === auditConst.status.checking && auditor.audit_id === ctx.session.sessionUser.accountId) { %>
  156. <div class="col-12 py-1 bg-light">
  157. <textarea class="form-control form-control-sm" name="opinion">同意</textarea>
  158. </div>
  159. <% } %>
  160. </div>
  161. <% } %>
  162. </div>
  163. </div>
  164. </div>
  165. </li>
  166. <% }) %>
  167. </ul>
  168. </div>
  169. <% }) %>
  170. </div>
  171. </div>
  172. </div>
  173. <div class="modal-footer">
  174. <button type="button" class="btn btn-secondary btn-sm" data-dismiss="modal">关闭</button>
  175. <input type="hidden" name="_csrf_j" value="<%= ctx.csrf %>" />
  176. <input type="hidden" name="checkType" value="<%= auditConst.status.checked %>" />
  177. <button type="submit" class="btn btn-success btn-sm">确认通过</button>
  178. </div>
  179. </form>
  180. </div>
  181. </div>
  182. <!--审批退回-->
  183. <div class="modal fade sp-location-list" id="sp-back" data-backdrop="static">
  184. <div class="modal-dialog modal-lg" role="document">
  185. <form class="modal-content modal-lg" action="<%- preUrl %>/ledger/audit/check" method="post"
  186. onsubmit="return auditCheck(1);">
  187. <div class="modal-header">
  188. <h5 class="modal-title">审批退回</h5>
  189. </div>
  190. <div class="modal-body">
  191. <div class="row">
  192. <div class="col-4">
  193. <% if(tender.ledger_status !== auditConst.status.checked && ctx.session.sessionUser.is_admin) { %>
  194. <a class="sp-list-item" href="#sub-sp2" data-toggle="modal" data-target="#sub-sp2" id="hideSp">修改审批流程</a>
  195. <% } %>
  196. <div class="card modal-height-500 mt-3 scroll-y" style="overflow: auto">
  197. <ul class="list-group list-group-flush auditors-list" id="auditors-list">
  198. <% tender.userGroups.forEach((item, idx) => { %>
  199. <% if (idx === 0) { %>
  200. <li class="list-group-item d-flex justify-content-between align-items-center">
  201. <span class="mr-1"><i class="fa fa fa-play-circle fa-rotate-90"></i></span>
  202. <span class="text-muted">
  203. <% for (const u of item) { %>
  204. <small class="d-inline-block text-dark mx-1" title="<%- u.role %>" data-auditorId="<%- u.audit_id %>"><%- u.name %></small>
  205. <% } %>
  206. </span>
  207. <span class="badge badge-light badge-pill ml-auto"><small>原报</small></span>
  208. </li>
  209. <% } else if(idx === tender.userGroups.length -1 && idx !== 0) { %>
  210. <li class="list-group-item d-flex justify-content-between align-items-center">
  211. <span class="mr-1"><i class="fa fa fa-stop-circle"></i></span>
  212. <span class="text-muted">
  213. <% for (const u of item) { %>
  214. <small class="d-inline-block text-dark mx-1" title="<%- u.role %>" data-auditorId="<%- u.audit_id %>"><%- u.name %></small>
  215. <% } %>
  216. </span>
  217. <div class="d-flex ml-auto">
  218. <% if (item[0].audit_type !== auditType.key.common) { %>
  219. <span class="badge badge-pill badge-<%- auditType.info[item[0].audit_type].class %> p-1"><small><%- auditType.info[item[0].audit_type].short %></small></span>
  220. <% } %>
  221. <span class="badge badge-light badge-pill"><small>终审</small></span>
  222. </div>
  223. </li>
  224. <% } else {%>
  225. <li class="list-group-item d-flex justify-content-between align-items-center">
  226. <span class="mr-1"><i class="fa fa-chevron-circle-down"></i></span>
  227. <span class="text-muted">
  228. <% for (const u of item) { %>
  229. <small class="d-inline-block text-dark mx-1" title="<%- u.role %>" data-auditorId="<%- u.audit_id %>"><%- u.name %></small>
  230. <% } %>
  231. </span>
  232. <div class="d-flex ml-auto">
  233. <% if (item[0].audit_type !== auditType.key.common) { %>
  234. <span class="badge badge-pill badge-<%- auditType.info[item[0].audit_type].class %> p-1"><small><%- auditType.info[item[0].audit_type].short %></small></span>
  235. <% } %>
  236. <span class="badge badge-light badge-pill"><small><%= ctx.helper.transFormToChinese(idx) %>审</small></span>
  237. </div>
  238. </li>
  239. <% } %>
  240. <% }) %>
  241. </ul>
  242. </div>
  243. </div>
  244. <div class="col-8 modal-height-500" style="overflow: auto">
  245. <% tender.auditHistory.forEach((his, idx) => { %>
  246. <!-- 展开/收起历史流程 -->
  247. <% if(idx === tender.auditHistory.length - 1 && tender.auditHistory.length !== 1) { %>
  248. <div class="text-right"><a href="javascript: void(0);" id="fold-btn" data-target="show"
  249. data-idx="<%- idx + 1 %>">展开历史审批流程</a></div>
  250. <% } %>
  251. <div class="<%- idx < tender.auditHistory.length - 1 ? 'fold-card' : '' %>">
  252. <div class="text-center text-muted"><%- idx+1 %>#</div>
  253. <ul class="timeline-list list-unstyled mt-2 <% if (idx === tender.auditHistory.length - 1 && tender.auditHistory.length !== 1) { %>last-auditor-list<% } %>">
  254. <% his.forEach((group, index) => { %>
  255. <% if (index === 0) { %>
  256. <li class="timeline-list-item pb-2">
  257. <div class="timeline-item-date">
  258. <%- group.beginYear %>
  259. <span><%- group.beginDate %></span>
  260. <span><%- group.beginTime %></span>
  261. </div>
  262. <div class="timeline-item-tail"></div>
  263. <div class="timeline-item-icon bg-success text-light"><i class="fa fa-caret-down"></i></div>
  264. <div class="timeline-item-content">
  265. <div class="py-1">
  266. <span class="text-black-50">原报</span>
  267. <span class="pull-right text-success"><%- idx !== 0 ? '重新' : '' %>上报审批</span>
  268. </div>
  269. <div class="card">
  270. <div class="card-body px-3 py-0">
  271. <div class="card-text p-2 py-3 row">
  272. <div class="col">
  273. <span class="h6"><%- tender.user.name %></span>
  274. <span class="text-muted ml-1"><%- tender.user.role %></span>
  275. </div>
  276. <div class="col">
  277. <span class="pull-right text-success"><i class="fa fa-check-circle"></i></span>
  278. </div>
  279. </div>
  280. </div>
  281. </div>
  282. </div>
  283. </li>
  284. <% } %>
  285. <li class="timeline-list-item pb-2 <% if (group.status === auditConst.status.uncheck && idx === tender.auditHistory.length - 1 && tender.auditHistory.length !== 1) { %>is_uncheck<% } %>">
  286. <% if (his.endYear) { %>
  287. <div class="timeline-item-date">
  288. <%- group.endYear %>
  289. <span><%- group.endDate %></span>
  290. <span><%- group.endTime %></span>
  291. </div>
  292. <% } %>
  293. <% if (index < his.length - 1) { %>
  294. <div class="timeline-item-tail"></div>
  295. <% } %>
  296. <% if (group.status === auditConst.status.checked) { %>
  297. <div class="timeline-item-icon bg-success text-light"><i class="fa fa-check"></i></div>
  298. <% } else if (group.status === auditConst.status.checkNo || group.status === auditConst.status.checkNoPre || group.status === auditConst.status.checkCancel) { %>
  299. <div class="timeline-item-icon bg-warning text-light"><i class="fa fa-level-up"></i></div>
  300. <% } else if (group.status === auditConst.status.checking) { %>
  301. <div class="timeline-item-icon bg-warning text-light"><i class="fa fa-ellipsis-h"></i></div>
  302. <% } else { %>
  303. <div class="timeline-item-icon bg-secondary text-light"></div>
  304. <% } %>
  305. <div class="timeline-item-content">
  306. <div class="py-1">
  307. <span class="text-black-50">
  308. <%- (!group.is_final ? group.audit_order : '终') %>审
  309. <% if (group.audit_type !== auditType.key.common) { %><span class="text-<%- auditType.info[group.audit_type].class %> "><%- auditType.info[group.audit_type].long %></span><% } %>
  310. </span>
  311. <% if (group.status !== auditConst.status.uncheck) { %>
  312. <span class="pull-right <%- auditConst.statusClass[group.status] %>"><%- auditConst.statusString[group.status] %></span>
  313. <% } %>
  314. </div>
  315. <div class="card">
  316. <div class="card-body px-3 py-0">
  317. <% for (const [i, auditor] of group.auditors.entries()) { %>
  318. <div class="card-text p-2 py-3 row <%- ( i > 0 ? 'border-top' : '') %>">
  319. <div class="col">
  320. <span class="h6"><%- auditor.name %></span>
  321. <span class="text-muted ml-1"><%- auditor.role %></span>
  322. </div>
  323. <div class="col">
  324. <% if (auditor.status === auditConst.status.checked) { %>
  325. <span class="pull-right text-success"><i class="fa fa-check-circle"></i></span>
  326. <% } if (auditor.status === auditConst.status.checkNo || auditor.status === auditConst.status.checkNoPre || auditor.status === auditConst.status.checkCancel) { %>
  327. <span class="pull-right text-warning"><i class="fa fa-share-square fa-rotate-270"></i></span>
  328. <% } else if (auditor.status === auditConst.status.checking) { %>
  329. <span class="pull-right text-warning"><i class="fa fa-commenting"></i></span>
  330. <% } %>
  331. </div>
  332. <% if (auditor.status !== auditConst.status.uncheck && auditor.opinion) { %>
  333. <div class="col-12 py-1 bg-light"><i class="fa fa-commenting-o mr-1"></i><%- auditor.opinion%></div>
  334. <% } %>
  335. <% if (auditor.status === auditConst.status.checking && auditor.audit_id === ctx.session.sessionUser.accountId) { %>
  336. <div class="col-12 py-1 bg-light">
  337. <textarea class="form-control form-control-sm" name="opinion">不同意</textarea>
  338. </div>
  339. <% } %>
  340. </div>
  341. <% } %>
  342. </div>
  343. </div>
  344. </div>
  345. </li>
  346. <% }) %>
  347. </ul>
  348. </div>
  349. <% }) %>
  350. </div>
  351. </div>
  352. </div>
  353. <div class="modal-footer">
  354. <button type="button" class="btn btn-secondary btn-sm" data-dismiss="modal">关闭</button>
  355. <input type="hidden" name="_csrf_j" value="<%= ctx.csrf %>" />
  356. <input type="hidden" name="checkType" value="<%= auditConst.status.checkNo %>" />
  357. <button type="submit" class="btn btn-warning btn-sm">确认退回</button>
  358. </div>
  359. </form>
  360. </div>
  361. </div>
  362. <% } %>
  363. <% if (tender.ledger_status !== auditConst.status.checked && ctx.session.sessionUser.is_admin) { %>
  364. <!--上报审批-->
  365. <div class="modal fade" id="sub-sp2" data-backdrop="static">
  366. <div class="modal-dialog" style="max-width: 650px" role="document">
  367. <div class="modal-content">
  368. <div class="modal-header">
  369. <h5 class="modal-title">修改审批流程</h5>
  370. </div>
  371. <div class="modal-body">
  372. <div class="card mt-1">
  373. <div class="modal-height-500" style="overflow: visible">
  374. <style>
  375. #admin-edit-shenpi thead th {
  376. border-bottom: 0;
  377. }
  378. #admin-edit-shenpi td, #admin-edit-shenpi th {
  379. padding: 0.75rem;
  380. }
  381. #admin-edit-shenpi th {
  382. background: none;
  383. color: #212529;
  384. border-top: 0;
  385. }
  386. </style>
  387. <table class="table table-hover" id="admin-edit-shenpi">
  388. <thead>
  389. <tr class="card-header">
  390. <th>审批流程</th>
  391. <th width="80" style="text-align: center">审批状态</th>
  392. <th width="200" style="text-align: center">操作</th>
  393. </tr>
  394. </thead>
  395. <% for (let i = 1, iLen = auditors.length; i < iLen; i++) { %>
  396. <tr>
  397. <td><span class="shenpi-order"><%- i %></span> <%- auditors[i].name %> <small class="text-muted"><%- auditors[i].role %></small></td>
  398. <td style="text-align: center"><span class="<%- auditConst.auditStringClass[auditors[i].status] %>"><%- auditors[i].status !== auditConst.status.uncheck ? auditConst.auditString[auditors[i].status] : '待审批' %></span></td>
  399. <td style="text-align: center">
  400. <% if (auditors[i].status === auditConst.status.checking) { %>
  401. <span class="dropdown mr-2">
  402. <a href="javascript: void(0)" class="add-audit" id="<%- auditors[i].audit_id %>_add_dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">增加</a>
  403. <div class="dropdown-menu dropdown-menu-right" id="<%- auditors[i].audit_id %>_add_dropdownMenu" aria-labelledby="<%- auditors[i].audit_id %>_add_dropdownMenuButton" style="width:220px">
  404. <div class="mb-2 p-2"><input class="form-control form-control-sm gr-search"
  405. placeholder="姓名/手机 检索" autocomplete="off" data-code="<%- auditors[i].audit_id %>_add"></div>
  406. <dl class="list-unstyled book-list" data-aid="<%- auditors[i].audit_id %>" data-operate="add">
  407. <% accountGroup.forEach((group, idx) => { %>
  408. <dt><a href="javascript: void(0);" class="acc-btn" data-groupid="<%- idx %>"
  409. data-type="hide"><i class="fa fa-plus-square"></i></a> <%- group.groupName %></dt>
  410. <div class="dd-content" data-toggleid="<%- idx %>">
  411. <% group.groupList.forEach(item => { %>
  412. <% if (item.id !== ctx.tender.user_id) { %>
  413. <dd class="border-bottom p-2 mb-0 " data-id="<%- item.id %>">
  414. <p class="mb-0 d-flex"><span class="text-primary"><%- item.name %></span><span
  415. class="ml-auto"><%- item.mobile %></span></p>
  416. <span class="text-muted"><%- item.role %></span>
  417. </dd>
  418. <% } %>
  419. <% });%>
  420. </div>
  421. <% }) %>
  422. </dl>
  423. </div>
  424. </span>
  425. <% } %>
  426. <% if (auditors[i].status === auditConst.status.uncheck) { %>
  427. <span class="dropdown mr-2">
  428. <a href="javascript: void(0)" class="add-audit" id="<%- auditors[i].audit_id %>_add_dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">增加</a>
  429. <div class="dropdown-menu dropdown-menu-right" id="<%- auditors[i].audit_id %>_add_dropdownMenu" aria-labelledby="<%- auditors[i].audit_id %>_add_dropdownMenuButton" style="width:220px">
  430. <div class="mb-2 p-2"><input class="form-control form-control-sm gr-search"
  431. placeholder="姓名/手机 检索" autocomplete="off" data-code="<%- auditors[i].audit_id %>_add"></div>
  432. <dl class="list-unstyled book-list" data-aid="<%- auditors[i].audit_id %>" data-operate="add">
  433. <% accountGroup.forEach((group, idx) => { %>
  434. <dt><a href="javascript: void(0);" class="acc-btn" data-groupid="<%- idx %>"
  435. data-type="hide"><i class="fa fa-plus-square"></i></a> <%- group.groupName %></dt>
  436. <div class="dd-content" data-toggleid="<%- idx %>">
  437. <% group.groupList.forEach(item => { %>
  438. <% if (item.id !== ctx.tender.user_id) { %>
  439. <dd class="border-bottom p-2 mb-0 " data-id="<%- item.id %>">
  440. <p class="mb-0 d-flex"><span class="text-primary"><%- item.name %></span><span
  441. class="ml-auto"><%- item.mobile %></span></p>
  442. <span class="text-muted"><%- item.role %></span>
  443. </dd>
  444. <% } %>
  445. <% });%>
  446. </div>
  447. <% }) %>
  448. </dl>
  449. </div>
  450. </span>
  451. <span class="dropdown mr-2">
  452. <a href="javascript: void(0)" class="change-audit" id="<%- auditors[i].audit_id %>_change_dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">更换</a>
  453. <div class="dropdown-menu dropdown-menu-right" id="<%- auditors[i].audit_id %>_change_dropdownMenu" aria-labelledby="<%- auditors[i].audit_id %>_change_dropdownMenuButton" style="width:220px">
  454. <div class="mb-2 p-2"><input class="form-control form-control-sm gr-search"
  455. placeholder="姓名/手机 检索" autocomplete="off" data-code="<%- auditors[i].audit_id %>_change"></div>
  456. <dl class="list-unstyled book-list" data-aid="<%- auditors[i].audit_id %>" data-operate="change">
  457. <% accountGroup.forEach((group, idx) => { %>
  458. <dt><a href="javascript: void(0);" class="acc-btn" data-groupid="<%- idx %>"
  459. data-type="hide"><i class="fa fa-plus-square"></i></a> <%- group.groupName %></dt>
  460. <div class="dd-content" data-toggleid="<%- idx %>">
  461. <% group.groupList.forEach(item => { %>
  462. <% if (item.id !== ctx.tender.user_id) { %>
  463. <dd class="border-bottom p-2 mb-0 " data-id="<%- item.id %>">
  464. <p class="mb-0 d-flex"><span class="text-primary"><%- item.name %></span><span
  465. class="ml-auto"><%- item.mobile %></span></p>
  466. <span class="text-muted"><%- item.role %></span>
  467. </dd>
  468. <% } %>
  469. <% });%>
  470. </div>
  471. <% }) %>
  472. </dl>
  473. </div>
  474. </span>
  475. <span class="dropdown">
  476. <a href="javascript: void(0)" class="text-danger" title="移除" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">移除</a>
  477. <div class="dropdown-menu">
  478. <span class="dropdown-item" href="javascript:void(0);">确认移除审批人?</span>
  479. <div class="dropdown-divider"></div>
  480. <div class="px-2 py-1 text-center">
  481. <button class="remove-audit btn btn-sm btn-danger" data-id="<%- auditors[i].audit_id %>">移除</button>
  482. <button class="btn btn-sm btn-secondary">取消</button>
  483. </div>
  484. </div>
  485. </span>
  486. <% } %>
  487. </td>
  488. </tr>
  489. <% } %>
  490. </table>
  491. </div>
  492. </div>
  493. </div>
  494. <form class="modal-footer">
  495. <button type="button" class="btn btn-secondary btn-sm" data-dismiss="modal">关闭</button>
  496. </form>
  497. </div>
  498. </div>
  499. </div>
  500. <% } %>
  501. <% if (tender.ledger_status === auditConst.status.checked && tender.finalAuditorIds.indexOf(ctx.session.sessionUser.accountId) >= 0 && !tender.hasStage && !tender.hasRevise) { %>
  502. <% if (!authMobile && ctx.session.sessionUser.loginStatus === 0) { %>
  503. <!--终审重新审批-->
  504. <div class="modal fade" id="sp-down-back" data-backdrop="static">
  505. <div class="modal-dialog" role="document">
  506. <div class="modal-content">
  507. <div class="modal-header">
  508. <h5 class="modal-title">重新审批</h5>
  509. </div>
  510. <div class="modal-body">
  511. <h5>重新审批需要您的手机短信验证</h5>
  512. <h5>您目前还没设置认证手机,请先设置。</h5>
  513. </div>
  514. <div class="modal-footer">
  515. <button type="button" class="btn btn-sm btn-secondary" data-dismiss="modal">取消</button>
  516. <a href="/profile/sms" class="btn btn-sm btn-primary">去设置</a>
  517. </div>
  518. </div>
  519. </div>
  520. </div>
  521. <% } else { %>
  522. <div class="modal fade" id="sp-down-back" data-backdrop="static">
  523. <div class="modal-dialog" role="document">
  524. <form class="modal-content" action="<%- preUrl %>/ledger/audit/check/again" method="post"
  525. onsubmit="return auditAgainCheck();">
  526. <div class="modal-header">
  527. <h5 class="modal-title">重新审批</h5>
  528. </div>
  529. <div class="modal-body">
  530. <h5>确认由「终审-<%= auditors[auditors.length-1].name %>」重新审批 ?
  531. </h5>
  532. <% if (ctx.session.sessionUser.loginStatus === 0) { %>
  533. <div class="form-group">
  534. <label>重审需要验证码确认,验证码将发送至尾号<%- authMobile.slice(-4) %>的手机</label>
  535. <div class="input-group input-group-sm mb-3">
  536. <input class="form-control" type="text" readonly="readonly" name="code"
  537. placeholder="输入短信中的6位验证码" />
  538. <div class="input-group-append">
  539. <button class="btn btn-outline-secondary" type="button" id="get-code">获取验证码</button>
  540. </div>
  541. </div>
  542. </div>
  543. <% } %>
  544. </div>
  545. <div class="modal-footer">
  546. <button type="button" class="btn btn-secondary btn-sm" data-dismiss="modal">关闭</button>
  547. <input type="hidden" name="_csrf_j" value="<%= ctx.csrf %>" />
  548. <button <% if (ctx.session.sessionUser.loginStatus === 0) { %>disabled<% } %> id="re-shenpi-btn"
  549. class="btn btn-warning btn-sm">确定重审</button>
  550. </div>
  551. </form>
  552. </div>
  553. </div>
  554. <% } %>
  555. <% } %>
  556. <script>
  557. $('.sp-location-list').on('shown.bs.modal', function () {
  558. const scrollBox = $(this).find('div[class="col-8 modal-height-500"]');
  559. const bdiv = (scrollBox.offset() && scrollBox.offset().top) || 0;
  560. scrollBox.scrollTop(0);
  561. const hdiv = divSearch($(this).find('textarea')) ? $(this).find('textarea') : null;
  562. const hdheight = hdiv ? hdiv.parents('.timeline-item-content').offset().top : null;
  563. if (hdiv && scrollBox.length && scrollBox[0].scrollHeight > 200 && hdheight - bdiv > 200) {
  564. scrollBox.scrollTop(hdheight - bdiv);
  565. }
  566. });
  567. function divSearch(div) {
  568. if (div.length > 0) {
  569. return true;
  570. }
  571. return false;
  572. }
  573. // 展开历史审核记录
  574. $('.modal-body #fold-btn').click(function () {
  575. const type = $(this).data('target')
  576. const auditCard = $(this).parent().parent()
  577. if (type === 'show') {
  578. $(this).data('target', 'hide')
  579. auditCard.find('.fold-card').slideDown('swing', () => {
  580. auditCard.find('#fold-btn').text('收起历史审核记录')
  581. })
  582. } else {
  583. $(this).data('target', 'show')
  584. auditCard.find('.fold-card').slideUp('swing', () => {
  585. auditCard.find('#fold-btn').text('展开历史审核记录')
  586. })
  587. }
  588. });
  589. // 重新审批获取手机验证码
  590. // 获取验证码
  591. let isPosting = false;
  592. $("#get-code").click(function() {
  593. if (isPosting) {
  594. return false;
  595. }
  596. const btn = $(this);
  597. $.ajax({
  598. url: '/profile/code?_csrf_j=<%= ctx.csrf %>',
  599. type: 'post',
  600. data: { mobile: '<%- authMobile %>', type: 'shenpi' },
  601. dataTye: 'json',
  602. error: function() {
  603. isPosting = false;
  604. },
  605. beforeSend: function() {
  606. isPosting = true;
  607. },
  608. success: function(response) {
  609. isPosting = false;
  610. if (response.err === 0) {
  611. codeSuccess(btn);
  612. $("input[name='code']").removeAttr('readonly');
  613. $("#re-shenpi-btn").removeAttr('disabled');
  614. } else {
  615. toast(response.msg, 'error');
  616. }
  617. }
  618. });
  619. });
  620. /**
  621. * 获取成功后的操作
  622. *
  623. * @param {Object} btn - 点击的按钮
  624. * @return {void}
  625. */
  626. function codeSuccess(btn) {
  627. let counter = 60;
  628. btn.addClass('disabled').text('重新获取 ' + counter + 'S');
  629. btn.parent().siblings('input').removeAttr('readonly').attr('placeholder', '输入短信中的6位验证码');
  630. const bindBtn = $("#bind-btn");
  631. bindBtn.removeClass('btn-secondary disabled').addClass('btn-primary');
  632. const countDown = setInterval(function() {
  633. const countString = counter - 1 <= 0 ? '' : ' ' + (counter - 1) + 'S';
  634. // 倒数结束后
  635. if (countString === '') {
  636. clearInterval(countDown);
  637. btn.removeClass('disabled');
  638. }
  639. const text = '重新获取' + countString;
  640. btn.text(text);
  641. counter -= 1;
  642. }, 1000);
  643. }
  644. // 重新审批按钮
  645. $("#re-shenpi-btn").click(function () {
  646. const data = {
  647. };
  648. $.ajax({
  649. url: '<%- preUrl %>/audit/check/again',
  650. type: 'get',
  651. data: data,
  652. dataTye: 'json',
  653. success: function (response) {
  654. if (response.err === 0) {
  655. window.location.href = response.url;
  656. } else {
  657. toast(response.msg, 'error');
  658. }
  659. }
  660. });
  661. });
  662. function auditAgainCheck() {
  663. <% if (ctx.session.sessionUser.loginStatus === 0) { %>
  664. const code = $("#sp-down-back input[name='code']").val();
  665. if ($(this).hasClass('disabled')) {
  666. return false;
  667. }
  668. if (code.length < 6) {
  669. toastr.error('请填写正确的验证码');
  670. return false;
  671. }
  672. <% } %>
  673. return true;
  674. }
  675. </script>