|
@@ -0,0 +1,301 @@
|
|
|
+<% if (ctx.session.sessionUser.accountId === ctx.tender.data.user_id && ctx.tender.data.ledger_status === auditConst.status.checked &&
|
|
|
+ (settles.length === 0 || settles[settles.length- 1].status === auditConst.status.checked)) { %>
|
|
|
+<!--弹出添加期-->
|
|
|
+<div class="modal fade" id="add-qi" data-backdrop="static">
|
|
|
+ <div class="modal-dialog" role="document">
|
|
|
+ <form class="modal-content" action="/tender/<%- ctx.tender.id %>/settle/add" method="post" onsubmit="return checkValidSettle(this);">
|
|
|
+ <div class="modal-header">
|
|
|
+ <h5 class="modal-title">添加新一期</h5>
|
|
|
+ </div>
|
|
|
+ <div class="modal-body">
|
|
|
+ <div class="form-group">
|
|
|
+ <label>期</label>
|
|
|
+ <input class="form-control form-control-sm" value="第 <%- settles.length + 1 %> 期" type="text" readonly="">
|
|
|
+ </div>
|
|
|
+ <div class="form-group">
|
|
|
+ <label>结算年月<b class="text-danger">*</b></label>
|
|
|
+ <input class="datepicker-here form-control form-control-sm" autocomplete="off" readonly placeholder="点击选择年月" data-view="months" data-min-view="months" data-date-format="yyyy-MM" data-language="zh" type="text" name="date" autocomplete="off">
|
|
|
+ </div>
|
|
|
+ <div class="form-group">
|
|
|
+ <label>结算周期<b class="text-danger">*</b></label>
|
|
|
+ <input class="datepicker-here form-control form-control-sm" autocomplete="off" readonly placeholder="点击选择时间" data-range="true" data-multiple-dates-separator=" ~ " data-language="zh" type="text" name="period" autocomplete="off">
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="modal-footer">
|
|
|
+ <input type="hidden" name="_csrf_j" value="<%= ctx.csrf %>" />
|
|
|
+ <button type="button" class="btn btn-secondary btn-sm" data-dismiss="modal">关闭</button>
|
|
|
+ <button type="submit" class="btn btn-primary btn-sm" id="add-stage-btn">确定添加</button>
|
|
|
+ </div>
|
|
|
+ </form>
|
|
|
+ </div>
|
|
|
+</div>
|
|
|
+<% } %>
|
|
|
+<!--审批流程/结果-->
|
|
|
+<div class="modal fade" id="sp-list" data-backdrop="static">
|
|
|
+ <div class="modal-dialog modal-lg" role="document">
|
|
|
+ <div class="modal-content">
|
|
|
+ <div class="modal-header">
|
|
|
+ <h5 class="modal-title">审批流程</h5>
|
|
|
+ </div>
|
|
|
+ <div class="modal-body">
|
|
|
+ <div class="row">
|
|
|
+ <div class="col-4 modal-height-500" style="overflow: auto">
|
|
|
+ <div class="card mt-3">
|
|
|
+ <ul class="list-group list-group-flush" id="auditor-list">
|
|
|
+ </ul>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="col-8 modal-height-500" style="overflow: auto" id="audit-list">
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="modal-footer">
|
|
|
+ <button type="button" class="btn btn-secondary btn-sm" data-dismiss="modal">关闭</button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</div>
|
|
|
+<% if (settles.length > 0 && settles[0].user_id === ctx.session.sessionUser.accountId) { %>
|
|
|
+<!--设置-->
|
|
|
+<div class="modal fade" id="edit" data-backdrop="static">
|
|
|
+ <div class="modal-dialog" role="document">
|
|
|
+ <form class="modal-content" action="/tender/<%- ctx.tender.id %>/settle/save" method="post" onsubmit="return checkValidSettle(this);">
|
|
|
+ <div class="modal-header">
|
|
|
+ <h5 class="modal-title">期编辑</h5>
|
|
|
+ </div>
|
|
|
+ <div class="modal-body">
|
|
|
+ <div class="form-group">
|
|
|
+ <label>期</label>
|
|
|
+ <input class="form-control form-control-sm" id="edit-name" value="第 <%- stages[0].order %> 期" type="text" readonly="" name="name">
|
|
|
+ </div>
|
|
|
+ <div class="form-group">
|
|
|
+ <label>结算年月<b class="text-danger">*</b></label>
|
|
|
+ <input class="datepicker-here form-control form-control-sm" autocomplete="off" readonly name="date" placeholder="点击选择年月" data-view="months" data-min-view="months" data-date-format="yyyy-MM" data-language="zh" type="text">
|
|
|
+ </div>
|
|
|
+ <div class="form-group">
|
|
|
+ <label>结算周期<b class="text-danger">*</b></label>
|
|
|
+ <input class="datepicker-here form-control form-control-sm" autocomplete="off" readonly name="period" placeholder="点击选择时间" data-range="true" data-multiple-dates-separator=" ~ " data-language="zh" type="text">
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="modal-footer">
|
|
|
+ <input type="hidden" name="_csrf_j" value="<%= ctx.csrf %>" />
|
|
|
+ <input type="hidden" name="order" id="edit-order" value="<%- stages[0].order %>">
|
|
|
+ <button type="button" class="btn btn-secondary btn-sm" data-dismiss="modal">关闭</button>
|
|
|
+ <button type="submit" class="btn btn-primary btn-sm" id="edit-ok" >确定修改</button>
|
|
|
+ </div>
|
|
|
+ </form>
|
|
|
+ </div>
|
|
|
+</div>
|
|
|
+<% } %>
|
|
|
+<script src="/public/js/datepicker/datepicker.min.js"></script>
|
|
|
+<script src="/public/js/datepicker/datepicker.zh.js"></script>
|
|
|
+<script src="/public/js/moment/moment.min.js"></script>
|
|
|
+<script>
|
|
|
+ const tenderId = '<%- ctx.tender.id %>';
|
|
|
+ const auditConst = JSON.parse('<%- JSON.stringify(auditConst) %>');
|
|
|
+ const auditType = JSON.parse('<%- JSON.stringify(auditType) %>');
|
|
|
+ $('.datepicker-here').datepicker({
|
|
|
+ autoClose: true,
|
|
|
+ });
|
|
|
+
|
|
|
+ $('.edit-stage').on('click', function () {
|
|
|
+ const index = parseInt($(this).data('index'));
|
|
|
+ const editDate = $('#edit-date').datepicker().data('datepicker');
|
|
|
+ $('#edit-name').val('第 ' + stages[index].order + ' 期');
|
|
|
+ $('#edit-order').val(stages[index].order);
|
|
|
+ if (stages[index].s_time && stages[index].s_time !== '') {
|
|
|
+ editDate.selectDate(new Date(stages[index].s_time));
|
|
|
+ }
|
|
|
+ const period = [];
|
|
|
+ for (const p of stages[index].period.split('~')) {
|
|
|
+ if (p && p !== '') {
|
|
|
+ period.push(new Date(p));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ const editPeriod = $('#edit-period').datepicker().data('datepicker');
|
|
|
+ if (period.length > 0) {
|
|
|
+ editPeriod.selectDate(period);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ function checkValidSettle(obj) {
|
|
|
+ const date = $('input[name=date]', obj).val();
|
|
|
+ if (date === '') {
|
|
|
+ toastr.error('请选择结算年月');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ const period = $('input[name=period]', obj).val();
|
|
|
+ if (period === '') {
|
|
|
+ toastr.error('请选择结算周期');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ const startDate = period.split('~')[0];
|
|
|
+ const endDate = period.split('~')[1] ? period.split('~')[1] : null;
|
|
|
+
|
|
|
+ if ((startDate.indexOf(date) === -1 && !endDate) || (startDate.indexOf(date) === -1 && endDate && endDate.indexOf(date) === -1)) {
|
|
|
+ toastr.error('所选日期与当前月份不匹配,请重新选择');
|
|
|
+ $('input[name="period"]', obj).parents('.form-group').find('.text-danger').remove();
|
|
|
+ $('input[name="period"]', obj).parents('.form-group').append('<small class="text-danger">所选日期与当前月份不匹配,请重新选择</small>');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ $('#audit-list').on('click', 'a', function() {
|
|
|
+ const type = $(this).data('target')
|
|
|
+ const auditCard = $(this).parent().parent()
|
|
|
+ if (type === 'show') {
|
|
|
+ $(this).data('target', 'hide')
|
|
|
+ auditCard.find('.fold-card').slideDown('swing', () => {
|
|
|
+ auditCard.find('#end-target').text($(this).data('idx') + '#')
|
|
|
+ auditCard.find('#fold-btn').text('收起历史审核记录')
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ $(this).data('target', 'show')
|
|
|
+ auditCard.find('.fold-card').slideUp('swing', () => {
|
|
|
+ auditCard.find('#end-target').text('1#')
|
|
|
+ auditCard.find('#fold-btn').text('展开历史审核记录')
|
|
|
+ })
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ const getGroupAuditHtml = function (group) {
|
|
|
+ return group.map(u => { return `<small class="d-inline-block text-dark mx-1" title="${u.role}" data-auditorId="${u.aid}">${u.name}</small>`; }).join('');
|
|
|
+ };
|
|
|
+ const getAuditTypeHtml = function (type) {
|
|
|
+ if (type === auditType.key.common) return '';
|
|
|
+ return `<div class="li-subscript"><span class="badge badge-pill badge-${auditType.info[type].class} p-1 badge-bg-small"><small>${auditType.info[type].short}</small></span></div>`;
|
|
|
+ };
|
|
|
+ const getAuditTypeText = function (type) {
|
|
|
+ if (type === auditType.key.common) return '';
|
|
|
+ return `<span class="text-${auditType.info[type].class}">${auditType.info[type].long}</span>`;
|
|
|
+ };
|
|
|
+ const getAuditorsHtml = function (auditors) {
|
|
|
+ const auditorsHTML = [];
|
|
|
+ auditors.forEach((group, idx) => {
|
|
|
+ if (idx === 0) {
|
|
|
+ auditorsHTML.push(`<li class="list-group-item d-flex justify-content-between align-items-center">
|
|
|
+ <span class="mr-1"><i class="fa fa fa-play-circle fa-rotate-90"></i></span>
|
|
|
+ <span class="text-muted">${getGroupAuditHtml(group)}</span>
|
|
|
+ <span class="badge badge-light badge-pill ml-auto"><small>原报</small></span>
|
|
|
+ </li>`);
|
|
|
+ } else if(idx === auditors.length -1 && idx !== 0) {
|
|
|
+ auditorsHTML.push(`<li class="list-group-item d-flex justify-content-between align-items-center">
|
|
|
+ <span class="mr-1"><i class="fa fa fa-stop-circle fa-rotate-90"></i></span>
|
|
|
+ <span class="text-muted">${getGroupAuditHtml(group)}</span>
|
|
|
+ <div class="d-flex ml-auto">
|
|
|
+ ${getAuditTypeHtml(group[0].audit_type)}
|
|
|
+ <span class="badge badge-light badge-pill ml-auto"><small>终审</small></span>
|
|
|
+ </div>
|
|
|
+ </li>`);
|
|
|
+ } else {
|
|
|
+ auditorsHTML.push(`<li class="list-group-item d-flex justify-content-between align-items-center">
|
|
|
+ <span class="mr-1"><i class="fa fa fa-chevron-circle-down"></i></span>
|
|
|
+ <span class="text-muted">${getGroupAuditHtml(group)}</span>
|
|
|
+ <div class="d-flex ml-auto">
|
|
|
+ ${getAuditTypeHtml(group[0].audit_type)}
|
|
|
+ <span class="badge badge-light badge-pill"><small>${transFormToChinese(idx)}审</small></span>
|
|
|
+ </div>
|
|
|
+ </li>`);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return auditorsHTML;
|
|
|
+ }
|
|
|
+ const getAuditHistroyHtml = function (auditHistory) {
|
|
|
+ const historyHTML = [];
|
|
|
+ auditHistory.forEach((his, idx) => {
|
|
|
+ if (idx === auditHistory.length - 1 && auditHistory.length !== 1) {
|
|
|
+ historyHTML.push(`<div class="text-right"><a href="javascript: void(0);" id="fold-btn" data-target="show">展开历史审批流程</a></div>`);
|
|
|
+ }
|
|
|
+ historyHTML.push(`<div class="${idx < auditHistory.length - 1 ? 'fold-card' : ''}">`);
|
|
|
+ historyHTML.push(`<div class="text-center text-muted">${idx+1}#</div>`);
|
|
|
+ historyHTML.push(`<ul class="timeline-list list-unstyled mt-2 ${ idx === auditHistory.length - 1 && auditHistory.length !== 1 ? 'last-auditor-list' : '' }">`);
|
|
|
+ his.forEach((group) => {
|
|
|
+ historyHTML.push(`<li class="timeline-list-item pb-2 ${ group.status === auditConst.status.uncheck && idx === auditHistory.length - 1 && auditHistory.length !== 1 ? 'is_uncheck' : ''}">`);
|
|
|
+ if (group.auditYear) {
|
|
|
+ historyHTML.push(`<div class="timeline-item-date">${group.auditYear}<span>${group.auditDate}</span><span>${group.auditTime}</span></div>`);
|
|
|
+ }
|
|
|
+ if (group.audit_order < his.length - 1) {
|
|
|
+ historyHTML.push('<div class="timeline-item-tail"></div>');
|
|
|
+ }
|
|
|
+ if (group.status === auditConst.status.checked) {
|
|
|
+ historyHTML.push('<div class="timeline-item-icon bg-success text-light"><i class="fa fa-check"></i></div>');
|
|
|
+ } else if (group.status === auditConst.status.checkNo || group.status === auditConst.status.checkNoPre || group.status === auditConst.status.checkCancel) {
|
|
|
+ historyHTML.push('<div class="timeline-item-icon bg-warning text-light"><i class="fa fa-level-up"></i></div>');
|
|
|
+ } else if (group.status === auditConst.status.checking) {
|
|
|
+ historyHTML.push('<div class="timeline-item-icon bg-warning text-light"><i class="fa fa-ellipsis-h"></i></div>');
|
|
|
+ } else {
|
|
|
+ historyHTML.push('<div class="timeline-item-icon bg-secondary text-light"></div>');
|
|
|
+ }
|
|
|
+
|
|
|
+ historyHTML.push('<div class="timeline-item-content">');
|
|
|
+ if (group.audit_order > 0) {
|
|
|
+ const statuStr = group.status !== auditConst.status.uncheck ?
|
|
|
+ `<span class="pull-right ${auditConst.statusClass[group.status]}">${auditConst.statusString[group.status]}</span>` : '';
|
|
|
+ historyHTML.push(`<div class="py-1">
|
|
|
+ <span class="text-black-50">
|
|
|
+ ${ !group.is_final ? group.audit_order + '' : '终' }审 ${getAuditTypeText(group.audit_type)}
|
|
|
+ </span>
|
|
|
+ ${statuStr}
|
|
|
+ </div>`);
|
|
|
+ } else {
|
|
|
+ historyHTML.push(` <div class="py-1">
|
|
|
+ <span class="text-black-50">原报</span>
|
|
|
+ <span class="pull-right text-success">${idx !== 0 ? '重新' : '' }上报审批</span>
|
|
|
+ </div>`);
|
|
|
+ }
|
|
|
+ historyHTML.push('<div class="card"><div class="card-body px-3 py-0">');
|
|
|
+ for (const [i, auditor] of group.auditors.entries()) {
|
|
|
+ historyHTML.push(`<div class="card-text p-2 py-3 row ${ ( i > 0 ? 'border-top' : '') }">`);
|
|
|
+ historyHTML.push(`<div class="col"><span class="h6">${auditor.name}</span><span class="text-muted ml-1">${auditor.role}</span></div>`);
|
|
|
+ historyHTML.push('<div class="col">');
|
|
|
+ if (auditor.status === auditConst.status.checked) {
|
|
|
+ historyHTML.push('<span class="pull-right text-success"><i class="fa fa-check-circle"></i></span>');
|
|
|
+ } if (auditor.status === auditConst.status.checkNo || auditor.status === auditConst.status.checkNoPre || auditor.status === auditConst.status.checkCancel) {
|
|
|
+ historyHTML.push('<span class="pull-right text-warning"><i class="fa fa-share-square fa-rotate-270"></i></span>');
|
|
|
+ }
|
|
|
+ historyHTML.push('</div>');
|
|
|
+ if (group.audit_order > 0 && auditor.opinion) {
|
|
|
+ historyHTML.push(`<div class="col-12 py-1 bg-light"><i class="fa fa-commenting-o mr-1"></i>${auditor.opinion}</div>`);
|
|
|
+ }
|
|
|
+ historyHTML.push('</div>');
|
|
|
+ }
|
|
|
+ historyHTML.push('</div></div>');
|
|
|
+ historyHTML.push('</div>');
|
|
|
+ historyHTML.push('</li>');
|
|
|
+ });
|
|
|
+ historyHTML.push('</div>');
|
|
|
+ historyHTML.push('</ul>');
|
|
|
+ });
|
|
|
+ return historyHTML.join('');
|
|
|
+ }
|
|
|
+ // 获取审批流程
|
|
|
+ $('a[data-target="#sp-list" ]').on('click', function () {
|
|
|
+ postData('/tender/' + tenderId + '/settle/auditors', { order: $(this).attr('s-order') }, function (result) {
|
|
|
+ $('#auditor-list').html(getAuditorsHtml(result.hisUserGroup));
|
|
|
+ $('#audit-list').html(getAuditHistroyHtml(result.auditHistory));
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ $(window).resize(checkTableWidth);
|
|
|
+ function checkTableWidth() {
|
|
|
+ if($('table th[name=contract_tp]').outerWidth() < 107) {
|
|
|
+ $('table th[name=contract_tp]').html('本期<br>合同计量');
|
|
|
+ $('table th[name=qc_tp]').html('本期数量<br>变更计量');
|
|
|
+ $('table th[name=tp]').html('本期<br>完成计量');
|
|
|
+ $('table th[name=pre_tp]').html('截止上期<br>完成计量');
|
|
|
+ $('table th[name=end_tp]').html('截止本期<br>完成计量');
|
|
|
+ } else {
|
|
|
+ $('table th[name=contract_tp]').html('本期合同计量');
|
|
|
+ $('table th[name=qc_tp]').html('本期数量变更计量');
|
|
|
+ $('table th[name=tp]').html('本期完成计量');
|
|
|
+ $('table th[name=pre_tp]').html('截止上期完成计量');
|
|
|
+ $('table th[name=end_tp]').html('截止本期完成计量');
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ $(function () {
|
|
|
+ checkTableWidth();
|
|
|
+ });
|
|
|
+</script>
|