audit_modal.ejs 107 KB

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