$(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('/acceptance/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':'AcceptanceSheet'
            },
            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-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-checkOperatorSupplier').text(contractHistoryData[i].obj.checkOperatorSupplier);
                            contractMakingViewBox.find('.contractMakingView-checkOperatorEnterprise').text(contractHistoryData[i].obj.checkOperatorEnterprise);
                            // contractMakingViewBox.find('.contractMakingView-managerName').text(contractHistoryData[i].obj.managerName);
                            contractMakingViewBox.find('.contractMakingView-expectedSettlementDate').text(contractHistoryData[i].obj.expectedSettlementDate);
                            contractMakingViewBox.find('.contractMakingView-signConfirm').text(contractHistoryData[i].obj.signConfirm == 1 ? '是' : '否');
                            if(contractHistoryData[i].obj.signConfirm == 0) {
                                contractMakingViewBox.find('.specification').addClass('hide')
                            }else {
                                contractMakingViewBox.find('.specification').removeClass('hide')
                                contractMakingViewBox.find('.contractMakingView-approvalComment').text(`签署人为：人员信息中的验收经办人(核心企业)；签署文件为：下游验收文件。`)
                            }

                            if( contractHistoryData[i].obj.fileStorage ){
                                var fileList=contractHistoryData[i].obj.fileStorage;
                                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>';
                                    }
                                    ii=null;
                                    contractMakingViewBox.find(".contractMakingView-uploadFile").append(filesHtm);
                                }
                            }

                            //人员信息
                            var personalInfoList=contractHistoryData[i].obj.acceptancePersonInfoHistories;
                            contractMakingViewBox.find('.contractMakingView-operator').text(contractHistoryData[i].obj.changePerson == 1 ? '是' : '否');
                            if( personalInfoList ){
                                var trs='';
                                for(var ii=0;ii<personalInfoList.length;ii++ ){
                                    let socialCreditCode = '';
                                    let mobile = '';
                                    if(personalInfoList[ii].socialCreditCode == null) {
                                        socialCreditCode = ''
                                    }else {
                                        socialCreditCode = personalInfoList[ii].socialCreditCode
                                    }
                                    if(personalInfoList[ii].mobile == null) {
                                        mobile = ''
                                    }else {
                                        mobile = personalInfoList[ii].mobile
                                    }
                                    trs+='<tr>'+
                                        '<td width="20%" class="enter">'+personalInfoList[ii].type+'</td>'+
                                        '<td width="20%" class="enter">'+personalInfoList[ii].name+'</td>'+
                                        // '<td width="20%" class="enter">'+personalInfoList[ii].cardType+'</td>'+
                                        // '<td width="20%" class="enter">'+socialCreditCode+'</td>'+
                                        '<td width="20%" class="enter">'+mobile+'</td>'+
                                        '</tr>';
                                }
                                ii=null;
                                contractMakingViewBox.find(".personalInfoList_header").after(trs);
                            }

                            contractMakingViewBox.find('.contractMakingView-steelWaiter').text(contractHistoryData[i].obj.steelWaiter == 1 ? '是' : '否');
                            if(contractHistoryData[i].obj.steelWaiter == 1 ) {
                                contractMakingViewBox.find('.sellBillNumberBox').show()
                                list = contractHistoryData[i].obj.sellBillNumber || []
                                let str = ''
                                list.forEach(item => {
                                    str +=`<span style="margin-right: 10px">${item}</span>`
                                })
                                contractMakingViewBox.find('.contractMakingView-sellBillNumber').append(str)

                            }else {
                                contractMakingViewBox.find('.sellBillNumberBox').hide()
                            }

                            //货物信息
                            var goodsInfoList=contractHistoryData[i].obj.acceptanceBusinessGoods;
                            if( goodsInfoList ){
                                var trs='';
                                for(var ii=0;ii<goodsInfoList.length;ii++ ){
                                    var num=ii+1;
                                    trs+='<tr>'+
                                        '<td width="5%" class="enter">'+num+'</td>'+
                                        '<td width="15%" class="enter">'+goodsInfoList[ii].goodsName+'</td>'+
                                        '<td width="15%" class="enter">'+goodsInfoList[ii].goodsMaterial+'</td>'+
                                        '<td width="13%" class="enter">'+goodsInfoList[ii].goodsType+'</td>'+
                                        '<td width="10%" class="enter">'+goodsInfoList[ii].goodsFactory+'</td>'+
                                        '<td width="10%" class="enter">'+goodsInfoList[ii].goodsUnit+'</td>'+
                                        '<td width="7%" class="enter">'+(Number(goodsInfoList[ii].goodsQuantity)).toFixed(4)+'</td>'+
                                        '<td width="10%" class="enter">'+(Number(goodsInfoList[ii].salesPriceStr)).toFixed(2)+'</td>'+
                                        '<td width="10%" class="enter">'+goodsInfoList[ii].acceptanceDate+'</td>'+
                                        '</tr>';
                                }
                                ii=null;
                                contractMakingViewBox.find(".goodsInfoList_header").after(trs);
                            }

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

                            if(contractHistoryData[i].obj.signConfirm == 1) {
                                contractMakingViewBox.find(".contractMakingView-cargoInformation").addClass('hide')
                            }

                            //buchong
                            contractMakingViewBox.find('.contractMakingView-additionalRemarks').text(contractHistoryData[i].obj.additionalRemarks);
                            if( contractHistoryData[i].obj.supplementFiles ){
                                var fileList=contractHistoryData[i].obj.supplementFiles;
                                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>';
                                    }
                                    ii=null;
                                    contractMakingViewBox.find(".contractMakingView-supUploadFile").append(filesHtm);
                                }
                            }

                        };

                        //验收人变更审核
                        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 changeExamineViewBox = $(".historyHideArea .changeExamineViewBox").clone();
                            changeExamineViewBox.find('.changeExamineViewBox-log').append(logText)
                            //审批结论
                            changeExamineViewBox.find(".changeExamineViewBox-approvalConclusion").text(contractHistoryData[i].obj.approvalConclusion == 'pass' ? '通过' : '驳回');

                            //审批意见
                            if( contractHistoryData[i].obj.approvalComments ){
                                changeExamineViewBox.find(".changeExamineViewBox-approvalOpinion").text(contractHistoryData[i].obj.approvalComments);
                            }
                            $(".showarea").append(changeExamineViewBox.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>';
                                }
                            }

                            var signViewBox = $(".historyHideArea .signViewBox").clone();
                            signViewBox.find('.signViewBox-log').append(logText)
                            // 电子合同信息
                            let shortContractLink = ''
                            if(contractHistoryData[i].obj.shortContractLink == null) {
                                shortContractLink = ''
                            }else {
                                shortContractLink = contractHistoryData[i].obj.shortContractLink
                            }
                            let str = ''
                                str += `
                                <tr>
                                    <td width="20%"  rowspan="${contractHistoryData[i].obj.acceptanceSignConfirmationElectronicInfoHistories.length + 2 }">
                                        <div class="signViewBox-certificationLink">${contractHistoryData[i].obj.electronicSignaturePersonal.name}</div>
                                    </td>
                                    <td width="10%" class="enter">
                                        <span>认证链接</span>:
                                    </td>
                                    <td width="45%" class="enter">
                                        <textarea style="width: 75%;" readonly class="signViewBox-copyUrl">${contractHistoryData[i].obj.electronicSignaturePersonal.shortAuthUrl}</textarea>
                                    </td>
                                    <td  width="25%" class="enter">
                                        <span style="float: left; line-height: 0.51rem;">认证状态:</span>
                                        <input style="width: 25%; float: left; margin-top: 0.08rem;" class="form-control signViewBox-certificationStatus" readonly value=${contractHistoryData[i].obj.electronicSignaturePersonal.authStatus == true ? '已认证' : '未认证'}>
                                    </td>
                                </tr>
                                <tr>
                                    <td width="10%" class="enter">
                                        <span>签署链接</span>:
                                    </td>
                                    <td width="70%" class="enter" colspan="3">
                                        <textarea readonly style="width:50%;" class=" signViewBox-copyUrl">${shortContractLink}</textarea>
                                    </td>
                                </tr>`
                                contractHistoryData[i].obj.acceptanceSignConfirmationElectronicInfoHistories.forEach(item => {
                                    str += `
                                        <tr>
                                            <td width="10%" class="enter">
                                                <div class="signViewBox-certificationLink" > ${item.contractName}</div>
                                            </td>
                                            <td  width="70%" class="enter" colspan="3">
                                                <span style="float: left; line-height: 0.51rem;">签署状态:</span>
                                                <input style="width: 70%; float: left; margin-top: 0.08rem;" class="form-control signViewBox-signStatus" readonly value=${item.signStatus == true ? '已签署' : '未签署'}>
                                            </td>
                                        </tr>
                                    `
                                })
                                signViewBox.find('.signViewBox-signConfirmInfoBox').append(str)
                            //签署结论
                            let signConclusion = '';
                                    if(contractHistoryData[i].obj.signConclusion == 1) {
                                        signConclusion = '完成'
                                    }else if(contractHistoryData[i].obj.signConclusion == 0) {
                                        signConclusion = '终止'
                                    }else if(contractHistoryData[i].obj.signConclusion == 2) {
                                        signConclusion = '驳回'
                                    }
                            signViewBox.find(".signViewBox-approvalConclusion").text(signConclusion);

                            // 签署意见
                            if( contractHistoryData[i].obj.remark ){
                                signViewBox.find(".signViewBox-approvalOpinion").text(contractHistoryData[i].obj.remark);
                            }

                            //货物信息
                            var goodsInfoList=contractHistoryData[i].obj.acceptanceSignConfirmationGoodsInfos;
                            if( goodsInfoList ){
                                var trs='';
                                for(var ii=0;ii<goodsInfoList.length;ii++ ){
                                    var num=ii+1;
                                    trs+='<tr>'+
                                        '<td width="5%" class="enter">'+num+'</td>'+
                                        '<td width="15%" class="enter">'+goodsInfoList[ii].goodsName+'</td>'+
                                        '<td width="15%" class="enter">'+goodsInfoList[ii].goodsMaterial+'</td>'+
                                        '<td width="13%" class="enter">'+goodsInfoList[ii].goodsType+'</td>'+
                                        '<td width="10%" class="enter">'+goodsInfoList[ii].goodsFactory+'</td>'+
                                        '<td width="10%" class="enter">'+goodsInfoList[ii].goodsUnit+'</td>'+
                                        '<td width="7%" class="enter">'+(Number(goodsInfoList[ii].goodsQuantity)).toFixed(4)+'</td>'+
                                        '<td width="10%" class="enter">'+(Number(goodsInfoList[ii].salesPrice)).toFixed(2)+'</td>'+
                                        '<td width="10%" class="enter">'+goodsInfoList[ii].acceptanceDate+'</td>'+
                                        '</tr>';
                                }
                                ii=null;
                                signViewBox.find(".goodsInfoList_header").after(trs);
                            }

                            $(".showarea").append(signViewBox.show());
                            if(contractHistoryData[i].obj.signConclusion !== 1) {
                                signViewBox.find(".signViewBox-cargoInformation").addClass('hide')
                            }
                        };

                        //法务审核条款
                        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.salesContract ){
                                var fileList=contractHistoryData[i].obj.salesContract;
                                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>';
                                    }
                                    ii=null;
                                    terminationContractApprovalViewBox.find(".terminationContractApprovalView-contractFile").append(filesHtm);
                                }
                            }

                            // 采购合同
                            if( contractHistoryData[i].obj.purchContract ){
                                var fileList=contractHistoryData[i].obj.purchContract;
                                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>';
                                    }
                                    ii=null;
                                    terminationContractApprovalViewBox.find(".terminationContractApprovalView-purchaseFile").append(filesHtm);
                                }
                            }

                            // 上游验收单(验收单附件)
                            if( contractHistoryData[i].obj.acceptanceUpstreamFile ){
                                var fileList=contractHistoryData[i].obj.acceptanceUpstreamFile;
                                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>';
                                    }
                                    ii=null;
                                    terminationContractApprovalViewBox.find(".terminationContractApprovalView-acceptanceFile").append(filesHtm);
                                }
                            }
                            //审批结论
                            let approvalConclusion = ''
                            if(contractHistoryData[i].obj.approvalConclusion == 'pass') {
                                approvalConclusion = '通过'
                            }else if(contractHistoryData[i].obj.approvalConclusion == 'back'){
                                approvalConclusion = '驳回'
                            }else if(contractHistoryData[i].obj.approvalConclusion == 'veto'){
                                approvalConclusion = '否决'
                            }
                            terminationContractApprovalViewBox.find(".terminationContractApprovalView-approvalConclusion").text(approvalConclusion);

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

                            //签署确认
                            // if(contractHistoryData[i].obj.result == '通过') {
                            //     terminationContractApprovalViewBox.find(".signConfirmation").show()
                            //     terminationContractApprovalViewBox.find(".terminationContractApprovalView-signConfirmation").text(contractHistoryData[i].obj.signConfirm == 1 ? '是' : '否');
                            // }
                            // if(contractHistoryData[i].obj.signConfirm == 1) {
                            //     terminationContractApprovalViewBox.find(".signingInformation").show()
                            //     //签署文件
                            //     let fileStorages = ''
                            //     contractHistoryData[i].obj.file.forEach(item => {
                            //         fileStorages += `<div class="fileStorage" style="display:none">
                            //             <input type="text" class="originalId"   value="${item.id}">
                            //             <input type="text" class="originalUrl"  value="${item.path}">
                            //             <input type="text" class="originalType" value="${item.fileType}">
                            //             <input type="text" class="originalName" value="${item.originalName}">
                            //             <input type="text" class="originalSize" value="${item.size}">
                            //         </div>`
                            //     })
                            //     showOriginalFile(fileStorages, terminationContractApprovalViewBox.find('.originalFileList').find('.fileListBox'), 'onlyView')
                            //     //签署人信息
                            //     var signPersonalConditionList = [contractHistoryData[i].obj.acceptancePersonInfoHistoryRef];
                            //     if( signPersonalConditionList ){
                            //         var str='';
                            //         for(var ii=0;ii<signPersonalConditionList.length;ii++ ){
                            //             str +=
                            //                 '<tr>'+
                            //                     '<td width="20%" class="enter">'+signPersonalConditionList[ii].type+'</td>'+
                            //                     '<td width="20%" class="enter">'+signPersonalConditionList[ii].name+'</td>'+
                            //                     '<td width="20%" class="enter">'+signPersonalConditionList[ii].cardType+'</td>'+
                            //                     '<td width="20%" class="enter">'+signPersonalConditionList[ii].socialCreditCode+'</td>'+
                            //                     '<td width="20%" class="enter">'+signPersonalConditionList[ii].mobile+'</td>'+
                            //                 '</tr>';

                            //         }
                            //         terminationContractApprovalViewBox.find(".signTable").find(".signerContent").append(str);
                            //     }

                            // }

                            // 下游验收单(已签署附件)
                            if(contractHistoryData[i].obj.signConfirm == 1) {
                                terminationContractApprovalViewBox.find(".signed").removeClass('hide')
                                if( contractHistoryData[i].obj.signConfirmFiles ){
                                    var fileList=contractHistoryData[i].obj.signConfirmFiles;
                                    var filesHtm='';
                                    if(fileList.length>0) {
                                        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-signedFile").append(filesHtm);
                                }
                            }
                            $(".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();
            }
        });

    });


})
