function checkMoney(money) {
    return money !==null ?  commaDelimiter(money) : '/'
}
$(function(){
    // resize时设置操作部分的样式(定位的top值)
    $('body').resize(function(){
        $(".projectManagementBottom").css('top',$(".projectManagementTop").height()+$(".businessNavigation").height()+$('.projectManagementBottom .detailContentBox-title').height()+'px');
    });
    $('body').resize();

    // 拖动中间线
    $(".projectManagementBottom .detailContentBox-title").mousedown(function(){
        var isDrag = true;
        $(document).mousemove(function(e){
            if( isDrag ){
                if( e.clientY>=($(".breadcrumb").height()+$(".yk_head").height()) && $('.detailContentBox').height()-e.clientY+$(".breadcrumb").height()+$(".yk_head").height()>200 ){
                    $(".projectManagementTop").css('height',(e.clientY-$(".businessNavigation").height()-$(".breadcrumb").height()-$(".yk_head").height())+'px');
                    $(".projectManagementBottom").css('top',(e.clientY-$(".breadcrumb").height()-$(".yk_head").height())+'px');
                };
            };
        });
        $(document).unbind('mouseup').bind('mouseup',function(){
            $(document).unbind('mousemove');
            isDrag = false;
        });
        return false;
    });

    // 点击历史信息标题展开对应内容
    $(".projectManagementTop").on('click','.detailContentBox-title',function(){
        if( $(this).hasClass('up') ){
            $(this).removeClass('up');
            $(this).nextAll().each(function(i,ele){
                if( !$(ele).hasClass('hide') ){
                    $(ele).show();
                }
            });
        }else{
            $(this).addClass('up');
            $(this).nextAll().hide();
        }
    });

    // 点击导航展开对应部分的内容
    $('.businessNavigation').on("click","li",function(){
        var scrollTopNo = $('.businessNavigation li').index($(this));
        if( $('.projectManagementTop .detailContentBox-title').eq(scrollTopNo).hasClass('up') ){
            $('.projectManagementTop .detailContentBox-title').eq(scrollTopNo).removeClass('up');
            $('.projectManagementTop .detailContentBox-title').eq(scrollTopNo).nextAll().each(function(i,ele){
                if( !$(ele).hasClass('hide') ){
                    $(ele).show();
                }
            });
        };
        var scrollTopHeight = 0;
        if( scrollTopNo == 0 ){
            scrollTopHeight = 0;
        }else{
            for( var i=0;i<scrollTopNo;i++ ){
                scrollTopHeight += $('.projectManagementTop .nodeShow').eq(i).height();
            };
            i = null;
        };
        $('.projectManagementTop .newTabAddUpdateBox').animate({'scrollTop':scrollTopHeight})
    });

    // 加载查看历史信息dom元素
    $(".projectManagementTop .newTabAddUpdateBox").load('/bill/history',function(){
        var businessKey,async = true;
        if( GetRequest() && GetRequest()['historyId'] ){
            businessKey = GetRequest()['historyId'];
            async = false;
            //window.location.href = window.location.href.split('?')[0]
        }else{
            businessKey = $('[name=businessKey]').val();
        };

        // 获取历史信息
        $.ajax({
            url:'/businessProcessingTask/doBusinessHistoryView',
            type:'get',
            data:{
                'businessKey':businessKey,
                'businessType':'BillBasicInformation'
            },
            async:async,
            success:function(data){
                if( data.success ){
                    var contractHistoryData = data.data;
                    for( var i=0;i<contractHistoryData.length;i++ ){
                        // 添加导航dom
                        $(".businessNavigation ul").append('<li><div class="businessCircle">'+(i+1)+'</div><div class="businessWord"><span>'+contractHistoryData[i].formBusinessName+'</span></div></li>');

                        //
                        if( contractHistoryData[i].formBusinessName == '录入结算单' || contractHistoryData[i].formBusinessName =='结算单修改' || contractHistoryData[i].formBusinessName =='变更结算单'){
                            //标题log
                            var logText = '';
                            if(contractHistoryData[i].businessProcessingLogVo) {
                                if (contractHistoryData[i].businessProcessingLogVo.assigneeTypeName) {
                                    logText += '<span style="color: #333;font-size: 0.13rem;font-weight: normal">' + contractHistoryData[i].businessProcessingLogVo.assigneeTypeName + '：' + contractHistoryData[i].businessProcessingLogVo.assigneeName + ' </span>';
                                }

                                if (contractHistoryData[i].businessProcessingLogVo.status) {
                                    logText += '<span style="color: #333;font-size: 0.13rem;font-weight: normal">状态：' + contractHistoryData[i].businessProcessingLogVo.status + ' </span>';
                                }

                                if (contractHistoryData[i].businessProcessingLogVo.startTime) {
                                    logText += '<span style="color: #333;font-size: 0.13rem;font-weight: normal">开始时间：' + contractHistoryData[i].businessProcessingLogVo.startTime + ' </span>';
                                }

                                if (contractHistoryData[i].businessProcessingLogVo.endTime) {
                                    logText += '<span style="color: #333;font-size: 0.13rem;font-weight: normal">完成时间：' + contractHistoryData[i].businessProcessingLogVo.endTime + ' </span>';
                                }
                            }

                            var contractMakingViewBox = $(".historyHideArea .contractMakingViewBox").clone();
                            contractMakingViewBox.find('.contractMakingViewBox-log').append(logText)

                            if(contractHistoryData[i].formBusinessName == '录入结算单') {
                                contractMakingViewBox.find(".detailContentBox-title-small").text('录入结算单')
                            }else if(contractHistoryData[i].formBusinessName == '结算单修改'){
                                contractMakingViewBox.find(".detailContentBox-title-small").text('结算单修改')
                            }else {
                                contractMakingViewBox.find(".detailContentBox-title-small").text('变更结算单')
                            }

                            // 结算信息
                            contractMakingViewBox.find('.contractMakingView-enterpriseName').text(contractHistoryData[i].obj.supplier.enterpriseName);
                            contractMakingViewBox.find('.contractMakingView-customerEnterpriseName').text(contractHistoryData[i].obj.customer.enterpriseName);
                            contractMakingViewBox.find('.contractMakingView-businessName').text(contractHistoryData[i].obj.businessName);
                            contractMakingViewBox.find('.contractMakingView-businessNo').text(contractHistoryData[i].obj.businessNumber);
                            contractMakingViewBox.find('.contractMakingView-platformName').text(contractHistoryData[i].obj.platform.platformName);
                            contractMakingViewBox.find('.contractMakingView-operatorSupplier').text(contractHistoryData[i].obj.operatorSupplier);
                            contractMakingViewBox.find('.contractMakingView-operatorEnterprise').text(contractHistoryData[i].obj.operatorEnterprise);
                            contractMakingViewBox.find('.contractMakingView-settlementDate').text(contractHistoryData[i].obj.settlementDate);
                            contractMakingViewBox.find('.contractMakingView-settlementAmount').text(contractHistoryData[i].obj.settlementAmount);

                            //货物信息
                            var goodsInfoList=contractHistoryData[i].obj.settlementHisGoodsInfos;
                            if( goodsInfoList ){
                                let totalNum = 0
                                let totalPrice = 0
                                let totalPurchase = 0
                                var trs='';
                                for(var ii=0;ii<goodsInfoList.length;ii++ ){
                                    var num=ii+1;
                                    trs+='<tr>'+
                                        '<td  class="enter">'+num+'</td>'+
                                        '<td  class="enter">'+goodsInfoList[ii].acceptanceNumber+'</td>'+
                                        '<td  class="enter">'+goodsInfoList[ii].acceptanceDate+'</td>'+
                                        '<td  class="enter">'+goodsInfoList[ii].goodsName+'</td>'+
                                        '<td  class="enter">'+goodsInfoList[ii].goodsFactory+'</td>'+
                                        '<td  class="enter">'+goodsInfoList[ii].goodsType+'</td>'+
                                        '<td  class="enter">'+goodsInfoList[ii].goodsUnit+'</td>'+
                                        '<td  class="enter">'+ (Number(goodsInfoList[ii].goodsQuantity)).toFixed(4)+'</td>'+
                                        '<td  class="enter">'+ checkMoney((Number(goodsInfoList[ii].salesPrice)).toFixed(2)) +'</td>'+
                                        '<td  class="enter">'+ checkMoney((Number(goodsInfoList[ii].salesTotalPrice)).toFixed(2)) +'</td>'+
                                        '<td  class="enter">'+ checkMoney((Number(goodsInfoList[ii].salesGuaranteeMoney)).toFixed(2)) +'</td>'+
                                        '<td  class="enter">'+ checkMoney((Number(goodsInfoList[ii].purchasePrice)).toFixed(2)) +'</td>'+
                                        '<td  class="enter">'+ checkMoney((Number(goodsInfoList[ii].purchaseTotalPrice)).toFixed(2)) +'</td>'+
                                        '<td  class="enter">'+ checkMoney((Number(goodsInfoList[ii].purchaseGuaranteeMoney)).toFixed(2)) +'</td>'+
                                        '</tr>';
                                    let salesTotalPrice = goodsInfoList[ii].salesTotalPrice == null ? 0 : goodsInfoList[ii].salesTotalPrice
                                    let purchaseTotalPrice = goodsInfoList[ii].purchaseTotalPrice == null ? 0 : goodsInfoList[ii].purchaseTotalPrice
                                    totalPrice += salesTotalPrice
                                    totalPurchase += purchaseTotalPrice
                                    totalNum += goodsInfoList[ii].goodsQuantity
                                }
                                ii=null;
                                contractMakingViewBox.find(".totalNum").text( totalNum ? (Math.round(totalNum*100)/100).toFixed(4) : '');
                                contractMakingViewBox.find(".totalPrice").text( totalPrice ? commaDelimiter((Math.round(totalPrice*100)/100).toFixed(2)) : '');
                                contractMakingViewBox.find(".totalPurchase").text( totalPurchase ? commaDelimiter((Math.round(totalPurchase*100)/100).toFixed(2)) : '');
                                contractMakingViewBox.find(".goodsInfoList_header").after(trs);
                            }

                            //占用费
                          /*   var goodsInfoList=contractHistoryData[i].obj.billCapitalOccupationFees;
                            if( goodsInfoList ){
                                var trs='';
                                for(var ii=0;ii<goodsInfoList.length;ii++ ){
                                    var num=ii+1;
                                    trs+='<tr>'+
                                        '<td  class="enter">'+num+'</td>'+
                                        '<td  class="enter">'+goodsInfoList[ii].acceptanceDate+'</td>'+
                                        '<td  class="enter">'+goodsInfoList[ii].customer.enterpriseName+'</td>'+
                                        '<td  class="enter">'+goodsInfoList[ii].goodsName+'</td>'+
                                        '<td  class="enter">'+goodsInfoList[ii].goodsFactory+'</td>'+
                                        '<td  class="enter">'+goodsInfoList[ii].goodsType+'</td>'+
                                        '<td  class="enter">'+goodsInfoList[ii].goodsUnit+'</td>'+
                                        '<td  class="enter">'+goodsInfoList[ii].goodsNum+'</td>'+
                                        '<td  class="enter">'+goodsInfoList[ii].capitalOccupationFee ? commaDelimiter(goodsInfoList[ii].capitalOccupationFee) : '/'+'</td>'+
                                        '</tr>';
                                }
                                ii=null;
                                contractMakingViewBox.find(".goodsInfoList2_header").after(trs);
                            } */

                            // contractMakingViewBox.find('.contractMakingView-companyName').text(contractHistoryData[i].obj.platform.platformName);
                            // contractMakingViewBox.find('.contractMakingView-managerName').text(contractHistoryData[i].obj.managerName);
                            // contractMakingViewBox.find('.contractMakingView-billInformationNumber').text(contractHistoryData[i].obj.billInformationNumber);
                            // contractMakingViewBox.find('.contractMakingView-settlementDate').text(contractHistoryData[i].obj.settlementDate);
                            // contractMakingViewBox.find('.contractMakingView-settlementAmount').text( contractHistoryData[i].obj.settlementAmount ? commaDelimiter(contractHistoryData[i].obj.settlementAmount) : '/');
                            contractMakingViewBox.find('.contractMakingView-settlementStartDate').text(contractHistoryData[i].obj.settlementStartDate);
                            contractMakingViewBox.find('.contractMakingView-settlementEndDate').text(contractHistoryData[i].obj.settlementEndDate);

                            //回款计划
                            var goodsInfoList=contractHistoryData[i].obj.settlementHisRepaymentPlans;
                            if( goodsInfoList ){
                                var trs='',sumAmount= 0;
                                for(var ii=0;ii<goodsInfoList.length;ii++ ){
                                    var num=ii+1;
                                    trs+='<tr>'+
                                        '<td  class="enter">'+num+'</td>'+
                                        '<td  class="enter">'+goodsInfoList[ii].repaymentDate+'</td>'+
                                        '<td  class="enter">'+(goodsInfoList[ii].repaymentAmount ? commaDelimiter(goodsInfoList[ii].repaymentAmount) : '/')+'</td>'+
                                        '</tr>';
                                    sumAmount += goodsInfoList[ii].repaymentAmount;
                                }
                                ii=null;
                                contractMakingViewBox.find(".totalSum").text( sumAmount ? commaDelimiter((Math.round(sumAmount*100)/100).toFixed(2)) : '');
                                contractMakingViewBox.find(".paymentList_header").after(trs);
                            }


                            if( contractHistoryData[i].obj.files ){
                                var fileList=contractHistoryData[i].obj.files;
                                var filesHtm='';
                                if( fileList.length>0 ){
                                    //contractMakingViewBox.find(".uploadFile").removeClass("hide");
                                    for(var ii=0;ii<fileList.length;ii++){
                                        filesHtm+='<div class="uploaderFile oldFile">'+
                                            '<input type="hidden" class="fileid" value="'+fileList[ii].id+'">'+
                                            '<div class="fileContent"><div class="file-wrapper">';
                                        var fileType=fileList[ii].fileType;
                                        if(fileType=='.jpg' || fileType=='.jpeg' || fileType=='.png' || fileType=='.bmp'){
                                            filesHtm+='<div class="file-icon" style="color: rgb(119, 31, 173);"><div  class="file-icon-image"'+
                                                'style="background-image:url('+ fileList[ii].path +');"></div></div>';
                                        }else {
                                            filesHtm+='<div class="file-icon" style="color:#5AC4FC;"><div class="file-icon-image"><i class="icon icon-file-pdf"></i></div></div>';
                                        }
                                        filesHtm+='<div class="content">'+
                                            '<div class="file-name">'+fileList[ii].originalName+'</div>'+
                                            '<div class="file-size small text-muted">'+(fileList[ii].size/1024/1024).toFixed(2)+'MB</div>'+
                                            '</div>'+
                                            '<div class="actions" style="width: 1.032rem;">'+
                                            '<a class="btn btn-link btn-preview-file" target="_blank" href="/fileStorage/preview?fileId='+fileList[ii].id+'">'+
                                            '<em style="display:none">预览</em>'+
                                            '<i class="operateIconfont operateIcon-yulan"></i>'+
                                            '</a>'+
                                            // '<a class="btn btn-link btn-download-file" style="float:right" href="/fileStorage/downloadFile?fileId='+fileList[ii].id+'">'+
                                            // '<em style="display:none">下载</em>'+
                                            // '<i class="operateIconfont operateIcon-xiazai"></i>'+
                                            // '</a>'+
                                            '</div></div>';
                                    }
                                    contractMakingViewBox.find(".contractMakingView-uploadFile").append(filesHtm);
                                }
                            }

                            if( contractHistoryData[i].obj.netPriceFiles ){
                                var fileList=contractHistoryData[i].obj.netPriceFiles;
                                var filesHtm='';
                                if( fileList.length>0 ){
                                    //contractMakingViewBox.find(".uploadFile").removeClass("hide");
                                    for(var ii=0;ii<fileList.length;ii++){
                                        filesHtm+='<div class="uploaderFile oldFile">'+
                                            '<input type="hidden" class="fileid" value="'+fileList[ii].id+'">'+
                                            '<div class="fileContent"><div class="file-wrapper">';
                                        var fileType=fileList[ii].fileType;
                                        if(fileType=='.jpg' || fileType=='.jpeg' || fileType=='.png' || fileType=='.bmp'){
                                            filesHtm+='<div class="file-icon" style="color: rgb(119, 31, 173);"><div  class="file-icon-image"'+
                                                'style="background-image:url('+ fileList[ii].path +');"></div></div>';
                                        }else {
                                            filesHtm+='<div class="file-icon" style="color:#5AC4FC;"><div class="file-icon-image"><i class="icon icon-file-pdf"></i></div></div>';
                                        }
                                        filesHtm+='<div class="content">'+
                                            '<div class="file-name">'+fileList[ii].originalName+'</div>'+
                                            '<div class="file-size small text-muted">'+(fileList[ii].size/1024/1024).toFixed(2)+'MB</div>'+
                                            '</div>'+
                                            '<div class="actions" style="width: 1.032rem;">'+
                                            '<a class="btn btn-link btn-preview-file" target="_blank" href="/fileStorage/preview?fileId='+fileList[ii].id+'">'+
                                            '<em style="display:none">预览</em>'+
                                            '<i class="operateIconfont operateIcon-yulan"></i>'+
                                            '</a>'+
                                            // '<a class="btn btn-link btn-download-file" style="float:right" href="/fileStorage/downloadFile?fileId='+fileList[ii].id+'">'+
                                            // '<em style="display:none">下载</em>'+
                                            // '<i class="operateIconfont operateIcon-xiazai"></i>'+
                                            // '</a>'+
                                            '</div></div>';
                                    }
                                    contractMakingViewBox.find(".contractMakingView-netPriceFile").append(filesHtm);
                                }
                            }

                            //buchong
                            contractMakingViewBox.find('.contractMakingView-supplement').text(contractHistoryData[i].obj.additionalRemarks);
                            if( contractHistoryData[i].obj.additionalFiles ){
                                var fileList=contractHistoryData[i].obj.additionalFiles;
                                var filesHtm='';
                                if( fileList.length>0 ){
                                    //contractMakingViewBox.find(".uploadFile").removeClass("hide");
                                    for(var ii=0;ii<fileList.length;ii++){
                                        filesHtm+='<div class="uploaderFile oldFile">'+
                                            '<input type="hidden" class="fileid" value="'+fileList[ii].id+'">'+
                                            '<div class="fileContent"><div class="file-wrapper">';
                                        var fileType=fileList[ii].fileType;
                                        if(fileType=='.jpg' || fileType=='.jpeg' || fileType=='.png' || fileType=='.bmp'){
                                            filesHtm+='<div class="file-icon" style="color: rgb(119, 31, 173);"><div  class="file-icon-image"'+
                                                'style="background-image:url('+ fileList[ii].path +');"></div></div>';
                                        }else {
                                            filesHtm+='<div class="file-icon" style="color:#5AC4FC;"><div class="file-icon-image"><i class="icon icon-file-pdf"></i></div></div>';
                                        }
                                        filesHtm+='<div class="content">'+
                                            '<div class="file-name">'+fileList[ii].originalName+'</div>'+
                                            '<div class="file-size small text-muted">'+(fileList[ii].size/1024/1024).toFixed(2)+'MB</div>'+
                                            '</div>'+
                                            '<div class="actions" style="width: 1.032rem;">'+
                                            '<a class="btn btn-link btn-preview-file" target="_blank" href="/fileStorage/preview?fileId='+fileList[ii].id+'">'+
                                            '<em style="display:none">预览</em>'+
                                            '<i class="operateIconfont operateIcon-yulan"></i>'+
                                            '</a>'+
                                            // '<a class="btn btn-link btn-download-file" style="float:right" href="/fileStorage/downloadFile?fileId='+fileList[ii].id+'">'+
                                            // '<em style="display:none">下载</em>'+
                                            // '<i class="operateIconfont operateIcon-xiazai"></i>'+
                                            // '</a>'+
                                            '</div></div>';
                                    }
                                    contractMakingViewBox.find(".contractMakingView-supUploadFile").append(filesHtm);
                                }
                            }
                            $(".showarea").append(contractMakingViewBox.show());

                        };

                        //审核
                        if( contractHistoryData[i].formBusinessName == '财务审核' || contractHistoryData[i].formBusinessName == '财务审核变更'){
                            //标题log
                            var logText = '';
                            if(contractHistoryData[i].businessProcessingLogVo) {
                                if (contractHistoryData[i].businessProcessingLogVo.assigneeTypeName) {
                                    logText += '<span style="color: #333;font-size: 0.13rem;font-weight: normal">' + contractHistoryData[i].businessProcessingLogVo.assigneeTypeName + '：' + contractHistoryData[i].businessProcessingLogVo.assigneeName + ' </span>';
                                }

                                if (contractHistoryData[i].businessProcessingLogVo.status) {
                                    logText += '<span style="color: #333;font-size: 0.13rem;font-weight: normal">状态：' + contractHistoryData[i].businessProcessingLogVo.status + ' </span>';
                                }

                                if (contractHistoryData[i].businessProcessingLogVo.startTime) {
                                    logText += '<span style="color: #333;font-size: 0.13rem;font-weight: normal">开始时间：' + contractHistoryData[i].businessProcessingLogVo.startTime + ' </span>';
                                }

                                if (contractHistoryData[i].businessProcessingLogVo.endTime) {
                                    logText += '<span style="color: #333;font-size: 0.13rem;font-weight: normal">完成时间：' + contractHistoryData[i].businessProcessingLogVo.endTime + ' </span>';
                                }
                                // $('.terminationContractApprovalViewBox-log').append(logText)
                            }

                            var terminationContractApprovalViewBox = $(".historyHideArea .terminationContractApprovalViewBox").clone();
                            terminationContractApprovalViewBox.find('.terminationContractApprovalViewBox-log').append(logText)

                            if(contractHistoryData[i].formBusinessName == '财务审核') {
                                terminationContractApprovalViewBox.find(".detailContentBox-title-small").text('财务审核')
                            }else if(contractHistoryData[i].formBusinessName == '财务审核变更'){
                                terminationContractApprovalViewBox.find(".detailContentBox-title-small").text('财务审核变更')
                            }
                              // 上游结算单
                              if( contractHistoryData[i].obj.files.length){
                                  var fileList=contractHistoryData[i].obj.files;
                                  var filesHtm='';
                                  if( fileList.length>0 ){
                                      //contractMakingViewBox.find(".uploadFile").removeClass("hide");
                                      for(var ii=0;ii<fileList.length;ii++){
                                          filesHtm+='<div class="uploaderFile oldFile">'+
                                              '<input type="hidden" class="fileid" value="'+fileList[ii].id+'">'+
                                              '<div class="fileContent"><div class="file-wrapper">';
                                          var fileType=fileList[ii].fileType;
                                          if(fileType=='.jpg' || fileType=='.jpeg' || fileType=='.png' || fileType=='.bmp'){
                                              filesHtm+='<div class="file-icon" style="color: rgb(119, 31, 173);"><div  class="file-icon-image"'+
                                                  'style="background-image:url('+ fileList[ii].path +');"></div></div>';
                                          }else {
                                              filesHtm+='<div class="file-icon" style="color:#5AC4FC;"><div class="file-icon-image"><i class="icon icon-file-pdf"></i></div></div>';
                                          }
                                          filesHtm+='<div class="content">'+
                                              '<div class="file-name">'+fileList[ii].originalName+'</div>'+
                                              '<div class="file-size small text-muted">'+(fileList[ii].size/1024/1024).toFixed(2)+'MB</div>'+
                                              '</div>'+
                                              '<div class="actions" style="width: 1.032rem;">'+
                                              '<a class="btn btn-link btn-preview-file" target="_blank" href="/fileStorage/preview?fileId='+fileList[ii].id+'">'+
                                              '<em style="display:none">预览</em>'+
                                              '<i class="operateIconfont operateIcon-yulan"></i>'+
                                              '</a>'+
                                            //   '<a class="btn btn-link btn-download-file" style="float:right" href="/fileStorage/downloadFile?fileId='+fileList[ii].id+'">'+
                                            //   '<em style="display:none">下载</em>'+
                                            //   '<i class="operateIconfont operateIcon-xiazai"></i>'+
                                            //   '</a>'+
                                              '</div></div>';
                                      }
                                      terminationContractApprovalViewBox.find(".terminationContractApprovalView-supUploadFile").append(filesHtm);
                                  }
                              }

                            //审批结论
                            terminationContractApprovalViewBox.find(".terminationContractApprovalView-approvalConclusion").text(contractHistoryData[i].obj.result);

                            //审批意见
                            if( contractHistoryData[i].obj.approvalComment ){
                                terminationContractApprovalViewBox.find(".terminationContractApprovalView-approvalOpinion").text(contractHistoryData[i].obj.approvalComment);
                            }

                            $(".showarea").append(terminationContractApprovalViewBox.show());
                        }

                        //补充
                        if( contractHistoryData[i].formBusinessName == '补充资料' ){
                            //标题log
                            var logText = '';
                            if(contractHistoryData[i].businessProcessingLogVo) {
                                if (contractHistoryData[i].businessProcessingLogVo.assigneeTypeName) {
                                    logText += '<span style="color: #333;font-size: 0.13rem;font-weight: normal">' + contractHistoryData[i].businessProcessingLogVo.assigneeTypeName + '：' + contractHistoryData[i].businessProcessingLogVo.assigneeName + ' </span>';
                                }

                                if (contractHistoryData[i].businessProcessingLogVo.status) {
                                    logText += '<span style="color: #333;font-size: 0.13rem;font-weight: normal">状态：' + contractHistoryData[i].businessProcessingLogVo.status + ' </span>';
                                }

                                if (contractHistoryData[i].businessProcessingLogVo.startTime) {
                                    logText += '<span style="color: #333;font-size: 0.13rem;font-weight: normal">开始时间：' + contractHistoryData[i].businessProcessingLogVo.startTime + ' </span>';
                                }

                                if (contractHistoryData[i].businessProcessingLogVo.endTime) {
                                    logText += '<span style="color: #333;font-size: 0.13rem;font-weight: normal">完成时间：' + contractHistoryData[i].businessProcessingLogVo.endTime + ' </span>';
                                }
                                // $('.terminationContractApprovalViewBox-log').append(logText)
                            }

                            var supplementViewBox = $(".historyHideArea .supplementViewBox").clone();
                            supplementViewBox.find('.supplementViewBox-log').append(logText)

                            if( contractHistoryData[i].obj.addFiles ){
                                var fileList=contractHistoryData[i].obj.addFiles;
                                var filesHtm='';
                                if( fileList.length>0 ){
                                    //contractMakingViewBox.find(".uploadFile").removeClass("hide");
                                    for(var ii=0;ii<fileList.length;ii++){
                                        filesHtm+='<div class="uploaderFile oldFile">'+
                                            '<input type="hidden" class="fileid" value="'+fileList[ii].id+'">'+
                                            '<div class="fileContent"><div class="file-wrapper">';
                                        var fileType=fileList[ii].fileType;
                                        if(fileType=='.jpg' || fileType=='.jpeg' || fileType=='.png' || fileType=='.bmp'){
                                            filesHtm+='<div class="file-icon" style="color: rgb(119, 31, 173);"><div  class="file-icon-image"'+
                                                'style="background-image:url('+ fileList[ii].path +');"></div></div>';
                                        }else {
                                            filesHtm+='<div class="file-icon" style="color:#5AC4FC;"><div class="file-icon-image"><i class="icon icon-file-pdf"></i></div></div>';
                                        }
                                        filesHtm+='<div class="content">'+
                                            '<div class="file-name">'+fileList[ii].originalName+'</div>'+
                                            '<div class="file-size small text-muted">'+(fileList[ii].size/1024/1024).toFixed(2)+'MB</div>'+
                                            '</div>'+
                                            '<div class="actions" style="width: 1.032rem;">'+
                                            '<a class="btn btn-link btn-preview-file" target="_blank" href="/fileStorage/preview?fileId='+fileList[ii].id+'">'+
                                            '<em style="display:none">预览</em>'+
                                            '<i class="operateIconfont operateIcon-yulan"></i>'+
                                            '</a>'+
                                            // '<a class="btn btn-link btn-download-file" style="float:right" href="/fileStorage/downloadFile?fileId='+fileList[ii].id+'">'+
                                            // '<em style="display:none">下载</em>'+
                                            // '<i class="operateIconfont operateIcon-xiazai"></i>'+
                                            // '</a>'+
                                            '</div></div>';
                                    }
                                    supplementViewBox.find(".supplementView-uploadFile").append(filesHtm);
                                }
                            }

                            $(".showarea").append(supplementViewBox.show());
                        }

                        //审核补充
                        if( contractHistoryData[i].formBusinessName == '审核补充资料' ){
                            //标题log
                            var logText = '';
                            if(contractHistoryData[i].businessProcessingLogVo) {
                                if (contractHistoryData[i].businessProcessingLogVo.assigneeTypeName) {
                                    logText += '<span style="color: #333;font-size: 0.13rem;font-weight: normal">' + contractHistoryData[i].businessProcessingLogVo.assigneeTypeName + '：' + contractHistoryData[i].businessProcessingLogVo.assigneeName + ' </span>';
                                }

                                if (contractHistoryData[i].businessProcessingLogVo.status) {
                                    logText += '<span style="color: #333;font-size: 0.13rem;font-weight: normal">状态：' + contractHistoryData[i].businessProcessingLogVo.status + ' </span>';
                                }

                                if (contractHistoryData[i].businessProcessingLogVo.startTime) {
                                    logText += '<span style="color: #333;font-size: 0.13rem;font-weight: normal">开始时间：' + contractHistoryData[i].businessProcessingLogVo.startTime + ' </span>';
                                }

                                if (contractHistoryData[i].businessProcessingLogVo.endTime) {
                                    logText += '<span style="color: #333;font-size: 0.13rem;font-weight: normal">完成时间：' + contractHistoryData[i].businessProcessingLogVo.endTime + ' </span>';
                                }
                                // $('.terminationContractApprovalViewBox-log').append(logText)
                            }

                            var supplementApprovalViewBox = $(".historyHideArea .supplementApprovalViewBox").clone();
                            supplementApprovalViewBox.find('.supplementApprovalViewBox-log').append(logText)

                            //审批结论
                            supplementApprovalViewBox.find(".supplementApprovalView-approvalConclusion").text(contractHistoryData[i].obj.result);

                            //审批意见
                            if( contractHistoryData[i].obj.approvalComment ){
                                supplementApprovalViewBox.find(".supplementApprovalView-approvalOpinion").text(contractHistoryData[i].obj.approvalComment);
                            }

                            $(".showarea").append(supplementApprovalViewBox.show());
                        }

                        //签署确认
                        if (contractHistoryData[i].formBusinessName == '签署结算单' ) {
                            //标题log
                            var logText = '';
                            if (contractHistoryData[i].businessProcessingLogVo) {
                                if (contractHistoryData[i].businessProcessingLogVo.assigneeTypeName) {
                                    logText += '<span style="color: #333;font-size: 0.13rem;font-weight: normal">' + contractHistoryData[i].businessProcessingLogVo.assigneeTypeName + '：' + contractHistoryData[i].businessProcessingLogVo.assigneeName + ' </span>';
                                }

                                if (contractHistoryData[i].businessProcessingLogVo.status) {
                                    logText += '<span style="color: #333;font-size: 0.13rem;font-weight: normal">状态：' + contractHistoryData[i].businessProcessingLogVo.status + ' </span>';
                                }

                                if (contractHistoryData[i].businessProcessingLogVo.startTime) {
                                    logText += '<span style="color: #333;font-size: 0.13rem;font-weight: normal">开始时间：' + contractHistoryData[i].businessProcessingLogVo.startTime + ' </span>';
                                }

                                if (contractHistoryData[i].businessProcessingLogVo.endTime) {
                                    logText += '<span style="color: #333;font-size: 0.13rem;font-weight: normal">完成时间：' + contractHistoryData[i].businessProcessingLogVo.endTime + ' </span>';
                                }
                                //$('.signConfirmationViewBox-log').append(logText)
                            }

                            var signConfirmationViewBox = $(".historyHideArea .signConfirmationViewBox").clone();
                            signConfirmationViewBox.find('.signConfirmationViewBox-log').append(logText)
                            signConfirmationViewBox.find(".detailContentBox-title-small").text('签署结算单')

                            //电子合同信息
                            signConfirmationViewBox.find(".signConfirmationView-authUrl").text(contractHistoryData[i].obj.certifyLink==undefined?'':contractHistoryData[i].obj.certifyLink);
                            signConfirmationViewBox.find(".signConfirmationView-authStatus").text(contractHistoryData[i].obj.certifyStatus?'已认证':'未认证');
                            signConfirmationViewBox.find(".signConfirmationView-signUrl").text(contractHistoryData[i].obj.contractLink==undefined?'':contractHistoryData[i].obj.shortContractLink);
                            signConfirmationViewBox.find(".signConfirmationView-signStatus").text(contractHistoryData[i].obj.signStatus?'已签署':'未签署');

                            // 上游验收单(已签署附件)
                            if( contractHistoryData[i].obj.settlementSignedFile){
                                var fileList=contractHistoryData[i].obj.settlementSignedFile;
                                var filesHtm='';
                                    filesHtm+='<div class="uploaderFile oldFile">'+
                                        '<input type="hidden" class="fileid" value="'+fileList.id+'">'+
                                        '<div class="fileContent"><div class="file-wrapper">';
                                    var fileType=fileList.fileType;
                                    if(fileType=='.jpg' || fileType=='.jpeg' || fileType=='.png' || fileType=='.bmp'){
                                        filesHtm+='<div class="file-icon" style="color: rgb(119, 31, 173);"><div  class="file-icon-image"'+
                                            'style="background-image:url('+ fileList.path +');"></div></div>';
                                    }else {
                                        filesHtm+='<div class="file-icon" style="color:#5AC4FC;"><div class="file-icon-image"><i class="icon icon-file-pdf"></i></div></div>';
                                    }
                                    filesHtm+='<div class="content">'+
                                        '<div class="file-name">'+fileList.originalName+'</div>'+
                                        '<div class="file-size small text-muted">'+(fileList.size/1024/1024).toFixed(2)+'MB</div>'+
                                        '</div>'+
                                        '<div class="actions" style="width: 1.032rem;">'+
                                        '<a class="btn btn-link btn-preview-file" target="_blank" href="/fileStorage/preview?fileId='+fileList.id+'">'+
                                        '<em style="display:none">预览</em>'+
                                        '<i class="operateIconfont operateIcon-yulan"></i>'+
                                        '</a>'+
                                        // '<a class="btn btn-link btn-download-file" style="float:right" href="/fileStorage/downloadFile?fileId='+fileList[ii].id+'">'+
                                        // '<em style="display:none">下载</em>'+
                                        // '<i class="operateIconfont operateIcon-xiazai"></i>'+
                                        // '</a>'+
                                        '</div></div>';
                                signConfirmationViewBox.find(".signConfirmationView-signedFile").append(filesHtm);
                            }


                            $(".showarea").append(signConfirmationViewBox.show());

                        }

                    };
                    i = null;
                }else{
                    if( data.msg != '返回结果为空' ){
                        new $.zui.Messager('获取历史信息失败:'+data.msg, {
                            type: 'danger'
                        }).show();
                    };
                };

                // 导航排序
                $('.businessNavigation .businessCircle').each(function(i,ele){
                    $(ele).text(i+1)
                })

                // 历史信息排序
                $(".projectManagementTop .detailContentBox-title").each(function(i,ele){
                    $(ele).text( (i+1)+'、'+$(ele).text() );
                    $(ele).addClass('up');
                    $(ele).nextAll().hide();
                });

                if( $('.projectManagementTop .showarea .nodeShow').length<=0 ){
                    $('.projectManagementBottom').css('top','0')
                };

                // 新窗口查看时需要计算高度
                $(".projectManagementTop.historyTop").css('height',$("body").height()-$(".breadcrumb").height()-$(".businessNavigation").height()-15 )
                $(window).bind('resize',function(){
                    $(".projectManagementTop.historyTop").css('height',$("body").height()-$(".breadcrumb").height()-$(".businessNavigation").height()-15 )
                })
            },
            error:function(status){
                new $.zui.Messager('获取历史信息时发生错误:'+status, {
                    type: 'danger'
                }).show();
            }
        });

    });


})
