audit_modal.ejs 110 KB

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