audit_modal.ejs 109 KB

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