modal.ejs 25 KB

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