audit_modal.ejs 136 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956
  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. let removeNodes = [];
  1685. if (nodes.length !== gatherNodes.length) {
  1686. // 移除节点统计
  1687. removeNodes = _.difference(gatherNodes, _.map(nodes, function (node) { return node.id + ''; }));
  1688. }
  1689. console.log(gsTree, nodes, removeNodes);
  1690. $('#material-exponent-detail h5').text('获取指数法调差所选期台账数据成功');
  1691. stopProgress($('#material-exponent-progress'));
  1692. $('#list-exponent-detail').show();
  1693. resetProgress($('#list-exponent-progress'));
  1694. if (!interval) {
  1695. $('#list-exponent-detail').show();
  1696. setProgress($('#list-exponent-progress'), 30);
  1697. }
  1698. const nodeData = [];
  1699. const tpData = {};
  1700. if (is_stage_self) {
  1701. for (const ms of result.materialStageData) {
  1702. tpData[ms.sid + '_tp'] = {
  1703. contract_tp: 0,
  1704. qc_tp: 0,
  1705. gather_tp: 0,
  1706. };
  1707. }
  1708. } else {
  1709. tpData['all'] = {
  1710. contract_tp: 0,
  1711. qc_tp: 0,
  1712. gather_tp: 0,
  1713. };
  1714. }
  1715. for (const node of nodes) {
  1716. const preNodes = result.materialPreNodes.length > 0 ? _.filter(result.materialPreNodes, { node: node.id }) : null;
  1717. let ex_pre_tp = 0;
  1718. let ex_tax_pre_tp = 0;
  1719. if (preNodes && preNodes.length > 0) {
  1720. for (const pn of preNodes) {
  1721. ex_pre_tp = ZhCalc.add(ex_pre_tp, pn.ex_tp || 0);
  1722. ex_tax_pre_tp = ZhCalc.add(ex_tax_pre_tp, pn.ex_tax_tp || 0);
  1723. }
  1724. ex_pre_tp = ZhCalc.add(ex_pre_tp, preNodes[0].ex_pre_tp);
  1725. ex_tax_pre_tp = ZhCalc.add(ex_tax_pre_tp, preNodes[0].ex_tax_pre_tp);
  1726. }
  1727. if (is_stage_self) {
  1728. for (const ms of result.materialStageData) {
  1729. const key = ms.sid + '_tp';
  1730. tpData[key].contract_tp = ZhCalc.add(tpData[key].contract_tp, node[ms.sid + '_contract_tp'] || 0);
  1731. tpData[key].qc_tp = ZhCalc.add(tpData[key].qc_tp, node[ms.sid + '_qc_tp'] || 0);
  1732. tpData[key].gather_tp = ZhCalc.add(tpData[key].gather_tp, node[ms.sid + '_gather_tp'] || 0);
  1733. nodeData.push({
  1734. code: node.code || node.b_code,
  1735. node: node.id,
  1736. name: node.name,
  1737. ms_id: ms.id,
  1738. contract_tp: node[ms.sid + '_contract_tp'] || 0,
  1739. qc_tp: node[ms.sid + '_qc_tp'] || 0,
  1740. gather_tp: node[ms.sid + '_gather_tp'] || 0,
  1741. ex_calc: setExCalc(node[ms.sid + '_contract_tp'], node[ms.sid + '_qc_tp'], node[ms.sid + '_gather_tp']),
  1742. ex_pre_tp,
  1743. ex_tax_pre_tp,
  1744. });
  1745. }
  1746. } else {
  1747. const key = 'all';
  1748. tpData[key].contract_tp = ZhCalc.add(tpData[key].contract_tp, node.contract_tp || 0);
  1749. tpData[key].qc_tp = ZhCalc.add(tpData[key].qc_tp, node.qc_tp || 0);
  1750. tpData[key].gather_tp = ZhCalc.add(tpData[key].gather_tp, node.gather_tp || 0);
  1751. nodeData.push({
  1752. code: node.code || node.b_code,
  1753. node: node.id,
  1754. name: node.name,
  1755. ms_id: null,
  1756. contract_tp: node.contract_tp || 0,
  1757. qc_tp: node.qc_tp || 0,
  1758. gather_tp: node.gather_tp || 0,
  1759. ex_calc: setExCalc(node.contract_tp, node.qc_tp, node.gather_tp),
  1760. ex_pre_tp,
  1761. ex_tax_pre_tp,
  1762. });
  1763. }
  1764. }
  1765. // 标段(不含新增分项)调差基数数据更新或新增
  1766. const baseNodes = [];
  1767. // 总金额 - tpData 里金额就是不含新增分项金额,先获取总金额
  1768. const totalTp = {};
  1769. for (const node of gsTree.children) {
  1770. if (is_stage_self) {
  1771. for (const ms of result.materialStageData) {
  1772. const key = ms.sid + '_tp';
  1773. if (!totalTp[key]) {
  1774. totalTp[key] = {
  1775. contract_tp: 0,
  1776. qc_tp: 0,
  1777. gather_tp: 0,
  1778. };
  1779. }
  1780. totalTp[key].contract_tp = ZhCalc.add(totalTp[key].contract_tp, node[ms.sid + '_contract_tp'] || 0);
  1781. totalTp[key].qc_tp = ZhCalc.add(totalTp[key].qc_tp, node[ms.sid + '_qc_tp'] || 0);
  1782. totalTp[key].gather_tp = ZhCalc.add(totalTp[key].gather_tp, node[ms.sid + '_gather_tp'] || 0);
  1783. }
  1784. } else {
  1785. const key = 'all';
  1786. if (!totalTp[key]) {
  1787. totalTp[key] = {
  1788. contract_tp: 0,
  1789. qc_tp: 0,
  1790. gather_tp: 0,
  1791. };
  1792. }
  1793. totalTp[key].contract_tp = ZhCalc.add(totalTp[key].contract_tp, node.contract_tp || 0);
  1794. totalTp[key].qc_tp = ZhCalc.add(totalTp[key].qc_tp, node.qc_tp || 0);
  1795. totalTp[key].gather_tp = ZhCalc.add(totalTp[key].gather_tp, node.gather_tp || 0);
  1796. }
  1797. }
  1798. const preBaseNodes = result.materialPreNodes ? _.filter(result.materialPreNodes, { node: '-1' }) : null;
  1799. let ex_pre_tp = 0;
  1800. let ex_tax_pre_tp = 0;
  1801. if (preBaseNodes && preBaseNodes.length > 0) {
  1802. for (const pn of preBaseNodes) {
  1803. ex_pre_tp = ZhCalc.add(ex_pre_tp, pn.ex_tp || 0);
  1804. ex_tax_pre_tp = ZhCalc.add(ex_tax_pre_tp, pn.ex_tax_tp || 0);
  1805. }
  1806. ex_pre_tp = ZhCalc.add(ex_pre_tp, preBaseNodes[0].ex_pre_tp);
  1807. ex_tax_pre_tp = ZhCalc.add(ex_tax_pre_tp, preBaseNodes[0].ex_tax_pre_tp);
  1808. }
  1809. if (is_stage_self) {
  1810. for (const ms of result.materialStageData) {
  1811. const node_tp = tpData[ms.sid + '_tp'];
  1812. const total_tp = totalTp[ms.sid + '_tp'];
  1813. const contract_tp = ZhCalc.sub(total_tp.contract_tp, node_tp.contract_tp);
  1814. const qc_tp = ZhCalc.sub(total_tp.qc_tp, node_tp.qc_tp);
  1815. const gather_tp = ZhCalc.sub(total_tp.gather_tp, node_tp.gather_tp);
  1816. baseNodes.push({
  1817. code: '不含新增分项',
  1818. name: '标段',
  1819. node: '-1',
  1820. ms_id: ms.id,
  1821. ex_calc: setExCalc(contract_tp, qc_tp, gather_tp),
  1822. contract_tp,
  1823. qc_tp,
  1824. gather_tp,
  1825. ex_pre_tp,
  1826. ex_tax_pre_tp,
  1827. });
  1828. }
  1829. } else {
  1830. const node_tp = tpData['all'];
  1831. const total_tp = totalTp['all'];
  1832. const contract_tp = ZhCalc.sub(total_tp.contract_tp, node_tp.contract_tp);
  1833. const qc_tp = ZhCalc.sub(total_tp.qc_tp, node_tp.qc_tp);
  1834. const gather_tp = ZhCalc.sub(total_tp.gather_tp, node_tp.gather_tp);
  1835. baseNodes.push({
  1836. code: '不含新增分项',
  1837. name: '标段',
  1838. node: '-1',
  1839. ms_id: null,
  1840. ex_calc: setExCalc(contract_tp, qc_tp, gather_tp),
  1841. contract_tp,
  1842. qc_tp,
  1843. gather_tp,
  1844. ex_pre_tp,
  1845. ex_tax_pre_tp,
  1846. });
  1847. }
  1848. console.log(baseNodes, nodeData);
  1849. postData('/tender/' + cur_tenderid + '/measure/material/' + cur_materialOrder + '/exponent/save', { type:'update_node', updateData: { baseNodes, addNodes: nodeData, delNodes: [], exponent_node: _.map(nodes, 'id'), remove_node: removeNodes } }, function (result) {
  1850. stopProgress($('#list-exponent-progress'));
  1851. $('#reload-make').show();
  1852. }, function (err) {
  1853. stop = true;
  1854. clearInterval(interval);
  1855. $('#reload-make').show();
  1856. });
  1857. });
  1858. }
  1859. function setExCalc(contract_tp, qc_tp, gather_tp) {
  1860. const insert_ex_calc = [
  1861. {
  1862. code: 'bqht',
  1863. text: '所选期合同计量金额',
  1864. value: contract_tp || 0,
  1865. select: false,
  1866. },
  1867. {
  1868. code: 'bqbg',
  1869. text: '所选期变更计量金额',
  1870. value: qc_tp || 0,
  1871. select: false,
  1872. },
  1873. {
  1874. code: 'bqwc',
  1875. text: '所选期完成计量金额',
  1876. value: gather_tp || 0,
  1877. select: true,
  1878. },
  1879. {
  1880. code: 'zdy',
  1881. text: '自定义金额',
  1882. value: gather_tp || 0,
  1883. result: '',
  1884. select: false,
  1885. },
  1886. ];
  1887. return insert_ex_calc;
  1888. }
  1889. async function postMLData(stage_id, material_list, insertGclList, removeGclList, _progress) {
  1890. try {
  1891. const result = await postDataAsync('/tender/' + cur_tenderid + '/measure/material/save/data', { type: 'make_material_list', mid: materialID || mid, stage_id, material_list, insertGclList, removeGclList });
  1892. if (!result) {
  1893. stop = true;
  1894. clearInterval(interval);
  1895. $('#reload-make').show();
  1896. } else {
  1897. stopProgress(_progress);
  1898. }
  1899. return result ? result : false;
  1900. } catch (err) {
  1901. console.error('失败:', err);
  1902. stop = true;
  1903. clearInterval(interval);
  1904. $('#reload-make').show();
  1905. return false;
  1906. }
  1907. }
  1908. function setProgress(_this, time = 50) {
  1909. interval = setInterval(function () {
  1910. if (value < 100) {
  1911. value = parseInt(value) + 1;
  1912. _this.css("width", value + "%").text(value + "%");
  1913. } else if (value === 100) {
  1914. value = parseInt(value) + 1;
  1915. value = 30;
  1916. }
  1917. }, time);
  1918. }
  1919. function resetProgress(_this) {
  1920. _this.removeClass('bg-success');
  1921. _this.css("width", "0%").text("0%").attr('aria-valuenow', '0');
  1922. }
  1923. function stopProgress(_this) {
  1924. if (interval) {
  1925. _this.addClass('bg-success');
  1926. _this.css("width", "100%").text("100%");
  1927. value = 0;
  1928. stop = true;
  1929. clearInterval(interval);
  1930. interval = 0;
  1931. }
  1932. }
  1933. })
  1934. </script>
  1935. <% } %>