| 
					
				 | 
			
			
				@@ -167,7 +167,136 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         </div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     </div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 </div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+<!--批量上报变更令--> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+<div class="modal fade" id="batch-sb" data-backdrop="static" style=""> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    <div class="modal-dialog modal-lg" style="max-width:1100px;" role="document"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <div class="modal-content"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <div class="modal-header"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                <h5 class="modal-title">批量上报变更令</h5> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                <button type="button" class="close" data-dismiss="modal" aria-label="Close"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    <span aria-hidden="true">×</span> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                </button> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            </div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <div class="modal-body"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                <div class="row"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    <!-- 左侧变更令 --> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    <div class="col-6" > 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        <div class="modal-height-500" style="overflow-y:auto;"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            <table class="table table-hover table-bordered"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                <thead> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                <tr> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    <th width="15%" class="text-center"><div class="align-middle"><input id="select-all-uncheck" type="checkbox"></div></th> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    <th width="40%">变更令编号</th> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    <th width="">原审批流程</th> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                </tr> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                </thead> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                <tbody id="uncheck_list"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                </tbody> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            </table> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        </div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    </div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    <!-- 右侧新审批流程 --> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    <div class="col-6"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        <div class=" ml-auto"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            <div class="dropdown text-right" id="show-audit-select"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            </div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            <div class="card mt-1"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                <div class="card-header"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    审批流程 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                </div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                <div class="modal-height-500" style="overflow-y:auto;"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    <ul class="list-group list-group-flush" id="auditList"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    </ul> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                </div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            </div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        </div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    </div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                </div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                <div class="alert alert-warning mt-2 mb-0">批量操作会覆盖原审批流程,请合理选择。</div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            </div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <div class="modal-footer"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                <button type="button" class="btn btn-sm btn-secondary" data-dismiss="modal">取消</button> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                <button class="btn btn-sm btn-primary" id="batch_uncheck_btn">确定</button> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            </div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    </div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+</div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+<!--批量上报变更令进度条modal--> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+<div class="modal fade" id="batch-sb-progress" data-backdrop="static" style=""> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    <div class="modal-dialog" role="document"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <div class="modal-content"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <div class="modal-header"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                <h5 class="modal-title">批量上报变更令</h5> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            </div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <div class="modal-body"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                <div class="progress"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    <div class="progress-tz-bar progress-bar progress-bar-striped progress-bar-animated" role="progressbar" style="width: 100%" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100"></div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                </div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                <div class="mt-1 progress-tz-text">台账获取并处理中...</div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                <div class="change-progress"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                </div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            </div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <div class="modal-footer" style="display: none"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                <button class="btn btn-sm btn-primary" onclick="window.location.reload();">刷新页面</button> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            </div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    </div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+</div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 <% } %> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+<!--批量审批变更令--> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+<div class="modal fade" id="batch-sp" data-backdrop="static" style=""> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    <div class="modal-dialog modal-lg" role="document"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <div class="modal-content"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <div class="modal-header"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                <h5 class="modal-title">批量审批变更令</h5> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                <button type="button" class="close" data-dismiss="modal" aria-label="Close"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    <span aria-hidden="true">×</span> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                </button> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            </div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <div class="modal-body"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                <div class="modal-height-500" style="overflow-y:auto;"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    <table class="table table-hover table-bordered"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        <thead> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        <tr> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            <th width="5%"><div class="align-middle text-center"><input type="checkbox" id="select-all-checking"></div></th> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            <th width="25%">变更令编号</th> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            <th width="">变更令名称</th> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            <th width="25%">批量编号</th> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        </tr> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        </thead> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        <tbody id="checking_list"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        </tbody> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    </table> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                </div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            </div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <div class="modal-footer"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                <button type="button" class="btn btn-sm btn-secondary" data-dismiss="modal">取消</button> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                <button type="button" class="btn btn-sm btn-primary" id="batch_checking_btn">确定</button> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            </div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    </div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+</div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+<!--批量审批变更令进度条modal--> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+<div class="modal fade" id="batch-sp-progress" data-backdrop="static" style=""> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    <div class="modal-dialog" role="document"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <div class="modal-content"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <div class="modal-header"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                <h5 class="modal-title">批量审批变更令</h5> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            </div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <div class="modal-body"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                <div class="progress"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    <div class="progress-tz-bar progress-bar progress-bar-striped progress-bar-animated" role="progressbar" style="width: 100%" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100"></div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                </div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                <div class="mt-1 progress-tz-text">台账获取并处理中...</div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                <div class="change-progress"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                </div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            </div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <div class="modal-footer" style="display: none"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                <button class="btn btn-sm btn-primary" onclick="window.location.reload();">刷新页面</button> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            </div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    </div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+</div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 <script> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     const ruleType = <%- ruleType %>; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     const ruleConst = JSON.parse('<%- JSON.stringify(ruleConst) %>'); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -197,4 +326,830 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 </script> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 <script src="/public/js/moment/moment.min.js"></script> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+<script src="/public/js/decimal.min.js"></script> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+<script src="/public/js/zh_calc.js"></script> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+<script src="/public/js/path_tree.js"></script> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+<script src="/public/js/gcl_gather.js"></script> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+<script> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    const shenpiConst = JSON.parse(unescape('<%- escape(JSON.stringify(shenpiConst)) %>')); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    $(function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const intervalIds = {}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <% if (tender.user_id === ctx.session.sessionUser.accountId) { %> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        let this_cid = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        let shenpi_status = shenpiConst.sp_status.sqspr; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        let accountList, accountGroup; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        let uncheckList = []; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 批量上报变更令部分 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $('#batch-sb').on('show.bs.modal', function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            postData(`/tender/${tenderId}/change/batch/fun`, { type: 'get_report_list' }, function (res) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                let html = ''; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                $('#select-all-uncheck').prop('checked', false); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                shenpi_status = res.shenpi_status; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                uncheckList = res.uncheckList; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                for (const l of res.uncheckList) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    html += '<tr>' + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        `<td class="text-center"><input type="checkbox" value="${l.cid}"></td>` + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        `<td class=""><a href="/tender/${tenderId}/change/${l.cid}/information" target="_blank">${l.code}</a></td>` + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        '<td>' + setAuditList(l.auditList) +'</td>' + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        '</tr>'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                $('#uncheck_list').html(html); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (res.uncheckList.length > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    $('#uncheck_list tr').eq(0).addClass('table-warning'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    this_cid = res.uncheckList[0].cid; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    makeSpList(res.uncheckList[0].auditList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    $('#uncheck_list tr').removeClass('table-warning'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    this_cid = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    makeSpList([]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                let showAuditSelectHtml = ''; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (res.spGroupList && res.spGroupList.length > 0 && shenpi_status === shenpiConst.sp_status.gdspl) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    let optionHtml = ''; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    for (const g of res.spGroupList) { %> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        optionHtml += `<option value="${g.id}" ${res.uncheckList.length > 0 && g.id === res.uncheckList[0].sp_group ? 'selected' : ''}>${g.name}</option>`; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    showAuditSelectHtml += '<div class="row">' + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        '<div class="col-7"></div>' + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    '<div class="col-5">' + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        '<select class="form-control form-control-sm change-sp-group">' + optionHtml + '</select>' + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    '</div></div>'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    accountList = res.accountList; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    accountGroup = res.accountGroup; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    showAuditSelectHtml += getSelectAuditHtml('report'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                $('#show-audit-select').html(showAuditSelectHtml); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        function setAuditList(auditList) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            let html = []; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // 去除原报 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (auditList.length > 1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                for (const [i,a] of auditList.entries()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (i === 0) continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    const oneAuditNames = _.map(a, 'name'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    let names = oneAuditNames.join('、'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (oneAuditNames.length > 1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        names = (a[0].audit_type === auditType.key.and ? '(会)' : (a[0].audit_type === auditType.key.or ? '(或)' : '')) + names; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    html.push(names); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return html.join('-'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        function getSelectAuditHtml(code) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            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 = 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                '                                                    <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' + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                '                                                        添加审批流程\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'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return html; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // uncheckList tr  切换 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $('#uncheck_list').on('click', 'tr', function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            $('#uncheck_list tr').removeClass('table-warning'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            $(this).addClass('table-warning'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            this_cid = $(this).find('a').attr('href').split('/')[4]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            makeSpList(uncheckList.find(l => l.cid === this_cid).auditList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $('#uncheck_list').on('click', 'input[type="checkbox"]', function (e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            e.stopPropagation(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // uncheckList tr全选 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $('#select-all-uncheck').click(function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            $('#uncheck_list tr').find('input[type="checkbox"]').prop('checked', $(this).prop('checked')); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        let timer = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        let oldSearchVal = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $('body').on('input propertychange', 'div[id$="_dropdownMenu"] .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 => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                // if (item.id !== changesUid) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                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', 'div[id$="_dropdownMenu"] .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; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 添加到审批流程中 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $('body').on('click', 'div[id$="_dropdownMenu"] dl dd', function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            const id = parseInt($(this).data('id')); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (!this_cid) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                toastr.error('请选择变更令'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (id !== 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                postData('/tender/' + tenderId + '/change/' + this_cid + '/information/audit/add', { auditorId: id }, (datas) => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    makeSpList(datas); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    const index = uncheckList.findIndex(item => item.cid === this_cid); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (index !== -1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        uncheckList[index].auditList = datas; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        $('#uncheck_list tr').eq(index).children('td').eq(2).html(setAuditList(datas)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 移除审批流程的审批人 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $('body').on('click', '#auditList li a', function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            const uid = $(this).parents('li').attr('data-auditid'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            const li = $(this).parents('li'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            const data = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                auditorId: uid, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (!this_cid) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                toastr.error('请选择变更令'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            postData('/tender/' + tenderId + '/change/' + this_cid + '/information/audit/delete', data, (datas) => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                li.remove(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                let liIndex = 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                $('#auditList li').each(function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    $(this).children('.col-auto').eq(0).text(liIndex); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    liIndex++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                const index = uncheckList.findIndex(item => item.cid === this_cid); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (index !== -1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    uncheckList[index].auditList = datas; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    $('#uncheck_list tr').eq(index).children('td').eq(2).html(setAuditList(datas)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 切换审批组 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $('body').on('change', '.change-sp-group', function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            const data = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                type: 'change_sp_group', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                sp_group: parseInt($(this).val()), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (!this_cid) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                toastr.error('请选择变更令'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (!data.sp_group) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                toastr.error('请选择固定审批组'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            console.log(data); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            postData('/tender/' + tenderId + '/change/' + this_cid + '/information/audit/spgroup', data, (datas) => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                makeSpList(datas); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                const index = uncheckList.findIndex(item => item.cid === this_cid); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (index !== -1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    uncheckList[index].auditList = datas; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    $('#uncheck_list tr').eq(index).children('td').eq(2).html(setAuditList(datas)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        function makeSpList(datas) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            const html = []; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // 如果是重新上报,添加到重新上报列表中 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            const auditorshtml = []; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (datas.length > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                for (const [index,data] of datas.entries()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (index !== 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        html.push('<li class="list-group-item d-flex" data-auditid="'+ data[0].uid +'">'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        html.push(`<div class="col-auto">${index}</div>`); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        html.push('<div class="col">'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        for (const auditor of data) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            html.push(`<div class="d-inline-block mx-1" auditorId="${auditor.uid}"><i class="fa fa-user text-muted"></i> ${auditor.name} <small class="text-muted">${auditor.role}</small></div>`); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        html.push('</div>'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        html.push('<div class="col-auto">'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        // todo 添加会签或签时 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if (data[0].audit_type !== auditType.key.common) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            html.push(`<span class="badge badge-pill badge-${auditType.info[data[0].audit_type].class} badge-bg-small"><small>${auditType.info[data[0].audit_type].long}</small></span>`); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if (shenpi_status === shenpiConst.sp_status.sqspr || (shenpi_status === shenpiConst.sp_status.gdzs && index+1 !== datas.length)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            html.push('<a href="javascript: void(0)" class="text-danger pull-right">移除</a>'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        html.push('</div>'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        html.push('</li>'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            $('#auditList').html(html.join('')); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $('#batch_uncheck_btn').click(function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // 至少勾选一个 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if ($('#uncheck_list input:checked').length === 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                toastr.error('请至少勾选一个变更令'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            const cids = []; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            $('#uncheck_list input:checked').each(function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                cids.push($(this).val()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            $('#batch-sb').modal('hide'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            $('#batch-sb-progress').modal('show'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            $('#batch-sb-progress .progress-tz-bar').css('width', '0%'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            $('#batch-sb-progress .modal-footer').hide(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            setProgress($('#batch-sb-progress .progress-tz-bar'), 30, 'tz1'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            $('#batch-sb-progress .progress-tz-text').text('台账数据获取中...').removeClass('text-success'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            let changeListData; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            let gclGatherData; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            postData('/tender/' + tenderId + '/change/defaultBills', { form: 'batch' }, async function (result) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                gclGatherModel.loadLedgerData(result.bills); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                gclGatherModel.loadPosData(result.pos); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                gclGatherData = gclGatherModel.gatherGclData(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                gclGatherData = _.filter(gclGatherData, function (item) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    return item.leafXmjs && item.leafXmjs.length !== 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                for (const ggd in gclGatherData) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (gclGatherData[ggd].leafXmjs && gclGatherData[ggd].leafXmjs.length === 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        gclGatherData.splice(ggd, 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    gclGatherData[ggd].code = gclGatherData[ggd].b_code; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    let hadcid = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    for (const xmj of gclGatherData[ggd].leafXmjs) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        const changeLedger = _.find(result.changeLedgerList, { id: xmj.gcl_id }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        const changePos = _.find(result.changePosList, { id: xmj.mx_id, lid: xmj.gcl_id }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if (changeLedger || changePos) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            xmj.cid = 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            xmj.ccid = changeLedger ? changeLedger.ccid : changePos.ccid; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            hadcid = 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (hadcid !== 0) gclGatherData[ggd].cid = 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                // console.log(gclGatherData); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                // 数组去重 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                const dealBillList = result.dealBills; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                for (const db of gclGatherData) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    const exist_index = dealBillList.findIndex(function (item) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        return item.code === db.code && item.name === db.name && item.unit === db.unit && item.unit_price === db.unit_price; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (exist_index !== -1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        dealBillList.splice(exist_index, 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                changeListData = gclGatherData.concat(dealBillList).sort(sortByCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                console.log(changeListData); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                stopProgress($('#batch-sb-progress .progress-tz-bar'), 'tz1'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                $('#batch-sb-progress .progress-tz-text').text('台账数据加载完成').addClass('text-success'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                $('#batch-sb-progress .change-progress').html(''); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                for (const c of cids) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    const cInfo = uncheckList.find(item => item.cid === c); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (cInfo) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        $('#batch-sb-progress .change-progress').append(`<div id="change-${cInfo.cid}-progress"><div class="mt-3 progress">` + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            '<div class="progress-bar progress-bar-striped progress-bar-animated" role="progressbar" style="width: 0%" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100"></div>' + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    '</div>' + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    `<div class="mt-1">变更令 <b>${cInfo.code}</b> <span class="progress-change-text">上报处理中...</span></div></div>`); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        await checkAndChange(cInfo, changeListData, result.changeLedgerList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                $('#batch-sb-progress .modal-footer').show(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <% } %> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        let checkingList = []; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $('#batch-sp').on('show.bs.modal', function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            postData(`/tender/${tenderId}/change/batch/fun`, { type: 'get_shenpi_list' }, function (res) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                let html = ''; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                $('#select-all-checking').prop('checked', false); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                checkingList = res.checkingList; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                for (const l of res.checkingList) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    const finalHtml = l.is_finalAudit ? `<input type="text" class="form-control form-control-sm final_pcode_input" data-cid="${l.cid}" value="${l.p_code}" />` : ''; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    html += '<tr>' + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        `<td class="text-center"><input type="checkbox" value="${l.cid}"></td>` + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        `<td class=""><a href="/tender/${tenderId}/change/${l.cid}/information" target="_blank">${l.code}</a></td>` + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        `<td>${l.name}</td>` + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        `<td>${finalHtml}</td>` + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        '</tr>'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                $('#checking_list').html(html); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $('body').on('change', '.final_pcode_input', function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            const cid = $(this).data('cid'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            const cInfo = checkingList.find(item => item.cid === cid); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            cInfo.p_code = $(this).val(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $('#checking_list').on('click', 'input[type="checkbox"]', function (e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            e.stopPropagation(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // uncheckList tr全选 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $('#select-all-checking').click(function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            $('#checking_list tr').find('input[type="checkbox"]').prop('checked', $(this).prop('checked')); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $('#batch_checking_btn').click(function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // 至少勾选一个 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if ($('#checking_list input:checked').length === 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                toastr.error('请至少勾选一个变更令'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            const cids = []; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            $('#checking_list input:checked').each(function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                cids.push($(this).val()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            $('#batch-sp').modal('hide'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            $('#batch-sp-progress').modal('show'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            $('#batch-sp-progress .progress-tz-bar').css('width', '0%'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            $('#batch-sp-progress .modal-footer').hide(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            setProgress($('#batch-sp-progress .progress-tz-bar'), 30, 'tz2'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            $('#batch-sp-progress .progress-tz-text').text('台账数据获取中...').removeClass('text-success'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            let changeListData; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            let gclGatherData; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            postData('/tender/' + tenderId + '/change/defaultBills', { from: 'batch' }, async function (result) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                gclGatherModel.loadLedgerData(result.bills); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                gclGatherModel.loadPosData(result.pos); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                gclGatherData = gclGatherModel.gatherGclData(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                gclGatherData = _.filter(gclGatherData, function (item) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    return item.leafXmjs && item.leafXmjs.length !== 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                for (const ggd in gclGatherData) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (gclGatherData[ggd].leafXmjs && gclGatherData[ggd].leafXmjs.length === 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        gclGatherData.splice(ggd, 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    gclGatherData[ggd].code = gclGatherData[ggd].b_code; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    let hadcid = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    for (const xmj of gclGatherData[ggd].leafXmjs) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        const changeLedger = _.find(result.changeLedgerList, { id: xmj.gcl_id }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        const changePos = _.find(result.changePosList, { id: xmj.mx_id, lid: xmj.gcl_id }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if (changeLedger || changePos) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            xmj.cid = 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            xmj.ccid = changeLedger ? changeLedger.ccid : changePos.ccid; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            hadcid = 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (hadcid !== 0) gclGatherData[ggd].cid = 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                // console.log(gclGatherData); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                // 数组去重 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                const dealBillList = result.dealBills; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                for (const db of gclGatherData) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    const exist_index = dealBillList.findIndex(function (item) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        return item.code === db.code && item.name === db.name && item.unit === db.unit && item.unit_price === db.unit_price; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (exist_index !== -1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        dealBillList.splice(exist_index, 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                changeListData = gclGatherData.concat(dealBillList).sort(sortByCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                console.log(changeListData); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                stopProgress($('#batch-sp-progress .progress-tz-bar'), 'tz2'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                $('#batch-sp-progress .progress-tz-text').text('台账数据加载完成').addClass('text-success'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                $('#batch-sp-progress .change-progress').html(''); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                for (const c of cids) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    const cInfo = checkingList.find(item => item.cid === c); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (cInfo) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        $('#batch-sp-progress .change-progress').append(`<div id="change-${cInfo.cid}-progress"><div class="mt-3 progress">` + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            '<div class="progress-bar progress-bar-striped progress-bar-animated" role="progressbar" style="width: 0%" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100"></div>' + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            '</div>' + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            `<div class="mt-1">变更令 <b>${cInfo.code}</b> <span class="progress-change-text">审批处理中...</span></div></div>`); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        await checkAndChange(cInfo, changeListData, result.changeLedgerList, 'checking'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                $('#batch-sp-progress .modal-footer').show(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }, function (res) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }, false); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        let value = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // let interval; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        let stop = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        function setProgress(_this, time = 50, name) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            let intervalId = setInterval(function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (value < 100) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    value = parseInt(value) + 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    _this.css("width", value + "%").text(value + "%"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } else if (value === 100) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    value = parseInt(value) + 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    value = 30; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }, time); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            intervalIds[name] = intervalId; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        function resetProgress(_this) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            _this.removeClass('bg-success'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            _this.css("width", "0%").text("0%").attr('aria-valuenow', '0'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        function failProgress(_this, name) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (intervalIds[name]) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                _this.addClass('bg-danger'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                _this.css("width", "100%").text("失败"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                value = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                stop = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                clearInterval(intervalIds[name]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                intervalIds[name] = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        function stopProgress(_this, name) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (intervalIds[name]) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                _this.addClass('bg-success'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                _this.css("width", "100%").text("100%"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                value = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                stop = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                clearInterval(intervalIds[name]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                intervalIds[name] = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        async function checkAndChange(cInfo, changeListData, changeLedgerList, status = 'uncheck') { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            setProgress($(`#change-${cInfo.cid}-progress .progress-bar`), 30, `change-${cInfo.cid}`); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // 根据已添加的清单显示 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (cInfo.changeList.length > 0 && cInfo.changeList[0]) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                const removeList = []; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                const updateList = []; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                const updateGclIdList = []; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                for (const [index,clinfo] of cInfo.changeList.entries()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (clinfo.lid != 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        let listinfo = changeListData.find(function (item) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            return (item.id !== undefined && item.id == clinfo.lid) || (item.id === undefined && item.leafXmjs !== undefined && item.leafXmjs.length !== 0 && item.leafXmjs[0].gcl_id == clinfo.lid); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if (listinfo === undefined || (clinfo.lid && clinfo.gcl_id && clinfo.lid !== clinfo.gcl_id)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            // 有可能这部分台账发生变化,此时要更新清单lid信息,防止数据丢失 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            const newlistinfo = changeListData.find(function (item) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                return (item.id !== undefined && item.id == clinfo.gcl_id) || (item.id === undefined && item.leafXmjs !== undefined && item.leafXmjs.length !== 0 && _.find(item.leafXmjs, {gcl_id: clinfo.gcl_id })); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            if ((listinfo === undefined && newlistinfo) || (listinfo && newlistinfo && !isObjEqual(listinfo, newlistinfo))) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                listinfo = newlistinfo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                updateList.push({id: clinfo.id, lid: newlistinfo.leafXmjs[0].gcl_id}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                // 更新lid 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                cInfo.changeList[index].lid = newlistinfo.leafXmjs[0].gcl_id; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if (listinfo === undefined) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            // 针对旧数据获取清单信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            listinfo = changeListData[clinfo.lid - 1]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            if (listinfo === undefined) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                removeList.push(clinfo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        const info = makePushBwmx(clinfo, listinfo, removeList, updateList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if (info) break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if (_.findIndex(changeLedgerList, { id: clinfo.gcl_id }) !== -1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            // 可能因为升降级关系:细目,分部分项等会发生变化,更新清单 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            const updateInfo = {}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            if (info.code !== clinfo.xmj_code) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                updateInfo.xmj_code = info.code; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                // changeList[index].xmj_code = info.code; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            if (info.jldy !== clinfo.xmj_jldy) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                updateInfo.xmj_jldy = info.jldy; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                // changeList[index].xmj_jldy = info.jldy; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            if (info.dwgc !== clinfo.xmj_dwgc) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                updateInfo.xmj_dwgc = info.dwgc; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                // changeList[index].xmj_dwgc = info.dwgc; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            if (info.fbgc !== clinfo.xmj_fbgc) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                updateInfo.xmj_fbgc = info.fbgc; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                // changeList[index].xmj_fbgc = info.fbgc; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            if (info.fxgc !== clinfo.xmj_fxgc) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                updateInfo.xmj_fxgc = info.fxgc; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                // changeList[index].xmj_fxgc = info.fxgc; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            if (!_.isEmpty(updateInfo) && _.indexOf(updateGclIdList, clinfo.gcl_id) === -1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                updateGclIdList.push(clinfo.gcl_id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                // updateInfo.gcl_id = info.id; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                updateList.push({ row: updateInfo, where: { tid: tenderId, gcl_id: clinfo.gcl_id } }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                await sleep(2000); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (updateList.length > 0 || removeList.length > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    failProgress($('#change-' + cInfo.cid + '-progress .progress-bar'), `change-${cInfo.cid}`); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    $('#change-' + cInfo.cid + '-progress .mt-1').addClass('text-danger'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    $('#change-' + cInfo.cid + '-progress .progress-change-text').text('清单数据发生变化,需要进入到详情页处理'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                // 上报或审批变更令 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                let ss = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (status === 'uncheck') { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    postDataWithAsync('/tender/' + tenderId + '/change/' + cInfo.cid + '/information/audit/start', {}, function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    }, function (res) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        ss = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        failProgress($('#change-' + cInfo.cid + '-progress .progress-bar'), `change-${cInfo.cid}`); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        $('#change-' + cInfo.cid + '-progress .mt-1').addClass('text-danger'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        $('#change-' + cInfo.cid + '-progress .progress-change-text').text(res); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    }, false); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    const pData = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        change_id: cInfo.cid, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        w_code: cInfo.code, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        status: auditConst.status.checked, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        sdesc: '同意', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (cInfo.is_finalAudit) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if (cInfo.p_code) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            pData.p_code = cInfo.p_code; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            const postData2 = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                p_code: cInfo.p_code, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            let returnflag = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            postDataWithAsync('/tender/' + tenderId + '/change/' + cInfo.cid + '/check/codeRepeat',postData2, function (result) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            }, function (data) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                returnflag = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            if (!returnflag) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                failProgress($('#change-' + cInfo.cid + '-progress .progress-bar'), `change-${cInfo.cid}`); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                $('#change-' + cInfo.cid + '-progress .mt-1').addClass('text-danger'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                $('#change-' + cInfo.cid + '-progress .progress-change-text').text('批复编号不能与其它变更令重复!'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            failProgress($('#change-' + cInfo.cid + '-progress .progress-bar'), `change-${cInfo.cid}`); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            $('#change-' + cInfo.cid + '-progress .mt-1').addClass('text-danger'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            $('#change-' + cInfo.cid + '-progress .progress-change-text').text('变更令号(批复编号)不能为空!'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    postDataWithAsync('/tender/' + tenderId + '/change/approval', pData, function (result) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    }, function (res) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        ss = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        failProgress($('#change-' + cInfo.cid + '-progress .progress-bar'), `change-${cInfo.cid}`); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        $('#change-' + cInfo.cid + '-progress .mt-1').addClass('text-danger'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        $('#change-' + cInfo.cid + '-progress .progress-change-text').text(res); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    }, false); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (ss) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    stopProgress($('#change-' + cInfo.cid + '-progress .progress-bar'), `change-${cInfo.cid}`); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    $('#change-' + cInfo.cid + '-progress .mt-1').addClass('text-success'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    $('#change-' + cInfo.cid + '-progress .progress-change-text').text((status === 'uncheck' ? '上报' : '审批') + '成功'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const postDataWithAsync = function (url, data, successCallback, errorCallBack, showWaiting = true) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (showWaiting) showWaitingView(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            $.ajax({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                type:"POST", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                url: url, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                data: {'data': JSON.stringify(data)}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                dataType: 'json', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                cache: false, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                async: false, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                timeout: 60000, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                beforeSend: function(xhr) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    let csrfToken = Cookies.get('csrfToken_j'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    xhr.setRequestHeader('x-csrf-token', csrfToken); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                success: function(result){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (result.err === 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if (successCallback) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            successCallback(result.data); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        toastr.error(result.msg); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if (errorCallBack) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            errorCallBack(result.msg); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (showWaiting) closeWaitingView(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                error: function(jqXHR, textStatus, errorThrown){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    toastr.error('error: ' + textStatus + " " + errorThrown); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (errorCallBack) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        errorCallBack(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (showWaiting) closeWaitingView(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        function sleep(millisecond) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return new Promise(resolve => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                setTimeout(() => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    resolve() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                }, millisecond) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        function isObjEqual(o1,o2){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            var props1 = Object.getOwnPropertyNames(o1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            var props2 = Object.getOwnPropertyNames(o2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (props1.length != props2.length) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            for (var i = 0,max = props1.length; i < max; i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                var propName = props1[i]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (o1[propName] !== o2[propName]) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    return false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        function makePushBwmx(clinfo, listinfo, removeList, updateList) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            let needUpdate = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            const checkKey = ['name', 'code', 'unit', 'unit_price']; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            const checkLeafKey = ['oamount', 'bwmx', 'code', 'dwgc', 'fbgc', 'fxgc', 'jldy']; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (listinfo.leafXmjs !== undefined) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                const leafInfo = listinfo.leafXmjs.find(function (item) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    // const flag = (item.bwmx === undefined || item.bwmx === clinfo.bwmx || item.jldy === clinfo.bwmx) && item.gcl_id === clinfo.gcl_id && (!clinfo.mx_id || (item.mx_id && clinfo.mx_id && item.mx_id === clinfo.mx_id)) && (item.quantity !== null ? item.quantity === parseFloat(clinfo.oamount) : 0 === parseFloat(clinfo.oamount)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    const flag = item.gcl_id === clinfo.gcl_id && (!clinfo.mx_id || (item.mx_id && clinfo.mx_id && item.mx_id === clinfo.mx_id)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (flag && item.code === clinfo.xmj_code) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        return flag && item.code === clinfo.xmj_code; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    return flag; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (leafInfo) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    const oneUpdate = { id: clinfo.id }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    // 判断要不要更新名称,单位,原数量,单价 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    checkKey.forEach(function (key) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if (listinfo[key] !== clinfo[key]) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            oneUpdate[key] = listinfo[key]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            // clinfo[key] = listinfo[key]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            if (key === 'unit') { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                const changeKey = ['oamount', 'oamount2', 'camount']; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                changeKey.forEach(function (key) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    const value = ZhCalc.round(clinfo[key], findDecimal(listinfo[key])); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    if (value !== clinfo[key]) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        oneUpdate[key] = value; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        // clinfo[key] = value; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            needUpdate = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    checkLeafKey.forEach(function (key) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        // 只有数量是对比leafInfo,其它对比listinfo,且有些值需要重新计算 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if (key === 'oamount') { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            if (leafInfo.quantity !== clinfo[key]) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                oneUpdate[key] = leafInfo.quantity; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                // clinfo[key] = leafInfo.quantity; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                needUpdate = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } else if (key === 'bwmx') { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            if (leafInfo[key] !== undefined && leafInfo[key] !== clinfo[key]) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                oneUpdate[key] = leafInfo[key]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                // clinfo[key] = leafInfo[key]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                needUpdate = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            } else if (leafInfo[key] === undefined && leafInfo.jldy !== clinfo[key]) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                oneUpdate[key] = leafInfo.jldy; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                // clinfo[key] = leafInfo.jldy; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                needUpdate = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            if (leafInfo[key] !== clinfo['xmj_' + key]) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                oneUpdate['xmj_' + key] = leafInfo[key]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                // clinfo['xmj_' + key] = leafInfo[key]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                needUpdate = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (needUpdate) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        updateList.push(oneUpdate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    removeList.push(clinfo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    needUpdate = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return needUpdate; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 编号排序,多重判断 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        function sortByCode(a, b) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            let code1 = a.code.split('-'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            let code2 = b.code.split('-'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            let code1length = code1.length; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            let code2length = code2.length; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            for (let i = 0; i < code1length; i ++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (i+1 <= code2length) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (code1[i] != code2[i]) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if (/^\d+$/.test(code1[i]) && /^\d+$/.test(code2[i])) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            return parseInt(code1[i]) - parseInt(code2[i]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } else if (!/^\d+$/.test(code1[i]) && /^\d+$/.test(code2[i])) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            return 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } else if (/^\d+$/.test(code1[i]) && !/^\d+$/.test(code2[i])) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            return -1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            const str1length = code1[i].length; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            const str2length = code2[i].length; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            for (let j = 0; j < str1length; j++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                if (j+1 <= str2length) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    if (code1[i].charAt(j) != code2[i].charAt(j)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        return code1[i].charAt(j).charCodeAt() - code2[i].charAt(j).charCodeAt(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    }  else if (j+1 == str1length && code1[i].charAt(j) == code2[i].charAt(j)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        if (str1length == str2length) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                            return 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                            return str1length - str2length; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    if (j+1 >= str1length) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        return 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        return -1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } else if (i+1 == code1length && code1[i] == code2[i]) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if (code1length == code2length) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            return 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            return code1length - code2length; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (i+1 >= code1length) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        return 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        return -1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+</script> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 |