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('/underlying/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':'UnderlyingManage'
            },
            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 == '录入底层' ){
                            //标题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)

                            contractMakingViewBox.find('.contractMakingView-supplierName').text(contractHistoryData[i].obj.underlyingHisInfo.supplierName);
                            contractMakingViewBox.find('.contractMakingView-purchaserCustomer').text(contractHistoryData[i].obj.underlyingHisInfo.customerName);
                            contractMakingViewBox.find('.contractMakingView-businessNumber').text(contractHistoryData[i].obj.underlyingHisInfo.businessNumber);
                            contractMakingViewBox.find('.contractMakingView-businessName').text(contractHistoryData[i].obj.underlyingHisInfo.businessName);
                            contractMakingViewBox.find('.contractMakingView-tradingPlatformName').text(contractHistoryData[i].obj.underlyingHisInfo.tradingPlatformName);
                            contractMakingViewBox.find('.contractMakingView-contractName').text(contractHistoryData[i].obj.underlyingHisInfo.contractName);
                            contractMakingViewBox.find('.contractMakingView-contractNumber').text(checkMoney(contractHistoryData[i].obj.underlyingHisInfo.contractNumber));
                            contractMakingViewBox.find('.contractMakingView-contractAmount').text(contractHistoryData[i].obj.underlyingHisInfo.contractAmount);
                            contractMakingViewBox.find('.contractMakingView-remark').text(contractHistoryData[i].obj.underlyingHisInfo.remark);

                            contractMakingViewBox.find('.contractMakingView-accountsReceivableStartDate').text(contractHistoryData[i].obj.underlyingHisInfo.accountsReceivableStartDate);
                            contractMakingViewBox.find('.contractMakingView-accountsReceivableEndDate').text(contractHistoryData[i].obj.underlyingHisInfo.accountsReceivableEndDate);
                            contractMakingViewBox.find('.contractMakingView-accountReceivablePeriod').text(contractHistoryData[i].obj.underlyingHisInfo.accountReceivablePeriod);

                            // 货物信息
                            var goodsInfoList=contractHistoryData[i].obj.underlyingHisGoodsInfoList;
                            if( goodsInfoList ){
                                let totalPrice = 0
                                let totalPurchase = 0
                                let totalNum = 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].acceptanceGoodsInfo.acceptanceDate+'</td>'+
                                        '<td  class="enter">'+goodsInfoList[ii].acceptanceGoodsInfo.goodsName+'</td>'+
                                        '<td  class="enter">'+goodsInfoList[ii].acceptanceGoodsInfo.goodsFactory+'</td>'+
                                        '<td  class="enter">'+goodsInfoList[ii].acceptanceGoodsInfo.goodsType+'</td>'+
                                        '<td  class="enter">'+goodsInfoList[ii].acceptanceGoodsInfo.goodsUnit+'</td>'+
                                        '<td  class="enter">'+(Number(goodsInfoList[ii].acceptanceGoodsInfo.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
                                    totalPrice += salesTotalPrice
                                    let purchaseTotalPrice = goodsInfoList[ii].purchaseTotalPrice == null ? 0 : goodsInfoList[ii].purchaseTotalPrice
                                    totalPurchase += purchaseTotalPrice
                                    let goodsQuantity = goodsInfoList[ii].acceptanceGoodsInfo.goodsQuantity == null ? 0 : goodsInfoList[ii].acceptanceGoodsInfo.goodsQuantity
                                    totalNum += goodsQuantity
                                }

                                ii=null;
                                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(".totalNum").text( totalNum ? commaDelimiter((Math.round(totalNum*100)/100).toFixed(4)) : '');

                                contractMakingViewBox.find(".goodsInfoList_header").after(trs);
                            }


                            //底层
                            var underList=contractHistoryData[i].obj.hisAccountsReceivableInfoList;
                            if( underList ){
                                var trs='';
                                let accountsReceivableAmountAllNum = 0
                                let netAccountsReceivableAmountAllNum = 0
                                let underlyingTotalNum = 0
                                for(var ii=0;ii<underList.length;ii++ ){
                                    var num=ii+1;
                                    trs+='<tr>'+
                                        '<td  class="enter">'+num+'</td>'+
                                        '<td  class="enter">'+underList[ii].goodsName+'</td>'+
                                        '<td  class="enter">'+underList[ii].goodsFactory+'</td>'+
                                        '<td  class="enter">'+underList[ii].goodsType+'</td>'+
                                        '<td  class="enter">'+underList[ii].goodsUnit+'</td>'+
                                        '<td  class="enter">'+(Number(underList[ii].goodsQuantity)).toFixed(4)+'</td>'+
                                        '<td  class="enter">'+checkMoney((Number(underList[ii].accountsReceivableAmount)).toFixed(2))+'</td>'+
                                        '<td  class="enter">'+checkMoney((Number(underList[ii].netAccountsReceivableAmount)).toFixed(2))+'</td>'+
                                        '</tr>';
                                    let accountsReceivableAmount = underList[ii].accountsReceivableAmount == null ? 0 : underList[ii].accountsReceivableAmount

                                    let netAccountsReceivableAmount = underList[ii].netAccountsReceivableAmount == null ? 0 : underList[ii].netAccountsReceivableAmount

                                    let goodsQuantity = underList[ii].goodsQuantity == null ? 0 : underList[ii].goodsQuantity
                                    underlyingTotalNum += goodsQuantity
                                    accountsReceivableAmountAllNum += accountsReceivableAmount
                                    netAccountsReceivableAmountAllNum += netAccountsReceivableAmount
                                }
                                ii=null;
                                // contractMakingViewBox.find(".accountsReceivableAmount").text( accountsReceivableAmountAllNum ? commaDelimiter(Math.round(accountsReceivableAmountAllNum*100)/100) : '');

                                contractMakingViewBox.find(".netAccountsReceivableAmountAll").text( netAccountsReceivableAmountAllNum ? commaDelimiter((Math.round(netAccountsReceivableAmountAllNum*100)/100).toFixed(2)) : '');
                                contractMakingViewBox.find(".totalAmountAccountsReceivable").text( accountsReceivableAmountAllNum ? commaDelimiter((Math.round(accountsReceivableAmountAllNum*100)/100).toFixed(2)) : '');

                                contractMakingViewBox.find(".underlyingTotalNum").text( underlyingTotalNum ? commaDelimiter((Math.round(underlyingTotalNum*100)/100).toFixed(4)) : '');
                                contractMakingViewBox.find(".underlyingList_header").after(trs);
                            }

                            if( contractHistoryData[i].obj.underlyingFileList ){
                                var fileList=contractHistoryData[i].obj.underlyingFileList;
                                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);
                                }
                            }

                            //关联采购发票信息
                            // var purchInvoiceInfoList=contractHistoryData[i].obj.mortgageGoodsInformations;
                            // if( purchInvoiceInfoList ){
                            //     var trs='';
                            //     for(var ii=0;ii<goodsInfoList.length;ii++ ){
                            //         var num=ii+1;
                            //         trs+='<tr>'+
                            //             '<td  class="enter">'+num+'</td>'+
                            //             '<td  class="enter">'+purchInvoiceInfoList[ii].acceptanceDate+'</td>'+
                            //             '<td  class="enter">'+purchInvoiceInfoList[ii].goodsName+'</td>'+
                            //             '<td  class="enter">'+purchInvoiceInfoList[ii].goodsFactory+'</td>'+
                            //             '<td  class="enter">'+purchInvoiceInfoList[ii].goodsType+'</td>'+
                            //             '<td  class="enter">'+commaDelimiter(purchInvoiceInfoList[ii].purchaseGuaranteeMoney)+'</td>'+
                            //             '</tr>';
                            //     }
                            //     ii=null;
                            //     contractMakingViewBox.find(".purchInvoice_header").after(trs);
                            // }

                            //关联采购发票附件
                            // if( contractHistoryData[i].obj.fileStorages ){
                            //     var fileList=contractHistoryData[i].obj.fileStorages;
                            //     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-purchInvoiceFile").append(filesHtm);
                            //     }
                            // }

                            $(".showarea").append(contractMakingViewBox.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 terminationContractApprovalViewBox = $(".historyHideArea .terminationContractApprovalViewBox").clone();
                            terminationContractApprovalViewBox.find('.terminationContractApprovalViewBox-log').append(logText)


                            if( contractHistoryData[i].obj.salesContractFiles ){
                                var fileList=contractHistoryData[i].obj.salesContractFiles;
                                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-salesContractFiles").append(filesHtm);
                                }
                            }
                            if( contractHistoryData[i].obj.purchContractFiles ){
                                var fileList=contractHistoryData[i].obj.purchContractFiles;
                                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-purchContractFiles").append(filesHtm);
                                }
                            }
                            if( contractHistoryData[i].obj.acceptanceFiles ){
                                var fileList=contractHistoryData[i].obj.acceptanceFiles;
                                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-acceptanceFiles").append(filesHtm);
                                }
                            }
                            if( contractHistoryData[i].obj.settlementFiles ){
                                var fileList=contractHistoryData[i].obj.settlementFiles;
                                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-settlementFiles").append(filesHtm);
                                }
                            }
                            if( contractHistoryData[i].obj.purchInvoiceFiles ){
                                var fileList=contractHistoryData[i].obj.purchInvoiceFiles;
                                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-purchInvoiceFiles").append(filesHtm);
                                }
                            }
                            if( contractHistoryData[i].obj.salesInvoiceFiles ){
                                var fileList=contractHistoryData[i].obj.salesInvoiceFiles;
                                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-salesInvoiceFiles").append(filesHtm);
                                }
                            }
                             //审批结论
                             terminationContractApprovalViewBox.find(".terminationContractApprovalView-approvalConclusion").text(contractHistoryData[i].obj.underlyingApproval.approvalConclusion === 'back' ? '驳回' : '通过');
                            //审批意见
                            if( contractHistoryData[i].obj.underlyingApproval.approvalComment ){
                                terminationContractApprovalViewBox.find(".terminationContractApprovalView-approvalOpinion").text(contractHistoryData[i].obj.underlyingApproval.approvalComment);
                            }

                            $(".showarea").append(terminationContractApprovalViewBox.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();
            }
        });

    });


})
