<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>设计变更详情</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <meta name="decorator" content="base"/>
    <link rel="stylesheet" type="text/css" href="${ctxPlugin}/static/css/reset.css"/>
    <link rel="stylesheet" href="${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/dist/viewer.css" media="all">
    <style>
        html {
            background-color: #fff;
            padding-bottom: 50px;
        }
        .form-span {
            display: block;
            padding: 8px 0;
            margin-left: 110px;
        }

        .page-iframe {
            border: none;
            width: 100%;
            min-height: calc(100vh - 250px);
        }
        .mb-10{
            margin-bottom: 10px !important;
        }
        .pd-10{
            padding: 10px;
        }
        .idea-text{
            width: 320px; height: 100px;outline: none; padding: 3px
        }
        .msg-title{
            text-align: center;
            margin: 10px 0;
            font-size: 16px;
        }
        .title1 {
            border-left: 4px solid #1b6073;
            padding-left: 20px;
            font-size: 14px;
            margin: 10px auto;
            font-weight: 600;
            height: 34px;
            line-height: 34px;
            background-color: #f4f6f9;
            color: #666666;
        }
        .download-link {
            display: inline-block;
            padding: 8px 16px;
            color: #007bff;
            text-decoration: none;
            border-radius: 4px;
        }

        .download-link:hover {
            color: #0056b3;
        }
        .layui-input-block {
            margin-left: 110px;
        }

        .layui-form-label {
            width: 110px;
        }
        .clearfix{*zoom:1;}
        .clearfix:before,.clearfix:after{display:table; line-height:0; content:"";}
        .clearfix:after{clear:both;}

        .layui-tab-title{
            margin: 0 0 0 20px;
        }
        .layui-tab-content{
            margin: 0 0 0 20px;
        }
        .bj-img {
            margin-right: 5px;
        }
        .blank-img {
            background: url('${ctxPlugin}/static/imgs/blankImg.png') center center no-repeat;
            width: 80px;
            height: 80px;
            display: inline-block;
        }
        .link-blue{ color: #1b6073; cursor: pointer;}
        .two-col {
            display: flex;
        }
        .two-col .scheme-item,.component-item {
            padding-right: 20px;
            flex-grow: 1;
            flex-shrink: 1;
            flex-basis: 0;
        }
        .two-col .design-item {
            flex-grow: 1;
            flex-shrink: 1;
            padding-right: 20px;
            flex-basis: 0;
        }
        div.sep {
            border-bottom: 1px dashed #ccc;
            padding-top: 10px;
            clear: both;
            margin-bottom: 10px;
        }
        .two-col .design-doc {
            flex-grow: 1;
            flex-shrink: 1;
            padding-right: 20px;
            flex-basis: 0;
        }
        .design-item-title {
            margin-bottom: 10px;
        }
    </style>
</head>
<body>
<div class="layui-fluid pd-10">
    <div class="order-win layui-form">
        <button class="layui-btn" style="margin-left: 94.5%;" onclick="approvalRecord()">审批记录</button>
        <div class="layui-card-body pt-20 pb-40">
            <div class="layui-col-xs12 form-box">
                <div class="layui-inline layui-col-xs3">
                    <label class="layui-form-label w-130">电站编码：</label>
                    <div class="layui-input-block ">
                        <input type="text" autocomplete="off"  name="stationCode" lay-verify="stationCode"  class="layui-input" value="${entry.powerStationCode}" disabled>
                        <input type="text" style="width: 78%;float: left;"  id="stationId" lay-verify="stationCode" class="layui-input hide" value="">
<%--                        <a href="#" class="pos-a h-32 lh-32 layui-span-unit pl-10 layui-table-link" onclick="selectEntry('${partnerId}')" style="font-size: 20px">+</a>--%>
                    </div>
                </div>
                <div class="layui-inline layui-col-xs3">
                    <label class="layui-form-label w-130">电站状态：</label>
                    <div class="layui-input-block ">
                        <input type="text"  name="status" class="layui-input"
                        <c:choose>
                        <c:when test="${entry.status eq '0'}">
                               <c:if test="${entry.credit eq '0'}">value="暂存"</c:if>
                               <c:if test="${entry.credit eq '1'}">value="待预审"</c:if>
                               <c:if test="${entry.credit eq '2'}">value="预审待审批"</c:if>
                               <c:if test="${entry.credit eq '3'}">value="预审审批中"</c:if>
                               <c:if test="${entry.credit eq '4' && entry.designAuditFlag eq '3'}">value="自审驳回"</c:if>
                               <c:if test="${entry.credit eq '4' && entry.designAuditFlag eq 'a'}">value="待设计"</c:if>
                               <c:if test="${entry.credit eq '4' && entry.designAuditFlag ne '3' && entry.designAuditFlag ne 'a'}">value="待踏勘"</c:if>
                               <c:if test="${entry.credit eq '5'}">value="预审拒绝"</c:if>
                        </c:when>
                        <c:when test="${entry.status eq '1'}">
                               <c:if test="${entry.designAuditFlag eq '1'}">value="待踏勘"</c:if>
                               <c:if test="${entry.designAuditFlag eq 'a'}">value="待设计"</c:if>
                               <c:if test="${entry.designAuditFlag eq '2'}">value="待自审"</c:if>
                               <c:if test="${entry.designAuditFlag eq '3'}">value="自审驳回"</c:if>
                               <c:if test="${entry.designAuditFlag eq '4'}">value="自审通过"</c:if>
                               <c:if test="${entry.designAuditFlag eq '5'}">value="设计审核驳回"</c:if>
                               <c:if test="${entry.designAuditFlag eq '6'}">value="设计审核通过"</c:if>
                               <c:if test="${entry.designAuditFlag eq '7'}">value="进件审核驳回"</c:if>
                               <c:if test="${entry.designAuditFlag eq '8'}">value="进件审核中"</c:if>
                               <c:if test="${entry.designAuditFlag eq '9'}">value="进件审核通过"</c:if>
                        </c:when>
                        <c:when test="${entry.status eq '2'}">
                            value="审核驳回"
                        </c:when>
                        <c:when test="${entry.status eq '3'}">
                               value="待下单"
                        </c:when>
                        <c:when test="${entry.status eq '4'}">
                               <c:if test="${entry.installFlag eq '1'}">value="待派工"</c:if>
                               <c:if test="${entry.installFlag eq '2'}">value="待安装"</c:if>
                               <c:if test="${entry.installFlag eq '3'}">value="自审驳回"</c:if>
                               <c:if test="${entry.installFlag eq '4'}">value="安装完成"</c:if>
                        </c:when>
                        <c:when test="${entry.status eq '5'}">
                            value="待安装验收"
                        </c:when>
                        <c:when test="${entry.status eq 'f'}">
                               value="安装验收驳回"
                        </c:when>
                        <c:when test="${entry.status eq '6'}">
                            value="待并网"
                        </c:when>
                        <c:when test="${entry.status eq '7'}">
                               value="待并网验收"
                        </c:when>
                        <c:when test="${entry.status eq '8'}">
                            value="待交付"
                        </c:when>
                        <c:when test="${entry.status eq '9'}">
                               value="待归档"
                        </c:when>
                        <c:when test="${entry.status eq '10'}">
                            value="验收驳回"
                        </c:when>
                        <c:when test="${entry.status eq '11'}">
                               value="归档驳回"
                        </c:when>
                        <c:when test="${entry.status eq 'a'}">
                            value="已完成"
                        </c:when>
                        <c:when test="${entry.status eq 'c'}">
                            value="待代理商确认"
                        </c:when>
                        <c:when test="${entry.status eq 'e'}">
                                value="待签署合同"
                        </c:when>
                        <c:when test="${entry.status eq 'w'}">
                            value="信息登记"
                        </c:when>
                        <c:when test="${entry.status eq 'g'}">
                                value="设计审核"
                        </c:when>
                        <c:when test="${entry.status eq 'AN'}">
                            value="待安装确认"
                        </c:when>
                        <c:when test="${entry.status eq 'AT'}">
                                value="安装确认驳回"
                        </c:when>
                        <c:when test="${entry.status eq 'BW'}">
                            value="待并网确认"
                        </c:when>
                        <c:when test="${entry.status eq 'BN'}">
                                value="并网确认驳回"
                        </c:when>
                        <c:when test="${entry.status eq 'h'}">
                            value="勘测设计自审"
                        </c:when>
                        <c:when test="${entry.status eq 'i'}">
                                value="安装自审"
                        </c:when>
                        <c:otherwise>
                               --
                        </c:otherwise>
                        </c:choose>
                               disabled>
                    </div>
                </div>
                <div class="layui-inline layui-col-xs3">
                    <label class="layui-form-label w-130">代理商：</label>
                    <div class="layui-input-block ">
                        <input type="text" name="traderName" class="layui-input" value="${entry.traderName}" disabled>
                    </div>
                </div>
                <div class="layui-inline layui-col-xs3">
                    <label class="layui-form-label w-130">所属资方：</label>
                    <div class="layui-input-block ">
                        <input type="text" name="partnerName" class="layui-input" value="${entry.partnerName}" disabled>
                    </div>
                </div>
                <div class="layui-inline layui-col-xs3">
                    <label class="layui-form-label w-130">业主姓名：</label>
                    <div class="layui-input-block ">
                        <input type="text" name="tenantName"  class="layui-input" value="${entry.tenantName}" disabled>
                    </div>
                </div>
                <div class="layui-inline layui-col-xs3">
                    <label class="layui-form-label w-130">身份证号：</label>
                    <div class="layui-input-block ">
                        <input type="text" name="idCode" class="layui-input" value="${entry.idCode}" disabled>
                    </div>
                </div>
                <div class="layui-inline layui-col-xs9">
                    <label class="layui-form-label w-130">安装地址：</label>
                    <div class="layui-input-block ">
                        <input type="text" name="address" class="layui-input" value="${entry.province}${entry.city}${entry.area}${entry.address}" disabled>
                    </div>
                </div>
            </div>
        </div>
        <div class="clear-both">
            <p class="layui-elem-quote" style="margin: 0px 0px 0px 10px">产品信息</p>
            <div class="layui-form-item layui-row">
                <div class="layui-col-sm3 layui-col-md3">
                    <label class="layui-form-label">备案类型：</label>
                    <span class="form-span" id="filingType">
                        <c:choose>
                            <c:when test="${entry.filingType eq '1'}">
                                农户备案
                            </c:when>
                            <c:when test="${entry.filingType eq '2'}">
                                项目公司备案
                            </c:when>
                        </c:choose>
                    </span>
                </div>
                <div class="layui-col-sm3 layui-col-md3">
                    <label class="layui-form-label">项目公司：</label>
                    <span class="form-span" id="projectCompanyName">
                        ${entry.projectCompanyName}
                    </span>
                </div>
                <div class="layui-col-sm3 layui-col-md3">
                    <label class="layui-form-label">业务属性：</label>
                    <span class="form-span" id="productLine">
                        <c:choose>
                            <c:when test="${entry.productLine eq '1'}">
                                纯租25年业务
                            </c:when>
                            <c:when test="${entry.productLine eq '2'}">
                                经营性租赁
                            </c:when>
                            <c:when test="${entry.productLine eq '3'}">
                                融资租赁
                            </c:when>
                            <c:when test="${entry.productLine eq '4'}">
                                光伏贷
                            </c:when>
                            <c:when test="${entry.productLine eq '5'}">
                                全款
                            </c:when>
                            <c:when test="${entry.productLine eq '6'}">
                                其他
                            </c:when>
                            <c:otherwise>
                                ${entry.productLine}
                            </c:otherwise>
                        </c:choose>
                    </span>
                </div>
                <div class="layui-col-sm12 layui-col-md12" id="projectTab">
                    <table class="layui-table">
                        <colgroup>
                            <col width="25%">
                            <col width="25%">
                            <col width="25%">
                            <col width="25%">
                        </colgroup>
                        <thead>
                        <tr style="background: white">
                            <th style="text-align: center">序号</th>
                            <th style="text-align: center">产品编号</th>
                            <th style="text-align: center">产品名称</th>
                            <th style="text-align: center">屋顶类型</th>
                        </tr>
                        </thead>
                        <tbody id="projectList">
                        <c:forEach items="${entryProject}" varStatus="vs" var="project">
                            <tr style="text-align: center" class="projectTr" >
                                <td>${vs.count}</td>
                                <td>${project.columns.code}</td>
                                <td>${project.columns.name}</td>
                                <td>${project.columns.roof_type}</td>
                            </tr>
                        </c:forEach>
                        </tbody>
                    </table>
                </div>
            </div>
            <div class="layui-inline layui-col-xs12">
                <label class="layui-form-label w-130">变更原因：</label>
                <div class="layui-input-block ">
                    <textarea name="reason" id="reason" placeholder="" disabled class="layui-textarea">${design.reason}</textarea>
                </div>
            </div>
        </div>
        <div class="clear-both">
            <p class="layui-elem-quote" style="margin: 0px 0px 0px 10px">设计方案信息</p>
            <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief" id="LAY_app">
                <ul class="layui-tab-title" id="designInfoUl">
                    <c:forEach items="${entryProject}" var="entryProject" varStatus="vs">
                        <li class=" <c:if test="${vs.index eq 0}">layui-this</c:if>" id="${entryProject.columns.code}">
                            <c:choose>
                                <c:when test="${not empty entryProject.columns.roof_type}">
                                    ${entryProject.columns.roof_type}
                                </c:when>
                                <c:otherwise>
                                    ${entryProject.columns.name}
                                </c:otherwise>
                            </c:choose>
                        </li>
                    </c:forEach>
                </ul>
                <c:forEach items="${changeDetails}" var="entryDesign" varStatus="vs">
                    <div class="layui-tab-content designTabContent <c:if test="${vs.index ne 0}">layui-hide</c:if>  " id="designImgDiv${vs.index}">
                        <div class="layui-tab-content two-col" style="padding: 0">
                            <div class="scheme-item">
                                <div>变更前方案：</div>
                                <table class="layui-table">
                                    <thead>
                                    <th>方案类型</th>
                                    <th>方案名称</th>
                                    </thead>
                                    <tbody id="contentBody">
                                    <tr>
                                        <td id="schemeTypeName">${entryDesign.columns.pre_scheme_type_name}</td>
                                        <td id="schemeName">${entryDesign.columns.pre_scheme_name}</td>
                                    </tr>
                                    </tbody>
                                </table>
                            </div>
                            <div class="scheme-item">
                                <div>变更后方案：</div>
                                <table class="layui-table">
                                    <thead>
                                    <th>方案类型</th>
                                    <th>方案名称</th>
                                    </thead>
                                    <tbody id="contentBody2">
                                    <tr>
                                        <td id="postSchemeTypeName">${entryDesign.columns.scheme_type_name}</td>
                                        <td id="postSchemeName">${entryDesign.columns.scheme_name}</td>
                                    </tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>

                        <div class="sep"></div>

                        <div class="layui-tab-content  two-col" style="padding: 0">
                            <div class="component-item">
                                <div>变更前物料：</div>
                                <table class="layui-table" id="preComponentTable">
                                    <thead>
                                    <th style="text-align: center">序号</th>
                                    <th style="text-align: center">物料类型</th>
                                    <th style="text-align: center">物料规格</th>
                                    <th style="text-align: center">数量</th>
                                    </thead>
                                    <tbody id="preComponentTableContent">
                                    <c:forEach varStatus="vs" items="${entryDesign.columns.preComponentList}" var="preComponent" >
                                        <tr  style="text-align: center">
                                            <td>${vs.count}</td>
                                            <td>
                                                <c:choose>
                                                    <c:when test="${preComponent.columns.item_type eq '1'}">
                                                        逆变器
                                                    </c:when>
                                                    <c:when test="${preComponent.columns.item_type eq '2'}">
                                                        并网箱
                                                    </c:when>
                                                    <c:when test="${preComponent.columns.item_type eq  '3'}">
                                                        组件
                                                    </c:when>
                                                    <c:when test="${preComponent.columns.item_type eq  '4'}">
                                                        支架
                                                    </c:when>
                                                </c:choose>
                                            </td>
                                            <td>
                                                <c:choose>
                                                    <c:when test="${preComponent.columns.item_type eq '1'}">
                                                        <c:if test="${info2.columns.component1_model.status == '1'}">
                                                            ${preComponent.columns.material_model}
                                                        </c:if>
                                                        <c:if test="${info2.columns.component1_model.status != '1'}">
                                                            ${preComponent.columns.model}
                                                        </c:if>
                                                    </c:when>
                                                    <c:when test="${preComponent.columns.item_type eq  '3'}">
                                                        <c:if test="${info2.columns.component3_model.status == '1'}">
                                                            ${preComponent.columns.material_model}Wp
                                                        </c:if>
                                                        <c:if test="${info2.columns.component3_model.status != '1'}">
                                                            ${preComponent.columns.model}Wp
                                                        </c:if>
                                                    </c:when>
                                                    <c:otherwise>
                                                        ${preComponent.columns.model}
                                                    </c:otherwise>
                                                </c:choose>
                                            </td>
                                            <td>${preComponent.columns.num}</td>
                                        </tr>
                                    </c:forEach>
                                    </tbody>
                                </table>
                                <div>变更前设计安装容量：<span id="preDesignCapacity">${entryDesign.columns.preDesignCapacity / 1000}</span>kW</div>
                            </div>
                            <div class="component-item">
                                <div>变更后物料：</div>
                                <table class="layui-table">
                                    <thead>
                                    <th style="text-align: center">序号</th>
                                    <th style="text-align: center">物料类型</th>
                                    <th style="text-align: center">物料规格</th>
                                    <th style="text-align: center">数量</th>
                                    </thead>
                                    <tbody id="postComponentTableContent">
                                    <c:forEach varStatus="vs" items="${entryDesign.columns.postComponentList}" var="postComponent" >
                                        <tr style="text-align: center">
                                            <td>${vs.count}</td>
                                            <td>
                                                <c:choose>
                                                    <c:when test="${postComponent.columns.item_type eq '1'}">
                                                        逆变器
                                                    </c:when>
                                                    <c:when test="${postComponent.columns.item_type eq '2'}">
                                                        并网箱
                                                    </c:when>
                                                    <c:when test="${postComponent.columns.item_type eq  '3'}">
                                                        组件
                                                    </c:when>
                                                    <c:when test="${postComponent.columns.item_type eq  '4'}">
                                                        支架
                                                    </c:when>
                                                </c:choose>
                                            </td>
                                            <td>
                                                <c:choose>
                                                    <c:when test="${postComponent.columns.item_type eq '1'}">
                                                        <c:if test="${info2.columns.component1_model.status == '1'}">
                                                            ${postComponent.columns.material_model}
                                                        </c:if>
                                                        <c:if test="${info2.columns.component1_model.status != '1'}">
                                                            ${postComponent.columns.model}
                                                        </c:if>
                                                    </c:when>
                                                    <c:when test="${postComponent.columns.item_type eq  '3'}">
                                                        <c:if test="${info2.columns.component3_model.status == '1'}">
                                                            ${postComponent.columns.material_model}Wp
                                                        </c:if>
                                                        <c:if test="${info2.columns.component3_model.status != '1'}">
                                                            ${postComponent.columns.model}Wp
                                                        </c:if>
                                                    </c:when>
                                                    <c:otherwise>
                                                        ${postComponent.columns.model}
                                                    </c:otherwise>
                                                </c:choose>
                                            </td>
                                            <td>${postComponent.columns.num}</td>
                                        </tr>
                                    </c:forEach>
                                    </tbody>
                                </table>
                                <div>变更后设计安装容量：<span id="postDesignCapacity">${entryDesign.columns.postDesignCapacity /1000}</span>kW</div>
                            </div>
                        </div>

                        <div class="sep"></div>

                        <div class="layui-tab-content two-col" style="padding: 0;margin-top: 5px;">
                            <div class="design-doc">
                                <c:if test="${info2.columns.design_drawings.status eq '1'}">
                                    <div class=" design_drawings">
                                        变更前<i class="design_drawings_name">设计图纸：</i>
                                        <div id="preDocs">
                                            <c:forEach varStatus="vs" items="${entryDesign.columns.pre_design_drawings}" var="path" >
                                                <div style="margin-top: 5px">
                                                    <a href="${commonStaticImgPath}${path}" class="download-link">${fns:substringAfterLast(path, '/')}</a>
                                                    <a  target="_blank"  onclick="previewUrl('${commonStaticImgPath}${path}')" style="cursor: pointer" class="download-link">查看</a>
                                                </div>
                                            </c:forEach>
                                        </div>
                                    </div>
                                </c:if>
                                <%--
                                <c:if test="${info2.columns.zjpb_img_03.status eq '1'}">
                                    <div class="zjpb_img">
                                        变更前<i class="zjpb_img_name">组件排布图：</i>
                                        <div id="zjpb_img_pre">
                                            <c:forEach varStatus="vs" items="${entryDesign.columns.pre_zjpb_img}" var="path" >
                                                <div style="margin-top: 5px">
                                                    <a href="${commonStaticImgPath}${path}" class="download-link">${fns:substringAfterLast(path, '/')}</a>
                                                    <a  target="_blank"  onclick="previewUrl('${commonStaticImgPath}${path}')" style="cursor: pointer" class="download-link">查看</a>
                                                </div>
                                            </c:forEach>
                                        </div>
                                    </div>
                                </c:if>
                                <c:if test="${info2.columns.zjzx_img_03.status eq '1'}">
                                    <div  class="zjzx_img">
                                        变更前<i class="zjzx_img_name">组串接线图：</i>
                                        <div id="zjzx_img_pre">
                                            <c:forEach varStatus="vs" items="${entryDesign.columns.pre_zjzx_img}" var="path" >
                                                <div style="margin-top: 5px">
                                                    <a href="${commonStaticImgPath}${path}" class="download-link">${fns:substringAfterLast(path, '/')}</a>
                                                    <a  target="_blank"  onclick="previewUrl('${commonStaticImgPath}${path}')" style="cursor: pointer" class="download-link">查看</a>
                                                </div>
                                            </c:forEach>
                                        </div>
                                    </div>
                                </c:if>
                                <c:if test="${info2.columns.zjcs_img_03.status eq '1'}">
                                    <div  class="zjcs_img">
                                        变更前<i class="zjcs_img_name">组件支架图：</i>
                                        <div id="zjcs_img_pre">
                                            <c:forEach varStatus="vs" items="${entryDesign.columns.pre_zjcs_img}" var="path" >
                                                <div style="margin-top: 5px">
                                                    <a href="${commonStaticImgPath}${path}" class="download-link">${fns:substringAfterLast(path, '/')}</a>
                                                    <a  target="_blank"  onclick="previewUrl('${commonStaticImgPath}${path}')" style="cursor: pointer" class="download-link">查看</a>
                                                </div>
                                            </c:forEach>
                                        </div>
                                    </div>
                                </c:if>
                                <c:if test="${info2.columns.zjhs_img_03.status eq '1'}">
                                    <div  class="zjhs_img">
                                        变更前<i class="zjhs_img_name">一次接线图/电气图：</i>
                                        <div id="zjhs_img_pre">
                                            <c:forEach varStatus="vs" items="${entryDesign.columns.pre_zjhs_img}" var="path" >
                                                <div style="margin-top: 5px">
                                                    <a href="${commonStaticImgPath}${path}" class="download-link">${fns:substringAfterLast(path, '/')}</a>
                                                    <a  target="_blank"  onclick="previewUrl('${commonStaticImgPath}${path}')" style="cursor: pointer" class="download-link">查看</a>
                                                </div>
                                            </c:forEach>
                                        </div>
                                    </div>
                                </c:if>
                                --%>
                            </div>
                            <div class="design-doc">
                                <c:if test="${info2.columns.design_drawings.status eq '1'}">
                                    <div class="design_drawings" >
                                        变更后<i class="design_drawings_name">设计图纸：</i>
                                        <div id="postDocs">
                                            <c:forEach varStatus="vs" items="${entryDesign.columns.design_drawings}" var="path" >
                                                <div style="margin-top: 5px">
                                                    <a href="${commonStaticImgPath}${path}" class="download-link">${fns:substringAfterLast(path, '/')}</a>
                                                    <a  target="_blank"  onclick="previewUrl('${commonStaticImgPath}${path}')" style="cursor: pointer" class="download-link">查看</a>
                                                </div>
                                            </c:forEach>
                                        </div>
                                    </div>
                                </c:if>

                                    <%--
                                    <c:if test="${info2.columns.zjpb_img_03.status eq '1'}">
                                        <div class="zjpb_img hide">
                                            变更后<i class="zjpb_img_name">组件排布图：</i>
                                            <div id="zjpb_img_post">

                                            </div>
                                        </div>
                                    </c:if>

                                    <div  class=" zjzx_img hide">
                                        变更后<i class="zjzx_img_name">组件接线图：</i>
                                        <div id="zjzx_img_post">

                                        </div>
                                    </div>
                                    <div  class=" zjcs_img hide">
                                        变更后<i class="zjcs_img_name">组件支架图：</i>
                                        <div id="zjcs_img_post">

                                        </div>
                                    </div>
                                    <div  class=" zjhs_img hide">
                                        变更后<i class="zjhs_img_name">一次接线图/电气图：</i>
                                        <div id="zjhs_img_post">

                                        </div>
                                    </div>
                                    --%>
                            </div>
                        </div>
                    </div>
                </c:forEach>
            </div>
        </div>
        <div class="layui-inline layui-col-xs12">
            <label class="layui-form-label w-130">审核备注：</label>
            <div class="layui-input-block ">
                <input type="text" name="auditRemarks" class="layui-input" value="${design.auditRemark}" autocomplete="off" <c:if test="${fromAudit eq '2'}">disabled</c:if>>
            </div>
        </div>
    </div>
</div>

<c:choose>
    <c:when test="${(fns:checkPagePermission(request, 'DZBG_SJBG_DSH_AUDIT_B') eq '0') && fromAudit eq '1'}">
        <div class="layui-form-item text-c operate-footer">
            <button type="button" class="layui-btn" onclick="temp();">暂存</button>
            <button type="button" class="layui-btn" onclick="pass();">审核通过</button>
            <button type="button" class="layui-btn" onclick="reject();">审核驳回</button>
            <button class="layui-btn layui-btn-primary" onclick="closeSelf()">取消</button>
        </div>
    </c:when>
    <c:otherwise>
        <div class="layui-form-item text-c operate-footer">
            <button class="layui-btn layui-btn-primary" onclick="closeSelf()">关闭</button>
        </div>
    </c:otherwise>
</c:choose>

<script src="${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/layui/layui.js"></script>
<script src="${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/dist/viewer.js"></script>
<script src="${ctxPlugin}/lib/base64.js"></script>
<script>
    //图片查看效果
    let form = null;
    let entry = null;
    let formSet = null;
    let info2 = null;
    let preComponents = [];
    var viewer = new Viewer(document.getElementById('LAY_app'));
    layui.config({
        base: '${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'jquery', 'layer','upload','form'], function () {
        $ = layui.$;
        layer = layui.layer;
        upload = layui.upload;
        form = layui.form;
        element = layui.element;

        element.on('tab(docDemoTabBrief)', function (data) {
            $('.designTabContent').eq(data.index).removeClass('layui-hide').siblings('.designTabContent').addClass('layui-hide');
        });

        upload.render({
            elem: '#dzImgsUploader',
            url: '${ctx}/common/uploadFile',
            before: function (obj) {
                //预读本地文件示例，不支持ie8
                obj.preview(function (index, file, result) {
                });
            },
            done: function (res) {
                //上传完毕回调
                addImg(res.path,"dzImgs", 4);
            },
            error: function () {
                //请求异常回调
            }
        });

        upload.render({
            elem: '#uploadDzDocPost' //绑定元素
            , accept: 'file'
            , url: '${ctx}/common/uploadFileKeepName' //上传接口
            , before: function (obj) {
                //预读本地文件示例，不支持ie8
                obj.preview(function (index, file, result) {
                });
            }
            , done: function (res, index, upload) {
                $("#inputDzDocPost").val(res.path);
                $("#linkDzDocPost").text(res.filename).attr("href", "${commonStaticImgPath}"+res.path).data('filename', res.filename);
            }
            , error: function () {
                //请求异常回调
            }
        });

        form.on('select(planType)', function (data) {
            var value = $(data.elem).find("option:selected").val();
            if (isBlank(value)) {
                return
            }
            var that_ = $(this);
            //获取当前类型下的方案名称
            $.ajax({
                url: "${ctx}/planManage/findPlanByAssembly",
                type: "POST",
                data: {
                    planType: value
                },
                success: function (result) {
                    let planNameSelect = $(".planName");
                    planNameSelect.empty();
                    var length = result.length;
                    var planNameHtml = "<option value=''>请选择</option>";
                    for (var i = 0; i < length; i++) {
                        planNameHtml += "<option value='" + result[i].columns.id+"'>" + result[i].columns.name + "</option>";
                    }
                    planNameSelect.append(planNameHtml);
                    form.render('select');
                }
            });
        });

        form.on('select(spec)', function (data) {
            const num = $(this).closest('tr').find('td').eq(3).find('input').val();
            var value = $(data.elem).find("option:selected").text();
            const capacity = parseInt(value) * parseInt(num);
            $('#postDesignCapacity').text(isNaN(capacity) ? "-" : capacity);
        });

    });

    function filename(filePath) {
        if (!filePath) {
            return '';
        }
        let index = filePath.lastIndexOf("/");
        if (index !== -1) {
            return filePath.substring(index+1);
        }
        return filePath;
    }

    function addImg(data, classimg, count) {
        let icons = $('#postDzImgsDiv').find('.imgSpan').size();
        const uploader = $('#dzImgsUploader');
        if(icons+1>=count){
            uploader.hide();
        }
        var html = '<div class="bj-img imgSpan"><span class="layui-icon-close layui-icon" onclick="deleteIcon(this)"></span>';
        html += '<img src="${commonStaticImgPath}' + data + '" height="700" width="1200"/>';
        html += '<input type="hidden" class="' + classimg + '" value="' + data + '"/> </div>';
        $(html).insertBefore(uploader);
        //图片查看效果
        viewer.update();
    }


    function deleteIcon(r) {
        const uploader = $('#dzImgsUploader');
        $(r).closest('.imgSpan').remove();
        let icons = $('#postDzImgsDiv').find('.imgSpan').size();
        if (icons >= 4) {
            uploader.hide();
        } else {
            uploader.show();
        }
    }

    function closeSelf() {
        var index = parent.layer.getFrameIndex(window.name);
        parent.layer.close(index);//关闭当前页
        parent.parent.layer.closeAll();
    }

    <c:if test="${(fns:checkPagePermission(request, 'DZBG_SJBG_DSH_AUDIT_B') eq '0') && fromAudit eq '1' }">


    let tempReq = false;
    function temp() {
        if (auditing) {
            return;
        }
        var remark = $("input[name='auditRemarks']").val();
        if (isBlank(remark)) {
            layer.msg("请输入审核备注！",{icon:"2"});
            return;
        }
        auditing = true;
        var index= layer.load(2, {shade: [0.5,'#fff'], content:''});
        $.ajax({
            url: "${ctx}/entryChanges/designInfo/tempDesignChange",
            type: "POST",
            contentType : "application/json;charsetset=UTF-8",
            data: JSON.stringify({
                changeId: '${id}',
                msg: remark
            }),
            success: function (data) {
                if (data.code === "200") {
                    top.layer.msg("暂存成功，请处理下一条数据!");
                } else {
                    auditing = false;
                    layer.msg(data.errMsg);
                }
            },
            error: function () {
                layer.msg('系统忙，请稍后再试')
                auditing = false;
            }
            ,complete: function () {
                layer.close(index);
            }
        });
    }

    function pass() {
        audit("1");
    }

    function reject() {
        audit("2");
    }

    let auditing = false;
    function audit(auditResult) {
        if (auditing) {
            return;
        }
        var remark = $("input[name='auditRemarks']").val();
        if (auditResult != '1' && isBlank(remark)) {
            layer.msg("请输入审核备注！",{icon:"2"});
            return;
        }
        auditing = true;
        var index= layer.load(2, {shade: [0.5,'#fff'], content:''});
        $.ajax({
            url: "${ctx}/entryChanges/designInfo/auditDesignChangeHR",
            type: "POST",
            contentType : "application/json;charsetset=UTF-8",
            data: JSON.stringify({
                changeId: '${id}',
                value: auditResult,
                msg: remark
            }),
            success: function (data) {
                if (data.code === "200") {
                    top.layer.msg("操作成功");
                    parent.searchOrder();
                    closeSelf();
                } else {
                    auditing = false;
                    layer.msg(data.errMsg);
                }
            },
            error: function () {
                layer.msg('系统忙，请稍后再试')
                auditing = false;
            }
            ,complete: function () {
                layer.close(index);
            }
        });
    }
    </c:if>

    function isBlank(val) {
        if (val == null || val == '' || val == undefined) {
            return true;
        }
        return false;
    }
    function resetSort(){
        var sort = 1;
        $("#contentBody").find("tr").each(function (index) {
            if (!$(this).hasClass("hide")) {
                $(this).find("td:first").text(sort);
                sort++;
            }
        });
    }
    function previewUrl(_url) {
        if (!checkUrl(_url)) {
            return false;
        }
        var base = new Base64();
        var b64Encoded = base.encode(_url);
        if(_url.endsWith('pdf')){
            window.open('http://47.98.203.224:8012/onlinePreview?url=' + encodeURIComponent(b64Encoded)+'&officePreviewType=pdf');
        }else{
            window.open('http://47.98.203.224:8012/onlinePreview?url=' + encodeURIComponent(b64Encoded));
        }
    }

    function checkUrl(url) {
        //url= 协议://(ftp的登录信息)[IP|域名](:端口号)(/或?请求参数)
        var strRegex = '^((https|http|ftp)://)'//(https或http或ftp)
            + '(([\\w_!~*\'()\\.&=+$%-]+: )?[\\w_!~*\'()\\.&=+$%-]+@)?' //ftp的user@  可有可无
            + '(([0-9]{1,3}\\.){3}[0-9]{1,3}' // IP形式的URL- 3位数字.3位数字.3位数字.3位数字
            + '|' // 允许IP和DOMAIN（域名）
            + '(localhost)|'	//匹配localhost
            + '([\\w_!~*\'()-]+\\.)*' // 域名- 至少一个[英文或数字_!~*\'()-]加上.
            + '\\w+\\.' // 一级域名 -英文或数字  加上.
            + '[a-zA-Z]{1,6})' // 顶级域名- 1-6位英文
            + '(:[0-9]{1,5})?' // 端口- :80 ,1-5位数字
            + '((/?)|' // url无参数结尾 - 斜杆或这没有
            + '(/[\\w_!~*\'()\\.;?:@&=+$,%#-]+)+/?)$';//请求参数结尾- 英文或数字和[]内的各种字符
        var re = new RegExp(strRegex, 'i');//i不区分大小写
        //将url做uri转码后再匹配，解除请求参数中的中文和空字符影响
        if (re.test(encodeURI(url))) {
            return (true);
        } else {
            return (false);
        }
    }
    function approvalRecord(){
        var entryId = "${entry.id}";
        layer.open({
            title: '审批记录',
            type: 2,
            area: ['35%', '100%'],
            offset: 'rt',
            content: '${ctx}/customerEntry/approvalRecordPage?entryId='+entryId
        })
    }
</script>
</body>
</html>
