audit_modal.ejs 136 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951
  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.company %>" 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.company %>" 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.company %>" 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-10">
  177. <span class="h6"><%- ctx.material.user.name %></span>
  178. <span class="text-muted ml-1">
  179. <%- ctx.material.user.company %>
  180. <% if (ctx.material.user.role) { %>
  181. - <%= ctx.material.user.role %>
  182. <% } %>
  183. </span>
  184. </div>
  185. <div class="col">
  186. <span class="pull-right text-success"><i class="fa fa-check-circle"></i></span>
  187. </div>
  188. </div>
  189. </div>
  190. </div>
  191. </div>
  192. </li>
  193. <% } %>
  194. <li class="timeline-list-item pb-2 <% if (group.status === auditConst.status.uncheck && idx === ctx.material.auditHistory.length - 1) { %>is_uncheck<% } %>">
  195. <% if (group.endYear) { %>
  196. <div class="timeline-item-date">
  197. <%- group.endYear %>
  198. <span><%- group.endDate %></span>
  199. <span><%- group.endTime %></span>
  200. </div>
  201. <% } %>
  202. <% if (index < his.length - 1) { %>
  203. <div class="timeline-item-tail"></div>
  204. <% } %>
  205. <% if (group.status === auditConst.status.checked) { %>
  206. <div class="timeline-item-icon bg-success text-light"><i class="fa fa-check"></i></div>
  207. <% } else if (group.status === auditConst.status.checkNo || group.status === auditConst.status.checkNoPre || group.status === auditConst.status.checkCancel) { %>
  208. <div class="timeline-item-icon bg-warning text-light"><i class="fa fa-level-up"></i></div>
  209. <% } else if (group.status === auditConst.status.checking) { %>
  210. <div class="timeline-item-icon bg-warning text-light"><i class="fa fa-ellipsis-h"></i></div>
  211. <% } else { %>
  212. <div class="timeline-item-icon bg-secondary text-light"></div>
  213. <% } %>
  214. <div class="timeline-item-content">
  215. <div class="py-1">
  216. <span class="text-black-50">
  217. <%- (!group.is_final ? group.audit_order : '终') %>审
  218. <% if (group.audit_type !== auditType.key.common) { %><span class="text-<%- auditType.info[group.audit_type].class %> "><%- auditType.info[group.audit_type].long %></span><% } %>
  219. </span>
  220. <% if (group.status !== auditConst.status.uncheck) { %>
  221. <span class="pull-right <%- auditConst.statusClass[group.status] %>"><%- auditConst.statusString[group.status] %></span>
  222. <% } %>
  223. </div>
  224. <div class="card">
  225. <div class="card-body px-3 py-0">
  226. <% for (const [i, auditor] of group.auditors.entries()) { %>
  227. <div class="card-text p-2 py-3 row <%- ( i > 0 ? 'border-top' : '') %>">
  228. <div class="col-10">
  229. <span class="h6"><%- auditor.name %></span>
  230. <span class="text-muted ml-1">
  231. <%- auditor.company %>
  232. <% if (auditor.role) { %>
  233. - <%= auditor.role %>
  234. <% } %>
  235. </span>
  236. </div>
  237. <div class="col">
  238. <% if (auditor.status === auditConst.status.checked) { %>
  239. <span class="pull-right text-success"><i class="fa fa-check-circle"></i></span>
  240. <% } else if (auditor.status === auditConst.status.checkNo || auditor.status === auditConst.status.checkNoPre || auditor.status === auditConst.status.checkCancel) { %>
  241. <span class="pull-right text-warning"><i class="fa fa-share-square fa-rotate-270"></i></span>
  242. <% } %>
  243. </div>
  244. <% if (auditor.opinion) { %>
  245. <div class="col-12 py-1 bg-light"><i class="fa fa-commenting-o mr-1"></i><%- auditor.opinion%></div>
  246. <% } %>
  247. </div>
  248. <% } %>
  249. </div>
  250. </div>
  251. </div>
  252. </li>
  253. <% }) %>
  254. </ul>
  255. </div>
  256. <% }) %>
  257. </div>
  258. </div>
  259. </div>
  260. <form class="modal-footer" method="post" action="<%- preUrl %>/audit/start" onsubmit="return checkAuditorFrom()">
  261. <input type="hidden" name="_csrf_j" value="<%= ctx.csrf %>">
  262. <button type="button" class="btn btn-secondary btn-sm" data-dismiss="modal">关闭</button>
  263. <% if(ctx.material.status === auditConst.status.checkNo && ctx.session.sessionUser.accountId === ctx.material.user_id) { %>
  264. <button class="btn btn-primary btn-sm sp-list-item" type="submit">确认上报</button>
  265. <% } %>
  266. </form>
  267. </div>
  268. </div>
  269. </div>
  270. <% } %>
  271. <% if (ctx.material.status === auditConst.status.checking || ctx.material.status === auditConst.status.checkNoPre) { %>
  272. <% if (ctx.material.curAuditorIds.indexOf(ctx.session.sessionUser.accountId) >= 0) { %>
  273. <!--审批通过-->
  274. <div class="modal fade sp-location-list" id="sp-done" data-backdrop="static">
  275. <div class="modal-dialog modal-lg" role="document">
  276. <form class="modal-content" action="<%- preUrl %>/audit/check" method="post" id="audit-check0">
  277. <div class="modal-header">
  278. <h5 class="modal-title">审批通过</h5>
  279. </div>
  280. <div class="modal-body">
  281. <div class="row">
  282. <div class="col-4">
  283. <% if(ctx.material.status !== auditConst.status.checked && ctx.session.sessionUser.is_admin) { %>
  284. <a class="sp-list-item" href="#sub-sp2" data-toggle="modal" data-target="#sub-sp2"
  285. id="hideSp">修改审批流程</a>
  286. <% } %>
  287. <div class="card modal-height-500 mt-3" style="overflow: auto">
  288. <ul class="list-group list-group-flush auditors-list">
  289. <% ctx.material.auditors2.forEach((item, idx) => { %>
  290. <% if (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-play-circle fa-rotate-90"></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.company %>" data-auditorId="<%- u.aid %>"><%- u.name %></small>
  296. <% } %>
  297. </span>
  298. <span class="badge badge-light badge-pill ml-auto"><small>原报</small></span>
  299. </li>
  300. <% } else if(idx === ctx.material.auditors2.length -1 && idx !== 0) { %>
  301. <li class="list-group-item d-flex justify-content-between align-items-center">
  302. <span class="mr-1"><i class="fa fa fa-stop-circle"></i></span>
  303. <span class="text-muted">
  304. <% for (const u of item) { %>
  305. <small class="d-inline-block text-dark mx-1" title="<%- u.company %>" data-auditorId="<%- u.aid %>"><%- u.name %></small>
  306. <% } %>
  307. </span>
  308. <div class="d-flex ml-auto">
  309. <% if (item[0].audit_type !== auditType.key.common) { %>
  310. <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>
  311. <% } %>
  312. <span class="badge badge-light badge-pill"><small>终审</small></span>
  313. </div>
  314. </li>
  315. <% } else {%>
  316. <li class="list-group-item d-flex justify-content-between align-items-center">
  317. <span class="mr-1"><i class="fa fa-chevron-circle-down"></i></span>
  318. <span class="text-muted">
  319. <% for (const u of item) { %>
  320. <small class="d-inline-block text-dark mx-1" title="<%- u.company %>" data-auditorId="<%- u.aid %>"><%- u.name %></small>
  321. <% } %>
  322. </span>
  323. <div class="d-flex ml-auto">
  324. <% if (item[0].audit_type !== auditType.key.common) { %>
  325. <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>
  326. <% } %>
  327. <span class="badge badge-light badge-pill"><small><%= ctx.helper.transFormToChinese(idx) %>审</small></span>
  328. </div>
  329. </li>
  330. <% } %>
  331. <% }) %>
  332. </ul>
  333. </div>
  334. </div>
  335. <div class="col-8 modal-height-500" style="overflow: auto">
  336. <% ctx.material.auditHistory.forEach((his, idx) => { %>
  337. <!-- 展开/收起历史流程 -->
  338. <% if(idx === ctx.material.auditHistory.length - 1 && ctx.material.auditHistory.length !== 1) { %>
  339. <div class="text-right">
  340. <a href="javascript: void(0);" id="fold-btn" data-target="show">展开历史审批流程</a>
  341. </div>
  342. <% } %>
  343. <div class="<%- idx < ctx.material.auditHistory.length - 1 ? 'fold-card' : '' %>">
  344. <div class="text-center text-muted"><%- idx+1 %>#</div>
  345. <ul class="timeline-list list-unstyled mt-2 <% if (idx === ctx.material.auditHistory.length - 1) { %>last-auditor-list<% } %>">
  346. <% his.forEach((group, index) => { %>
  347. <% if (index === 0) { %>
  348. <li class="timeline-list-item pb-2">
  349. <div class="timeline-item-date">
  350. <%- group.beginYear %>
  351. <span><%- group.beginDate %></span>
  352. <span><%- group.beginTime %></span>
  353. </div>
  354. <div class="timeline-item-tail"></div>
  355. <div class="timeline-item-icon bg-success text-light"><i class="fa fa-caret-down"></i></div>
  356. <div class="timeline-item-content">
  357. <div class="py-1">
  358. <span class="text-black-50">原报</span>
  359. <span class="pull-right text-success"><%- idx !== 0 ? '重新' : '' %>上报审批</span>
  360. </div>
  361. <div class="card">
  362. <div class="card-body px-3 py-0">
  363. <div class="card-text p-2 py-3 row">
  364. <div class="col-10">
  365. <span class="h6"><%- ctx.material.user.name %></span>
  366. <span class="text-muted ml-1">
  367. <%- ctx.material.user.company %>
  368. <% if (ctx.material.user.role) { %>
  369. - <%= ctx.material.user.role %>
  370. <% } %>
  371. </span>
  372. </div>
  373. <div class="col">
  374. <span class="pull-right text-success"><i class="fa fa-check-circle"></i></span>
  375. </div>
  376. </div>
  377. </div>
  378. </div>
  379. </div>
  380. </li>
  381. <% } %>
  382. <li class="timeline-list-item pb-2 <% if (group.status === auditConst.status.uncheck && idx === ctx.material.auditHistory.length - 1) { %>is_uncheck<% } %>">
  383. <% if (group.endYear) { %>
  384. <div class="timeline-item-date">
  385. <%- group.endYear %>
  386. <span><%- group.endDate %></span>
  387. <span><%- group.endTime %></span>
  388. </div>
  389. <% } %>
  390. <% if (index < his.length - 1) { %>
  391. <div class="timeline-item-tail"></div>
  392. <% } %>
  393. <% if (group.status === auditConst.status.checked) { %>
  394. <div class="timeline-item-icon bg-success text-light"><i class="fa fa-check"></i></div>
  395. <% } else if (group.status === auditConst.status.checkNo || group.status === auditConst.status.checkNoPre || group.status === auditConst.status.checkCancel) { %>
  396. <div class="timeline-item-icon bg-warning text-light"><i class="fa fa-level-up"></i></div>
  397. <% } else if (group.status === auditConst.status.checking) { %>
  398. <div class="timeline-item-icon bg-warning text-light"><i class="fa fa-ellipsis-h"></i></div>
  399. <% } else { %>
  400. <div class="timeline-item-icon bg-secondary text-light"></div>
  401. <% } %>
  402. <div class="timeline-item-content">
  403. <div class="py-1">
  404. <span class="text-black-50">
  405. <%- (!group.is_final ? group.audit_order : '终') %>审
  406. <% if (group.audit_type !== auditType.key.common) { %><span class="text-<%- auditType.info[group.audit_type].class %> "><%- auditType.info[group.audit_type].long %></span><% } %>
  407. </span>
  408. <% if (group.status !== auditConst.status.uncheck) { %>
  409. <span class="pull-right <%- auditConst.statusClass[group.status] %>"><%- auditConst.statusString[group.status] %></span>
  410. <% } %>
  411. </div>
  412. <div class="card">
  413. <div class="card-body px-3 py-0">
  414. <% for (const [i, auditor] of group.auditors.entries()) { %>
  415. <div class="card-text p-2 py-3 row <%- ( i > 0 ? 'border-top' : '') %>">
  416. <div class="col-10">
  417. <span class="h6"><%- auditor.name %></span>
  418. <span class="text-muted ml-1"><%- auditor.company %>
  419. <% if (auditor.role) { %>
  420. - <%= auditor.role %>
  421. <% } %>
  422. </span>
  423. </div>
  424. <div class="col">
  425. <% if (auditor.status === auditConst.status.checked) { %>
  426. <span class="pull-right text-success"><i class="fa fa-check-circle"></i></span>
  427. <% } if (auditor.status === auditConst.status.checkNo || auditor.status === auditConst.status.checkNoPre || auditor.status === auditConst.status.checkCancel) { %>
  428. <span class="pull-right text-warning"><i class="fa fa-share-square fa-rotate-270"></i></span>
  429. <% } else if (auditor.status === auditConst.status.checking) { %>
  430. <span class="pull-right text-warning"><i class="fa fa-commenting"></i></span>
  431. <% } %>
  432. </div>
  433. <% if (auditor.status !== auditConst.status.uncheck && auditor.opinion) { %>
  434. <div class="col-12 py-1 bg-light"><i class="fa fa-commenting-o mr-1"></i><%- auditor.opinion%></div>
  435. <% } %>
  436. <% if (auditor.status === auditConst.status.checking && auditor.aid === ctx.session.sessionUser.accountId) { %>
  437. <div class="col-12 py-1 bg-light">
  438. <textarea class="form-control form-control-sm" name="opinion">同意</textarea>
  439. </div>
  440. <% } %>
  441. </div>
  442. <% } %>
  443. </div>
  444. </div>
  445. </div>
  446. </li>
  447. <% }) %>
  448. </ul>
  449. </div>
  450. <% }) %>
  451. </div>
  452. </div>
  453. </div>
  454. <div class="modal-footer">
  455. <button type="button" class="btn btn-secondary btn-sm" data-dismiss="modal">关闭</button>
  456. <input type="hidden" name="_csrf_j" value="<%= ctx.csrf %>" />
  457. <input type="hidden" name="checkType" value="<%= auditConst.status.checked %>" />
  458. <button type="submit" class="btn btn-success btn-sm">确认通过</button>
  459. </div>
  460. </form>
  461. </div>
  462. </div>
  463. <!--审批退回-->
  464. <div class="modal fade sp-location-list" id="sp-back" data-backdrop="static">
  465. <div class="modal-dialog modal-lg" role="document">
  466. <form class="modal-content modal-lg" action="<%- preUrl %>/audit/check" method="post" id="audit-check1">
  467. <div class="modal-header">
  468. <h5 class="modal-title">审批退回</h5>
  469. </div>
  470. <div class="modal-body">
  471. <div class="row">
  472. <div class="col-4">
  473. <% if(ctx.material.status !== auditConst.status.checked && ctx.session.sessionUser.is_admin) { %>
  474. <a class="sp-list-item" href="#sub-sp2" data-toggle="modal" data-target="#sub-sp2"
  475. id="hideSp">修改审批流程</a>
  476. <% } %>
  477. <div class="card modal-height-500 mt-3" style="overflow: auto">
  478. <ul class="list-group list-group-flush auditors-list">
  479. <% ctx.material.auditors2.forEach((item, idx) => { %>
  480. <% if (idx === 0) { %>
  481. <li class="list-group-item d-flex justify-content-between align-items-center">
  482. <span class="mr-1"><i class="fa fa fa-play-circle fa-rotate-90"></i></span>
  483. <span class="text-muted">
  484. <% for (const u of item) { %>
  485. <small class="d-inline-block text-dark mx-1" title="<%- u.company %>" data-auditorId="<%- u.aid %>"><%- u.name %></small>
  486. <% } %>
  487. </span>
  488. <span class="badge badge-light badge-pill ml-auto"><small>原报</small></span>
  489. </li>
  490. <% } else if(idx === ctx.material.auditors2.length -1 && idx !== 0) { %>
  491. <li class="list-group-item d-flex justify-content-between align-items-center">
  492. <span class="mr-1"><i class="fa fa fa-stop-circle"></i></span>
  493. <span class="text-muted">
  494. <% for (const u of item) { %>
  495. <small class="d-inline-block text-dark mx-1" title="<%- u.company %>" data-auditorId="<%- u.aid %>"><%- u.name %></small>
  496. <% } %>
  497. </span>
  498. <div class="d-flex ml-auto">
  499. <% if (item[0].audit_type !== auditType.key.common) { %>
  500. <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>
  501. <% } %>
  502. <span class="badge badge-light badge-pill"><small>终审</small></span>
  503. </div>
  504. </li>
  505. <% } else {%>
  506. <li class="list-group-item d-flex justify-content-between align-items-center">
  507. <span class="mr-1"><i class="fa fa-chevron-circle-down"></i></span>
  508. <span class="text-muted">
  509. <% for (const u of item) { %>
  510. <small class="d-inline-block text-dark mx-1" title="<%- u.company %>" data-auditorId="<%- u.aid %>"><%- u.name %></small>
  511. <% } %>
  512. </span>
  513. <div class="d-flex ml-auto">
  514. <% if (item[0].audit_type !== auditType.key.common) { %>
  515. <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>
  516. <% } %>
  517. <span class="badge badge-light badge-pill"><small><%= ctx.helper.transFormToChinese(idx) %>审</small></span>
  518. </div>
  519. </li>
  520. <% } %>
  521. <% }) %>
  522. </ul>
  523. </div>
  524. </div>
  525. <div class="col-8 modal-height-500" style="overflow: auto">
  526. <% ctx.material.auditHistory.forEach((his, idx) => { %>
  527. <!-- 展开/收起历史流程 -->
  528. <% if(idx === ctx.material.auditHistory.length - 1 && ctx.material.auditHistory.length !== 1) { %>
  529. <div class="text-right"><a href="javascript: void(0);" id="fold-btn" data-target="show"
  530. data-idx="<%- idx + 1 %>">展开历史审批流程</a></div>
  531. <% } %>
  532. <div class="<%- idx < ctx.material.auditHistory.length - 1 ? 'fold-card' : '' %>">
  533. <div class="text-center text-muted"><%- idx+1 %>#</div>
  534. <ul class="timeline-list list-unstyled mt-2 <% if (idx === ctx.material.auditHistory.length - 1) { %>last-auditor-list<% } %>">
  535. <% his.forEach((group, index) => { %>
  536. <% if (index === 0) { %>
  537. <li class="timeline-list-item pb-2">
  538. <div class="timeline-item-date">
  539. <%- group.beginYear %>
  540. <span><%- group.beginDate %></span>
  541. <span><%- group.beginTime %></span>
  542. </div>
  543. <div class="timeline-item-tail"></div>
  544. <div class="timeline-item-icon bg-success text-light"><i class="fa fa-caret-down"></i></div>
  545. <div class="timeline-item-content">
  546. <div class="py-1">
  547. <span class="text-black-50">原报</span>
  548. <span class="pull-right text-success"><%- idx !== 0 ? '重新' : '' %>上报审批</span>
  549. </div>
  550. <div class="card">
  551. <div class="card-body px-3 py-0">
  552. <div class="card-text p-2 py-3 row">
  553. <div class="col-10">
  554. <span class="h6"><%- ctx.material.user.name %></span>
  555. <span class="text-muted ml-1">
  556. <%- ctx.material.user.company %>
  557. <% if (ctx.material.user.role) { %>
  558. - <%= ctx.material.user.role %>
  559. <% } %>
  560. </span>
  561. </div>
  562. <div class="col">
  563. <span class="pull-right text-success"><i class="fa fa-check-circle"></i></span>
  564. </div>
  565. </div>
  566. </div>
  567. </div>
  568. </div>
  569. </li>
  570. <% } %>
  571. <li class="timeline-list-item pb-2 <% if (group.status === auditConst.status.uncheck && idx === ctx.material.auditHistory.length - 1) { %>is_uncheck<% } %>">
  572. <% if (his.endYear) { %>
  573. <div class="timeline-item-date">
  574. <%- group.endYear %>
  575. <span><%- group.endDate %></span>
  576. <span><%- group.endTime %></span>
  577. </div>
  578. <% } %>
  579. <% if (index < his.length - 1) { %>
  580. <div class="timeline-item-tail"></div>
  581. <% } %>
  582. <% if (group.status === auditConst.status.checked) { %>
  583. <div class="timeline-item-icon bg-success text-light"><i class="fa fa-check"></i></div>
  584. <% } else if (group.status === auditConst.status.checkNo || group.status === auditConst.status.checkNoPre || group.status === auditConst.status.checkCancel) { %>
  585. <div class="timeline-item-icon bg-warning text-light"><i class="fa fa-level-up"></i></div>
  586. <% } else if (group.status === auditConst.status.checking) { %>
  587. <div class="timeline-item-icon bg-warning text-light"><i class="fa fa-ellipsis-h"></i></div>
  588. <% } else { %>
  589. <div class="timeline-item-icon bg-secondary text-light"></div>
  590. <% } %>
  591. <div class="timeline-item-content">
  592. <div class="py-1">
  593. <span class="text-black-50">
  594. <%- (!group.is_final ? group.audit_order : '终') %>审
  595. <% if (group.audit_type !== auditType.key.common) { %><span class="text-<%- auditType.info[group.audit_type].class %> "><%- auditType.info[group.audit_type].long %></span><% } %>
  596. </span>
  597. <% if (group.status !== auditConst.status.uncheck) { %>
  598. <span class="pull-right <%- auditConst.statusClass[group.status] %>"><%- auditConst.statusString[group.status] %></span>
  599. <% } %>
  600. </div>
  601. <div class="card">
  602. <div class="card-body px-3 py-0">
  603. <% for (const [i, auditor] of group.auditors.entries()) { %>
  604. <div class="card-text p-2 py-3 row <%- ( i > 0 ? 'border-top' : '') %>">
  605. <div class="col-10">
  606. <span class="h6"><%- auditor.name %></span>
  607. <span class="text-muted ml-1"><%- auditor.company %>
  608. <% if (auditor.role) { %>
  609. - <%= auditor.role %>
  610. <% } %>
  611. </span>
  612. </div>
  613. <div class="col">
  614. <% if (auditor.status === auditConst.status.checked) { %>
  615. <span class="pull-right text-success"><i class="fa fa-check-circle"></i></span>
  616. <% } if (auditor.status === auditConst.status.checkNo || auditor.status === auditConst.status.checkNoPre || auditor.status === auditConst.status.checkCancel) { %>
  617. <span class="pull-right text-warning"><i class="fa fa-share-square fa-rotate-270"></i></span>
  618. <% } else if (auditor.status === auditConst.status.checking) { %>
  619. <span class="pull-right text-warning"><i class="fa fa-commenting"></i></span>
  620. <% } %>
  621. </div>
  622. <% if (auditor.status !== auditConst.status.uncheck && auditor.opinion) { %>
  623. <div class="col-12 py-1 bg-light"><i class="fa fa-commenting-o mr-1"></i><%- auditor.opinion%></div>
  624. <% } %>
  625. <% if (auditor.status === auditConst.status.checking && auditor.aid === ctx.session.sessionUser.accountId) { %>
  626. <div class="col-12 py-1 bg-light">
  627. <textarea class="form-control form-control-sm" name="opinion">不同意</textarea>
  628. <div class="alert alert-warning mt-1 mb-0 p-2" id="reject-process">
  629. <div class="form-check form-check-inline">
  630. <input class="form-check-input" type="radio" name="checkType" id="inlineRadio1" value="<%- auditConst.status.checkNo %>">
  631. <label class="form-check-label" for="inlineRadio1">退回原报 <%- ctx.material.user.name %></label>
  632. </div>
  633. <% if (auditor.audit_order > 1) { %>
  634. <div class="form-check form-check-inline">
  635. <input class="form-check-input" type="radio" name="checkType" id="inlineRadio2" value="<%- auditConst.status.checkNoPre %>">
  636. <label class="form-check-label" for="inlineRadio2">退回上一审批人
  637. <% const pre = ctx.helper._.findLast(his, x => { return x.audit_order === auditor.audit_order - 1 }); %>
  638. <%- (pre.audit_type === auditType.key.common ? pre.auditors[0].name : `${pre.audit_order}审`)%>
  639. </label>
  640. </div>
  641. <% } %>
  642. </div>
  643. </div>
  644. <% } %>
  645. </div>
  646. <% } %>
  647. </div>
  648. </div>
  649. </div>
  650. </li>
  651. <% }) %>
  652. </ul>
  653. </div>
  654. <% }) %>
  655. </div>
  656. </div>
  657. </div>
  658. <div class="modal-footer">
  659. <button type="button" class="btn btn-secondary btn-sm" data-dismiss="modal">关闭</button>
  660. <input type="hidden" name="_csrf_j" value="<%= ctx.csrf %>" />
  661. <button type="submit" class="btn btn-warning btn-sm">确认退回</button>
  662. </div>
  663. </form>
  664. </div>
  665. </div>
  666. <% } %>
  667. <% } %>
  668. <!--材料调差-小数位数-->
  669. <div class="modal fade" id="cc-digits" data-backdrop="static">
  670. <div class="modal-dialog" role="document">
  671. <form action="/tender/<%- ctx.tender.id %>/measure/material/<%- ctx.material.order %>/save/decimal" method="post" onsubmit="return checkSetDecimal();" class="modal-content">
  672. <div class="modal-header">
  673. <h5 class="modal-title">设置</h5>
  674. </div>
  675. <div class="modal-body">
  676. <div class="form-group mb-3">
  677. <h5>信息价小数位数</h5>
  678. <div class="row">
  679. <div class="col-4">
  680. <div class="input-group input-group-sm">
  681. <div class="input-group-prepend">
  682. <span class="input-group-text">单价</span>
  683. </div>
  684. <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<% } %>>
  685. </div>
  686. </div>
  687. <div class="col-4">
  688. <div class="input-group input-group-sm">
  689. <div class="input-group-prepend">
  690. <span class="input-group-text">金额</span>
  691. </div>
  692. <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<% } %>>
  693. </div>
  694. </div>
  695. <div class="col-4">
  696. <div class="input-group input-group-sm">
  697. <div class="input-group-prepend">
  698. <span class="input-group-text">数量</span>
  699. </div>
  700. <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<% } %>>
  701. </div>
  702. </div>
  703. </div>
  704. </div>
  705. <div class="form-group mb-3">
  706. <h5>指数法小数位数</h5>
  707. <div class="row">
  708. <div class="col-4">
  709. <div class="input-group input-group-sm">
  710. <div class="input-group-prepend">
  711. <span class="input-group-text">单价</span>
  712. </div>
  713. <input type="number" step="1" min="0" max="6" id="exponent_decimal_up" name="exponent_up" class="form-control" value="<%- material.exponent_decimal.up %>" <% if (!((material.status === auditConst.status.uncheck || material.status === auditConst.status.checkNo) && ctx.session.sessionUser.accountId === material.user_id)) { %>disabled<% } %>>
  714. </div>
  715. </div>
  716. <div class="col-4">
  717. <div class="input-group input-group-sm">
  718. <div class="input-group-prepend">
  719. <span class="input-group-text">金额</span>
  720. </div>
  721. <input type="number" step="1" min="0" max="6" id="exponent_decimal_tp" name="exponent_tp" class="form-control" value="<%- material.exponent_decimal.tp %>" <% if (!((material.status === auditConst.status.uncheck || material.status === auditConst.status.checkNo) && ctx.session.sessionUser.accountId === material.user_id)) { %>disabled<% } %>>
  722. </div>
  723. </div>
  724. <div class="col-4">
  725. <div class="input-group input-group-sm">
  726. <div class="input-group-prepend">
  727. <span class="input-group-text">计算值</span>
  728. </div>
  729. <input type="number" step="1" min="0" max="6" id="exponent_decimal_qty" name="exponent_qty" class="form-control" value="<%- material.exponent_decimal.qty %>" <% if (!((material.status === auditConst.status.uncheck || material.status === auditConst.status.checkNo) && ctx.session.sessionUser.accountId === material.user_id)) { %>disabled<% } %>>
  730. </div>
  731. </div>
  732. </div>
  733. </div>
  734. <div class="form-group">
  735. <h5>计量期数据来源</h5>
  736. <div>
  737. <% 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)))) { %>
  738. <% for (const qs of qtySourceConst) { %>
  739. <div class="form-check form-check-inline">
  740. <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<% } %>>
  741. <label class="form-check-label" for="<%- qs.key %>_source"><%- qs.name %></label>
  742. </div>
  743. <% } %>
  744. <% } else { %>
  745. <div class="form-check form-check-inline">
  746. <input type="radio" class="form-check-input" checked disabled>
  747. <label class="form-check-label"><%- ctx.helper._.find(qtySourceConst, { value: material.qty_source }).name %></label>
  748. </div>
  749. <% } %>
  750. </div>
  751. </div>
  752. </div>
  753. <div class="modal-footer">
  754. <input type="hidden" name="_csrf_j" value="<%= ctx.csrf %>" />
  755. <button type="button" class="btn btn-sm btn-secondary" data-dismiss="modal">取消</button>
  756. <% if ((material.status === auditConst.status.uncheck || material.status === auditConst.status.checkNo) && ctx.session.sessionUser.accountId === material.user_id) { %>
  757. <button type="submit" class="btn btn-sm btn-primary">确认修改</button>
  758. <% } %>
  759. </div>
  760. </form>
  761. </div>
  762. </div>
  763. <% 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) { %>
  764. <% if (ctx.material && !ctx.material.authMobile && ctx.session.sessionUser.loginStatus === 0) { %>
  765. <!--终审重新审批-->
  766. <div class="modal fade" id="sp-down-back" data-backdrop="static">
  767. <div class="modal-dialog" role="document">
  768. <div class="modal-content">
  769. <div class="modal-header">
  770. <h5 class="modal-title">重新审批</h5>
  771. </div>
  772. <div class="modal-body">
  773. <h5>重新审批需要您的手机短信验证</h5>
  774. <h5>您目前还没设置认证手机,请先设置。</h5>
  775. </div>
  776. <div class="modal-footer">
  777. <button type="button" class="btn btn-sm btn-secondary" data-dismiss="modal">取消</button>
  778. <a href="/profile/sms" class="btn btn-sm btn-primary">去设置</a>
  779. </div>
  780. </div>
  781. </div>
  782. </div>
  783. <% } else { %>
  784. <div class="modal fade" id="sp-down-back" data-backdrop="static">
  785. <div class="modal-dialog" role="document">
  786. <div class="modal-content">
  787. <div class="modal-header">
  788. <h5 class="modal-title">重新审批</h5>
  789. </div>
  790. <div class="modal-body">
  791. <h5>确认由「终审-<%= ctx.session.sessionUser.name %>」重新审批「第<%= ctx.material.order %>期」?
  792. </h5>
  793. <% if (ctx.session.sessionUser.loginStatus === 0) { %>
  794. <div class="form-group">
  795. <label>重审需要验证码确认,验证码将发送至尾号<%- ctx.material.authMobile.slice(-4) %>的手机</label>
  796. <div class="input-group input-group-sm mb-3">
  797. <input class="form-control" type="text" readonly="readonly" name="code"
  798. placeholder="输入短信中的6位验证码" />
  799. <div class="input-group-append">
  800. <button class="btn btn-outline-secondary" type="button" id="get-code">获取验证码</button>
  801. </div>
  802. </div>
  803. </div>
  804. <% } %>
  805. </div>
  806. <div class="modal-footer">
  807. <button type="button" class="btn btn-secondary btn-sm" data-dismiss="modal">关闭</button>
  808. <!--<a href="<%- preUrl %>/audit/check/again" disabled class="btn btn-warning btn-sm">确定重审</a>-->
  809. <button <% if (ctx.session.sessionUser.loginStatus === 0) { %>disabled<% } %> id="re-shenpi-btn"
  810. class="btn btn-warning btn-sm">确定重审</button>
  811. </div>
  812. </div>
  813. </div>
  814. </div>
  815. <% } %>
  816. <% } %>
  817. <% if (ctx.material && ctx.material.status !== auditConst.status.checked && ctx.session.sessionUser.is_admin) { %>
  818. <!--上报审批-->
  819. <div class="modal fade" id="sub-sp2" data-backdrop="static">
  820. <div class="modal-dialog" style="max-width: 650px" role="document">
  821. <div class="modal-content">
  822. <div class="modal-header">
  823. <h5 class="modal-title">修改审批流程</h5>
  824. </div>
  825. <div class="modal-body">
  826. <div class="card mt-1">
  827. <div class="modal-height-500" style="overflow: auto">
  828. <style>
  829. #admin-edit-shenpi thead th {
  830. border-bottom: 0;
  831. }
  832. #admin-edit-shenpi td, #admin-edit-shenpi th {
  833. padding: 0.75rem;
  834. }
  835. #admin-edit-shenpi th {
  836. background: none;
  837. color: #212529;
  838. border-top: 0;
  839. }
  840. </style>
  841. <table class="table table-hover" id="admin-edit-shenpi">
  842. <thead>
  843. <tr class="card-header text-center">
  844. <th width="100px">审批流程</th>
  845. <th>审批人员</th>
  846. <th width="80" style="text-align: center">审批状态</th>
  847. <th width="200" style="text-align: center">操作</th>
  848. </tr>
  849. </thead>
  850. <tbody id="admin-edit-shenpi-list">
  851. <% for (const [i, group] of ctx.material.auditors2.entries()) { %>
  852. <% if (i === 0) continue; %>
  853. <% for (const [j, auditor] of group.entries()) { %>
  854. <tr>
  855. <td class="text-left d-flex">
  856. <% if (j === 0) { %>
  857. <%- i + '审' %>
  858. <% if (auditor.audit_type !== auditType.key.common) { %>
  859. <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>
  860. <% } %>
  861. <% } %>
  862. </td>
  863. <td></span> <%- auditor.name %> <small class="text-muted"><%- auditor.role %></small></td>
  864. <td style="text-align: center"><span class="<%- auditConst.auditStringClass[auditor.status] %>"><%- auditor.status !== auditConst.status.uncheck ? auditConst.auditString[auditor.status] : '待审批' %></span></td>
  865. <td style="text-align: center">
  866. <% if (auditor.status === auditConst.status.checking && j === group.length - 1) { %>
  867. <span class="dropdown mr-2">
  868. <a href="javascript: void(0)" class="add-audit" id="<%- auditor.aid %>_add_dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">增加</a>
  869. <div class="dropdown-menu dropdown-menu-right" id="<%- auditor.aid %>_add_dropdownMenu" aria-labelledby="<%- auditor.aid %>_add_dropdownMenuButton" style="width:220px">
  870. <div class="mb-2 p-2"><input class="form-control form-control-sm gr-search"
  871. placeholder="姓名/手机 检索" autocomplete="off" data-code="<%- auditor.aid %>_add"></div>
  872. <dl class="list-unstyled book-list" data-aid="<%- auditor.aid %>" data-operate="add">
  873. <% accountGroup.forEach((group, idx) => { %>
  874. <dt><a href="javascript: void(0);" class="acc-btn" data-groupid="<%- idx %>"
  875. data-type="hide"><i class="fa fa-plus-square"></i></a> <%- group.groupName %></dt>
  876. <div class="dd-content" data-toggleid="<%- idx %>">
  877. <% group.groupList.forEach(item => { %>
  878. <% if (item.id !== ctx.material.user_id) { %>
  879. <dd class="border-bottom p-2 mb-0 " data-id="<%- item.id %>">
  880. <p class="mb-0 d-flex"><span class="text-primary"><%- item.name %></span><span
  881. class="ml-auto"><%- item.mobile %></span></p>
  882. <span class="text-muted"><%- item.role %></span>
  883. </dd>
  884. <% } %>
  885. <% });%>
  886. </div>
  887. <% }) %>
  888. </dl>
  889. </div>
  890. </span>
  891. <% } %>
  892. <% if (auditor.status === auditConst.status.uncheck) { %>
  893. <% if (j === group.length - 1) { %>
  894. <span class="dropdown mr-2">
  895. <a href="javascript: void(0)" class="add-audit" id="<%- auditor.aid %>_add_dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">增加</a>
  896. <div class="dropdown-menu dropdown-menu-right" id="<%- auditor.aid %>_add_dropdownMenu" aria-labelledby="<%- auditor.aid %>_add_dropdownMenuButton" style="width:220px">
  897. <div class="mb-2 p-2"><input class="form-control form-control-sm gr-search"
  898. placeholder="姓名/手机 检索" autocomplete="off" data-code="<%- auditor.aid %>_add"></div>
  899. <dl class="list-unstyled book-list" data-aid="<%- auditor.aid %>" data-operate="add">
  900. <% accountGroup.forEach((group, idx) => { %>
  901. <dt><a href="javascript: void(0);" class="acc-btn" data-groupid="<%- idx %>"
  902. data-type="hide"><i class="fa fa-plus-square"></i></a> <%- group.groupName %></dt>
  903. <div class="dd-content" data-toggleid="<%- idx %>">
  904. <% group.groupList.forEach(item => { %>
  905. <% if (item.id !== ctx.material.user_id) { %>
  906. <dd class="border-bottom p-2 mb-0 " data-id="<%- item.id %>">
  907. <p class="mb-0 d-flex"><span class="text-primary"><%- item.name %></span><span
  908. class="ml-auto"><%- item.mobile %></span></p>
  909. <span class="text-muted"><%- item.role %></span>
  910. </dd>
  911. <% } %>
  912. <% });%>
  913. </div>
  914. <% }) %>
  915. </dl>
  916. </div>
  917. </span>
  918. <% if (auditor.audit_type !== auditType.key.common) { %>
  919. <span class="dropdown mr-2">
  920. <a href="javascript: void(0)" class="add-audit" id="<%- auditor.aid %>_add-sibling_dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">平级</a>
  921. <div class="dropdown-menu dropdown-menu-right" id="<%- auditor.aid %>_add-sibling_dropdownMenu" aria-labelledby="<%- auditor.aid %>_add-sibling_dropdownMenuButton" style="width:220px">
  922. <div class="mb-2 p-2"><input class="form-control form-control-sm gr-search"
  923. placeholder="姓名/手机 检索" autocomplete="off" data-code="<%- auditor.aid %>_add-sibling"></div>
  924. <dl class="list-unstyled book-list" data-aid="<%- auditor.aid %>" data-operate="add-sibling">
  925. <% accountGroup.forEach((group, idx) => { %>
  926. <dt><a href="javascript: void(0);" class="acc-btn" data-groupid="<%- idx %>"
  927. data-type="hide"><i class="fa fa-plus-square"></i></a> <%- group.groupName %></dt>
  928. <div class="dd-content" data-toggleid="<%- idx %>">
  929. <% group.groupList.forEach(item => { %>
  930. <% if (item.id !== ctx.material.user_id) { %>
  931. <dd class="border-bottom p-2 mb-0 " data-id="<%- item.id %>">
  932. <p class="mb-0 d-flex"><span class="text-primary"><%- item.name %></span><span
  933. class="ml-auto"><%- item.mobile %></span></p>
  934. <span class="text-muted"><%- item.role %></span>
  935. </dd>
  936. <% } %>
  937. <% });%>
  938. </div>
  939. <% }) %>
  940. </dl>
  941. </div>
  942. </span>
  943. <% } %>
  944. <% } %>
  945. <span class="dropdown mr-2">
  946. <a href="javascript: void(0)" class="change-audit" id="<%- auditor.aid %>_change_dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">更换</a>
  947. <div class="dropdown-menu dropdown-menu-right" id="<%- auditor.aid %>_change_dropdownMenu" aria-labelledby="<%- auditor.aid %>_change_dropdownMenuButton" style="width:220px">
  948. <div class="mb-2 p-2"><input class="form-control form-control-sm gr-search"
  949. placeholder="姓名/手机 检索" autocomplete="off" data-code="<%- auditor.aid %>_change"></div>
  950. <dl class="list-unstyled book-list" data-aid="<%- auditor.aid %>" data-operate="change">
  951. <% accountGroup.forEach((group, idx) => { %>
  952. <dt><a href="javascript: void(0);" class="acc-btn" data-groupid="<%- idx %>"
  953. data-type="hide"><i class="fa fa-plus-square"></i></a> <%- group.groupName %></dt>
  954. <div class="dd-content" data-toggleid="<%- idx %>">
  955. <% group.groupList.forEach(item => { %>
  956. <% if (item.id !== ctx.material.user_id) { %>
  957. <dd class="border-bottom p-2 mb-0 " data-id="<%- item.id %>">
  958. <p class="mb-0 d-flex"><span class="text-primary"><%- item.name %></span><span
  959. class="ml-auto"><%- item.mobile %></span></p>
  960. <span class="text-muted"><%- item.role %></span>
  961. </dd>
  962. <% } %>
  963. <% });%>
  964. </div>
  965. <% }) %>
  966. </dl>
  967. </div>
  968. </span>
  969. <span class="dropdown">
  970. <a href="javascript: void(0)" class="text-danger" title="移除" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">移除</a>
  971. <div class="dropdown-menu">
  972. <span class="dropdown-item" href="javascript:void(0);">确认移除审批人?</span>
  973. <div class="dropdown-divider"></div>
  974. <div class="px-2 py-1 text-center">
  975. <button class="remove-audit btn btn-sm btn-danger" data-id="<%- auditor.aid %>">移除</button>
  976. <button class="btn btn-sm btn-secondary">取消</button>
  977. </div>
  978. </div>
  979. </span>
  980. <% } %>
  981. </td>
  982. </tr>
  983. <% } %>
  984. <% } %>
  985. </tbody>
  986. </table>
  987. </div>
  988. </div>
  989. </div>
  990. <form class="modal-footer">
  991. <div class="mr-auto text-warning">
  992. <span class="mr-3">增加:后级审核人</span>
  993. <span class="">平级:会签/或签增加平级审核人</span>
  994. </div>
  995. <button type="button" class="btn btn-secondary btn-sm" data-dismiss="modal">关闭</button>
  996. </form>
  997. </div>
  998. </div>
  999. </div>
  1000. <% } %>
  1001. <script type="text/javascript">
  1002. const csrf = '<%= ctx.csrf %>';
  1003. const authMobile = '<%= ctx.material.authMobile %>';
  1004. const sam_auditConst = JSON.parse('<%- JSON.stringify(auditConst) %>');
  1005. const auditType = JSON.parse('<%- JSON.stringify(auditType) %>');
  1006. </script>
  1007. <% if (ctx.session.sessionUser.accountId === ctx.material.user_id && (ctx.material.status === auditConst.status.uncheck || ctx.material.status === auditConst.status.checkNo)) { %>
  1008. <script>
  1009. const accountGroup = JSON.parse(unescape('<%- escape(JSON.stringify(accountGroup)) %>'));
  1010. const accountList = JSON.parse(unescape('<%- escape(JSON.stringify(accountList)) %>'));
  1011. const shenpi_status = <%- ctx.tender.info.shenpi.material %>;
  1012. const shenpiConst = JSON.parse('<%- JSON.stringify(shenpiConst) %>');
  1013. </script>
  1014. <% } else if (ctx.material && ctx.material.status !== auditConst.status.checked && ctx.session.sessionUser.is_admin) { %>
  1015. <script type="text/javascript">
  1016. const accountGroup = JSON.parse(unescape('<%- escape(JSON.stringify(accountGroup)) %>'));
  1017. const accountList = JSON.parse(unescape('<%- escape(JSON.stringify(accountList)) %>'));
  1018. const material_uid = parseInt('<%= ctx.material.user_id %>');
  1019. const auditorList = JSON.parse(unescape('<%- escape(JSON.stringify(ctx.material.auditors2)) %>'));
  1020. </script>
  1021. <% } %>
  1022. <script>
  1023. const cur_uid = parseInt('<%- ctx.session.sessionUser.accountId %>');
  1024. const cur_tenderid = parseInt('<%- ctx.tender.id %>');
  1025. const cur_materialOrder = parseInt('<%- ctx.material.order %>');
  1026. </script>
  1027. <script>
  1028. $('.sp-location-list').on('shown.bs.modal', function () {
  1029. const scrollBox = $(this).find('div[class="col-8 modal-height-500"]');
  1030. const bdiv = (scrollBox.offset() && scrollBox.offset().top) || 0;
  1031. scrollBox.scrollTop(0);
  1032. const hdiv = divSearch($(this).find('textarea')) ? $(this).find('textarea') : null;
  1033. const hdheight = hdiv ? hdiv.parents('.timeline-item-content').offset().top : null;
  1034. if (hdiv && scrollBox.length && scrollBox[0].scrollHeight > 200 && hdheight - bdiv > 200) {
  1035. scrollBox.scrollTop(hdheight - bdiv);
  1036. }
  1037. });
  1038. function divSearch(div) {
  1039. if (div.length > 0) {
  1040. return true;
  1041. }
  1042. return false;
  1043. }
  1044. $('#audit-check0').submit(function (e) {
  1045. if (auditCheck(0)) {
  1046. const data = {
  1047. opinion: $('[name=opinion]', this).val(),
  1048. checkType: parseInt($('[name=checkType]', this).val()),
  1049. };
  1050. postData(this.action, data, function () {
  1051. window.location.reload();
  1052. });
  1053. }
  1054. return false;
  1055. });
  1056. $('#audit-check1').submit(function (e) {
  1057. if (auditCheck(1)) {
  1058. const data = {
  1059. opinion: $('[name=opinion]', this).val(),
  1060. checkType: parseInt($('[name=checkType]:checked', this).val()),
  1061. };
  1062. postData(this.action, data, function () {
  1063. window.location.reload();
  1064. });
  1065. }
  1066. return false;
  1067. });
  1068. function auditCheck(i) {
  1069. const opinion = $('textarea[name="opinion"]').eq(i).val().replace(/\r\n/g, '<br/>').replace(/\n/g, '<br/>').replace(/\s/g, ' ');
  1070. $('textarea[name="opinion"]').eq(i).val(opinion);
  1071. return true;
  1072. }
  1073. // 展开历史审核记录
  1074. $('.modal-body #fold-btn').click(function () {
  1075. const type = $(this).data('target')
  1076. const auditCard = $(this).parent().parent()
  1077. if (type === 'show') {
  1078. $(this).data('target', 'hide')
  1079. auditCard.find('.fold-card').slideDown('swing', () => {
  1080. auditCard.find('#fold-btn').text('收起历史审核记录')
  1081. })
  1082. } else {
  1083. $(this).data('target', 'show')
  1084. auditCard.find('.fold-card').slideUp('swing', () => {
  1085. auditCard.find('#fold-btn').text('展开历史审核记录')
  1086. })
  1087. }
  1088. });
  1089. $('.sp-list-btn').click(function () {
  1090. const type = $(this).data('type')
  1091. if (type === 'hide') {
  1092. $('.sp-list-item').hide()
  1093. $('.modal-title').text('审批流程')
  1094. } else {
  1095. $('.sp-list-item').show()
  1096. $('.modal-title').text('重新上报')
  1097. }
  1098. });
  1099. $('#cc-digits').on('shown.bs.modal', function () {
  1100. $('#decimal_up').val(<%- material.decimal.up %>);
  1101. $('#decimal_tp').val(<%- material.decimal.tp %>);
  1102. $('#decimal_qty').val(<%- material.decimal.qty %>);
  1103. $('#exponent_decimal_up').val(<%- material.exponent_decimal.up %>);
  1104. $('#exponent_decimal_tp').val(<%- material.exponent_decimal.tp %>);
  1105. $('#exponent_decimal_qty').val(<%- material.exponent_decimal.qty %>);
  1106. });
  1107. // 小数位设置
  1108. function checkSetDecimal() {
  1109. const up = parseInt($('#decimal_up').val());
  1110. const tp = parseInt($('#decimal_tp').val());
  1111. const qty = parseInt($('#decimal_qty').val());
  1112. const exponent_up = parseInt($('#exponent_decimal_up').val());
  1113. const exponent_tp = parseInt($('#exponent_decimal_tp').val());
  1114. const exponent_qty = parseInt($('#exponent_decimal_qty').val());
  1115. let flag = false;
  1116. if(_.isNaN(up) || up > 6 || up < 0) {
  1117. toastr.error('信息价单价小数位数设置不能大于6或小于0');
  1118. flag = true;
  1119. }
  1120. if(_.isNaN(tp) || tp > 6 || tp < 0) {
  1121. toastr.error('信息价金额小数位数设置不能大于6或小于0');
  1122. flag = true;
  1123. }
  1124. if(_.isNaN(qty) || qty > 6 || qty < 0) {
  1125. toastr.error('信息价数量小数位数设置不能大于6或小于0');
  1126. flag = true;
  1127. }
  1128. if(_.isNaN(exponent_up) || exponent_up > 6 || exponent_up < 0) {
  1129. toastr.error('指数法单价小数位数设置不能大于6或小于0');
  1130. flag = true;
  1131. }
  1132. if(_.isNaN(exponent_tp) || exponent_tp > 6 || exponent_tp < 0) {
  1133. toastr.error('指数法金额小数位数设置不能大于6或小于0');
  1134. flag = true;
  1135. }
  1136. if(_.isNaN(exponent_qty) || exponent_qty > 6 || exponent_qty < 0) {
  1137. toastr.error('指数法计算值小数位数设置不能大于6或小于0');
  1138. flag = true;
  1139. }
  1140. if (flag) {
  1141. return false;
  1142. }
  1143. }
  1144. // 重新审批按钮
  1145. $("#re-shenpi-btn").click(function () {
  1146. const data = {
  1147. };
  1148. <% if (ctx.session.sessionUser.loginStatus === 0) { %>
  1149. const code = $("#sp-down-back input[name='code']").val();
  1150. if ($(this).hasClass('disabled')) {
  1151. return false;
  1152. }
  1153. if (code.length < 6) {
  1154. // alert('请填写正确的验证码');
  1155. toastr.error('请填写正确的验证码');
  1156. return false;
  1157. }
  1158. data.code = code;
  1159. <% } %>
  1160. $.ajax({
  1161. url: '<%- preUrl %>/audit/check/again',
  1162. type: 'get',
  1163. data: data,
  1164. dataTye: 'json',
  1165. success: function (response) {
  1166. if (response.err === 0) {
  1167. window.location.href = response.url;
  1168. } else {
  1169. toastr.error(response.msg);
  1170. }
  1171. }
  1172. });
  1173. });
  1174. </script>
  1175. <% if (ctx.material.needStageExponent) { %>
  1176. <div class="modal fade" id="exponent-stage-edit" data-backdrop="static">
  1177. <div class="modal-dialog " role="document" >
  1178. <div class="modal-content">
  1179. <div class="modal-header">
  1180. <h5 class="modal-title">指数法调差独立期数据更新</h5>
  1181. </div>
  1182. <div class="modal-body">
  1183. <% if (ctx.material.is_stage_self) { %>
  1184. <% for (const ms of materialStageData) { %>
  1185. <div id="exponent-list-detail-<%- ms.sid %>" style="display: none" class="mb-3">
  1186. <h5>生成期指数工料:<b>第<%- ms.order %>期</b></h5>
  1187. <div class="progress">
  1188. <div id="exponent-list-progress-<%- ms.sid %>" class="progress-bar" role="progressbar" style="width: 0%;" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100">0%</div>
  1189. </div>
  1190. </div>
  1191. <% } %>
  1192. <% } %>
  1193. <div id="exponent-detail" style="display: none">
  1194. <h5>计算指数期金额和总金额:</h5>
  1195. <div class="progress">
  1196. <div id="exponent-progress" class="progress-bar" role="progressbar" style="width: 0%;" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100">0%</div>
  1197. </div>
  1198. </div>
  1199. </div>
  1200. <div class="modal-footer" style="display: none" id="reload-make2">
  1201. <button type="button" class="btn btn-sm btn-primary" onclick="window.location.reload();">刷新页面</button>
  1202. </div>
  1203. </div>
  1204. </div>
  1205. </div>
  1206. <script>
  1207. $(function () {
  1208. const stage_ids2 = JSON.parse(unescape('<%- escape(JSON.stringify(ctx.material.stage_id)) %>'));
  1209. const stage_id2 = stage_ids2.split(',');
  1210. (async () => {
  1211. $('#exponent-stage-edit').modal('show');
  1212. console.log('hello');
  1213. let value2 = 0;
  1214. let interval2;
  1215. let stop2 = false;
  1216. for (const newSid of stage_id2) {
  1217. const sid = parseInt(newSid);
  1218. $('#exponent-list-detail-' + sid).show();
  1219. resetProgress2($('#exponent-list-progress-' + sid));
  1220. if (!interval2) {
  1221. $('#exponent-list-detail-' + sid).show();
  1222. setProgress2($('#exponent-list-progress-' + sid), 30);
  1223. }
  1224. const msg = await postExponentData(sid, $('#exponent-list-progress-' + sid));
  1225. if (!msg) return;
  1226. }
  1227. $('#exponent-detail').show();
  1228. setProgress2($('#exponent-progress'), 30);
  1229. postData('/tender/' + cur_tenderid + '/measure/material/save/data', { type: 'make_exponent_tp', mid: materialID || mid }, function (result) {
  1230. stopProgress2($('#exponent-progress'));
  1231. $('#reload-make2').show();
  1232. }, function (err) {
  1233. stop2 = true;
  1234. clearInterval(interval2);
  1235. $('#reload-make2').show();
  1236. });
  1237. async function postExponentData(stage_id, _progress) {
  1238. try {
  1239. const result = await postDataAsync('/tender/' + cur_tenderid + '/measure/material/save/data', { type: 'make_stage_exponent', mid: materialID || mid, stage_id });
  1240. if (!result) {
  1241. stop2 = true;
  1242. clearInterval(interval2);
  1243. $('#reload-make2').show();
  1244. } else {
  1245. stopProgress2(_progress);
  1246. }
  1247. return result ? result : false;
  1248. } catch (err) {
  1249. console.error('失败:', err);
  1250. stop2 = true;
  1251. clearInterval(interval2);
  1252. $('#reload-make2').show();
  1253. return false;
  1254. }
  1255. }
  1256. function setProgress2(_this, time = 50) {
  1257. interval2 = setInterval(function () {
  1258. if (value2 < 100) {
  1259. value2 = parseInt(value2) + 1;
  1260. _this.css("width", value2 + "%").text(value2 + "%");
  1261. } else if (value2 === 100) {
  1262. value2 = parseInt(value2) + 1;
  1263. value2 = 30;
  1264. }
  1265. }, time);
  1266. }
  1267. function resetProgress2(_this) {
  1268. _this.removeClass('bg-success');
  1269. _this.css("width", "0%").text("0%").attr('aria-valuenow', '0');
  1270. }
  1271. function stopProgress2(_this) {
  1272. if (interval2) {
  1273. _this.addClass('bg-success');
  1274. _this.css("width", "100%").text("100%");
  1275. value2 = 0;
  1276. stop2 = true;
  1277. clearInterval(interval2);
  1278. interval2 = 0;
  1279. }
  1280. }
  1281. })();
  1282. });
  1283. </script>
  1284. <% } %>
  1285. <% if (ctx.session.sessionUser.accountId === ctx.material.user_id && (ctx.material.calc_stage !== ctx.material.stage_id || !ctx.material.calc_tp || ctx.material.needUpdateExponent)) { %>
  1286. <div class="modal fade" id="okedit" data-backdrop="static">
  1287. <div class="modal-dialog " role="document" >
  1288. <div class="modal-content">
  1289. <div class="modal-header">
  1290. <%
  1291. const showTC = (ctx.material.calc_stage !== ctx.material.stage_id || !ctx.material.calc_tp);
  1292. const showZS = ctx.material.needUpdateExponent;
  1293. let make_title = '';
  1294. if (showTC) make_title += '调差清单';
  1295. if (showTC && showZS) make_title += '和';
  1296. if (showZS) make_title += '指数数据';
  1297. %>
  1298. <h5 class="modal-title">生成新一期<%- make_title %></h5>
  1299. </div>
  1300. <div class="modal-body">
  1301. <% if (ctx.material.calc_stage !== ctx.material.stage_id || !ctx.material.calc_tp) { %>
  1302. <div>
  1303. <h5 id="material-detail">正在获取上期调差清单数据中,请等待...</h5>
  1304. <div class="progress">
  1305. <div id="material-progress" class="progress-bar" role="progressbar" style="width: 100%;" aria-valuenow="50" aria-valuemin="0" aria-valuemax="100">100%</div>
  1306. </div>
  1307. </div>
  1308. <% if (ctx.material.is_stage_self) { %>
  1309. <% for (const ms of materialStageData) { %>
  1310. <div id="list-detail-<%- ms.sid %>" style="display: none" class="mt-3">
  1311. <h5>生成期信息价调差清单:<b>第<%- ms.order %>期</b></h5>
  1312. <div class="progress">
  1313. <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>
  1314. </div>
  1315. </div>
  1316. <% } %>
  1317. <% } else { %>
  1318. <div id="list-detail" style="display: none" class="mt-3">
  1319. <h5>生成信息价调差清单:</h5>
  1320. <div class="progress">
  1321. <div id="list-progress" class="progress-bar" role="progressbar" style="width: 0%;" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100">0%</div>
  1322. </div>
  1323. </div>
  1324. <% } %>
  1325. <div id="self-detail" style="display: none" class="mt-3">
  1326. <h5>处理独立信息价调差清单和计算信息价调差金额:</h5>
  1327. <div class="progress">
  1328. <div id="self-progress" class="progress-bar" role="progressbar" style="width: 0%;" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100">0%</div>
  1329. </div>
  1330. </div>
  1331. <% } %>
  1332. <% if (ctx.material.needUpdateExponent) { %>
  1333. <div id="material-exponent-detail" style="display: none" class="mt-3">
  1334. <h5>指数法调差正在获取所选期台账数据中,请等待...</h5>
  1335. <div class="progress">
  1336. <div id="material-exponent-progress" class="progress-bar" role="progressbar" style="width: 100%;" aria-valuenow="50" aria-valuemin="0" aria-valuemax="100">100%</div>
  1337. </div>
  1338. </div>
  1339. <div id="list-exponent-detail" style="display: none" class="mt-3">
  1340. <h5>生成指数调差分项数据并计算金额:</h5>
  1341. <div class="progress">
  1342. <div id="list-exponent-progress" class="progress-bar" role="progressbar" style="width: 0%;" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100">0%</div>
  1343. </div>
  1344. </div>
  1345. <% } %>
  1346. </div>
  1347. <div class="modal-footer" style="display: none" id="reload-make">
  1348. <button type="button" class="btn btn-sm btn-primary" onclick="window.location.reload();">刷新页面</button>
  1349. </div>
  1350. </div>
  1351. </div>
  1352. </div>
  1353. <script>
  1354. $(function () {
  1355. const stage_ids = JSON.parse(unescape('<%- escape(JSON.stringify(ctx.material.stage_id)) %>'));
  1356. const calc_stages = JSON.parse(unescape('<%- escape(JSON.stringify(ctx.material.calc_stage)) %>'));
  1357. const needUpdateExponent = <%- ctx.material.needUpdateExponent %>;
  1358. const stage_id = stage_ids.split(',');
  1359. const calc_stage = calc_stages.split(',');
  1360. const calc_tp = parseInt('<%- ctx.material.calc_tp %>');
  1361. // stage_id和calc_stage数组对比,找出不同的值,并发起更新
  1362. const diff_stage_ids = _.difference(stage_id, calc_stage);
  1363. if (diff_stage_ids.length === 0 && calc_tp && !needUpdateExponent) return;
  1364. const is_stage_self = parseInt('<%- ctx.material.is_stage_self %>');
  1365. $('#okedit').modal('show');
  1366. let value = 0;
  1367. let interval;
  1368. let stop = false;
  1369. if (diff_stage_ids.length !== 0 || !calc_tp) {
  1370. setProgress($('#material-progress'), 30);
  1371. postData('/tender/'+ cur_tenderid +'/measure/material/gcl/load', { stage_id, is_stage_self }, async function (result) {
  1372. // console.log(result);
  1373. const ledger = result.ledger;
  1374. const pos = result.pos;
  1375. const gclList = result.gclList;
  1376. const selfList = result.selfList;
  1377. // 整理material,针对上期是独立单价并多个不同值的单独设置值进行部分值去除
  1378. const materialListForSelf = _.uniqWith(_.orderBy(result.materialListForSelf, ['ms_id'], ['desc']), function(item1, item2) {
  1379. 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;
  1380. });
  1381. const insertSelfList = [];// 需要单独添加的明细清单工料含量列表
  1382. const hadQtySelfList = [];
  1383. $('#material-detail').text('获取上期调差清单数据成功');
  1384. stopProgress($('#material-progress'));
  1385. if (is_stage_self) {
  1386. for (const [i, newSid] of diff_stage_ids.entries()) {
  1387. const sid = parseInt(newSid);
  1388. $('#list-detail-' + sid).show();
  1389. resetProgress($('#list-progress-' + sid));
  1390. if (!interval) {
  1391. $('#list-detail-' + sid).show();
  1392. setProgress($('#list-progress-' + sid), 30);
  1393. }
  1394. const insertGclList = [];
  1395. const insertList = [];
  1396. const removeGclList = [];
  1397. const curLedger = _.find(result.curLedgerData, {sid: newSid});
  1398. const curPos = _.find(result.curPosData, {sid: newSid});
  1399. gclGatherModel.loadLedgerData(_.cloneDeep(ledger), curLedger.ledgerData);
  1400. gclGatherModel.loadPosData(_.cloneDeep(pos), curPos.posData);
  1401. const gclGatherData = gclGatherModel.gatherGclData();
  1402. // console.log(gclGatherData);
  1403. const insertGcl = [];
  1404. for (const g of gclList) {
  1405. const gcl = _.find(gclGatherData, function (item) {
  1406. return item.leafXmjs && item.leafXmjs.length > 0 && _.findIndex(item.leafXmjs, {gcl_id: g.gcl_id}) !== -1;
  1407. });
  1408. if (gcl) {
  1409. const ig = _.find(insertGcl, {gcl});
  1410. if (ig) {
  1411. if (_.findIndex(ig.bills, {mb_id: g.mb_id}) === -1) {
  1412. ig.bills.push(g);
  1413. }
  1414. } else {
  1415. insertGcl.push({
  1416. bills: [g],
  1417. gcl,
  1418. leafXmjs: _.filter(gcl.leafXmjs, function (item) {
  1419. return item.gather_qty !== undefined && item.gather_qty !== null
  1420. }),
  1421. })
  1422. }
  1423. } else {
  1424. removeGclList.push(g);
  1425. }
  1426. }
  1427. for (const one of insertGcl) {
  1428. if (one.leafXmjs && one.leafXmjs.length > 0) {
  1429. for (const xmj of one.leafXmjs) {
  1430. const is_self = _.findIndex(selfList, { gcl_id: xmj.gcl_id, xmj_id: xmj.id, mx_id: xmj.mx_id ? xmj.mx_id : '' }) !== -1;// 区分单独计量的明细工料含量
  1431. if (is_self) {
  1432. const billsList = _.filter(materialListForSelf, { gcl_id: xmj.gcl_id, xmj_id: xmj.id, mx_id: xmj.mx_id ? xmj.mx_id : '' });
  1433. for (const bill of billsList) {
  1434. if (!_.find(hadQtySelfList, bill)) {
  1435. hadQtySelfList.push(bill);
  1436. }
  1437. insertSelfList.push({
  1438. gcl_id: xmj.gcl_id,
  1439. mx_id: xmj.mx_id ? xmj.mx_id : '',
  1440. xmj_id: xmj.id ? xmj.id : null,
  1441. contract_qty: xmj.contract_qty,
  1442. qc_qty: xmj.qc_qty,
  1443. qc_minus_qty: xmj.qc_minus_qty,
  1444. gather_qty: xmj.gather_qty,
  1445. quantity: bill.quantity,
  1446. expr: bill.expr,
  1447. mb_id: bill.mb_id,
  1448. order: bill.order,
  1449. sid,
  1450. });
  1451. }
  1452. } else {
  1453. const newgcl = _.find(gclList, { gcl_id: xmj.gcl_id });
  1454. for (const bill of one.bills) {
  1455. insertList.push({
  1456. gcl_id: xmj.gcl_id,
  1457. mx_id: xmj.mx_id ? xmj.mx_id : '',
  1458. xmj_id: xmj.id ? xmj.id : null,
  1459. contract_qty: xmj.contract_qty,
  1460. qc_qty: xmj.qc_qty,
  1461. qc_minus_qty: xmj.qc_minus_qty,
  1462. gather_qty: xmj.gather_qty,
  1463. quantity: bill.quantity,
  1464. expr: bill.expr,
  1465. mb_id: bill.mb_id,
  1466. order: bill.order,
  1467. sid,
  1468. });
  1469. if (!newgcl) {
  1470. if (_.findIndex(insertGclList, { gcl_id: xmj.gcl_id }) === -1) {
  1471. insertGclList.push({
  1472. gcl_id: xmj.gcl_id,
  1473. quantity: bill.quantity,
  1474. expr: bill.expr,
  1475. old_quantity: bill.quantity,
  1476. old_expr: bill.expr,
  1477. mb_id: bill.mb_id,
  1478. order: bill.order,
  1479. });
  1480. }
  1481. }
  1482. }
  1483. }
  1484. }
  1485. }
  1486. }
  1487. console.log(sid, insertList, insertGclList, removeGclList);
  1488. const msg = await postMLData(sid, insertList, insertGclList, removeGclList, $('#list-progress-' + sid));
  1489. if (!msg) return;
  1490. }
  1491. } else {
  1492. $('#list-detail').show();
  1493. resetProgress($('#list-progress'));
  1494. if (!interval) {
  1495. $('#list-detail').show();
  1496. setProgress($('#list-progress'), 30);
  1497. }
  1498. const insertGclList = [];
  1499. const insertList = [];
  1500. const removeGclList = [];
  1501. const curLedgerData = result.curLedgerData;
  1502. const curPosData = result.curPosData;
  1503. gclGatherModel.loadLedgerData(_.cloneDeep(ledger), curLedgerData);
  1504. gclGatherModel.loadPosData(_.cloneDeep(pos), curPosData);
  1505. const gclGatherData = gclGatherModel.gatherGclData();
  1506. const insertGcl = [];
  1507. for (const g of gclList) {
  1508. const gcl = _.find(gclGatherData, function (item) {
  1509. return item.leafXmjs && item.leafXmjs.length > 0 && _.findIndex(item.leafXmjs, {gcl_id: g.gcl_id}) !== -1;
  1510. });
  1511. if (gcl) {
  1512. const ig = _.find(insertGcl, {gcl});
  1513. if (ig) {
  1514. if (_.findIndex(ig.bills, {mb_id: g.mb_id}) === -1) {
  1515. ig.bills.push(g);
  1516. }
  1517. } else {
  1518. insertGcl.push({
  1519. bills: [g],
  1520. gcl,
  1521. leafXmjs: _.filter(gcl.leafXmjs, function (item) {
  1522. return item.gather_qty !== undefined && item.gather_qty !== null || (item.qc_minus_qty !== undefined && item.qc_minus_qty !== null)
  1523. }),
  1524. })
  1525. }
  1526. } else {
  1527. removeGclList.push(g);
  1528. }
  1529. }
  1530. for (const one of insertGcl) {
  1531. if (one.leafXmjs && one.leafXmjs.length > 0) {
  1532. for (const xmj of one.leafXmjs) {
  1533. const is_self = _.findIndex(selfList, { gcl_id: xmj.gcl_id, xmj_id: xmj.id, mx_id: xmj.mx_id ? xmj.mx_id : null }) !== -1;// 区分单独计量的明细工料含量
  1534. if (is_self) {
  1535. const billsList = _.filter(materialListForSelf, { gcl_id: xmj.gcl_id, xmj_id: xmj.id, mx_id: xmj.mx_id ? xmj.mx_id : null });
  1536. for (const bill of billsList) {
  1537. hadQtySelfList.push(bill);
  1538. insertSelfList.push({
  1539. gcl_id: xmj.gcl_id,
  1540. mx_id: xmj.mx_id ? xmj.mx_id : '',
  1541. xmj_id: xmj.id ? xmj.id : null,
  1542. contract_qty: xmj.contract_qty,
  1543. qc_qty: xmj.qc_qty,
  1544. qc_minus_qty: xmj.qc_minus_qty,
  1545. gather_qty: xmj.gather_qty,
  1546. quantity: bill.quantity,
  1547. expr: bill.expr,
  1548. mb_id: bill.mb_id,
  1549. order: bill.order,
  1550. });
  1551. }
  1552. } else {
  1553. const newgcl = _.find(gclList, { gcl_id: xmj.gcl_id });
  1554. for (const bill of one.bills) {
  1555. insertList.push({
  1556. gcl_id: xmj.gcl_id,
  1557. mx_id: xmj.mx_id ? xmj.mx_id : '',
  1558. xmj_id: xmj.id ? xmj.id : null,
  1559. contract_qty: xmj.contract_qty,
  1560. qc_qty: xmj.qc_qty,
  1561. qc_minus_qty: xmj.qc_minus_qty,
  1562. gather_qty: xmj.gather_qty,
  1563. quantity: bill.quantity,
  1564. expr: bill.expr,
  1565. mb_id: bill.mb_id,
  1566. order: bill.order,
  1567. });
  1568. if (!newgcl) {
  1569. insertGclList.push({
  1570. gcl_id: xmj.gcl_id,
  1571. quantity: bill.quantity,
  1572. expr: bill.expr,
  1573. old_quantity: bill.quantity,
  1574. old_expr: bill.expr,
  1575. mb_id: bill.mb_id,
  1576. order: bill.order,
  1577. });
  1578. }
  1579. }
  1580. }
  1581. }
  1582. }
  1583. }
  1584. console.log(diff_stage_ids, insertList, insertGclList, removeGclList);
  1585. const msg = await postMLData(diff_stage_ids.join(','), insertList, insertGclList, removeGclList, $('#list-progress'));
  1586. if (!msg) return;
  1587. }
  1588. $('#self-detail').show();
  1589. setProgress($('#self-progress'), 30);
  1590. // 通过比较materialListForSelf和hadQtySelfList不重合部分,得出本期为null的gather_qty列表,插入到insertSelfList中
  1591. const pushSelfList = _.xorWith(materialListForSelf, hadQtySelfList, _.isEqual);
  1592. if (pushSelfList.length > 0) {
  1593. for (const ps of pushSelfList) {
  1594. insertSelfList.push({
  1595. gcl_id: ps.gcl_id,
  1596. mx_id: ps.mx_id,
  1597. xmj_id: ps.xmj_id,
  1598. contract_qty: null,
  1599. qc_qty: null,
  1600. qc_minus_qty: null,
  1601. gather_qty: null,
  1602. quantity: ps.quantity,
  1603. expr: ps.expr,
  1604. mb_id: ps.mb_id,
  1605. order: ps.order,
  1606. });
  1607. }
  1608. }
  1609. console.log(insertSelfList);
  1610. postData('/tender/' + cur_tenderid + '/measure/material/save/data', { type: 'make_self_list', mid: materialID || mid, material_self_list: insertSelfList }, function (result) {
  1611. stopProgress($('#self-progress'));
  1612. if (needUpdateExponent) {
  1613. setExponentData();
  1614. } else {
  1615. $('#reload-make').show();
  1616. }
  1617. }, function (err) {
  1618. stop = true;
  1619. clearInterval(interval);
  1620. $('#reload-make').show();
  1621. });
  1622. return;
  1623. });
  1624. } else if (needUpdateExponent) {
  1625. setExponentData();
  1626. }
  1627. function setExponentData() {
  1628. $('#material-exponent-detail').show();
  1629. setProgress($('#material-exponent-progress'), 30);
  1630. postData('/tender/' + cur_tenderid + '/measure/material/' + cur_materialOrder + '/exponent/save', {type: 'load', filter: 'ledger;stage;nodes;pre_nodes'}, function (result) {
  1631. const gsTreeSetting = {
  1632. id: 'ledger_id',
  1633. pid: 'ledger_pid',
  1634. order: 'order',
  1635. level: 'level',
  1636. rootId: -1,
  1637. keys: ['id', 'tender_id', 'ledger_id'],
  1638. stageId: 'id',
  1639. };
  1640. gsTreeSetting.updateFields = ['contract_qty', 'contract_tp', 'qc_qty', 'qc_tp', 'qc_minus_qty'];
  1641. gsTreeSetting.calcFields = ['deal_tp', 'total_price', 'contract_tp', 'qc_tp', 'gather_tp', 'contract_pc_tp', 'qc_pc_tp', 'pc_tp'];
  1642. if (is_stage_self) {
  1643. for (const ms of result.materialStageData) {
  1644. gsTreeSetting.updateFields.push(ms.sid + '_contract_qty', ms.sid + '_contract_tp',
  1645. ms.sid + '_qc_qty', ms.sid + '_qc_tp', ms.sid + '_qc_minus_qty');
  1646. gsTreeSetting.calcFields.push(ms.sid + '_deal_tp', ms.sid + '_total_price', ms.sid + '_contract_tp',
  1647. ms.sid + '_qc_tp', ms.sid + '_gather_tp',
  1648. ms.sid + '_contract_pc_tp', ms.sid + '_qc_pc_tp', ms.sid + '_pc_tp');
  1649. }
  1650. }
  1651. // else {
  1652. // gsTreeSetting.updateFields.push(material_sids + '_contract_qty', material_sids + '_contract_tp',
  1653. // material_sids + '_qc_qty', material_sids + '_qc_tp', material_sids + '_qc_minus_qty');
  1654. // gsTreeSetting.calcFields.push(material_sids + '_deal_tp', material_sids + '_total_price', material_sids + '_contract_tp',
  1655. // material_sids + '_qc_tp', material_sids + '_gather_tp',
  1656. // material_sids + '_contract_pc_tp', material_sids + '_qc_pc_tp', material_sids + '_pc_tp');
  1657. // }
  1658. gsTreeSetting.calcFun = function (node) {
  1659. if (node.children && node.children.length === 0) {
  1660. node.gather_qty = ZhCalc.add(node.contract_qty, node.qc_qty);
  1661. if (is_stage_self) {
  1662. for (const ms of result.materialStageData) {
  1663. node[ms.sid + '_gather_qty'] = ZhCalc.add(node[ms.sid + '_contract_qty'], node[ms.sid + '_qc_qty']);
  1664. }
  1665. }
  1666. }
  1667. node.gather_tp = ZhCalc.sum([node.contract_tp, node.qc_tp, node.pc_tp]);
  1668. if (is_stage_self) {
  1669. for (const ms of result.materialStageData) {
  1670. node[ms.sid + '_gather_tp'] = ZhCalc.sum([node[ms.sid + '_contract_tp'], node[ms.sid + '_qc_tp'], node[ms.sid + '_pc_tp']]);
  1671. }
  1672. }
  1673. };
  1674. const gsTree = createNewPathTree('stage', gsTreeSetting);
  1675. gsTree.loadDatas(result.ledgerData);
  1676. treeCalc.calculateAll(gsTree);
  1677. const gatherNodes = result.exponent_nodes ? _.map(result.exponent_nodes.split(',')) : [];
  1678. const nodes = [];
  1679. for (const node of gsTree.nodes) {
  1680. if (gatherNodes.indexOf(node.id + '') !== -1) {
  1681. nodes.push(node);
  1682. }
  1683. }
  1684. console.log(gsTree, nodes);
  1685. $('#material-exponent-detail h5').text('获取指数法调差所选期台账数据成功');
  1686. stopProgress($('#material-exponent-progress'));
  1687. $('#list-exponent-detail').show();
  1688. resetProgress($('#list-exponent-progress'));
  1689. if (!interval) {
  1690. $('#list-exponent-detail').show();
  1691. setProgress($('#list-exponent-progress'), 30);
  1692. }
  1693. const nodeData = [];
  1694. const tpData = {};
  1695. if (is_stage_self) {
  1696. for (const ms of result.materialStageData) {
  1697. tpData[ms.sid + '_tp'] = {
  1698. contract_tp: 0,
  1699. qc_tp: 0,
  1700. gather_tp: 0,
  1701. };
  1702. }
  1703. } else {
  1704. tpData['all'] = {
  1705. contract_tp: 0,
  1706. qc_tp: 0,
  1707. gather_tp: 0,
  1708. };
  1709. }
  1710. for (const node of nodes) {
  1711. const preNodes = result.materialPreNodes.length > 0 ? _.filter(result.materialPreNodes, { node: node.id }) : null;
  1712. let ex_pre_tp = 0;
  1713. let ex_tax_pre_tp = 0;
  1714. if (preNodes && preNodes.length > 0) {
  1715. for (const pn of preNodes) {
  1716. ex_pre_tp = ZhCalc.add(ex_pre_tp, pn.ex_tp || 0);
  1717. ex_tax_pre_tp = ZhCalc.add(ex_tax_pre_tp, pn.ex_tax_tp || 0);
  1718. }
  1719. ex_pre_tp = ZhCalc.add(ex_pre_tp, preNodes[0].ex_pre_tp);
  1720. ex_tax_pre_tp = ZhCalc.add(ex_tax_pre_tp, preNodes[0].ex_tax_pre_tp);
  1721. }
  1722. if (is_stage_self) {
  1723. for (const ms of result.materialStageData) {
  1724. const key = ms.sid + '_tp';
  1725. tpData[key].contract_tp = ZhCalc.add(tpData[key].contract_tp, node[ms.sid + '_contract_tp'] || 0);
  1726. tpData[key].qc_tp = ZhCalc.add(tpData[key].qc_tp, node[ms.sid + '_qc_tp'] || 0);
  1727. tpData[key].gather_tp = ZhCalc.add(tpData[key].gather_tp, node[ms.sid + '_gather_tp'] || 0);
  1728. nodeData.push({
  1729. code: node.code || node.b_code,
  1730. node: node.id,
  1731. name: node.name,
  1732. ms_id: ms.id,
  1733. contract_tp: node[ms.sid + '_contract_tp'] || 0,
  1734. qc_tp: node[ms.sid + '_qc_tp'] || 0,
  1735. gather_tp: node[ms.sid + '_gather_tp'] || 0,
  1736. ex_calc: setExCalc(node[ms.sid + '_contract_tp'], node[ms.sid + '_qc_tp'], node[ms.sid + '_gather_tp']),
  1737. ex_pre_tp,
  1738. ex_tax_pre_tp,
  1739. });
  1740. }
  1741. } else {
  1742. const key = 'all';
  1743. tpData[key].contract_tp = ZhCalc.add(tpData[key].contract_tp, node.contract_tp || 0);
  1744. tpData[key].qc_tp = ZhCalc.add(tpData[key].qc_tp, node.qc_tp || 0);
  1745. tpData[key].gather_tp = ZhCalc.add(tpData[key].gather_tp, node.gather_tp || 0);
  1746. nodeData.push({
  1747. code: node.code || node.b_code,
  1748. node: node.id,
  1749. name: node.name,
  1750. ms_id: null,
  1751. contract_tp: node.contract_tp || 0,
  1752. qc_tp: node.qc_tp || 0,
  1753. gather_tp: node.gather_tp || 0,
  1754. ex_calc: setExCalc(node.contract_tp, node.qc_tp, node.gather_tp),
  1755. ex_pre_tp,
  1756. ex_tax_pre_tp,
  1757. });
  1758. }
  1759. }
  1760. // 标段(不含新增分项)调差基数数据更新或新增
  1761. const baseNodes = [];
  1762. // 总金额 - tpData 里金额就是不含新增分项金额,先获取总金额
  1763. const totalTp = {};
  1764. for (const node of gsTree.children) {
  1765. if (is_stage_self) {
  1766. for (const ms of result.materialStageData) {
  1767. const key = ms.sid + '_tp';
  1768. if (!totalTp[key]) {
  1769. totalTp[key] = {
  1770. contract_tp: 0,
  1771. qc_tp: 0,
  1772. gather_tp: 0,
  1773. };
  1774. }
  1775. totalTp[key].contract_tp = ZhCalc.add(totalTp[key].contract_tp, node[ms.sid + '_contract_tp'] || 0);
  1776. totalTp[key].qc_tp = ZhCalc.add(totalTp[key].qc_tp, node[ms.sid + '_qc_tp'] || 0);
  1777. totalTp[key].gather_tp = ZhCalc.add(totalTp[key].gather_tp, node[ms.sid + '_gather_tp'] || 0);
  1778. }
  1779. } else {
  1780. const key = 'all';
  1781. if (!totalTp[key]) {
  1782. totalTp[key] = {
  1783. contract_tp: 0,
  1784. qc_tp: 0,
  1785. gather_tp: 0,
  1786. };
  1787. }
  1788. totalTp[key].contract_tp = ZhCalc.add(totalTp[key].contract_tp, node.contract_tp || 0);
  1789. totalTp[key].qc_tp = ZhCalc.add(totalTp[key].qc_tp, node.qc_tp || 0);
  1790. totalTp[key].gather_tp = ZhCalc.add(totalTp[key].gather_tp, node.gather_tp || 0);
  1791. }
  1792. }
  1793. const preBaseNodes = result.materialPreNodes ? _.filter(result.materialPreNodes, { node: '-1' }) : null;
  1794. let ex_pre_tp = 0;
  1795. let ex_tax_pre_tp = 0;
  1796. if (preBaseNodes && preBaseNodes.length > 0) {
  1797. for (const pn of preBaseNodes) {
  1798. ex_pre_tp = ZhCalc.add(ex_pre_tp, pn.ex_tp || 0);
  1799. ex_tax_pre_tp = ZhCalc.add(ex_tax_pre_tp, pn.ex_tax_tp || 0);
  1800. }
  1801. ex_pre_tp = ZhCalc.add(ex_pre_tp, preBaseNodes[0].ex_pre_tp);
  1802. ex_tax_pre_tp = ZhCalc.add(ex_tax_pre_tp, preBaseNodes[0].ex_tax_pre_tp);
  1803. }
  1804. if (is_stage_self) {
  1805. for (const ms of result.materialStageData) {
  1806. const node_tp = tpData[ms.sid + '_tp'];
  1807. const total_tp = totalTp[ms.sid + '_tp'];
  1808. const contract_tp = ZhCalc.sub(total_tp.contract_tp, node_tp.contract_tp);
  1809. const qc_tp = ZhCalc.sub(total_tp.qc_tp, node_tp.qc_tp);
  1810. const gather_tp = ZhCalc.sub(total_tp.gather_tp, node_tp.gather_tp);
  1811. baseNodes.push({
  1812. code: '不含新增分项',
  1813. name: '标段',
  1814. node: '-1',
  1815. ms_id: ms.id,
  1816. ex_calc: setExCalc(contract_tp, qc_tp, gather_tp),
  1817. contract_tp,
  1818. qc_tp,
  1819. gather_tp,
  1820. ex_pre_tp,
  1821. ex_tax_pre_tp,
  1822. });
  1823. }
  1824. } else {
  1825. const node_tp = tpData['all'];
  1826. const total_tp = totalTp['all'];
  1827. const contract_tp = ZhCalc.sub(total_tp.contract_tp, node_tp.contract_tp);
  1828. const qc_tp = ZhCalc.sub(total_tp.qc_tp, node_tp.qc_tp);
  1829. const gather_tp = ZhCalc.sub(total_tp.gather_tp, node_tp.gather_tp);
  1830. baseNodes.push({
  1831. code: '不含新增分项',
  1832. name: '标段',
  1833. node: '-1',
  1834. ms_id: null,
  1835. ex_calc: setExCalc(contract_tp, qc_tp, gather_tp),
  1836. contract_tp,
  1837. qc_tp,
  1838. gather_tp,
  1839. ex_pre_tp,
  1840. ex_tax_pre_tp,
  1841. });
  1842. }
  1843. console.log(baseNodes, nodeData);
  1844. postData('/tender/' + cur_tenderid + '/measure/material/' + cur_materialOrder + '/exponent/save', { type:'update_node', updateData: { baseNodes, addNodes: nodeData, delNodes: [], exponent_node: _.map(nodes, 'id') } }, function (result) {
  1845. stopProgress($('#list-exponent-progress'));
  1846. $('#reload-make').show();
  1847. }, function (err) {
  1848. stop = true;
  1849. clearInterval(interval);
  1850. $('#reload-make').show();
  1851. });
  1852. });
  1853. }
  1854. function setExCalc(contract_tp, qc_tp, gather_tp) {
  1855. const insert_ex_calc = [
  1856. {
  1857. code: 'bqht',
  1858. text: '所选期合同计量金额',
  1859. value: contract_tp || 0,
  1860. select: false,
  1861. },
  1862. {
  1863. code: 'bqbg',
  1864. text: '所选期变更计量金额',
  1865. value: qc_tp || 0,
  1866. select: false,
  1867. },
  1868. {
  1869. code: 'bqwc',
  1870. text: '所选期完成计量金额',
  1871. value: gather_tp || 0,
  1872. select: true,
  1873. },
  1874. {
  1875. code: 'zdy',
  1876. text: '自定义金额',
  1877. value: gather_tp || 0,
  1878. result: '',
  1879. select: false,
  1880. },
  1881. ];
  1882. return insert_ex_calc;
  1883. }
  1884. async function postMLData(stage_id, material_list, insertGclList, removeGclList, _progress) {
  1885. try {
  1886. const result = await postDataAsync('/tender/' + cur_tenderid + '/measure/material/save/data', { type: 'make_material_list', mid: materialID || mid, stage_id, material_list, insertGclList, removeGclList });
  1887. if (!result) {
  1888. stop = true;
  1889. clearInterval(interval);
  1890. $('#reload-make').show();
  1891. } else {
  1892. stopProgress(_progress);
  1893. }
  1894. return result ? result : false;
  1895. } catch (err) {
  1896. console.error('失败:', err);
  1897. stop = true;
  1898. clearInterval(interval);
  1899. $('#reload-make').show();
  1900. return false;
  1901. }
  1902. }
  1903. function setProgress(_this, time = 50) {
  1904. interval = setInterval(function () {
  1905. if (value < 100) {
  1906. value = parseInt(value) + 1;
  1907. _this.css("width", value + "%").text(value + "%");
  1908. } else if (value === 100) {
  1909. value = parseInt(value) + 1;
  1910. value = 30;
  1911. }
  1912. }, time);
  1913. }
  1914. function resetProgress(_this) {
  1915. _this.removeClass('bg-success');
  1916. _this.css("width", "0%").text("0%").attr('aria-valuenow', '0');
  1917. }
  1918. function stopProgress(_this) {
  1919. if (interval) {
  1920. _this.addClass('bg-success');
  1921. _this.css("width", "100%").text("100%");
  1922. value = 0;
  1923. stop = true;
  1924. clearInterval(interval);
  1925. interval = 0;
  1926. }
  1927. }
  1928. })
  1929. </script>
  1930. <% } %>