modal.ejs 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488
  1. <!--弹出添加标段-->
  2. <div class="modal fade" id="add-bd" data-backdrop="static">
  3. <div class="modal-dialog" role="document">
  4. <div class="modal-content">
  5. <div class="modal-header">
  6. <h5 class="modal-title">添加新标段</h5>
  7. </div>
  8. <div class="modal-body">
  9. <div class="form-group">
  10. <label>标段名称<b class="text-danger">*</b></label>
  11. <input class="form-control form-control-sm" placeholder="输入标段名称" type="text" name="name">
  12. </div>
  13. <div class="form-group">
  14. <style>
  15. .tooltip-inner {
  16. max-width: initial;
  17. }
  18. </style>
  19. <label ><b class="text-danger">*</b>计价标准<a style="" href="javascript:void(0)" data-toggle="tooltip" data-placement="right" title="" data-original-title="用于初始化新建模板、项目节、标准清单" class="ml-2"><i class="fa fa-info-circle"></i></a></label>
  20. <div>
  21. <% for (const [i, v] of valuations.entries()) { %>
  22. <div class="form-check form-check-inline mt-2">
  23. <input class="form-check-input" name="valuation" type="radio" id="valuation<%- v.id %>" value="<%- v.id %>" <% if (i === 0) { %>checked<% } %>>
  24. <label class="form-check-label" for="valuation<%- v.id %>"><%- v.name %></label>
  25. </div>
  26. <% } %>
  27. </div>
  28. </div>
  29. </div>
  30. <div class="modal-footer">
  31. <button type="button" class="btn btn-secondary btn-sm" data-dismiss="modal">关闭</button>
  32. <button type="button" class="btn btn-primary btn-sm" id="add-bd-ok">确定添加</button>
  33. </div>
  34. </div>
  35. </div>
  36. </div>
  37. <!--弹出分类设置-->
  38. <div class="modal fade" id="cate-set" data-backdrop="static">
  39. <div class="modal-dialog" role="document">
  40. <div class="modal-content">
  41. <div class="modal-header">
  42. <h5 class="modal-title">分类设置</h5>
  43. </div>
  44. <div class="modal-body">
  45. <div class="modal-height-300">
  46. <ul id="treeLevel" class="ztree"></ul>
  47. </div>
  48. </div>
  49. <div class="modal-footer">
  50. <button type="button" class="btn btn-secondary btn-sm" data-dismiss="modal">关闭</button>
  51. <button type="button" class="btn btn-primary btn-sm" id="set-cate-ok">确定</button>
  52. </div>
  53. </div>
  54. </div>
  55. </div>
  56. <div class="modal fade" id="cate-set-self" data-backdrop="static">
  57. <div class="modal-dialog" role="document">
  58. <div class="modal-content">
  59. <div class="modal-header">
  60. <h5 class="modal-title">分类设置</h5>
  61. </div>
  62. <div class="modal-body">
  63. <div class="modal-height-300">
  64. <ul id="treeLevel-self" class="ztree"></ul>
  65. </div>
  66. </div>
  67. <div class="modal-footer">
  68. <button type="button" class="btn btn-primary btn-sm" id="set-cate-self-reset">重置</button>
  69. <button type="button" class="btn btn-secondary btn-sm" data-dismiss="modal">关闭</button>
  70. <button type="button" class="btn btn-primary btn-sm" id="set-cate-self-ok">确定</button>
  71. </div>
  72. </div>
  73. </div>
  74. </div>
  75. <!--弹出列设置-->
  76. <div class="modal fade" id="col-set" data-backdrop="static">
  77. <div class="modal-dialog" role="document">
  78. <div class="modal-content">
  79. <div class="modal-header">
  80. <h5 class="modal-title">列设置</h5>
  81. </div>
  82. <div class="modal-body">
  83. <table class="table table-hover table-bordered">
  84. <thead><tr><th width="150px">列名</th><th width="150px">别名</th><th width="50px">显示</th></tr></thead>
  85. <tbody class="text-center">
  86. <% for (const cs of colSet) { %>
  87. <tr code="<%- cs.field %>">
  88. <td><%- cs.name %><% if (cs.hint) { %><i class="fa fa-question-circle text-primary ml-1" data-placement="bottom" data-toggle="tooltip" data-original-title="<%- cs.hint %>"></i><% } %></td>
  89. <% if (cs.fixed.indexOf('alias') >= 0) { %>
  90. <td class="disabled">-</td>
  91. <% } else {%>
  92. <td><input type="text" class="form-control form-control-sm" value="<%- cs.alias %>"></td>
  93. <% } %>
  94. <% if (cs.fixed.indexOf('show') >= 0 ) { %>
  95. <td>
  96. <div class="form-check form-check-inline">
  97. <input class="form-check-input" type="checkbox" id="inlineCheckbox-<%- cs.code %>" checked="" disabled="">
  98. <label class="form-check-label" for="inlineCheckbox-<%- cs.code %>"></label>
  99. </div>
  100. </td>
  101. <% } else { %>
  102. <td>
  103. <div class="form-check form-check-inline">
  104. <input class="form-check-input" type="checkbox" id="inlineCheckbox-<%- cs.code %>" <% if (cs.show) { %> checked <% } %> >
  105. <label class="form-check-label" for="inlineCheckbox-<%- cs.code %>"></label>
  106. </div>
  107. </td>
  108. <% } %>
  109. </tr>
  110. <% } %>
  111. </tbody>
  112. </table>
  113. <div class="text-danger">请勿全选(页面显示不下);谨慎修改别名(修改后,各页面概念将不一致)</div>
  114. </div>
  115. <form class="modal-footer" action="/list/info/col-set" method="post" onsubmit="return onSetCol();">
  116. <input type="hidden" name="_csrf_j" value="<%= ctx.csrf %>">
  117. <input type="hidden" name="col_set" value="">
  118. <input type="hidden" name="col_type" value="info">
  119. <button type="button" class="btn btn-secondary btn-sm" data-dismiss="modal">关闭</button>
  120. <button type="submit" class="btn btn-primary btn-sm" id="add-bd-ok">确定修改</button>
  121. </form>
  122. </div>
  123. </div>
  124. </div>
  125. <!--弹出计量模式选择-->
  126. <div class="modal fade" id="jlms" data-backdrop="static">
  127. <div class="modal-dialog modal-lg" role="document">
  128. <div class="modal-content">
  129. <div class="modal-header">
  130. <h5 class="modal-title">选择计量模式</h5>
  131. <button type="button" class="close" data-dismiss="modal" aria-label="Close">
  132. <span aria-hidden="true">&times;</span>
  133. </button>
  134. </div>
  135. <div class="modal-body">
  136. <div class="row">
  137. <% for (const mt in measureType) { %>
  138. <div class="col-6">
  139. <div class="card">
  140. <div class="card-body">
  141. <h5 class="card-title"><i class="fa fa-bookmark"></i><%- measureType[mt].title %></h5>
  142. <p class="card-text"><b><%- measureType[mt].name %></b><%- measureType[mt].hint%></p>
  143. <a href="#" mst="<%- measureType[mt].value %>" class="btn btn-primary btn-sm">选择他</a>
  144. </div>
  145. </div>
  146. </div>
  147. <% } %>
  148. </div>
  149. </div>
  150. </div>
  151. </div>
  152. </div>
  153. <div class="modal fade" id="sp-list" data-backdrop="static">
  154. <div class="modal-dialog" role="document">
  155. <div class="modal-content">
  156. <div class="modal-header">
  157. <h5 class="modal-title">审批进度详情</h5>
  158. </div>
  159. <div class="modal-body">
  160. <div class="modal-height-500" style="overflow: auto" id="audit-list">
  161. </div>
  162. </div>
  163. <div class="modal-footer">
  164. <button type="button" class="btn btn-secondary btn-sm" data-dismiss="modal">关闭</button>
  165. </div>
  166. </div>
  167. </div>
  168. </div>
  169. <script>
  170. const auditType = JSON.parse('<%- JSON.stringify(auditConst.auditType) %>');
  171. const colSet = JSON.parse('<%- JSON.stringify(colSet) %>');
  172. const onSetCol = function() {
  173. const trs = $('tr[code]', '#col-set');
  174. const colSet = [];
  175. for (const tr of trs) {
  176. colSet.push({ field: $(tr).attr('code'), show: $('input[type=checkbox]', tr)[0].checked, alias: $('input[type=text]', tr).val() || ''});
  177. }
  178. $('input[name=col_set]').val(JSON.stringify(colSet));
  179. };
  180. $(document).ready(function () {
  181. const getAuditTypeText = function (type) {
  182. if (type === auditType.key.common) return '';
  183. return `<span class="text-${auditType.info[type].class}">${auditType.info[type].long}</span>`;
  184. };
  185. const loadStageHistory = function (result, auditConst2) {
  186. const { auditHistory, auditors2, user } = result;
  187. let historyHTML = [];
  188. auditHistory.forEach((his, idx) => {
  189. if (idx === auditHistory.length - 1 && auditHistory.length !== 1) {
  190. historyHTML.push(`<div class="text-right"><a href="javascript: void(0);" id="fold-btn" data-target="show">展开历史审批流程</a></div>`);
  191. }
  192. historyHTML.push(`<div class="${idx < auditHistory.length - 1 ? 'fold-card' : ''}">`);
  193. historyHTML.push(`<div class="text-center text-muted">${idx+1}#</div>`);
  194. historyHTML.push(`<ul class="timeline-list list-unstyled mt-2 pr-1 ${ idx === auditHistory.length - 1 && auditHistory.length !== 1 ? 'last-auditor-list' : '' }">`);
  195. his.forEach((group, index) => {
  196. console.log(group);
  197. if (index === 0) {
  198. historyHTML.push(`<li class="timeline-list-item pb-2">
  199. <div class="timeline-item-date">
  200. ${group.beginYear}
  201. <span>${group.beginDate}</span>
  202. <span>${group.beginTime}</span>
  203. </div>
  204. <div class="timeline-item-tail"></div>
  205. <div class="timeline-item-icon bg-success text-light"><i class="fa fa-caret-down"></i></div>
  206. <div class="timeline-item-content">
  207. <div class="py-1">
  208. <span class="text-black-50">原报</span>
  209. <span class="pull-right text-success">${idx !== 0 ? '重新' : '' }上报审批</span>
  210. </div>
  211. <div class="card">
  212. <div class="card-body px-3 py-0">
  213. <div class="card-text p-2 py-3 row">
  214. <div class="col">
  215. <span class="h6">${user.name}</span>
  216. <span class="text-muted ml-1">${user.role}</span>
  217. </div>
  218. <div class="col">
  219. <span class="pull-right text-success"><i class="fa fa-check-circle"></i></span>
  220. </div>
  221. </div>
  222. </div>
  223. </div>
  224. </div>
  225. </li>`);
  226. }
  227. historyHTML.push(`<li class="timeline-list-item pb-2 ${ group.status === auditConst2.status.uncheck && idx === auditHistory.length - 1 && auditHistory.length !== 1 ? 'is_uncheck' : ''}">`);
  228. if (group.endYear) {
  229. historyHTML.push(`<div class="timeline-item-date">${group.endYear}<span>${group.endDate}</span><span>${group.endTime}</span></div>`);
  230. }
  231. if (index < his.length - 1) {
  232. historyHTML.push('<div class="timeline-item-tail"></div>');
  233. }
  234. if (group.status === auditConst2.status.checked) {
  235. historyHTML.push('<div class="timeline-item-icon bg-success text-light"><i class="fa fa-check"></i></div>');
  236. } else if (group.status === auditConst2.status.checkNo || group.status === auditConst2.status.checkNoPre || group.status === auditConst2.status.checkCancel) {
  237. historyHTML.push('<div class="timeline-item-icon bg-warning text-light"><i class="fa fa-level-up"></i></div>');
  238. } else if (group.status === auditConst2.status.checking) {
  239. historyHTML.push('<div class="timeline-item-icon bg-warning text-light"><i class="fa fa-ellipsis-h"></i></div>');
  240. } else {
  241. historyHTML.push('<div class="timeline-item-icon bg-secondary text-light"></div>');
  242. }
  243. historyHTML.push('<div class="timeline-item-content">');
  244. const statuStr = group.status !== auditConst2.status.uncheck ?
  245. `<span class="pull-right ${auditConst2.statusClass[group.status]}">${auditConst2.statusString[group.status]}</span>` : '';
  246. historyHTML.push(`<div class="py-1">
  247. <span class="text-black-50">
  248. ${ !group.is_final ? group.audit_order + '' : '终' }审 ${getAuditTypeText(group.audit_type)}
  249. </span>
  250. ${statuStr}
  251. </div>`);
  252. historyHTML.push('<div class="card"><div class="card-body px-3 py-0">');
  253. for (const [i, auditor] of group.auditors.entries()) {
  254. historyHTML.push(`<div class="card-text p-2 py-3 row ${ ( i > 0 ? 'border-top' : '') }">`);
  255. historyHTML.push(`<div class="col"><span class="h6">${auditor.name}</span><span class="text-muted ml-1">${auditor.role}</span></div>`);
  256. historyHTML.push('<div class="col">');
  257. if (auditor.status === auditConst2.status.checked) {
  258. historyHTML.push('<span class="pull-right text-success"><i class="fa fa-check-circle"></i></span>');
  259. } if (auditor.status === auditConst2.status.checkNo || auditor.status === auditConst2.status.checkNoPre || auditor.status === auditConst2.status.checkCancel) {
  260. historyHTML.push('<span class="pull-right text-warning"><i class="fa fa-share-square fa-rotate-270"></i></span>');
  261. }
  262. historyHTML.push('</div>');
  263. if (auditor.opinion) {
  264. historyHTML.push(`<div class="col-12 py-1 bg-light"><i class="fa fa-commenting-o mr-1"></i>${auditor.opinion}</div>`);
  265. }
  266. historyHTML.push('</div>');
  267. }
  268. historyHTML.push('</div></div>');
  269. historyHTML.push('</div>');
  270. historyHTML.push('</li>');
  271. });
  272. historyHTML.push('</div>');
  273. historyHTML.push('</ul>');
  274. });
  275. $('#audit-list').empty();
  276. $('#audit-list').append(historyHTML.join(''));
  277. }
  278. const loadHistory = function (result, auditConst2) {
  279. const dayMode = true;
  280. const { auditHistory, auditors, user } = result
  281. let historyHTML = ''
  282. const leftAuditors = auditors;
  283. const darkHTML = !dayMode ? 'bg-dark border-secondary text-white' : '';
  284. auditHistory.forEach((auditors, idx) => {
  285. if(idx === auditHistory.length - 1 && auditHistory.length !== 1) {
  286. historyHTML += `<div class="text-right"><a href="javascript: void(0);" id="fold-btn" data-target="show"
  287. >展开历史审批流程</a></div>`
  288. }
  289. historyHTML += `<div class="${idx < auditHistory.length - 1 ? 'fold-card' : ''}">
  290. <div class="text-center text-muted">${idx + 1}#</div>
  291. <ul class="timeline-list list-unstyled mt-2">`
  292. auditors.forEach((auditor, index) => {
  293. if (index === 0) {
  294. historyHTML += `<li class="timeline-list-item pb-2">
  295. <div class="timeline-item-date">
  296. ${formatDate(auditor.begin_time, !dayMode)}
  297. </div>
  298. <div class="timeline-item-tail"></div>
  299. <div class="timeline-item-icon bg-success text-light">
  300. <i class="fa fa-caret-down"></i>
  301. </div>
  302. <div class="timeline-item-content">
  303. <div class="card ${darkHTML}">
  304. <div class="card-body p-3">
  305. <div class="card-text">
  306. <p class="mb-1"><span
  307. class="h5">${user.name}</span><span
  308. class="pull-right text-success">${idx !== 0 ? '重新' : ''}上报审批</span>
  309. </p>
  310. <p class="text-muted mb-0">${user.role}</p>
  311. </div>
  312. </div>
  313. </div>
  314. </div>
  315. </li>
  316. <li class="timeline-list-item pb-2">
  317. <div class="timeline-item-date">
  318. ${formatDate(auditor.end_time, !dayMode)}
  319. </div>`
  320. if(index < auditors.length - 1) {
  321. historyHTML += `<div class="timeline-item-tail"></div>`
  322. }
  323. if(auditor.status === auditConst2.status.checked) {
  324. historyHTML += `<div class="timeline-item-icon bg-success text-light">
  325. <i class="fa fa-check"></i>
  326. </div>`
  327. } else if(auditor.status === auditConst2.status.checkNo || auditor.status === auditConst2.status.checkNoPre) {
  328. historyHTML += `<div class="timeline-item-icon bg-warning text-light">
  329. <i class="fa fa-level-up"></i>
  330. </div>`
  331. } else if(auditor.status === auditConst2.status.checking) {
  332. historyHTML += `<div class="timeline-item-icon bg-warning text-light">
  333. <i class="fa fa-ellipsis-h"></i>
  334. </div>`
  335. } else {
  336. historyHTML += `<div class="timeline-item-icon bg-secondary text-light"></div>`
  337. }
  338. historyHTML += `<div class="timeline-item-content">
  339. <div class="card ${darkHTML}">
  340. <div class="card-body p-3">
  341. <div class="card-text">
  342. <p class="mb-1"><span class="h5">${auditor.name}</span><span
  343. class="pull-right ${auditConst2.statusClass[auditor.status]}">${auditConst2.statusString[auditor.status]}</span>
  344. </p>
  345. <p class="text-muted mb-0">${auditor.role}</p>
  346. </div>
  347. </div>`
  348. if (auditor.opinion) {
  349. historyHTML += `<div class="card-body p-3 border-top">
  350. <p style="margin: 0;">${auditor.opinion}</p>
  351. </div>`
  352. }
  353. historyHTML += `</div></div></li>`
  354. } else {
  355. historyHTML += `<li class="timeline-list-item pb-2">
  356. <div class="timeline-item-date">
  357. ${formatDate(auditor.end_time, !dayMode)}
  358. </div>`
  359. if(index < auditors.length - 1) {
  360. historyHTML += `<div class="timeline-item-tail"></div>`
  361. }
  362. if(auditor.status === auditConst2.status.checked) {
  363. historyHTML += `<div class="timeline-item-icon bg-success text-light">
  364. <i class="fa fa-check"></i>
  365. </div>`
  366. } else if(auditor.status === auditConst2.status.checkNo || auditor.status === auditConst2.status.checkNoPre) {
  367. historyHTML += `<div class="timeline-item-icon bg-warning text-light">
  368. <i class="fa fa-level-up"></i>
  369. </div>`
  370. } else if(auditor.status === auditConst2.status.checking) {
  371. historyHTML += `<div class="timeline-item-icon bg-warning text-light">
  372. <i class="fa fa-ellipsis-h"></i>
  373. </div>`
  374. } else {
  375. historyHTML += `<div class="timeline-item-icon bg-secondary text-light"></div>`
  376. }
  377. historyHTML += `<div class="timeline-item-content">
  378. <div class="card ${darkHTML}">
  379. <div class="card-body p-3">
  380. <div class="card-text">
  381. <p class="mb-1"><span class="h5">${auditor.name}</span>
  382. <span
  383. class="pull-right
  384. ${auditConst2.statusClass[auditor.status]}">${auditor.status !== auditConst2.status.uncheck ? auditConst2.statusString[auditor.status] : ''}
  385. ${auditor.status === auditConst2.status.checkNo ? user.name : ''}
  386. ${auditor.status === auditConst2.status.checkNoPre && auditor.sort - 1 > 0 ? _.find(auditors, { sort: auditor.sort - 1 }).name : ''}
  387. </span>
  388. </p>
  389. <p class="text-muted mb-0">${auditor.role}</p>
  390. </div>
  391. </div>`
  392. if (auditor.opinion) {
  393. historyHTML += `<div class="card-body p-3 border-top">
  394. <p style="margin: 0;">${auditor.opinion} </p>
  395. </div>`
  396. }
  397. historyHTML += `</div></div></li>`
  398. }
  399. })
  400. historyHTML += '</ul></div>'
  401. })
  402. $('#audit-list').empty()
  403. $('#audit-list').append(historyHTML)
  404. }
  405. // 获取审批流程
  406. $('a[data-target="#sp-list" ]').on('click', function () {
  407. const type = $(this).attr('data-type');
  408. const data = {
  409. order: $(this).attr('data-order'),
  410. };
  411. const tenderId = $(this).attr('data-tender');
  412. let url = '';
  413. let auditConst2 = '';
  414. if (type === 'stage') {
  415. url = '/tender/' + tenderId + '/measure/stage/auditors';
  416. auditConst2 = JSON.parse('<%- JSON.stringify(auditConst.stage) %>');
  417. } else if (type === 'ledger') {
  418. url = '/tender/' + tenderId + '/measure/ledger/auditors';
  419. auditConst2 = JSON.parse('<%- JSON.stringify(auditConst.ledger) %>');
  420. } else if (type === 'material') {
  421. url = '/tender/' + tenderId + '/measure/material/auditors';
  422. auditConst2 = JSON.parse('<%- JSON.stringify(auditConst.material) %>');
  423. }
  424. postData(url, data, function (result) {
  425. if (type === 'stage') {
  426. loadStageHistory(result, auditConst2);
  427. } else {
  428. loadHistory(result, auditConst2);
  429. }
  430. });
  431. });
  432. // 展开/收起历史审核记录
  433. $('#audit-list').on('click', 'a', function() {
  434. const type = $(this).data('target')
  435. const auditCard = $(this).parent().parent()
  436. if (type === 'show') {
  437. $(this).data('target', 'hide')
  438. auditCard.find('.fold-card').slideDown('swing', () => {
  439. auditCard.find('#end-target').text($(this).data('idx') + '#')
  440. auditCard.find('#fold-btn').text('收起历史审核记录')
  441. })
  442. } else {
  443. $(this).data('target', 'show')
  444. auditCard.find('.fold-card').slideUp('swing', () => {
  445. auditCard.find('#end-target').text('1#')
  446. auditCard.find('#fold-btn').text('展开历史审核记录')
  447. })
  448. }
  449. });
  450. function formatDate(date, dayMode) {
  451. if (!date) return '';
  452. date = new Date(date)
  453. const year = date.getFullYear();
  454. let mon = date.getMonth() + 1;
  455. let day = date.getDate();
  456. let hour = date.getHours();
  457. let minute = date.getMinutes();
  458. let scond = date.getSeconds();
  459. if (mon < 10) {
  460. mon = '0' + mon.toString();
  461. }
  462. if (day < 10) {
  463. day = '0' + day.toString();
  464. }
  465. if (hour < 10) {
  466. hour = '0' + hour.toString();
  467. }
  468. if (minute < 10) {
  469. minute = '0' + minute.toString();
  470. }
  471. if (scond < 10) {
  472. scond = '0' + scond.toString();
  473. }
  474. return `${year}<span class="${dayMode ? 'text-light' : ''}">${mon}-${day}</span><span class="${dayMode ? 'text-light' : ''}">${hour}:${minute}:${scond}</span>`;
  475. };
  476. });
  477. </script>