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

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

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

        .layui-tab-title{
            margin: 0 0 0 20px;
        }
        .layui-tab-content{
            margin: 0 0 0 20px;
        }
        .bj-img {
            margin-right: 5px;
        }
        .blank-img {
            background: url('${ctxPlugin}/static/imgs/blankImg.png') center center no-repeat;
            width: 80px;
            height: 80px;
            display: inline-block;
        }
        .link-blue{ color: #1b6073; cursor: pointer;}
    </style>
</head>
<body>
<div class="layui-fluid pd-10">
    <div class="order-win layui-form">
        <div class="layui-card-body pt-20 pb-40">
            <div class="layui-col-xs12 form-box">
                <div class="layui-inline layui-col-xs3">
                    <label class="layui-form-label w-130">电站编码：</label>
                    <div class="layui-input-block ">
                        <input type="text" autocomplete="off" disabled name="stationCode" lay-verify="stationCode" class="layui-input" value="">
                        <input type="hidden"   id="stationId" lay-verify="stationCode" class="layui-input" value="">
                        <a href="#" class="pos-a h-32 lh-32 layui-span-unit pl-10 layui-table-link" onclick="selectEntry('${partnerId}')" style="font-size: 20px">+</a>
                       <%-- <button type="button" class="layui-btn layui-btn-sm" onclick="searchCode()">
                            <i class="layui-icon">&#xe615;</i>
                        </button>--%>
                    </div>
                </div>
                <div class="layui-inline layui-col-xs3">
                    <label class="layui-form-label w-130">电站状态：</label>
                    <div class="layui-input-block ">
                        <input type="text"  name="status" class="layui-input" value="" disabled>
                    </div>
                </div>
                <div class="layui-inline layui-col-xs3">
                    <label class="layui-form-label w-130">代理商：</label>
                    <div class="layui-input-block ">
                        <input type="text" name="traderName" class="layui-input" value="" disabled>
                    </div>
                </div>
                <div class="layui-inline layui-col-xs3">
                    <label class="layui-form-label w-130">产品名称：</label>
                    <div class="layui-input-block ">
                        <input type="text" name="projectName"  class="layui-input" value="" disabled>
                    </div>
                </div>
                <div class="layui-inline layui-col-xs3">
                    <label class="layui-form-label w-130">项目公司：</label>
                    <div class="layui-input-block ">
                        <input type="text" name="projectCompanyName" class="layui-input" value="" disabled>
                    </div>
                </div>
                <div class="layui-inline layui-col-xs3">
                    <label class="layui-form-label w-130">业主姓名：</label>
                    <div class="layui-input-block ">
                        <input type="text" name="tenantName"  class="layui-input" value="" disabled>
                    </div>
                </div>
                <div class="layui-inline layui-col-xs3">
                    <label class="layui-form-label w-130">所属资方：</label>
                    <div class="layui-input-block ">
                        <input type="text" name="partnerName" class="layui-input" value="" disabled>
                    </div>
                </div>
                <div class="layui-inline layui-col-xs3">
                    <label class="layui-form-label w-130">身份证号：</label>
                    <div class="layui-input-block ">
                        <input type="text" name="idCode" class="layui-input" value="" disabled>
                    </div>
                </div>
                <div class="layui-inline layui-col-xs9">
                    <label class="layui-form-label w-130">安装地址：</label>
                    <div class="layui-input-block ">
                        <input type="text" name="address" class="layui-input" value="" disabled>
                    </div>
                </div>
                <div class="layui-inline layui-col-xs12">
                    <label class="layui-form-label w-130">变更原因：</label>
                    <div class="layui-input-block ">
                        <textarea name="reason" id="reason" placeholder="" class="layui-textarea"></textarea>
<%--                        <input type="text" name="reason" class="layui-input" value="" autocomplete="off">--%>
                    </div>
                </div>
            </div>
        </div>
        <div class="clear-both">
            <p class="layui-elem-quote" style="margin: 0px 0px 0px 10px">勘测信息</p>
            <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief" id="LAY_app">

            <div class="layui-tab-content" style="padding: 0px">
                <table class="layui-table" style="text-align: center;">
                    <thead>
                    <tr>
                        <th width="5%">序号</th>
                        <th width="15%">文件名称</th>
                        <th width="40%">变更前信息</th>
                        <th width="40%">变更后信息</th>
                    </tr>
                    </thead>
                    <tbody id="contentBody">
                    <tr id="fly_imgs" class="change hide">
                        <td>1</td>
                        <td id="fly_imgs_name">无人机航拍图</td>
                        <td id="flyImgs">
                        </td>
                        <td>
                            <div class="hide moreDiv">

                            </div>
                            <div class="upload-container moreUpload" data-span-name="flyImgs">
                                <img src="" alt="img placeholder">
                            </div>
                            <input type="text" class="hide numMin" value="3">
                            <input type="text" class="hide numMax" value="9">
                        </td>
                    </tr>
                    <tr id="roof_photo_one" class="change hide">
                        <td>2</td>
                        <td id="roof_photo_one_name">安装区域整体照片</td>
                        <td id="roofPhotoOne">
                        </td>
                        <td>
                            <div class="hide moreDiv">

                            </div>
                            <div class="upload-container moreUpload" data-span-name="roofPhotoOne">
                                <img src="" alt="img placeholder">
                            </div>
                            <input type="text" class="hide numMin" value="2">
                            <input type="text" class="hide numMax" value="9">
                        </td>
                    </tr>
                    <tr id="roof_photo_two" class="change hide">
                        <td>3</td>
                        <td id="roof_photo_two_name">安装区域东南角照片</td>
                        <td id="roofPhotoTwo">
                        </td>
                        <td>
                            <div class="hide moreDiv">

                            </div>
                            <div class="upload-container moreUpload" data-span-name="roofPhotoTwo">
                                <img src="" alt="img placeholder">
                            </div>
                            <input type="text" class="hide numMin" value="1">
                            <input type="text" class="hide numMax" value="9">
                        </td>
                    </tr>
                    <tr id="roof_photo_four" class="change hide">
                        <td>5</td>
                        <td id="roof_photo_four_name">安装区域正南照片</td>
                        <td id="roofPhotoFour">

                        </td>
                        <td>
                            <div class="hide moreDiv">

                            </div>
                            <div class="upload-container moreUpload" data-span-name="roofPhotoFour">
                                <img src="" alt="img placeholder">
                            </div>
                            <input type="text" class="hide numMin" value="1">
                            <input type="text" class="hide numMax" value="9">
                        </td>
                    </tr>
                    <tr id="roof_photo_three" class="change hide">
                        <td>4</td>
                        <td id="roof_photo_three_name">安装区域西南角照片</td>
                        <td id="roofPhotoThree">
                        </td>
                        <td>
                            <div class="hide moreDiv">

                            </div>
                            <div class="upload-container moreUpload" data-span-name="roofPhotoThree">
                                <img src="" alt="img placeholder">
                            </div>
                            <input type="text" class="hide numMin" value="1">
                            <input type="text" class="hide numMax" value="9">
                        </td>
                    </tr>
                    <tr id="house_outline_photo" class="change hide">
                        <td>4</td>
                        <td id="house_outline_photo_name">房屋轮廓照片</td>
                        <td id="houseOutlinePhoto">
                        </td>
                        <td>
                            <div class="hide moreDiv">
                            </div>
                            <div class="upload-container moreUpload" data-span-name="houseOutlinePhoto">
                                <img src="" alt="img placeholder">
                            </div>
                            <input type="text" class="hide numMin" value="1">
                            <input type="text" class="hide numMax" value="9">
                        </td>
                    </tr>
                    <tr id="roof_photo_five" class="change hide">
                        <td>6</td>
                        <td id="roof_photo_five_name">安装区域细节照片</td>
                        <td id="roofPhotoFive">

                        </td>
                        <td>
                            <div class="hide moreDiv">

                            </div>
                            <div class="upload-container moreUpload" data-span-name="roofPhotoFive">
                                <img src="" alt="img placeholder">
                            </div>
                            <input type="text" class="hide numMin" value="4">
                            <input type="text" class="hide numMax" value="9">
                        </td>
                    </tr>
                    <tr id="roof_photo_interior" class="change hide">
                        <td>9</td>
                        <td id="roof_photo_interior_name">房屋内部环境照片</td>
                        <td id="roofPhotoInterior">
                        </td>
                        <td>
                            <div class="hide moreDiv">

                            </div>
                            <div class="upload-container moreUpload"  data-span-name="roofPhotoInterior">
                                <img src="" alt="img placeholder">
                            </div>
                            <input type="text" class="hide numMin" value="2">
                            <input type="text" class="hide numMax" value="9">
                        </td>
                    </tr>
                    <tr id="roof_photo_facade" class="change hide">
                        <td>8</td>
                        <td id="roof_photo_facade_name">房屋内部结构照片</td>
                        <td id="roofPhotoFacade">
                        </td>
                        <td>
                            <div class="hide moreDiv">

                            </div>
                            <div class="upload-container moreUpload"  data-span-name="roofPhotoFacade">
                                <img src="" alt="img placeholder">
                            </div>
                            <input type="text" class="hide numMin" value="2">
                            <input type="text" class="hide numMax" value="9">
                        </td>
                    </tr>
                    <tr id="detail_supplement_one" class="change hide">
                        <td>7</td>
                        <td id="detail_supplement_one_name">逆变器、配电箱预安装位置照片</td>
                        <td id="detailSupplementOne">

                        </td>
                        <td>
                            <div class="hide moreDiv">

                            </div>
                            <div class="upload-container moreUpload" data-span-name="detailSupplementOne">
                                <img src="" alt="img placeholder">
                            </div>
                            <input type="text" class="hide numMin" value="1">
                            <input type="text" class="hide numMax" value="9">
                        </td>
                    </tr>
                    <tr id="house_supplement_one" class="change hide">
                        <td>10</td>
                        <td id="house_supplement_one_name">其他障碍物照片</td>
                        <td id="houseSupplementOne">
                        </td>
                        <td>
                            <div class="hide moreDiv">

                            </div>
                            <div class="upload-container moreUpload" data-span-name="houseSupplementOne">
                                <img src="" alt="img placeholder">
                            </div>
                            <input type="text" class="hide numMax" value="9">
                        </td>
                    </tr>
                    <tr id="survey_video" class="change hide">
                        <td>11</td>
                        <td id="survey_video_name">踏勘补充证明视频</td>
                        <td id="surveyVideo">
                        </td>
                        <td>
                            <div class="hide videoDiv">

                            </div>
<%--                            <div class="bj-img videoSpan" style="width: 150px;">--%>
<%--&lt;%&ndash;                                <span class="layui-icon-close layui-icon" style="z-index: 9;" onclick="delVideoImg(this)"></span>&ndash;%&gt;--%>
<%--&lt;%&ndash;                                <video class="showVideo" controls width="150px" height="78px" src="" ></video>&ndash;%&gt;--%>
<%--&lt;%&ndash;                                <input type="hidden" class="data-input"  name="surveyVideo" value=""/>&ndash;%&gt;--%>
<%--                            </div>--%>
                            <div class="upload-container videoUpload"  data-span-name="surveyVideo">
                                <img src="" alt="img placeholder">
                            </div>
                            <input type="text" class="hide numMax" value="8">
                        </td>
                    </tr>
                    <tr id="survey_files" class="change hide">
                        <td>12</td>
                        <td id="survey_files_name">踏勘记录表</td>
                        <td id="surveyFiles" style="text-align: left">

                        </td>
                        <td style="text-align: left">
                            <div class="imgSpan hide" style="text-align: left;">

                            </div>
                            <div class="udFile"  data-span-name="surveyFiles" style="cursor: pointer;color: #0a6597;">
                                上传
                            </div>
                            <input type="text" class="hide numMax" value="4">
                        </td>
                    </tr>
                    <tr id="vr_roof_one" class="change hide">
                        <td>10</td>
                        <td id="vr_roof_one_name"></td>
                        <td id="vrRoofOne">
                        </td>
                        <td>
                            <div class="hide moreDiv">

                            </div>
                            <div class="upload-container moreUpload" data-span-name="vrRoofOne">
                                <img src="" alt="img placeholder">
                            </div>
                            <input type="text" class="hide numMax" value="9">
                        </td>
                    </tr>
                    <tr id="vr_roof_two" class="change hide">
                        <td>10</td>
                        <td id="vr_roof_two_name"></td>
                        <td id="vrRoofTwo">
                        </td>
                        <td>
                            <div class="hide moreDiv">

                            </div>
                            <div class="upload-container moreUpload" data-span-name="vrRoofTwo">
                                <img src="" alt="img placeholder">
                            </div>
                            <input type="text" class="hide numMax" value="9">
                        </td>
                    </tr>
                    <tr id="vr_roof_three" class="change hide">
                        <td>10</td>
                        <td id="vr_roof_three_name"></td>
                        <td id="vrRoofThree">
                        </td>
                        <td>
                            <div class="hide moreDiv">

                            </div>
                            <div class="upload-container moreUpload" data-span-name="vrRoofThree">
                                <img src="" alt="img placeholder">
                            </div>
                            <input type="text" class="hide numMax" value="9">
                        </td>
                    </tr>
                    <tr id="vr_roof_four" class="change hide">
                        <td>10</td>
                        <td id="vr_roof_four_name"></td>
                        <td id="vrRoofFour">
                        </td>
                        <td>
                            <div class="hide moreDiv">

                            </div>
                            <div class="upload-container moreUpload" data-span-name="vrRoofFour">
                                <img src="" alt="img placeholder">
                            </div>
                            <input type="text" class="hide numMax" value="9">
                        </td>
                    </tr>
                    <tr id="fw_img1" class="change hide">
                        <td>10</td>
                        <td id="fw_img1_name"></td>
                        <td id="fwImg1">
                        </td>
                        <td>
                            <div class="hide moreDiv">

                            </div>
                            <div class="upload-container moreUpload" data-span-name="fwImg1">
                                <img src="" alt="img placeholder">
                            </div>
                            <input type="text" class="hide numMax" value="9">
                        </td>
                    </tr>
                    <tr id="fw_img2" class="change hide">
                        <td>10</td>
                        <td id="fw_img2_name"></td>
                        <td id="fwImg2">
                        </td>
                        <td>
                            <div class="hide moreDiv">

                            </div>
                            <div class="upload-container moreUpload" data-span-name="fwImg2">
                                <img src="" alt="img placeholder">
                            </div>
                            <input type="text" class="hide numMax" value="9">
                        </td>
                    </tr>
                    <tr id="fw_img3" class="change hide">
                        <td>10</td>
                        <td id="fw_img3_name"></td>
                        <td id="fwImg3">
                        </td>
                        <td>
                            <div class="hide moreDiv">

                            </div>
                            <div class="upload-container moreUpload" data-span-name="fwImg3">
                                <img src="" alt="img placeholder">
                            </div>
                            <input type="text" class="hide numMax" value="9">
                        </td>
                    </tr>
                    <tr id="fw_img4" class="change hide">
                        <td>10</td>
                        <td id="fw_img4_name"></td>
                        <td id="fwImg4">
                        </td>
                        <td>
                            <div class="hide moreDiv">

                            </div>
                            <div class="upload-container moreUpload" data-span-name="fwImg4">
                                <img src="" alt="img placeholder">
                            </div>
                            <input type="text" class="hide numMax" value="9">
                        </td>
                    </tr>
                    <tr id="fw_img5" class="change hide">
                        <td>10</td>
                        <td id="fw_img5_name"></td>
                        <td id="fwImg5">
                        </td>
                        <td>
                            <div class="hide moreDiv">

                            </div>
                            <div class="upload-container moreUpload" data-span-name="fwImg5">
                                <img src="" alt="img placeholder">
                            </div>
                            <input type="text" class="hide numMax" value="9">
                        </td>
                    </tr>
                    </tbody>
                </table>
            </div>
        </div>
        </div>
    </div>
</div>
<div class="layui-form-item text-c operate-footer">
    <button type="button" class="layui-btn" id="save">提交</button>
    <button class="layui-btn layui-btn-primary" onclick="closeSelf()">取消</button>
</div>

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

        upload.render({
            elem: '.moreUpload' //绑定元素
            , url: '${ctx}/common/uploadFile' //上传接口
            ,multiple:true
            ,before: function(obj){
                //预读本地文件示例，不支持ie8
                obj.preview(function (index, file, result) {

                });
            }
            , done: function (res, index, upload) {
                var titleName = $(this.item).attr("data-span-name");
                var html='';
                html+='<div class="bj-img imgSpan">';
                html+=' <span class="layui-icon-close layui-icon" onclick="delMoreImg(this)"></span>';
                html += '<img src="${commonStaticImgPath}' + res.path + '">';
                html += '<input type="hidden" class="data-input" name="' + titleName + '" value="' + res.path + '"/>';
                html+='</div>';
                $(this.item).parent("td").find(".moreDiv").append(html);
                $(this.item).parent("td").find(".moreDiv").show();
                var maxNum = $(this.item).parent("td").find(".numMax").val();
                if ($(this.item).parent("td").find(".moreDiv").find(".imgSpan").length == maxNum) {
                    $(this.item).hide();
                }
                viewer.update();
            }
            , error: function () {
                //请求异常回调
            }
        });

        upload.render({
            elem: '.videoUpload' //绑定元素
            ,accept: 'video'
            ,multiple:true
            , url: '${ctx}/common/uploadFile' //上传接口
            ,before: function(obj){
                //预读本地文件示例，不支持ie8
                obj.preview(function (index, file, result) {

                });
            }
            , done: function (res, index, upload) {
                $(this.item).parent("td").find(".videoDiv").show();
                var html = '';
                html += '<div class="bj-img videoSpan" style="width: 150px;">';
                html += '<span  class="layui-icon-close layui-icon" style="z-index: 9;"  onClick="delVideoImg(this)"></span>';
                html += '<video class="showVideo" controls width="150px" height="78px" src="${commonStaticImgPath}' + res.path + '"/>';
                html += '<input type="hidden" class="data-input" name="surveyVideo" value="' + res.path + '"/>';
                html += '</div>';
                $(this.item).parent("td").find(".videoDiv").append(html);
                var maxNum = $(this.item).parent("td").find(".numMax").val();
                if ($(this.item).parent("td").find(".showVideo").length == maxNum) {
                    $(this.item).hide();
                }
            }
            , error: function () {
                //请求异常回调
            }
        });

        upload.render({
            elem: '.udFile' //绑定元素
            , accept: 'file'
            ,multiple:true
            , url: '${ctx}/common/uploadFileKeepName' //上传接口
            , before: function (obj) {
                //预读本地文件示例，不支持ie8
                obj.preview(function (index, file, result) {
                });
            }
            , done: function (res, index, upload) {
                var titleName = $(this.item).attr("data-span-name");
                $(this.item).parent("td").find(".imgSpan").show();
                var html='';
                html += '<div>';
                html += '<a href="${commonStaticImgPath}' + res.path + '" target="_blank" class="fileH">' + res.filename + '</a>';
                html += '<span onclick="delFile(this)" style="cursor:pointer;"><i class="layui-icon">&#xe640;</i></span>';
                html += '<input name="' + titleName + '" class="hide" value="' + res.path + '">';
                html += '</div>';
                $(this.item).parent("td").find(".imgSpan").append(html);
                var maxNum = $(this.item).parent("td").find(".numMax").val();
                if ($(this.item).parent("td").find(".fileH").length == maxNum) {
                    $(this.item).hide();
                }
            }
            , error: function () {
                //请求异常回调
            }
        });

        $("#save").click(function(){
            commit();
        })
    })

    var opeRep = false;
    function commit() {
        if(opeRep){
            return;
        }
        var entryId = $("#stationId").val();
        if (isBlank(entryId)) {
            layer.msg("请选择电站");
            return;
        }
        var flyImgs = [];
        $("input[name='flyImgs']").each(function(){
            flyImgs.push($(this).val());
        })
        var roofPhotoOne = [];
        $("input[name='roofPhotoOne']").each(function(){
            roofPhotoOne.push($(this).val());
        })

        if(roofPhotoOne.length>0 && roofPhotoOne.length<2){
            layer.msg(  $("#roof_photo_one_name").text()+"最少上传2张");
            return;
        }
        var roofPhotoTwo = [];
        $("input[name='roofPhotoTwo']").each(function(){
            roofPhotoTwo.push($(this).val());
        })
        if (roofPhotoTwo.length == 0) {
            layer.msg(  $("#roof_photo_two_name").text()+"不能为空");
            return;
        }
        var roofPhotoThree = [];
        $("input[name='roofPhotoThree']").each(function(){
            roofPhotoThree.push($(this).val());
        })
        if (roofPhotoThree.length == 0) {
            layer.msg(  $("#roof_photo_three_name").text()+"不能为空");
            return;
        }
        var roofPhotoFour = [];
        $("input[name='roofPhotoFour']").each(function(){
            roofPhotoFour.push($(this).val());
        })
        if (roofPhotoFour.length == 0) {
            layer.msg(  $("#roof_photo_four_name").text()+"不能为空");
            return;
        }
        var roofPhotoFive = [];
        $("input[name='roofPhotoFive']").each(function(){
            roofPhotoFive.push($(this).val());
        })

        var roofPhotoFacade = [];
        $("input[name='roofPhotoFacade']").each(function(){
            roofPhotoFacade.push($(this).val());
        })

        var roofPhotoInterior = [];
        $("input[name='roofPhotoInterior']").each(function(){
            roofPhotoInterior.push($(this).val());
        })
        var houseSupplementOne = [];
        $("input[name='houseSupplementOne']").each(function(){
            houseSupplementOne.push($(this).val());
        })
        var detailSupplementOne = [];
        $("input[name='detailSupplementOne']").each(function(){
            detailSupplementOne.push($(this).val());
        })
        var surveyVideo = [];
        $("input[name='surveyVideo']").each(function(){
            surveyVideo.push($(this).val());
        })
        var surveyFiles = [];
        $("input[name='surveyFiles']").each(function(){
            surveyFiles.push($(this).val());
        })
        var houseOutlinePhoto = [];
        $("input[name='houseOutlinePhoto']").each(function(){
            houseOutlinePhoto.push($(this).val());
        })
        var vrRoofOne = [];
        $("input[name='vrRoofOne']").each(function(){
            vrRoofOne.push($(this).val());
        })
        var vrRoofTwo = [];
        $("input[name='vrRoofTwo']").each(function(){
            vrRoofTwo.push($(this).val());
        })
        var vrRoofThree = [];
        $("input[name='vrRoofThree']").each(function(){
            vrRoofThree.push($(this).val());
        })

        var vrRoofFour = [];
        $("input[name='vrRoofFour']").each(function(){
            vrRoofFour.push($(this).val());
        })
        var fwImg1 = [];
        $("input[name='fwImg1']").each(function(){
            fwImg1.push($(this).val());
        })
        var fwImg2 = [];
        $("input[name='fwImg2']").each(function(){
            fwImg2.push($(this).val());
        })
        var fwImg3 = [];
        $("input[name='fwImg3']").each(function(){
            fwImg3.push($(this).val());
        })
        var fwImg4 = [];
        $("input[name='fwImg4']").each(function(){
            fwImg4.push($(this).val());
        })
        var fwImg5 = [];
        $("input[name='fwImg5']").each(function(){
            fwImg5.push($(this).val());
        })


        var checkRe = true;
        for (i = 0; i < formSet.length; i++) {
            let columnKey = formSet[i].columnKey;
            let useFlag = formSet[i].useFlag;
            let mustFillFlag = formSet[i].mustFillFlag;
            if (columnKey.includes(partnerId)) {
                columnKey = columnKey.substring(0, columnKey.indexOf(partnerId)-1);
            }
            if (useFlag=='1' && columnKey=='fly_imgs' && mustFillFlag=='1') {
                if(flyImgs.length == 0){
                    layer.msg(  $("#fly_imgs_name").text()+"不能为空");
                    checkRe = false;
                    return;
                }
                if(flyImgs.length>0 && flyImgs.length<3){
                    layer.msg(  $("#fly_imgs_name").text()+"最少上传3张");
                    checkRe = false;
                    return;
                }
            }

            if (useFlag=='1' && columnKey=='roof_photo_one' && mustFillFlag=='1' &&roofPhotoOne.length == 0) {
                layer.msg(  $("#roof_photo_one_name").text()+"不能为空");
                checkRe = false;
                return;
            }
            if (useFlag=='1' && columnKey=='roof_photo_five' && mustFillFlag=='1' &&roofPhotoFive.length == 0) {
                layer.msg(  $("#roof_photo_five_name").text()+"不能为空");
                checkRe = false;
                return;
            }

            if(useFlag=='1' && columnKey=='roof_photo_facade' && mustFillFlag=='1' &&roofPhotoFacade.length>0 ){
                if(roofPhotoFacade.length == 0){
                    layer.msg(  $("#roof_photo_facade_name").text()+"不能为空");
                    checkRe = false;
                    return;
                }
                if( roofPhotoFacade.length<2){
                    layer.msg(  $("#roof_photo_facade_name").text()+"最少上传2张");
                    checkRe = false;
                    return;
                }
            }
            if (useFlag=='1' && columnKey=='roof_photo_interior' && mustFillFlag=='1') {
                if (roofPhotoInterior.length == 0) {
                    layer.msg(  $("#roof_photo_interior_name").text()+"不能为空");
                    checkRe = false;
                    return;
                }
                if(roofPhotoInterior.length>0 && roofPhotoInterior.length<2){
                    layer.msg(  $("#roof_photo_interior_name").text()+"最少上传2张");
                    checkRe = false;
                    return;
                }
            }
            if (useFlag=='1' && columnKey=='detail_supplement_one' && mustFillFlag=='1'&&detailSupplementOne.length == 0) {
                layer.msg(  $("#detail_supplement_one_name").text()+"不能为空");
                checkRe = false;
                return;
            }
            if(useFlag=='1' && columnKey=='house_supplement_one' && mustFillFlag=='1' && houseSupplementOne.length==0){
                layer.msg(  $("#house_supplement_one_name").text()+"不能为空");
                checkRe = false;
                return;
            }
            if(useFlag=='1' && columnKey=='survey_video' && mustFillFlag=='1' && surveyVideo.length==0){
                layer.msg(  $("#survey_video_name").text()+"不能为空");
                checkRe = false;
                return;
            }
            if(useFlag=='1' && columnKey=='survey_files' && mustFillFlag=='1' && surveyFiles.length==0){
                layer.msg(  $("#survey_files_name").text()+"不能为空");
                checkRe = false;
                return;
            }
            if(useFlag=='1' && columnKey=='house_outline_photo' && mustFillFlag=='1' && houseOutlinePhoto.length==0){
                layer.msg(  $("#house_outline_photo_name").text()+"不能为空");
                checkRe = false;
                return;
            }
            if(useFlag=='1' && columnKey=='vr_roof_one' && mustFillFlag=='1' && vrRoofOne.length==0){
                layer.msg(  $("#vr_roof_one_name").text()+"不能为空");
                checkRe = false;
                return;
            }
            if(useFlag=='1' && columnKey=='vr_roof_two' && mustFillFlag=='1' && vrRoofTwo.length==0){
                layer.msg(  $("#vr_roof_two_name").text()+"不能为空");
                checkRe = false;
                return;
            }
            if(useFlag=='1' && columnKey=='vr_roof_three' && mustFillFlag=='1' && vrRoofThree.length==0){
                layer.msg(  $("#vr_roof_three_name").text()+"不能为空");
                checkRe = false;
                return;
            }
            if(useFlag=='1' && columnKey=='vr_roof_four' && mustFillFlag=='1' && vrRoofFour.length==0){
                layer.msg(  $("#vr_roof_four_name").text()+"不能为空");
                checkRe = false;
                return;
            }
            if(useFlag=='1' && columnKey=='fw_img1' && mustFillFlag=='1' && fwImg1.length==0){
                layer.msg(  $("#fw_img1_name").text()+"不能为空");
                checkRe = false;
                return;
            }
            if(useFlag=='1' && columnKey=='fw_img2' && mustFillFlag=='1' && fwImg2.length==0){
                layer.msg(  $("#fw_img2_name").text()+"不能为空");
                checkRe = false;
                return;
            }
            if(useFlag=='1' && columnKey=='fw_img3' && mustFillFlag=='1' && fwImg3.length==0){
                layer.msg(  $("#fw_img3_name").text()+"不能为空");
                checkRe = false;
                return;
            }
            if(useFlag=='1' && columnKey=='fw_img4' && mustFillFlag=='1' && fwImg4.length==0){
                layer.msg(  $("#fw_img4_name").text()+"不能为空");
                checkRe = false;
                return;
            }
            if(useFlag=='1' && columnKey=='fw_img5' && mustFillFlag=='1' && fwImg5.length==0){
                layer.msg(  $("#fw_img5_name").text()+"不能为空");
                checkRe = false;
                return;
            }
        }
        if(!checkRe){
            return;
        }

        // var reason = $("input[name='reason']").val();
        var reason = $("#reason").val();
        opeRep = true;
        $.ajax({
            type: 'post',
            url: '${ctx}/customer/entry/change/survey/addChangeRecord',
            dataType: 'json',
            data: {
                entryId: entryId,
                type: '0',
                status: status,
                flyImgs: flyImgs.join(","),
                roofPhotoOne: roofPhotoOne.join(","),
                roofPhotoTwo: roofPhotoTwo.join(","),
                roofPhotoThree: roofPhotoThree.join(","),
                roofPhotoFour: roofPhotoFour.join(","),
                roofPhotoFive: roofPhotoFive.join(","),
                roofPhotoFacade: roofPhotoFacade.join(","),
                roofPhotoInterior: roofPhotoInterior.join(","),
                houseSupplementOne: houseSupplementOne.join(","),
                detailSupplementOne: detailSupplementOne.join(","),
                surveyVideo: surveyVideo.join(","),
                surveyFiles: surveyFiles.join(","),
                houseOutlinePhoto: houseOutlinePhoto.join(","),
                vrRoofOne: vrRoofOne.join(","),
                vrRoofTwo: vrRoofTwo.join(","),
                vrRoofThree: vrRoofThree.join(","),
                vrRoofFour: vrRoofFour.join(","),
                fwImg1: fwImg1.join(","),
                fwImg2: fwImg2.join(","),
                fwImg3: fwImg3.join(","),
                fwImg4: fwImg4.join(","),
                fwImg5: fwImg5.join(","),
                reason: reason
            },
            success: function(data){
                if (data.code == "200") {
                    top.layer.msg("操作成功");
                    closeSelf();
                    parent.location.reload();
                } else {
                    layer.msg(data.errMsg);
                }
            },
            complete: function(){
                opeRep = false;
            }
        });
    }

    function selectEntry(partnerId){
        layer.open({
            type: 2,
            title: '选择电站',
            content: '${ctx}/customer/entry/change/survey/toSelectEntry?partnerId='+partnerId,
            area: ['80%','80%']
        });
    }

    function searchCode(stationCode){
        if (isBlank(stationCode)) {
            return;
        }
        $("input[name='stationCode']").val(stationCode);
        $.ajax({
            type: 'post',
            url: '${ctx}/customer/entry/change/survey/selectNumber/' + stationCode,
            dataType: 'json',
            data: {
                stationCode: stationCode
            },
            success: function(res){
                clearHtml();
                if (res.code == "200") {
                    var surveyRecord = res.data.surveyRecord;
                    var customerEntry = res.data.customerEntry;
                    formSet = res.data.formSet;
                    partnerId = res.data.customerEntry.partnerId;
                    var project = res.data.project;
                    $("#stationId").val(customerEntry.id);
                    $("input[name='status']").val(getStatus(customerEntry));
                    $("input[name='traderName']").val(customerEntry.createTraderName);
                    $("input[name='projectName']").val(project.name);
                    $("input[name='projectCompanyName']").val(customerEntry.projectCompanyName);
                    $("input[name='tenantName']").val(customerEntry.tenantName);
                    $("input[name='partnerName']").val(customerEntry.partnerName);
                    $("input[name='idCode']").val(customerEntry.idCode);
                    $("input[name='address']").val(customerEntry.province + customerEntry.city + customerEntry.area + customerEntry.address);
                    if (!isBlank(surveyRecord)) {
                        appendHtml(surveyRecord,customerEntry);
                        hideOrShowHtml(formSet,customerEntry.partnerId);
                    }
                } else {
                    formSet = null;
                    clearHtml();
                    layer.msg(res.errMsg);
                }
            }
        });
    }

    function clearHtml(){
        $("#stationId").val("");
        $("input[name='status']").val("");
        $("input[name='traderName']").val("");
        $("input[name='projectName']").val("");
        $("input[name='projectCompanyName']").val("");
        $("input[name='tenantName']").val("");
        $("input[name='idCode']").val("");
        $("input[name='address']").val("");
        $("#flyImgs").empty();
        $("#roofPhotoOne").empty();
        $("#roofPhotoTwo").empty();
        $("#roofPhotoThree").empty();
        $("#roofPhotoFour").empty();
        $("#roofPhotoFive").empty();
        $("#detailSupplementOne").empty();
        $("#roofPhotoFacade").empty();
        $("#roofPhotoInterior").empty();
        $("#houseSupplementOne").empty();
        $("#surveyVideo").empty();
        $("#surveyFiles").empty();
        $("#houseOutlinePhoto").empty();
        $("#vrRoofFour").empty();
        $("#fwImg1").empty();
        $("#fwImg2").empty();
        $("#fwImg3").empty();
        $("#fwImg4").empty();
        $("#fwImg5").empty();
        $(".change").addClass("hide");

    }

    function hideOrShowHtml(setData,partnerId) {
        for (var i = 0; i < setData.length; i++) {
            let columnKey = setData[i].columnKey;
            if (setData[i].useFlag == '0') {//不启用
                $("#" + columnKey).addClass("hide");
            } else {
                if (columnKey.includes(partnerId)) {
                    columnKey = columnKey.substring(0, columnKey.indexOf(partnerId)-1);
                }
                $("#" + columnKey).removeClass('hide');
                $("#" + columnKey+'_name').text(setData[i].columnName);
            }
        }
        resetSort();
    }

    function appendHtml(data, entryData) {
        if (!isBlank(data.flyImgs)) {
            var imgsArr = data.flyImgs.split(",");
            var html = '';
            var h2 = '';
            for (var i = 0; i < imgsArr.length; i++) {
                html += '<div class="bj-img">';
                html += '   <img src="${commonStaticImgPath}' + imgsArr[i] + '">';
                html += '</div>';

                h2 += '<div class="bj-img imgSpan">';
                h2 += ' <span class="layui-icon-close layui-icon" onclick="delMoreImg(this)"></span>';
                h2 += '<img src="${commonStaticImgPath}' + imgsArr[i] + '">';
                h2 += '<input type="hidden" class="data-input" name="flyImgs" value="' + imgsArr[i] + '"/>';
                h2 += '</div>';
            }
            $("#flyImgs").empty().append(html);
            $("#flyImgs").next().find(".moreDiv").show();
            $("#flyImgs").next().find(".moreDiv").empty().append(h2);
            var maxNum = $("#flyImgs").next().find(".numMax").val();
            if (imgsArr.length == maxNum) {
                $("#flyImgs").next().find(".moreUpload").hide();
            }
        }
        if (!isBlank(data.roofPhotoOne)) {
            var imgs = data.roofPhotoOne.split(",");
            var html = '';
            var h2 = '';
            for (var i = 0; i < imgs.length; i++) {
                html += '<div class="bj-img">';
                html += '   <img src="${commonStaticImgPath}' + imgs[i] + '">';
                html += '</div>';

                h2 += '<div class="bj-img imgSpan">';
                h2 += ' <span class="layui-icon-close layui-icon" onclick="delMoreImg(this)"></span>';
                h2 += '<img src="${commonStaticImgPath}' + imgs[i] + '">';
                h2 += '<input type="hidden" class="data-input" name="roofPhotoOne" value="' + imgs[i] + '"/>';
                h2 += '</div>';
            }
            $("#roofPhotoOne").empty().append(html);
            $("#roofPhotoOne").next().find(".moreDiv").show();
            $("#roofPhotoOne").next().find(".moreDiv").empty().append(h2);
            var maxNum = $("#roofPhotoOne").next().find(".numMax").val();
            if (imgs.length == maxNum) {
                $("#roofPhotoOne").next().find(".moreUpload").hide();
            }
        }
        console.log(data.roofPhotoTwo)
        if (!isBlank(data.roofPhotoTwo)) {
            console.log(data.roofPhotoTwo)
            var imgsArr = data.roofPhotoTwo.split(",");
            var html = '';
            var h2 = '';
            for (var i = 0; i < imgsArr.length; i++) {
                html += '<div class="bj-img">';
                html += '   <img src="${commonStaticImgPath}' + imgsArr[i] + '">';
                html += '</div>';

                h2 += '<div class="bj-img imgSpan">';
                h2 += ' <span class="layui-icon-close layui-icon" onclick="delMoreImg(this)"></span>';
                h2 += '<img src="${commonStaticImgPath}' + imgsArr[i] + '">';
                h2 += '<input type="hidden" class="data-input" name="roofPhotoTwo" value="' + imgsArr[i] + '"/>';
                h2 += '</div>';
            }
            $("#roofPhotoTwo").empty().append(html);
            $("#roofPhotoTwo").next().find(".moreDiv").show();
            $("#roofPhotoTwo").next().find(".moreDiv").empty().append(h2);
            var maxNum = $("#roofPhotoTwo").next().find(".numMax").val();
            if (imgsArr.length == maxNum) {
                $("#roofPhotoTwo").next().find(".moreUpload").hide();
            }
        }
        if (!isBlank(data.roofPhotoThree)) {
            console.log(data.roofPhotoThree)
            var imgsArr = data.roofPhotoThree.split(",");
            var html = '';
            var h2 = '';
            for (var i = 0; i < imgsArr.length; i++) {
                html += '<div class="bj-img">';
                html += '   <img src="${commonStaticImgPath}' + imgsArr[i] + '">';
                html += '</div>';

                h2 += '<div class="bj-img imgSpan">';
                h2 += ' <span class="layui-icon-close layui-icon" onclick="delMoreImg(this)"></span>';
                h2 += '<img src="${commonStaticImgPath}' + imgsArr[i] + '">';
                h2 += '<input type="hidden" class="data-input" name="roofPhotoThree" value="' + imgsArr[i] + '"/>';
                h2 += '</div>';
            }
            $("#roofPhotoThree").empty().append(html);

            $("#roofPhotoThree").next().find(".moreDiv").show();
            $("#roofPhotoThree").next().find(".moreDiv").empty().append(h2);
            var maxNum = $("#roofPhotoThree").next().find(".numMax").val();
            if (imgsArr.length == maxNum) {
                $("#roofPhotoThree").next().find(".moreUpload").hide();
            }
        }
        if (!isBlank(data.roofPhotoFour)) {
            var imgsArr = data.roofPhotoFour.split(",");
            var html = '';
            var h2 = '';
            for (var i = 0; i < imgsArr.length; i++) {
                html += '<div class="bj-img">';
                html += '   <img src="${commonStaticImgPath}' + imgsArr[i] + '">';
                html += '</div>';

                h2 += '<div class="bj-img imgSpan">';
                h2 += ' <span class="layui-icon-close layui-icon" onclick="delMoreImg(this)"></span>';
                h2 += '<img src="${commonStaticImgPath}' + imgsArr[i] + '">';
                h2 += '<input type="hidden" class="data-input" name="roofPhotoFour" value="' + imgsArr[i] + '"/>';
                h2 += '</div>';
            }
            $("#roofPhotoFour").empty().append(html);
            $("#roofPhotoFour").next().find(".moreDiv").show();
            $("#roofPhotoFour").next().find(".moreDiv").empty().append(h2);
            var maxNum = $("#roofPhotoFour").next().find(".numMax").val();
            if (imgsArr.length == maxNum) {
                $("#roofPhotoFour").next().find(".moreUpload").hide();
            }
        }
        if (!isBlank(data.houseOutlinePhoto)) {
            var imgsArr = data.houseOutlinePhoto.split(",");
            var html = '';
            var h2 = '';
            for (var i = 0; i < imgsArr.length; i++) {
                html += '<div class="bj-img">';
                html += '   <img src="${commonStaticImgPath}' + imgsArr[i] + '">';
                html += '</div>';

                h2 += '<div class="bj-img imgSpan">';
                h2 += ' <span class="layui-icon-close layui-icon" onclick="delMoreImg(this)"></span>';
                h2 += '<img src="${commonStaticImgPath}' + imgsArr[i] + '">';
                h2 += '<input type="hidden" class="data-input" name="houseOutlinePhoto" value="' + imgsArr[i] + '"/>';
                h2 += '</div>';
            }
            $("#houseOutlinePhoto").empty().append(html);
            $("#houseOutlinePhoto").next().find(".moreDiv").show();
            $("#houseOutlinePhoto").next().find(".moreDiv").empty().append(h2);
            var maxNum = $("#houseOutlinePhoto").next().find(".numMax").val();
            if (imgsArr.length == maxNum) {
                $("#houseOutlinePhoto").next().find(".moreUpload").hide();
            }
        }
        if (!isBlank(data.roofPhotoFive)) {
            var imgsArr = data.roofPhotoFive.split(",");
            var html = '';
            var h2 = '';
            for (var i = 0; i < imgsArr.length; i++) {
                html += '<div class="bj-img">';
                html += '   <img src="${commonStaticImgPath}' + imgsArr[i] + '">';
                html += '</div>';

                h2 += '<div class="bj-img imgSpan">';
                h2 += ' <span class="layui-icon-close layui-icon" onclick="delMoreImg(this)"></span>';
                h2 += '<img src="${commonStaticImgPath}' + imgsArr[i] + '">';
                h2 += '<input type="hidden" class="data-input" name="roofPhotoFive" value="' + imgsArr[i] + '"/>';
                h2 += '</div>';
            }
            $("#roofPhotoFive").empty().append(html);
            $("#roofPhotoFive").next().find(".moreDiv").show();
            $("#roofPhotoFive").next().find(".moreDiv").empty().append(h2);
            var maxNum = $("#roofPhotoFive").next().find(".numMax").val();
            if (imgsArr.length == maxNum) {
                $("#roofPhotoFive").next().find(".moreUpload").hide();
            }
        }
        if (!isBlank(data.detailSupplementOne)) {
            var flyImgsArr = data.detailSupplementOne.split(",");
            var html = '';
            var h2 = '';
            for (var i = 0; i < flyImgsArr.length; i++) {
                html += '<div class="bj-img">';
                html += '   <img src="${commonStaticImgPath}' + flyImgsArr[i] + '">';
                html += '</div>';

                h2 += '<div class="bj-img imgSpan">';
                h2 += ' <span class="layui-icon-close layui-icon" onclick="delMoreImg(this)"></span>';
                h2 += '<img src="${commonStaticImgPath}' + flyImgsArr[i] + '">';
                h2 += '<input type="hidden" class="data-input" name="detailSupplementOne" value="' + flyImgsArr[i] + '"/>';
                h2 += '</div>';
            }
            $("#detailSupplementOne").empty().append(html);
            $("#detailSupplementOne").next().find(".moreDiv").show();
            $("#detailSupplementOne").next().find(".moreDiv").empty().append(h2);
            var maxNum = $("#detailSupplementOne").next().find(".numMax").val();
            if (imgsArr.length == maxNum) {
                $("#detailSupplementOne").next().find(".moreUpload").hide();
            }
        }
        if (!isBlank(data.roofPhotoFacade)) {
            var imgsArr = data.roofPhotoFacade.split(",");
            var html = '';
            var h2 = '';
            for (var i = 0; i < imgsArr.length; i++) {
                html += '<div class="bj-img">';
                html += '   <img src="${commonStaticImgPath}' + imgsArr[i] + '">';
                html += '</div>';

                h2 += '<div class="bj-img imgSpan">';
                h2 += ' <span class="layui-icon-close layui-icon" onclick="delMoreImg(this)"></span>';
                h2 += '<img src="${commonStaticImgPath}' + imgsArr[i] + '">';
                h2 += '<input type="hidden" class="data-input" name="roofPhotoFacade" value="' + imgsArr[i] + '"/>';
                h2 += '</div>';
            }
            $("#roofPhotoFacade").empty().append(html);
            $("#roofPhotoFacade").next().find(".moreDiv").show();
            $("#roofPhotoFacade").next().find(".moreDiv").empty().append(h2);
            var maxNum = $("#roofPhotoFacade").next().find(".numMax").val();
            if (imgsArr.length == maxNum) {
                $("#roofPhotoFacade").next().find(".moreUpload").hide();
            }
        }
        if (!isBlank(data.roofPhotoInterior)) {
            var imgsArr = data.roofPhotoInterior.split(",");
            var html = '';
            var h2 = '';
            for (var i = 0; i < imgsArr.length; i++) {
                html += '<div class="bj-img">';
                html += '   <img src="${commonStaticImgPath}' + imgsArr[i] + '">';
                html += '</div>';

                h2 += '<div class="bj-img imgSpan">';
                h2 += ' <span class="layui-icon-close layui-icon" onclick="delMoreImg(this)"></span>';
                h2 += '<img src="${commonStaticImgPath}' + imgsArr[i] + '">';
                h2 += '<input type="hidden" class="data-input" name="roofPhotoInterior" value="' + imgsArr[i] + '"/>';
                h2 += '</div>';
            }
            $("#roofPhotoInterior").empty().append(html);
            $("#roofPhotoInterior").next().find(".moreDiv").show();
            $("#roofPhotoInterior").next().find(".moreDiv").empty().append(h2);
            var maxNum = $("#roofPhotoInterior").next().find(".numMax").val();
            if (imgsArr.length == maxNum) {
                $("#roofPhotoInterior").next().find(".moreUpload").hide();
            }
        }
        if (!isBlank(data.houseSupplementOne)) {
            var imgsArr = data.houseSupplementOne.split(",");
            var html = '';
            var h2 = '';
            for (var i = 0; i < imgsArr.length; i++) {
                html += '<div class="bj-img">';
                html += '   <img src="${commonStaticImgPath}' + imgsArr[i] + '">';
                html += '</div>';

                h2 += '<div class="bj-img imgSpan">';
                h2 += ' <span class="layui-icon-close layui-icon" onclick="delMoreImg(this)"></span>';
                h2 += '<img src="${commonStaticImgPath}' + imgsArr[i] + '">';
                h2 += '<input type="hidden" class="data-input" name="houseSupplementOne" value="' + imgsArr[i] + '"/>';
                h2 += '</div>';
            }
            $("#houseSupplementOne").empty().append(html);
            $("#houseSupplementOne").next().find(".moreDiv").show();
            $("#houseSupplementOne").next().find(".moreDiv").empty().append(h2);
            var maxNum = $("#houseSupplementOne").next().find(".numMax").val();
            if (imgsArr.length == maxNum) {
                $("#houseSupplementOne").next().find(".moreUpload").hide();
            }
        }
        if (!isBlank(data.surveyVideo)) {
            var imgsArr = data.surveyVideo.split(",");
            var html = '';
            var h2 = '';
            for (var i = 0; i < imgsArr.length; i++) {
                html += '<div class="bj-img videoSpan" style="width: 150px;">';
                html += '<video class="showVideo" controls width="150px" height="78px" src="${commonStaticImgPath}' + imgsArr[i] + '"/>';
                html += '</div>';
                h2 += '<div class="bj-img videoSpan" style="width: 150px;">';
                h2 += '<span  class="layui-icon-close layui-icon" style="z-index: 9;" onClick="delVideoImg(this)"></span>';
                h2 += '<video class="showVideo" controls width="150px" height="78px" src="${commonStaticImgPath}' + imgsArr[i] + '"/>';
                h2 += '<input type="hidden" className="data-input" name="surveyVideo" value="' + imgsArr[i] + '"/>';
                h2 += '</div>';
            }
            $("#surveyVideo").empty().append(html);
            $("#surveyVideo").next().find(".videoDiv").show();
            $("#surveyVideo").next().find(".videoDiv").empty().append(h2);
            var maxNum = $("#surveyVideo").next().find(".numMax").val();
            if (imgsArr.length == maxNum) {
                $("#surveyVideo").next().find(".videoUpload").hide();
            }
        }
        if (!isBlank(data.surveyFiles)) {
            var imgsArr = data.surveyFiles.split(",");
            var html = '';
            var h2 = '';
            for (var i = 0; i < imgsArr.length; i++) {
                var fileName = imgsArr[i].substring(imgsArr[i].lastIndexOf("/") + 1, imgsArr[i].length);
                html += '<div>';
                html += '<a href="${commonStaticImgPath}' + imgsArr[i] + '" target="_blank">' + fileName + '</a>';
                html += '</div>';

                var fname = imgsArr[i].substring(imgsArr[i].lastIndexOf("/") + 1, imgsArr[i].length);
                h2 += '<div>';
                h2 += '<a href="${commonStaticImgPath}' + imgsArr[i] + '" target="_blank" class="fileH">' + fname + '</a>';
                h2 += '<span onclick="delFile(this)" style="cursor:pointer;"><i class="layui-icon">&#xe640;</i></span>';
                h2 += '<input name="surveyFiles" class="hide" value="' + imgsArr[i] + '">';
                h2 += '</div>';
            }
            $("#surveyFiles").empty().append(html);

            $("#surveyFiles").next().find(".imgSpan").show();
            $("#surveyFiles").next().find(".imgSpan").empty().append(h2);
            var maxNum = $("#surveyFiles").next().find(".numMax").val();
            if (imgsArr.length == maxNum) {
                $("#surveyFiles").next().find(".udFile").hide();
            }
        }
        if (!isBlank(data.vrRoofOne)) {
            var imgsArr = data.vrRoofOne.split(",");
            var html = '';
            var h2 = '';
            for (var i = 0; i < imgsArr.length; i++) {
                html += '<div class="bj-img">';
                html += '   <img src="${commonStaticImgPath}' + imgsArr[i] + '">';
                html += '</div>';

                h2 += '<div class="bj-img imgSpan">';
                h2 += ' <span class="layui-icon-close layui-icon" onclick="delMoreImg(this)"></span>';
                h2 += '<img src="${commonStaticImgPath}' + imgsArr[i] + '">';
                h2 += '<input type="hidden" class="data-input" name="vrRoofOne" value="' + imgsArr[i] + '"/>';
                h2 += '</div>';
            }
            $("#vrRoofOne").empty().append(html);
            $("#vrRoofOne").next().find(".moreDiv").show();
            $("#vrRoofOne").next().find(".moreDiv").empty().append(h2);
            var maxNum = $("#vrRoofOne").next().find(".numMax").val();
            if (imgsArr.length == maxNum) {
                $("#vrRoofOne").next().find(".moreUpload").hide();
            }
        }
        if (!isBlank(data.vrRoofTwo)) {
            var imgsArr = data.vrRoofTwo.split(",");
            var html = '';
            var h2 = '';
            for (var i = 0; i < imgsArr.length; i++) {
                html += '<div class="bj-img">';
                html += '   <img src="${commonStaticImgPath}' + imgsArr[i] + '">';
                html += '</div>';

                h2 += '<div class="bj-img imgSpan">';
                h2 += ' <span class="layui-icon-close layui-icon" onclick="delMoreImg(this)"></span>';
                h2 += '<img src="${commonStaticImgPath}' + imgsArr[i] + '">';
                h2 += '<input type="hidden" class="data-input" name="vrRoofTwo" value="' + imgsArr[i] + '"/>';
                h2 += '</div>';
            }
            $("#vrRoofTwo").empty().append(html);
            $("#vrRoofTwo").next().find(".moreDiv").show();
            $("#vrRoofTwo").next().find(".moreDiv").empty().append(h2);
            var maxNum = $("#vrRoofTwo").next().find(".numMax").val();
            if (imgsArr.length == maxNum) {
                $("#vrRoofTwo").next().find(".moreUpload").hide();
            }
        }
        if (!isBlank(data.vrRoofThree)) {
            var imgsArr = data.vrRoofThree.split(",");
            var html = '';
            var h2 = '';
            for (var i = 0; i < imgsArr.length; i++) {
                html += '<div class="bj-img">';
                html += '   <img src="${commonStaticImgPath}' + imgsArr[i] + '">';
                html += '</div>';

                h2 += '<div class="bj-img imgSpan">';
                h2 += ' <span class="layui-icon-close layui-icon" onclick="delMoreImg(this)"></span>';
                h2 += '<img src="${commonStaticImgPath}' + imgsArr[i] + '">';
                h2 += '<input type="hidden" class="data-input" name="vrRoofThree" value="' + imgsArr[i] + '"/>';
                h2 += '</div>';
            }
            $("#vrRoofThree").empty().append(html);
            $("#vrRoofThree").next().find(".moreDiv").show();
            $("#vrRoofThree").next().find(".moreDiv").empty().append(h2);
            var maxNum = $("#vrRoofThree").next().find(".numMax").val();
            if (imgsArr.length == maxNum) {
                $("#vrRoofThree").next().find(".moreUpload").hide();
            }
        }
        if (!isBlank(data.vrRoofFour)) {
            var imgsArr = data.vrRoofFour.split(",");
            var html = '';
            var h2 = '';
            for (var i = 0; i < imgsArr.length; i++) {
                html += '<div class="bj-img">';
                html += '   <img src="${commonStaticImgPath}' + imgsArr[i] + '">';
                html += '</div>';

                h2 += '<div class="bj-img imgSpan">';
                h2 += ' <span class="layui-icon-close layui-icon" onclick="delMoreImg(this)"></span>';
                h2 += '<img src="${commonStaticImgPath}' + imgsArr[i] + '">';
                h2 += '<input type="hidden" class="data-input" name="vrRoofFour" value="' + imgsArr[i] + '"/>';
                h2 += '</div>';
            }
            $("#vrRoofFour").empty().append(html);
            $("#vrRoofFour").next().find(".moreDiv").show();
            $("#vrRoofFour").next().find(".moreDiv").empty().append(h2);
            var maxNum = $("#vrRoofFour").next().find(".numMax").val();
            if (imgsArr.length == maxNum) {
                $("#vrRoofFour").next().find(".moreUpload").hide();
            }
        }
        if (!isBlank(data.fwImg1)) {
            var imgsArr = data.fwImg1.split(",");
            var html = '';
            var h2 = '';
            for (var i = 0; i < imgsArr.length; i++) {
                html += '<div class="bj-img">';
                html += '   <img src="${commonStaticImgPath}' + imgsArr[i] + '">';
                html += '</div>';

                h2 += '<div class="bj-img imgSpan">';
                h2 += ' <span class="layui-icon-close layui-icon" onclick="delMoreImg(this)"></span>';
                h2 += '<img src="${commonStaticImgPath}' + imgsArr[i] + '">';
                h2 += '<input type="hidden" class="data-input" name="fwImg1" value="' + imgsArr[i] + '"/>';
                h2 += '</div>';
            }
            $("#fwImg1").empty().append(html);
            $("#fwImg1").next().find(".moreDiv").show();
            $("#fwImg1").next().find(".moreDiv").empty().append(h2);
            var maxNum = $("#fwImg1").next().find(".numMax").val();
            if (imgsArr.length == maxNum) {
                $("#fwImg1").next().find(".moreUpload").hide();
            }
        }
        if (!isBlank(data.fwImg2)) {
            var imgsArr = data.fwImg2.split(",");
            var html = '';
            var h2 = '';
            for (var i = 0; i < imgsArr.length; i++) {
                html += '<div class="bj-img">';
                html += '   <img src="${commonStaticImgPath}' + imgsArr[i] + '">';
                html += '</div>';

                h2 += '<div class="bj-img imgSpan">';
                h2 += ' <span class="layui-icon-close layui-icon" onclick="delMoreImg(this)"></span>';
                h2 += '<img src="${commonStaticImgPath}' + imgsArr[i] + '">';
                h2 += '<input type="hidden" class="data-input" name="fwImg2" value="' + imgsArr[i] + '"/>';
                h2 += '</div>';
            }
            $("#fwImg2").empty().append(html);
            $("#fwImg2").next().find(".moreDiv").show();
            $("#fwImg2").next().find(".moreDiv").empty().append(h2);
            var maxNum = $("#fwImg2").next().find(".numMax").val();
            if (imgsArr.length == maxNum) {
                $("#fwImg2").next().find(".moreUpload").hide();
            }
        }
        if (!isBlank(data.fwImg3)) {
            var imgsArr = data.fwImg3.split(",");
            var html = '';
            var h2 = '';
            for (var i = 0; i < imgsArr.length; i++) {
                html += '<div class="bj-img">';
                html += '   <img src="${commonStaticImgPath}' + imgsArr[i] + '">';
                html += '</div>';

                h2 += '<div class="bj-img imgSpan">';
                h2 += ' <span class="layui-icon-close layui-icon" onclick="delMoreImg(this)"></span>';
                h2 += '<img src="${commonStaticImgPath}' + imgsArr[i] + '">';
                h2 += '<input type="hidden" class="data-input" name="fwImg3" value="' + imgsArr[i] + '"/>';
                h2 += '</div>';
            }
            $("#fwImg3").empty().append(html);
            $("#fwImg3").next().find(".moreDiv").show();
            $("#fwImg3").next().find(".moreDiv").empty().append(h2);
            var maxNum = $("#fwImg3").next().find(".numMax").val();
            if (imgsArr.length == maxNum) {
                $("#fwImg3").next().find(".moreUpload").hide();
            }
        }
        if (!isBlank(data.fwImg4)) {
            var imgsArr = data.fwImg4.split(",");
            var html = '';
            var h2 = '';
            for (var i = 0; i < imgsArr.length; i++) {
                html += '<div class="bj-img">';
                html += '   <img src="${commonStaticImgPath}' + imgsArr[i] + '">';
                html += '</div>';

                h2 += '<div class="bj-img imgSpan">';
                h2 += ' <span class="layui-icon-close layui-icon" onclick="delMoreImg(this)"></span>';
                h2 += '<img src="${commonStaticImgPath}' + imgsArr[i] + '">';
                h2 += '<input type="hidden" class="data-input" name="fwImg4" value="' + imgsArr[i] + '"/>';
                h2 += '</div>';
            }
            $("#fwImg4").empty().append(html);
            $("#fwImg4").next().find(".moreDiv").show();
            $("#fwImg4").next().find(".moreDiv").empty().append(h2);
            var maxNum = $("#fwImg4").next().find(".numMax").val();
            if (imgsArr.length == maxNum) {
                $("#fwImg4").next().find(".moreUpload").hide();
            }
        }
        if (!isBlank(data.fwImg5)) {
            var imgsArr = data.fwImg5.split(",");
            var html = '';
            var h2 = '';
            for (var i = 0; i < imgsArr.length; i++) {
                html += '<div class="bj-img">';
                html += '   <img src="${commonStaticImgPath}' + imgsArr[i] + '">';
                html += '</div>';

                h2 += '<div class="bj-img imgSpan">';
                h2 += ' <span class="layui-icon-close layui-icon" onclick="delMoreImg(this)"></span>';
                h2 += '<img src="${commonStaticImgPath}' + imgsArr[i] + '">';
                h2 += '<input type="hidden" class="data-input" name="fwImg5" value="' + imgsArr[i] + '"/>';
                h2 += '</div>';
            }
            $("#fwImg5").empty().append(html);
            $("#fwImg5").next().find(".moreDiv").show();
            $("#fwImg5").next().find(".moreDiv").empty().append(h2);
            var maxNum = $("#fwImg5").next().find(".numMax").val();
            if (imgsArr.length == maxNum) {
                $("#fwImg5").next().find(".moreUpload").hide();
            }
        }
        viewer.update();
    }

    function resetSort(){
        var sort = 1;
        $("#contentBody").find("tr").each(function (index) {
            if (!$(this).hasClass("hide")) {
                $(this).find("td:first").text(sort);
                sort++;
            }
        });
    }

    function getStatus(d) {
        if (d.status == '0') {
            if (d.credit == '0') {
                return "暂存";
            } else if(d.credit == '1'){
                return "待预审";
            } else if(d.credit == '2'){
                return "预审待审批";
            } else if(d.credit == '3'){
                return "预审审批中";
            } else if(d.credit == '4'){
                if(d.designAuditFlag == '3'){
                    return '自审驳回';
                }else if(d.designAuditFlag == 'a'){
                    return '待设计';
                }else {
                    return '待踏勘';
                }
            } else if(d.credit == '5'){
                return "预审拒绝";
            }
            return "暂存";
        }else if (d.status == '1') {
            if (d.designAuditFlag == '1') {
                return "待踏勘";
            } else if (d.designAuditFlag == '2') {
                return "待自审";
            } else if (d.designAuditFlag == '3') {
                return "自审驳回";
            } else if (d.designAuditFlag == '4') {
                return "自审通过";
            } else if (d.designAuditFlag == '5') {
                return "设计审核驳回";
            } else if (d.designAuditFlag == '6') {
                return "设计审核通过";
            } else if (d.designAuditFlag == '7') {
                return "进件审核驳回";
            } else if (d.designAuditFlag == '8') {
                return "进件审核中";
            } else if (d.designAuditFlag == '9') {
                return "进件审核通过";
            } else if (d.designAuditFlag == 'a') {
                return "待设计";
            }
            return "待审核";
        } else if (d.status == '2') {
            return "审核驳回";
        } else if (d.status == '3') {
            return "待下单";
        } else if(d.status=='4'){
            if(d.installFlag=='1'){
                return "待派工";
            }else if(d.installFlag=='2'){
                return "待安装";
            }else if(d.installFlag=='3'){
                return "自审驳回";
            }else if(d.installFlag=='4'){
                return "安装完成";
            }
        } else if(d.status=='5'){
            return "待安装验收";
        } else if(d.status=='f'){
            return "安装验收驳回";
        } else if(d.status=='6'){
            return "待并网";
        } else if(d.status=='7'){
            return "待并网验收";
        } else if(d.status=='8'){
            return "待交付";
        } else if(d.status=='9'){
            return "待归档";
        } else if(d.status=='10'){
            return "验收驳回";
        } else if(d.status=='11'){
            return "归档驳回";
        } else if(d.status=='a'){
            return "已完成";
        } else if(d.status=='c'){
            return "待代理商确认";
        } else if(d.status=='e'){
            return "待签署合同";
        } else if(d.status=='w'){
            return "信息登记";
        } else if(d.status=='g'){
            return "设计审核";
        } else if(d.status=='AN'){
            return "待安装确认";
        } else if(d.status=='AT'){
            return "安装确认驳回";
        } else if(d.status=='BW'){
            return "待并网确认";
        } else if(d.status=='BN'){
            return "并网确认驳回";
        } else if(d.status=='h'){
            return "勘测设计自审";
        } else if(d.status=='i'){
            return "安装自审";
        }
    }

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

    function delMoreImg(that){
        $(that).parent("div").parent("div").parent("td").find(".moreUpload").show();
        $(that).parent("div").remove();
    }

    function delVideoImg(that){
        $(that).parent("div").parent("div").parent("td").find(".videoUpload").show();
        $(that).parent("div").remove();
    }

    function delFile(that){
        $(that).hide();
        $(that).parent("div").parent("div").parent("td").find(".udFile").show();
        $(that).parent("div").remove();
        // $(that).parent("div").parent("div").parent("td").find(".udFile").show();
    }

    function isBlank(val) {
        if (val == null || val == '' || val == undefined) {
            return true;
        }
        return false;
    }
    window.addEventListener('beforeunload', function (event) {
        console.l("进来了没有")
        // 这里可以执行一些清理工作或者发送数据给服务器
        event.preventDefault(); // 阻止默认行为
        // 可以返回一个提示信息或设置 `return` 值
        return '您确定要离开吗？';
    });
</script>
</body>
</html>

