<%@ 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/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/dist/viewer.css" media="all">
    <link rel="stylesheet" href="${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/style/admin.css" media="all">
    <link rel="stylesheet" type="text/css" href="${ctxPlugin}/static/css/reset.css" />
    <style>
        *{
            padding: 0;
            margin: 0;
        }
        table{
            text-align: left;
        }
        .tableHeader{
            height: 38px;
            /*line-height: 38px;*/
            background-color: #d2b790 !important; color: #FFF;
        }
        .title{
            font-weight: bold;
            font-size: 14px;
            line-height: 30px;
            text-align: left;
        }
        td{
            padding: 0 5px;
        }
        .add{
            width: 60px;
            height: 60px;
            bordeR:1px solid #dddddd;
            position: relative;
            /*float: left;*/
            margin: 5px auto;
        }
        .add span{
            position: absolute;
            left: 0;top: 0;
            z-index: 0;
            width: 100%;
            height: 100%;
            font-size: 20px;
            text-align: center;
            line-height: 60px;
            font-weight: normal;
        }
        .add input{
            width: 100%;
            height: 100%;
            opacity: 0;
            position: absolute;
            z-index:10;
            left: 0;
            top: 0;
        }
        .bj-img > span {
            position: absolute;
            right: 0;
            top: 0;
            background-color: #f00;
            width: 20px;
            height: 20px;
            line-height: 20px;
            text-align: center;
            color: #fff;
            cursor: pointer;
            display: none;
        }
        .bj-img:hover span {
            display: block;
        }
        .img{
            overflow: hidden;
            padding: 5px 0;
            display: flex;
            justify-content: center;
        }
        .img>ul{
            float: left;
            list-style: none;
        }
        .img li{
            width: 60px;
            height: 60px;
            bordeR:1px solid #dddddd;
            position: relative;
            float: left;
            margin-right: 10px;
        }
        .img li img{
            object-fit: scale-down;
            width: 100%;
            height: 100%;
        }
        .img+span{
            line-height: 30px;
            font-size: 12px;
            color: red;
        }
        .pd-20{
            padding: 20px;
        }
        .form-title{
            line-height: 40px;
            font-weight: bold;
        }
        .form-input{
            width: 100%;
            padding: 5px 0;
            border: none;
            outline: none;
        }
        .red{
            color: red;
        }
        .unit{
            position: absolute;
            right: 30px;
            top: 8px;
            font-weight: bold;
        }
        .pos-r{
            position: relative;
        }

        .no-resize{
            resize: none;
        }
        .flex{
            display: flex;
        }
        .text-r{
            text-align: right;
        }
        .m-10{
            margin: 10px;
        }
        .operate-footer {
            width: 100%;
            position: fixed;
            bottom: 0;
            z-index: 30000;
            background: #F8F8F8;
            padding: 10px 0;
            text-align: center;
        }
        .footer-btn {
            height: 27px;
            line-height: 27px;
            padding: 0 18px;
            border-radius: 2px;
            font-size: 14px;
            cursor: pointer;
            border: 1px solid #C9C9C9;
            background-color: #fff;
            outline: none;
        }
        .pb-50{
            padding-bottom: 50px;
        }
        .pd-10{
            padding: 10px;
        }
        .normal-btn{
            border: 1px solid #D9B589;
            background-color: #D9B589 !important;
            color: #fff;
        }
        .layui-layer-btn0{
            border-color:#D9B589 !important;
            background-color: #D9B589 !important;
        }
        .idea-text{
            width: 320px; height: 100px;outline: none; padding: 3px
        }
        .hide{
            display: none;
        }
        .f-l{
            float: left;
        }
        .title1 {
            /*border-left: 4px solid #D9B589;*/
            padding-left: 10px;
            font-size: 14px;
            margin: 10px auto 0 auto;
            font-weight: 600;
            height: 42px;
            line-height: 42px;
            background-color: #848484;
            color: #FFF;
        }
        .mark {
            color: #ff0000;
            line-height: 15px;
            width: 8px;
            display: inline-block;
            text-align: left;
        }
        .report-table{background: #fff}
        .report-table td{border: 1px solid #dddddd; padding: 5px 10px}
        .report-table tr:nth-child(even) {
            background-color: #f7f7f7;
        }
        .report-table tr:nth-child(odd) {
            background-color: #ffffff;
        }
        .blank-img {
            background: url('${ctxPlugin}/static/imgs/blankImg.png') center center no-repeat;
            width: 62px;
            height: 62px;
            display: inline-block;
        }
        .pointer {
            cursor: pointer;
        }
    </style>
</head>
<body>

<div class="layui-fluid pd-20"  id="LAY_app" style="padding-bottom: 70px;">
    <table border cellpadding="0" cellspacing="0" width="100%" class="report-table">

        <tr class="tableHeader">
            <td colspan="8">项目信息</td>
        </tr>

        <tr>
            <td width="25%" colspan="2">电站编号</td>
            <td width="25%" colspan="2"><input type="text" class="form-input" value="${entry.powerStationCode}"
                                               disabled/></td>
            <td width="25%" colspan="2">产品名称</td>
            <td width="25%" colspan="2"><input type="text" class="form-input" disabled value="${entry.projectName}"/></td>
        </tr>
        <tr>
            <td colspan="2">代理商</td>
            <td colspan="2"><input type="text" class="form-input" disabled value="${trader.name}"/></td>
            <td colspan="2">项目公司</td>
            <td colspan="2"><input type="text" class="form-input" disabled value="${entry.projectCompanyName}"/></td>
        </tr>
            <tr>
                <td colspan="2">电站状态</td>
                <td colspan="2"><input type="text" class="form-input" disabled value="${entryStatus}"/></td>
                <td colspan="2">备案类型</td>
                <td colspan="2"><input type="text" class="form-input" disabled value="${entryFilingType}"/></td>
            </tr>
            <tr>
                <td colspan="2">业务员</td>
                <td colspan="2"><input type="text" class="form-input" disabled value="${entry.creator}"/></td>
                <td colspan="4"></td>
            </tr>
            <tr>
                <td colspan="2">创建时间</td>
                <td colspan="6"><input type="text" class="form-input" disabled value="<fmt:formatDate value="${entry.createTime}" pattern="yyyy-MM-dd HH:mm:ss"/>"/></td>
            </tr>

        <tr class="tableHeader">
            <td colspan="8">并网信息</td>
        </tr>
        <!-- 并网机构 -->
        <c:if test="${info4.columns.grid_institution.status eq '1'}">
        <td colspan="1">
            <c:if test="${info4.columns.grid_institution.mustFillFlag eq '1'}"><i class="mark">*</i></c:if>并网机构
        </td>
        <td colspan="1">
            <div class="layui-form">
                <div class="layui-input-block" style="margin-left: 0">
                    <select name="bwInstitution" id="bwInstitution" lay-filter="bwInstitution" <c:if test="${entry.ifStateGridStatus eq '1' || entry.ifStateGridStatus eq '2'}">disabled</c:if>>
                        <option value="">请选择</option>
                        <option value="0" <c:if test="${entry.gridInstitution eq '0'}">selected</c:if>>国网</option>
                        <option value="1" <c:if test="${entry.gridInstitution eq '1'}">selected</c:if>>南网</option>
                    </select>
                </div>
                <input type="hidden" id="gridInstitution" value="${entry.gridInstitution}">
            </div>
        </td>
        </c:if>
        <!-- 动态内容区块 -->
        <c:if test="${info4.columns.power_plant_code.status eq '1'}">
        <td colspan="1" class="nwInstitution <c:if test="${entry.gridInstitution ne '1'}">layui-hide</c:if>">
            <c:if test="${info4.columns.power_plant_code.mustFillFlag eq '1'}"><i class="mark">*</i></c:if>电厂编码
        </td>
        <td colspan="1" class="nwInstitution <c:if test="${entry.gridInstitution ne '1'}">layui-hide</c:if> ">
            <input type="text" class="layui-input" id="powerPlantCode" ${opt eq 'merge' ? '' : 'readonly'}
                   name="powerPlantCode" value="${entry.powerPlantCode}" />
        </td>
        </c:if>
        <c:if test="${info4.columns.province_code_hand.status eq '1'}">
            <td colspan="1" class="nwInstitution <c:if test="${entry.gridInstitution ne '1'}">layui-hide</c:if>">
                <c:if test="${info4.columns.province_code_hand.mustFillFlag eq '1'}"><i class="mark">*</i></c:if>电力公司
            </td>
            <td colspan="1" class="nwInstitution <c:if test="${entry.gridInstitution ne '1'}">layui-hide</c:if> ">
                <input type="text" class="layui-input" id="provinceCodeHand" ${opt eq 'merge' ? '' : 'readonly'}
                       name="provinceCodeHand" value="${entry.provinceCodeHand}" />
            </td>
        </c:if>
        <tr>
            <td colspan="2"><i class="mark">*</i>发电户号</td>
            <td colspan="2"><input type="text" class="layui-input" id="generatorNo" ${opt eq 'merge'? '': 'readonly'}
                                   name="generatorNo" value="${entry.generatorNo}"  <c:if test="${entry.ifStateGridStatus eq '1' || entry.ifStateGridStatus eq '2'}">readonly</c:if>/></td>
            <c:if test="${info4.columns.province_code.status eq '1'}">
            <td colspan="2" class="gwInstitution <c:if test="${entry.gridInstitution ne '0'}">layui-hide</c:if>"><i class="mark">*</i>电力公司</td>
            <td colspan="2" class="gwInstitution <c:if test="${entry.gridInstitution ne '0'}">layui-hide</c:if>">
                <div class="layui-form">
                    <div class="layui-input-block" style="margin-left: 0">
                        <select name="provinceCode" id="provinceCode" lay-search ${opt eq 'merge'? '': 'disabled'} <c:if test="${entry.ifStateGridStatus eq '1' || entry.ifStateGridStatus eq '2'}">disabled</c:if>>
                            <option value="">请选择省</option>
                            <c:choose>
                                <c:when test="${empty entry.provinceCode}">
                                    <c:forEach items="${procodes}" var="code">
                                        <option value="${code.columns.code}"
                                                <c:if test="${entry.province eq code.columns.name}">selected</c:if>
                                        >${code.columns.power_company}</option>
                                    </c:forEach>
                                </c:when>
                                <c:otherwise>
                                    <c:forEach items="${procodes}" var="code">
                                        <option value="${code.columns.code}"
                                                <c:if test="${entry.provinceCode eq code.columns.code}">selected</c:if>
                                        >${code.columns.power_company}</option>
                                    </c:forEach>
                                </c:otherwise>
                            </c:choose>

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

            </td>
        </tr>
        <c:if test="${info4.columns.address_consistent.status eq '1'}">
            <c:if test="${opt eq 'merge'}">
                <tr>
                    <td colspan="2"><i class="mark">*</i>购售电地址是否一致</td>
                    <td colspan="2">
                        <div class="layui-form">
                            <div class="layui-input-block" style="margin-left: 0">
                                <select name="addressConsistent" id="addressConsistent" lay-filter="addressConsistent">
                                    <option value="">请选择</option>
                                    <option value="Y" <c:if test="${entry.addressConsistent eq 'Y'}">selected</c:if> >是</option>
                                    <option value="N" <c:if test="${entry.addressConsistent eq 'N'}">selected</c:if> >否</option>
                                </select>
                            </div>
                        </div>
                    </td>
                    <td colspan="4">
                </tr>
            </c:if>
            <tr <c:if test="${empty entry.addressConsistent or entry.addressConsistent eq 'Y'}">style="display: none;"</c:if> id="addressInputs">
                <td width="25%" colspan="2"><i class="mark addressDiv">*</i>购售电地址</td>
                <td width="75%" colspan="6">
                        <%--
                        <input type="text" class="form-input" disabled id="addressInput"
                               <c:if test="${entry.addressConsistent eq 'N' && opt eq 'merge'}">style="display: none"</c:if>
                               value="${entry.province}${entry.city}${entry.area}${entry.address}"/>
                        --%>
                    <c:if test="${opt eq 'merge'}">
                        <div class="layui-form addressDiv" <c:if test="${entry.addressConsistent ne 'N'}">style="display: none"</c:if> >
                            <div class="layui-input-block" style="margin-left: 0">
                                <div class="layui-col-sm2 pr-10" style="width: 22%">
                                    <select name="province" id="province" lay-filter="province" lay-search>
                                        <option value="">请选择省</option>
                                        <c:forEach items="${pros}" var="pro">
                                            <option value="${pro.columns.ProvinceName}"
                                                    title="${pro.columns.ProvinceID }"
                                                    <c:if test="${entry.electricProvince eq pro.columns.ProvinceName}">selected</c:if>>${pro.columns.ProvinceName}</option>
                                        </c:forEach>
                                    </select>
                                </div>
                                <div class="layui-col-sm2 pr-10" style="width: 22%">
                                    <select name="city" id="city" lay-filter="city" lay-search>
                                        <option value="">请选择市</option>
                                        <c:forEach items="${faccitys}" var="city">
                                            <option value="${city.columns.CityName}"
                                                    <c:if test="${entry.electricCity eq city.columns.CityName}">selected</c:if>
                                                    title="${city.columns.CityID}">${city.columns.CityName}</option>
                                        </c:forEach>
                                    </select>
                                </div>
                                <div class="layui-col-sm2 pr-10" style="width: 22%">
                                    <select name="area" id="area" lay-search>
                                        <option value="">请选择县/区</option>
                                        <c:forEach items="${areas}" var="area">
                                            <option value="${area.columns.DistrictName}"
                                                    <c:if test="${entry.electricArea eq area.columns.DistrictName}">selected</c:if>
                                                    title="${area.columns.DistrictID}">${area.columns.DistrictName}</option>
                                        </c:forEach>
                                    </select>
                                </div>

                                <div class="layui-col-sm4">
                                    <input type="text" name="address" id="address" placeholder=""
                                           autocomplete="off" class="layui-input layui-col-lg2 "
                                           value="${entry.electricAddress}">
                                </div>
                            </div>
                        </div>

                    </c:if>
                </td>
            </tr>
        </c:if>
        <c:if test="${entry.partnerId ne '01'}">
        <tr>
            <td colspan="2"><i class="mark">*</i>购售电合同</td>
            <td colspan="4" id="xsdTD">
            <c:if test="${opt eq 'merge'}">
                <div class="layui-input-block pos-r" style="display: flex;align-items: center;margin-left: 0;">
                    <span class="h-32 lh-32 layui-span-unit" style="color:#2890ac;">文件上传</span>
                    <input type="file" id="uploadFile" style="position: absolute; z-index: 3; opacity: 0; left: 0; width: 44px;"/>
                    <input type="hidden" id="contractFile" value="${entry.contract}"/>
                    <span id="contractFilename">${entry.contractFilename}</span>
                </div>
            </c:if>
                <c:if test="${opt eq 'TwoMergeAccept'}">
                    <div class="layui-input-block pos-r view-attachment">
                        <a class="h-32 lh-32 layui-span-unit lookBtn" target="_blank" href="${commonStaticImgPath}${entry.contract}" style="color: #2890ac;">${entry.contractFilename}</a>
                    </div>

                </c:if>
            </td>
        </tr>
        </c:if>
        <c:if test="${entry.partnerId eq '01'}">
            <tr>
                <td colspan="2"><i class="mark">*</i>购售电合同</td>
                <td colspan="4" id="xsdTD1">
                    <c:if test="${opt eq 'merge'}">
                        <div id="filesDiv">
                            <div  id="filesUploader">
                                <span style="color:blue;cursor: pointer" id="safetyFiles"><i class="mark">*</i>文件上传</span>
                            </div>
                            <c:if test="${not empty entry.contract}">
                                <c:forEach items="${entry.contract}" var="file"
                                           varStatus="vs">
                                    <div style="margin-top: 5px">
                                                        <span style="color: red"
                                                              class="layui-icon-close layui-icon"
                                                              onclick="delImgs(this,'filesUploader')"></span>
                                        <a style="color:#2890ac;" target="_blank"
                                           onclick="previewUrl('${commonStaticImgPath}${file}')"
                                           class="download-link">${fns:substringAfterLast(file, '/')}</a>
                                        <input type="hidden" class="contractFiles"
                                               value="${file}">
                                    </div>
                                </c:forEach>
                            </c:if>
                        </div>
                    </c:if>
                    <c:if test="${opt eq 'TwoMergeAccept'}">
                        <c:if test="${not empty entry.contractVideoUrl}">
                            <c:forEach items="${entry.contractVideoUrl}" var="file" varStatus="vs">
                                <div class="layui-input-block pos-r view-attachment">
                                    <a class="h-32 lh-32 layui-span-unit lookBtn" target="_blank" href="${commonStaticImgPath}${entry.contract}" style="color: #2890ac;">${entry.contractFilename}</a>
                                </div>
                            </c:forEach>
                        </c:if>
                    </c:if>
                </td>
            <c:if test="${info4.columns.contract_video_url.status eq '1'}">
                <td colspan="1" id="xsdTD2">
                    <c:if test="${opt eq 'merge'}">
                        <span id="filesVideoUploader" style="color:blue;cursor: pointer" id="videoFiles" class="<c:if test="${videoCount >= 5}">layui-hide</c:if>">视频上传</span>
                        <div id="filesVideoDiv">
                            <div>
                                <c:if test="${not empty entry.contractVideoUrl}">
                                    <c:forEach items="${entry.contractVideoUrl}" var="file" varStatus="vs">
                                        <div style="margin-top: 5px;float: left;" >
                                            <video controls src="${commonStaticImgPath}${file}" height="60px" width="65px"></video>
                                            <span style="color: red" class="layui-icon-close layui-icon" onclick="delImgs(this,'filesVideoUploader')"></span>
                                            <input type="hidden" class="contractVideoFiles" value="${file}">
                                        </div>
                                    </c:forEach>
                                </c:if>
                            </div>
                        </div>
                    </c:if>
                    <c:if test="${opt eq 'TwoMergeAccept'}">
                        <c:if test="${not empty entry.contractVideoUrl}">
                            <c:forEach items="${entry.contractVideoUrl}" var="file" varStatus="vs">
                            <div class="layui-input-block pos-r view-attachment">
                                <a class="h-32 lh-32 layui-span-unit lookBtn" target="_blank" href="${commonStaticImgPath}${entry.contractVideoUrl}" style="color: #2890ac;">${entry.contractVideoName}</a>
                            </div>
                            </c:forEach>
                        </c:if>
                    </c:if>
                </td>
            </c:if>
            </tr>
        </c:if>


        <c:if test="${info4.columns.yx_img.status eq '1'}">
        <tr>
            <td colspan="2" rowspan="2">电站并网照片</td>
            <td colspan="2"><i class="mark">*</i>近3天发电量</td>
            <td colspan="2">补充信息</td>
            <td colspan="2">补充信息2</td>
        </tr>
        <tr>
            <td colspan="2" id="yxImgTD">
                <c:if test="${opt eq 'merge'}">
                    <c:if test="${not empty report.yxImg}">
                        <ul class="img">
                            <li class="imgsLi bj-img ">
                                <span class="layui-icon-close layui-icon" onclick="delImg(this,1)"></span>
                                <img src="${commonStaticImgPaths}${report.yxImg}" alt="">
                                <input type="hidden" class="imgValues pointer" id="yxImg" value="${report.yxImg}">
                            </li>
                        </ul>
                        <div class="add layui-hide">
                            <span>+</span>
                            <input type="file" class="uploadFile pointer" max-num="1" accept="image/*">
                        </div>
                    </c:if>
                    <c:if test="${empty report.yxImg}">
                        <div class="add">
                            <span>+</span>
                            <input type="file" class="uploadFile pointer" max-num="1" accept="image/*">
                        </div>
                    </c:if>
                </c:if>
                <c:if test="${opt ne 'merge'}">
                    <ul class="img">
                        <li class="imgsLi bj-img ">
                            <img src="${commonStaticImgPaths}${report.yxImg}" alt="">
                        </li>
                    </ul>
                </c:if>
            </td>
            <td colspan="2" id="gebImgTD">
                <c:if test="${opt eq 'merge'}">
                    <c:if test="${not empty report.gebImg}">
                        <ul class="img">
                            <li class="imgsLi bj-img ">
                                <span class="layui-icon-close layui-icon" onclick="delImg(this,1)"></span>
                                <img src="${commonStaticImgPaths}${report.gebImg}" alt="">
                                <input type="hidden" class="imgValues" id="gebImg" value="${report.gebImg}">
                            </li>
                        </ul>
                        <div class="add layui-hide">
                            <span>+</span>
                            <input type="file" class="uploadFile pointer" max-num="1" accept="image/*">
                        </div>
                    </c:if>
                    <c:if test="${empty report.gebImg}">
                        <div class="add">
                            <span>+</span>
                            <input type="file" class="uploadFile pointer" max-num="1" accept="image/*">
                        </div>
                    </c:if>
                </c:if>
                <c:if test="${opt ne 'merge'}">
                    <ul class="img">
                        <li class="imgsLi bj-img ">
                            <c:if test="${not empty report.gebImg}">
                                <img src="${commonStaticImgPaths}${report.gebImg}" alt="">
                            </c:if>
                            <c:if test="${empty report.gebImg}">
                                <i class="blank-img"></i>
                            </c:if>
                        </li>
                    </ul>
                </c:if>
            </td>
            <td colspan="2" id="gebImg2TD">
                <c:if test="${opt eq 'merge'}">
                    <c:if test="${not empty report.gebImg2}">
                        <ul class="img">
                            <li class="imgsLi bj-img ">
                                <span class="layui-icon-close layui-icon" onclick="delImg(this,1)"></span>
                                <img src="${commonStaticImgPaths}${report.gebImg2}" alt="">
                                <input type="hidden" class="imgValues" id="gebImg2" value="${report.gebImg2}">
                            </li>
                        </ul>
                        <div class="add layui-hide">
                            <span>+</span>
                            <input type="file" class="uploadFile pointer" max-num="1" accept="image/*">
                        </div>
                    </c:if>
                    <c:if test="${empty report.gebImg2}">
                        <div class="add">
                            <span>+</span>
                            <input type="file" class="uploadFile pointer" max-num="1" accept="image/*">
                        </div>
                    </c:if>
                </c:if>
                <c:if test="${opt ne 'merge'}">
                    <ul class="img">
                        <li class="imgsLi bj-img ">
                            <c:if test="${not empty report.gebImg2}">
                                <img src="${commonStaticImgPaths}${report.gebImg2}" alt="">
                            </c:if>
                            <c:if test="${empty report.gebImg2}">
                                <i class="blank-img"></i>
                            </c:if>
                        </li>
                    </ul>
                </c:if>
            </td>
        </tr>
        </c:if>
        <c:if test="${info4.columns.power_capacity_url.status eq '1'}">
        <tr>
            <td colspan="2" rowspan="2">电站并网照片</td>
            <td colspan="2"><i class="mark">*</i>三天发电量截图</td>
            <td colspan="2">补充信息</td>
            <td colspan="2">补充信息2</td>
        </tr>
        <tr>
            <td colspan="2">
                <c:if test="${opt eq 'merge'}">
                    <c:if test="${not empty report.powerCapacityUrl}">
                        <ul class="img">
                            <li class="imgsLi bj-img ">
                                <span class="layui-icon-close layui-icon" onclick="delImg(this,1)"></span>
                                <img src="${commonStaticImgPaths}${report.powerCapacityUrl}" alt="">
                                <input type="hidden" class="imgValues" id="powerCapacityUrl" value="${report.powerCapacityUrl}">
                            </li>
                        </ul>
                        <div class="add layui-hide">
                            <span>+</span>
                            <input type="file" class="uploadPowerCapacityUrl pointer" max-num="1" accept="image/*">
                        </div>
                    </c:if>
                    <c:if test="${empty report.powerCapacityUrl}">
                        <div class="add">
                            <span>+</span>
                            <input type="file" class="uploadPowerCapacityUrl pointer" max-num="1" accept="image/*">
                        </div>
                    </c:if>
                </c:if>
                <c:if test="${opt ne 'merge'}">
                    <ul class="img">
                        <li class="imgsLi bj-img ">
                            <c:if test="${not empty report.powerCapacityUrl}">
                                <img src="${commonStaticImgPaths}${report.powerCapacityUrl}" alt="">
                            </c:if>
                            <c:if test="${empty report.powerCapacityUrl}">
                                <i class="blank-img"></i>
                            </c:if>
                        </li>
                    </ul>
                </c:if>
            </td>
            <td colspan="2" id="gebImgTD">
                <c:if test="${opt eq 'merge'}">
                    <c:if test="${not empty report.gebImg}">
                        <ul class="img">
                            <li class="imgsLi bj-img ">
                                <span class="layui-icon-close layui-icon" onclick="delImg(this,1)"></span>
                                <img src="${commonStaticImgPaths}${report.gebImg}" alt="">
                                <input type="hidden" class="imgValues" id="gebImg" value="${report.gebImg}">
                            </li>
                        </ul>
                        <div class="add layui-hide">
                            <span>+</span>
                            <input type="file" class="uploadFile pointer" max-num="1" accept="image/*">
                        </div>
                    </c:if>
                    <c:if test="${empty report.gebImg}">
                        <div class="add">
                            <span>+</span>
                            <input type="file" class="uploadFile pointer" max-num="1" accept="image/*">
                        </div>
                    </c:if>
                </c:if>
                <c:if test="${opt ne 'merge'}">
                    <ul class="img">
                        <li class="imgsLi bj-img ">
                            <c:if test="${not empty report.gebImg}">
                                <img src="${commonStaticImgPaths}${report.gebImg}" alt="">
                            </c:if>
                            <c:if test="${empty report.gebImg}">
                                <i class="blank-img"></i>
                            </c:if>
                        </li>
                    </ul>
                </c:if>
            </td>
            <td colspan="2" id="gebImg2TD">
                <c:if test="${opt eq 'merge'}">
                    <c:if test="${not empty report.gebImg2}">
                        <ul class="img">
                            <li class="imgsLi bj-img ">
                                <span class="layui-icon-close layui-icon" onclick="delImg(this,1)"></span>
                                <img src="${commonStaticImgPaths}${report.gebImg2}" alt="">
                                <input type="hidden" class="imgValues" id="gebImg2" value="${report.gebImg2}">
                            </li>
                        </ul>
                        <div class="add layui-hide">
                            <span>+</span>
                            <input type="file" class="uploadFile pointer" max-num="1" accept="image/*">
                        </div>
                    </c:if>
                    <c:if test="${empty report.gebImg2}">
                        <div class="add">
                            <span>+</span>
                            <input type="file" class="uploadFile pointer" max-num="1" accept="image/*">
                        </div>
                    </c:if>
                </c:if>
                <c:if test="${opt ne 'merge'}">
                    <ul class="img">
                        <li class="imgsLi bj-img ">
                            <c:if test="${not empty report.gebImg2}">
                                <img src="${commonStaticImgPaths}${report.gebImg2}" alt="">
                            </c:if>
                            <c:if test="${empty report.gebImg2}">
                                <i class="blank-img"></i>
                            </c:if>
                        </li>
                    </ul>
                </c:if>
            </td>
        </tr>
        </c:if>
        <tr>
            <td colspan="2"><i class="mark">*</i>电表照片</td>
            <td colspan="6">
                <c:if test="${opt eq 'merge'}">
                    <c:if test="${not empty report.dbImgs}">
                        <ul class="img">
                            <li class="imgsLi bj-img ">
                                <span class="layui-icon-close layui-icon" onclick="delImg(this,1)"></span>
                                <img src="${commonStaticImgPaths}${report.dbImgs}" alt="">
                                <input type="hidden" class="imgValues" id="dbImgs" value="${report.dbImgs}">
                            </li>
                        </ul>
                        <div class="add layui-hide">
                            <span>+</span>
                            <input type="file" class="uploadDbImgs pointer" max-num="1" accept="image/*">
                        </div>
                    </c:if>
                    <c:if test="${empty report.dbImgs}">
                        <div class="add">
                            <span>+</span>
                            <input type="file" class="uploadDbImgs pointer" max-num="1" accept="image/*">
                        </div>
                    </c:if>
                </c:if>
                <c:if test="${opt ne 'merge'}">
                    <ul class="img">
                        <li class="imgsLi bj-img ">
                            <c:if test="${not empty report.dbImgs}">
                                <img src="${commonStaticImgPaths}${report.dbImgs}" alt="">
                            </c:if>
                            <c:if test="${empty report.dbImgs}">
                                <i class="blank-img"></i>
                            </c:if>
                        </li>
                    </ul>
                </c:if>
            </td>
        </tr>
        <c:if test="${info4.columns.archives_img.status eq '1'}">
        <tr>
            <td colspan="2" class="nwInstitution <c:if test="${entry.gridInstitution ne '1'}">layui-hide</c:if>"><c:if test="${info4.columns.archives_img.mustFillFlag eq '1'}"><i class="mark">*</i></c:if>南网营销系统档案截图（三户）</td>
            <td colspan="6" class="nwInstitution <c:if test="${entry.gridInstitution ne '1'}">layui-hide</c:if>">
                <c:if test="${opt eq 'merge'}">
                    <c:if test="${not empty report.archivesImg}">
                        <ul class="img">
                            <li class="imgsLi bj-img ">
                                <span class="layui-icon-close layui-icon" onclick="delImg(this,1)"></span>
                                <img src="${commonStaticImgPaths}${report.archivesImg}" alt="">
                                <input type="hidden" class="imgValues" id="archivesImg" value="${report.archivesImg}">
                            </li>
                        </ul>
                        <div class="add layui-hide">
                            <span>+</span>
                            <input type="file" class="uploadArchivesImgs pointer" max-num="1" accept="image/*">
                        </div>
                    </c:if>
                    <c:if test="${empty report.archivesImg}">
                        <div class="add">
                            <span>+</span>
                            <input type="file" class="uploadArchivesImgs pointer" max-num="1" accept="image/*">
                        </div>
                    </c:if>
                </c:if>
                <c:if test="${opt ne 'merge'}">
                    <ul class="img">
                        <li class="imgsLi bj-img ">
                            <c:if test="${not empty report.archivesImg}">
                                <img src="${commonStaticImgPaths}${report.archivesImg}" alt="">
                            </c:if>
                            <c:if test="${empty report.archivesImg}">
                                <i class="blank-img"></i>
                            </c:if>
                        </li>
                    </ul>
                </c:if>
            </td>
        </tr>
        </c:if>
        <c:if test="${info4.columns.dbx_imgs.status eq '1'}">
            <tr>
                <td colspan="2"><c:if test="${info4.columns.dbx_imgs.mustFillFlag eq '1'}"><i class="mark">*</i></c:if>电表箱照片</td>
                <td colspan="6">
                    <c:if test="${opt eq 'merge'}">
                        <c:if test="${not empty report.dbxImgs}">
                            <ul class="img">
                                <li class="imgsLi bj-img ">
                                    <span class="layui-icon-close layui-icon" onclick="delImg(this,1)"></span>
                                    <img src="${commonStaticImgPaths}${report.dbxImgs}" alt="">
                                    <input type="hidden" class="imgValues" id="dbxImgs" value="${report.dbxImgs}">
                                </li>
                            </ul>
                            <div class="add layui-hide">
                                <span>+</span>
                                <input type="file" class="uploadDbxImgs pointer" max-num="1" accept="image/*">
                            </div>
                        </c:if>
                        <c:if test="${empty report.dbxImgs}">
                            <div class="add">
                                <span>+</span>
                                <input type="file" class="uploadDbxImgs pointer" max-num="1" accept="image/*">
                            </div>
                        </c:if>
                    </c:if>
                    <c:if test="${opt ne 'merge'}">
                        <ul class="img">
                            <li class="imgsLi bj-img ">
                                <c:if test="${not empty report.dbxImgs}">
                                    <img src="${commonStaticImgPaths}${report.dbxImgs}" alt="">
                                </c:if>
                                <c:if test="${empty report.dbxImgs}">
                                    <i class="blank-img"></i>
                                </c:if>
                            </li>
                        </ul>
                    </c:if>
                </td>
            </tr>
        </c:if>
        <c:if test="${info4.columns.tlzhjk_imgs.status eq '1'}">
            <tr>
                <td colspan="2"><c:if test="${info4.columns.tlzhjk_imgs.mustFillFlag eq '1'}"><i class="mark">*</i></c:if>铜铝转换接头照片</td>
                <td colspan="6">
                    <c:if test="${opt eq 'merge'}">
                        <c:if test="${not empty report.tlzhjkImgs}">
                            <ul class="img">
                                <li class="imgsLi bj-img ">
                                    <span class="layui-icon-close layui-icon" onclick="delImg(this,1)"></span>
                                    <img src="${commonStaticImgPaths}${report.tlzhjkImgs}" alt="">
                                    <input type="hidden" class="imgValues" id="tlzhjkImgs" value="${report.tlzhjkImgs}">
                                </li>
                            </ul>
                            <div class="add layui-hide">
                                <span>+</span>
                                <input type="file" class="uploadTlzhjkImgs pointer" max-num="1" accept="image/*">
                            </div>
                        </c:if>
                        <c:if test="${empty report.tlzhjkImgs}">
                            <div class="add">
                                <span>+</span>
                                <input type="file" class="uploadTlzhjkImgs pointer" max-num="1" accept="image/*">
                            </div>
                        </c:if>
                    </c:if>
                    <c:if test="${opt ne 'merge'}">
                        <ul class="img">
                            <li class="imgsLi bj-img ">
                                <c:if test="${not empty report.tlzhjkImgs}">
                                    <img src="${commonStaticImgPaths}${report.tlzhjkImgs}" alt="">
                                </c:if>
                                <c:if test="${empty report.tlzhjkImgs}">
                                    <i class="blank-img"></i>
                                </c:if>
                            </li>
                        </ul>
                    </c:if>
                </td>
            </tr>
        </c:if>
        <tr>
            <td colspan="2"><i class="mark">*</i>并网调试报告</td>
            <td colspan="6">
                <div class="layui-input-block pos-r" style="display: flex;align-items: center;margin-left: 0;">
                    <c:if test="${opt ne 'TwoMergeAccept'}">
                    <span class="h-32 lh-32 layui-span-unit" style="color:#2890ac;">上传</span>
                    <input type="file" id="uploadReport" style="position: absolute; z-index: 3; opacity: 0; left: 0; width: 44px;"/>
                    <input type="hidden" id="bwtsFile" name="bwtsFile" value="${insurance.bwtsFile}"/>
                    <div id="bwtsFileName" style="text-overflow: ellipsis;max-width: 130px;white-space: nowrap;overflow: hidden;">${insurance.bwtsFilename}</div>
                    </c:if>
                    <c:if test="${opt eq 'TwoMergeAccept'}">
                        <div class="layui-input-block pos-r view-attachment">
                            <a class="h-32 lh-32 layui-span-unit lookBtn" target="_blank" href="${commonStaticImgPath}${insurance.bwtsFile}" style="color: #2890ac;">${insurance.bwtsFilename}</a>
                        </div>
                    </c:if>

                </div>
            </td>
        </tr>
        <c:if test="${entry.partnerId eq '01'}">
            <c:if test="${info4.columns.other_attachment.status eq '1'}">
            <tr>
                <td colspan="2">资方审查补充资料</td>
                <td colspan="6" id="zfscbczl">
                    <c:if test="${opt eq 'merge'}">
                        <div id="otherFilesDiv">
                            <div  id="otherFilesUploader">
                                <span style="color:blue;cursor: pointer" id="otherAttachment">文件上传</span>
                            </div>
                            <div class="imgsDiv  otherAttaImg" style="width: 45%;float:left;">
                                <c:if test="${not empty entry.otherAttachment}">
                                    <c:forEach items="${fn:split(entry.otherAttachment,',')}" var="img">
                                        <c:if test="${img.contains('jpg') || img.contains('jpeg') || img.contains('png')}">
                                            <div class="bj-img imgSpan" style="float:left;">
                                                <span class="layui-icon-close layui-icon" style="z-index: 1000" onclick="delImgs(this,'otherFilesUploader')"></span>
                                                <img src="${commonStaticImgPath}${img}" width="80px" height="80px">
                                                <input type="hidden" name="otherAttachment" class="otherAttachment" value="${img}"/>
                                            </div>
                                        </c:if>
                                        <c:if test="${img.contains('mp3') || img.contains('mp4')}">
                                            <div class="bj-img imgSpan" style="float:left;">
                                                <span class="layui-icon-close layui-icon" style="z-index: 1000" onclick="delImgs(this,'otherFilesUploader')"></span>
                                                <video controls src="${commonStaticImgPath}${img}" width="80px" height="80px"></video>
                                                <input type="hidden" name="otherAttachment" class="otherAttachment" value="${img}"/>
                                            </div>
                                        </c:if>
                                    </c:forEach>
                                </c:if>
                            </div>
                        </div>
                        <c:if test="${not empty entry.otherAttachment}">
                        <div class="otherAtta" style="float:left;">
                                <c:forEach items="${fn:split(entry.otherAttachment,',')}" var="img">
                                    <c:if test="${!img.contains('jpg') && !img.contains('jpeg') && !img.contains('mp3') && !img.contains('mp4')&& !img.contains('png')}">
                                        <div class="layui-input-block pos-r" style="display: flex;align-items: center;">
                                            <span class="layui-icon-close layui-icon" onclick="delImgs(this,'otherFilesUploader')"></span>
                                            <a style="color:#2890ac;cursor: pointer;" target="_blank"
                                               onclick="previewUrl('${commonStaticImgPath}${img}')"
                                               class="download-link">${fn:substring(img,img.lastIndexOf("/")+1 ,img.length() )}</a>
                                            <input type="hidden" name="otherAttachment" class="otherAttachment" value="${img}"/>
                                        </div>
                                    </c:if>
                                </c:forEach>
                            </div>
                        </c:if>
                    </c:if>
                    <c:if test="${opt eq 'TwoMergeAccept'}">
                        <c:if test="${not empty entry.otherAttachment}">
                            <c:forEach items="${entry.otherAttachment}" var="file" varStatus="vs">
                                <div class="layui-input-block pos-r view-attachment">
                                    <a class="h-32 lh-32 layui-span-unit lookBtn" target="_blank" href="${commonStaticImgPath}${entry.otherAttachment}" style="color: #2890ac;">${entry.otherAttachment}</a>
                                </div>
                            </c:forEach>
                        </c:if>
                    </c:if>
                </td>
            </tr>
            </c:if>
        </c:if>
    </table>

</div>
<c:if test="${opt eq 'view'}">
    <div class="operate-footer">
        <button class="layui-btn layui-btn-primary" onclick="closeSelf();">取消</button>
    </div>
</c:if>
<c:if test="${opt eq 'fixAccept'}">
    <!-- 安装验收 -->
    <div class="operate-footer">
        <button class="footer-btn normal-btn TwoAcceptPassBtn">同意</button>
        <button class="footer-btn normal-btn fixAcceptRefuseBtn">驳回</button>
        <button class="footer-btn" onclick="closeSelf();">取消</button>
    </div>
</c:if>
<c:if test="${opt eq 'merge'}">
    <!-- 并网 -->
    <div class="operate-footer">
        <button class="footer-btn normal-btn mergeTmpBtn">暂存</button>
        <button class="footer-btn normal-btn  gwInstitution mergeBtn layui-hide">提交国网授权</button>
        <button class="footer-btn normal-btn mergeSubmitBtn">提交</button>
        <button class="footer-btn" onclick="closeSelf();">取消</button>
    </div>
</c:if>
<c:if test="${opt eq 'TwoMergeAccept'}">
    <!-- 并网验收审核 -->
    <div class="operate-footer">
        <button class="footer-btn normal-btn TwomergeAcceptPassBtn">同意</button>
        <button class="footer-btn normal-btn TwomergeAcceptRefuseBtn">驳回</button>
        <button class="footer-btn" onclick="closeSelf();">取消</button>
    </div>
</c:if>

<%--<script src="https://cdn.bootcss.com/html2canvas/0.5.0-beta4/html2canvas.min.js"></script>--%>
<script src="${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/layui/layui.js"></script>
<script src="${ctxPlugin}/lib/factory.js"></script>
<script src="${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/dist/viewer.js"></script>
<script>
    //图片查看效果
    var viewer = new Viewer(document.getElementById('LAY_app'));
    layui.config({
        base: '${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'tableExt', 'jquery', 'layer','laypage','laydate','form','upload'], function(){
        //layui.use(['table','layer','laypage','laydate','form'], function(){
        $ = layui.$;
        tableExt = layui.tableExt;
        layer = layui.layer;
        laypage = layui.laypage;
        laydate = layui.laydate;
        form = layui.form;
        table = tableExt.getLayTable();
        var upload = layui.upload;


        let imgCount = $("#filesVideoDiv").find(".contractVideoFiles").length;
        if ((imgCount + 1) >= 5) {
            $("#filesVideoUploader").hide();
        }

        let imgCounts = $("#filesDiv").find(".contractFiles").length;
        if ((imgCounts + 1) >= 5) {
            $("#filesUploader").hide();
        }

        let imgOtherCounts = $("#otherFilesDiv").find(".otherAttachment").length;
        if ((imgOtherCounts + 1) >= 10) {
            $("#otherFilesUploader").hide();
        }

        var gridInstitution = $("#gridInstitution").val();
        if(!isBlank(gridInstitution)){
            if(gridInstitution === "0"){
                if('${entryFilingType}'=="农户备案") {
                    $('.gwInstitution').removeClass('layui-hide');
                }else{
                    $('.nwInstitution').addClass('layui-hide');
                }
            }else if(gridInstitution === 1){
                $('.nwInstitution').removeClass('layui-hide');
                $('.gwInstitution').addClass('layui-hide');
            }
        }
        <%--if('${entryFilingType}'=="农户备案") {--%>
        <%--    $('.gwInstitution').removeClass('layui-hide');--%>
        <%--}--%>
        form.on('select(bwInstitution)', function (data) {
            if (data.elem.value == 0) {
                if('${entryFilingType}'=="农户备案") {
                    $('.gwInstitution').removeClass('layui-hide');
                }
                    $('.nwInstitution').addClass('layui-hide');
            } else if (data.elem.value == 1) {
                $('.nwInstitution').removeClass('layui-hide');
                $('.gwInstitution').addClass('layui-hide');
            }
        });

        upload.render({
            elem: '#filesUploader',
            url: '${ctx}/common/uploadFile3',
            accept: 'file',
            exts: 'jpg|png|gif|doc|docx|ppt|pdf|xls|xlsx|txt|mp3|mov|rmvb|rm|flv|3gp|apk',
            before: function (obj) {
                //预读本地文件示例，不支持ie8
                obj.preview(function (index, file, result) {
                });
            },
            done: function (res) {
                //上传完毕回调
                let path = res.path;
                let index = path.lastIndexOf('/');
                let name = path.substring(index + 1);
                let imgCount = $("#filesDiv").find(".contractFiles").length;
                if ((imgCount + 1) >= 5) {
                    $("#filesUploader").hide();
                }
                let html = '<div style="margin-top: 5px"><span style="color:red;" class="layui-icon-close layui-icon" onclick="delImgs(this,\'filesUploader\')"></span>';
                html += '<a style="color:#2890ac;" target="_blank"  onclick="previewUrl(' + "\'" + '${commonStaticImgPath}' + path + "\'" + ')"    class="download-link">' + name + '</a>';
                html += '<input type="hidden" class="contractFiles" value="' + path + '"/> </div>';
                html += '<input type="hidden" class="contractFilesName" value="' + name + '"/> </div>';
                $("#filesDiv").append(html);
            },
            error: function () {
                //请求异常回调
            }
        });

        upload.render({
            elem: '#otherFilesUploader',
            url: '${ctx}/common/uploadFile3',
            accept: 'file',
            exts: 'jpg|png|gif|doc|docx|ppt|pdf|xls|xlsx|txt|mp3|mov|rmvb|rm|flv|3gp|apk|mp4',
            before: function (obj) {
                //预读本地文件示例，不支持ie8
                obj.preview(function (index, file, result) {
                });
            },
            done: function (res) {
                //上传完毕回调
                let path = res.path;
                let extName=res.filename;
                let index = path.lastIndexOf('/');
                let name = path.substring(index + 1);
                var len=$('#zfscbczl').find("input[name='otherAttachment']").length;
                if(len+1>=10){
                    $("#otherFilesUploader").hide();
                }
                var ht='';
                if(extName.indexOf("jpg")>0 || extName.indexOf("jpeg")>0){  //图片
                    ht+='<div class="bj-img imgSpan" style="float:left;">';
                    ht+=' <span class="layui-icon-close layui-icon" style="z-index: 1000" onclick="delMoreImg(this)"></span>';
                    ht += '<img src="${commonStaticImgPath}' + path + '" height="80px" width="80px">';
                    ht += '<input type="hidden" name="otherAttachment" class="otherAttachment" value="' + path + '"/>';
                    ht+=' </div>';
                    $(".otherAttaImg").append(ht);
                }else if(extName.indexOf("mp3")>0 || extName.indexOf("mp4")>0){  //视频
                    ht += '<div class="bj-img imgSpan" style="float:left;">';
                    ht+=' <span class="layui-icon-close layui-icon" style="z-index: 1000" onclick="delMoreImg(this)"></span>';
                    ht+=' <video controls src="${commonStaticImgPath}'+path+'" height="80px" width="80px"></video>';
                    ht += '<input type="hidden" name="otherAttachment" class="otherAttachment" value="' + path + '">';
                    ht += '</div>';
                    $(".otherAttaImg").append(ht);
                }else{
                    ht +='<div class="layui-input-block pos-r" style="display: flex;align-items: center;">';
                    ht +='<span style="color: red" class="layui-icon-close layui-icon" onclick="delFile(this)"></span>';
                    ht+=`<a style="color:#2890ac;cursor: pointer;" target="_blank" onclick="previewUrl('${commonStaticImgPath}`+path+`')" class="download-link">`+name+`</a>`
                    ht+='<input type="hidden" name="otherAttachment" class="otherAttachment" value="'+path+'"/>';
                    ht +='</div>';
                    $(".otherAtta").append(ht);
                }
            },
            error: function () {
                //请求异常回调
            }
        });

        upload.render({
            elem: '#filesVideoUploader',
            url: '${ctx}/common/uploadFile3',
            accept: 'file',
            exts: 'mp4|avi',
            before: function (obj) {
                //预读本地文件示例，不支持ie8
                obj.preview(function (index, file, result) {
                });
            },
            done: function (res) {
                //上传完毕回调
                let path = res.path;
                let index = path.lastIndexOf('/');
                let name = path.substring(index + 1);
                let imgCount = $("#filesVideoDiv").find(".contractVideoFiles").length;
                if ((imgCount + 1) >= 5) {
                    $("#filesVideoUploader").hide();
                }
                let html = '<div style="margin-top: 5px;float: left;">';
                html += '<video controls src="${commonStaticImgPath}' + path+' " height="60px" width="65px"></video>';
                html += '<span style="color:red;" class="layui-icon-close layui-icon" onclick="delImgs(this,\'filesVideoUploader\')"></span>';
                html += '<input type="hidden" class="contractVideoFiles" value="' + path + '"/>';
                html += '<input type="hidden" class="contractVideoName" value="' + name + '"/> </div>';
                $("#filesVideoDiv").append(html);
            },
            error: function () {
                //请求异常回调
            }
        });


        upload.render({
            elem: '#uploader66',
            url: '${ctx}/common/uploadFile3',
            accept: 'file',
            before: function (obj) {

            },
            done: function (res) {
                //上传完毕回调
                let path = res.path;
                let index = path.lastIndexOf('/');
                let name = path.substring(index + 1);
                let imgCount = $("#xsdTD2").find(".contractVideoUrl").length;
                $("#uploader66").hide();
                let html = '<div><span style="color: red" class="layui-icon-close layui-icon" onclick="delImg(this,\'uploader66\')"></span>';
                html += '<a style="color:#2890ac;" href="${commonStaticImgPath}' + path + '" download="' + path + '" class="download-link">' + name + '</a>';
                html += '<input type="hidden" name="contractVideoUrl" class="contractVideoUrl" value="' + path + '"/> </div>';
                $("#xsdTD2").append(html);
            },
            error: function () {
                //请求异常回调
            }
        });

        $('#uploadFile').change(function () {

            var file = $(this)[0].files[0];
            if(isBlank(file)){
                return;
            }
            var formData = new FormData();
            formData.append("file", file);
            $.ajax({
                url: "${ctx}/common/uploadFile",
                type: 'POST',
                data: formData,
                processData: false,
                contentType: false,
                success: function (data) {
                    $("#contractFile").val(data.path);
                    $("#contractFilename").text(file.name);
                }
            });
        });


        $('#uploadReport').change(function () {
            var file = $(this)[0].files[0];
            if(isBlank(file)){
                return;
            }
            var formData = new FormData();
            formData.append("file", file);
            $.ajax({
                url: "${ctx}/common/uploadFile",
                type: 'POST',
                data: formData,
                processData: false,
                contentType: false,
                success: function (data) {
                    $("#bwtsFile").val(data.path);
                    $("#bwtsFileName").text(file.name);
                }
            });
        });

        $('#uploadBxd').change(function () {
            var file = $(this)[0].files[0];
            if(isBlank(file)){
                return;
            }
            var formData = new FormData();
            formData.append("file", file);
            $.ajax({
                url: "${ctx}/common/uploadFile",
                type: 'POST',
                data: formData,
                processData: false,
                contentType: false,
                success: function (data) {
                    $("#bxdFile").val(data.path);
                    $("#bxdFileName").text(file.name);
                }
            });
        });


            $('.uploadDbImgs').change(function(){
                var $this = $(this);
                var file = $(this)[0].files[0];
                if(isBlank(file)){
                    return;
                }
                var formData = new FormData();
                formData.append("file", file);
                $.ajax({
                    url: "${ctx}/common/uploadFile",
                    type: 'POST',
                    data: formData,
                    processData: false,
                    contentType: false,
                    success: function (data) {
                        var maxNum = $this.attr('max-num');
                        var html = '<ul class="img"> ' +
                            '         <li class="imgsLi bj-img ">' +
                            '           <span class="layui-icon-close layui-icon" onclick="delImg(this,'+maxNum+')"></span>'+
                            '            <img src="${commonStaticImgPaths}' + data.path + '" alt="">' +
                            '            <input type="hidden" class="imgValues" id="dbImgs" value="' + data.path + '">'+
                            '          </li>' +
                            '        </ul>';
                        $this.closest('.add').before(html);
                        $this.closest('.add').addClass('layui-hide');

                    }
                });
            });

        $('.uploadArchivesImgs').change(function(){
            var $this = $(this);
            var file = $(this)[0].files[0];
            if(isBlank(file)){
                return;
            }
            var formData = new FormData();
            formData.append("file", file);
            $.ajax({
                url: "${ctx}/common/uploadFile",
                type: 'POST',
                data: formData,
                processData: false,
                contentType: false,
                success: function (data) {
                    var maxNum = $this.attr('max-num');
                    var html = '<ul class="img"> ' +
                        '         <li class="imgsLi bj-img ">' +
                        '           <span class="layui-icon-close layui-icon" onclick="delImg(this,'+maxNum+')"></span>'+
                        '            <img src="${commonStaticImgPaths}' + data.path + '" alt="">' +
                        '            <input type="hidden" class="imgValues" id="archivesImg" value="' + data.path + '">'+
                        '          </li>' +
                        '        </ul>';
                    $this.closest('.add').before(html);
                    $this.closest('.add').addClass('layui-hide');

                }
            });
        });

        $('.uploadPowerCapacityUrl').change(function(){
            var $this = $(this);
            var file = $(this)[0].files[0];
            if(isBlank(file)){
                return;
            }
            var formData = new FormData();
            formData.append("file", file);
            $.ajax({
                url: "${ctx}/common/uploadFile",
                type: 'POST',
                data: formData,
                processData: false,
                contentType: false,
                success: function (data) {
                    var maxNum = $this.attr('max-num');
                    var html = '<ul class="img"> ' +
                        '         <li class="imgsLi bj-img ">' +
                        '           <span class="layui-icon-close layui-icon" onclick="delImg(this,'+maxNum+')"></span>'+
                        '            <img src="${commonStaticImgPaths}' + data.path + '" alt="">' +
                        '            <input type="hidden" class="imgValues" id="powerCapacityUrl" value="' + data.path + '">'+
                        '          </li>' +
                        '        </ul>';
                    $this.closest('.add').before(html);
                    $this.closest('.add').addClass('layui-hide');

                }
            });
        });

        $('.uploadDbxImgs').change(function(){
            var $this = $(this);
            var file = $(this)[0].files[0];
            if(isBlank(file)){
                return;
            }
            var formData = new FormData();
            formData.append("file", file);
            $.ajax({
                url: "${ctx}/common/uploadFile",
                type: 'POST',
                data: formData,
                processData: false,
                contentType: false,
                success: function (data) {
                    var maxNum = $this.attr('max-num');
                    var html = '<ul class="img"> ' +
                        '         <li class="imgsLi bj-img ">' +
                        '           <span class="layui-icon-close layui-icon" onclick="delImg(this,'+maxNum+')"></span>'+
                        '            <img src="${commonStaticImgPaths}' + data.path + '" alt="">' +
                        '            <input type="hidden" class="imgValues" id="dbxImgs" value="' + data.path + '">'+
                        '          </li>' +
                        '        </ul>';
                    $this.closest('.add').before(html);
                    $this.closest('.add').addClass('layui-hide');

                }
            });
        });

        $('.uploadTlzhjkImgs').change(function(){
            var $this = $(this);
            var file = $(this)[0].files[0];
            if(isBlank(file)){
                return;
            }
            var formData = new FormData();
            formData.append("file", file);
            $.ajax({
                url: "${ctx}/common/uploadFile",
                type: 'POST',
                data: formData,
                processData: false,
                contentType: false,
                success: function (data) {
                    var maxNum = $this.attr('max-num');
                    var html = '<ul class="img"> ' +
                        '         <li class="imgsLi bj-img ">' +
                        '           <span class="layui-icon-close layui-icon" onclick="delImg(this,'+maxNum+')"></span>'+
                        '            <img src="${commonStaticImgPaths}' + data.path + '" alt="">' +
                        '            <input type="hidden" class="imgValues" id="tlzhjkImgs" value="' + data.path + '">'+
                        '          </li>' +
                        '        </ul>';
                    $this.closest('.add').before(html);
                    $this.closest('.add').addClass('layui-hide');

                }
            });
        });

        $('.changeInput').change(function(){
            var spec = $('#componentSpec').val().trim();
            var num = $('#componentNum').val().trim();
            if(!isNaN(spec) && !isNaN(num)){
                $('#capacity').val(spec*num);
            }
        });

        function getImgs(selector){
            var arr = [];
            $(selector).find('input.imgValues').each(function(){
                arr.push($(this).val());
            });
            return arr.join();
        }

        $('.uploadFile').change(function(){
            var $this = $(this);
            var file = $(this)[0].files[0];
            if(isBlank(file)){
                return;
            }
            var formData = new FormData();
            formData.append("file", file);
            $.ajax({
                url: "${ctx}/common/uploadFile",
                type: 'POST',
                data: formData,
                processData: false,
                contentType: false,
                success: function (data) {
                    var maxNum = $this.attr('max-num');
                    var html = '<ul class="img"> ' +
                        '         <li class="imgsLi bj-img ">' +
                        '           <span class="layui-icon-close layui-icon" onclick="delImg(this,'+maxNum+')"></span>'+
                        '            <img src="${commonStaticImgPaths}' + data.path + '" alt="">' +
                        '            <input type="hidden" class="imgValues" value="' + data.path + '">'+
                        '          </li>' +
                        '        </ul>';
                    $this.closest('.add').before(html);
                    var length = $this.closest('td').find('ul').length;
                    if(!isBlank(maxNum) && length >= maxNum){
                        $this.closest('.add').addClass('layui-hide');
                    }
                }
            });
        });

        function updateFileEntry(id) {
            $.ajax({
                type: 'post',
                url: '${ctx}/customerEntry/uploadTwoAttachment',
                data: {
                    id: id,
                    type:'1'
                },
                success: function(data){
                    console.log(data)
                }
            });
        }

        function afterSuccess(data) {
            console.log(data)
            if (data.code === '200') {
                parent.layer.msg('操作成功', {icon: 1});
                closeSelf();
                parent.searchOrder();
            } else if (data.code === '500') {
                layer.msg(data.errMsg, {icon: 2});
            } else if (data.code === '501') {
                layer.msg(data.errMsg, {icon: 2});
            }else if (data.code === '400' && !isBlank(data.errMsg)) {
                layer.msg(data.errMsg, {icon: 2});
            } else {
                layer.msg('操作失败', {icon: 2});
            }
        }

        function uploadAttachment(id) {
            $.ajax({
                type: 'post',
                url: '${ctx}/customerEntry/createEntryPdf',
                data: {
                    id: id
                },
                success: function(data){
                    console.log(data)
                }
            });
        }

        laydate.render({
            elem: '#insuranceDateFrom'
            ,trigger: 'click'
            ,format:"yyyyMMdd"
        });

        laydate.render({
            elem: '#insuranceDateTo'
            ,trigger: 'click'
            ,format:"yyyyMMdd"
        });

        //安装验收通过
        $('.fixAcceptPassBtn').click(function(){
            var $this = $(this);
            //安装验收意见
            var fixRemark = $('textarea[name="fixConclusionSh"]').val();

            // if (isBlank(fixRemark)) {
            //     layer.msg('请填写备注');
            //     return;
            // }
            $this.prop('disabled', true);
            $.ajax({
                type: 'post',
                url: '${ctx}/customerEntry/fixAcceptPass',
                data: {
                    id: '${entry.id}',
                    fixConclusion: fixRemark
                },
                success: function(data){
                    afterSuccess(data);
                },
                complete: function(){
                    $this.prop('disabled', false);
                }
            })
        });
        //安装验收退回
        $('.fixAcceptRefuseBtn').click(function(){
            var $this = $(this);
            //安装验收意见
            var fixRemark = $('textarea[name="fixConclusionSh"]').val();
            if (isBlank(fixRemark)) {
                layer.msg('请填写备注');
                return;
            }
            $this.prop('disabled', true);
            $.ajax({
                type: 'post',
                url: '${ctx}/customerEntry/fixAcceptRefuse',
                data: {
                    id: '${entry.id}',
                    fixConclusion: fixRemark
                },
                success: function(data){
                    afterSuccess(data);
                },
                complete: function(){
                    $this.prop('disabled', false);
                }
            })
        });

        //安装验收通过
        $('.TwoAcceptPassBtn').click(function(){
            var index= layer.load(2, {shade: [0.5,'#fff'], content:''});
            var $this = $(this);
            //二次安装验收意见
            var fixRemark = $('textarea[name="fixConclusionSh"]').val();
            // if (isBlank(fixRemark)) {
            //     layer.msg('请填写备注');
            //     return;
            // }

            $this.prop('disabled', true);
            $.ajax({
                type: 'post',
                url: '${ctx}/customerEntry/toNetAcceptPass',
                data: {
                    id: '${entry.id}',
                    type:'1',
                    fixConclusionSh: fixRemark
                },
                success: function(data){
                    afterSuccess(data);
                },
                complete: function(){
                    layer.close(index);
                    $this.prop('disabled', false);
                }
            })
        });
        //二次安装验收退回
        $('.TwoAcceptRefuseBtn').click(function(){
            var $this = $(this);
            //安装验收意见
            var fixRemark = $('textarea[name="fixConclusionSh"]').val();
            if (isBlank(fixRemark)) {
                layer.msg('请填写备注');
                return;
            }
            $this.prop('disabled', true);
            $.ajax({
                type: 'post',
                url: '${ctx}/customerEntry/toNetAcceptPass',
                data: {
                    id: '${entry.id}',
                    type:'2',
                    fixConclusionSh: fixRemark
                },
                success: function(data){
                    afterSuccess(data);
                },
                complete: function(){
                    $this.prop('disabled', false);
                }
            })
        });

        function getInsurance() {
            return {
                id: $("#insuranceId").val(),
                entryId: '${entry.id}',

                bwtsFile: $("input[name='bwtsFile']").val(),
                bwtsFilename: $("#bwtsFileName").text()
            };
        }



        //提交国网授权
        $('.mergeBtn').click(function(){
            var $this = $(this);
            //发电户号
            var generatorNo = $('input[name="generatorNo"]').val();
            var provinceCode = $("#provinceCode").val()
            var addressConsistent = $("#addressConsistent").val();//购售电地址是否一致
            var province = $("#province").val();
            var city = $("#city").val();
            var area = $("#area").val();
            var address = $("#address").val();
            var bwInstitution = $("#bwInstitution").val();
            var powerPlantCode = $("#powerPlantCode").val();
            var provinceCodeHand = $("#provinceCodeHand").val();
            //三户档案截图
            var archivesImg=$("#archivesImg").val();

            //近3天发电量
            var yxImg = getImgs($('#yxImgTD'));
            //划转截图
            var gebImg = getImgs($('#gebImgTD'));
            var gebImg2 = getImgs($('#gebImg2TD'));
            //电表照片
            var dbImgs=$("#dbImgs").val();
            var dbxImgs=$("#dbxImgs").val();
            //铜铝转换接头照片
            var tlzhjkImgs=$("#tlzhjkImgs").val();
            var powerCapacityUrl=$("#powerCapacityUrl").val();
            $this.prop('disabled', true);
            let application = {
                entryId: '${entry.id}',
                resultType:0,
                insurance: getInsurance()
            };
            var partnerId = "${entry.partnerId}";
            var contractFile;
            var contractFilename;
            let contractVideoUrl = "";
            let contractVideoName = "";
            if(partnerId === '01'){
                let contractFiles = "";
                let contractFilesName = "";
                $(".contractFiles").each(function () {
                    if (isBlank(contractFiles)) {
                        contractFiles = $(this).val();
                    } else {
                        contractFiles = contractFiles + "," + $(this).val();
                    }
                });
                $(".contractFilesName").each(function () {
                    if (isBlank(contractFilesName)) {
                        contractFilesName = $(this).val();
                    } else {
                        contractFilesName = contractFilesName + "," + $(this).val();
                    }
                });
                $(".contractVideoFiles").each(function () {
                    if (isBlank(contractVideoUrl)) {
                        contractVideoUrl = $(this).val();
                    } else {
                        contractVideoUrl = contractVideoUrl + "," + $(this).val();
                    }
                });
                $(".contractVideoName").each(function () {
                    if (isBlank(contractVideoName)) {
                        contractVideoName = $(this).val();
                    } else {
                        contractVideoName = contractVideoName + "," + $(this).val();
                    }
                });
                contractFile =  contractFiles;
                contractFilename = contractFilesName;
            }else{
                contractFile =  $("#contractFile").val();
                contractFilename = $("#contractFilename").text();
            }
            var order = {
                entryId: '${entry.id}',
                generatorNo: generatorNo,
                yxImg: yxImg,
                gebImg: gebImg,
                gebImg2: gebImg2,
                addressConsistent: addressConsistent,
                province: province,
                city: city,
                area: area,
                address: address,
                bwInstitution:bwInstitution,
                powerPlantCode:powerPlantCode,
                archivesImg:archivesImg,
                provinceCode:provinceCode,
                contractFile: contractFile,
                contractFilename: contractFilename,
                application: application,
                dbImgs:dbImgs,
                dbxImgs:dbxImgs,
                powerCapacityUrl:powerCapacityUrl,
                isEmpower:0,
                provinceCodeHand:provinceCodeHand,
                contractVideoUrl:contractVideoUrl,
                contractVideoName:contractVideoName,
                tlzhjkImgs:tlzhjkImgs

            }
            if (isBlank(generatorNo)) {
                layer.msg('发电户号不能为空');
                return;
            }
            if (isBlank(provinceCode)&&${info4.columns.province_code.mustFillFlag eq '1'}) {
                layer.msg('请选择所属电力公司');
                return;
            }
            $.ajax({
                type: 'post',
                url: '${ctx}/customerEntry/merge',
                contentType: "application/json;charsetset=UTF-8",
                data: JSON.stringify(order),
                success: function(data){
                    afterSuccess(data);
                },
                complete: function(){
                    $this.prop('disabled', false);
                }
            })
        });

        //并网暂存
        $('.mergeTmpBtn').click(function(){
            var $this = $(this);
            //发电户号
            var generatorNo = $('input[name="generatorNo"]').val();
            var provinceCode = $("#provinceCode").val()
            var addressConsistent = $("#addressConsistent").val();//购售电地址是否一致
            var province = $("#province").val();
            var city = $("#city").val();
            var area = $("#area").val();
            var address = $("#address").val();
            var bwInstitution = $("#bwInstitution").val();
            var powerPlantCode = $("#powerPlantCode").val()
            var provinceCodeHand = $("#provinceCodeHand").val();
            //三户档案截图
            var archivesImg=$("#archivesImg").val();

            //近3天发电量
            var yxImg = getImgs($('#yxImgTD'));
            //划转截图
            var gebImg = getImgs($('#gebImgTD'));
            var gebImg2 = getImgs($('#gebImg2TD'));
            //电表照片
            var dbImgs=$("#dbImgs").val();
            var dbxImgs=$("#dbxImgs").val();
            //铜铝转换接头照片
            var tlzhjkImgs=$("#tlzhjkImgs").val();
            var powerCapacityUrl=$("#powerCapacityUrl").val();
            $this.prop('disabled', true);
            let application = {
              entryId: '${entry.id}',
                resultType:0,
                insurance: getInsurance()
            };

            var partnerId = "${entry.partnerId}";
            var contractFile = "";
            var contractFilename = "";
            let contractVideoUrl = "";
            let contractVideoName = "";
            var otherAttachment = "";
            if(partnerId === '01'){
                let contractFiles = "";
                let contractFilesName = "";
                $(".contractFiles").each(function () {
                    if (isBlank(contractFiles)) {
                        contractFiles = $(this).val();
                    } else {
                        contractFiles = contractFiles + "," + $(this).val();
                    }
                });
                $(".contractFilesName").each(function () {
                    if (isBlank(contractFilesName)) {
                        contractFilesName = $(this).val();
                    } else {
                        contractFilesName = contractFilesName + "," + $(this).val();
                    }
                });
                $(".contractVideoFiles").each(function () {
                    if (isBlank(contractVideoUrl)) {
                        contractVideoUrl = $(this).val();
                    } else {
                        contractVideoUrl = contractVideoUrl + "," + $(this).val();
                    }
                });
                $(".contractVideoName").each(function () {
                    if (isBlank(contractVideoName)) {
                        contractVideoName = $(this).val();
                    } else {
                        contractVideoName = contractVideoName + "," + $(this).val();
                    }
                });
                $(".otherAttachment").each(function () {
                    if (isBlank(otherAttachment)) {
                        otherAttachment = $(this).val();
                    } else {
                        otherAttachment = otherAttachment + "," + $(this).val();
                    }
                });
                contractFile =  contractFiles;
                contractFilename = contractFilesName;
            }else{
                contractFile =  $("#contractFile").val();
                contractFilename = $("#contractFilename").text();
            }
            var order = {
                entryId: '${entry.id}',
                generatorNo: generatorNo,
                yxImg: yxImg,
                gebImg: gebImg,
                gebImg2: gebImg2,
                addressConsistent: addressConsistent,
                province: province,
                city: city,
                area: area,
                address: address,
                provinceCode:provinceCode,
                contractFile: contractFile,
                contractFilename: contractFilename,
                application: application,
                dbImgs:dbImgs,
                dbxImgs:dbxImgs,
                powerCapacityUrl:powerCapacityUrl,
                isEmpower:1,
                bwInstitution:bwInstitution,
                powerPlantCode:powerPlantCode,
                archivesImg:archivesImg,
                provinceCodeHand:provinceCodeHand,
                contractVideoUrl:contractVideoUrl,
                contractVideoName:contractVideoName,
                otherAttachment:otherAttachment,
                tlzhjkImgs:tlzhjkImgs

            }
            $.ajax({
                type: 'post',
                url: '${ctx}/customerEntry/mergeTmp',
                contentType: "application/json;charsetset=UTF-8",
                data: JSON.stringify(order),
                success: function(data){
                    afterSuccess(data);
                },
                complete: function(){
                    $this.prop('disabled', false);
                }
            })
        });
        //并网提交
        $('.mergeSubmitBtn').click(function(){
            var $this = $(this);
            //发电户号
            var generatorNo = $('input[name="generatorNo"]').val();
            var provinceCode = $("#provinceCode").val()
            var addressConsistent = $("#addressConsistent").val();//购售电地址是否一致
            if (isBlank(addressConsistent) &&${info4.columns.address_consistent.mustFillFlag eq '1'}) {
                layer.msg("请选择购售电地址是否一致");
                return;
            }
            var bwInstitution = $("#bwInstitution").val();
            var powerPlantCode = $("#powerPlantCode").val();
            var provinceCodeHand = $("#provinceCodeHand").val();

            var province = $("#province").val();
            var city = $("#city").val();
            var area = $("#area").val();
            var address = $("#address").val();
            if (addressConsistent === 'N') {
                if ((isBlank(province) || isBlank(city) || isBlank(area) || isBlank(address)) &&${info4.columns.address_consistent.mustFillFlag eq '1'}) {
                    layer.msg("购售电地址不能为空");
                    return;
                }
            }
            var dbImgs = $("#dbImgs").val();
            var dbxImgs = $("#dbxImgs").val();
            var powerCapacityUrl = $("#powerCapacityUrl").val(); //三天连续发电量监控系统截图
            //铜铝转换接头照片
            var tlzhjkImgs=$("#tlzhjkImgs").val();
            //近3天发电量
            var yxImg = getImgs($('#yxImgTD'));
            //划转截图
            var gebImg = getImgs($('#gebImgTD'));
            var gebImg2 = getImgs($('#gebImg2TD'));

            //三户档案截图
            var archivesImg=$("#archivesImg").val();

            if(isBlank(bwInstitution)&&${info4.columns.grid_institution.mustFillFlag eq '1'}){
                layer.msg('并网机构不能为空');
                return;
            }else{
                if(bwInstitution === '1'){
                    if (isBlank(powerPlantCode)&&${info4.columns.power_plant_code.mustFillFlag eq '1'}) {
                        layer.msg('电厂编码不能为空');
                        return;
                    }
                    if (isBlank(archivesImg)&&${info4.columns.archives_img.mustFillFlag eq '1'}) {
                        layer.msg('南网营销系统档案截图不能为空');
                        return;
                    }
                    if (isBlank(provinceCodeHand)&&${info4.columns.province_code_hand.mustFillFlag eq '1'}) {
                        layer.msg('南网电力公司不能为空');
                        return;
                    }

                }
            }
            if (isBlank(generatorNo)) {
                layer.msg('发电户号不能为空');
                return;
            }
            if(bwInstitution === '0'){
                if (isBlank(provinceCode)&&${info4.columns.province_code.mustFillFlag eq '1'}) {
                    layer.msg('请选择所属电力公司');
                    return;
                }
            }
            if (isBlank(yxImg)  && ${info4.columns.yx_img.mustFillFlag eq '1'}) {
                layer.msg('近3天发电量不能为空');
                return;
            }
            if (isBlank(powerCapacityUrl)  && ${info4.columns.power_capacity_url.mustFillFlag eq '1'}) {
                layer.msg('三天连续发电量监控系统截图不能为空');
                return;
            }
            if (isBlank(dbImgs) && ${info4.columns.db_imgs.mustFillFlag eq '1'}) {
                layer.msg('电表照片不能为空');
                return;
            }
            if (isBlank(tlzhjkImgs) && ${info4.columns.dbx_imgs.mustFillFlag eq '1'}) {
                layer.msg('铜铝转换接头照片不能为空');
                return;
            }
            let application = {
                entryId: '${entry.id}',
                resultType: 1,
                insurance: getInsurance()
            };
            let insurance = application.insurance;
            if (isBlank(insurance.bwtsFile)) {
                layer.msg('并网调试报告不能为空');
                return;
            }
            var partnerId = "${entry.partnerId}";
            var contractFile = "";
            var contractFilename = "";
            let contractVideoUrl = "";
            let contractVideoName = "";
            var otherAttachment = "";
            if(partnerId === '01'){
                let contractFiles = "";
                let contractFilesName = "";
                $(".contractFiles").each(function () {
                    if (isBlank(contractFiles)) {
                        contractFiles = $(this).val();
                    } else {
                        contractFiles = contractFiles + "," + $(this).val();
                    }
                });
                $(".contractFilesName").each(function () {
                    if (isBlank(contractFilesName)) {
                        contractFilesName = $(this).val();
                    } else {
                        contractFilesName = contractFilesName + "," + $(this).val();
                    }
                });
                $(".contractVideoFiles").each(function () {
                    if (isBlank(contractVideoUrl)) {
                        contractVideoUrl = $(this).val();
                    } else {
                        contractVideoUrl = contractVideoUrl + "," + $(this).val();
                    }
                });
                $(".contractVideoName").each(function () {
                    if (isBlank(contractVideoName)) {
                        contractVideoName = $(this).val();
                    } else {
                        contractVideoName = contractVideoName + "," + $(this).val();
                    }
                });
                if (isBlank(contractFiles)) {
                    layer.msg('请上传购售电合同文件', {icon: 2});
                    return;
                }
                $(".otherAttachment").each(function () {
                    if (isBlank(otherAttachment)) {
                        otherAttachment = $(this).val();
                    } else {
                        otherAttachment = otherAttachment + "," + $(this).val();
                    }
                });
                contractFile =  contractFiles;
                contractFilename = contractFilesName;
            }else{
                contractFile =  $("#contractFile").val();
                contractFilename = $("#contractFilename").text();
            }
            $this.prop('disabled', true);
            var order = {
                entryId: '${entry.id}',
                generatorNo: generatorNo,
                yxImg: yxImg,
                gebImg: gebImg,
                gebImg2:  gebImg2,
                dbImgs:dbImgs,
                dbxImgs:dbxImgs,
                addressConsistent: addressConsistent,
                province: province,
                city: city,
                area: area,
                address: address,
                bwInstitution:bwInstitution,
                powerPlantCode:powerPlantCode,
                archivesImg:archivesImg,
                provinceCode:provinceCode,
                contractFile: contractFile,
                contractFilename: contractFilename,
                application: application,
                powerCapacityUrl: powerCapacityUrl,
                bwInstitution:bwInstitution,
                powerPlantCode:powerPlantCode,
                archivesImg:archivesImg,
                isEmpower:1,
                provinceCodeHand:provinceCodeHand,
                contractVideoUrl:contractVideoUrl,
                contractVideoName:contractVideoName,
                otherAttachment:otherAttachment,
                tlzhjkImgs:tlzhjkImgs
            }
            $.ajax({
                type: 'post',
                url: '${ctx}/customerEntry/mergeSubmit',
                contentType: "application/json;charsetset=UTF-8",
                data: JSON.stringify(order),
                success: function(data){
                    afterSuccess(data);
                },
                complete: function(){
                    $this.prop('disabled', false);
                }
            })
        });
        //并网验收退回
        $('.mergeAcceptRefuseBtn').click(function(){
            var $this = $(this);
            var mergeConclusion = $('textarea[name="fixConclusionSh"]').val();
            if (isBlank(mergeConclusion)) {
                layer.msg('请填写备注');
                return;
            }
            $this.prop('disabled', true);
            $.ajax({
                type: 'post',
                url: '${ctx}/customerEntry/mergeAcceptRefuse',
                data: {
                    id: '${entry.id}',
                    mergeConclusion: mergeConclusion
                },
                success: function(data){
                    afterSuccess(data);
                },
                complete: function(){
                    $this.prop('disabled', false);
                }
            });
        });

        //并网验收通过
        $('.mergeAcceptPassBtn').click(function(){
            var $this = $(this);
            var fixConclusionSh = $('textarea[name="fixConclusionSh"]').val();
            // if (isBlank(fixConclusionSh)) {
            //     layer.msg('请填写备注');
            //     return;
            // }
            $this.prop('disabled', true);
            $.ajax({
                type: 'post',
                url: '${ctx}/customerEntry/mergeAcceptPass',
                data: {
                    id: '${entry.id}',
                    mergeConclusion: fixConclusionSh
                },
                success: function(data){
                    afterSuccess(data);
                },
                complete: function(){
                    $this.prop('disabled', false);
                }
            });
        });

        //并网验收审核退回
        $('.TwomergeAcceptRefuseBtn').click(function(){
            var $this = $(this);

            var fixConclusionSh = $('textarea[name="fixConclusionSh"]').val();
            if (isBlank(fixConclusionSh)) {
                layer.msg('请填写备注');
                return;
            }
            $this.prop('disabled', true);
            $.ajax({
                type: 'post',
                url: '${ctx}/customerEntry/twoMergeAcceptRefuse',
                data: {
                    id: '${entry.id}',
                    type:'2',
                    finalConclusion: fixConclusionSh
                },
                success: function(data){
                    afterSuccess(data);
                },
                complete: function(){
                    $this.prop('disabled', false);
                }
            });
        });

        //并网验收审核通过
        $('.TwomergeAcceptPassBtn').click(function(){
            var $this = $(this);

            var finalConclusion = $('textarea[name="fixConclusionSh"]').val();
            // if (isBlank(finalConclusion)) {
            //     layer.msg('请填写备注');
            //     return;
            // }
            var index= layer.load(2, {shade: [0.5,'#fff'], content:''});

            $this.prop('disabled', true);
            $.ajax({
                type: 'post',
                url: '${ctx}/customerEntry/twoMergeAcceptRefuse',
                data: {
                    id: '${entry.id}',
                    type: '1',
                    finalConclusion: finalConclusion
                },
                success: function(data){
                    afterSuccess(data);
                },
                complete: function(){
                    $this.prop('disabled', false);
                    layer.close(index);
                }
            });
        });

        $('.downloadPro').click(function(){

            var check_accept_imgs ="${entry.checkAcceptImgs}";
            if(!isBlank(check_accept_imgs)){
                // url="technical/imgDownload";
                // window.open('http://192.168.2.24/sfimggroup/'+check_accept_imgs)
                //  var name ="${entry.traderName}-${entry.powerStationCode}-户用电站验收报告.";
                location.href = '${commonStaticImgPath}' + check_accept_imgs;
            }else{
                var hideSubmitForm = document.createElement("form");
                hideSubmitForm.id = "tempForm1";
                hideSubmitForm.method = "post";
                hideSubmitForm.action = "${ctx}/customerEntry/downLoadPDF";
                hideSubmitForm.target = "_blank";
                hideSubmitForm.appendChild(createHideInput("id", "${entry.id}"));
                hideSubmitForm.addEventListener('onsubmit', function(){
                    // this.openDownloadWindow(name);
                });
                document.body.appendChild(hideSubmitForm);
                hideSubmitForm.submit();
                document.body.removeChild(hideSubmitForm);
            }
        })

        function  createHideInput(name, value){
            var hideInput = document.createElement("input");
            hideInput.type = "hidden";
            hideInput.name = name;
            hideInput.value = value;
            return hideInput;
        }


        form.on('select(addressConsistent)', function (data) {
            var addressConsistent = $("#addressConsistent").val();
            if (addressConsistent === 'N') {
                $(".addressDiv").show();
                $("#addressInput").hide();
                $("#addressInputs").show();
            } else {
                $(".addressDiv").hide();
                $("#addressInput").show();
                $("#addressInputs").hide();
            }
        });
        form.on('select(province)', function (data) {
            var province = $(data.elem).find("option:selected").attr("title");
            provinceOrder(province);
        });
        form.on('select(city)', function (data) {
            var city = $(data.elem).find("option:selected").attr("title");
            cityOrder(city);

        });
    })

    function provinceOrder(province) {
        $("#city").empty();
        $("#area").empty();
        if (isBlank(province)) {
            $("#city").append("<option value=''>请选择</option>");
            return "";
        }
        $.ajax({
            type: "POST",
            url: "${ctx}/main/redirect/getCitysByProId",
            data: {
                province: province
            },
            success: function (result) {
                if (result == "205") {
                    layer.msg("暂无数据!")
                    return
                }
                var html = " <option value=''>请选择</option>";
                for (var i = 0; i < result.length; i++) {
                    var city = result[i];
                    html = html + '<option value="' + city.columns.CityName + '" title="' + city.columns.CityID + '">' + city.columns.CityName + '</option>';
                }
                $("#city").append(html);
                form.render('select');
            }
        });

    }

    function cityOrder(city) {
        $("#area").empty()
        if (isBlank(city)) {
            $("#area").append("<option value=''>请选择</option>");
            return "";
        }
        $.ajax({
            type: "POST",
            url: "${ctx}/main/redirect/getAreaByCityId",
            data: {
                city: city
            },
            success: function (result) {
                if (result == "205") {
                    layer.msg("暂无数据!")
                    return
                }
                var html = "<option value=''>请选择</option>";
                for (var i = 0; i < result.length; i++) {
                    var area = result[i];
                    html = html + '<option value="' + area.columns.DistrictName + '" title="' + area.columns.DistrictID + '">' + area.columns.DistrictName + '</option>';
                }
                $("#area").append(html);

                form.render('select');
            }
        });

    }

    window.closeSelf = function() {
        var index = parent.layer.getFrameIndex(window.name);
        // window.parent.location.reload();//刷新父级页面
        parent.layer.close(index);//关闭当前页
    }

    function delImg(that,maxNum){
        $(that).closest('td').find('.add').removeClass("layui-hide");

        $(that).closest('ul').remove();
    }

    function delImgs(that, id) {
        $("#" + id).show();
        $(that).parent().remove();
    }

    function isBlank(val) {
        if (val == null || val == '' || val == undefined) {
            return true;
        }
        return false;
    }
    function delMoreImg(that){
        $(that).parent("div").parent("div").parent("div").find(".moreUpload").removeClass("hide");
        $(that).parent("div").parent("div").parent("div").find(".moreUpload").show();
        $(that).parent("div").remove();
    }

    function delFile(that) {
        $(that).parent().remove();
    }
</script>
</body>
</html>

