$(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('/purchContract/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': 'PurchContract'
            },
            async: async,
            success: function (data) {
                if (data.success) {
                    var contractHistoryData = data.data;
                    for (var i = 0; i < contractHistoryData.length; i++) {

                        // 添加导航dom
                        $(".businessNavigation ul").append('<li><div class="businessCircle">' + (i + 1) + '</div><div class="businessWord"><span>' + contractHistoryData[i].formBusinessName + '</span></div></li>');

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

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

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

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

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

                            if (contractHistoryData[i].formBusinessName == '采购合同录入') {
                                contractMakingViewBox.find(".detailContentBox-title-small").text('采购合同录入')
                            } else {
                                contractMakingViewBox.find(".detailContentBox-title-small").text('业务变更合同')
                            }

                            contractMakingViewBox.find('.contractMakingView-businessName').text(contractHistoryData[i].obj.businessBasicInfo.name);
                            contractMakingViewBox.find('.contractMakingView-platformName').text(contractHistoryData[i].obj.businessBasicInfo.platform.platformName);
                            contractMakingViewBox.find('.contractMakingView-enterpriseName').text(contractHistoryData[i].obj.businessBasicInfo.customer.enterpriseName);
                            contractMakingViewBox.find('.contractMakingView-businessNo').text(contractHistoryData[i].obj.businessBasicInfo.businessNumber);
                            // contractMakingViewBox.find('.contractMakingView-enterpriseName').text(contractHistoryData[i].obj.businessBasicInfo.customer.enterpriseName);
                            // contractMakingViewBox.find('.contractMakingView-creatTime').text(contractHistoryData[i].obj.businessBasicInfo.gmtCreate);

                            //合同信息
                            contractMakingViewBox.find('.contractMakingView-contractNumber').text(contractHistoryData[i].obj.purchContractBasicInfo.contractNumber);
                            contractMakingViewBox.find('.contractMakingView-contractName').text(contractHistoryData[i].obj.purchContractBasicInfo.contractName);
                            contractMakingViewBox.find('.contractMakingView-platform').text(contractHistoryData[i].obj.customer.enterpriseName);
                            contractMakingViewBox.find('.contractMakingView-customer').text(contractHistoryData[i].obj.businessBasicInfo.platform.platformName);
                            contractMakingViewBox.find('.contractMakingView-contractPeriod').text(contractHistoryData[i].obj.purchContractBasicInfo.contractPeriod);
                            contractMakingViewBox.find('.contractMakingView-repurchMethod').text(contractHistoryData[i].obj.purchContractBasicInfo.repurchMethodDic.name);
                            contractMakingViewBox.find('.contractMakingView-contractPlanAmountType').text(contractHistoryData[i].obj.purchContractBasicInfo.contractPlanAmountTypeDic.name);
                            contractMakingViewBox.find('.contractMakingView-contractPlanAmount').text(commaDelimiter(contractHistoryData[i].obj.purchContractBasicInfo.contractPlanAmount) + '元');

                            //付款条件
                            var paymentConditionList = contractHistoryData[i].obj.purchContractPaymentCondition;
                            if (paymentConditionList) {
                                var trs = '';
                                for (var ii = 0; ii < paymentConditionList.length; ii++) {
                                    var num = ii + 1;
                                    trs += '<tr>' +
                                        '<td width="15%" class="enter">' + num + '</td>' +
                                        '<td width="85%" class="enter">' + paymentConditionList[ii].paymentCondition + '</td>' +
                                        '</tr>';
                                }
                                contractMakingViewBox.find(".paymentConditionList_header").after(trs);
                            }

                            //结算
                            // contractMakingViewBox.find('.contractMakingView-deliveryDate').text(contractHistoryData[i].obj.purchContractSettleCycle.deliveryDate);
                            // contractMakingViewBox.find('.contractMakingView-signDate').text(contractHistoryData[i].obj.purchContractSettleCycle.signDate);
                            // contractMakingViewBox.find('.contractMakingView-firstSettleDate').text(contractHistoryData[i].obj.purchContractSettleCycle.firstSettleDate);
                            contractMakingViewBox.find('.contractMakingView-settleCycleMethodDict').text(contractHistoryData[i].obj.purchContractSettleCycle.settleCycleMethodDict.name);
                            var settleCycleUnit = ''
                            if (contractHistoryData[i].obj.purchContractSettleCycle.settleCycleMethodDict.name == '固定天数') {
                                settleCycleUnit = '天'
                            } else {
                                settleCycleUnit = '个自然月'
                            }
                            contractMakingViewBox.find('.contractMakingView-settleCycle').text('上一次结算后' + contractHistoryData[i].obj.purchContractSettleCycle.settleCycle + settleCycleUnit);
                            contractMakingViewBox.find('.contractMakingView-planPaybackDays').text('结算后' + contractHistoryData[i].obj.purchContractSettleCycle.planPaybackDays + '天');
                            contractMakingViewBox.find('.contractMakingView-estimatePayBackDays').text(commaDelimiter(contractHistoryData[i].obj.purchContractSettleCycle.settleMinAmount) + '元');

                            //质保金
                            contractMakingViewBox.find('.contractMakingView-retention').text((contractHistoryData[i].obj.purchContractRetentionInfo.retention ? '是' : '否'));
                            if (contractHistoryData[i].obj.purchContractRetentionInfo.retention) {
                                contractMakingViewBox.find('.contractMakingView-retentionPercent').text((contractHistoryData[i].obj.purchContractRetentionInfo.retentionPercent ? contractHistoryData[i].obj.purchContractRetentionInfo.retentionPercent + '%' : ''));
                                contractMakingViewBox.find('.contractMakingView-limit').text((contractHistoryData[i].obj.purchContractRetentionInfo.hasLimit ? '是' : '否'));
                                if (contractHistoryData[i].obj.purchContractRetentionInfo.hasLimit) {
                                    contractMakingViewBox.find('.contractMakingView-retentionLimit').text((contractHistoryData[i].obj.purchContractRetentionInfo.retentionLimit ? (commaDelimiter(contractHistoryData[i].obj.purchContractRetentionInfo.retentionLimit) + '元') : ''));
                                } else {
                                    contractMakingViewBox.find(".retentionLimit").hide();
                                    contractMakingViewBox.find(".contractMakingView-limit").css('width', 0).attr('colspan', 3)
                                }
                                contractMakingViewBox.find('.contractMakingView-releaseMethodDict').text(contractHistoryData[i].obj.purchContractRetentionInfo.releaseMethodDict.name);
                                if (contractHistoryData[i].obj.purchContractRetentionInfo.releaseMethodDict.name == '固定日期') {
                                    contractMakingViewBox.find('.contractMakingView-releaseMethodDict').removeAttr('colspan').css('width', '35%')
                                    contractMakingViewBox.find('.contractMakingView-releaseDays').hide();
                                    contractMakingViewBox.find('.releaseDays').hide();
                                    contractMakingViewBox.find('.contractMakingView-releaseDate').show();
                                    contractMakingViewBox.find('.releaseDate').show();
                                    contractMakingViewBox.find('.contractMakingView-releaseDate').text(contractHistoryData[i].obj.purchContractRetentionInfo.releaseDate);
                                } else if (contractHistoryData[i].obj.purchContractRetentionInfo.releaseMethodDict.name == '回款后固定天数') {
                                    contractMakingViewBox.find('.contractMakingView-releaseMethodDict').removeAttr('colspan').css('width', '35%')
                                    contractMakingViewBox.find('.contractMakingView-releaseDays').show();
                                    contractMakingViewBox.find('.releaseDays').show();
                                    contractMakingViewBox.find('.contractMakingView-releaseDate').hide();
                                    contractMakingViewBox.find('.releaseDate').hide();
                                    contractMakingViewBox.find('.contractMakingView-releaseDays').text(contractHistoryData[i].obj.purchContractRetentionInfo.releaseDays + '天');
                                } else {
                                    contractMakingViewBox.find('.contractMakingView-releaseMethodDict').css('width', '0').attr('colspan', '3')
                                    contractMakingViewBox.find('.contractMakingView-releaseDays').hide();
                                    contractMakingViewBox.find('.releaseDays').hide();
                                    contractMakingViewBox.find('.contractMakingView-releaseDate').hide();
                                    contractMakingViewBox.find('.releaseDate').hide();
                                }
                            } else {
                                contractMakingViewBox.find(".retentionTr").hide();
                                contractMakingViewBox.find(".contractMakingView-retention").css('width', 0).attr('colspan', 3)
                            }

                            //价格规则
                            contractMakingViewBox.find('.contractMakingView-accrualMarginCalcMethod').text(contractHistoryData[i].obj.purchContractPriceRule.accrualMarginCalcMethodDict.name);
                            if (contractHistoryData[i].obj.purchContractPriceRule.accrualMarginCalcMethodDict.name == '固定利率') {
                                contractMakingViewBox.find('.chaStr').remove()
                                contractMakingViewBox.find('.contractMakingView-tradePlatformOffer').text(contractHistoryData[i].obj.purchContractPriceRule.tradePlatformOffer + '%');
                                contractMakingViewBox.find('.contractMakingView-factoringOffer').text(contractHistoryData[i].obj.purchContractPriceRule.factoringOffer + '%');
                                contractMakingViewBox.find('.contractMakingView-factoringFinanceDeadline').text(contractHistoryData[i].obj.purchContractPriceRule.factoringFinanceDeadline + '天');
                                contractMakingViewBox.find('.contractMakingView-monthlyInterestRate').text(contractHistoryData[i].obj.purchContractPriceRule.monthlyInterestRate + '%');
                            } else {
                                contractMakingViewBox.find('.rateStr').remove()
                                contractMakingViewBox.find('.contractMakingView-differAmount').text(contractHistoryData[i].obj.purchContractPriceRule.differAmount !== undefined ? (commaDelimiter(contractHistoryData[i].obj.purchContractPriceRule.differAmount) + '元') : '');
                            }


                            //应收账款有效期
                            // contractMakingViewBox.find('.contractMakingView-startDate').text(contractHistoryData[i].obj.purchContractArExp.startDate);
                            // contractMakingViewBox.find('.contractMakingView-endDate').text(contractHistoryData[i].obj.purchContractArExp.endDate);

                            //货物信息
                            var goodsInfoList = contractHistoryData[i].obj.purchContractGoodsInfo;
                            if (goodsInfoList) {
                                var trs = '';
                                for (var ii = 0; ii < goodsInfoList.length; ii++) {
                                    var num = ii + 1;
                                    trs += '<tr>' +
                                        '<td  class="enter">' + num + '</td>' +
                                        '<td  class="enter">' + goodsInfoList[ii].salesContractGoodsInfo.goodsName + '</td>' +
                                        '<td  class="enter">' + goodsInfoList[ii].salesContractGoodsInfo.goodsFactory + '</td>' +
                                        '<td  class="enter">' + goodsInfoList[ii].salesContractGoodsInfo.modelNumber + '</td>' +
                                        '<td  class="enter">' + goodsInfoList[ii].salesContractGoodsInfo.units + '</td>' +
                                        '<td  class="enter">' + goodsInfoList[ii].quantity + '</td>' +
                                        // '<td width="12%" class="enter">' + (goodsInfoList[ii].salesContractGoodsInfo.clearPrice ? '是' : '否') + '</td>' +
                                        // '<td width="10%" class="enter">' + (goodsInfoList[ii].purchPrice ? commaDelimiter(goodsInfoList[ii].purchPrice) : '') + '</td>' +
                                        '<td width="14%" class="enter">' + goodsInfoList[ii].price + '</td>' +
                                        '<td width="14%" class="enter">' + goodsInfoList[ii].remark + '</td>' +
                                        '</tr>';
                                }
                                ii = null;
                                contractMakingViewBox.find(".goodsInfoList_header").after(trs);
                            }

                            // 增值税要求
                            contractMakingViewBox.find('.contractMakingView-priceComment').text(contractHistoryData[i].obj.purchContractVatInfo.priceComment);
                            contractMakingViewBox.find('.contractMakingView-taxRate').text(contractHistoryData[i].obj.purchContractVatInfo.taxRate + '%');
                            contractMakingViewBox.find('.contractMakingView-receiptType').text(contractHistoryData[i].obj.purchContractVatInfo.receiptTypeDic.name);
                            // contractMakingViewBox.find('.contractMakingView-openCycle').text(contractHistoryData[i].obj.purchContractVatInfo.openCycle);
                            contractMakingViewBox.find('.contractMakingView-openBank').text(contractHistoryData[i].obj.purchContractVatInfo.openBank);
                            contractMakingViewBox.find('.contractMakingView-receiptAccount').text(contractHistoryData[i].obj.purchContractVatInfo.receiptAccount);
                            contractMakingViewBox.find('.contractMakingView-receiptRemark').text(contractHistoryData[i].obj.purchContractVatInfo.receiptRemark);

                            // 结算与付款
                            contractMakingViewBox.find('.contractMakingView-settleMethod').text(contractHistoryData[i].obj.purchContractSettlePayment.settleMethodDic.name);
                            contractMakingViewBox.find('.contractMakingView-paymentMethod').text(contractHistoryData[i].obj.purchContractSettlePayment.paymentMethod);
                            contractMakingViewBox.find('.contractMakingView-bankAccountName').text(contractHistoryData[i].obj.purchContractSettlePayment.bankAccountName);
                            contractMakingViewBox.find('.contractMakingView-bankAccount').text(contractHistoryData[i].obj.purchContractSettlePayment.bankAccount);
                            contractMakingViewBox.find('.contractMakingView-bankName').text(contractHistoryData[i].obj.purchContractSettlePayment.bankName);


                            // 需方收货人
                            var buyersList = contractHistoryData[i].obj.buyers;
                            if (buyersList) {
                                var trs = '';
                                for (var ii = 0; ii < buyersList.length; ii++) {
                                    var num = ii + 1;
                                    trs += '<tr>' +
                                        '<td width="10%" class="enter">' + num + '</td>' +
                                        '<td width="20%" class="enter">' + buyersList[ii].name + '</td>' +
                                        '<td width="35%" class="enter">' + buyersList[ii].idCard + '</td>' +
                                        '<td width="35%" class="enter">' + buyersList[ii].contact + '</td>' +
                                        '</tr>';
                                }
                                ii = null;
                                contractMakingViewBox.find(".buyersList_header").after(trs);
                            }

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

                            // 供应商发货人
                            var supplierList = contractHistoryData[i].obj.sellers;
                            if (supplierList) {
                                var trs = '';
                                for (var ii = 0; ii < supplierList.length; ii++) {
                                    var num = ii + 1;
                                    trs += '<tr>' +
                                        '<td width="10%" class="enter">' + num + '</td>' +
                                        '<td width="20%" class="enter">' + supplierList[ii].name + '</td>' +
                                        '<td width="35%" class="enter">' + supplierList[ii].idCard + '</td>' +
                                        '<td width="35%" class="enter">' + supplierList[ii].contact + '</td>' +
                                        '</tr>';
                                }
                                ii = null;
                                contractMakingViewBox.find(".supplierList_header").after(trs);
                            }

                            $(".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].formBusinessName == '采购合同审核') {
                                terminationContractApprovalViewBox.find(".detailContentBox-title-small").text('采购合同审核')
                            } else {
                                terminationContractApprovalViewBox.find(".detailContentBox-title-small").text('采购合同变更审核')
                            }

                            if (contractHistoryData[i].obj.purchContractApproval.approvalConclusion == '通过') {

                                terminationContractApprovalViewBox.find(".terminationContractApprovalView-contractName").text(contractHistoryData[i].obj.purchContractBasicInfo.contractName ? contractHistoryData[i].obj.purchContractBasicInfo.contractName : '');
                                terminationContractApprovalViewBox.find(".terminationContractApprovalView-contractNumber").text(contractHistoryData[i].obj.purchContractBasicInfo.contractNumber ? contractHistoryData[i].obj.purchContractBasicInfo.contractNumber : '');
                                terminationContractApprovalViewBox.find(".terminationContractApprovalView-projectAmountCategory").text(contractHistoryData[i].obj.purchContractReplenishInfo.projectAmountCategoryDic.name);
                                terminationContractApprovalViewBox.find(".terminationContractApprovalView-goodsPriceSettleMethod").text(contractHistoryData[i].obj.purchContractReplenishInfo.goodsPriceSettleMethod);

                                //增值税
                                /* terminationContractApprovalViewBox.find(".terminationContractApprovalView-priceComment").text(contractHistoryData[i].obj.purchContractVatInfo.priceComment);
                                terminationContractApprovalViewBox.find(".terminationContractApprovalView-taxRate").text(contractHistoryData[i].obj.purchContractVatInfo.taxRate);
                                terminationContractApprovalViewBox.find(".terminationContractApprovalView-receiptType").text(contractHistoryData[i].obj.purchContractVatInfo.receiptType);
                                terminationContractApprovalViewBox.find(".terminationContractApprovalView-openCycle").text(contractHistoryData[i].obj.purchContractVatInfo.openCycle);
                                terminationContractApprovalViewBox.find(".terminationContractApprovalView-openBank").text(contractHistoryData[i].obj.purchContractVatInfo.openBank);
                                terminationContractApprovalViewBox.find(".terminationContractApprovalView-receiptAccount").text(contractHistoryData[i].obj.purchContractVatInfo.receiptAccount);
                                terminationContractApprovalViewBox.find(".terminationContractApprovalView-receiptRemark").text(contractHistoryData[i].obj.purchContractVatInfo.receiptRemark); */

                                //质量与验收
                                terminationContractApprovalViewBox.find(".terminationContractApprovalView-acceptCriteria").text(contractHistoryData[i].obj.purchContractQualityAccept.acceptCriteria);
                                terminationContractApprovalViewBox.find(".terminationContractApprovalView-qualityCriteria").text(contractHistoryData[i].obj.purchContractQualityAccept.qualityCriteria);

                                //结算付款
                                /*   terminationContractApprovalViewBox.find(".terminationContractApprovalView-settleMethod").text(contractHistoryData[i].obj.purchContractSettlePayment.settleMethod);
                                  terminationContractApprovalViewBox.find(".terminationContractApprovalView-paymentMethod").text(contractHistoryData[i].obj.purchContractSettlePayment.paymentMethod); */

                                //交货规定
                                terminationContractApprovalViewBox.find(".terminationContractApprovalView-deliverSite").text(contractHistoryData[i].obj.purchContractDeliverClause.deliverSite);
                                terminationContractApprovalViewBox.find(".terminationContractApprovalView-deliverMethod").text(contractHistoryData[i].obj.purchContractDeliverClause.deliverMethod);
                                terminationContractApprovalViewBox.find(".terminationContractApprovalView-deliverDate").text(contractHistoryData[i].obj.purchContractDeliverClause.deliverDate);
                                terminationContractApprovalViewBox.find(".terminationContractApprovalView-transportPremium").text(contractHistoryData[i].obj.purchContractDeliverClause.transportPremium);

                                //需方
                                /*   var xufangList = contractHistoryData[i].obj.purchContractBuyerReceiver;
                                  if (xufangList) {
                                      var trs = '';
                                      for (var ii = 0; ii < xufangList.length; ii++) {
                                          var num = ii + 1;
                                          trs += '<tr>' +
                                              '<td width="10%" class="enter">' + num + '</td>' +
                                              '<td width="20%" class="enter">' + xufangList[ii].name + '</td>' +
                                              '<td width="35%" class="enter">' + xufangList[ii].certno + '</td>' +
                                              '<td width="35%" class="enter">' + xufangList[ii].contact + '</td>' +
                                              '</tr>';
                                      }
                                      ii = null;
                                      terminationContractApprovalViewBox.find(".xufangList_header").after(trs);
                                  }

                                  $(".showarea").append(terminationContractApprovalViewBox.show());
   */
                                //供应商
                                /*  var supplierList = contractHistoryData[i].obj.purchContractSellerSender;
                                 if (supplierList) {
                                     var trs = '';
                                     for (var ii = 0; ii < supplierList.length; ii++) {
                                         var num = ii + 1;
                                         trs += '<tr>' +
                                             '<td width="10%" class="enter">' + num + '</td>' +
                                             '<td width="20%" class="enter">' + supplierList[ii].name + '</td>' +
                                             '<td width="35%" class="enter">' + supplierList[ii].certno + '</td>' +
                                             '<td width="35%" class="enter">' + supplierList[ii].contact + '</td>' +
                                             '</tr>';
                                     }
                                     ii = null;
                                     terminationContractApprovalViewBox.find(".supplierList_header").after(trs);
                                 }

                                 $(".showarea").append(terminationContractApprovalViewBox.show()); */

                                // //供应商责任
                                // terminationContractApprovalViewBox.find(".terminationContractApprovalView-penaltyRate").text(contractHistoryData[i].obj.purchContractSellerBlame.penaltyRate);

                                // //合同违约条款
                                // terminationContractApprovalViewBox.find(".terminationContractApprovalView-contractCompensateRate").text(contractHistoryData[i].obj.purchContractPunishClause.contractCompensateRate);
                                // terminationContractApprovalViewBox.find(".terminationContractApprovalView-contractPenaltyRate").text(contractHistoryData[i].obj.purchContractPunishClause.contractPenaltyRate);

                                //其他
                                var otherList = contractHistoryData[i].obj.purchContractOtherClause;
                                if (otherList) {
                                    var trs = '';
                                    for (var ii = 0; ii < otherList.length; ii++) {
                                        var num = ii + 1;
                                        trs += '<tr>' +
                                            '<td width="15%" class="enter">' + num + '</td>' +
                                            '<td width="85%" class="enter">' + otherList[ii].paymentCondition + '</td>' +
                                            '</tr>';
                                    }
                                    ii = null;
                                    terminationContractApprovalViewBox.find(".otherList_header").after(trs);
                                }

                                // 合同签署方式
                                if (contractHistoryData[i].obj.purchContractApproval.signMode == 1) {
                                    terminationContractApprovalViewBox.find(".terminationContractApprovalView-signMode").text('线上签署');
                                    terminationContractApprovalViewBox.find(".terminationContractApprovalView-platformName").text(contractHistoryData[i].obj.platform.platformName);
                                    terminationContractApprovalViewBox.find(".terminationContractApprovalView-authStatus").text(contractHistoryData[i].obj.platform.authStatus == 1 ? '已认证' : '未认证');

                                    terminationContractApprovalViewBox.find(".terminationContractApprovalView-autoSignStatus").text(contractHistoryData[i].obj.platform.autoSignStatus == true ? '已签署' : '未签署');
                                    if (contractHistoryData[i].obj.purchContractApproval.upload == 1) {
                                        terminationContractApprovalViewBox.find(".terminationContractApprovalView-upload").text('是');
                                        const uploadPurchContracts = contractHistoryData[i].obj.purchContractApproval.uploadPurchContracts

                                        if (uploadPurchContracts.length) {
                                            let str = '';
                                            for (let i = 0; i < uploadPurchContracts.length; i++) {
                                                var num = i + 1;
                                                let signPersonnel = ''
                                                uploadPurchContracts[i].uploadPurchContractSigners.forEach(item => {
                                                    signPersonnel += `<div>${item.signerName}</div>`
                                                })
                                                const fileStorage = uploadPurchContracts[i].fileStorage
                                                const signerFileStr = `
                                                    <div class="fileStorage" style="display:none">
                                                            <input type="text" class="originalId" value="${fileStorage.id}">
                                                            <input type="text" class="originalUrl"  value="${fileStorage.path}">
                                                            <input type="text" class="originalType" value="${fileStorage.fileType}">
                                                            <input type="text" class="originalName" value="${fileStorage.originalName}">
                                                            <input type="text" class="originalSize" value="${fileStorage.size}">
                                                    </div>
                                                `

                                                str += `<tr class="terminationContractApprovalView-contractTableTr">
                                                    <td width="10%" class="enter">
                                                        ${num}
                                                    </td>
                                                    <td width="30%" class="enter">
                                                        ${uploadPurchContracts[i].contractName}
                                                    </td>
                                                    <td width="30%" class="enter">
                                                        ${signPersonnel}
                                                        </td>
                                                    <td width="30%" class="enter fileList">
                                                        ${signerFileStr}
                                                        <div class="fileContent"></div>
                                                    </td>'
                                                </tr>`;
                                            }
                                            terminationContractApprovalViewBox.find(".terminationContractApprovalView-contractTableTr").after(str);

                                            terminationContractApprovalViewBox.find('.terminationContractApprovalView-contractTable .terminationContractApprovalView-contractTableTr').each(function (j, sel) {
                                                showOriginalFile($(sel).find('.fileStorage'), $(sel).find('.fileList'), 'onlyView')
                                            })

                                        }
                                    } else {
                                        terminationContractApprovalViewBox.find('.terminationContractApprovalView-contractTable').hide()
                                        terminationContractApprovalViewBox.find(".terminationContractApprovalView-upload").text('否');
                                    }
                                    const fileStorage = contractHistoryData[i].obj.purchContractApproval.fileStorage
                                    console.log(fileStorage, 999)
                                    if(fileStorage) {
                                        const procurementContractStr = `
                                            <div class="fileStorage" style="display:none">
                                                    <input type="text" class="originalId"   value="${fileStorage.id}">
                                                    <input type="text" class="originalUrl"  value="${fileStorage.path}">
                                                    <input type="text" class="originalType" value="${fileStorage.fileType}">
                                                    <input type="text" class="originalName" value="${fileStorage.originalName}">
                                                    <input type="text" class="originalSize" value="${fileStorage.size}">

                                            </div>
                                        `
                                        showOriginalFile(procurementContractStr, terminationContractApprovalViewBox.find('.terminationContractApprovalView-procurementContract').find('.fileListBox'), 'onlyView')
                                    }


                                } else {
                                    terminationContractApprovalViewBox.find(".terminationContractApprovalView-signMode").text('线下签署');
                                    terminationContractApprovalViewBox.find('.terminationContractApprovalView-signModeChange').hide()
                                    terminationContractApprovalViewBox.find('.terminationContractApprovalView-contractTable').hide()
                                }

                            } else {
                                terminationContractApprovalViewBox.find('.backTr').remove();
                                terminationContractApprovalViewBox.find('.terminationContractApprovalView-approvalConclusion').attr('colspan', 3)
                                terminationContractApprovalViewBox.find('.terminationContractApprovalView-approvalConclusion').attr('width', '85%')
                                terminationContractApprovalViewBox.find('.terminationContractApprovalView-signModeChange').hide()
                                terminationContractApprovalViewBox.find('.terminationContractApprovalView-contractTable').hide()
                            }

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

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


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

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

                        //签署确认
                        if (contractHistoryData[i].formBusinessName == '签署确认（线上）' || contractHistoryData[i].formBusinessName == '签署确认（线下）' || contractHistoryData[i].formBusinessName == '采购合同变更签署（线上）' || contractHistoryData[i].formBusinessName == '采购合同变更签署（线下）' ||  contractHistoryData[i].formBusinessName == '采购合同签署' || contractHistoryData[i].formBusinessName == '采购合同变更签署') {
                            //标题log
                            var logText = '';
                            if (contractHistoryData[i].businessProcessingLogVo) {
                                if (contractHistoryData[i].businessProcessingLogVo.assigneeTypeName) {
                                    logText += '<span style="color: #333;font-size: 0.13rem;font-weight: normal">' + contractHistoryData[i].businessProcessingLogVo.assigneeTypeName + '：' + contractHistoryData[i].businessProcessingLogVo.assigneeName + ' </span>';
                                }

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

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

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


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


                            // if (contractHistoryData[i].formBusinessName == '采购合同签署') {
                            //     signConfirmationViewBox.find(".detailContentBox-title-small").text('采购合同签署')

                            // } else {
                            //     signConfirmationViewBox.find(".detailContentBox-title-small").text('采购合同变更签署')
                            // }
                            signConfirmationViewBox.find('.detailContentBox-title-small').text(contractHistoryData[i].formBusinessName)

                            if(contractHistoryData[i].obj.history == 1) {
                                signConfirmationViewBox.find('.history-data').show()
                                signConfirmationViewBox.find('.dataV3-1').hide()
                                // 贸理通2.0 的逻辑电子合同信息
                                signConfirmationViewBox.find(".signConfirmationView-authUrl").text(contractHistoryData[i].obj.certifyLink == undefined ? '' : contractHistoryData[i].obj.certifyLink);
                                signConfirmationViewBox.find(".signConfirmationView-authStatus").text(contractHistoryData[i].obj.certifyStatus ? '已认证' : '未认证');
                                signConfirmationViewBox.find(".signConfirmationView-signUrl").text(contractHistoryData[i].obj.contractLink == undefined ? '' : contractHistoryData[i].obj.shortContractLink);
                                signConfirmationViewBox.find(".signConfirmationView-signStatus").text(contractHistoryData[i].obj.signStatus ? '已签署' : '未签署');
                            }else {
                                const conclusion = contractHistoryData[i].obj.conclusion
                                signConfirmationViewBox.find('.history-data').hide()
                                signConfirmationViewBox.find('.dataV3-1').show()
                                if(conclusion == 'pass') {
                                    signConfirmationViewBox.find(".signConfirmationView-conclusion").text('通过')
                                }
                                signConfirmationViewBox.find(".signConfirmationView-remark").text(contractHistoryData[i].obj.remark)

                                if(contractHistoryData[i].obj.online == 1) {
                                    let purchContractElectronicInfos =  contractHistoryData[i].obj.purchContractElectronicInfos
                                    if(contractHistoryData[i].formBusinessName == '采购合同变更签署（线上）') {
                                        purchContractElectronicInfos = contractHistoryData[i].obj.purchContractSupplementElectronicInfos
                                    }

                                    signConfirmationViewBox.find(".signConfirmationView-enterpriseName").attr('rowspan', purchContractElectronicInfos.length + 2)
                                    signConfirmationViewBox.find(".signConfirmationView-enterpriseName").text(contractHistoryData[i].obj.supplier.enterpriseName);
                                    signConfirmationViewBox.find(".signConfirmationView-certifyLink").text(purchContractElectronicInfos[0].certifyLink);
                                    signConfirmationViewBox.find(".signConfirmationView-certifyStatus").text(purchContractElectronicInfos[0].certifyStatus == 1 ? '已认证' : '未认证');
                                    signConfirmationViewBox.find(".signConfirmationView-shortContractLink").text(purchContractElectronicInfos[0].shortContractLink);

                                    const purchContractElectronicStr = purchContractElectronicInfos.map(item => {
                                        return `
                                            <tr>
                                                <td width="20%" class="enter">
                                                    ${item.contractName}：
                                                </td>
                                                <td colspan="2" class="enter">
                                                    <div>
                                                        <span>签署状态：</span>
                                                        <span>${item.signStatus == '1' ? '已签署' : '未签署' }</span>
                                                    </div>
                                                </td>
                                            </tr>
                                        `
                                    })

                                    signConfirmationViewBox.find(".signConfirmationView-table tbody").append(purchContractElectronicStr)
                                    signConfirmationViewBox.find(".signConfirmationView-file-online").hide()
                                }else {
                                    if(contractHistoryData[i].obj.fileStorages) {
                                        let fileStorages = ''
                                        contractHistoryData[i].obj.fileStorages.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, signConfirmationViewBox.find('.signConfirmationView-files').find('.fileListBox'), 'onlyView')
                                    }

                                    signConfirmationViewBox.find(".signConfirmationView-electron-online").hide()
                                }
                            }
                            $(".showarea").append(signConfirmationViewBox.show());
                        }

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

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

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

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

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

                            // if (contractHistoryData[i].formBusinessName == '采购合同终审') {
                            //     legalFinalAdjudicationViewBox.find(".detailContentBox-title-small").text('采购合同终审')
                            // } else {
                            //     legalFinalAdjudicationViewBox.find(".detailContentBox-title-small").text('采购合同变更审核')
                            // }

                            legalFinalAdjudicationViewBox.find(".detailContentBox-title-small").text(contractHistoryData[i].formBusinessName)

                            if (contractHistoryData[i].obj.fileStorageList) {
                                var fileList = contractHistoryData[i].obj.fileStorageList;
                                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>';
                                    }
                                    legalFinalAdjudicationViewBox.find(".legalFinalAdjudicationView-uploadFile").append(filesHtm);
                                }
                            }
                            if(contractHistoryData[i].obj.online != 1) {
                                legalFinalAdjudicationViewBox.find(".legalFinalAdjudicationView-online").hide()
                            }

                            //审批结论
                            legalFinalAdjudicationViewBox.find(".legalFinalAdjudicationView-approvalConclusion").text(contractHistoryData[i].obj.approvalConclusion);

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

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

                            purchaseContractChangeViewBox.find('.purchaseContractChangeViewBox-approval').text(contractHistoryData[i].obj.contractSupplementInfo.approval == 1 ? '是' : '否');
                            purchaseContractChangeViewBox.find('.purchaseContractChangeViewBox-remark').text(contractHistoryData[i].obj.contractSupplementInfo.remark);

                            let fileStorages = ''
                            if(contractHistoryData[i].obj.files) {
                                contractHistoryData[i].obj.files.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, purchaseContractChangeViewBox.find('.contractBoxTd').find('.fileListBox'), 'onlyView')
                            }


                            if(contractHistoryData[i].obj.contractSupplementInfo.approval == 0) {
                                purchaseContractChangeViewBox.find('.purchaseContractChangeViewBox-approvalHide').hide()
                                purchaseContractChangeViewBox.find('.purchaseContractChangeViewBox-approval').attr('colspan', 3)
                                purchaseContractChangeViewBox.find('.purchaseContractChangeViewBox-approval').attr('width', '85%')
                                purchaseContractChangeViewBox.find('.purchaseContractChangeViewBox-contractFiles').show()

                            }else {
                                purchaseContractChangeViewBox.find('.purchaseContractChangeViewBox-approval').attr('width', '35%')
                                purchaseContractChangeViewBox.find('.purchaseContractChangeViewBox-approval').attr('colspan', 0)
                                purchaseContractChangeViewBox.find('.purchaseContractChangeViewBox-addGoods').text(contractHistoryData[i].obj.contractSupplementInfo.addGoods == 1 ? '是' : '否');
                                purchaseContractChangeViewBox.find('.purchaseContractChangeViewBox-supplementContractNumber').text(contractHistoryData[i].obj.contractSupplementInfo.supplementContractNumber);
                                purchaseContractChangeViewBox.find('.purchaseContractChangeViewBox-contractEffectDate').text(contractHistoryData[i].obj.contractSupplementInfo.contractEffectDate);
                                purchaseContractChangeViewBox.find('.purchaseContractChangeViewBox-priceRuleDetail').text(contractHistoryData[i].obj.contractSupplementInfo.priceRuleDetail);
                                purchaseContractChangeViewBox.find('.purchaseContractChangeViewBox-otherConvention').text(contractHistoryData[i].obj.contractSupplementInfo.otherConvention);
                                purchaseContractChangeViewBox.find('.purchaseContractChangeViewBox-contractFiles').hide()
                            }

                            if(contractHistoryData[i].obj.contractSupplementInfo.addGoods != 1) {
                                purchaseContractChangeViewBox.find('.goodsTable').hide()
                            }else {
                                //货物信息
                                var goodsInfoList = contractHistoryData[i].obj.contractGoodsInfo;
                                if (goodsInfoList) {
                                    var trs = '';
                                    for (var ii = 0; ii < goodsInfoList.length; ii++) {
                                        var num = ii + 1;
                                        trs += '<tr>' +
                                            '<td  class="enter">' + num + '</td>' +
                                            '<td  class="enter">' + goodsInfoList[ii].goodsName + '</td>' +
                                            '<td  class="enter">' + goodsInfoList[ii].goodsFactory + '</td>' +
                                            '<td  class="enter">' + goodsInfoList[ii].modelNumber + '</td>' +
                                            '<td  class="enter">' + goodsInfoList[ii].units + '</td>' +
                                            '<td  class="enter">' + goodsInfoList[ii].quantity + '</td>' +
                                            '<td  class="enter">' + goodsInfoList[ii].price + '</td>' +
                                            // '<td width="12%" class="enter">' + (goodsInfoList[ii].salesContractGoodsInfo.clearPrice ? '是' : '否') + '</td>' +
                                            // '<td width="10%" class="enter">' + (goodsInfoList[ii].purchPrice ? commaDelimiter(goodsInfoList[ii].purchPrice) : '') + '</td>' +
                                            '<td width="14%" class="enter">' + goodsInfoList[ii].remark + '</td>' +
                                            '</tr>';
                                    }
                                    ii = null;
                                    purchaseContractChangeViewBox.find(".goodsInfoList_header").after(trs);
                                }
                            }



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

                        }

                        if (contractHistoryData[i].formBusinessName == '采购合同变更审核') {
                            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 purchaseContractChangeCheckViewBox = $(".historyHideArea .purchaseContractChangeCheckViewBox").clone();
                            purchaseContractChangeCheckViewBox.find('.purchaseContractChangeCheckViewBox-log').append(logText)

                            purchaseContractChangeCheckViewBox.find('.purchaseContractChangeCheckViewBox-otherConvention').text(contractHistoryData[i].obj.otherConvention);

                            purchaseContractChangeCheckViewBox.find('.purchaseContractChangeCheckViewBox-approvalConclusion').text(contractHistoryData[i].obj.approvalConclusion === 'pass' ? '通过' : '驳回');


                            if(contractHistoryData[i].obj.approvalConclusion === 'pass') {
                                if (contractHistoryData[i].obj.signMode == 1) {
                                    purchaseContractChangeCheckViewBox.find(".purchaseContractChangeCheckViewBox-signMode").text('线上签署');
                                    if (contractHistoryData[i].obj.upload == 1) {
                                        purchaseContractChangeCheckViewBox.find(".purchaseContractChangeCheckViewBox-upload").text('是');

                                        const uploadPurchContracts = contractHistoryData[i].obj.uploadPurchSupplementContracts

                                        if (uploadPurchContracts.length) {
                                            let str = '';
                                            for (let i = 0; i < uploadPurchContracts.length; i++) {
                                                var num = i + 1;
                                                let signPersonnel = ''
                                                uploadPurchContracts[i].uploadPurchContractSupplementSignerList.forEach(item => {
                                                    signPersonnel += `<div>${item.signerName}</div>`
                                                })
                                                const fileStorage = uploadPurchContracts[i].fileStorage
                                                const signerFileStr = `
                                                    <div class="fileStorage" style="display:none">
                                                            <input type="text" class="originalId" value="${fileStorage.id}">
                                                            <input type="text" class="originalUrl"  value="${fileStorage.path}">
                                                            <input type="text" class="originalType" value="${fileStorage.fileType}">
                                                            <input type="text" class="originalName" value="${fileStorage.originalName}">
                                                            <input type="text" class="originalSize" value="${fileStorage.size}">
                                                    </div>
                                                `

                                                str += `<tr class="purchaseContractChangeCheckViewBox-contractTableTr">
                                                    <td width="10%" class="enter">
                                                        ${num}
                                                    </td>
                                                    <td width="30%" class="enter">
                                                        ${uploadPurchContracts[i].contractName}
                                                    </td>
                                                    <td width="30%" class="enter">
                                                        ${signPersonnel}
                                                        </td>
                                                    <td width="30%" class="enter fileList">
                                                        ${signerFileStr}
                                                        <div class="fileContent"></div>
                                                    </td>'
                                                </tr>`;
                                            }
                                            purchaseContractChangeCheckViewBox.find(".purchaseContractChangeCheckViewBox-contractTableTr").after(str);

                                            purchaseContractChangeCheckViewBox.find('.purchaseContractChangeCheckViewBox-contractTable .purchaseContractChangeCheckViewBox-contractTableTr').each(function (j, sel) {
                                                showOriginalFile($(sel).find('.fileStorage'), $(sel).find('.fileList'), 'onlyView')
                                            })

                                        }
                                    } else {
                                        purchaseContractChangeCheckViewBox.find('.purchaseContractChangeCheckViewBox-contractTable').hide()
                                        purchaseContractChangeCheckViewBox.find(".purchaseContractChangeCheckViewBox-upload").text('否');
                                    }

                                    const fileStorage = contractHistoryData[i].obj.fileStorage
                                    if(fileStorage) {
                                        const procurementContractStr = `
                                            <div class="fileStorage" style="display:none">
                                                    <input type="text" class="originalId"   value="${fileStorage.id}">
                                                    <input type="text" class="originalUrl"  value="${fileStorage.path}">
                                                    <input type="text" class="originalType" value="${fileStorage.fileType}">
                                                    <input type="text" class="originalName" value="${fileStorage.originalName}">
                                                    <input type="text" class="originalSize" value="${fileStorage.size}">
                                            </div>
                                        `
                                        showOriginalFile(procurementContractStr, purchaseContractChangeCheckViewBox.find('.purchaseContractChangeCheckViewBox-procurementContract').find('.fileListBox'), 'onlyView')
                                    }
                                } else {
                                    purchaseContractChangeCheckViewBox.find(".purchaseContractChangeCheckViewBox-signMode").text('线下签署');
                                    purchaseContractChangeCheckViewBox.find('.purchaseContractChangeCheckViewBox-signModeChange').hide()
                                    purchaseContractChangeCheckViewBox.find('.purchaseContractChangeCheckViewBox-contractTable').hide()
                                }
                            }else {
                                purchaseContractChangeCheckViewBox.find('.approvalChange').hide();
                                purchaseContractChangeCheckViewBox.find('.purchaseContractChangeCheckViewBox-approvalConclusion').attr('colspan', 3)
                                purchaseContractChangeCheckViewBox.find('.purchaseContractChangeCheckViewBox-approvalConclusion').attr('width', '85%')
                                purchaseContractChangeCheckViewBox.find('.purchaseContractChangeCheckViewBox-signModeChange').hide()
                                purchaseContractChangeCheckViewBox.find('.purchaseContractChangeCheckViewBox-contractTable').hide()
                            }

                            purchaseContractChangeCheckViewBox.find('.purchaseContractChangeCheckViewBox-approvalOpinion').text(contractHistoryData[i].obj.approvalComment);
                            $(".showarea").append(purchaseContractChangeCheckViewBox.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();
            }
        });

    });
})
