|
@@ -0,0 +1,297 @@
|
|
|
|
+'use strict';
|
|
|
|
+
|
|
|
|
+const tenderListSpec = (function(){
|
|
|
|
+ function getTenderNodeHtml(node, arr, pid) {
|
|
|
|
+ const html = [];
|
|
|
|
+ html.push('<tr pid="' + pid + '" data-tid="'+ (!node.cid ? node.id : -1) +'"' + (!node.cid ? 'class="tender-info" data-id="'+ node.id +'" style="cursor: pointer;"' : '') + '>');
|
|
|
|
+ // 名称
|
|
|
|
+ html.push('<td style="min-width: 150px;" class="in-' + node.level + '">');
|
|
|
|
+ if (node.cid) {
|
|
|
|
+ html.push('<span onselectstart="return false" style="{-moz-user-select:none}" class="fold-switch mr-1" title="收起" cid="'+ node.sort_id +'"><i class="fa fa-minus-square-o"></i></span> <i class="fa fa-folder-o"></i> ');
|
|
|
|
+ html.push((node.level === 1 ? '<b>' : ''), node.name, (node.level === 1 ? '</b>' : ''));
|
|
|
|
+ } else {
|
|
|
|
+ html.push('<span class="text-muted mr-2">');
|
|
|
|
+ html.push(arr.indexOf(node) === arr.length - 1 ? '└' : '├');
|
|
|
|
+ html.push('</span>');
|
|
|
|
+ html.push(node.name);
|
|
|
|
+ }
|
|
|
|
+ html.push('</td>');
|
|
|
|
+ // 累计划拨
|
|
|
|
+ html.push('<td class="text-right" style="width: 15%">');
|
|
|
|
+ if (!node.cid) {
|
|
|
|
+ html.push(node.transfer_amount ? node.transfer_amount : '');
|
|
|
|
+ }
|
|
|
|
+ html.push('</td>');
|
|
|
|
+ // 累计支付
|
|
|
|
+ html.push('<td class="text-right" style="width: 15%">');
|
|
|
|
+ if (!node.cid) {
|
|
|
|
+ html.push(node.pay_amount ? node.pay_amount : '');
|
|
|
|
+ }
|
|
|
|
+ html.push('</td>');
|
|
|
|
+ // 支付次数
|
|
|
|
+ html.push('<td class="text-center" style="width: 15%">');
|
|
|
|
+ if (!node.cid) {
|
|
|
|
+ html.push(node.pay_num ? node.pay_num : '');
|
|
|
|
+ }
|
|
|
|
+ html.push('</td>');
|
|
|
|
+ html.push('</tr>');
|
|
|
|
+ return html.join('');
|
|
|
|
+ }
|
|
|
|
+ function getTenderTreeHeaderHtml() {
|
|
|
|
+ const html = [];
|
|
|
|
+ const left = $('#sub-menu').css('display') === 'none' ? 56 : 176;
|
|
|
|
+ html.push('<table class="table table-hover table-bordered" id="progress-table">')
|
|
|
|
+ html.push('<thead style="position: sticky;left:'+ left +'px;top: 0;">', '<tr>');
|
|
|
|
+ html.push('<th class="text-center" style="min-width: 150px;">', '标段名称', '</th>');
|
|
|
|
+ html.push('<th class="text-center" style="width: 15%">', '累计划拨', '</th>');
|
|
|
|
+ html.push('<th class="text-center" style="width: 15%">', '累计支付', '</th>');
|
|
|
|
+ html.push('<th class="text-center" style="width: 15%">', '支付次数', '</th>');
|
|
|
|
+ html.push('</tr>', '</thead>');
|
|
|
|
+ return html.join('');
|
|
|
|
+ }
|
|
|
|
+ return { getTenderNodeHtml, getTenderTreeHeaderHtml }
|
|
|
|
+})();
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+let auditUtils;
|
|
|
|
+$(function () {
|
|
|
|
+ autoFlashHeight();
|
|
|
|
+
|
|
|
|
+ $('#company_select').change(function () {
|
|
|
|
+ const company_id = parseInt($(this).val()) || 0;
|
|
|
|
+ setSelectValue('company', company_id);
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ $('#order_select').change(function () {
|
|
|
|
+ const qi = parseInt($(this).val()) || 0;
|
|
|
|
+ setSelectValue('qi', qi);
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ function setSelectValue(select, value) {
|
|
|
|
+ const routes = [];
|
|
|
|
+ const company_id = select === 'company' ? value : parseInt($('#company_select').val());
|
|
|
|
+ if (company_id) {
|
|
|
|
+ const companyInfo = _.find(userCompanyList, { id: company_id });
|
|
|
|
+ if (companyInfo) routes.push('company=' + companyInfo.name);
|
|
|
|
+ }
|
|
|
|
+ const qi = select === 'qi' ? value : parseInt($('#order_select').val());
|
|
|
|
+ if (qi) {
|
|
|
|
+ routes.push('qi=' + qi);
|
|
|
|
+ }
|
|
|
|
+ if (getLocalCache('account-pageSize')) {
|
|
|
|
+ routes.push('pageSize=' + getLocalCache('account-pageSize'));
|
|
|
|
+ }
|
|
|
|
+ window.location.href = `/sp/${spid}/financial/pay/stage` + (routes.length ? '?' + routes.join('&') : '');
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ $('body').on('click', '.c-body .tender-info', function () {
|
|
|
|
+ $('.c-body .tender-info').removeClass('table-warning');
|
|
|
|
+ $(this).addClass('table-warning');
|
|
|
|
+ const tid = parseInt($(this).attr('data-id'));
|
|
|
|
+ if (!tid) {
|
|
|
|
+ toastr.warning('未选择标段');
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ console.log(tid);
|
|
|
|
+ const tenderPays = _.filter(pays, { tid });
|
|
|
|
+ console.log(tenderPays);
|
|
|
|
+ $('#qi_select').val('0');
|
|
|
|
+ const qi_options = ['<option value="0">筛选期数</option>'];
|
|
|
|
+ // 只取order大于0的并去除重复并倒序排序
|
|
|
|
+ const qis = _.orderBy(_.uniq(_.map(tenderPays, 'order')).filter(o => o > 0), null, 'desc');
|
|
|
|
+ for (const order of qis) {
|
|
|
|
+ qi_options.push('<option value="' + order + '">第' + order + '期</option>');
|
|
|
|
+ }
|
|
|
|
+ $('#qi_select').html(qi_options.join(''));
|
|
|
|
+ $('#used_selected').text('资金用途:全部');
|
|
|
|
+ // used_select清除如果存在用途为'<a class="dropdown-item to-log-link" data-val="" href="javascript:void(0);">全部</a>'这条remove掉
|
|
|
|
+ $('#used_select').find('a.to-log-link[data-val=""]').remove();
|
|
|
|
+ payListHtml(tenderPays, 0);
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ $('body').on('change', '#qi_select', function () {
|
|
|
|
+ const order = parseInt($(this).val());
|
|
|
|
+ const tid = parseInt($('.c-body .tender-info.table-warning').attr('data-id'));
|
|
|
|
+ if (!tid) {
|
|
|
|
+ toastr.warning('未选择标段');
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ const tenderPays = _.filter(pays, { tid });
|
|
|
|
+ let newTenderPays = tenderPays;
|
|
|
|
+ if (order !== 0) {
|
|
|
|
+ newTenderPays = _.filter(tenderPays, { order });
|
|
|
|
+ }
|
|
|
|
+ const used = $('#used_selected').attr('data-val') || '';
|
|
|
|
+ if (used !== '') {
|
|
|
|
+ newTenderPays = _.filter(newTenderPays, { used });
|
|
|
|
+ }
|
|
|
|
+ const status = parseInt($('#status_selected').attr('data-val')) || 0;
|
|
|
|
+ payListHtml(newTenderPays, status);
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ $('body').on('click', '#used_select .to-log-link', function () {
|
|
|
|
+ const used = $(this).attr('data-val') || '';
|
|
|
|
+ $('#used_selected').attr('data-val', used);
|
|
|
|
+ $('#used_selected').text('资金用途:' + (used === '' ? '全部' : used));
|
|
|
|
+ if (used !== '' && $('#used_select').find('a.to-log-link[data-val=""]').length === 0) {
|
|
|
|
+ $('#used_select').prepend('<a class="dropdown-item to-log-link" data-val="" href="javascript:void(0);">全部</a>');
|
|
|
|
+ } else if (used === '') {
|
|
|
|
+ $('#used_select').find('a.to-log-link[data-val=""]').remove();
|
|
|
|
+ }
|
|
|
|
+ const tid = parseInt($('.c-body .tender-info.table-warning').attr('data-id'));
|
|
|
|
+ if (!tid) {
|
|
|
|
+ toastr.warning('未选择标段');
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ let tenderPays = _.filter(pays, { tid });
|
|
|
|
+ const order = parseInt($('#qi_select').val()) || 0;
|
|
|
|
+ if (order !== 0) {
|
|
|
|
+ tenderPays = _.filter(tenderPays, { order });
|
|
|
|
+ }
|
|
|
|
+ if (used !== '') {
|
|
|
|
+ tenderPays = _.filter(tenderPays, { used });
|
|
|
|
+ }
|
|
|
|
+ const status = parseInt($('#status_selected').attr('data-val')) || 0;
|
|
|
|
+ payListHtml(tenderPays, status);
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ $('body').on('click', '#status_select .to-log-link', function () {
|
|
|
|
+ const status = parseInt($(this).attr('data-val')) || 0;
|
|
|
|
+ const tid = parseInt($('.c-body .tender-info.table-warning').attr('data-id'));
|
|
|
|
+ if (!tid) {
|
|
|
|
+ toastr.warning('未选择标段');
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ let tenderPays = _.filter(pays, { tid });
|
|
|
|
+ const order = parseInt($('#qi_select').val()) || 0;
|
|
|
|
+ if (order !== 0) {
|
|
|
|
+ tenderPays = _.filter(tenderPays, { order });
|
|
|
|
+ }
|
|
|
|
+ const used = $('#used_selected').attr('data-val') || '';
|
|
|
|
+ if (used !== '') {
|
|
|
|
+ tenderPays = _.filter(tenderPays, { used });
|
|
|
|
+ }
|
|
|
|
+ payListHtml(tenderPays, status);
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ function payListHtml(tenderPays, status = 0) {
|
|
|
|
+ const status_options = [];
|
|
|
|
+ for (const fs in filter.status) {
|
|
|
|
+ const f = filter.status[fs];
|
|
|
|
+ let num = 0;
|
|
|
|
+ switch(f) {
|
|
|
|
+ case filter.status.pending:
|
|
|
|
+ num = _.filter(tenderPays, function (item) {
|
|
|
|
+ return (item.status === auditConst.status.checking && item.curAuditors && item.curAuditors.findIndex(x => { return x.aid === user_id; }) >= 0 && item.curAuditors.find(x => { return x.aid === user_id; }).status === auditConst.status.checking) || (item.uid === user_id && (item.status === auditConst.status.uncheck || item.status === auditConst.status.checkNo));
|
|
|
|
+ }).length;
|
|
|
|
+ break;
|
|
|
|
+ case filter.status.uncheck:
|
|
|
|
+ num = _.filter(tenderPays, function (item) {
|
|
|
|
+ return item.status === auditConst.status.uncheck || item.status === auditConst.status.checkNo;
|
|
|
|
+ }).length;
|
|
|
|
+ break;
|
|
|
|
+ case filter.status.checking:
|
|
|
|
+ num = _.filter(tenderPays, function (item) {
|
|
|
|
+ return item.status === auditConst.status.checking;
|
|
|
|
+ }).length;
|
|
|
|
+ break;
|
|
|
|
+ case filter.status.checked:
|
|
|
|
+ num = _.filter(tenderPays, function (item) {
|
|
|
|
+ return item.status === auditConst.status.checked;
|
|
|
|
+ }).length;
|
|
|
|
+ break;
|
|
|
|
+ default:
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ if (status !== f) status_options.push('<a class="dropdown-item to-log-link" data-val="' + f + '" href="javascript:void(0);">' + filter.statusString[f] + '(' + num + ')</a>');
|
|
|
|
+ }
|
|
|
|
+ if (status !== 0) status_options.unshift('<a class="dropdown-item to-log-link" data-val="0" href="javascript:void(0);">全部</a>');
|
|
|
|
+ $('#status_select').html(status_options.join(''));
|
|
|
|
+ $('#status_selected').attr('data-val', status);
|
|
|
|
+ $('#status_selected').text('审批状态:' + (status === 0 ? '全部' : filter.statusString[status]));
|
|
|
|
+ let newTenderPays = tenderPays;
|
|
|
|
+ if (status !== 0) {
|
|
|
|
+ newTenderPays = _.filter(tenderPays, function (item) {
|
|
|
|
+ switch(status) {
|
|
|
|
+ case filter.status.pending:
|
|
|
|
+ return (item.status === auditConst.status.checking && item.curAuditors && item.curAuditors.findIndex(x => { return x.aid === user_id; }) >= 0 && item.curAuditors.find(x => { return x.aid === user_id; }).status === auditConst.status.checking) || (item.uid === user_id && (item.status === auditConst.status.uncheck || item.status === auditConst.status.checkNo));
|
|
|
|
+ case filter.status.uncheck:
|
|
|
|
+ return item.status === auditConst.status.uncheck || item.status === auditConst.status.checkNo;
|
|
|
|
+ case filter.status.checking:
|
|
|
|
+ return item.status === auditConst.status.checking;
|
|
|
|
+ case filter.status.checked:
|
|
|
|
+ return item.status === auditConst.status.checked;
|
|
|
|
+ default:
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ let html = '';
|
|
|
|
+ for (const pay of newTenderPays) {
|
|
|
|
+ let statusHtml = '';
|
|
|
|
+ if (pay.status === auditConst.status.checked && pay.final_auditor_str) {
|
|
|
|
+ statusHtml = `<a href="#sp-list" data-toggle="modal" data-target="#sp-list" c-id="${pay.id}">${pay.final_auditor_str}</a>`;
|
|
|
|
+ } else if (pay.curAuditors.length > 0) {
|
|
|
|
+ if (pay.curAuditors[0].audit_type === auditType.key.common) {
|
|
|
|
+ statusHtml = `<a href="#sp-list" data-toggle="modal" data-target="#sp-list" c-id="${pay.id}">${pay.curAuditors[0].name}${ pay.curAuditors[0].role !== '' && pay.curAuditors[0].role !== null? '-' + pay.curAuditors[0].role : ''}</a>`;
|
|
|
|
+ } else {
|
|
|
|
+ statusHtml = `<a href="#sp-list" data-toggle="modal" data-target="#sp-list" c-id="${pay.id}">${transFormToChinese(pay.curAuditors[0].audit_order) + '审'}</a>`;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ let operationHtml = '';
|
|
|
|
+ if (pay.status === auditConst.status.uncheck && pay.uid === user_id) {
|
|
|
|
+ operationHtml = `<a href="/sp/${spid}/financial/pay/${pay.id}/detail?from=tender" class="btn ${auditConst.statusButtonClass[pay.status]} btn-sm">${auditConst.statusButton[pay.status]}</a>`;
|
|
|
|
+ } else if (pay.status === auditConst.status.checkNo && pay.curAuditors && pay.uid === user_id) {
|
|
|
|
+ operationHtml = `<a href="/sp/${spid}/financial/pay/${pay.id}/detail?from=tender" class="btn ${auditConst.statusButtonClass[pay.status]} btn-sm">${auditConst.statusButton[pay.status]}</a>`;
|
|
|
|
+ } else if (pay.status === auditConst.status.checking && pay.curAuditors && pay.curAuditors.findIndex(x => { return x.aid === user_id; }) >= 0) {
|
|
|
|
+ const curAudit = pay.curAuditors.find(x => { return x.aid === user_id });
|
|
|
|
+ if (curAudit.status === auditConst.status.checking) {
|
|
|
|
+ operationHtml = `<a href="/sp/${spid}/financial/pay/${pay.id}/detail?from=tender" class="btn ${auditConst.statusButtonClass[pay.status]} btn-sm">${auditConst.statusButton[pay.status]}</a>`;
|
|
|
|
+ } else {
|
|
|
|
+ operationHtml = `<span class="${auditConst.auditStringClass[curAudit.status]}">${auditConst.auditString[curAudit.status]}</span>`;
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ operationHtml = `<span class="${auditConst.auditStringClass[pay.status]}">${auditConst.auditString[pay.status]}</span>`;
|
|
|
|
+ }
|
|
|
|
+ html += `<tr class="text-center" data-tid="${pay.order}">
|
|
|
|
+ <td class="">${pay.stage ? '<a href="/sp/'+ spid + '/financial/pay/stage/' + pay.stage.id + '?from=tender" class="account-page-size">第' + pay.stage.order + '期</a>' : '' }</td>
|
|
|
|
+ <td class=""><a href="/sp/${spid}/financial/pay/${pay.id}/detail?from=tender">${pay.code}</td>
|
|
|
|
+ <td class="">${moment(pay.create_time).format('YYYY-MM-DD')}</td>
|
|
|
|
+ <td class="">${pay.username}</td>
|
|
|
|
+ <td class="">${pay.used}</td>
|
|
|
|
+ <td class="">${pay.entities}</td>
|
|
|
|
+ <td class="text-right">${pay.total_price}</td>
|
|
|
|
+ <td class="text-left ${auditConst.auditProgressClass[pay.status]}">
|
|
|
|
+ ${statusHtml}
|
|
|
|
+ ${auditConst.auditProgress[pay.status]}
|
|
|
|
+ </td>
|
|
|
|
+ <td>
|
|
|
|
+ ${operationHtml}
|
|
|
|
+ </td>
|
|
|
|
+ </tr>`;
|
|
|
|
+ }
|
|
|
|
+ $('#pay-list').html(html);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ setTimeout(function () {
|
|
|
|
+ $('.c-body .tender-info').eq(0).click();// 需要延时加载
|
|
|
|
+ }, 500);
|
|
|
|
+
|
|
|
|
+ $.subMenu({
|
|
|
|
+ menu: '#sub-menu', miniMenu: '#sub-mini-menu', miniMenuList: '#mini-menu-list',
|
|
|
|
+ toMenu: '#to-menu', toMiniMenu: '#to-mini-menu',
|
|
|
|
+ key: 'menu.1.0.0',
|
|
|
|
+ miniHint: '#sub-mini-hint', hintKey: 'menu.hint.1.0.1',
|
|
|
|
+ callback: function (info) {
|
|
|
|
+ if (info.mini) {
|
|
|
|
+ $('.panel-title').addClass('fluid');
|
|
|
|
+ $('#sub-menu').removeClass('panel-sidebar');
|
|
|
|
+ } else {
|
|
|
|
+ $('.panel-title').removeClass('fluid');
|
|
|
|
+ $('#sub-menu').addClass('panel-sidebar');
|
|
|
|
+ }
|
|
|
|
+ autoFlashHeight();
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+});
|