| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278 | 
							- 'use strict';
 
- /**
 
-  *
 
-  *
 
-  * @author lanjianrong
 
-  * @date 2020/8/12
 
-  * @version
 
-  */
 
- $(document).ready(function () {
 
-     if (!advancePayTotal) {
 
-         $('#erro').modal('show');
 
-     }
 
-     // $('#advance_add').click(function() {
 
-     //     postData(`${window.location.pathname}/${type}/create`, {}, res => {
 
-     //         const html = `<tr>
 
-     //             <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 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>${auditConst.statusString[res.status]}</td>
 
-     //             <td><a href="/tender/${res.tid}/advance/${res.id}/detail" class="btn btn-primary btn-sm">编辑</a></td>
 
-     //             </tr>`
 
-     //         $('#advanceList').prepend(html)
 
-     //         $('#advance_add').remove()
 
-     //         window.location.href = `${window.location.pathname}/${res.id}/detail`
 
-     //     })
 
-     //     return false
 
-     // })
 
-     $('#advanceList').on('click', `a[href="#file"]`, function() {
 
-         const { fileList = [] } = advanceList.find(item => item.id === parseInt($(this).data('id')))
 
-         $('#file-content').empty()
 
-         let html = `<thead>
 
-                             <tr>
 
-                                 <th width="70%">文件名</th>
 
-                                 <th width="20%">上传时间</th>
 
-                                 <th width="10%">操作</th>
 
-                             </tr>
 
-                         </thead>`
 
-         fileList.forEach(file => {
 
-             html+= `<tr>
 
-                             <td>${file.filename}</td>
 
-                             <td>${new Date(file.create_time).toLocaleDateString()}</td>
 
-                             <td>
 
-                                 <a href="/${file.filepath}" target="_blank" title="下载"><i class="fa fa-download"></i></a>
 
-                             </td>
 
-                         </tr>`
 
-         })
 
-         $('#file-content').append(html)
 
-     })
 
-     $('a[data-target="#sp-list" ]').on('click', function () {
 
-         const id = $(this).data('vid')
 
-         postData(`${window.location.pathname.replace('/material', '')}/${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) => {
 
-                 if(idx === auditHistory.length - 1 && auditHistory.length !== 1) {
 
-                     historyHTML += `<div class="text-right"><a href="javascript: void(0);" id="fold-btn" data-target="show"
 
-                     >展开历史审批流程</a></div>`
 
-                 }
 
-                 historyHTML += `<div class="${idx < auditHistory.length - 1 ? 'fold-card' : ''}">
 
-                 <div class="text-center text-muted">${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>'
 
-             })
 
-             $('#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];
 
-         let t = '';
 
-         for (let i = 0; i < l.length; i++) {
 
-             t += l[i] + ((i + 1) % 3 == 0 && (i + 1) != l.length ? dot : '');
 
-         }
 
-         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>`;
 
-     }
 
- })
 
 
  |