audit_modal.ejs 107 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474
  1. <% if ((ctx.material.status === auditConst.status.uncheck || ctx.material.status === auditConst.status.checkNo) && (ctx.session.sessionUser.accountId === ctx.material.user_id || ctx.tender.isTourist)) { %>
  2. <!--上报审批-->
  3. <div class="modal fade" id="sub-sp" data-backdrop="static">
  4. <div class="modal-dialog" role="document">
  5. <div class="modal-content">
  6. <div class="modal-header">
  7. <h5 class="modal-title">上报审批</h5>
  8. </div>
  9. <div class="modal-body">
  10. <div class="dropdown text-right">
  11. <% if (ctx.tender.info.shenpi.material !== shenpiConst.sp_status.gdspl && ctx.session.sessionUser.accountId === ctx.material.user_id) { %>
  12. <button class="btn btn-outline-primary btn-sm dropdown-toggle" type="button"
  13. id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true"
  14. aria-expanded="false">
  15. 添加审批流程
  16. </button>
  17. <div class="dropdown-menu dropdown-menu-right" aria-labelledby="dropdownMenuButton"
  18. style="width:220px">
  19. <div class="mb-2 p-2"><input class="form-control form-control-sm"
  20. placeholder="姓名/手机 检索" id="gr-search" autocomplete="off"></div>
  21. <dl class="list-unstyled book-list" id="book-list">
  22. <% accountGroup.forEach((group, idx) => { %>
  23. <dt><a href="javascript: void(0);" class="acc-btn" data-groupid="<%- idx %>" data-type="hide"><i class="fa fa-plus-square"></i></a> <%- group.groupName %></dt>
  24. <div class="dd-content" data-toggleid="<%- idx %>">
  25. <% group.groupList.forEach(item => { %>
  26. <% if (item.id !== ctx.session.sessionUser.accountId) { %>
  27. <dd class="border-bottom p-2 mb-0 " data-id="<%- item.id %>" >
  28. <p class="mb-0 d-flex"><span class="text-primary"><%- item.name %></span><span
  29. class="ml-auto"><%- item.mobile %></span></p>
  30. <span class="text-muted"><%- item.role %></span>
  31. </dd>
  32. <% } %>
  33. <% });%>
  34. </div>
  35. <% }) %>
  36. </dl>
  37. </div>
  38. <% } %>
  39. </div>
  40. <div class="card mt-3">
  41. <div class="card-header">
  42. 审批流程
  43. </div>
  44. <div class="modal-height-500" style="overflow: auto">
  45. <ul class="list-group list-group-flush" id="auditors">
  46. <% for (let i = 0, iLen = ctx.material.auditorGroups.length; i < iLen; i++) { %>
  47. <li class="list-group-item d-flex" auditorId="<%- ctx.material.auditorGroups[i][0].aid %>">
  48. <div class="col-auto"><%- i+1 %></div>
  49. <div class="col">
  50. <% for (const auditor of ctx.material.auditorGroups[i]) { %>
  51. <div class="d-inline-block mx-1" auditorId="<%- auditor.aid %>">
  52. <i class="fa fa-user text-muted"></i> <%- auditor.name %> <small class="text-muted"><%- auditor.role %></small>
  53. </div>
  54. <% } %>
  55. </div>
  56. <div class="col-auto">
  57. <% if (ctx.material.auditorGroups[i][0].audit_type !== auditType.key.common) { %>
  58. <span class="badge badge-pill badge-<%- auditType.info[ctx.material.auditorGroups[i][0].audit_type].class %> badge-bg-small"><small><%- auditType.info[ctx.material.auditorGroups[i][0].audit_type].long%></small></span>
  59. <% } %>
  60. <% if ((ctx.tender.info.shenpi.material === shenpiConst.sp_status.sqspr ||
  61. (ctx.tender.info.shenpi.material === shenpiConst.sp_status.gdzs && i+1 !== iLen)) && ctx.session.sessionUser.accountId === ctx.material.user_id && !ctx.tender.isTourist) { %>
  62. <a href="javascript: void(0)" class="text-danger pull-right">移除</a>
  63. <% } %>
  64. </div>
  65. </li>
  66. <% } %>
  67. </ul>
  68. </div>
  69. </div>
  70. </div>
  71. <form class="modal-footer" method="post" action="<%- preUrl %>/audit/start" onsubmit="return checkAuditorFrom()">
  72. <button type="button" class="btn btn-secondary btn-sm" data-dismiss="modal">关闭</button>
  73. <input type="hidden" name="_csrf_j" value="<%= ctx.csrf %>">
  74. <% if (ctx.session.sessionUser.accountId === ctx.material.user_id) { %>
  75. <button class="btn btn-primary btn-sm" type="submit">确认上报</button>
  76. <% } %>
  77. </form>
  78. </div>
  79. </div>
  80. </div>
  81. <% } %>
  82. <% if(ctx.material && (ctx.material.status !== auditConst.status.uncheck)) { %>
  83. <!--审批流程/结果-->
  84. <div class="modal fade" id="sp-list" data-backdrop="static">
  85. <div class="modal-dialog modal-lg" role="document">
  86. <div class="modal-content">
  87. <div class="modal-header">
  88. <h5 class="modal-title"><%- ctx.material.status === auditConst.status.checking ? '审批流程' : '重新上报' %></h5>
  89. </div>
  90. <div class="modal-body">
  91. <div class="row">
  92. <div class="col-4">
  93. <% if(ctx.material.status === auditConst.status.checkNo && ctx.session.sessionUser.accountId === ctx.material.user_id) { %>
  94. <a class="sp-list-item" href="#sub-sp" data-toggle="modal" data-target="#sub-sp" id="hideSp">修改审批流程</a>
  95. <% } else if(ctx.material.status !== auditConst.status.checked && ctx.session.sessionUser.is_admin) { %>
  96. <a class="sp-list-item" href="#sub-sp2" data-toggle="modal" data-target="#sub-sp2"
  97. id="hideSp">修改审批流程</a>
  98. <% } %>
  99. <div class="card modal-height-500 mt-3" style="overflow: auto">
  100. <ul class="list-group list-group-flush auditors-list" id="auditors-list">
  101. <% ctx.material.auditors2.forEach((item, idx) => { %>
  102. <% if (idx === 0) { %>
  103. <li class="list-group-item d-flex justify-content-between align-items-center">
  104. <span class="mr-1"><i class="fa fa fa-play-circle fa-rotate-90"></i></span>
  105. <span class="text-muted">
  106. <% for (const u of item) { %>
  107. <small class="d-inline-block text-dark mx-1" title="<%- u.role %>" data-auditorId="<%- u.aid %>"><%- u.name %></small>
  108. <% } %>
  109. </span>
  110. <span class="badge badge-light badge-pill ml-auto"><small>原报</small></span>
  111. </li>
  112. <% } else if(idx === ctx.material.auditors2.length -1 && idx !== 0) { %>
  113. <li class="list-group-item d-flex justify-content-between align-items-center">
  114. <span class="mr-1"><i class="fa fa fa-stop-circle"></i></span>
  115. <span class="text-muted">
  116. <% for (const u of item) { %>
  117. <small class="d-inline-block text-dark mx-1" title="<%- u.role %>" data-auditorId="<%- u.aid %>"><%- u.name %></small>
  118. <% } %>
  119. </span>
  120. <div class="d-flex ml-auto">
  121. <% if (item[0].audit_type !== auditType.key.common) { %>
  122. <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>
  123. <% } %>
  124. <span class="badge badge-light badge-pill"><small>终审</small></span>
  125. </div>
  126. </li>
  127. <% } else {%>
  128. <li class="list-group-item d-flex justify-content-between align-items-center">
  129. <span class="mr-1"><i class="fa fa-chevron-circle-down"></i></span>
  130. <span class="text-muted">
  131. <% for (const u of item) { %>
  132. <small class="d-inline-block text-dark mx-1" title="<%- u.role %>" data-auditorId="<%- u.aid %>"><%- u.name %></small>
  133. <% } %>
  134. </span>
  135. <div class="d-flex ml-auto">
  136. <% if (item[0].audit_type !== auditType.key.common) { %>
  137. <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>
  138. <% } %>
  139. <span class="badge badge-light badge-pill"><small><%= ctx.helper.transFormToChinese(idx) %>审</small></span>
  140. </div>
  141. </li>
  142. <% } %>
  143. <% }) %>
  144. </ul>
  145. </div>
  146. </div>
  147. <div class="col-8 modal-height-500" style="overflow: auto">
  148. <% ctx.material.auditHistory.forEach((his, idx) => { %>
  149. <!-- 展开/收起历史流程 -->
  150. <% if(idx === ctx.material.auditHistory.length - 1 && ctx.material.auditHistory.length !== 1) { %>
  151. <div class="text-right">
  152. <a href="javascript: void(0);" id="fold-btn" data-target="show" >展开历史审批流程</a>
  153. </div>
  154. <% } %>
  155. <div class="<%- idx < ctx.material.auditHistory.length - 1 ? 'fold-card' : '' %>">
  156. <div class="text-center text-muted"><%- idx+1 %>#</div>
  157. <ul class="timeline-list list-unstyled mt-2 <% if (idx === ctx.material.auditHistory.length - 1) { %>last-auditor-list<% } %>">
  158. <% his.forEach((group, index) => { %>
  159. <% if (index === 0) { %>
  160. <li class="timeline-list-item pb-2">
  161. <div class="timeline-item-date">
  162. <%- group.beginYear %>
  163. <span><%- group.beginDate %></span>
  164. <span><%- group.beginTime %></span>
  165. </div>
  166. <div class="timeline-item-tail"></div>
  167. <div class="timeline-item-icon bg-success text-light"><i class="fa fa-caret-down"></i></div>
  168. <div class="timeline-item-content">
  169. <div class="py-1">
  170. <span class="text-black-50">原报</span>
  171. <span class="pull-right text-success"><%- idx !== 0 ? '重新' : '' %>上报审批</span>
  172. </div>
  173. <div class="card">
  174. <div class="card-body px-3 py-0">
  175. <div class="card-text p-2 py-3 row">
  176. <div class="col">
  177. <span class="h6"><%- ctx.material.user.name %></span>
  178. <span class="text-muted ml-1"><%- ctx.material.user.role %></span>
  179. </div>
  180. <div class="col">
  181. <span class="pull-right text-success"><i class="fa fa-check-circle"></i></span>
  182. </div>
  183. </div>
  184. </div>
  185. </div>
  186. </div>
  187. </li>
  188. <% } %>
  189. <li class="timeline-list-item pb-2 <% if (group.status === auditConst.status.uncheck && idx === ctx.material.auditHistory.length - 1) { %>is_uncheck<% } %>">
  190. <% if (group.endYear) { %>
  191. <div class="timeline-item-date">
  192. <%- group.endYear %>
  193. <span><%- group.endDate %></span>
  194. <span><%- group.endTime %></span>
  195. </div>
  196. <% } %>
  197. <% if (index < his.length - 1) { %>
  198. <div class="timeline-item-tail"></div>
  199. <% } %>
  200. <% if (group.status === auditConst.status.checked) { %>
  201. <div class="timeline-item-icon bg-success text-light"><i class="fa fa-check"></i></div>
  202. <% } else if (group.status === auditConst.status.checkNo || group.status === auditConst.status.checkNoPre || group.status === auditConst.status.checkCancel) { %>
  203. <div class="timeline-item-icon bg-warning text-light"><i class="fa fa-level-up"></i></div>
  204. <% } else if (group.status === auditConst.status.checking) { %>
  205. <div class="timeline-item-icon bg-warning text-light"><i class="fa fa-ellipsis-h"></i></div>
  206. <% } else { %>
  207. <div class="timeline-item-icon bg-secondary text-light"></div>
  208. <% } %>
  209. <div class="timeline-item-content">
  210. <div class="py-1">
  211. <span class="text-black-50">
  212. <%- (!group.is_final ? group.audit_order : '终') %>审
  213. <% if (group.audit_type !== auditType.key.common) { %><span class="text-<%- auditType.info[group.audit_type].class %> "><%- auditType.info[group.audit_type].long %></span><% } %>
  214. </span>
  215. <% if (group.status !== auditConst.status.uncheck) { %>
  216. <span class="pull-right <%- auditConst.statusClass[group.status] %>"><%- auditConst.statusString[group.status] %></span>
  217. <% } %>
  218. </div>
  219. <div class="card">
  220. <div class="card-body px-3 py-0">
  221. <% for (const [i, auditor] of group.auditors.entries()) { %>
  222. <div class="card-text p-2 py-3 row <%- ( i > 0 ? 'border-top' : '') %>">
  223. <div class="col">
  224. <span class="h6"><%- auditor.name %></span>
  225. <span class="text-muted ml-1"><%- auditor.role %></span>
  226. </div>
  227. <div class="col">
  228. <% if (auditor.status === auditConst.status.checked) { %>
  229. <span class="pull-right text-success"><i class="fa fa-check-circle"></i></span>
  230. <% } else if (auditor.status === auditConst.status.checkNo || auditor.status === auditConst.status.checkNoPre || auditor.status === auditConst.status.checkCancel) { %>
  231. <span class="pull-right text-warning"><i class="fa fa-share-square fa-rotate-270"></i></span>
  232. <% } %>
  233. </div>
  234. <% if (auditor.opinion) { %>
  235. <div class="col-12 py-1 bg-light"><i class="fa fa-commenting-o mr-1"></i><%- auditor.opinion%></div>
  236. <% } %>
  237. </div>
  238. <% } %>
  239. </div>
  240. </div>
  241. </div>
  242. </li>
  243. <% }) %>
  244. </ul>
  245. </div>
  246. <% }) %>
  247. </div>
  248. </div>
  249. </div>
  250. <form class="modal-footer" method="post" action="<%- preUrl %>/audit/start" onsubmit="return checkAuditorFrom()">
  251. <input type="hidden" name="_csrf_j" value="<%= ctx.csrf %>">
  252. <button type="button" class="btn btn-secondary btn-sm" data-dismiss="modal">关闭</button>
  253. <% if(ctx.material.status === auditConst.status.checkNo && ctx.session.sessionUser.accountId === ctx.material.user_id) { %>
  254. <button class="btn btn-primary btn-sm sp-list-item" type="submit">确认上报</button>
  255. <% } %>
  256. </form>
  257. </div>
  258. </div>
  259. </div>
  260. <% } %>
  261. <% if (ctx.material.status === auditConst.status.checking || ctx.material.status === auditConst.status.checkNoPre) { %>
  262. <% if (ctx.material.curAuditorIds.indexOf(ctx.session.sessionUser.accountId) >= 0) { %>
  263. <!--审批通过-->
  264. <div class="modal fade sp-location-list" id="sp-done" data-backdrop="static">
  265. <div class="modal-dialog modal-lg" role="document">
  266. <form class="modal-content" action="<%- preUrl %>/audit/check" method="post" id="audit-check0">
  267. <div class="modal-header">
  268. <h5 class="modal-title">审批通过</h5>
  269. </div>
  270. <div class="modal-body">
  271. <div class="row">
  272. <div class="col-4">
  273. <% if(ctx.material.status !== auditConst.status.checked && ctx.session.sessionUser.is_admin) { %>
  274. <a class="sp-list-item" href="#sub-sp2" data-toggle="modal" data-target="#sub-sp2"
  275. id="hideSp">修改审批流程</a>
  276. <% } %>
  277. <div class="card modal-height-500 mt-3" style="overflow: auto">
  278. <ul class="list-group list-group-flush auditors-list">
  279. <% ctx.material.auditors2.forEach((item, idx) => { %>
  280. <% if (idx === 0) { %>
  281. <li class="list-group-item d-flex justify-content-between align-items-center">
  282. <span class="mr-1"><i class="fa fa fa-play-circle fa-rotate-90"></i></span>
  283. <span class="text-muted">
  284. <% for (const u of item) { %>
  285. <small class="d-inline-block text-dark mx-1" title="<%- u.role %>" data-auditorId="<%- u.aid %>"><%- u.name %></small>
  286. <% } %>
  287. </span>
  288. <span class="badge badge-light badge-pill ml-auto"><small>原报</small></span>
  289. </li>
  290. <% } else if(idx === ctx.material.auditors2.length -1 && idx !== 0) { %>
  291. <li class="list-group-item d-flex justify-content-between align-items-center">
  292. <span class="mr-1"><i class="fa fa fa-stop-circle"></i></span>
  293. <span class="text-muted">
  294. <% for (const u of item) { %>
  295. <small class="d-inline-block text-dark mx-1" title="<%- u.role %>" data-auditorId="<%- u.aid %>"><%- u.name %></small>
  296. <% } %>
  297. </span>
  298. <div class="d-flex ml-auto">
  299. <% if (item[0].audit_type !== auditType.key.common) { %>
  300. <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>
  301. <% } %>
  302. <span class="badge badge-light badge-pill"><small>终审</small></span>
  303. </div>
  304. </li>
  305. <% } else {%>
  306. <li class="list-group-item d-flex justify-content-between align-items-center">
  307. <span class="mr-1"><i class="fa fa-chevron-circle-down"></i></span>
  308. <span class="text-muted">
  309. <% for (const u of item) { %>
  310. <small class="d-inline-block text-dark mx-1" title="<%- u.role %>" data-auditorId="<%- u.aid %>"><%- u.name %></small>
  311. <% } %>
  312. </span>
  313. <div class="d-flex ml-auto">
  314. <% if (item[0].audit_type !== auditType.key.common) { %>
  315. <span class="badge badge-pill badge-<%- auditType.info[item[0].audit_type].class %> p-1 ml-auto"><small><%- auditType.info[item[0].audit_type].short %></small></span>
  316. <% } %>
  317. <span class="badge badge-light badge-pill"><small><%= ctx.helper.transFormToChinese(idx) %>审</small></span>
  318. </div>
  319. </li>
  320. <% } %>
  321. <% }) %>
  322. </ul>
  323. </div>
  324. </div>
  325. <div class="col-8 modal-height-500" style="overflow: auto">
  326. <% ctx.material.auditHistory.forEach((his, idx) => { %>
  327. <!-- 展开/收起历史流程 -->
  328. <% if(idx === ctx.material.auditHistory.length - 1 && ctx.material.auditHistory.length !== 1) { %>
  329. <div class="text-right">
  330. <a href="javascript: void(0);" id="fold-btn" data-target="show">展开历史审批流程</a>
  331. </div>
  332. <% } %>
  333. <div class="<%- idx < ctx.material.auditHistory.length - 1 ? 'fold-card' : '' %>">
  334. <div class="text-center text-muted"><%- idx+1 %>#</div>
  335. <ul class="timeline-list list-unstyled mt-2 <% if (idx === ctx.material.auditHistory.length - 1) { %>last-auditor-list<% } %>">
  336. <% his.forEach((group, index) => { %>
  337. <% if (index === 0) { %>
  338. <li class="timeline-list-item pb-2">
  339. <div class="timeline-item-date">
  340. <%- group.beginYear %>
  341. <span><%- group.beginDate %></span>
  342. <span><%- group.beginTime %></span>
  343. </div>
  344. <div class="timeline-item-tail"></div>
  345. <div class="timeline-item-icon bg-success text-light"><i class="fa fa-caret-down"></i></div>
  346. <div class="timeline-item-content">
  347. <div class="py-1">
  348. <span class="text-black-50">原报</span>
  349. <span class="pull-right text-success"><%- idx !== 0 ? '重新' : '' %>上报审批</span>
  350. </div>
  351. <div class="card">
  352. <div class="card-body px-3 py-0">
  353. <div class="card-text p-2 py-3 row">
  354. <div class="col">
  355. <span class="h6"><%- ctx.material.user.name %></span>
  356. <span class="text-muted ml-1"><%- ctx.material.user.role %></span>
  357. </div>
  358. <div class="col">
  359. <span class="pull-right text-success"><i class="fa fa-check-circle"></i></span>
  360. </div>
  361. </div>
  362. </div>
  363. </div>
  364. </div>
  365. </li>
  366. <% } %>
  367. <li class="timeline-list-item pb-2 <% if (group.status === auditConst.status.uncheck && idx === ctx.material.auditHistory.length - 1) { %>is_uncheck<% } %>">
  368. <% if (group.endYear) { %>
  369. <div class="timeline-item-date">
  370. <%- group.endYear %>
  371. <span><%- group.endDate %></span>
  372. <span><%- group.endTime %></span>
  373. </div>
  374. <% } %>
  375. <% if (index < his.length - 1) { %>
  376. <div class="timeline-item-tail"></div>
  377. <% } %>
  378. <% if (group.status === auditConst.status.checked) { %>
  379. <div class="timeline-item-icon bg-success text-light"><i class="fa fa-check"></i></div>
  380. <% } else if (group.status === auditConst.status.checkNo || group.status === auditConst.status.checkNoPre || group.status === auditConst.status.checkCancel) { %>
  381. <div class="timeline-item-icon bg-warning text-light"><i class="fa fa-level-up"></i></div>
  382. <% } else if (group.status === auditConst.status.checking) { %>
  383. <div class="timeline-item-icon bg-warning text-light"><i class="fa fa-ellipsis-h"></i></div>
  384. <% } else { %>
  385. <div class="timeline-item-icon bg-secondary text-light"></div>
  386. <% } %>
  387. <div class="timeline-item-content">
  388. <div class="py-1">
  389. <span class="text-black-50">
  390. <%- (!group.is_final ? group.audit_order : '终') %>审
  391. <% if (group.audit_type !== auditType.key.common) { %><span class="text-<%- auditType.info[group.audit_type].class %> "><%- auditType.info[group.audit_type].long %></span><% } %>
  392. </span>
  393. <% if (group.status !== auditConst.status.uncheck) { %>
  394. <span class="pull-right <%- auditConst.statusClass[group.status] %>"><%- auditConst.statusString[group.status] %></span>
  395. <% } %>
  396. </div>
  397. <div class="card">
  398. <div class="card-body px-3 py-0">
  399. <% for (const [i, auditor] of group.auditors.entries()) { %>
  400. <div class="card-text p-2 py-3 row <%- ( i > 0 ? 'border-top' : '') %>">
  401. <div class="col">
  402. <span class="h6"><%- auditor.name %></span>
  403. <span class="text-muted ml-1"><%- auditor.role %></span>
  404. </div>
  405. <div class="col">
  406. <% if (auditor.status === auditConst.status.checked) { %>
  407. <span class="pull-right text-success"><i class="fa fa-check-circle"></i></span>
  408. <% } if (auditor.status === auditConst.status.checkNo || auditor.status === auditConst.status.checkNoPre || auditor.status === auditConst.status.checkCancel) { %>
  409. <span class="pull-right text-warning"><i class="fa fa-share-square fa-rotate-270"></i></span>
  410. <% } else if (auditor.status === auditConst.status.checking) { %>
  411. <span class="pull-right text-warning"><i class="fa fa-commenting"></i></span>
  412. <% } %>
  413. </div>
  414. <% if (auditor.status !== auditConst.status.uncheck && auditor.opinion) { %>
  415. <div class="col-12 py-1 bg-light"><i class="fa fa-commenting-o mr-1"></i><%- auditor.opinion%></div>
  416. <% } %>
  417. <% if (auditor.status === auditConst.status.checking && auditor.aid === ctx.session.sessionUser.accountId) { %>
  418. <div class="col-12 py-1 bg-light">
  419. <textarea class="form-control form-control-sm" name="opinion">同意</textarea>
  420. </div>
  421. <% } %>
  422. </div>
  423. <% } %>
  424. </div>
  425. </div>
  426. </div>
  427. </li>
  428. <% }) %>
  429. </ul>
  430. </div>
  431. <% }) %>
  432. </div>
  433. </div>
  434. </div>
  435. <div class="modal-footer">
  436. <button type="button" class="btn btn-secondary btn-sm" data-dismiss="modal">关闭</button>
  437. <input type="hidden" name="_csrf_j" value="<%= ctx.csrf %>" />
  438. <input type="hidden" name="checkType" value="<%= auditConst.status.checked %>" />
  439. <button type="submit" class="btn btn-success btn-sm">确认通过</button>
  440. </div>
  441. </form>
  442. </div>
  443. </div>
  444. <!--审批退回-->
  445. <div class="modal fade sp-location-list" id="sp-back" data-backdrop="static">
  446. <div class="modal-dialog modal-lg" role="document">
  447. <form class="modal-content modal-lg" action="<%- preUrl %>/audit/check" method="post"
  448. onsubmit="return auditCheck(1);">
  449. <div class="modal-header">
  450. <h5 class="modal-title">审批退回</h5>
  451. </div>
  452. <div class="modal-body">
  453. <div class="row">
  454. <div class="col-4">
  455. <% if(ctx.material.status !== auditConst.status.checked && ctx.session.sessionUser.is_admin) { %>
  456. <a class="sp-list-item" href="#sub-sp2" data-toggle="modal" data-target="#sub-sp2"
  457. id="hideSp">修改审批流程</a>
  458. <% } %>
  459. <div class="card modal-height-500 mt-3" style="overflow: auto">
  460. <ul class="list-group list-group-flush auditors-list">
  461. <% ctx.material.auditors2.forEach((item, idx) => { %>
  462. <% if (idx === 0) { %>
  463. <li class="list-group-item d-flex justify-content-between align-items-center">
  464. <span class="mr-1"><i class="fa fa fa-play-circle fa-rotate-90"></i></span>
  465. <span class="text-muted">
  466. <% for (const u of item) { %>
  467. <small class="d-inline-block text-dark mx-1" title="<%- u.role %>" data-auditorId="<%- u.aid %>"><%- u.name %></small>
  468. <% } %>
  469. </span>
  470. <span class="badge badge-light badge-pill ml-auto"><small>原报</small></span>
  471. </li>
  472. <% } else if(idx === ctx.material.auditors2.length -1 && idx !== 0) { %>
  473. <li class="list-group-item d-flex justify-content-between align-items-center">
  474. <span class="mr-1"><i class="fa fa fa-stop-circle"></i></span>
  475. <span class="text-muted">
  476. <% for (const u of item) { %>
  477. <small class="d-inline-block text-dark mx-1" title="<%- u.role %>" data-auditorId="<%- u.aid %>"><%- u.name %></small>
  478. <% } %>
  479. </span>
  480. <div class="d-flex ml-auto">
  481. <% if (item[0].audit_type !== auditType.key.common) { %>
  482. <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>
  483. <% } %>
  484. <span class="badge badge-light badge-pill"><small>终审</small></span>
  485. </div>
  486. </li>
  487. <% } else {%>
  488. <li class="list-group-item d-flex justify-content-between align-items-center">
  489. <span class="mr-1"><i class="fa fa-chevron-circle-down"></i></span>
  490. <span class="text-muted">
  491. <% for (const u of item) { %>
  492. <small class="d-inline-block text-dark mx-1" title="<%- u.role %>" data-auditorId="<%- u.aid %>"><%- u.name %></small>
  493. <% } %>
  494. </span>
  495. <div class="d-flex ml-auto">
  496. <% if (item[0].audit_type !== auditType.key.common) { %>
  497. <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>
  498. <% } %>
  499. <span class="badge badge-light badge-pill"><small><%= ctx.helper.transFormToChinese(idx) %>审</small></span>
  500. </div>
  501. </li>
  502. <% } %>
  503. <% }) %>
  504. </ul>
  505. </div>
  506. </div>
  507. <div class="col-8 modal-height-500" style="overflow: auto">
  508. <% ctx.material.auditHistory.forEach((his, idx) => { %>
  509. <!-- 展开/收起历史流程 -->
  510. <% if(idx === ctx.material.auditHistory.length - 1 && ctx.material.auditHistory.length !== 1) { %>
  511. <div class="text-right"><a href="javascript: void(0);" id="fold-btn" data-target="show"
  512. data-idx="<%- idx + 1 %>">展开历史审批流程</a></div>
  513. <% } %>
  514. <div class="<%- idx < ctx.material.auditHistory.length - 1 ? 'fold-card' : '' %>">
  515. <div class="text-center text-muted"><%- idx+1 %>#</div>
  516. <ul class="timeline-list list-unstyled mt-2 <% if (idx === ctx.material.auditHistory.length - 1) { %>last-auditor-list<% } %>">
  517. <% his.forEach((group, index) => { %>
  518. <% if (index === 0) { %>
  519. <li class="timeline-list-item pb-2">
  520. <div class="timeline-item-date">
  521. <%- group.beginYear %>
  522. <span><%- group.beginDate %></span>
  523. <span><%- group.beginTime %></span>
  524. </div>
  525. <div class="timeline-item-tail"></div>
  526. <div class="timeline-item-icon bg-success text-light"><i class="fa fa-caret-down"></i></div>
  527. <div class="timeline-item-content">
  528. <div class="py-1">
  529. <span class="text-black-50">原报</span>
  530. <span class="pull-right text-success"><%- idx !== 0 ? '重新' : '' %>上报审批</span>
  531. </div>
  532. <div class="card">
  533. <div class="card-body px-3 py-0">
  534. <div class="card-text p-2 py-3 row">
  535. <div class="col">
  536. <span class="h6"><%- ctx.material.user.name %></span>
  537. <span class="text-muted ml-1"><%- ctx.material.user.role %></span>
  538. </div>
  539. <div class="col">
  540. <span class="pull-right text-success"><i class="fa fa-check-circle"></i></span>
  541. </div>
  542. </div>
  543. </div>
  544. </div>
  545. </div>
  546. </li>
  547. <% } %>
  548. <li class="timeline-list-item pb-2 <% if (group.status === auditConst.status.uncheck && idx === ctx.material.auditHistory.length - 1) { %>is_uncheck<% } %>">
  549. <% if (his.endYear) { %>
  550. <div class="timeline-item-date">
  551. <%- group.endYear %>
  552. <span><%- group.endDate %></span>
  553. <span><%- group.endTime %></span>
  554. </div>
  555. <% } %>
  556. <% if (index < his.length - 1) { %>
  557. <div class="timeline-item-tail"></div>
  558. <% } %>
  559. <% if (group.status === auditConst.status.checked) { %>
  560. <div class="timeline-item-icon bg-success text-light"><i class="fa fa-check"></i></div>
  561. <% } else if (group.status === auditConst.status.checkNo || group.status === auditConst.status.checkNoPre || group.status === auditConst.status.checkCancel) { %>
  562. <div class="timeline-item-icon bg-warning text-light"><i class="fa fa-level-up"></i></div>
  563. <% } else if (group.status === auditConst.status.checking) { %>
  564. <div class="timeline-item-icon bg-warning text-light"><i class="fa fa-ellipsis-h"></i></div>
  565. <% } else { %>
  566. <div class="timeline-item-icon bg-secondary text-light"></div>
  567. <% } %>
  568. <div class="timeline-item-content">
  569. <div class="py-1">
  570. <span class="text-black-50">
  571. <%- (!group.is_final ? group.audit_order : '终') %>审
  572. <% if (group.audit_type !== auditType.key.common) { %><span class="text-<%- auditType.info[group.audit_type].class %> "><%- auditType.info[group.audit_type].long %></span><% } %>
  573. </span>
  574. <% if (group.status !== auditConst.status.uncheck) { %>
  575. <span class="pull-right <%- auditConst.statusClass[group.status] %>"><%- auditConst.statusString[group.status] %></span>
  576. <% } %>
  577. </div>
  578. <div class="card">
  579. <div class="card-body px-3 py-0">
  580. <% for (const [i, auditor] of group.auditors.entries()) { %>
  581. <div class="card-text p-2 py-3 row <%- ( i > 0 ? 'border-top' : '') %>">
  582. <div class="col">
  583. <span class="h6"><%- auditor.name %></span>
  584. <span class="text-muted ml-1"><%- auditor.role %></span>
  585. </div>
  586. <div class="col">
  587. <% if (auditor.status === auditConst.status.checked) { %>
  588. <span class="pull-right text-success"><i class="fa fa-check-circle"></i></span>
  589. <% } if (auditor.status === auditConst.status.checkNo || auditor.status === auditConst.status.checkNoPre || auditor.status === auditConst.status.checkCancel) { %>
  590. <span class="pull-right text-warning"><i class="fa fa-share-square fa-rotate-270"></i></span>
  591. <% } else if (auditor.status === auditConst.status.checking) { %>
  592. <span class="pull-right text-warning"><i class="fa fa-commenting"></i></span>
  593. <% } %>
  594. </div>
  595. <% if (auditor.status !== auditConst.status.uncheck && auditor.opinion) { %>
  596. <div class="col-12 py-1 bg-light"><i class="fa fa-commenting-o mr-1"></i><%- auditor.opinion%></div>
  597. <% } %>
  598. <% if (auditor.status === auditConst.status.checking && auditor.aid === ctx.session.sessionUser.accountId) { %>
  599. <div class="col-12 py-1 bg-light">
  600. <textarea class="form-control form-control-sm" name="opinion">不同意</textarea>
  601. <div class="alert alert-warning mt-1 mb-0 p-2" id="reject-process">
  602. <div class="form-check form-check-inline">
  603. <input class="form-check-input" type="radio" name="checkType" id="inlineRadio1" value="<%- auditConst.status.checkNo %>">
  604. <label class="form-check-label" for="inlineRadio1">退回原报 <%- ctx.material.user.name %></label>
  605. </div>
  606. <% if (auditor.audit_order > 1) { %>
  607. <div class="form-check form-check-inline">
  608. <input class="form-check-input" type="radio" name="checkType" id="inlineRadio2" value="<%- auditConst.status.checkNoPre %>">
  609. <label class="form-check-label" for="inlineRadio2">退回上一审批人
  610. <% const pre = ctx.helper._.findLast(his, x => { return x.audit_order === auditor.audit_order - 1 }); %>
  611. <%- (pre.audit_type === auditType.key.common ? pre.auditors[0].name : `${pre.audit_order}审`)%>
  612. </label>
  613. </div>
  614. <% } %>
  615. </div>
  616. </div>
  617. <% } %>
  618. </div>
  619. <% } %>
  620. </div>
  621. </div>
  622. </div>
  623. </li>
  624. <% }) %>
  625. </ul>
  626. </div>
  627. <% }) %>
  628. </div>
  629. </div>
  630. </div>
  631. <div class="modal-footer">
  632. <button type="button" class="btn btn-secondary btn-sm" data-dismiss="modal">关闭</button>
  633. <input type="hidden" name="_csrf_j" value="<%= ctx.csrf %>" />
  634. <button type="submit" class="btn btn-warning btn-sm">确认退回</button>
  635. </div>
  636. </form>
  637. </div>
  638. </div>
  639. <% } %>
  640. <% } %>
  641. <!--材料调差-小数位数-->
  642. <div class="modal fade" id="cc-digits" data-backdrop="static">
  643. <div class="modal-dialog" role="document">
  644. <form action="/tender/<%- ctx.tender.id %>/measure/material/<%- ctx.material.order %>/save/decimal" method="post" onsubmit="return checkSetDecimal();" class="modal-content">
  645. <div class="modal-header">
  646. <h5 class="modal-title">设置</h5>
  647. </div>
  648. <div class="modal-body">
  649. <div class="form-group mb-3">
  650. <h5>小数位数</h5>
  651. <div class="row">
  652. <div class="col-4">
  653. <div class="input-group input-group-sm">
  654. <div class="input-group-prepend">
  655. <span class="input-group-text">单价</span>
  656. </div>
  657. <input type="number" step="1" min="0" max="6" id="decimal_up" name="up" class="form-control" value="<%- material.decimal.up %>" <% if (!((material.status === auditConst.status.uncheck || material.status === auditConst.status.checkNo) && ctx.session.sessionUser.accountId === material.user_id)) { %>disabled<% } %>>
  658. </div>
  659. </div>
  660. <div class="col-4">
  661. <div class="input-group input-group-sm">
  662. <div class="input-group-prepend">
  663. <span class="input-group-text">金额</span>
  664. </div>
  665. <input type="number" step="1" min="0" max="6" id="decimal_tp" name="tp" class="form-control" value="<%- material.decimal.tp %>" <% if (!((material.status === auditConst.status.uncheck || material.status === auditConst.status.checkNo) && ctx.session.sessionUser.accountId === material.user_id)) { %>disabled<% } %>>
  666. </div>
  667. </div>
  668. <div class="col-4">
  669. <div class="input-group input-group-sm">
  670. <div class="input-group-prepend">
  671. <span class="input-group-text">数量</span>
  672. </div>
  673. <input type="number" step="1" min="0" max="6" id="decimal_qty" name="qty" class="form-control" value="<%- material.decimal.qty %>" <% if (!((material.status === auditConst.status.uncheck || material.status === auditConst.status.checkNo) && ctx.session.sessionUser.accountId === material.user_id)) { %>disabled<% } %>>
  674. </div>
  675. </div>
  676. </div>
  677. </div>
  678. <div class="form-group">
  679. <h5>计量期数据来源</h5>
  680. <div>
  681. <% if ((material.status === auditConst.status.uncheck || material.status === auditConst.status.checkNo) && ctx.session.sessionUser.accountId === material.user_id && (material.is_new_qty || (!material.is_new_qty && !(ctx.url.indexOf('/file') !== -1 || ctx.url.indexOf('/exponent') !== -1)))) { %>
  682. <% for (const qs of qtySourceConst) { %>
  683. <div class="form-check form-check-inline">
  684. <input type="radio" name="qty_source" id="<%- qs.key %>_source" class="form-check-input" value="<%- qs.value %>" <% if (material.qty_source === qtySourceValueConst[qs.key]) { %>checked<% } %>>
  685. <label class="form-check-label" for="<%- qs.key %>_source"><%- qs.name %></label>
  686. </div>
  687. <% } %>
  688. <% } else { %>
  689. <div class="form-check form-check-inline">
  690. <input type="radio" class="form-check-input" checked disabled>
  691. <label class="form-check-label"><%- ctx.helper._.find(qtySourceConst, { value: material.qty_source }).name %></label>
  692. </div>
  693. <% } %>
  694. </div>
  695. </div>
  696. </div>
  697. <div class="modal-footer">
  698. <input type="hidden" name="_csrf_j" value="<%= ctx.csrf %>" />
  699. <button type="button" class="btn btn-sm btn-secondary" data-dismiss="modal">取消</button>
  700. <% if ((material.status === auditConst.status.uncheck || material.status === auditConst.status.checkNo) && ctx.session.sessionUser.accountId === material.user_id) { %>
  701. <button type="submit" class="btn btn-sm btn-primary">确认修改</button>
  702. <% } %>
  703. </div>
  704. </form>
  705. </div>
  706. </div>
  707. <% if (ctx.material.auditors !== undefined && ctx.material.finalAuditorIds.indexOf(ctx.session.sessionUser.accountId) >= 0 && ctx.material.status === auditConst.status.checked && ctx.material.order === ctx.material.highOrder) { %>
  708. <% if (ctx.material && !ctx.material.authMobile && ctx.session.sessionUser.loginStatus === 0) { %>
  709. <!--终审重新审批-->
  710. <div class="modal fade" id="sp-down-back" data-backdrop="static">
  711. <div class="modal-dialog" role="document">
  712. <div class="modal-content">
  713. <div class="modal-header">
  714. <h5 class="modal-title">重新审批</h5>
  715. </div>
  716. <div class="modal-body">
  717. <h5>重新审批需要您的手机短信验证</h5>
  718. <h5>您目前还没设置认证手机,请先设置。</h5>
  719. </div>
  720. <div class="modal-footer">
  721. <button type="button" class="btn btn-sm btn-secondary" data-dismiss="modal">取消</button>
  722. <a href="/profile/sms" class="btn btn-sm btn-primary">去设置</a>
  723. </div>
  724. </div>
  725. </div>
  726. </div>
  727. <% } else { %>
  728. <div class="modal fade" id="sp-down-back" data-backdrop="static">
  729. <div class="modal-dialog" role="document">
  730. <div class="modal-content">
  731. <div class="modal-header">
  732. <h5 class="modal-title">重新审批</h5>
  733. </div>
  734. <div class="modal-body">
  735. <h5>确认由「终审-<%= ctx.session.sessionUser.name %>」重新审批「第<%= ctx.material.order %>期」?
  736. </h5>
  737. <% if (ctx.session.sessionUser.loginStatus === 0) { %>
  738. <div class="form-group">
  739. <label>重审需要验证码确认,验证码将发送至尾号<%- ctx.material.authMobile.slice(-4) %>的手机</label>
  740. <div class="input-group input-group-sm mb-3">
  741. <input class="form-control" type="text" readonly="readonly" name="code"
  742. placeholder="输入短信中的6位验证码" />
  743. <div class="input-group-append">
  744. <button class="btn btn-outline-secondary" type="button" id="get-code">获取验证码</button>
  745. </div>
  746. </div>
  747. </div>
  748. <% } %>
  749. </div>
  750. <div class="modal-footer">
  751. <button type="button" class="btn btn-secondary btn-sm" data-dismiss="modal">关闭</button>
  752. <!--<a href="<%- preUrl %>/audit/check/again" disabled class="btn btn-warning btn-sm">确定重审</a>-->
  753. <button <% if (ctx.session.sessionUser.loginStatus === 0) { %>disabled<% } %> id="re-shenpi-btn"
  754. class="btn btn-warning btn-sm">确定重审</button>
  755. </div>
  756. </div>
  757. </div>
  758. </div>
  759. <% } %>
  760. <% } %>
  761. <% if (ctx.material && ctx.material.status !== auditConst.status.checked && ctx.session.sessionUser.is_admin) { %>
  762. <!--上报审批-->
  763. <div class="modal fade" id="sub-sp2" data-backdrop="static">
  764. <div class="modal-dialog" style="max-width: 650px" role="document">
  765. <div class="modal-content">
  766. <div class="modal-header">
  767. <h5 class="modal-title">修改审批流程</h5>
  768. </div>
  769. <div class="modal-body">
  770. <div class="card mt-1">
  771. <div class="modal-height-500" style="overflow: auto">
  772. <style>
  773. #admin-edit-shenpi thead th {
  774. border-bottom: 0;
  775. }
  776. #admin-edit-shenpi td, #admin-edit-shenpi th {
  777. padding: 0.75rem;
  778. }
  779. #admin-edit-shenpi th {
  780. background: none;
  781. color: #212529;
  782. border-top: 0;
  783. }
  784. </style>
  785. <table class="table table-hover" id="admin-edit-shenpi">
  786. <thead>
  787. <tr class="card-header text-center">
  788. <th width="100px">审批流程</th>
  789. <th>审批人员</th>
  790. <th width="80" style="text-align: center">审批状态</th>
  791. <th width="200" style="text-align: center">操作</th>
  792. </tr>
  793. </thead>
  794. <tbody id="admin-edit-shenpi-list">
  795. <% for (const [i, group] of ctx.material.auditors2.entries()) { %>
  796. <% if (i === 0) continue; %>
  797. <% for (const [j, auditor] of group.entries()) { %>
  798. <tr>
  799. <td class="text-left d-flex">
  800. <% if (j === 0) { %>
  801. <%- i + '审' %>
  802. <% if (auditor.audit_type !== auditType.key.common) { %>
  803. <span class="ml-2 badge badge-pill badge-<%- auditType.info[auditor.audit_type].class %> p-1"><small><%- auditType.info[auditor.audit_type].short %></small></span>
  804. <% } %>
  805. <% } %>
  806. </td>
  807. <td></span> <%- auditor.name %> <small class="text-muted"><%- auditor.role %></small></td>
  808. <td style="text-align: center"><span class="<%- auditConst.auditStringClass[auditor.status] %>"><%- auditor.status !== auditConst.status.uncheck ? auditConst.auditString[auditor.status] : '待审批' %></span></td>
  809. <td style="text-align: center">
  810. <% if (auditor.status === auditConst.status.checking && j === group.length - 1) { %>
  811. <span class="dropdown mr-2">
  812. <a href="javascript: void(0)" class="add-audit" id="<%- auditor.aid %>_add_dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">增加</a>
  813. <div class="dropdown-menu dropdown-menu-right" id="<%- auditor.aid %>_add_dropdownMenu" aria-labelledby="<%- auditor.aid %>_add_dropdownMenuButton" style="width:220px">
  814. <div class="mb-2 p-2"><input class="form-control form-control-sm gr-search"
  815. placeholder="姓名/手机 检索" autocomplete="off" data-code="<%- auditor.aid %>_add"></div>
  816. <dl class="list-unstyled book-list" data-aid="<%- auditor.aid %>" data-operate="add">
  817. <% accountGroup.forEach((group, idx) => { %>
  818. <dt><a href="javascript: void(0);" class="acc-btn" data-groupid="<%- idx %>"
  819. data-type="hide"><i class="fa fa-plus-square"></i></a> <%- group.groupName %></dt>
  820. <div class="dd-content" data-toggleid="<%- idx %>">
  821. <% group.groupList.forEach(item => { %>
  822. <% if (item.id !== ctx.material.user_id) { %>
  823. <dd class="border-bottom p-2 mb-0 " data-id="<%- item.id %>">
  824. <p class="mb-0 d-flex"><span class="text-primary"><%- item.name %></span><span
  825. class="ml-auto"><%- item.mobile %></span></p>
  826. <span class="text-muted"><%- item.role %></span>
  827. </dd>
  828. <% } %>
  829. <% });%>
  830. </div>
  831. <% }) %>
  832. </dl>
  833. </div>
  834. </span>
  835. <% } %>
  836. <% if (auditor.status === auditConst.status.uncheck) { %>
  837. <% if (j === group.length - 1) { %>
  838. <span class="dropdown mr-2">
  839. <a href="javascript: void(0)" class="add-audit" id="<%- auditor.aid %>_add_dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">增加</a>
  840. <div class="dropdown-menu dropdown-menu-right" id="<%- auditor.aid %>_add_dropdownMenu" aria-labelledby="<%- auditor.aid %>_add_dropdownMenuButton" style="width:220px">
  841. <div class="mb-2 p-2"><input class="form-control form-control-sm gr-search"
  842. placeholder="姓名/手机 检索" autocomplete="off" data-code="<%- auditor.aid %>_add"></div>
  843. <dl class="list-unstyled book-list" data-aid="<%- auditor.aid %>" data-operate="add">
  844. <% accountGroup.forEach((group, idx) => { %>
  845. <dt><a href="javascript: void(0);" class="acc-btn" data-groupid="<%- idx %>"
  846. data-type="hide"><i class="fa fa-plus-square"></i></a> <%- group.groupName %></dt>
  847. <div class="dd-content" data-toggleid="<%- idx %>">
  848. <% group.groupList.forEach(item => { %>
  849. <% if (item.id !== ctx.material.user_id) { %>
  850. <dd class="border-bottom p-2 mb-0 " data-id="<%- item.id %>">
  851. <p class="mb-0 d-flex"><span class="text-primary"><%- item.name %></span><span
  852. class="ml-auto"><%- item.mobile %></span></p>
  853. <span class="text-muted"><%- item.role %></span>
  854. </dd>
  855. <% } %>
  856. <% });%>
  857. </div>
  858. <% }) %>
  859. </dl>
  860. </div>
  861. </span>
  862. <% if (auditor.audit_type !== auditType.key.common) { %>
  863. <span class="dropdown mr-2">
  864. <a href="javascript: void(0)" class="add-audit" id="<%- auditor.aid %>_add-sibling_dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">平级</a>
  865. <div class="dropdown-menu dropdown-menu-right" id="<%- auditor.aid %>_add-sibling_dropdownMenu" aria-labelledby="<%- auditor.aid %>_add-sibling_dropdownMenuButton" style="width:220px">
  866. <div class="mb-2 p-2"><input class="form-control form-control-sm gr-search"
  867. placeholder="姓名/手机 检索" autocomplete="off" data-code="<%- auditor.aid %>_add-sibling"></div>
  868. <dl class="list-unstyled book-list" data-aid="<%- auditor.aid %>" data-operate="add-sibling">
  869. <% accountGroup.forEach((group, idx) => { %>
  870. <dt><a href="javascript: void(0);" class="acc-btn" data-groupid="<%- idx %>"
  871. data-type="hide"><i class="fa fa-plus-square"></i></a> <%- group.groupName %></dt>
  872. <div class="dd-content" data-toggleid="<%- idx %>">
  873. <% group.groupList.forEach(item => { %>
  874. <% if (item.id !== ctx.material.user_id) { %>
  875. <dd class="border-bottom p-2 mb-0 " data-id="<%- item.id %>">
  876. <p class="mb-0 d-flex"><span class="text-primary"><%- item.name %></span><span
  877. class="ml-auto"><%- item.mobile %></span></p>
  878. <span class="text-muted"><%- item.role %></span>
  879. </dd>
  880. <% } %>
  881. <% });%>
  882. </div>
  883. <% }) %>
  884. </dl>
  885. </div>
  886. </span>
  887. <% } %>
  888. <% } %>
  889. <span class="dropdown mr-2">
  890. <a href="javascript: void(0)" class="change-audit" id="<%- auditor.aid %>_change_dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">更换</a>
  891. <div class="dropdown-menu dropdown-menu-right" id="<%- auditor.aid %>_change_dropdownMenu" aria-labelledby="<%- auditor.aid %>_change_dropdownMenuButton" style="width:220px">
  892. <div class="mb-2 p-2"><input class="form-control form-control-sm gr-search"
  893. placeholder="姓名/手机 检索" autocomplete="off" data-code="<%- auditor.aid %>_change"></div>
  894. <dl class="list-unstyled book-list" data-aid="<%- auditor.aid %>" data-operate="change">
  895. <% accountGroup.forEach((group, idx) => { %>
  896. <dt><a href="javascript: void(0);" class="acc-btn" data-groupid="<%- idx %>"
  897. data-type="hide"><i class="fa fa-plus-square"></i></a> <%- group.groupName %></dt>
  898. <div class="dd-content" data-toggleid="<%- idx %>">
  899. <% group.groupList.forEach(item => { %>
  900. <% if (item.id !== ctx.material.user_id) { %>
  901. <dd class="border-bottom p-2 mb-0 " data-id="<%- item.id %>">
  902. <p class="mb-0 d-flex"><span class="text-primary"><%- item.name %></span><span
  903. class="ml-auto"><%- item.mobile %></span></p>
  904. <span class="text-muted"><%- item.role %></span>
  905. </dd>
  906. <% } %>
  907. <% });%>
  908. </div>
  909. <% }) %>
  910. </dl>
  911. </div>
  912. </span>
  913. <span class="dropdown">
  914. <a href="javascript: void(0)" class="text-danger" title="移除" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">移除</a>
  915. <div class="dropdown-menu">
  916. <span class="dropdown-item" href="javascript:void(0);">确认移除审批人?</span>
  917. <div class="dropdown-divider"></div>
  918. <div class="px-2 py-1 text-center">
  919. <button class="remove-audit btn btn-sm btn-danger" data-id="<%- auditor.aid %>">移除</button>
  920. <button class="btn btn-sm btn-secondary">取消</button>
  921. </div>
  922. </div>
  923. </span>
  924. <% } %>
  925. </td>
  926. </tr>
  927. <% } %>
  928. <% } %>
  929. </tbody>
  930. </table>
  931. </div>
  932. </div>
  933. </div>
  934. <form class="modal-footer">
  935. <div class="mr-auto text-warning">
  936. <span class="mr-3">增加:后级审核人</span>
  937. <span class="">平级:会签/或签增加平级审核人</span>
  938. </div>
  939. <button type="button" class="btn btn-secondary btn-sm" data-dismiss="modal">关闭</button>
  940. </form>
  941. </div>
  942. </div>
  943. </div>
  944. <% } %>
  945. <script type="text/javascript">
  946. const csrf = '<%= ctx.csrf %>';
  947. const authMobile = '<%= ctx.material.authMobile %>';
  948. const sam_auditConst = JSON.parse('<%- JSON.stringify(auditConst) %>');
  949. const auditType = JSON.parse('<%- JSON.stringify(auditType) %>');
  950. </script>
  951. <% if (ctx.session.sessionUser.accountId === ctx.material.user_id && (ctx.material.status === auditConst.status.uncheck || ctx.material.status === auditConst.status.checkNo)) { %>
  952. <script>
  953. const accountGroup = JSON.parse(unescape('<%- escape(JSON.stringify(accountGroup)) %>'));
  954. const accountList = JSON.parse(unescape('<%- escape(JSON.stringify(accountList)) %>'));
  955. const shenpi_status = <%- ctx.tender.info.shenpi.material %>;
  956. const shenpiConst = JSON.parse('<%- JSON.stringify(shenpiConst) %>');
  957. </script>
  958. <% } else if (ctx.material && ctx.material.status !== auditConst.status.checked && ctx.session.sessionUser.is_admin) { %>
  959. <script type="text/javascript">
  960. const accountGroup = JSON.parse(unescape('<%- escape(JSON.stringify(accountGroup)) %>'));
  961. const accountList = JSON.parse(unescape('<%- escape(JSON.stringify(accountList)) %>'));
  962. const material_uid = parseInt('<%= ctx.material.user_id %>');
  963. const auditorList = JSON.parse(unescape('<%- escape(JSON.stringify(ctx.material.auditors2)) %>'));
  964. </script>
  965. <% } %>
  966. <script>
  967. const cur_uid = parseInt('<%- ctx.session.sessionUser.accountId %>');
  968. const cur_tenderid = parseInt('<%- ctx.tender.id %>');
  969. </script>
  970. <script>
  971. $('.sp-location-list').on('shown.bs.modal', function () {
  972. const scrollBox = $(this).find('div[class="col-8 modal-height-500"]');
  973. const bdiv = (scrollBox.offset() && scrollBox.offset().top) || 0;
  974. scrollBox.scrollTop(0);
  975. const hdiv = divSearch($(this).find('textarea')) ? $(this).find('textarea') : null;
  976. const hdheight = hdiv ? hdiv.parents('.timeline-item-content').offset().top : null;
  977. if (hdiv && scrollBox.length && scrollBox[0].scrollHeight > 200 && hdheight - bdiv > 200) {
  978. scrollBox.scrollTop(hdheight - bdiv);
  979. }
  980. });
  981. function divSearch(div) {
  982. if (div.length > 0) {
  983. return true;
  984. }
  985. return false;
  986. }
  987. $('#audit-check0').submit(function (e) {
  988. if (auditCheck(0)) {
  989. const data = {
  990. opinion: $('[name=opinion]', this).val(),
  991. checkType: parseInt($('[name=checkType]', this).val()),
  992. };
  993. postData(this.action, data, function () {
  994. window.location.reload();
  995. });
  996. }
  997. return false;
  998. });
  999. $('#audit-check1').submit(function (e) {
  1000. if (auditCheck(1)) {
  1001. const data = {
  1002. opinion: $('[name=opinion]', this).val(),
  1003. checkType: parseInt($('[name=checkType]:checked', this).val()),
  1004. };
  1005. postData(this.action, data, function () {
  1006. window.location.reload();
  1007. });
  1008. }
  1009. return false;
  1010. });
  1011. // 展开历史审核记录
  1012. $('.modal-body #fold-btn').click(function () {
  1013. const type = $(this).data('target')
  1014. const auditCard = $(this).parent().parent()
  1015. if (type === 'show') {
  1016. $(this).data('target', 'hide')
  1017. auditCard.find('.fold-card').slideDown('swing', () => {
  1018. auditCard.find('#fold-btn').text('收起历史审核记录')
  1019. })
  1020. } else {
  1021. $(this).data('target', 'show')
  1022. auditCard.find('.fold-card').slideUp('swing', () => {
  1023. auditCard.find('#fold-btn').text('展开历史审核记录')
  1024. })
  1025. }
  1026. });
  1027. $('.sp-list-btn').click(function () {
  1028. const type = $(this).data('type')
  1029. if (type === 'hide') {
  1030. $('.sp-list-item').hide()
  1031. $('.modal-title').text('审批流程')
  1032. } else {
  1033. $('.sp-list-item').show()
  1034. $('.modal-title').text('重新上报')
  1035. }
  1036. });
  1037. $('#cc-digits').on('shown.bs.modal', function () {
  1038. $('#decimal_up').val(<%- material.decimal.up %>);
  1039. $('#decimal_tp').val(<%- material.decimal.tp %>);
  1040. $('#decimal_qty').val(<%- material.decimal.qty %>);
  1041. });
  1042. // 小数位设置
  1043. function checkSetDecimal() {
  1044. const up = parseInt($('#decimal_up').val());
  1045. const tp = parseInt($('#decimal_tp').val());
  1046. const qty = parseInt($('#decimal_qty').val());
  1047. let flag = false;
  1048. if(_.isNaN(up) || up > 6 || up < 0) {
  1049. toastr.error('单价小数位数设置不能大于6或小于0');
  1050. flag = true;
  1051. }
  1052. if(_.isNaN(tp) || tp > 6 || tp < 0) {
  1053. toastr.error('金额小数位数设置不能大于6或小于0');
  1054. flag = true;
  1055. }
  1056. if(_.isNaN(qty) || qty > 6 || qty < 0) {
  1057. toastr.error('数量小数位数设置不能大于6或小于0');
  1058. flag = true;
  1059. }
  1060. if (flag) {
  1061. return false;
  1062. }
  1063. }
  1064. // 重新审批按钮
  1065. $("#re-shenpi-btn").click(function () {
  1066. const data = {
  1067. };
  1068. <% if (ctx.session.sessionUser.loginStatus === 0) { %>
  1069. const code = $("#sp-down-back input[name='code']").val();
  1070. if ($(this).hasClass('disabled')) {
  1071. return false;
  1072. }
  1073. if (code.length < 6) {
  1074. // alert('请填写正确的验证码');
  1075. toastr.error('请填写正确的验证码');
  1076. return false;
  1077. }
  1078. data.code = code;
  1079. <% } %>
  1080. $.ajax({
  1081. url: '<%- preUrl %>/audit/check/again',
  1082. type: 'get',
  1083. data: data,
  1084. dataTye: 'json',
  1085. success: function (response) {
  1086. if (response.err === 0) {
  1087. window.location.href = response.url;
  1088. } else {
  1089. toastr.error(response.msg);
  1090. }
  1091. }
  1092. });
  1093. });
  1094. </script>
  1095. <% if (ctx.session.sessionUser.accountId === ctx.material.user_id && (ctx.material.calc_stage !== ctx.material.stage_id || !ctx.material.calc_tp)) { %>
  1096. <div class="modal fade" id="okedit" data-backdrop="static">
  1097. <div class="modal-dialog " role="document" >
  1098. <div class="modal-content">
  1099. <div class="modal-header">
  1100. <h5 class="modal-title">生成新一期调差清单</h5>
  1101. </div>
  1102. <div class="modal-body">
  1103. <div>
  1104. <h5 id="material-detail">正在获取上期调差清单数据中,请等待...</h5>
  1105. <div class="progress">
  1106. <div id="material-progress" class="progress-bar" role="progressbar" style="width: 100%;" aria-valuenow="50" aria-valuemin="0" aria-valuemax="100">100%</div>
  1107. </div>
  1108. </div>
  1109. <% if (ctx.material.is_stage_self) { %>
  1110. <% for (const ms of materialStageData) { %>
  1111. <div id="list-detail-<%- ms.sid %>" style="display: none" class="mt-3">
  1112. <h5>生成期调差清单:<b>第<%- ms.order %>期</b></h5>
  1113. <div class="progress">
  1114. <div id="list-progress-<%- ms.sid %>" class="progress-bar" role="progressbar" style="width: 0%;" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100">0%</div>
  1115. </div>
  1116. </div>
  1117. <% } %>
  1118. <% } else { %>
  1119. <div id="list-detail" style="display: none" class="mt-3">
  1120. <h5>生成调差清单:</h5>
  1121. <div class="progress">
  1122. <div id="list-progress" class="progress-bar" role="progressbar" style="width: 0%;" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100">0%</div>
  1123. </div>
  1124. </div>
  1125. <% } %>
  1126. <div id="self-detail" style="display: none" class="mt-3">
  1127. <h5>处理独立调差清单和计算总金额:</h5>
  1128. <div class="progress">
  1129. <div id="self-progress" class="progress-bar" role="progressbar" style="width: 0%;" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100">0%</div>
  1130. </div>
  1131. </div>
  1132. </div>
  1133. <div class="modal-footer" style="display: none" id="reload-make">
  1134. <button type="button" class="btn btn-sm btn-primary" onclick="window.location.reload();">刷新页面</button>
  1135. </div>
  1136. </div>
  1137. </div>
  1138. </div>
  1139. <script>
  1140. $(function () {
  1141. const stage_ids = JSON.parse(unescape('<%- escape(JSON.stringify(ctx.material.stage_id)) %>'));
  1142. const calc_stages = JSON.parse(unescape('<%- escape(JSON.stringify(ctx.material.calc_stage)) %>'));
  1143. const stage_id = stage_ids.split(',');
  1144. const calc_stage = calc_stages.split(',');
  1145. const calc_tp = parseInt('<%- ctx.material.calc_tp %>');
  1146. // stage_id和calc_stage数组对比,找出不同的值,并发起更新
  1147. const diff_stage_ids = _.difference(stage_id, calc_stage);
  1148. if (diff_stage_ids.length === 0 && calc_tp) return;
  1149. const is_stage_self = parseInt('<%- ctx.material.is_stage_self %>');
  1150. $('#okedit').modal('show');
  1151. let value = 0;
  1152. let interval;
  1153. let stop = false;
  1154. setProgress($('#material-progress'), 30);
  1155. postData('/tender/'+ cur_tenderid +'/measure/material/gcl/load', { stage_id, is_stage_self }, async function (result) {
  1156. // console.log(result);
  1157. const ledger = result.ledger;
  1158. const pos = result.pos;
  1159. const gclList = result.gclList;
  1160. const selfList = result.selfList;
  1161. // 整理material,针对上期是独立单价并多个不同值的单独设置值进行部分值去除
  1162. const materialListForSelf = _.uniqWith(_.orderBy(result.materialListForSelf, ['ms_id'], ['desc']), function(item1, item2) {
  1163. return item1.xmj_id === item2.xmj_id && item1.gcl_id === item2.gcl_id && item1.mx_id === item2.mx_id && item1.mb_id === item2.mb_id;
  1164. });
  1165. const insertSelfList = [];// 需要单独添加的明细清单工料含量列表
  1166. const hadQtySelfList = [];
  1167. $('#material-detail').text('获取上期调差清单数据成功');
  1168. stopProgress($('#material-progress'));
  1169. if (is_stage_self) {
  1170. for (const [i, newSid] of diff_stage_ids.entries()) {
  1171. const sid = parseInt(newSid);
  1172. $('#list-detail-' + sid).show();
  1173. resetProgress($('#list-progress-' + sid));
  1174. if (!interval) {
  1175. $('#list-detail-' + sid).show();
  1176. setProgress($('#list-progress-' + sid), 30);
  1177. }
  1178. const insertGclList = [];
  1179. const insertList = [];
  1180. const removeGclList = [];
  1181. const curLedger = _.find(result.curLedgerData, {sid: newSid});
  1182. const curPos = _.find(result.curPosData, {sid: newSid});
  1183. gclGatherModel.loadLedgerData(_.cloneDeep(ledger), curLedger.ledgerData);
  1184. gclGatherModel.loadPosData(_.cloneDeep(pos), curPos.posData);
  1185. const gclGatherData = gclGatherModel.gatherGclData();
  1186. // console.log(gclGatherData);
  1187. const insertGcl = [];
  1188. for (const g of gclList) {
  1189. const gcl = _.find(gclGatherData, function (item) {
  1190. return item.leafXmjs && item.leafXmjs.length > 0 && _.findIndex(item.leafXmjs, {gcl_id: g.gcl_id}) !== -1;
  1191. });
  1192. if (gcl) {
  1193. const ig = _.find(insertGcl, {gcl});
  1194. if (ig) {
  1195. if (_.findIndex(ig.bills, {mb_id: g.mb_id}) === -1) {
  1196. ig.bills.push(g);
  1197. }
  1198. } else {
  1199. insertGcl.push({
  1200. bills: [g],
  1201. gcl,
  1202. leafXmjs: _.filter(gcl.leafXmjs, function (item) {
  1203. return item.gather_qty !== undefined && item.gather_qty !== null
  1204. }),
  1205. })
  1206. }
  1207. } else {
  1208. removeGclList.push(g);
  1209. }
  1210. }
  1211. for (const one of insertGcl) {
  1212. if (one.leafXmjs && one.leafXmjs.length > 0) {
  1213. for (const xmj of one.leafXmjs) {
  1214. const is_self = _.findIndex(selfList, { gcl_id: xmj.gcl_id, xmj_id: xmj.id, mx_id: xmj.mx_id ? xmj.mx_id : '' }) !== -1;// 区分单独计量的明细工料含量
  1215. if (is_self) {
  1216. const billsList = _.filter(materialListForSelf, { gcl_id: xmj.gcl_id, xmj_id: xmj.id, mx_id: xmj.mx_id ? xmj.mx_id : '' });
  1217. for (const bill of billsList) {
  1218. if (!_.find(hadQtySelfList, bill)) {
  1219. hadQtySelfList.push(bill);
  1220. }
  1221. insertSelfList.push({
  1222. gcl_id: xmj.gcl_id,
  1223. mx_id: xmj.mx_id ? xmj.mx_id : '',
  1224. xmj_id: xmj.id ? xmj.id : null,
  1225. contract_qty: xmj.contract_qty,
  1226. qc_qty: xmj.qc_qty,
  1227. qc_minus_qty: xmj.qc_minus_qty,
  1228. gather_qty: xmj.gather_qty,
  1229. quantity: bill.quantity,
  1230. expr: bill.expr,
  1231. mb_id: bill.mb_id,
  1232. order: bill.order,
  1233. sid,
  1234. });
  1235. }
  1236. } else {
  1237. const newgcl = _.find(gclList, { gcl_id: xmj.gcl_id });
  1238. for (const bill of one.bills) {
  1239. insertList.push({
  1240. gcl_id: xmj.gcl_id,
  1241. mx_id: xmj.mx_id ? xmj.mx_id : '',
  1242. xmj_id: xmj.id ? xmj.id : null,
  1243. contract_qty: xmj.contract_qty,
  1244. qc_qty: xmj.qc_qty,
  1245. qc_minus_qty: xmj.qc_minus_qty,
  1246. gather_qty: xmj.gather_qty,
  1247. quantity: bill.quantity,
  1248. expr: bill.expr,
  1249. mb_id: bill.mb_id,
  1250. order: bill.order,
  1251. sid,
  1252. });
  1253. if (!newgcl) {
  1254. if (_.findIndex(insertGclList, { gcl_id: xmj.gcl_id }) === -1) {
  1255. insertGclList.push({
  1256. gcl_id: xmj.gcl_id,
  1257. quantity: bill.quantity,
  1258. expr: bill.expr,
  1259. old_quantity: bill.quantity,
  1260. old_expr: bill.expr,
  1261. mb_id: bill.mb_id,
  1262. order: bill.order,
  1263. });
  1264. }
  1265. }
  1266. }
  1267. }
  1268. }
  1269. }
  1270. }
  1271. console.log(sid, insertList, insertGclList, removeGclList);
  1272. const msg = await postMLData(sid, insertList, insertGclList, removeGclList, $('#list-progress-' + sid));
  1273. if (!msg) return;
  1274. }
  1275. } else {
  1276. $('#list-detail').show();
  1277. resetProgress($('#list-progress'));
  1278. if (!interval) {
  1279. $('#list-detail').show();
  1280. setProgress($('#list-progress'), 30);
  1281. }
  1282. const insertGclList = [];
  1283. const insertList = [];
  1284. const removeGclList = [];
  1285. const curLedgerData = result.curLedgerData;
  1286. const curPosData = result.curPosData;
  1287. gclGatherModel.loadLedgerData(_.cloneDeep(ledger), curLedgerData);
  1288. gclGatherModel.loadPosData(_.cloneDeep(pos), curPosData);
  1289. const gclGatherData = gclGatherModel.gatherGclData();
  1290. const insertGcl = [];
  1291. for (const g of gclList) {
  1292. const gcl = _.find(gclGatherData, function (item) {
  1293. return item.leafXmjs && item.leafXmjs.length > 0 && _.findIndex(item.leafXmjs, {gcl_id: g.gcl_id}) !== -1;
  1294. });
  1295. if (gcl) {
  1296. const ig = _.find(insertGcl, {gcl});
  1297. if (ig) {
  1298. if (_.findIndex(ig.bills, {mb_id: g.mb_id}) === -1) {
  1299. ig.bills.push(g);
  1300. }
  1301. } else {
  1302. insertGcl.push({
  1303. bills: [g],
  1304. gcl,
  1305. leafXmjs: _.filter(gcl.leafXmjs, function (item) {
  1306. return item.gather_qty !== undefined && item.gather_qty !== null || (item.qc_minus_qty !== undefined && item.qc_minus_qty !== null)
  1307. }),
  1308. })
  1309. }
  1310. } else {
  1311. removeGclList.push(g);
  1312. }
  1313. }
  1314. for (const one of insertGcl) {
  1315. if (one.leafXmjs && one.leafXmjs.length > 0) {
  1316. for (const xmj of one.leafXmjs) {
  1317. const is_self = _.findIndex(selfList, { gcl_id: xmj.gcl_id, xmj_id: xmj.id, mx_id: xmj.mx_id ? xmj.mx_id : null }) !== -1;// 区分单独计量的明细工料含量
  1318. if (is_self) {
  1319. const billsList = _.filter(materialListForSelf, { gcl_id: xmj.gcl_id, xmj_id: xmj.id, mx_id: xmj.mx_id ? xmj.mx_id : null });
  1320. for (const bill of billsList) {
  1321. hadQtySelfList.push(bill);
  1322. insertSelfList.push({
  1323. gcl_id: xmj.gcl_id,
  1324. mx_id: xmj.mx_id ? xmj.mx_id : '',
  1325. xmj_id: xmj.id ? xmj.id : null,
  1326. contract_qty: xmj.contract_qty,
  1327. qc_qty: xmj.qc_qty,
  1328. qc_minus_qty: xmj.qc_minus_qty,
  1329. gather_qty: xmj.gather_qty,
  1330. quantity: bill.quantity,
  1331. expr: bill.expr,
  1332. mb_id: bill.mb_id,
  1333. order: bill.order,
  1334. });
  1335. }
  1336. } else {
  1337. const newgcl = _.find(gclList, { gcl_id: xmj.gcl_id });
  1338. for (const bill of one.bills) {
  1339. insertList.push({
  1340. gcl_id: xmj.gcl_id,
  1341. mx_id: xmj.mx_id ? xmj.mx_id : '',
  1342. xmj_id: xmj.id ? xmj.id : null,
  1343. contract_qty: xmj.contract_qty,
  1344. qc_qty: xmj.qc_qty,
  1345. qc_minus_qty: xmj.qc_minus_qty,
  1346. gather_qty: xmj.gather_qty,
  1347. quantity: bill.quantity,
  1348. expr: bill.expr,
  1349. mb_id: bill.mb_id,
  1350. order: bill.order,
  1351. });
  1352. if (!newgcl) {
  1353. insertGclList.push({
  1354. gcl_id: xmj.gcl_id,
  1355. quantity: bill.quantity,
  1356. expr: bill.expr,
  1357. old_quantity: bill.quantity,
  1358. old_expr: bill.expr,
  1359. mb_id: bill.mb_id,
  1360. order: bill.order,
  1361. });
  1362. }
  1363. }
  1364. }
  1365. }
  1366. }
  1367. }
  1368. console.log(diff_stage_ids, insertList, insertGclList, removeGclList);
  1369. const msg = await postMLData(diff_stage_ids.join(','), insertList, insertGclList, removeGclList, $('#list-progress'));
  1370. if (!msg) return;
  1371. }
  1372. $('#self-detail').show();
  1373. setProgress($('#self-progress'), 30);
  1374. // 通过比较materialListForSelf和hadQtySelfList不重合部分,得出本期为null的gather_qty列表,插入到insertSelfList中
  1375. const pushSelfList = _.xorWith(materialListForSelf, hadQtySelfList, _.isEqual);
  1376. if (pushSelfList.length > 0) {
  1377. for (const ps of pushSelfList) {
  1378. insertSelfList.push({
  1379. gcl_id: ps.gcl_id,
  1380. mx_id: ps.mx_id,
  1381. xmj_id: ps.xmj_id,
  1382. contract_qty: null,
  1383. qc_qty: null,
  1384. qc_minus_qty: null,
  1385. gather_qty: null,
  1386. quantity: ps.quantity,
  1387. expr: ps.expr,
  1388. mb_id: ps.mb_id,
  1389. order: ps.order,
  1390. });
  1391. }
  1392. }
  1393. console.log(insertSelfList);
  1394. postData('/tender/' + cur_tenderid + '/measure/material/save/data', { type: 'make_self_list', mid: materialID || mid, material_self_list: insertSelfList }, function (result) {
  1395. stopProgress($('#self-progress'));
  1396. $('#reload-make').show();
  1397. }, function (err) {
  1398. stop = true;
  1399. clearInterval(interval);
  1400. $('#reload-make').show();
  1401. });
  1402. // postData(preUrl + '/measure/material/add', newMaterialData, function (result) {
  1403. // window.location.href = preUrl + '/measure/material/' + result.order;
  1404. // }, function () {
  1405. // stop = true;
  1406. // clearInterval(interval);
  1407. // console.log(_self.parents('div[id="add-qi"]'));
  1408. // $('#add-qi').modal('show');
  1409. // $('#okedit').modal('hide');
  1410. // _self.parents('div[id="add-qi"]').modal('show');
  1411. // _self.attr('disabled', false).text('确认添加');
  1412. // });
  1413. return;
  1414. });
  1415. async function postMLData(stage_id, material_list, insertGclList, removeGclList, _progress) {
  1416. try {
  1417. const result = await postDataAsync('/tender/' + cur_tenderid + '/measure/material/save/data', { type: 'make_material_list', mid: materialID || mid, stage_id, material_list, insertGclList, removeGclList });
  1418. if (!result) {
  1419. stop = true;
  1420. clearInterval(interval);
  1421. $('#reload-make').show();
  1422. } else {
  1423. stopProgress(_progress);
  1424. }
  1425. return result ? result : false;
  1426. } catch (err) {
  1427. console.error('失败:', err);
  1428. stop = true;
  1429. clearInterval(interval);
  1430. $('#reload-make').show();
  1431. return false;
  1432. }
  1433. }
  1434. function setProgress(_this, time = 50) {
  1435. interval = setInterval(function () {
  1436. if (value < 100) {
  1437. value = parseInt(value) + 1;
  1438. _this.css("width", value + "%").text(value + "%");
  1439. } else if (value === 100) {
  1440. value = parseInt(value) + 1;
  1441. value = 30;
  1442. }
  1443. }, time);
  1444. }
  1445. function resetProgress(_this) {
  1446. _this.removeClass('bg-success');
  1447. _this.css("width", "0%").text("0%").attr('aria-valuenow', '0');
  1448. }
  1449. function stopProgress(_this) {
  1450. if (interval) {
  1451. _this.addClass('bg-success');
  1452. _this.css("width", "100%").text("100%");
  1453. value = 0;
  1454. stop = true;
  1455. clearInterval(interval);
  1456. interval = 0;
  1457. }
  1458. }
  1459. })
  1460. </script>
  1461. <% } %>