audit_modal.ejs 106 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449
  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" onsubmit="return auditCheck(0);">
  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"
  448. onsubmit="return auditCheck(1);">
  449. <div class="modal-header">
  450. <h5 class="modal-title">审批退回</h5>
  451. </div>
  452. <div class="modal-body">
  453. <div class="row">
  454. <div class="col-4">
  455. <% if(ctx.material.status !== auditConst.status.checked && ctx.session.sessionUser.is_admin) { %>
  456. <a class="sp-list-item" href="#sub-sp2" data-toggle="modal" data-target="#sub-sp2"
  457. id="hideSp">修改审批流程</a>
  458. <% } %>
  459. <div class="card modal-height-500 mt-3" style="overflow: auto">
  460. <ul class="list-group list-group-flush auditors-list">
  461. <% ctx.material.auditors2.forEach((item, idx) => { %>
  462. <% if (idx === 0) { %>
  463. <li class="list-group-item d-flex justify-content-between align-items-center">
  464. <span class="mr-1"><i class="fa fa fa-play-circle fa-rotate-90"></i></span>
  465. <span class="text-muted">
  466. <% for (const u of item) { %>
  467. <small class="d-inline-block text-dark mx-1" title="<%- u.role %>" data-auditorId="<%- u.aid %>"><%- u.name %></small>
  468. <% } %>
  469. </span>
  470. <span class="badge badge-light badge-pill ml-auto"><small>原报</small></span>
  471. </li>
  472. <% } else if(idx === ctx.material.auditors2.length -1 && idx !== 0) { %>
  473. <li class="list-group-item d-flex justify-content-between align-items-center">
  474. <span class="mr-1"><i class="fa fa fa-stop-circle"></i></span>
  475. <span class="text-muted">
  476. <% for (const u of item) { %>
  477. <small class="d-inline-block text-dark mx-1" title="<%- u.role %>" data-auditorId="<%- u.aid %>"><%- u.name %></small>
  478. <% } %>
  479. </span>
  480. <div class="d-flex ml-auto">
  481. <% if (item[0].audit_type !== auditType.key.common) { %>
  482. <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>
  483. <% } %>
  484. <span class="badge badge-light badge-pill"><small>终审</small></span>
  485. </div>
  486. </li>
  487. <% } else {%>
  488. <li class="list-group-item d-flex justify-content-between align-items-center">
  489. <span class="mr-1"><i class="fa fa-chevron-circle-down"></i></span>
  490. <span class="text-muted">
  491. <% for (const u of item) { %>
  492. <small class="d-inline-block text-dark mx-1" title="<%- u.role %>" data-auditorId="<%- u.aid %>"><%- u.name %></small>
  493. <% } %>
  494. </span>
  495. <div class="d-flex ml-auto">
  496. <% if (item[0].audit_type !== auditType.key.common) { %>
  497. <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>
  498. <% } %>
  499. <span class="badge badge-light badge-pill"><small><%= ctx.helper.transFormToChinese(idx) %>审</small></span>
  500. </div>
  501. </li>
  502. <% } %>
  503. <% }) %>
  504. </ul>
  505. </div>
  506. </div>
  507. <div class="col-8 modal-height-500" style="overflow: auto">
  508. <% ctx.material.auditHistory.forEach((his, idx) => { %>
  509. <!-- 展开/收起历史流程 -->
  510. <% if(idx === ctx.material.auditHistory.length - 1 && ctx.material.auditHistory.length !== 1) { %>
  511. <div class="text-right"><a href="javascript: void(0);" id="fold-btn" data-target="show"
  512. data-idx="<%- idx + 1 %>">展开历史审批流程</a></div>
  513. <% } %>
  514. <div class="<%- idx < ctx.material.auditHistory.length - 1 ? 'fold-card' : '' %>">
  515. <div class="text-center text-muted"><%- idx+1 %>#</div>
  516. <ul class="timeline-list list-unstyled mt-2 <% if (idx === ctx.material.auditHistory.length - 1) { %>last-auditor-list<% } %>">
  517. <% his.forEach((group, index) => { %>
  518. <% if (index === 0) { %>
  519. <li class="timeline-list-item pb-2">
  520. <div class="timeline-item-date">
  521. <%- group.beginYear %>
  522. <span><%- group.beginDate %></span>
  523. <span><%- group.beginTime %></span>
  524. </div>
  525. <div class="timeline-item-tail"></div>
  526. <div class="timeline-item-icon bg-success text-light"><i class="fa fa-caret-down"></i></div>
  527. <div class="timeline-item-content">
  528. <div class="py-1">
  529. <span class="text-black-50">原报</span>
  530. <span class="pull-right text-success"><%- idx !== 0 ? '重新' : '' %>上报审批</span>
  531. </div>
  532. <div class="card">
  533. <div class="card-body px-3 py-0">
  534. <div class="card-text p-2 py-3 row">
  535. <div class="col">
  536. <span class="h6"><%- ctx.material.user.name %></span>
  537. <span class="text-muted ml-1"><%- ctx.material.user.role %></span>
  538. </div>
  539. <div class="col">
  540. <span class="pull-right text-success"><i class="fa fa-check-circle"></i></span>
  541. </div>
  542. </div>
  543. </div>
  544. </div>
  545. </div>
  546. </li>
  547. <% } %>
  548. <li class="timeline-list-item pb-2 <% if (group.status === auditConst.status.uncheck && idx === ctx.material.auditHistory.length - 1) { %>is_uncheck<% } %>">
  549. <% if (his.endYear) { %>
  550. <div class="timeline-item-date">
  551. <%- group.endYear %>
  552. <span><%- group.endDate %></span>
  553. <span><%- group.endTime %></span>
  554. </div>
  555. <% } %>
  556. <% if (index < his.length - 1) { %>
  557. <div class="timeline-item-tail"></div>
  558. <% } %>
  559. <% if (group.status === auditConst.status.checked) { %>
  560. <div class="timeline-item-icon bg-success text-light"><i class="fa fa-check"></i></div>
  561. <% } else if (group.status === auditConst.status.checkNo || group.status === auditConst.status.checkNoPre || group.status === auditConst.status.checkCancel) { %>
  562. <div class="timeline-item-icon bg-warning text-light"><i class="fa fa-level-up"></i></div>
  563. <% } else if (group.status === auditConst.status.checking) { %>
  564. <div class="timeline-item-icon bg-warning text-light"><i class="fa fa-ellipsis-h"></i></div>
  565. <% } else { %>
  566. <div class="timeline-item-icon bg-secondary text-light"></div>
  567. <% } %>
  568. <div class="timeline-item-content">
  569. <div class="py-1">
  570. <span class="text-black-50">
  571. <%- (!group.is_final ? group.audit_order : '终') %>审
  572. <% if (group.audit_type !== auditType.key.common) { %><span class="text-<%- auditType.info[group.audit_type].class %> "><%- auditType.info[group.audit_type].long %></span><% } %>
  573. </span>
  574. <% if (group.status !== auditConst.status.uncheck) { %>
  575. <span class="pull-right <%- auditConst.statusClass[group.status] %>"><%- auditConst.statusString[group.status] %></span>
  576. <% } %>
  577. </div>
  578. <div class="card">
  579. <div class="card-body px-3 py-0">
  580. <% for (const [i, auditor] of group.auditors.entries()) { %>
  581. <div class="card-text p-2 py-3 row <%- ( i > 0 ? 'border-top' : '') %>">
  582. <div class="col">
  583. <span class="h6"><%- auditor.name %></span>
  584. <span class="text-muted ml-1"><%- auditor.role %></span>
  585. </div>
  586. <div class="col">
  587. <% if (auditor.status === auditConst.status.checked) { %>
  588. <span class="pull-right text-success"><i class="fa fa-check-circle"></i></span>
  589. <% } if (auditor.status === auditConst.status.checkNo || auditor.status === auditConst.status.checkNoPre || auditor.status === auditConst.status.checkCancel) { %>
  590. <span class="pull-right text-warning"><i class="fa fa-share-square fa-rotate-270"></i></span>
  591. <% } else if (auditor.status === auditConst.status.checking) { %>
  592. <span class="pull-right text-warning"><i class="fa fa-commenting"></i></span>
  593. <% } %>
  594. </div>
  595. <% if (auditor.status !== auditConst.status.uncheck && auditor.opinion) { %>
  596. <div class="col-12 py-1 bg-light"><i class="fa fa-commenting-o mr-1"></i><%- auditor.opinion%></div>
  597. <% } %>
  598. <% if (auditor.status === auditConst.status.checking && auditor.aid === ctx.session.sessionUser.accountId) { %>
  599. <div class="col-12 py-1 bg-light">
  600. <textarea class="form-control form-control-sm" name="opinion">不同意</textarea>
  601. <div class="alert alert-warning mt-1 mb-0 p-2" id="reject-process">
  602. <div class="form-check form-check-inline">
  603. <input class="form-check-input" type="radio" name="checkType" id="inlineRadio1" value="<%- auditConst.status.checkNo %>">
  604. <label class="form-check-label" for="inlineRadio1">退回原报 <%- ctx.material.user.name %></label>
  605. </div>
  606. <% if (auditor.audit_order > 1) { %>
  607. <div class="form-check form-check-inline">
  608. <input class="form-check-input" type="radio" name="checkType" id="inlineRadio2" value="<%- auditConst.status.checkNoPre %>">
  609. <label class="form-check-label" for="inlineRadio2">退回上一审批人
  610. <% const pre = ctx.helper._.findLast(his, x => { return x.audit_order === auditor.audit_order - 1 }); %>
  611. <%- (pre.audit_type === auditType.key.common ? pre.auditors[0].name : `${pre.audit_order}审`)%>
  612. </label>
  613. </div>
  614. <% } %>
  615. </div>
  616. </div>
  617. <% } %>
  618. </div>
  619. <% } %>
  620. </div>
  621. </div>
  622. </div>
  623. </li>
  624. <% }) %>
  625. </ul>
  626. </div>
  627. <% }) %>
  628. </div>
  629. </div>
  630. </div>
  631. <div class="modal-footer">
  632. <button type="button" class="btn btn-secondary btn-sm" data-dismiss="modal">关闭</button>
  633. <input type="hidden" name="_csrf_j" value="<%= ctx.csrf %>" />
  634. <button type="submit" class="btn btn-warning btn-sm">确认退回</button>
  635. </div>
  636. </form>
  637. </div>
  638. </div>
  639. <% } %>
  640. <% } %>
  641. <!--材料调差-小数位数-->
  642. <div class="modal fade" id="cc-digits" data-backdrop="static">
  643. <div class="modal-dialog" role="document">
  644. <form action="/tender/<%- ctx.tender.id %>/measure/material/<%- ctx.material.order %>/save/decimal" method="post" onsubmit="return checkSetDecimal();" class="modal-content">
  645. <div class="modal-header">
  646. <h5 class="modal-title">设置</h5>
  647. </div>
  648. <div class="modal-body">
  649. <div class="form-group mb-3">
  650. <h5>小数位数</h5>
  651. <div class="row">
  652. <div class="col-4">
  653. <div class="input-group input-group-sm">
  654. <div class="input-group-prepend">
  655. <span class="input-group-text">单价</span>
  656. </div>
  657. <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<% } %>>
  658. </div>
  659. </div>
  660. <div class="col-4">
  661. <div class="input-group input-group-sm">
  662. <div class="input-group-prepend">
  663. <span class="input-group-text">金额</span>
  664. </div>
  665. <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<% } %>>
  666. </div>
  667. </div>
  668. <div class="col-4">
  669. <div class="input-group input-group-sm">
  670. <div class="input-group-prepend">
  671. <span class="input-group-text">数量</span>
  672. </div>
  673. <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<% } %>>
  674. </div>
  675. </div>
  676. </div>
  677. </div>
  678. <div class="form-group">
  679. <h5>计量期数据来源</h5>
  680. <div>
  681. <% 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)))) { %>
  682. <% for (const qs of qtySourceConst) { %>
  683. <div class="form-check form-check-inline">
  684. <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<% } %>>
  685. <label class="form-check-label" for="<%- qs.key %>_source"><%- qs.name %></label>
  686. </div>
  687. <% } %>
  688. <% } else { %>
  689. <div class="form-check form-check-inline">
  690. <input type="radio" class="form-check-input" checked disabled>
  691. <label class="form-check-label"><%- ctx.helper._.find(qtySourceConst, { value: material.qty_source }).name %></label>
  692. </div>
  693. <% } %>
  694. </div>
  695. </div>
  696. </div>
  697. <div class="modal-footer">
  698. <input type="hidden" name="_csrf_j" value="<%= ctx.csrf %>" />
  699. <button type="button" class="btn btn-sm btn-secondary" data-dismiss="modal">取消</button>
  700. <% if ((material.status === auditConst.status.uncheck || material.status === auditConst.status.checkNo) && ctx.session.sessionUser.accountId === material.user_id) { %>
  701. <button type="submit" class="btn btn-sm btn-primary">确认修改</button>
  702. <% } %>
  703. </div>
  704. </form>
  705. </div>
  706. </div>
  707. <% 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) { %>
  708. <% if (ctx.material && !ctx.material.authMobile && ctx.session.sessionUser.loginStatus === 0) { %>
  709. <!--终审重新审批-->
  710. <div class="modal fade" id="sp-down-back" data-backdrop="static">
  711. <div class="modal-dialog" role="document">
  712. <div class="modal-content">
  713. <div class="modal-header">
  714. <h5 class="modal-title">重新审批</h5>
  715. </div>
  716. <div class="modal-body">
  717. <h5>重新审批需要您的手机短信验证</h5>
  718. <h5>您目前还没设置认证手机,请先设置。</h5>
  719. </div>
  720. <div class="modal-footer">
  721. <button type="button" class="btn btn-sm btn-secondary" data-dismiss="modal">取消</button>
  722. <a href="/profile/sms" class="btn btn-sm btn-primary">去设置</a>
  723. </div>
  724. </div>
  725. </div>
  726. </div>
  727. <% } else { %>
  728. <div class="modal fade" id="sp-down-back" data-backdrop="static">
  729. <div class="modal-dialog" role="document">
  730. <div class="modal-content">
  731. <div class="modal-header">
  732. <h5 class="modal-title">重新审批</h5>
  733. </div>
  734. <div class="modal-body">
  735. <h5>确认由「终审-<%= ctx.session.sessionUser.name %>」重新审批「第<%= ctx.material.order %>期」?
  736. </h5>
  737. <% if (ctx.session.sessionUser.loginStatus === 0) { %>
  738. <div class="form-group">
  739. <label>重审需要验证码确认,验证码将发送至尾号<%- ctx.material.authMobile.slice(-4) %>的手机</label>
  740. <div class="input-group input-group-sm mb-3">
  741. <input class="form-control" type="text" readonly="readonly" name="code"
  742. placeholder="输入短信中的6位验证码" />
  743. <div class="input-group-append">
  744. <button class="btn btn-outline-secondary" type="button" id="get-code">获取验证码</button>
  745. </div>
  746. </div>
  747. </div>
  748. <% } %>
  749. </div>
  750. <div class="modal-footer">
  751. <button type="button" class="btn btn-secondary btn-sm" data-dismiss="modal">关闭</button>
  752. <!--<a href="<%- preUrl %>/audit/check/again" disabled class="btn btn-warning btn-sm">确定重审</a>-->
  753. <button <% if (ctx.session.sessionUser.loginStatus === 0) { %>disabled<% } %> id="re-shenpi-btn"
  754. class="btn btn-warning btn-sm">确定重审</button>
  755. </div>
  756. </div>
  757. </div>
  758. </div>
  759. <% } %>
  760. <% } %>
  761. <% if (ctx.material && ctx.material.status !== auditConst.status.checked && ctx.session.sessionUser.is_admin) { %>
  762. <!--上报审批-->
  763. <div class="modal fade" id="sub-sp2" data-backdrop="static">
  764. <div class="modal-dialog" style="max-width: 650px" role="document">
  765. <div class="modal-content">
  766. <div class="modal-header">
  767. <h5 class="modal-title">修改审批流程</h5>
  768. </div>
  769. <div class="modal-body">
  770. <div class="card mt-1">
  771. <div class="modal-height-500" style="overflow: auto">
  772. <style>
  773. #admin-edit-shenpi thead th {
  774. border-bottom: 0;
  775. }
  776. #admin-edit-shenpi td, #admin-edit-shenpi th {
  777. padding: 0.75rem;
  778. }
  779. #admin-edit-shenpi th {
  780. background: none;
  781. color: #212529;
  782. border-top: 0;
  783. }
  784. </style>
  785. <table class="table table-hover" id="admin-edit-shenpi">
  786. <thead>
  787. <tr class="card-header text-center">
  788. <th width="100px">审批流程</th>
  789. <th>审批人员</th>
  790. <th width="80" style="text-align: center">审批状态</th>
  791. <th width="200" style="text-align: center">操作</th>
  792. </tr>
  793. </thead>
  794. <tbody id="admin-edit-shenpi-list">
  795. <% for (const [i, group] of ctx.material.auditors2.entries()) { %>
  796. <% if (i === 0) continue; %>
  797. <% for (const [j, auditor] of group.entries()) { %>
  798. <tr>
  799. <td class="text-left d-flex">
  800. <% if (j === 0) { %>
  801. <%- i + '审' %>
  802. <% if (auditor.audit_type !== auditType.key.common) { %>
  803. <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>
  804. <% } %>
  805. <% } %>
  806. </td>
  807. <td></span> <%- auditor.name %> <small class="text-muted"><%- auditor.role %></small></td>
  808. <td style="text-align: center"><span class="<%- auditConst.auditStringClass[auditor.status] %>"><%- auditor.status !== auditConst.status.uncheck ? auditConst.auditString[auditor.status] : '待审批' %></span></td>
  809. <td style="text-align: center">
  810. <% if (auditor.status === auditConst.status.checking && j === group.length - 1) { %>
  811. <span class="dropdown mr-2">
  812. <a href="javascript: void(0)" class="add-audit" id="<%- auditor.aid %>_add_dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">增加</a>
  813. <div class="dropdown-menu dropdown-menu-right" id="<%- auditor.aid %>_add_dropdownMenu" aria-labelledby="<%- auditor.aid %>_add_dropdownMenuButton" style="width:220px">
  814. <div class="mb-2 p-2"><input class="form-control form-control-sm gr-search"
  815. placeholder="姓名/手机 检索" autocomplete="off" data-code="<%- auditor.aid %>_add"></div>
  816. <dl class="list-unstyled book-list" data-aid="<%- auditor.aid %>" data-operate="add">
  817. <% accountGroup.forEach((group, idx) => { %>
  818. <dt><a href="javascript: void(0);" class="acc-btn" data-groupid="<%- idx %>"
  819. data-type="hide"><i class="fa fa-plus-square"></i></a> <%- group.groupName %></dt>
  820. <div class="dd-content" data-toggleid="<%- idx %>">
  821. <% group.groupList.forEach(item => { %>
  822. <% if (item.id !== ctx.material.user_id) { %>
  823. <dd class="border-bottom p-2 mb-0 " data-id="<%- item.id %>">
  824. <p class="mb-0 d-flex"><span class="text-primary"><%- item.name %></span><span
  825. class="ml-auto"><%- item.mobile %></span></p>
  826. <span class="text-muted"><%- item.role %></span>
  827. </dd>
  828. <% } %>
  829. <% });%>
  830. </div>
  831. <% }) %>
  832. </dl>
  833. </div>
  834. </span>
  835. <% } %>
  836. <% if (auditor.status === auditConst.status.uncheck) { %>
  837. <% if (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. <% if (auditor.audit_type !== auditType.key.common) { %>
  863. <span class="dropdown mr-2">
  864. <a href="javascript: void(0)" class="add-audit" id="<%- auditor.aid %>_add-sibling_dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">平级</a>
  865. <div class="dropdown-menu dropdown-menu-right" id="<%- auditor.aid %>_add-sibling_dropdownMenu" aria-labelledby="<%- auditor.aid %>_add-sibling_dropdownMenuButton" style="width:220px">
  866. <div class="mb-2 p-2"><input class="form-control form-control-sm gr-search"
  867. placeholder="姓名/手机 检索" autocomplete="off" data-code="<%- auditor.aid %>_add-sibling"></div>
  868. <dl class="list-unstyled book-list" data-aid="<%- auditor.aid %>" data-operate="add-sibling">
  869. <% accountGroup.forEach((group, idx) => { %>
  870. <dt><a href="javascript: void(0);" class="acc-btn" data-groupid="<%- idx %>"
  871. data-type="hide"><i class="fa fa-plus-square"></i></a> <%- group.groupName %></dt>
  872. <div class="dd-content" data-toggleid="<%- idx %>">
  873. <% group.groupList.forEach(item => { %>
  874. <% if (item.id !== ctx.material.user_id) { %>
  875. <dd class="border-bottom p-2 mb-0 " data-id="<%- item.id %>">
  876. <p class="mb-0 d-flex"><span class="text-primary"><%- item.name %></span><span
  877. class="ml-auto"><%- item.mobile %></span></p>
  878. <span class="text-muted"><%- item.role %></span>
  879. </dd>
  880. <% } %>
  881. <% });%>
  882. </div>
  883. <% }) %>
  884. </dl>
  885. </div>
  886. </span>
  887. <% } %>
  888. <% } %>
  889. <span class="dropdown mr-2">
  890. <a href="javascript: void(0)" class="change-audit" id="<%- auditor.aid %>_change_dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">更换</a>
  891. <div class="dropdown-menu dropdown-menu-right" id="<%- auditor.aid %>_change_dropdownMenu" aria-labelledby="<%- auditor.aid %>_change_dropdownMenuButton" style="width:220px">
  892. <div class="mb-2 p-2"><input class="form-control form-control-sm gr-search"
  893. placeholder="姓名/手机 检索" autocomplete="off" data-code="<%- auditor.aid %>_change"></div>
  894. <dl class="list-unstyled book-list" data-aid="<%- auditor.aid %>" data-operate="change">
  895. <% accountGroup.forEach((group, idx) => { %>
  896. <dt><a href="javascript: void(0);" class="acc-btn" data-groupid="<%- idx %>"
  897. data-type="hide"><i class="fa fa-plus-square"></i></a> <%- group.groupName %></dt>
  898. <div class="dd-content" data-toggleid="<%- idx %>">
  899. <% group.groupList.forEach(item => { %>
  900. <% if (item.id !== ctx.material.user_id) { %>
  901. <dd class="border-bottom p-2 mb-0 " data-id="<%- item.id %>">
  902. <p class="mb-0 d-flex"><span class="text-primary"><%- item.name %></span><span
  903. class="ml-auto"><%- item.mobile %></span></p>
  904. <span class="text-muted"><%- item.role %></span>
  905. </dd>
  906. <% } %>
  907. <% });%>
  908. </div>
  909. <% }) %>
  910. </dl>
  911. </div>
  912. </span>
  913. <span class="dropdown">
  914. <a href="javascript: void(0)" class="text-danger" title="移除" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">移除</a>
  915. <div class="dropdown-menu">
  916. <span class="dropdown-item" href="javascript:void(0);">确认移除审批人?</span>
  917. <div class="dropdown-divider"></div>
  918. <div class="px-2 py-1 text-center">
  919. <button class="remove-audit btn btn-sm btn-danger" data-id="<%- auditor.aid %>">移除</button>
  920. <button class="btn btn-sm btn-secondary">取消</button>
  921. </div>
  922. </div>
  923. </span>
  924. <% } %>
  925. </td>
  926. </tr>
  927. <% } %>
  928. <% } %>
  929. </tbody>
  930. </table>
  931. </div>
  932. </div>
  933. </div>
  934. <form class="modal-footer">
  935. <div class="mr-auto text-warning">
  936. <span class="mr-3">增加:后级审核人</span>
  937. <span class="">平级:会签/或签增加平级审核人</span>
  938. </div>
  939. <button type="button" class="btn btn-secondary btn-sm" data-dismiss="modal">关闭</button>
  940. </form>
  941. </div>
  942. </div>
  943. </div>
  944. <% } %>
  945. <script type="text/javascript">
  946. const csrf = '<%= ctx.csrf %>';
  947. const authMobile = '<%= ctx.material.authMobile %>';
  948. const sam_auditConst = JSON.parse('<%- JSON.stringify(auditConst) %>');
  949. const auditType = JSON.parse('<%- JSON.stringify(auditType) %>');
  950. </script>
  951. <% if (ctx.session.sessionUser.accountId === ctx.material.user_id && (ctx.material.status === auditConst.status.uncheck || ctx.material.status === auditConst.status.checkNo)) { %>
  952. <script>
  953. const accountGroup = JSON.parse(unescape('<%- escape(JSON.stringify(accountGroup)) %>'));
  954. const accountList = JSON.parse(unescape('<%- escape(JSON.stringify(accountList)) %>'));
  955. const shenpi_status = <%- ctx.tender.info.shenpi.material %>;
  956. const shenpiConst = JSON.parse('<%- JSON.stringify(shenpiConst) %>');
  957. </script>
  958. <% } else if (ctx.material && ctx.material.status !== auditConst.status.checked && ctx.session.sessionUser.is_admin) { %>
  959. <script type="text/javascript">
  960. const accountGroup = JSON.parse(unescape('<%- escape(JSON.stringify(accountGroup)) %>'));
  961. const accountList = JSON.parse(unescape('<%- escape(JSON.stringify(accountList)) %>'));
  962. const material_uid = parseInt('<%= ctx.material.user_id %>');
  963. const auditorList = JSON.parse(unescape('<%- escape(JSON.stringify(ctx.material.auditors2)) %>'));
  964. </script>
  965. <% } %>
  966. <script>
  967. const cur_uid = parseInt('<%- ctx.session.sessionUser.accountId %>');
  968. const cur_tenderid = parseInt('<%- ctx.tender.id %>');
  969. </script>
  970. <script>
  971. $('.sp-location-list').on('shown.bs.modal', function () {
  972. const scrollBox = $(this).find('div[class="col-8 modal-height-500"]');
  973. const bdiv = (scrollBox.offset() && scrollBox.offset().top) || 0;
  974. scrollBox.scrollTop(0);
  975. const hdiv = divSearch($(this).find('textarea')) ? $(this).find('textarea') : null;
  976. const hdheight = hdiv ? hdiv.parents('.timeline-item-content').offset().top : null;
  977. if (hdiv && scrollBox.length && scrollBox[0].scrollHeight > 200 && hdheight - bdiv > 200) {
  978. scrollBox.scrollTop(hdheight - bdiv);
  979. }
  980. });
  981. function divSearch(div) {
  982. if (div.length > 0) {
  983. return true;
  984. }
  985. return false;
  986. }
  987. // 展开历史审核记录
  988. $('.modal-body #fold-btn').click(function () {
  989. const type = $(this).data('target')
  990. const auditCard = $(this).parent().parent()
  991. if (type === 'show') {
  992. $(this).data('target', 'hide')
  993. auditCard.find('.fold-card').slideDown('swing', () => {
  994. auditCard.find('#fold-btn').text('收起历史审核记录')
  995. })
  996. } else {
  997. $(this).data('target', 'show')
  998. auditCard.find('.fold-card').slideUp('swing', () => {
  999. auditCard.find('#fold-btn').text('展开历史审核记录')
  1000. })
  1001. }
  1002. });
  1003. $('.sp-list-btn').click(function () {
  1004. const type = $(this).data('type')
  1005. if (type === 'hide') {
  1006. $('.sp-list-item').hide()
  1007. $('.modal-title').text('审批流程')
  1008. } else {
  1009. $('.sp-list-item').show()
  1010. $('.modal-title').text('重新上报')
  1011. }
  1012. });
  1013. $('#cc-digits').on('shown.bs.modal', function () {
  1014. $('#decimal_up').val(<%- material.decimal.up %>);
  1015. $('#decimal_tp').val(<%- material.decimal.tp %>);
  1016. $('#decimal_qty').val(<%- material.decimal.qty %>);
  1017. });
  1018. // 小数位设置
  1019. function checkSetDecimal() {
  1020. const up = parseInt($('#decimal_up').val());
  1021. const tp = parseInt($('#decimal_tp').val());
  1022. const qty = parseInt($('#decimal_qty').val());
  1023. let flag = false;
  1024. if(_.isNaN(up) || up > 6 || up < 0) {
  1025. toastr.error('单价小数位数设置不能大于6或小于0');
  1026. flag = true;
  1027. }
  1028. if(_.isNaN(tp) || tp > 6 || tp < 0) {
  1029. toastr.error('金额小数位数设置不能大于6或小于0');
  1030. flag = true;
  1031. }
  1032. if(_.isNaN(qty) || qty > 6 || qty < 0) {
  1033. toastr.error('数量小数位数设置不能大于6或小于0');
  1034. flag = true;
  1035. }
  1036. if (flag) {
  1037. return false;
  1038. }
  1039. }
  1040. // 重新审批按钮
  1041. $("#re-shenpi-btn").click(function () {
  1042. const data = {
  1043. };
  1044. <% if (ctx.session.sessionUser.loginStatus === 0) { %>
  1045. const code = $("#sp-down-back input[name='code']").val();
  1046. if ($(this).hasClass('disabled')) {
  1047. return false;
  1048. }
  1049. if (code.length < 6) {
  1050. // alert('请填写正确的验证码');
  1051. toastr.error('请填写正确的验证码');
  1052. return false;
  1053. }
  1054. data.code = code;
  1055. <% } %>
  1056. $.ajax({
  1057. url: '<%- preUrl %>/audit/check/again',
  1058. type: 'get',
  1059. data: data,
  1060. dataTye: 'json',
  1061. success: function (response) {
  1062. if (response.err === 0) {
  1063. window.location.href = response.url;
  1064. } else {
  1065. toastr.error(response.msg);
  1066. }
  1067. }
  1068. });
  1069. });
  1070. </script>
  1071. <% if (ctx.session.sessionUser.accountId === ctx.material.user_id && (ctx.material.calc_stage !== ctx.material.stage_id || !ctx.material.calc_tp)) { %>
  1072. <div class="modal fade" id="okedit" data-backdrop="static">
  1073. <div class="modal-dialog " role="document" >
  1074. <div class="modal-content">
  1075. <div class="modal-header">
  1076. <h5 class="modal-title">生成新一期调差清单</h5>
  1077. </div>
  1078. <div class="modal-body">
  1079. <div>
  1080. <h5 id="material-detail">正在获取上期调差清单数据中,请等待...</h5>
  1081. <div class="progress">
  1082. <div id="material-progress" class="progress-bar" role="progressbar" style="width: 100%;" aria-valuenow="50" aria-valuemin="0" aria-valuemax="100">100%</div>
  1083. </div>
  1084. </div>
  1085. <% if (ctx.material.is_stage_self) { %>
  1086. <% for (const ms of materialStageData) { %>
  1087. <div id="list-detail-<%- ms.sid %>" style="display: none" class="mt-3">
  1088. <h5>生成期调差清单:<b>第<%- ms.order %>期</b></h5>
  1089. <div class="progress">
  1090. <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>
  1091. </div>
  1092. </div>
  1093. <% } %>
  1094. <% } else { %>
  1095. <div id="list-detail" style="display: none" class="mt-3">
  1096. <h5>生成调差清单:</h5>
  1097. <div class="progress">
  1098. <div id="list-progress" class="progress-bar" role="progressbar" style="width: 0%;" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100">0%</div>
  1099. </div>
  1100. </div>
  1101. <% } %>
  1102. <div id="self-detail" style="display: none" class="mt-3">
  1103. <h5>处理独立调差清单和计算总金额:</h5>
  1104. <div class="progress">
  1105. <div id="self-progress" class="progress-bar" role="progressbar" style="width: 0%;" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100">0%</div>
  1106. </div>
  1107. </div>
  1108. </div>
  1109. <div class="modal-footer" style="display: none" id="reload-make">
  1110. <button type="button" class="btn btn-sm btn-primary" onclick="window.location.reload();">刷新页面</button>
  1111. </div>
  1112. </div>
  1113. </div>
  1114. </div>
  1115. <script>
  1116. $(function () {
  1117. const stage_ids = JSON.parse(unescape('<%- escape(JSON.stringify(ctx.material.stage_id)) %>'));
  1118. const calc_stages = JSON.parse(unescape('<%- escape(JSON.stringify(ctx.material.calc_stage)) %>'));
  1119. const stage_id = stage_ids.split(',');
  1120. const calc_stage = calc_stages.split(',');
  1121. const calc_tp = parseInt('<%- ctx.material.calc_tp %>');
  1122. // stage_id和calc_stage数组对比,找出不同的值,并发起更新
  1123. const diff_stage_ids = _.difference(stage_id, calc_stage);
  1124. if (diff_stage_ids.length === 0 && calc_tp) return;
  1125. const is_stage_self = parseInt('<%- ctx.material.is_stage_self %>');
  1126. $('#okedit').modal('show');
  1127. let value = 0;
  1128. let interval;
  1129. let stop = false;
  1130. setProgress($('#material-progress'), 30);
  1131. postData('/tender/'+ cur_tenderid +'/measure/material/gcl/load', { stage_id, is_stage_self }, async function (result) {
  1132. // console.log(result);
  1133. const ledger = result.ledger;
  1134. const pos = result.pos;
  1135. const gclList = result.gclList;
  1136. const selfList = result.selfList;
  1137. // 整理material,针对上期是独立单价并多个不同值的单独设置值进行部分值去除
  1138. const materialListForSelf = _.uniqWith(_.orderBy(result.materialListForSelf, ['ms_id'], ['desc']), function(item1, item2) {
  1139. 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;
  1140. });
  1141. const insertSelfList = [];// 需要单独添加的明细清单工料含量列表
  1142. const hadQtySelfList = [];
  1143. $('#material-detail').text('获取上期调差清单数据成功');
  1144. stopProgress($('#material-progress'));
  1145. if (is_stage_self) {
  1146. for (const [i, newSid] of diff_stage_ids.entries()) {
  1147. const sid = parseInt(newSid);
  1148. $('#list-detail-' + sid).show();
  1149. resetProgress($('#list-progress-' + sid));
  1150. if (!interval) {
  1151. $('#list-detail-' + sid).show();
  1152. setProgress($('#list-progress-' + sid), 30);
  1153. }
  1154. const insertGclList = [];
  1155. const insertList = [];
  1156. const removeGclList = [];
  1157. const curLedger = _.find(result.curLedgerData, {sid: newSid});
  1158. const curPos = _.find(result.curPosData, {sid: newSid});
  1159. gclGatherModel.loadLedgerData(_.cloneDeep(ledger), curLedger.ledgerData);
  1160. gclGatherModel.loadPosData(_.cloneDeep(pos), curPos.posData);
  1161. const gclGatherData = gclGatherModel.gatherGclData();
  1162. // console.log(gclGatherData);
  1163. const insertGcl = [];
  1164. for (const g of gclList) {
  1165. const gcl = _.find(gclGatherData, function (item) {
  1166. return item.leafXmjs && item.leafXmjs.length > 0 && _.findIndex(item.leafXmjs, {gcl_id: g.gcl_id}) !== -1;
  1167. });
  1168. if (gcl) {
  1169. const ig = _.find(insertGcl, {gcl});
  1170. if (ig) {
  1171. if (_.findIndex(ig.bills, {mb_id: g.mb_id}) === -1) {
  1172. ig.bills.push(g);
  1173. }
  1174. } else {
  1175. insertGcl.push({
  1176. bills: [g],
  1177. gcl,
  1178. leafXmjs: _.filter(gcl.leafXmjs, function (item) {
  1179. return item.gather_qty !== undefined && item.gather_qty !== null
  1180. }),
  1181. })
  1182. }
  1183. } else {
  1184. removeGclList.push(g);
  1185. }
  1186. }
  1187. for (const one of insertGcl) {
  1188. if (one.leafXmjs && one.leafXmjs.length > 0) {
  1189. for (const xmj of one.leafXmjs) {
  1190. const is_self = _.findIndex(selfList, { gcl_id: xmj.gcl_id, xmj_id: xmj.id, mx_id: xmj.mx_id ? xmj.mx_id : '' }) !== -1;// 区分单独计量的明细工料含量
  1191. if (is_self) {
  1192. const billsList = _.filter(materialListForSelf, { gcl_id: xmj.gcl_id, xmj_id: xmj.id, mx_id: xmj.mx_id ? xmj.mx_id : '' });
  1193. for (const bill of billsList) {
  1194. if (!_.find(hadQtySelfList, bill)) {
  1195. hadQtySelfList.push(bill);
  1196. }
  1197. insertSelfList.push({
  1198. gcl_id: xmj.gcl_id,
  1199. mx_id: xmj.mx_id ? xmj.mx_id : '',
  1200. xmj_id: xmj.id ? xmj.id : null,
  1201. contract_qty: xmj.contract_qty,
  1202. qc_qty: xmj.qc_qty,
  1203. qc_minus_qty: xmj.qc_minus_qty,
  1204. gather_qty: xmj.gather_qty,
  1205. quantity: bill.quantity,
  1206. expr: bill.expr,
  1207. mb_id: bill.mb_id,
  1208. order: bill.order,
  1209. sid,
  1210. });
  1211. }
  1212. } else {
  1213. const newgcl = _.find(gclList, { gcl_id: xmj.gcl_id });
  1214. for (const bill of one.bills) {
  1215. insertList.push({
  1216. gcl_id: xmj.gcl_id,
  1217. mx_id: xmj.mx_id ? xmj.mx_id : '',
  1218. xmj_id: xmj.id ? xmj.id : null,
  1219. contract_qty: xmj.contract_qty,
  1220. qc_qty: xmj.qc_qty,
  1221. qc_minus_qty: xmj.qc_minus_qty,
  1222. gather_qty: xmj.gather_qty,
  1223. quantity: bill.quantity,
  1224. expr: bill.expr,
  1225. mb_id: bill.mb_id,
  1226. order: bill.order,
  1227. sid,
  1228. });
  1229. if (!newgcl) {
  1230. if (_.findIndex(insertGclList, { gcl_id: xmj.gcl_id }) === -1) {
  1231. insertGclList.push({
  1232. gcl_id: xmj.gcl_id,
  1233. quantity: bill.quantity,
  1234. expr: bill.expr,
  1235. old_quantity: bill.quantity,
  1236. old_expr: bill.expr,
  1237. mb_id: bill.mb_id,
  1238. order: bill.order,
  1239. });
  1240. }
  1241. }
  1242. }
  1243. }
  1244. }
  1245. }
  1246. }
  1247. console.log(sid, insertList, insertGclList, removeGclList);
  1248. const msg = await postMLData(sid, insertList, insertGclList, removeGclList, $('#list-progress-' + sid));
  1249. if (!msg) return;
  1250. }
  1251. } else {
  1252. $('#list-detail').show();
  1253. resetProgress($('#list-progress'));
  1254. if (!interval) {
  1255. $('#list-detail').show();
  1256. setProgress($('#list-progress'), 30);
  1257. }
  1258. const insertGclList = [];
  1259. const insertList = [];
  1260. const removeGclList = [];
  1261. const curLedgerData = result.curLedgerData;
  1262. const curPosData = result.curPosData;
  1263. gclGatherModel.loadLedgerData(_.cloneDeep(ledger), curLedgerData);
  1264. gclGatherModel.loadPosData(_.cloneDeep(pos), curPosData);
  1265. const gclGatherData = gclGatherModel.gatherGclData();
  1266. const insertGcl = [];
  1267. for (const g of gclList) {
  1268. const gcl = _.find(gclGatherData, function (item) {
  1269. return item.leafXmjs && item.leafXmjs.length > 0 && _.findIndex(item.leafXmjs, {gcl_id: g.gcl_id}) !== -1;
  1270. });
  1271. if (gcl) {
  1272. const ig = _.find(insertGcl, {gcl});
  1273. if (ig) {
  1274. if (_.findIndex(ig.bills, {mb_id: g.mb_id}) === -1) {
  1275. ig.bills.push(g);
  1276. }
  1277. } else {
  1278. insertGcl.push({
  1279. bills: [g],
  1280. gcl,
  1281. leafXmjs: _.filter(gcl.leafXmjs, function (item) {
  1282. return item.gather_qty !== undefined && item.gather_qty !== null || (item.qc_minus_qty !== undefined && item.qc_minus_qty !== null)
  1283. }),
  1284. })
  1285. }
  1286. } else {
  1287. removeGclList.push(g);
  1288. }
  1289. }
  1290. for (const one of insertGcl) {
  1291. if (one.leafXmjs && one.leafXmjs.length > 0) {
  1292. for (const xmj of one.leafXmjs) {
  1293. const is_self = _.findIndex(selfList, { gcl_id: xmj.gcl_id, xmj_id: xmj.id, mx_id: xmj.mx_id ? xmj.mx_id : null }) !== -1;// 区分单独计量的明细工料含量
  1294. if (is_self) {
  1295. const billsList = _.filter(materialListForSelf, { gcl_id: xmj.gcl_id, xmj_id: xmj.id, mx_id: xmj.mx_id ? xmj.mx_id : null });
  1296. for (const bill of billsList) {
  1297. hadQtySelfList.push(bill);
  1298. insertSelfList.push({
  1299. gcl_id: xmj.gcl_id,
  1300. mx_id: xmj.mx_id ? xmj.mx_id : '',
  1301. xmj_id: xmj.id ? xmj.id : null,
  1302. contract_qty: xmj.contract_qty,
  1303. qc_qty: xmj.qc_qty,
  1304. qc_minus_qty: xmj.qc_minus_qty,
  1305. gather_qty: xmj.gather_qty,
  1306. quantity: bill.quantity,
  1307. expr: bill.expr,
  1308. mb_id: bill.mb_id,
  1309. order: bill.order,
  1310. });
  1311. }
  1312. } else {
  1313. const newgcl = _.find(gclList, { gcl_id: xmj.gcl_id });
  1314. for (const bill of one.bills) {
  1315. insertList.push({
  1316. gcl_id: xmj.gcl_id,
  1317. mx_id: xmj.mx_id ? xmj.mx_id : '',
  1318. xmj_id: xmj.id ? xmj.id : null,
  1319. contract_qty: xmj.contract_qty,
  1320. qc_qty: xmj.qc_qty,
  1321. qc_minus_qty: xmj.qc_minus_qty,
  1322. gather_qty: xmj.gather_qty,
  1323. quantity: bill.quantity,
  1324. expr: bill.expr,
  1325. mb_id: bill.mb_id,
  1326. order: bill.order,
  1327. });
  1328. if (!newgcl) {
  1329. insertGclList.push({
  1330. gcl_id: xmj.gcl_id,
  1331. quantity: bill.quantity,
  1332. expr: bill.expr,
  1333. old_quantity: bill.quantity,
  1334. old_expr: bill.expr,
  1335. mb_id: bill.mb_id,
  1336. order: bill.order,
  1337. });
  1338. }
  1339. }
  1340. }
  1341. }
  1342. }
  1343. }
  1344. console.log(diff_stage_ids, insertList, insertGclList, removeGclList);
  1345. const msg = await postMLData(diff_stage_ids.join(','), insertList, insertGclList, removeGclList, $('#list-progress'));
  1346. if (!msg) return;
  1347. }
  1348. $('#self-detail').show();
  1349. setProgress($('#self-progress'), 30);
  1350. // 通过比较materialListForSelf和hadQtySelfList不重合部分,得出本期为null的gather_qty列表,插入到insertSelfList中
  1351. const pushSelfList = _.xorWith(materialListForSelf, hadQtySelfList, _.isEqual);
  1352. if (pushSelfList.length > 0) {
  1353. for (const ps of pushSelfList) {
  1354. insertSelfList.push({
  1355. gcl_id: ps.gcl_id,
  1356. mx_id: ps.mx_id,
  1357. xmj_id: ps.xmj_id,
  1358. contract_qty: null,
  1359. qc_qty: null,
  1360. qc_minus_qty: null,
  1361. gather_qty: null,
  1362. quantity: ps.quantity,
  1363. expr: ps.expr,
  1364. mb_id: ps.mb_id,
  1365. order: ps.order,
  1366. });
  1367. }
  1368. }
  1369. console.log(insertSelfList);
  1370. postData('/tender/' + cur_tenderid + '/measure/material/save/data', { type: 'make_self_list', mid: materialID || mid, material_self_list: insertSelfList }, function (result) {
  1371. stopProgress($('#self-progress'));
  1372. $('#reload-make').show();
  1373. }, function (err) {
  1374. stop = true;
  1375. clearInterval(interval);
  1376. $('#reload-make').show();
  1377. });
  1378. // postData(preUrl + '/measure/material/add', newMaterialData, function (result) {
  1379. // window.location.href = preUrl + '/measure/material/' + result.order;
  1380. // }, function () {
  1381. // stop = true;
  1382. // clearInterval(interval);
  1383. // console.log(_self.parents('div[id="add-qi"]'));
  1384. // $('#add-qi').modal('show');
  1385. // $('#okedit').modal('hide');
  1386. // _self.parents('div[id="add-qi"]').modal('show');
  1387. // _self.attr('disabled', false).text('确认添加');
  1388. // });
  1389. return;
  1390. });
  1391. async function postMLData(stage_id, material_list, insertGclList, removeGclList, _progress) {
  1392. try {
  1393. const result = await postDataAsync('/tender/' + cur_tenderid + '/measure/material/save/data', { type: 'make_material_list', mid: materialID || mid, stage_id, material_list, insertGclList, removeGclList });
  1394. if (!result) {
  1395. stop = true;
  1396. clearInterval(interval);
  1397. $('#reload-make').show();
  1398. } else {
  1399. stopProgress(_progress);
  1400. }
  1401. return result ? result : false;
  1402. } catch (err) {
  1403. console.error('失败:', err);
  1404. stop = true;
  1405. clearInterval(interval);
  1406. $('#reload-make').show();
  1407. return false;
  1408. }
  1409. }
  1410. function setProgress(_this, time = 50) {
  1411. interval = setInterval(function () {
  1412. if (value < 100) {
  1413. value = parseInt(value) + 1;
  1414. _this.css("width", value + "%").text(value + "%");
  1415. } else if (value === 100) {
  1416. value = parseInt(value) + 1;
  1417. value = 30;
  1418. }
  1419. }, time);
  1420. }
  1421. function resetProgress(_this) {
  1422. _this.removeClass('bg-success');
  1423. _this.css("width", "0%").text("0%").attr('aria-valuenow', '0');
  1424. }
  1425. function stopProgress(_this) {
  1426. if (interval) {
  1427. _this.addClass('bg-success');
  1428. _this.css("width", "100%").text("100%");
  1429. value = 0;
  1430. stop = true;
  1431. clearInterval(interval);
  1432. interval = 0;
  1433. }
  1434. }
  1435. })
  1436. </script>
  1437. <% } %>