|
@@ -14,9 +14,9 @@ $(document).ready(function () {
|
|
const html = `<tr>
|
|
const html = `<tr>
|
|
<td><a href="/tender/${res.tid}/advance/${res.id}/detail" data-id="${res.id}">第${res.order}期</a></td>
|
|
<td><a href="/tender/${res.tid}/advance/${res.id}/detail" data-id="${res.id}">第${res.order}期</a></td>
|
|
<td>${res.pay_ratio || 0}%</td>
|
|
<td>${res.pay_ratio || 0}%</td>
|
|
- <td class="text-right">${formatMoney(res.cur_amount || 0)}</td>
|
|
|
|
- <td class="text-right">${formatMoney(res.prev_amount || 0)}</td>
|
|
|
|
- <td class="text-right">${formatMoney(res.prev_total_amount || 0)}</td>
|
|
|
|
|
|
+ <td class="text-right">${formatMoney((res.cur_amount || 0), ',', decimal)}</td>
|
|
|
|
+ <td class="text-right">${formatMoney((res.prev_amount || 0), ',', decimal)}</td>
|
|
|
|
+ <td class="text-right">${formatMoney((res.prev_total_amount || 0),',', decimal)}</td>
|
|
<td><a class="btn btn-sm" href="#file" data-toggle="modal" data-target="#file"><i class="fa fa-paperclip "></i> 3</a></td>
|
|
<td><a class="btn btn-sm" href="#file" data-toggle="modal" data-target="#file"><i class="fa fa-paperclip "></i> 3</a></td>
|
|
<td>${auditConst.statusString[res.status]}</td>
|
|
<td>${auditConst.statusString[res.status]}</td>
|
|
<td><a href="/tender/${res.tid}/advance/${res.id}/detail" class="btn btn-primary btn-sm">编辑</a></td>
|
|
<td><a href="/tender/${res.tid}/advance/${res.id}/detail" class="btn btn-primary btn-sm">编辑</a></td>
|
|
@@ -49,15 +49,226 @@ $(document).ready(function () {
|
|
})
|
|
})
|
|
$('#file-content').append(html)
|
|
$('#file-content').append(html)
|
|
})
|
|
})
|
|
- function formatMoney(s, dot = ',') {
|
|
|
|
- if (!s) return '0.00';
|
|
|
|
- s = parseFloat((s + '').replace(/[^\d\.-]/g, '')).toFixed(2) + '';
|
|
|
|
- let l = s.split('.')[0].split('').reverse(),
|
|
|
|
|
|
+
|
|
|
|
+ $('a[data-target="#sp-list" ]').on('click', function () {
|
|
|
|
+ const id = $(this).data('vid')
|
|
|
|
+ postData(`${window.location.pathname}/${id}/auditors`, {}, (res) => {
|
|
|
|
+ const { auditHistory, auditors, user } = res
|
|
|
|
+ let auditorsHTML = ''
|
|
|
|
+ let historyHTML = ''
|
|
|
|
+ auditors.forEach((auditor, idx) => {
|
|
|
|
+ if (idx === 0) {
|
|
|
|
+ auditorsHTML += `<li class="list-group-item">
|
|
|
|
+ <i class="fa fa fa-play-circle fa-rotate-90"></i> ${auditor.name}
|
|
|
|
+ <small class="text-muted">${auditor.role}</small>
|
|
|
|
+ <span class="pull-right">原报</span>
|
|
|
|
+ </li>`
|
|
|
|
+ } else if(idx === auditors.length -1 && idx !== 0) {
|
|
|
|
+ auditorsHTML += `<li class="list-group-item">
|
|
|
|
+ <i class="fa fa fa-stop-circle"></i> ${auditor.name}
|
|
|
|
+ <small class="text-muted">${auditor.role}</small>
|
|
|
|
+ <span class="pull-right">终审</span>
|
|
|
|
+ </li>`
|
|
|
|
+ } else {
|
|
|
|
+ auditorsHTML += `<li class="list-group-item">
|
|
|
|
+ <i class="fa fa-chevron-circle-down"></i> ${auditor.name}
|
|
|
|
+ <small class="text-muted">${auditor.role}</small>
|
|
|
|
+ <span class="pull-right">${transFormToChinese(idx)}审</span>
|
|
|
|
+ </li>`
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ $('#auditor-list').empty()
|
|
|
|
+ $('#auditor-list').append(auditorsHTML)
|
|
|
|
+ auditHistory.forEach((auditors, idx) => {
|
|
|
|
+ historyHTML += `<div class="${idx < auditHistory.length - 1 ? 'fold-card' : ''}">
|
|
|
|
+ <div class="text-center text-muted"
|
|
|
|
+ ${idx === auditHistory.length - 1 ? 'id="end-target"' : ""}>
|
|
|
|
+ ${idx === auditHistory.length - 1 ? 1 : idx+1}#</div>
|
|
|
|
+ <ul class="timeline-list list-unstyled mt-2">`
|
|
|
|
+ auditors.forEach((auditor, index) => {
|
|
|
|
+ if (index === 0) {
|
|
|
|
+ historyHTML += `<li class="timeline-list-item pb-2">
|
|
|
|
+ <div class="timeline-item-date">
|
|
|
|
+ ${formatDate(auditor.create_time)}
|
|
|
|
+ </div>
|
|
|
|
+ <div class="timeline-item-tail"></div>
|
|
|
|
+ <div class="timeline-item-icon bg-success text-light">
|
|
|
|
+ <i class="fa fa-caret-down"></i>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="timeline-item-content">
|
|
|
|
+ <div class="card">
|
|
|
|
+ <div class="card-body p-3">
|
|
|
|
+ <div class="card-text">
|
|
|
|
+ <p class="mb-1"><span
|
|
|
|
+ class="h5">${user.name}</span><span
|
|
|
|
+ class="pull-right text-success">${idx !== 0 ? '重新' : ''}上报审批</span>
|
|
|
|
+ </p>
|
|
|
|
+ <p class="text-muted mb-0">${user.role}</p>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ </li>
|
|
|
|
+ <li class="timeline-list-item pb-2">
|
|
|
|
+ <div class="timeline-item-date">
|
|
|
|
+ ${formatDate(auditor.end_time)}
|
|
|
|
+ </div>`
|
|
|
|
+
|
|
|
|
+ if(index < auditors.length - 1) {
|
|
|
|
+ historyHTML += `<div class="timeline-item-tail"></div>`
|
|
|
|
+ }
|
|
|
|
+ if(auditor.status === auditConst.status.checked) {
|
|
|
|
+ historyHTML += `<div class="timeline-item-icon bg-success text-light">
|
|
|
|
+ <i class="fa fa-check"></i>
|
|
|
|
+ </div>`
|
|
|
|
+
|
|
|
|
+ } else if(auditor.status === auditConst.status.checkNo || auditor.status === auditConst.status.checkNoPre) {
|
|
|
|
+ historyHTML += `<div class="timeline-item-icon bg-warning text-light">
|
|
|
|
+ <i class="fa fa-level-up"></i>
|
|
|
|
+ </div>`
|
|
|
|
+ } else if(auditor.status === auditConst.status.checking) {
|
|
|
|
+ historyHTML += `<div class="timeline-item-icon bg-warning text-light">
|
|
|
|
+ <i class="fa fa-ellipsis-h"></i>
|
|
|
|
+ </div>`
|
|
|
|
+ } else {
|
|
|
|
+ historyHTML += `<div class="timeline-item-icon bg-secondary text-light"></div>`
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ historyHTML += `<div class="timeline-item-content">
|
|
|
|
+ <div class="card">
|
|
|
|
+ <div class="card-body p-3">
|
|
|
|
+ <div class="card-text">
|
|
|
|
+ <p class="mb-1"><span class="h5">${auditor.name}</span><span
|
|
|
|
+ class="pull-right ${auditConst.statusClass[auditor.status]}">${auditConst.statusString[auditor.status]}</span>
|
|
|
|
+ </p>
|
|
|
|
+ <p class="text-muted mb-0">${auditor.role}</p>
|
|
|
|
+ </div>
|
|
|
|
+ </div>`
|
|
|
|
+ if (auditor.opinion) {
|
|
|
|
+ historyHTML += `<div class="card-body p-3 border-top">
|
|
|
|
+ <p style="margin: 0;">${auditor.opinion}</p>
|
|
|
|
+ </div>`
|
|
|
|
+ }
|
|
|
|
+ historyHTML += `</div></div></li>`
|
|
|
|
+ } else {
|
|
|
|
+ historyHTML += `<li class="timeline-list-item pb-2">
|
|
|
|
+ <div class="timeline-item-date">
|
|
|
|
+ ${formatDate(auditor.end_time)}
|
|
|
|
+ </div>`
|
|
|
|
+
|
|
|
|
+ if(index < auditors.length - 1) {
|
|
|
|
+ historyHTML += `<div class="timeline-item-tail"></div>`
|
|
|
|
+ }
|
|
|
|
+ if(auditor.status === auditConst.status.checked) {
|
|
|
|
+ historyHTML += `<div class="timeline-item-icon bg-success text-light">
|
|
|
|
+ <i class="fa fa-check"></i>
|
|
|
|
+ </div>`
|
|
|
|
+ } else if(auditor.status === auditConst.status.checkNo || auditor.status === auditConst.status.checkNoPre) {
|
|
|
|
+ historyHTML += `<div class="timeline-item-icon bg-warning text-light">
|
|
|
|
+ <i class="fa fa-level-up"></i>
|
|
|
|
+ </div>`
|
|
|
|
+
|
|
|
|
+ } else if(auditor.status === auditConst.status.checking) {
|
|
|
|
+ historyHTML += `<div class="timeline-item-icon bg-warning text-light">
|
|
|
|
+ <i class="fa fa-ellipsis-h"></i>
|
|
|
|
+ </div>`
|
|
|
|
+ } else {
|
|
|
|
+ historyHTML += `<div class="timeline-item-icon bg-secondary text-light"></div>`
|
|
|
|
+ }
|
|
|
|
+ historyHTML += `<div class="timeline-item-content">
|
|
|
|
+ <div class="card">
|
|
|
|
+ <div class="card-body p-3">
|
|
|
|
+ <div class="card-text">
|
|
|
|
+ <p class="mb-1"><span class="h5">${auditor.name}</span>
|
|
|
|
+ <span
|
|
|
|
+ class="pull-right
|
|
|
|
+ ${auditConst.statusClass[auditor.status]}">${auditor.status !== auditConst.status.uncheck ? auditConst.statusString[auditor.status] : ''}
|
|
|
|
+ ${auditor.status === auditConst.status.checkNo ? user.name : ''}
|
|
|
|
+ ${auditor.status === auditConst.status.checkNoPre ? auditors[index-1].name : ''}
|
|
|
|
+ </span>
|
|
|
|
+ </p>
|
|
|
|
+ <p class="text-muted mb-0">${auditor.role}</p>
|
|
|
|
+ </div>
|
|
|
|
+ </div>`
|
|
|
|
+
|
|
|
|
+ if (auditor.opinion) {
|
|
|
|
+ historyHTML += `<div class="card-body p-3 border-top">
|
|
|
|
+ <p style="margin: 0;">${auditor.opinion} </p>
|
|
|
|
+ </div>`
|
|
|
|
+ }
|
|
|
|
+ historyHTML += `</div></div></li>`
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ historyHTML += '</ul></div>'
|
|
|
|
+ if(idx === auditHistory.length - 1 && auditHistory.length !== 1) {
|
|
|
|
+ historyHTML += `<div class="text-right"><a href="javascript: void(0);" id="fold-btn" data-target="show"
|
|
|
|
+ data-idx="${idx + 1}">展开历史审批流程</a></div>`
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ $('#audit-list').empty()
|
|
|
|
+ $('#audit-list').append(historyHTML)
|
|
|
|
+ })
|
|
|
|
+ })
|
|
|
|
+ function formatMoney(s, dot = ',', decimal = 2) {
|
|
|
|
+ if (!s) {
|
|
|
|
+ s = 0;
|
|
|
|
+ return s.toFixed(decimal);
|
|
|
|
+ }
|
|
|
|
+ s = parseFloat((s + '').replace(/[^\d\.-]/g, '')).toFixed(decimal) + '';
|
|
|
|
+ if (!decimal) {
|
|
|
|
+ s += '.';
|
|
|
|
+ }
|
|
|
|
+ const l = s.split('.')[0].split('').reverse(),
|
|
r = s.split('.')[1];
|
|
r = s.split('.')[1];
|
|
let t = '';
|
|
let t = '';
|
|
for (let i = 0; i < l.length; i++) {
|
|
for (let i = 0; i < l.length; i++) {
|
|
t += l[i] + ((i + 1) % 3 == 0 && (i + 1) != l.length ? dot : '');
|
|
t += l[i] + ((i + 1) % 3 == 0 && (i + 1) != l.length ? dot : '');
|
|
}
|
|
}
|
|
- return t.split('').reverse().join('') + '.' + r;
|
|
|
|
|
|
+ return t.split('').reverse().join('') + (decimal === 0 ? '' : '.' + r);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ function transFormToChinese(num) {
|
|
|
|
+ const changeNum = ['零', '一', '二', '三', '四', '五', '六', '七', '八', '九'];
|
|
|
|
+ const unit = ['', '十', '百', '千', '万'];
|
|
|
|
+ num = parseInt(num);
|
|
|
|
+ const getWan = temp => {
|
|
|
|
+ const strArr = temp.toString().split('').reverse();
|
|
|
|
+ let newNum = '';
|
|
|
|
+ for (let i = 0; i < strArr.length; i++) {
|
|
|
|
+ newNum = (i == 0 && strArr[i] == 0 ? '' : (i > 0 && strArr[i] == 0 && strArr[i - 1] == 0 ? '' : changeNum[strArr[i]] + (strArr[i] == 0 ? unit[0] : unit[i]))) + newNum;
|
|
|
|
+ }
|
|
|
|
+ return strArr.length === 2 && newNum.indexOf('一十') !== -1 ? newNum.replace('一十', '十') : newNum;
|
|
|
|
+ };
|
|
|
|
+ const overWan = Math.floor(num / 10000);
|
|
|
|
+ let noWan = num % 10000;
|
|
|
|
+ if (noWan.toString().length < 4) noWan = '0' + noWan;
|
|
|
|
+ return overWan ? getWan(overWan) + '万' + getWan(noWan) : getWan(num);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ function formatDate(date) {
|
|
|
|
+ if (!date) return '';
|
|
|
|
+ date = new Date(date)
|
|
|
|
+ const year = date.getFullYear();
|
|
|
|
+ let mon = date.getMonth() + 1;
|
|
|
|
+ let day = date.getDate();
|
|
|
|
+ let hour = date.getHours();
|
|
|
|
+ let minute = date.getMinutes();
|
|
|
|
+ let scond = date.getSeconds();
|
|
|
|
+ if (mon < 10) {
|
|
|
|
+ mon = '0' + mon.toString();
|
|
|
|
+ }
|
|
|
|
+ if (day < 10) {
|
|
|
|
+ day = '0' + day.toString();
|
|
|
|
+ }
|
|
|
|
+ if (hour < 10) {
|
|
|
|
+ hour = '0' + hour.toString();
|
|
|
|
+ }
|
|
|
|
+ if (minute < 10) {
|
|
|
|
+ minute = '0' + minute.toString();
|
|
|
|
+ }
|
|
|
|
+ if (scond < 10) {
|
|
|
|
+ scond = '0' + scond.toString();
|
|
|
|
+ }
|
|
|
|
+ return `${year}<span>${mon}-${day}</span><span>${hour}:${minute}:${scond}</span>`;
|
|
}
|
|
}
|
|
})
|
|
})
|