| 
					
				 | 
			
			
				@@ -0,0 +1,848 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+'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="change-tender" style="cursor: pointer;"' : '') + '>'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        html.push('<td style="width: 60px" class="text-center">'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (!node.cid) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            html.push(`<input type="checkbox" class="tender-check" name="tender_id[]" value="${node.id}" ${_.findIndex(tenders, { tid: node.id }) !== -1 ? 'checked disabled' : ''} ${is_admin || (fptReportTids && _.includes(fptReportTids, node.id)) ? '' : 'disabled' } />`); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        html.push('</td>'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 名称 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        html.push('<td 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('</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="width: 60px;">', '选择', '</th>'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        html.push('<th class="text-center">', '标段名称', '</th>'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        html.push('</tr>', '</thead>'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return html.join(''); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    return { getTenderNodeHtml, getTenderTreeHeaderHtml } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+})(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+let auditUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+$(function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    autoFlashHeight(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    $('#liucheng').on('shown.bs.modal', function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        tenderListOrder.reOrderTenders(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        initTenderTree(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $('#shenpi-tender-list').html(getTenderTreeHtml()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        localHideList(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $('#shenpi-tender-list tr').removeClass('bg-warning'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (tenders.length > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            $('#shenpi-tender-list tr.change-tender').eq(0).addClass('bg-warning'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            auditUtils.makeReportListHtml(tenders[0]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            auditUtils.makeShenpiListHtml(tenders[0]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    $('#payaccount').on('shown.bs.modal', function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        tenderListOrder.reOrderTenders(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        initTenderTree(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $('#pay-tender-list').html(getTenderTreeHtml()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        localHideList(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $('#pay-tender-list tr').removeClass('bg-warning'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (tenders.length > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            $('#pay-tender-list tr.change-tender').eq(0).addClass('bg-warning'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            auditUtils.makeBankHtml(tenders[0]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    $('#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('&') : ''); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    let timer = null 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    let oldSearchVal = null 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    $('#liucheng').on('input propertychange', '.gr-search', function(e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        oldSearchVal = e.target.value; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        timer && clearTimeout(timer); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        timer = setTimeout(() => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            const newVal = $(this).val(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            const code = $(this).attr('data-code'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            let html = ''; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (newVal && newVal === oldSearchVal) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                accountList.filter(item => item && (item.name.indexOf(newVal) !== -1 || (item.mobile && item.mobile.indexOf(newVal) !== -1))).forEach(item => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    html += `<dd class="border-bottom p-2 mb-0 " data-id="${item.id}" > 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        <p class="mb-0 d-flex"><span class="text-primary">${item.name}</span><span 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                class="ml-auto">${item.mobile || ''}</span></p> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        <span class="text-muted">${item.role || ''}</span> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    </dd>` 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                $('#' + code + '_dropdownMenu .book-list').empty(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                $('#' + code + '_dropdownMenu .book-list').append(html); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (!$('#' + code + '_dropdownMenu .acc-btn').length) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    accountGroup.forEach((group, idx) => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if (!group) return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        html += `<dt><a href="javascript: void(0);" class="acc-btn" data-groupid="${idx}" data-type="hide"><i class="fa fa-plus-square"></i> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        </a> ${group.groupName}</dt> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        <div class="dd-content" data-toggleid="${idx}">`; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        group.groupList.forEach(item => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            html += `<dd class="border-bottom p-2 mb-0 " data-id="${item.id}" > 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                <p class="mb-0 d-flex"><span class="text-primary">${item.name}</span><span 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        class="ml-auto">${item.mobile || ''}</span></p> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                <span class="text-muted">${item.role || ''}</span> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            </dd>`; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        html += '</div>'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    $('#' + code + '_dropdownMenu .book-list').empty(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    $('#' + code + '_dropdownMenu .book-list').append(html); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }, 400); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    $('body').on('click', '#shenpi-tender-list .change-tender', function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if ($(this).hasClass('bg-warning')) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $('#shenpi-tender-list tr').removeClass('bg-warning'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $(this).addClass('bg-warning'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const tid = parseInt($(this).data('tid')) || 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const tender = tenders.find(t => t.id === tid); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (!tender) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            toastr.error('请选择标段'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        auditUtils.makeReportListHtml(tender); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        auditUtils.makeShenpiListHtml(tender); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    $('body').on('click', '#pay-tender-list .change-tender', function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if ($(this).hasClass('bg-warning')) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $('#pay-tender-list tr').removeClass('bg-warning'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $(this).addClass('bg-warning'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const tid = parseInt($(this).data('tid')) || 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const tender = tenders.find(t => t.id === tid); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (!tender) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            toastr.error('请选择标段'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        auditUtils.makeBankHtml(tender); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    auditUtils = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        makeReportListHtml: function (flow) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            let addHtml = ''; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            $('#select-all-ptAudits').prop('checked', false); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            for (const pl of flow.permissionList) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                addHtml += `<tr> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                <td class="text-center"><input type="checkbox" class="select-ptAudit" data-id="${pl.id}"></td><td>${pl.name}</td><td>${pl.company}</td> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                <td class="text-center"><input type="checkbox" class="save-report" data-id="${pl.id}" ${pl.is_report ? 'checked' : ''}></td><td class="text-center"><a href="javascript:void(0);" class="text-danger remove-audit" data-id="${pl.id}">移除</a></td> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            </tr>`; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            $('#report-list').html(addHtml); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        makeShenpiListHtml: function (flow) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            let addhtml = '<ul class="list-unstyled">\n'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            addhtml += this.getgdsplHtml(flow, 'financial'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            addhtml += '</ul>\n'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            $('#shenpi-list').html(addhtml); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        makeBankHtml: function (tender) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            $('#payaccount input[name="name"]').val(''); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            $('#payaccount input[name="bank"]').val(''); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            $('#payaccount input[name="bank_account"]').val(''); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            $('#payaccount input[name="contact"]').val(''); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            $('#payaccount input[name="phone"]').val(''); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (tender) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                $('#payaccount input[name="name"]').val(tender.pt.name); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                $('#payaccount input[name="bank"]').val(tender.pt.bank); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                $('#payaccount input[name="bank_account"]').val(tender.pt.bank_account); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                $('#payaccount input[name="contact"]').val(tender.pt.contact); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                $('#payaccount input[name="phone"]').val(tender.pt.phone); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (is_admin || (fptReportTids && _.includes(fptReportTids, tender.id))) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    $('#payaccount table input[type="text"]').attr('readonly', false); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    $('#get-form-tender').show(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    $('#batch-other-bank').show(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    $('#payaccount table input[type="text"]').attr('readonly', true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    $('#get-form-tender').hide(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    $('#batch-other-bank').hide(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        getAuditHtml: function(audit, is_report = 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return '<span class="d-inline-block"><span class="badge badge-light">'+ audit.name +' <span class="dropdown">\n' + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                '                                                            <a href="javascript:void(0);" class="btn-sm text-danger px-1" title="移除" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><i class="fa fa-remove"></i></a>\n' + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                '                                                            <div class="dropdown-menu">\n' + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                '                                                                <a class="dropdown-item" href="javascript:void(0);">确认移除' + ( is_report ? '填报人' : '审批人') + '?</a>\n' + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                '                                                                <div class="dropdown-divider"></div>\n' + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                '                                                                <div class="px-2 py-1 text-center">\n' + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                '                                                                    <button class="remove-audit btn btn-sm btn-danger" data-id="' + (is_report ? audit.id : audit.audit_id) + '">移除</button>\n' + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                '                                                                    <button class="btn btn-sm btn-secondary">取消</button>\n' + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                '                                                                </div>\n' + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                '                                                            </div>\n' + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                '                                                        </span> ' + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                '                                            </span></span>\n' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        getAuditTypeHtml: function(code, type) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            const html = []; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            html.push(`<span class="d-inline-block"><select class="form-control form-control-sm audit-type-key" data-type="${type}">`); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            for (const t of auditType.types) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (t.valid && t.valid.indexOf(code) < 0) continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                html.push(`<option value="${t.value}" ${t.value === type ? 'selected' : ''}>${t.name}</option>`); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            html.push('</select></span> '); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return html.join(''); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        getSelectAuditHtml: function (code, is_report = 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            let divhtml = ''; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            accountGroup.forEach((group, idx) => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                let didivhtml = ''; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if(group) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    group.groupList.forEach(item => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        didivhtml += '<dd class="border-bottom p-2 mb-0 " data-id="' + item.id + '" >\n' + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            '<p class="mb-0 d-flex"><span class="text-primary">' + item.name + '</span><span\n' + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            '                                                                                class="ml-auto">' + item.mobile + '</span></p>\n' + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            '                                                                    <span class="text-muted">' + item.role + '</span>\n' + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            '                                                                    </dd>\n'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    divhtml += '<dt><a href="javascript: void(0);" class="acc-btn" data-groupid="' + idx + '" data-type="hide"><i class="fa fa-plus-square"></i></a> ' + group.groupName + '</dt>\n' + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        '                                                                <div class="dd-content" data-toggleid="' + idx + '">\n' + didivhtml + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        '                                                                </div>\n'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            const html = 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                '                                            <span class="d-inline-block">\n' + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                '                                                <div class="dropdown text-right">\n' + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                '                                                    <button class="btn btn-outline-primary btn-sm dropdown-toggle" type="button" id="' + code + '_dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">\n' + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                '                                                        ' + (is_report ? '添加填报人' : '选择审批人') + '\n' + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                '                                                    </button>\n' + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                '                                                    <div class="dropdown-menu dropdown-menu-right" id="' + code + '_dropdownMenu" aria-labelledby="' + code + '_dropdownMenuButton" style="width:220px">\n' + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                '                                                        <div class="mb-2 p-2"><input class="form-control form-control-sm gr-search"\n' + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                '                                                                                     placeholder="姓名/手机 检索" autocomplete="off" data-code="' + code + '"></div>\n' + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                '                                                        <dl class="list-unstyled book-list">\n' + divhtml + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                '                                                        </dl>\n' + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                '                                                    </div>\n' + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                '                                                </div>\n' + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                '                                            </span>\n'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return html; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 以下i从1开始 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        getAuditGroupInnerHtml: function(code, auditGroup, i) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            const html = []; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            const type = auditGroup.length > 0 ? auditGroup[0].audit_type : auditType.key.common; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            html.push(`<span class="col-auto">${transFormToChinese(i)}审</span><span class="col-10 spr-span">`); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            html.push(this.getAuditTypeHtml(code, type)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            for (const audit of auditGroup) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                html.push(this.getAuditHtml(audit)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (type !== auditType.key.common || auditGroup.length === 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                html.push(this.getSelectAuditHtml(code)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (type === auditType.key.union && auditGroup.length > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                html.push(`<button class="btn btn-sm btn-outline-primary" sp_type="${code}" audit_order="${i}" name="union-set">协同设置</button>`); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            html.push('</span>'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return html.join(''); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        getAuditGroupHtml: function (code, auditGroup, i) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return `<li class="d-flex justify-content-start align-items-center mb-3">${this.getAuditGroupInnerHtml(code, auditGroup, i)}</li>`; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        getgdsplHtml(flow, this_code) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            let addhtml = ''; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (flow.auditGroupList.length !== 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                for(const [i, auditGroup] of flow.auditGroupList.entries()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    addhtml += this.getAuditGroupHtml(this_code, auditGroup, i + 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                const addGroupHtml = this_code === 'change' && (!flow.groupList || (flow.groupList && flow.groupList.length === 0)) ? 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    `<span class="pl-3"><a href="javascript:void(0);" class="show-spzsave" data-code="${this_code}"><i class="fa fa-save"></i> 存为审批组</a></span>\n` : ''; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                addhtml += '<li>\n' + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    '                                            <span class="pl-3"><a href="javascript:void(0);" class="add-audit" ><i class="fa fa-plus"></i> 添加流程</a></span>\n' + addGroupHtml + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    '                                        </li>'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                addhtml += this.getAuditGroupHtml(this_code, [], 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return addhtml; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 以下i从0开始 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        addAudit: function (tender, user, i) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            const flow = tender; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (!flow.auditGroupList) flow.auditGroupList = []; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (!flow.auditGroupList[i]) flow.auditGroupList[i] = []; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            flow.auditGroupList[i].push(user); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return flow.auditGroupList[i]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        removeAudit: function (tender, audit_id, i) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            const flow = tender; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (flow.auditGroupList[i].length === 1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                flow.auditGroupList.splice(i, 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            flow.auditGroupList[i].splice(flow.auditGroupList[i].findIndex(x => { return x.audit_id === audit_id; }), 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return flow.auditGroupList[i]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        setAuditType: function (tender, audit_type, i) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            const flow = tender; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (!flow || !flow.auditGroupList || !flow.auditGroupList[i]) return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            flow.auditGroupList[i].forEach(x => { x.audit_type = audit_type}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return flow.auditGroupList[i]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    // 选中填报人 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    $('body').on('click', 'div[id="report_audit_dropdownMenu"] dl dd', function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const tid = parseInt($('#shenpi-tender-list tr.bg-warning').data('tid')); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const tender = tenders.find(t => t.id === tid); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (!tender) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            toastr.error('请选择标段'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const id = parseInt($(this).data('id')); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (!id) return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (!isNaN(id) && id !== 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            postData(`/sp/${spid}/financial/pay/stage/save`, {type: 'add-tender-audit', id: id, tid: tender.id }, function (result) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                tender.permissionList = result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                auditUtils.makeReportListHtml(tender); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    // 移除填报人 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    $('body').on('click', '#report-list .remove-audit', function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const tid = parseInt($('#shenpi-tender-list tr.bg-warning').data('tid')); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const tender = tenders.find(t => t.id === tid); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (!tender) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            toastr.error('请选择标段'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const id = parseInt($(this).data('id')); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        deleteAfterHint(function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            postData(`/sp/${spid}/financial/pay/stage/save`, {type: 'del-tender-audit', id, tid: tender.id }, function (result) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                tender.permissionList = result.permissionList; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                tender.auditGroupList = result.auditGroupList; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                auditUtils.makeReportListHtml(tender); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                auditUtils.makeShenpiListHtml(tender); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }, '确认删除该标段用户?'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    // 勾选是否为填报人 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    $('body').on('click', '#report-list .save-report', function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const tid = parseInt($('#shenpi-tender-list tr.bg-warning').data('tid')); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const tender = tenders.find(t => t.id === tid); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (!tender) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            toastr.error('请选择标段'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const id = parseInt($(this).data('id')); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const isReport = $(this).prop('checked'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const permission = tender.permissionList.find(p => p.id === id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (!permission) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            toastr.error('该用户不存在'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        postData(`/sp/${spid}/financial/pay/stage/save`, {type: 'save-permission', updateData: { id, is_report: isReport } }, function (result) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            permission.is_report = isReport; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    $('#select-all-ptAudits').click(function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $('#report-list .select-ptAudit').prop('checked', $(this).prop('checked')); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    $('#batch-del-ptAudit').click(function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const tid = parseInt($('#shenpi-tender-list tr.bg-warning').data('tid')); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const tender = tenders.find(t => t.id === tid); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (!tender) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            toastr.error('请选择标段'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const ids = []; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $('#report-list .select-ptAudit:checked').each(function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            ids.push(parseInt($(this).data('id'))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (ids.length === 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            toastr.warning('请勾选要删除的用户'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        deleteAfterHint(function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            postData(`/sp/${spid}/financial/pay/stage/save`, {type: 'del-tender-audit', id: ids, tid: tender.id }, function (result) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                tender.permissionList = result.permissionList; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                tender.auditGroupList = result.auditGroupList; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                auditUtils.makeReportListHtml(tender); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                auditUtils.makeShenpiListHtml(tender); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }, '确认删除已勾选的标段用户?'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    $('#batch-other-ptAudit').click(function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const cur_tenderid = parseInt($('#shenpi-tender-list tr.bg-warning').data('tid')); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const tender = tenders.find(t => t.id === cur_tenderid); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (!tender) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            toastr.error('请选择标段'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const ids = []; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $('#report-list .select-ptAudit:checked').each(function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            ids.push(parseInt($(this).data('id'))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (ids.length === 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            toastr.warning('请勾选要同步的用户'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const num = $('#shenpi-tender-list input:checked').length; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (num === 0 || (num === 1 && parseInt($('#shenpi-tender-list input:checked').eq(0).parents('tr').data('tid')) === cur_tenderid)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            toastr.warning('请选择需要设置审批同步的标段'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const tenderList = []; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        for (let i = 0; i < num; i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            const tid = parseInt($('#shenpi-tender-list input:checked').eq(i).parents('tr').data('tid')); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (tid !== cur_tenderid) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                tenderList.push(tid); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const data = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            type: 'copy-tender-audit', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            id: ids, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            this_tid: tender.id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        data.tidList = tenderList.join(','); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        postData(`/sp/${spid}/financial/pay/stage/save`,  data, function (result) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            toastr.success('已同步到其它勾选标段'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            for (let i = 0; i < num; i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                const tid = parseInt($('#shenpi-tender-list input:checked').eq(i).parents('tr').data('tid')); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (tid !== cur_tenderid) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    const other_tender = tenders.find(t => t.id === tid); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    const permissionList = _.filter(result.otherPermissionList, { tid: tid }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    other_tender.permissionList = permissionList; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    $('#batch-other-bank').click(function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const cur_tenderid = parseInt($('#pay-tender-list tr.bg-warning').data('tid')); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const tender = tenders.find(t => t.id === cur_tenderid); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (!tender) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            toastr.error('请选择标段'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const copyTenders = []; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $('#pay-tender-list input:checked').each(function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (cur_tenderid !== parseInt($(this).val())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                const one = tenders.find(t => t.id === parseInt($(this).val())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                copyTenders.push(one.pt); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (copyTenders.length === 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            toastr.warning('请勾选要同步的标段'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const data = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            type: 'copy-tender-bank', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            tenders: copyTenders, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            this_tender: tender.pt, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        postData(`/sp/${spid}/financial/pay/stage/save`,  data, function (result) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            toastr.success('已同步信息到其它勾选标段'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            $('#pay-tender-list input:checked').each(function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (cur_tenderid !== parseInt($(this).val())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    const one = tenders.find(t => t.id === parseInt($(this).val())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    const newOne = result.find(t => t.tid === one.id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (newOne) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        one.pt = newOne; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    // 选中审批人 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    $('body').on('click', '#shenpi-list div[id$="_dropdownMenu"] dl dd', function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const tid = parseInt($('#shenpi-tender-list tr.bg-warning').data('tid')); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const tender = tenders.find(t => t.id === tid); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (!tender) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            toastr.error('请选择标段'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const id = parseInt($(this).data('id')); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (!id) return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        let this_code = 'financial'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const user = _.find(accountList, function (item) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return item.id === id; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 判断是否已存在审批人 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const aid_num = $(this).parents('ul').find('.remove-audit').length; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        for (let i = 0; i < aid_num; i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            const aid = parseInt($(this).parents('ul').find('.remove-audit').eq(i).data('id')); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (aid === id) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                toastr.warning('该审核人已存在,请勿重复添加'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const prop = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            status: sp_status.gdspl, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            code: sp_type[this_code], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            audit_id: id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            type: 'add', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            audit_type: parseInt($(this).parents('li').find('select[class*="audit-type-key"]')[0].value), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            audit_order: $(this).parents('li').index() + 1, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const _self = $(this); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        postData(`/sp/${spid}/financial/pay/stage/save`, { type: 'add-shenpi-audit', shenpi: prop, tid }, function (result) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            const data = result.shenpi; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            const auditGroup = auditUtils.addAudit(tender, { audit_id: data.audit_id, name: user.name, audit_type: data.audit_type, audit_order: data.audit_order }, prop.audit_order - 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (_self.parents('ul').find('.add-audit').length === 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                _self.parents('ul').append('<li>\n' + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    '                                            <span class="pl-3"><a href="javascript:void(0);" class="add-audit" ><i class="fa fa-plus"></i> 添加流程</a></span>\n' + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    '                                        </li>'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            _self.parents('li').html(auditUtils.getAuditGroupInnerHtml(this_code, auditGroup, prop.audit_order)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            tender.permissionList = result.permissionList; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            auditUtils.makeReportListHtml(tender); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    // 移除审批人 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    $('body').on('click', '#shenpi-list .remove-audit', function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const tid = parseInt($('#shenpi-tender-list tr.bg-warning').data('tid')); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const tender = tenders.find(t => t.id === tid); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (!tender) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            toastr.error('请选择标段'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const id = parseInt($(this).data('id')); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const this_code = 'financial'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const prop = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            status: sp_status.gdspl, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            code: sp_type[this_code], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            audit_id: id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            type: 'del', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const _self = $(this); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        postData('/tender/' + tid + '/shenpi/audit/save', prop, function (data) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            const index = _self.parents('li').index(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            const auditGroup = auditUtils.removeAudit(tender, id, index); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (auditGroup) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                _self.parents('li').html(auditUtils.getAuditGroupInnerHtml(this_code, auditGroup, index + 1)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                const _selflc = _self.parents('#shenpi-list'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                _self.parents('li').remove(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                const aid_num = parseInt(_selflc.children('ul').find('li.d-flex').length); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (aid_num === 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    _selflc.children('ul').html(auditUtils.getAuditGroupHtml(this_code, [], 1)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    for (let i = 0; i < aid_num; i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        _selflc.find('li.d-flex').eq(i).find('.col-auto').text(transFormToChinese(i+1) + '审'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    $('body').on('click', '#shenpi-list .add-audit', function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const num = $(this).parents('ul').children('li').length; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const this_code = 'financial'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const addhtml = auditUtils.getAuditGroupHtml(this_code, [], num); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $(this).parents('ul').append(addhtml); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $(this).parents('li').remove(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    // 设置会签、或签 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    $('body').on('change', 'select[class*="audit-type-key"]', function() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const tid = parseInt($('#shenpi-tender-list tr.bg-warning').data('tid')); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const tender = tenders.find(t => t.id === tid); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (!tender) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            toastr.error('请选择标段'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const removes = $(this).parents('.d-flex').find('.remove-audit'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (removes.length === 0) return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const this_status = sp_status.gdspl; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const this_code = 'financial'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const ids = []; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const liParent = $(this).parents('li'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        removes.each((i, r) => { ids.push(parseInt(r.getAttribute('data-id'))); }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const prop = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            status: this_status, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            code: sp_type[this_code], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            audit_id: ids, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            audit_type: parseInt(this.value), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            type: 'audit-type', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (prop.audit_type === auditType.key.common && ids.length > 1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            toastr.warning('设置个人审批前请先删除多余的审批人'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            this.value = this.getAttribute('data-type'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const _self = this; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        postData('/tender/'+ tid +'/shenpi/audit/save', prop, function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            _self.setAttribute('data-type', _self.value); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            const auditGroup = auditUtils.setAuditType(tender, prop.audit_type, liParent.index()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            liParent.html(auditUtils.getAuditGroupInnerHtml(this_code, auditGroup, liParent.index() + 1)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    $('#set-other-tenders').on('click', function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const cur_tenderid = parseInt($('#shenpi-tender-list tr.bg-warning').data('tid')); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const tender = tenders.find(t => t.id === cur_tenderid); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (!tender) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            toastr.error('请选择标段'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (tender.auditGroupList.length === 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            toastr.warning('请先设置审批流程再同步到其它标段'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const this_code = 'financial'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const num = $('#shenpi-tender-list input:checked').length; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (num === 0 || (num === 1 && parseInt($('#shenpi-tender-list input:checked').eq(0).parents('tr').data('tid')) === cur_tenderid)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            toastr.warning('请选择需要设置审批同步的标段'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const data = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            type: 'copy-shenpi-audit', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            status: sp_status.gdspl, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            code: this_code, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            this_tid: cur_tenderid, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 二维数组变一维 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        data.auditList = []; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        for (const auditGroup of tender.auditGroupList) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            data.auditList.push(...auditGroup); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const tenderList = []; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        for (let i = 0; i < num; i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            const tid = parseInt($('#shenpi-tender-list input:checked').eq(i).parents('tr').data('tid')); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (tid !== cur_tenderid) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                tenderList.push(tid); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        data.tidList = tenderList.join(','); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        console.log(data); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        postData(`/sp/${spid}/financial/pay/stage/save`, data, function (result) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            toastr.success('已同步到其它勾选标段'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            for (let i = 0; i < num; i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                const tid = parseInt($('#shenpi-tender-list input:checked').eq(i).parents('tr').data('tid')); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (tid !== cur_tenderid) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    const other_tender = tenders.find(t => t.id === tid); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    other_tender.auditGroupList = tender.auditGroupList; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    const permissionList = _.filter(result.otherPermissionList, { tid: tid }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    other_tender.permissionList = permissionList; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    // 添加到成员中 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    $('body').on('click', '.book-list dt', function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const idx = $(this).find('.acc-btn').attr('data-groupid') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const type = $(this).find('.acc-btn').attr('data-type') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (type === 'hide') { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            $(this).parent().find(`div[data-toggleid="${idx}"]`).show(() => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                $(this).children().find('i').removeClass('fa-plus-square').addClass('fa-minus-square-o') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                $(this).find('.acc-btn').attr('data-type', 'show') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            $(this).parent().find(`div[data-toggleid="${idx}"]`).hide(() => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                $(this).children().find('i').removeClass('fa-minus-square-o').addClass('fa-plus-square') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                $(this).find('.acc-btn').attr('data-type', 'hide') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return false 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    $('#add-company-select').on('change', function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const company = userCompanyList.find(t => t.name === $(this).val()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $('#company_order').val(company ? company.count + 1 : 0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    $('#add-qi-btn').on('click', function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const companyName = $('#add-company-select').val(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const company = userCompanyList.find(t => t.name === companyName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (!company) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            toastr.error('单位不存在'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const order = parseInt($('#company_order').val()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (!order || order < 1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            toastr.error('期数有误'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const prop = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            company_id: company.id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            order, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        postData(`/sp/${spid}/financial/pay/stage/save`, { type: 'add-pay-stage', updateData: prop }, function (result) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            window.location.href = `/sp/${spid}/financial/pay/stage/${result.id}`; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    $('body').on('click', '#pay-list .del-pay-btn', function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const fpsid = $(this).data('id'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        deleteAfterHint(function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            postData(`/sp/${spid}/financial/pay/stage/save`, {type: 'del-pay-stage', postData: { node: fpsid }}, function (result) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                window.location.reload(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }, '确认删除该资金支付单位期?'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    $('#get-form-tender').on('click', function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const tid = $('#pay-tender-list tr.bg-warning').data('tid'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const tender = tenders.find(t => t.id === parseInt(tid)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (!tid || !tender) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            toastr.error('标段不存在'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (is_admin || (fptReportTids && _.includes(fptReportTids, tender.id))) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            console.log(tender); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (tender.pay_account && (tender.pay_account.name || tender.pay_account.bank || tender.pay_account.account || tender.pay_account.contact || tender.pay_account.phone)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                $('#payaccount input[name="name"]').val(tender.pay_account.name); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                $('#payaccount input[name="bank"]').val(tender.pay_account.bank); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                $('#payaccount input[name="bank_account"]').val(tender.pay_account.account); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                $('#payaccount input[name="contact"]').val(tender.pay_account.contact); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                $('#payaccount input[name="phone"]').val(tender.pay_account.phone); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                const data = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    id: tender.pt.id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    tid: tender.id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    name: tender.pay_account.name, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    bank: tender.pay_account.bank, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    bank_account: tender.pay_account.account, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    contact: tender.pay_account.contact, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    phone: tender.pay_account.phone, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                postData(`/sp/${spid}/financial/pay/stage/save`, { type: 'set-pay-tender', updateData: data }, function (result) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    toastr.success('已同步'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    tender.pt = result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                toastr.success('已同步'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            toastr.error('无权限操作'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    $('#payaccount input[type="text"]').on('change', function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const tid = $('#pay-tender-list tr.bg-warning').data('tid'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const tender = tenders.find(t => t.id === parseInt(tid)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (!tid || !tender) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            toastr.error('标段不存在'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (is_admin || (fptReportTids && _.includes(fptReportTids, tender.id))) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            const data = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                id: tender.pt.id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                tid: tender.id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                name: $('#payaccount input[name="name"]').val(), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                bank: $('#payaccount input[name="bank"]').val(), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                bank_account: $('#payaccount input[name="bank_account"]').val(), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                contact: $('#payaccount input[name="contact"]').val(), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                phone: $('#payaccount input[name="phone"]').val(), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            postData(`/sp/${spid}/financial/pay/stage/save`, { type: 'set-pay-tender', updateData: data }, function (result) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                tender.pt = result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    $('#set-pay-btn').on('click', function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const tid = $('#payaccount input[name="tid"]').val(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const tender = tenders.find(t => t.id === parseInt(tid)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (!tid || !tender) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            toastr.error('标段不存在'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (is_admin || (fptReportTids && _.includes(fptReportTids, tender.id))) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            const data = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                id: parseInt($('#payaccount input[name="id"]').val()), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                tid: tender.id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                name: $('#payaccount input[name="name"]').val(), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                bank: $('#payaccount input[name="bank"]').val(), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                bank_account: $('#payaccount input[name="bank_account"]').val(), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                contact: $('#payaccount input[name="contact"]').val(), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                phone: $('#payaccount input[name="phone"]').val(), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (!data.name) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                toastr.error('请填写开户名称'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (!data.bank) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                toastr.error('请填写开户银行'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (!data.bank_account) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                toastr.error('请填写开户账号'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            postData(`/sp/${spid}/financial/pay/stage/save`, { type: 'set-pay-tender', updateData: data }, function (result) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                toastr.success('保存成功'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                tender.pt = result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            toastr.error('无权限操作'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    $.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(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+}); 
			 |