<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<!DOCTYPE HTML>
<html>
<head>
    <meta name="decorator" content="base"/>
    <link rel="stylesheet" href="${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/style/admin.css" media="all">
    <link rel="stylesheet" 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;
        }
        .bj-img {
            margin-right: 0px;
        }
        .bj-img > span{
           z-index: 1;
        }
        .lookBtn{
            color: #2890ac;
            width: 10px;
            padding: 11px;
        }
        .bj-img{width: 80px;
            height: 80px;
            border: 1px solid #ddd;
            float: inherit;
            margin-right: 20px;
            display: inline-block;
            position: relative;
        }
        .fczImg .imgSpan{
            margin-right: 14px;
        }
    </style>
</head>

<body>
<div class="layui-form">
    <div class="layui-card">
        <div class="layui-card-body layui-col-xs12" id="LAY_app">
            <div class="layui-card">
                <blockquote class="layui-elem-quote">项目信息</blockquote>
                <div class="layui-card-body">
                    <div class="layui-row layui-col-space12 layui-form-item">
                        <div class="layui-col-lg3 layui-col-sm3">
                            <label class="layui-form-label"><i class="mark">*</i>产品编号：</label>
                            <div class="layui-input-block">
                                <input type="text" id="projectCode" class="layui-input layui-bg-gray" disabled>
                            </div>
                        </div>
                        <div class="layui-col-lg3 layui-col-sm3">
                            <label class="layui-form-label"><i class="mark">*</i>产品名称：</label>
                            <div class="layui-input-block">

                                <select name="projectId" id="projectId" lay-filter="projectId" lay-search  lay-verify="required">
                                    <option value="">请选择</option>
                                    <c:forEach items="${project}" var="ject">
                                        <option value="${ject.columns.id}" title="${ject.columns.code}"
                                                lay-data="${ject.columns.companyName}"
                                                lay-tips="${ject.columns.pay_cycle}"
                                                lay-type="${ject.columns.filing_type}"
                                        >${ject.columns.name}</option>
                                    </c:forEach>
                                </select>
                                <input hidden name="projectName" id="projectName">
                            </div>
                        </div>
                        <div class="layui-col-lg3 layui-col-sm3">
                            <label class="layui-form-label">所属项目公司：</label>
                            <div class="layui-input-block">
                                <input type="text" disabled class="layui-input " id="companyName">
                            </div>
                        </div>

                        <div class="layui-col-lg3 layui-col-sm3 ">
                            <label class="layui-form-label">租金支付周期：</label>
                            <div class="layui-input-block pos-r">
                                <input type="text" disabled placeholder=""
                                       autocomplete="off" class="layui-input" id="payCycle">
                            </div>
                        </div>
                        <div class="layui-col-lg3 layui-col-sm3 ">
                            <label class="layui-form-label">备案类型：</label>
                            <div class="layui-input-block pos-r">
                                <input type="text" disabled placeholder=""
                                       autocomplete="off" class="layui-input" id="filingType">
                            </div>
                        </div>
                        <div class="layui-col-lg3 layui-col-sm3">
                            <label class="layui-form-label"><i class="mark">*</i>预估组件：</label>
                            <div class="layui-input-block">
                                <input type="text" oninput="if(value.length>9)value=value.slice(0,9)" name="estimateCapacity" id="estimateCapacity"
                                       autocomplete="off" class="layui-input" placeholder="请输入预估组件">
                                <span class="pos-a h-32 lh-32 layui-span-unit">块</span>
                            </div>
                        </div>
                    </div>

                </div>
            </div>
            <div class="layui-card jibenxinxi ">
                <blockquote class="layui-elem-quote">业主信息</blockquote>
                <div class="layui-card-body ">

                    <div class="layui-row layui-col-space12 layui-form-item">

                        <div class="layui-col-lg3 layui-col-sm3">
                            <label class="layui-form-label"><i class="mark">*</i>业主姓名：</label>
                            <div class="layui-input-block">
                                <input type="text" name="tenantName" id="tenantName" lay-verify="required"
                                       autocomplete="off" class="layui-input ">
                            </div>
                        </div>
                        <div class="layui-col-lg3 layui-col-sm3">
                            <label class="layui-form-label"><i class="mark">*</i>性别：</label>
                            <div class="layui-input-block">
                                <input type="radio" name="gender"  title="男"
                                       value="MALE"  checked/>
                                <input type="radio" name="gender"  title="女"
                                       value="FEMALE" />
                            </div>
                        </div>
                        <div class="layui-col-lg3 layui-col-sm3">
                            <div>
                                <label class="layui-form-label"><i class="mark">*</i>年龄：</label>
                                <div class="layui-input-block">
                                    <input type="text" lay-filter="age" onkeyup="change()" name="age" id="age"  class="layui-input age" value="${entry.age}" lay-verify="required">
                                </div>
                            </div>
                        </div>
                        <div class="layui-col-lg3 layui-col-sm3" style="position:relative;">
                            <div>
                                <label class="layui-form-label"><i class="mark">*</i>联系方式：</label>
                                <div class="layui-input-block">
                                    <input type="text" name="mobile" id="mobile" lay-verify="recevierMobile"
                                           class="layui-input" autocomplete="off">
                                </div>
                            </div>
                        </div>
                        <div class="layui-col-lg3 layui-col-sm3">
                            <label class="layui-form-label"><i class="mark">*</i>身份证号：</label>
                            <div class="layui-input-block">
                                <input type="text" name="idCode" id="idCode" lay-verify="identity"
                                       autocomplete="off" class="layui-input " lay-verify="required">
                            </div>
                        </div>

                        <div class="layui-col-lg9 layui-col-sm9">
                            <label class="layui-form-label"><i class="mark">*</i>安装地址：</label>
                            <div class="layui-input-block">
                                <div class="layui-col-lg2 layui-col-sm2 pr-10">
                                    <select name="province" id="province" lay-verify="required"
                                            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.province eq pro.columns.ProvinceName}">selected</c:if>>${pro.columns.ProvinceName}</option>
                                        </c:forEach>
                                    </select>
                                </div>
                                <div class="layui-col-lg2 layui-col-sm2 pr-10">
                                    <select name="city" id="city" lay-verify="required" lay-filter="city"
                                            lay-search>
                                        <option value="">请选择市</option>

                                    </select>
                                </div>
                                <div class="layui-col-lg2 layui-col-sm2 pr-10">
                                    <select name="area" id="area" lay-verify="required" lay-search>
                                        <option value="">请选择县/区</option>

                                    </select>
                                </div>
                                <div class="layui-col-lg6 layui-col-sm5">
                                    <div class="layui-inline">
                                        <input type="text" name="customerAddress" lay-verify="required"
                                               autocomplete="off" class="layui-input layui-col-lg2 "
                                               value="${entry.customerAddress}">
                                    </div>
                                </div>
                            </div>

                        </div>

                        <div class="layui-col-lg3 layui-col-sm3">
                            <label class="layui-form-label"><i class="mark">*</i>账户名称：</label>
                            <div class="layui-input-block">
                                <input type="text" name="bankName" id="bankName" lay-verify="required"
                                       autocomplete="off" class="layui-input ">
                            </div>
                        </div>
                        <div class="layui-col-lg3 layui-col-sm3">
                            <label class="layui-form-label"><i class="mark">*</i>银行账号：</label>
                            <div class="layui-input-block">
                                <input type="text" name="bankCode" id="bankCode" lay-verify="required"
                                       autocomplete="off" class="layui-input ">
                            </div>
                        </div>

                        <div class="layui-col-lg4 layui-col-sm4">
                            <label class="layui-form-label"><i class="mark">*</i>开户行：</label>
                            <div class="layui-input-block">
                                <div id="tssBank"></div>
                            </div>
                        </div>

                        <div class="layui-col-lg4 layui-col-sm4">
                            <label class="layui-form-label"><i class="mark">*</i>身份证：</label>
                            <div class="layui-input-block img-box">
                                <div>
                                    <div id="imgsDiv14"></div>
                                    <div class="upload-container" id="uploader14">
                                        <img src="" alt="img placeholder" id="imgsAdd14">
                                    </div>
                                    <div style="width: 80px; text-align: center; color: #FF0000">正面</div>
                                </div>
                                <div>
                                    <div id="imgsDiv15"></div>
                                    <div class="upload-container" id="uploader15">
                                        <img src="" alt="img placeholder" id="imgsAdd15">
                                    </div>
                                    <div style="width: 80px; text-align: center; color: #FF0000">反面</div>
                                </div>
                            </div>
                        </div>

                        <div class="layui-col-lg4 layui-col-sm4">
                            <label class="layui-form-label  w-120">户口本复印件：</label>
                            <div class="layui-input-block img-box ml-120">
                                <div>
                                    <div>
                                        <div id="imgsDiv28"></div>
                                        <div class="upload-container" id="uploader28">
                                            <img src="" alt="img placeholder" id="imgsAdd28">
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="layui-col-lg4 layui-col-sm4">
                            <label class="layui-form-label"><i class="mark">*</i>银行卡照片：</label>
                            <div class="layui-input-block img-box">
                                <div>
                                    <div>
                                        <div id="imgsDiv29"></div>
                                        <div class="upload-container" id="uploader29">
                                            <img src="" alt="img placeholder" id="imgsAdd29">
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>

                    </div>
                </div>
            </div>

            <div class="layui-card hide" id="bcxx">
                <blockquote class="layui-elem-quote">补充信息</blockquote>
                <div class="layui-card-body ">
                    <div class="layui-row layui-col-space12 layui-form-item">
                        <div class="layui-col-lg3 layui-col-sm3">
                            <label class="layui-form-label"><i class="mark">*</i>共签人名称：</label>
                            <div class="layui-input-block">
                                <input type="text" name="bpName" id="bpName" class="layui-input " value="${entry.bpName}" >
                            </div>
                        </div>
                        <div class="layui-col-lg3 layui-col-sm3">
                            <label class="layui-form-label"><i class="mark">*</i>证件号码：</label>
                            <div class="layui-input-block">
                                <input type="text" name="bpIdCard" id="bpIdCard" class="layui-input " value="${entry.bpIdCard}" >
                            </div>
                        </div>
                        <div class="layui-col-lg3 layui-col-sm3">
                            <label class="layui-form-label"><i class="mark">*</i>手机号：</label>
                            <div class="layui-input-block">
                                <input type="text" name="bpMobile" id="bpMobile" class="layui-input " value="${entry.bpMobile}" >
                            </div>
                        </div>

                        <div class="layui-col-lg4 layui-col-sm4">
                            <label class="layui-form-label"><i class="mark">*</i>身份证：</label>
                            <div class="layui-input-block img-box">
                                <div>
                                    <div id="imgsDiv30">
                                    </div>
                                    <div class="upload-container" id="uploader30">
                                        <img src="" alt="img placeholder" id="imgsAdd30">
                                    </div>
                                    <div style="width: 80px; text-align: center; color: #FF0000">正面</div>
                                </div>
                                <div>
                                    <div id="imgsDiv31">
                                    </div>
                                    <div class="upload-container" id="uploader31">
                                        <img src="" alt="img placeholder" id="imgsAdd31">
                                    </div>
                                    <div style="width: 80px; text-align: center; color: #FF0000">反面</div>
                                </div>
                            </div>
                        </div>
                        <div class="layui-col-lg4 layui-col-sm4">
                            <label class="layui-form-label w-120"><i class="mark">*</i>子女证明材料：</label>
                            <div class="layui-input-block img-box ml-120">
                                <div>
                                    <div id="imgsDiv32">
                                    </div>
                                    <div class="upload-container " id="uploader32">
                                        <img src="" alt="img placeholder" id="imgsAdd32">
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>

                </div>
            </div>

            <div class="layui-card">
                <blockquote class="layui-elem-quote">房屋信息</blockquote>
                <div class="layui-card-body ">

                    <div class="layui-row layui-col-space12 layui-form-item">
                        <div class="layui-col-lg3 layui-col-sm3">
                            <label class="layui-form-label">屋顶类型：</label>
                            <div class="layui-input-block">
                                <select name="roofType" id="roofType">
                                    <option value="">请选择</option>
                                    <option value="平屋顶">平屋顶</option>
                                    <option value="斜屋顶">斜屋顶</option>
                                </select>
                            </div>
                        </div>
                        <div class="layui-col-lg3 layui-col-sm3">
                            <label class="layui-form-label">并网距离：</label>
                            <div class="layui-input-block">
                                <input type="text" name="distance" id="distance" autocomplete="off" class="layui-input">
                                <span class="pos-a h-32 lh-32 layui-span-unit">米</span>
                            </div>
                        </div>
                        <div class="layui-col-lg3 layui-col-sm3" style="position:relative;">
                            <div>
                                <label class="layui-form-label">方位角：</label>
                                <div class="layui-inline" style="width: 120px;">
                                    <select lay-filter="azimuth" name="azimuth" id="azimuth"  lay-search>
                                        <option value="">请选择</option>
                                        <option value="1">正南</option>
                                        <option value="2">南偏东</option>
                                        <option value="3">南偏西</option>
                                    </select>
                                </div>
                                <div class="layui-inline" style="width: 112px">
                                    <input type="text" name="angle" id="angle" class="layui-input" maxlength="2"
                                           oninput="value=value.replace(/[^\d]/g,'')" onchange="checkAngle()" />
                                    <span class="pos-a h-32 lh-32 layui-span-unit">度</span>
                                </div>
                            </div>
                        </div>
                        <div class="layui-col-lg3 layui-col-sm3">
                            <label class="layui-form-label">建筑高度：</label>
                            <div class="layui-input-block">
                                <input type="text" name="buildingHeight" id="buildingHeight" autocomplete="off"
                                       class="layui-input">
                                <span class="pos-a h-32 lh-32 layui-span-unit">米</span>
                            </div>
                        </div>
                        <div class="layui-col-lg3 layui-col-sm3">
                            <label class="layui-form-label">拍摄方式：</label>
                            <div class="layui-input-block">
                                <input type="radio" name="shootType" lay-filter="shootType" title="无人机拍摄" value="1" checked/>
                                <input type="radio" name="shootType" lay-filter="shootType" title="手机拍摄" value="2"/>
                            </div>
                        </div>
                        <div class="layui-col-lg11 layui-col-sm11">
                            <label class="layui-form-label">房屋照片：</label>
                            <div class="layui-input-block img-box" id="wrjps">
                                <div>
                                    <div id="imgsDiv1"></div>
                                    <div class="upload-container" id="uploaderone">
                                        <img src="" alt="img placeholder" id="imgsAdd1">
                                    </div>
                                    <div style="width: 80px; text-align: center; color: #ff0000">房屋正面</div>
                                </div>
                                <div>
                                    <div id="imgsDiv2"></div>
                                    <div class="upload-container" id="uploader2">
                                        <img src="" alt="img placeholder" id="imgsAdd2">
                                    </div>
                                    <div style="width: 80px; text-align: center; color: #ff0000">东南角</div>
                                </div>
                                <div>
                                    <div id="imgsDiv3"></div>
                                    <div class="upload-container" id="uploader3">
                                        <img src="" alt="img placeholder" id="imgsAdd3">
                                    </div>
                                    <div style="width: 80px; text-align: center; color: #ff0000">西南角</div>
                                </div>
                                <div>
                                    <div id="imgsDiv4"></div>
                                    <div class="upload-container" id="uploader4">
                                        <img src="" alt="img placeholder" id="imgsAdd4">
                                    </div>
                                    <div style="width: 80px; text-align: center; color: #ff0000">正南侧</div>
                                </div>
                                <div>
                                    <div id="imgsDiv5"></div>
                                    <div class="upload-container" id="uploader5">
                                        <img src="" alt="img placeholder" id="imgsAdd5">
                                    </div>
                                    <div style="width: 80px; text-align: center; color: #ff0000">生活气息照1</div>
                                </div>
                                <div>
                                    <div id="imgsDiv6"></div>
                                    <div class="upload-container" id="uploader6">
                                        <img src="" alt="img placeholder" id="imgsAdd6">
                                    </div>
                                    <div style="width: 80px; text-align: center; color: #ff0000">生活气息照2</div>
                                </div>
                                <div>
                                    <div id="imgsDiv7"></div>
                                    <div class="upload-container" id="uploader7">
                                        <img src="" alt="img placeholder" id="imgsAdd7">
                                    </div>
                                    <div style="width: 80px; text-align: center; color: #ff0000">补充1</div>
                                </div>
                                <div>
                                    <div id="imgsDiv8"></div>
                                    <div class="upload-container" id="uploader8">
                                        <img src="" alt="img placeholder" id="imgsAdd8">
                                    </div>
                                    <div style="width: 80px; text-align: center; color: #ff0000">补充2</div>
                                </div>
                                <div>
                                    <div id="imgsDiv9"></div>
                                    <div class="upload-container" id="uploader9">
                                        <img src="" alt="img placeholder" id="imgsAdd9">
                                    </div>
                                    <div style="width: 80px; text-align: center; color: #144856">补充1</div>
                                </div>
                                <div>
                                    <div id="imgsDiv10"></div>
                                    <div class="upload-container" id="uploader10">
                                        <img src="" alt="img placeholder" id="imgsAdd10">
                                    </div>
                                    <div style="width: 80px; text-align: center; color: #144856">补充2</div>
                                </div>
                            </div>
                        </div>
                        <div class="layui-col-lg5 layui-col-sm5">
                            <label class="layui-form-label">细节照片：</label>
                            <div class="layui-input-block img-box">
                                <div>
                                    <div id="imgsDiv11"></div>
                                    <div class="upload-container" id="uploader11">
                                        <img src="" alt="img placeholder" id="imgsAdd11">
                                    </div>
                                    <div style="width: 80px; text-align: center; color: #ff0000">障碍物照片</div>
                                </div>
                                <div>
                                    <div id="imgsDiv17"></div>
                                    <div class="upload-container" id="uploader17">
                                        <img src="" alt="img placeholder" id="imgsAdd17">
                                    </div>
                                    <div style="width: 80px; text-align: center; color: #ff0000">楼顶厚度</div>
                                </div>
                                <div>
                                    <div id="imgsDiv18"></div>
                                    <div class="upload-container" id="uploader18">
                                        <img src="" alt="img placeholder" id="imgsAdd18">
                                    </div>
                                    <div style="width: 80px; text-align: center; color: #144856">补充1</div>
                                </div>
                                <div>
                                    <div id="imgsDiv19"></div>
                                    <div class="upload-container" id="uploader19">
                                        <img src="" alt="img placeholder" id="imgsAdd19">
                                    </div>
                                    <div style="width: 80px; text-align: center; color: #144856">补充2</div>
                                </div>
                            </div>
                        </div>
                        <div class="layui-col-lg7 layui-col-sm7">
                            <label class="layui-form-label"><i class="mark">*</i>屋顶视频：</label>
                            <div class="layui-input-block img-box">
                                <div>
                                <div id="imgsDiva1">

                                </div>
                                <div class="upload-container " id="uploadera1">
                                    <img src="" alt="img placeholder" id="imgsAdda1">
                                </div>
                                <div style="width: 80px; text-align: center; color: #144856">屋顶视频</div>
                                </div>
                            </div>
                        </div>

                        <div class="layui-col-lg5 layui-col-sm5">
                            <label class="layui-form-label">房产证：</label>
                            <div class="layui-input-block" style="display: flex">
                                <div id="imgsDiv" class="fczImg"></div>
                                <div class="upload-container" id="uploader">
                                    <img src="" alt="img placeholder" id="imgsAdd">
                                </div>
                            </div>

                        </div>
                        <div class="layui-col-lg4 layui-col-sm4">
                            <label class="layui-form-label">踏勘记录表：</label>
                            <div class="layui-input-block img-box">
                                <div>
                                    <div id="imgsDiv12"></div>
                                    <div class="upload-container" id="uploader12">
                                        <img src="" alt="img placeholder" id="imgsAdd12">
                                    </div>
                                    <div style="width: 80px; text-align: center; color: #FF0000">记录表1</div>
                                </div>
                                <div>
                                    <div id="imgsDiv13"></div>
                                    <div class="upload-container" id="uploader13">
                                        <img src="" alt="img placeholder" id="imgsAdd13">
                                    </div>
                                    <div style="width: 80px; text-align: center; color: #144856">记录表2</div>
                                </div>
                            </div>
                        </div>
                        <div class="layui-col-lg3 layui-col-sm3">
                            <label class="layui-form-label">备案文件：</label>
                            <div class="layui-input-block">
                                <div id="imgsDiv16"></div>
                                <div class="upload-container" id="uploader16">
                                    <img src="" alt="img placeholder" id="imgsAdd16">
                                </div>
                            </div>
                        </div>
                        <div class="layui-col-xs12"></div>
                        <div class="layui-col-lg3 layui-col-sm3">
                            <label class="layui-form-label">划款方式：</label>
                            <div class="layui-input-block">
                                <select name="repaymentMethod" id="repaymentMethod">
                                    <option value="">请选择</option>
                                    <option value="1">二类卡</option>
                                    <option value="2">光E宝</option>
                                    <option value="0">其它</option>
                                </select>
                            </div>
                        </div>

                        <%--<div class="layui-col-lg3 layui-col-sm3">
                            <label class="layui-form-label">二类卡号：</label>
                            <div class="layui-input-block">
                                <input type="text"
                                       disabled class="layui-input" value="">
                            </div>
                        </div>--%>

                        <div class="layui-col-xs12">
                            <label class="layui-form-label" id="changeDescribe">备注：</label>
                            <div class="layui-input-block">
                                <textarea name="remarks" id="remarks" class="layui-textarea"
                                          lay-verify="required"></textarea>
                            </div>
                        </div>

                    </div>
                </div>
            </div>

            <div class="layui-card">
                <blockquote class="layui-elem-quote">方案信息</blockquote>
                <div class="layui-card-body">

                    <div class="layui-row layui-col-space12 layui-form-item">
                        <div class="layui-col-lg12 layui-col-sm12">
                            <label class="layui-form-label">匹配方式：</label>
                            <div class="layui-input-block">
                                <input type="radio" name="schemeType" value="2" title="组合方案" checked
                                       lay-filter="schemeType">
                                <input type="radio" name="schemeType" value="1" title="标准方案"
                                       lay-filter="schemeType">
                            </div>
                        </div>
                        <div class="layui-hide" id="showSchemeId">
                            <div class="layui-row planLie">
                                <div class="planbiao">
                                    <div class="layui-col-lg3 layui-col-sm3">
                                        <label class="layui-form-label">方案类型：</label>
                                        <div class="layui-input-block">
                                            <select lay-filter="planType" name="planType" class="planType" lay-search>
                                                <option value="">请选择</option>
                                                <c:forEach items="${insta}" var="ins">
                                                    <option value="${ins.columns.id}">${ins.columns.name}</option>
                                                </c:forEach>
                                            </select>
                                        </div>
                                    </div>
                                    <div class="layui-col-lg3 layui-col-sm3 ">
                                        <label class="layui-form-label">方案名称：</label>
                                        <div class="layui-input-block pos-r">
                                            <select lay-filter="planName" name="planName" class="planName" lay-search>
                                                <option value="">请选择</option>

                                            </select>
                                        </div>
                                    </div>
                                    <div class="layui-col-lg2 layui-col-sm2 ">
                                        <label class="layui-form-label">参考图纸：</label>
                                        <div class="layui-input-block pos-r view-attachment">
                                           <%-- <span class="h-32 lh-32 ml-5 layui-span-unit">查看</span>--%>
                                        </div>
                                    </div>
                                    <div class="layui-col-lg3 layui-col-sm3" style="text-align: center">
                                        <input type="hidden" class="planId">
                                        <input type="hidden" class="planCode">
                                    </div>
                                </div>
                        </div>
                        </div>
                        <div id="zuhefangan" class="zuhefangan">
                            <div class="layui-row planLie">
                                <div class="planbiao">
                                    <div class="layui-col-lg3 layui-col-sm3">
                                        <label class="layui-form-label">方案类型：</label>
                                        <div class="layui-input-block">
                                            <select lay-filter="planType" name="planType" class="planType" lay-search>
                                                <option value="">请选择</option>

                                            <c:forEach items="${insta}" var="ins">
                                                <option value="${ins.columns.id}">${ins.columns.name}</option>
                                            </c:forEach>
                                            </select>
                                        </div>
                                    </div>
                                    <div class="layui-col-lg3 layui-col-sm3 ">
                                        <label class="layui-form-label">方案名称：</label>
                                        <div class="layui-input-block pos-r">
                                            <select lay-filter="planName" name="planName" class="planName" lay-search>
                                                <option value="">请选择</option>

                                            </select>
                                        </div>
                                    </div>
                                    <div class="layui-col-lg1 layui-col-sm1 ">
                                        <label class="layui-form-label">参考图纸：</label>
                                        <div class="layui-input-block pos-r view-attachment">
                                          <%--  <span class="h-32 lh-32 ml-5 layui-span-unit">查看</span>--%>
                                        </div>
                                    </div>
                                    <div class="layui-col-lg2 layui-col-sm2" style="text-align: center">
                                        <input type="hidden" class="planId">
                                        <input type="hidden" class="planCode">
                                        <button type="button" class="layui-btn savePlan" onclick="savePlan(this)">
                                            新增方案
                                        </button>
                                        <button type="button" class="layui-btn layui-btn-primary deletePlan layui-hide"
                                                onclick="deletePlan(this)">删除
                                        </button>
                                    </div>
                                </div>
                            </div>

                        </div>
                        <div class="layui-row">
                            <div class="layui-col-lg3 layui-col-sm3 ">
                                <label class="layui-form-label">设计容量：</label>
                                <div class="layui-input-block pos-r">
                                    <input class="layui-input layui-bg-gray" name="designCapacity" value="" disabled>
                                    <span class="pos-a h-32 lh-32 layui-span-unit">W</span>
                                </div>
                            </div>
                            <%--<div class="layui-col-lg9 layui-col-sm9 ">
                                <label class="layui-form-label">设计图纸：</label>
                                <div class="layui-input-block pos-r" style="display: flex; align-items: center">
                                    <div id="attachFile">
                                    </div>
                                    <div class="pos-r ml-5">
                                        <span class="h-32 lh-32 layui-span-unit" style="color:#2890ac;">上传</span>
                                        <input type="file" id="uploadFile" style="position: absolute; z-index: 3; left: 0; top:0; opacity: 0; width: 44px;"/>
                                    </div>
                                </div>
                            </div>--%>
                            <div class="layui-col-lg3 layui-col-sm3 ">
                                <label class="layui-form-label"><i class="mark">*</i>设计图纸：</label>
                                <div class="layui-input-block pos-r">
                                    <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;"/>
                                    <ul id="attachFile">

                                    </ul>
                                </div>
                            </div>
                            <div class="layui-col-lg12 layui-col-sm12 mt-10">
                                <label class="layui-form-label"></label>
                                <div class="layui-input-block img-box">
                                    <div>
                                        <div id="imgsDiv24">
                                            <c:if test="${not empty entry.zjpbImg}">
                                                <div class="bj-img imgSpan">
                                                    <span class="layui-icon-close layui-icon" onclick="delImg(this,'uploader24')"></span>
                                                    <img src="${commonStaticImgPath}${entry.zjpbImg}" height="700" width="1200"/>
                                                    <input type="hidden" class="zjpbImg" value="${entry.zjpbImg}"/>
                                                </div>
                                            </c:if>
                                        </div>
                                        <div class="upload-container " id="uploader24">
                                            <img src="" alt="img placeholder" id="imgsAdd24">
                                        </div>
                                        <div style="width: 80px; text-align: center;">组件排布图</div>
                                    </div>
                                    <div>
                                        <div id="imgsDiv25">
                                            <c:if test="${not empty entry.zjzxImg}">
                                                <div class="bj-img imgSpan">
                                                    <span class="layui-icon-close layui-icon" onclick="delImg(this,'uploader25')"></span>
                                                    <img src="${commonStaticImgPath}${entry.zjzxImg}" height="700" width="1200"/>
                                                    <input type="hidden" class="zjzxImg" value="${entry.zjzxImg}"/>
                                                </div>
                                            </c:if>
                                        </div>
                                        <div class="upload-container <c:if test="${not empty entry.zjzxImg}">hide</c:if>" id="uploader25">
                                            <img src="" alt="img placeholder" id="imgsAdd25">
                                        </div>
                                        <div style="width: 80px; text-align: center;">组件走线图</div>
                                    </div>
                                    <div>
                                        <div id="imgsDiv26">
                                            <c:if test="${not empty entry.zjcsImg}">
                                                <div class="bj-img imgSpan">
                                                    <span class="layui-icon-close layui-icon" onclick="delImg(this,'uploader26')"></span>
                                                    <img src="${commonStaticImgPath}${entry.zjcsImg}" height="700" width="1200"/>
                                                    <input type="hidden" class="zjcsImg" value="${entry.zjcsImg}"/>
                                                </div>
                                            </c:if>
                                        </div>
                                        <div class="upload-container <c:if test="${not empty entry.zjcsImg}">hide</c:if>" id="uploader26">
                                            <img src="" alt="img placeholder" id="imgsAdd26">
                                        </div>
                                        <div style="width: 80px; text-align: center;">支架侧视图</div>
                                    </div>
                                    <div>
                                        <div id="imgsDiv27">
                                            <c:if test="${not empty entry.zjhsImg}">
                                                <div class="bj-img imgSpan">
                                                    <span class="layui-icon-close layui-icon" onclick="delImg(this,'uploader27')"></span>
                                                    <img src="${commonStaticImgPath}${entry.zjhsImg}" height="700" width="1200"/>
                                                    <input type="hidden" class="zjhsImg" value="${entry.zjhsImg}"/>
                                                </div>
                                            </c:if>
                                        </div>
                                        <div class="upload-container <c:if test="${not empty entry.zjhsImg}">hide</c:if>" id="uploader27">
                                            <img src="" alt="img placeholder" id="imgsAdd27">
                                        </div>
                                        <div style="width: 80px; text-align: center;">支架后视图</div>
                                    </div>
                                    <div>
                                        <div id="imgsDiv35">
                                            <c:if test="${not empty entry.nbqwzImg}">
                                                <div class="bj-img imgSpan">
                                                    <span class="layui-icon-close layui-icon" onclick="delImg(this,'uploader28')"></span>
                                                    <img src="${commonStaticImgPath}${entry.nbqwzImg}" height="700" width="1200"/>
                                                    <input type="hidden" class="nbqwzImg" value="${entry.nbqwzImg}"/>
                                                </div>
                                            </c:if>
                                        </div>
                                        <div class="upload-container <c:if test="${not empty entry.nbqwzImg}">hide</c:if>" id="uploader35">
                                            <img src="" alt="img placeholder" id="imgsAdd35">
                                        </div>
                                        <div style="width: 80px; text-align: center;">逆变器位置</div>
                                    </div>
                                    <div>
                                        <div id="imgsDiv36">
                                            <c:if test="${not empty entry.pdxwzImg}">
                                                <div class="bj-img imgSpan">
                                                    <span class="layui-icon-close layui-icon" onclick="delImg(this,'uploader29')"></span>
                                                    <img src="${commonStaticImgPath}${entry.pdxwzImg}" height="700" width="1200"/>
                                                    <input type="hidden" class="pdxwzImg" value="${entry.pdxwzImg}"/>
                                                </div>
                                            </c:if>
                                        </div>
                                        <div class="upload-container <c:if test="${not empty entry.pdxwzImg}">hide</c:if>" id="uploader36">
                                            <img src="" alt="img placeholder" id="imgsAdd36">
                                        </div>
                                        <div style="width: 80px; text-align: center;">配电箱位置</div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="assembly">
                            <div class="layui-row assemblyDiv">
                                <div class="layui-col-lg5 layui-col-sm7">
                                    <label class="layui-form-label">组件：</label>
                                    <div class="layui-input-block">
                                        <div class="layui-inline">
                                            <select lay-filter="assembly" name="assembly" class="assembly" lay-search>
                                                <option value="">请选择</option>
                                            </select>
                                            <span class="pos-a h-32 lh-32 layui-span-unit" style="right: 30px">W</span>
                                        </div>
                                        <span class="layui-inline">X </span>
                                        <div class="layui-inline">
                                            <input type="text" class="layui-input" style="width: 85px;" placeholder="数量" name="optionVal">
                                        </div>
    <%--                                    <i class="layui-icon layui-icon-add-circle" style="float: right;position: absolute;right: 0px;top: 3px;color: #1b6073;font-size: 25px;" onclick="add1(this)"></i>--%>
                                    </div>
                                </div>
                                <div class="layui-col-lg3 layui-col-sm3">
                                    <i class="layui-icon layui-icon-add-circle" style="color: #1b6073;font-size: 25px;" onclick="add1(this)"></i>
                                    <i class="layui-icon layui-icon-delete layui-hide" style="color: #1b6073;font-size: 25px;" onclick="delete1(this)"></i>
                                </div>
                            </div>
                        </div>
                        <div class="inverter">
                            <div class="layui-row inverterDiv">
                                <div class="layui-col-lg5 layui-col-sm7">
                                    <label class="layui-form-label">逆变器：</label>
                                    <div class="layui-input-block">
                                        <div class="layui-inline">
                                            <select lay-filter="inverter" name="inverter" class="inverter" lay-search>
                                                <option value="">请选择</option>
                                            </select>
                                        </div>
                                        <span class="layui-inline">X </span>
                                        <div class="layui-inline">
                                            <input type="text" class="layui-input" style="width: 85px;" placeholder="数量" name="optionVal">
                                        </div>
                                    </div>
                                </div>
                                <div class="layui-col-lg3 layui-col-sm3">
                                    <i class="layui-icon layui-icon-add-circle" style="color: #1b6073;font-size: 25px;" onclick="add2(this)"></i>
                                    <i class="layui-icon layui-icon-delete layui-hide" style="color: #1b6073;font-size: 25px;" onclick="delete2(this)"></i>
                                </div>
                            </div>
                        </div>
                        <div class="grid-connection">
                            <div class="layui-row connectionDiv">
                                <div class="layui-col-lg5 layui-col-sm7">
                                    <label class="layui-form-label">并网箱：</label>
                                    <div class="layui-input-block">
                                        <div class="layui-inline">
                                            <select lay-filter="grid-connection" name="gridConnection" class="grid-connection" lay-search>
                                                <option value="">请选择</option>
                                            </select>
                                        </div>
                                        <span class="layui-inline">X </span>
                                        <div class="layui-inline">
                                            <input type="text" class="layui-input" style="width: 85px;" placeholder="数量" name="optionVal">
                                        </div>
                                    </div>
                                </div>
                                <div class="layui-col-lg3 layui-col-sm3">
                                    <i class="layui-icon layui-icon-add-circle" style="color: #1b6073;font-size: 25px;" onclick="add3(this)"></i>
                                    <i class="layui-icon layui-icon-delete layui-hide" style="color: #1b6073;font-size: 25px;" onclick="delete3(this)"></i>
                                </div>
                            </div>
                        </div>
                        <div class="grid-support">
                            <div class="layui-row supportDiv">
                                <div class="layui-col-lg5 layui-col-sm7">
                                    <label class="layui-form-label">支架：</label>
                                    <div class="layui-input-block">
                                        <div class="layui-inline">
                                            <select lay-filter="grid-support" name="gridSupport" class="grid-support" lay-search>
                                                <option value="">请选择</option>
                                            </select>
                                        </div>
                                        <span class="layui-inline">X </span>
                                        <div class="layui-inline">
                                            <input type="text" class="layui-input" style="width: 85px;" placeholder="数量" name="optionVal">
                                        </div>
                                    </div>
                                </div>
                                <div class="layui-col-lg3 layui-col-sm3">
                                    <i class="layui-icon layui-icon-add-circle" style="color: #1b6073;font-size: 25px;" onclick="add4(this)"></i>
                                    <i class="layui-icon layui-icon-delete layui-hide" style="color: #1b6073;font-size: 25px;" onclick="delete4(this)"></i>
                                </div>
                            </div>
                        </div>
                        <div class="layui-col-xs12">
                            <label class="layui-form-label">备注：</label>
                            <div class="layui-input-block">
                                    <textarea name="schemeRemarks" id="schemeRemarks" placeholder=""
                                              class="layui-textarea" lay-verify="required"></textarea>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="operate-footer">
        <button type="button" class="layui-btn temporaryOrder">暂存</button>
      <%--  <button type="button" class="layui-btn saveOrder">提交审核</button>--%>
        <button type="button" class="layui-btn layui-btn-primary" onclick="cancel()">取消</button>
    </div>
</div>


<script src="${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/layui/layui.js"></script>
<script src="${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/dist/viewer.js"></script>
<script src="${ctxPlugin}/lib/xm-select.js"></script>
<script>
    //图片查看效果
    var viewer = new Viewer(document.getElementById('LAY_app'));
    var imgsCount = 0;
    var serviceType = '${order.serviceType}';
    var reg = /^(?:[1-9]\d*|0)(?:\.\d+)?$/;
    var number = /^[1-9]\d*$/;//非0正整数正则
    var plan_html = "<option value=''>请选择</option>";
    var plan_type_html = "<option value=''>请选择</option>";
    var currentPlanTypeHtml = '';
    var assemblyOptionHtml = '';// 组件下拉选html
    var inverterOptionHtml = '';// 逆变器下拉选html
    var gridConnectionOptionHtml = '';// 并网箱下拉选html
    var supportOptionHtml = '';// 支架下拉选html
    // 联行号
    var tssBankNum = '';
    // 银行名称
    var tssBankNumName = '';
    var quaimgsCount=0;
    layui.config({
        base: '${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'form', 'layedit', 'laydate', 'jquery', 'upload', 'layer'], function () {
        $ = layui.$
            , element = layui.element
            , form = layui.form
            , layer = layui.layer
            , laydate = layui.laydate;
        var upload = layui.upload;

        initElectricSelect();

        //执行实例 房产证
        var uploadInst = upload.render({
            elem: '#uploader' //绑定元素
            , url: '${ctx}/common/uploadFile' //上传接口
            , before: function (obj) {
                //预读本地文件示例，不支持ie8
                obj.preview(function (index, file, result) {
                });
            }
            , done: function (res) {
                //上传完毕回调
                quaimgsCount++;
                addImg(res.path, "uploader", "imgsDiv", "house-ownership");
                if (quaimgsCount >= 5) {
                    $("#uploader").hide();
                } else {
                    $("#uploader").show();
                }
            }
            , error: function () {
                //请求异常回调
            }
        });

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

        upload.render({
            elem: '#uploader2' //绑定元素
            , url: '${ctx}/common/uploadFile' //上传接口
            , before: function (obj) {
                //预读本地文件示例，不支持ie8
                obj.preview(function (index, file, result) {
                });
            }
            , done: function (res) {
                //上传完毕回调
                addImg(res.path, "uploader2", "imgsDiv2", "pic2");
            }
            , error: function () {
                //请求异常回调
            }
        });
        upload.render({
            elem: '#uploader3' //绑定元素
            , url: '${ctx}/common/uploadFile' //上传接口
            , before: function (obj) {
                //预读本地文件示例，不支持ie8
                obj.preview(function (index, file, result) {
                });
            }
            , done: function (res) {
                //上传完毕回调
                addImg(res.path, "uploader3", "imgsDiv3", "pic3");
            }
            , error: function () {
                //请求异常回调
            }
        });
        upload.render({
            elem: '#uploader4' //绑定元素
            , url: '${ctx}/common/uploadFile' //上传接口
            , before: function (obj) {
                //预读本地文件示例，不支持ie8
                obj.preview(function (index, file, result) {
                });
            }
            , done: function (res) {
                //上传完毕回调
                addImg(res.path, "uploader4", "imgsDiv4", "pic4");
            }
            , error: function () {
                //请求异常回调
            }
        });

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

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

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

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

        upload.render({
            elem: '#uploader9' //绑定元素
            , url: '${ctx}/common/uploadFile' //上传接口
            , before: function (obj) {
                //预读本地文件示例，不支持ie8
                obj.preview(function (index, file, result) {
                });
            }
            , done: function (res) {
                //上传完毕回调
                addImg(res.path, "uploader9", "imgsDiv9", "pic9");
                // 下方用于视频
                /*$("#uploader9").hide();
                var html = '<div class="bj-img imgSpan"><span class="layui-icon-close layui-icon" onclick="delImg(this,\'uploader9\')"></span>';
                html+=' <video controls width="80px" height="80px" id="videoId" src="${commonStaticImgPath}'+ res.path+'"></video>';
                html += '<input type="hidden" class="roof-value" value="' + res.path + '"/> </div>';
                $("#imgsDiv9").append(html);*/

            }
            , error: function () {
                //请求异常回调
            }
        });

        upload.render({
            elem: '#uploader20' //绑定元素
            , url: '${ctx}/common/uploadFile' //上传接口
            , accept: 'video'
            , before: function (obj) {
                //预读本地文件示例，不支持ie8
                obj.preview(function (index, file, result) {
                });
            }
            , done: function (res) {
                //上传完毕回调
                $("#uploader20").hide();
                var html = '<div class="bj-img imgSpan"><span class="layui-icon-close layui-icon" onclick="delImg(this,\'uploader20\')"></span>';
                html+=' <video controls width="80px" height="80px" id="videoId20" src="${commonStaticImgPath}'+ res.path+'"></video>';
                html += '<input type="hidden" class="roof-value20" value="' + res.path + '"/> </div>';
                $("#imgsDiv20").append(html);

            }
            , error: function () {
                //请求异常回调
            }
        });

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

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

        upload.render({
            elem: '#uploader12' //绑定元素
            , url: '${ctx}/common/uploadFile' //上传接口
            , before: function (obj) {
                //预读本地文件示例，不支持ie8
                obj.preview(function (index, file, result) {
                });
            }
            , done: function (res) {
                //上传完毕回调
                addImg(res.path, "uploader12", "imgsDiv12", "survey-record");
            }
            , error: function () {
                //请求异常回调
            }
        });

        upload.render({
            elem: '#uploader13' //绑定元素
            , url: '${ctx}/common/uploadFile' //上传接口
            , before: function (obj) {
                //预读本地文件示例，不支持ie8
                obj.preview(function (index, file, result) {
                });
            }
            , done: function (res) {
                //上传完毕回调
                addImg(res.path, "uploader13", "imgsDiv13", "survey-record2");
            }
            , error: function () {
                //请求异常回调
            }
        });

        upload.render({
            elem: '#uploader14' //绑定元素
            , url: '${ctx}/common/uploadFile' //上传接口
            , before: function (obj) {
                //预读本地文件示例，不支持ie8
                obj.preview(function (index, file, result) {
                });
            }
            , done: function (res) {
                //上传完毕回调
                addImg(res.path, "uploader14", "imgsDiv14", "id-card-front");
            }
            , error: function () {
                //请求异常回调
            }
        });

        upload.render({
            elem: '#uploadera1' //绑定元素
            , url: '${ctx}/common/uploadFile' //上传接口
            , accept: 'video'
            , before: function (obj) {
                //预读本地文件示例，不支持ie8
                obj.preview(function (index, file, result) {
                });
            }
            , done: function (res) {
                //上传完毕回调

                $("#uploadera1").hide();
                var html = '<div class="bj-img imgSpan"><span class="layui-icon-close layui-icon" onclick="delImg(this,\'uploadera1\')"></span>';
                html+=' <video controls width="80px" height="80px" id="videoId1" src="${commonStaticImgPath}'+ res.path+'"></video>';
                html += '<input type="hidden" class="roof-value" value="' + res.path + '"/> </div>';
                $("#imgsDiva1").append(html);
                //addImg(res.path, "uploadera1", "imgsDiva1", "videoId1");
                //图片查看效果
                viewer.update();
            }
            , error: function () {
                //请求异常回调
            }
        });

        upload.render({
            elem: '#uploader15' //绑定元素
            , url: '${ctx}/common/uploadFile' //上传接口
            , before: function (obj) {
                //预读本地文件示例，不支持ie8
                obj.preview(function (index, file, result) {
                });
            }
            , done: function (res) {
                //上传完毕回调
                addImg(res.path, "uploader15", "imgsDiv15", "id-card-back");
            }
            , error: function () {
                //请求异常回调
            }
        });

        upload.render({
            elem: '#uploader16' //绑定元素
            , url: '${ctx}/common/uploadFile' //上传接口
            , before: function (obj) {
                //预读本地文件示例，不支持ie8
                obj.preview(function (index, file, result) {
                });
            }
            , done: function (res) {
                //上传完毕回调
                addImg(res.path, "uploader16", "imgsDiv16", "filing-document-photo");
            }
            , error: function () {
                //请求异常回调
            }
        });

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

        upload.render({
            elem: '#uploader21' //绑定元素
            , url: '${ctx}/common/uploadFile' //上传接口
            , before: function (obj) {
                //预读本地文件示例，不支持ie8
                obj.preview(function (index, file, result) {
                });
            }
            , done: function (res) {
                //上传完毕回调
                addImg(res.path, "uploader21", "imgsDiv21", "roof-photo-facade-02");
            }
            , error: function () {
                //请求异常回调
            }
        });

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

        upload.render({
            elem: '#uploader22' //绑定元素
            , url: '${ctx}/common/uploadFile' //上传接口
            , before: function (obj) {
                //预读本地文件示例，不支持ie8
                obj.preview(function (index, file, result) {
                });
            }
            , done: function (res) {
                //上传完毕回调
                addImg(res.path, "uploader22", "imgsDiv22", "roof-photo-interior-02");
            }
            , error: function () {
                //请求异常回调
            }
        });

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

        upload.render({
            elem: '#uploader23' //绑定元素
            , url: '${ctx}/common/uploadFile' //上传接口
            , before: function (obj) {
                //预读本地文件示例，不支持ie8
                obj.preview(function (index, file, result) {
                });
            }
            , done: function (res) {
                //上传完毕回调
                addImg(res.path, "uploader23", "imgsDiv23", "dimensions-photo-thickness-02");
            }
            , error: function () {
                //请求异常回调
            }
        });

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

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

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

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

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

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

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



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

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

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

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


        function addImg(data, id, imgsDiv, classimg) {
            $("#" + id).hide();
            var html = '<div class="bj-img imgSpan"><span class="layui-icon-close layui-icon" onclick="delImg(this,\'' + id + '\')"></span>';
            html += '<img src="${commonStaticImgPath}' + data + '" height="700" width="1200"/>';
            html += '<input type="hidden" class="' + classimg + '" value="' + data + '"/> </div>';
            $("#" + imgsDiv).append(html);
            //图片查看效果
            viewer.update();
        }

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

            var len=$(".attachFileImg").length;
            if(len>=10){
                layer.msg("最多上传10个文件!")
                return;
            }
            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) {
                    /!*$('#attachFile').append('<li style="width: 190px;text-overflow: ellipsis;white-space: nowrap;overflow: hidden;"><span class="uploadFileName"  title="'+file.name+'">'+file.name+'</span><input type="hidden" name="attach"  value="'+data.path+'"> <input type="hidden" name="attachName" value="'+file.name+'"/> ');
                    *!/
                    console.log(file.type.indexOf("image"));
                    var html='';
                    if(file.type.indexOf("image")!=-1){
                         html = '<div class="bj-img imgSpan"><span class="layui-icon-close layui-icon" onclick="delImg(this)"></span>';
                         html += '<img src="${commonStaticImgPath}' + data.path + '" height="700" width="1200"/>';
                         html += '<input type="hidden" class="attachFileImg" value="' + data.path + '"/> </div>';
                    }else{
                        html+='<div class="fileDivs bj-img" style="border: none;">'
                        html+='<span class="layui-icon-close layui-icon" onclick="delImg(this)"></span>';
                        html+='<a class="h-32 lh-32 layui-span-unit lookBtn" href="${commonStaticImgPath}'+data.path+'">查看</a>';
                        html += '<input type="hidden" class="attachFileImg" value="' + data.path + '"/>';
                        html+='</div>';
                    }
                    $('#attachFile').append(html);

                }
            });
        });*/


        $('#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) {
                    $('#attachFile').empty().append('<li><span class="uploadFileName">'+file.name+'</span><input type="hidden" name="attach"  value="'+data.path+'"> <input type="hidden" name="attachName" value="'+file.name+'"/> ');
                }
            });
        });

        //日期
        laydate.render({
            elem: '#applianceBuyTime'
            , trigger: 'click'
        });
        //预约时间
        laydate.render({
            elem: '#promiseTime'
            , trigger: 'click'
        });
        laydate.render({
            elem: '#repairTime'
            , value: '${data}'
            , type: 'datetime'
            , trigger: 'click'
        });
        form.render(null, 'component-form-element');
        //自定义验证规则
        form.verify({
            title: function (value) {
                if (value.length < 5) {
                    return '标题至少得5个字符啊';
                }
            }
            , pass: [
                /^[\S]{6,12}$/
                , '密码必须6到12位，且不能出现空格'
            ]

            , content: function (value) {
                layedit.sync(editIndex);
            }
        });

        form.on('radio(schemeType)', function (data) {
            var type = data.value;
            if ('1' == type) {
                //标准
                $("#showSchemeId").removeClass("layui-hide");
                $("#zuhefangan").addClass("layui-hide");
                //清除
                /*    $(".planType").empty();
                    $(".planName").empty();
                    $(".componentNum").val('');
                    $("#componentCount").val('');
                    $(".addplan").remove();
                    $("#componentSpec").val('');
                    form.render('select');*/

            } else {
                $("#zuhefangan").removeClass("layui-hide");
                $("#showSchemeId").addClass("layui-hide");
                /*              $("#schemeId").val('');
                              $(".deletePlan").hide();
                              $(".savePlan").show();
                              form.render('select');*/
            }
        });


        form.on('select(projectId)', function (data) {
            var code = $(data.elem).find("option:selected").attr("title");

            $("#projectCode").val(code);

            var companyName=$(data.elem).find("option:selected").attr("lay-data");
            var pay_cycle=$(data.elem).find("option:selected").attr("lay-tips");
            var filing_type=$(data.elem).find("option:selected").attr("lay-type");
            if('1'==pay_cycle){
                pay_cycle="按月支付";
            }else if('2'==pay_cycle){
                pay_cycle="按季支付";
            }else if('3'==pay_cycle){
                pay_cycle="按年支付";
            }
            $("#projectName").val($(data.elem).find("option:selected").text());
            $("#companyName").val(companyName);
            $("#payCycle").val(pay_cycle);
            $("#filingType").val('1'==filing_type?"农户备案":"项目公司备案");
            if(filing_type=='1'){
                $("#repaymentMethod").val('1');
            }
            form.render('select');
     /*       if (!isBlank(modeId)) {
                var $planTypeSelect = $('.planLie').find('select[name=planType]');
                $planTypeSelect.empty();
                var htmls = " <option value=''>请选择</option>";
                var result = modeId.split(",");
                var dataName = data.split(",");
                for (var i = 0; i < result.length; i++) {
                    var city = result[i];
                    htmls = htmls + '<option value="' + city + '" >' + dataName[i] + '</option>';
                }
                $planTypeSelect.append(htmls);
                currentPlanTypeHtml += htmls;
                form.render('select');
            }*/

        })

        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);

        });

        form.on('select(azimuth)', function (data) {
            var azimuth = $(data.elem).find("option:selected").val();
            if (azimuth === '1') {
                $('#angle').val('').addClass('layui-bg-gray').attr("readonly",true);
            } else {
                $('#angle').removeClass('layui-bg-gray').attr("readonly",false);
            }
        });

        form.on('select(planType)', function (data) {

            var value = $(data.elem).find("option:selected").val();
            if (isBlank(value)) {
                return
            }
            var that_ = $(this);
            //获取当前类型下的方案名称
            $.ajax({
                url: "${ctx}/planManage/findPlanByAssembly",
                type: "POST",
                data: {
                    planType: value
                }
                , success: function (result) {
                    that_.parents(".planbiao").find(".planName").empty();

                    var length = result.length;
                    var plan_name_html = "<option value=''>请选择</option>";
                    for (var i = 0; i < length; i++) {
                        plan_name_html += "<option value='" + result[i].columns.id + "' title='" + result[i].columns.assembly_count + "' date='" + result[i].columns.code + "' data-attach='"+result[i].columns.attach+"' data-attach2='"+result[i].columns.attach2+"'>" + result[i].columns.name + "</option>";
                    }

                    that_.parents(".planbiao").find(".planName").append(plan_name_html);
                    form.render('select');
                }
            })
            /*  }else{
                  //名称已选，获取块数
                  var num = $(data.elem).find("option:selected").attr("title");
                  var code = $(data.elem).find("option:selected").attr("date");
                  var id = data.value;
                  console.log(num)
                  console.log(id)
                  $(this).parents(".planbiao").find(".planId").val(id);
                  $(this).parents(".planbiao").find(".componentNum").val(num);
                  $(this).parents(".planbiao").find(".yuanshiNum").val(num);
                  $(this).parents(".planbiao").find(".planCode").val(code);
                  componentNum();
              }*/

        })


        form.on('select(planName)', function (data) {

            //   var value = data.value;
            var value = $(data.elem).find("option:selected").text();
            if (isBlank(value)) {
                return
            }
            var that_ = $(this);

            //名称已选，获取块数
            var num = $(data.elem).find("option:selected").attr("title");
            var code = $(data.elem).find("option:selected").attr("date");
            var id = data.value;
            $(this).parents(".planbiao").find(".planId").val(id);
            $(this).parents(".planbiao").find(".componentNum").val(num);
            $(this).parents(".planbiao").find(".yuanshiNum").val(num);
            $(this).parents(".planbiao").find(".planCode").val(code);
            componentNum();
            var attach = $(data.elem).find("option:selected").data('attach');
            var attach2 = $(data.elem).find("option:selected").data('attach2');
            var viewAttachHtml = '';
            if (!isBlank(attach)) {
                viewAttachHtml += '<a class="h-32 lh-32 ml-5 layui-span-unit" href="${commonStaticImgPath}'+attach+'" style="color:#2890ac;">查看</a>';
            }
            if (!isBlank(attach2)) {
                viewAttachHtml += '<a class="h-32 lh-32 ml-5 layui-span-unit" href="${commonStaticImgPath}'+attach2+'" style="color:#2890ac;">查看</a>';
            }
            that_.closest('.layui-row').find('.view-attachment').empty().append(viewAttachHtml);
            // }

        })


        //重新计算组件块数
        function componentNum() {
            var numco = 0;
            $(".componentNum").each(function () {
                if (!isBlank($(this).val())) {
                    numco = numco + parseInt($(this).val());
                }
            });
            $("#componentCount").val(parseInt(numco));
        }

        // 组件数量输入框值改变事件
        $(document).on('change', '.assembly input[name=optionVal]', function () {
            if (isBlank($(this).val())) {
                return;
            }
            statisticsCapacity();
        });

        // 组件下拉选切换事件
        form.on('select(assembly)', function (data) {
            if (isBlank(data.value)) {
                return;
            }
            statisticsCapacity();
        });

        // 统计设计容量
        function statisticsCapacity() {
            var capacity = 0;
            $('.assembly').find('.layui-row').each(function (index, that) {
                var value = $(that).find('select[name=assembly]').val();
                if (isBlank(value)) {

                    return;
                }
                var power = $(that).find('select[name=assembly] option:selected').data('power');
                // console.log(power);
                var num = $(that).find('input[name=optionVal]').val();
                if (isBlank(that)) {

                    return;
                }
                if (!number.test(num)) {
                    return;
                }
                capacity = capacity + parseInt(power) * parseInt(num);
            });
            $('input[name=designCapacity]').val(capacity);
        }

        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, arean) {
            $("#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 + '" >' + area.columns.DistrictName + '</option>';
                    }
                    $("#area").append(html);
                    if (!isBlank(arean)) {
                        $("#area").val(arean)
                    }

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

        }


        var savetemFlag = false;
        $(".temporaryOrder").click(function () {
            if (savetemFlag) {
                return;
            }
            var projectId = $("#projectId").val();  //信息来源
            if (isBlank(projectId)) {
                layer.msg("请选择项目名称!", {icon: 2});
                return ;
            }
            var projectName=$("input[name=projectName]").val();
            // 预估组件
            let estimateCapacity = $("#estimateCapacity").val();
            // 使用正则表达式校验正整数
            var regex = /^[1-9]\d*$/;
            if(!isBlank(estimateCapacity) && !regex.test(estimateCapacity)) {
                layer.msg("预估组件请输入正整数!", {icon: 2});
                return ;
            }
            // 租户信息
            var tenantName = $("input[name=tenantName]").val();//业主姓名
            if (isBlank(tenantName)) {
                layer.msg("业主姓名不能为空", {icon: 2});
                return
            }
            var mobile = $("input[name=mobile]").val();//联系方式
            if (!isBlank(mobile) && !isPhoneNo($.trim(mobile))) {
                layer.msg("联系方式格式不正确", {icon: 2});
                return
            }
            var idCode = $("input[name=idCode]").val();//身份证号
            // if (!isBlank(idCode) && !IsCard($.trim(idCode))) {
            //     layer.msg("身份证号格式不正确", {icon: 2});
            //     return
            // }
            var age=$("input[name='age']").val(); //年龄
            var gender=$("input[name='gender']:checked").val(); //性别
            var roofType = $("#roofType").val(); //屋顶类型
            var province = $("#province").find("option:selected").val();//省
            var city = $("#city").find("option:selected").val();//市
            var area = $("#area").find("option:selected").val();//区
            var address = $("input[name=customerAddress]").val();//用户地址
            var distance = $("#distance").val(); // 并网距离
            if (!isBlank(distance) && !isNumber($.trim(distance))) {
                layer.msg("并网距离格式不正确", {icon: 2});
                return
            }
            var azimuth = $("#azimuth").val(); //方位角
            var angle = $('input[name=angle]').val();//角度
            var buildingHeight = $("input[name=buildingHeight]").val();//建筑高度
            if (!isBlank(buildingHeight) && !isNumber($.trim(buildingHeight))) {
                layer.msg("建筑高度格式不正确", {icon: 2});
                return
            }
            var bankName = $("#bankName").val(); //开户银行
            var bankCode = $("#bankCode").val(); //银行账号
            var repaymentMethod = $("#repaymentMethod").val(); //还款方式
            var remarks = $("textarea[name=remarks]").val();//备注
            var shootType = $("input[name=shootType]:checked").val();// 拍摄方式

            var houseOwnership;//房产证
            $(".house-ownership").each(function () {
                if (isBlank(houseOwnership)) {
                    houseOwnership = $(this).val();
                } else {
                    houseOwnership = houseOwnership + "," + $(this).val();
                }
            });
            var idCardFront = $('.id-card-front').val();//身份证正面
            var idCardBack = $('.id-card-back').val();//身份证反面


            var residenceBooklet ;//户口本复印件

            $(".residenceBooklet").each(function () {
                if (isBlank(residenceBooklet)) {
                    residenceBooklet = $(this).val();
                } else {
                    residenceBooklet = residenceBooklet + "," + $(this).val();
                }
            });

            var bankCard=$(".bankCard").val(); //银行卡照片
            var surveyRecord = $('.survey-record').val();//踏勘记录1
            var surveyRecord2 = $('.survey-record2').val();//踏勘记录2

            var bpName = $('#bpName').val();//共签人名称
            var bpIdCard = $('#bpIdCard').val();//共签人证件号码
            var bpMobile = $('#bpMobile').val();//共签人手机号
            var bpCardFront = $('.bpCardFront').val();//共签人身份证正面
            var bpCardBack = $('.bpCardBack').val();//共签人身份证反面
            var bpFile ;//共签人子女证明材料

            $(".bpFile").each(function () {
                if (isBlank(bpFile)) {
                    bpFile = $(this).val();
                } else {
                    bpFile = bpFile + "," + $(this).val();
                }
            });

            // 房屋正面
            let roofPhotoOne = $('.pic1').val();
            // 东南角
            let roofPhotoTwo = $('.pic2').val();
            // 西南角
            let roofPhotoThree = $('.pic3').val();
            // 正南侧
            let roofPhotoFour = $('.pic4').val();
            // 生活气息照1
            let roofPhotoFacade = $('.pic5').val();
            // 生活气息照2
            let roofPhotoInterior = $('.pic6').val();
            // 补充1
            let roofPhotoFive = $('.pic7').val();
            // 补充2
            let roofPhotoSix = $('.pic8').val();
            // 房屋补充1
            let houseSupplementOne = $('.pic9').val();
            // 房屋补充2
            let houseSupplementTwo = $('.pic10').val();
            // 障碍物照片
            let roofPhotoSeven = $('.pic11').val();
            // 楼顶厚度/围墙
            let dimensionsPhotoThickness = $('.pic17').val();
            // 细节补充1
            let detailSupplementOne = $('.pic18').val();
            // 细节补充2
            let detailSupplementTwo = $('.pic19').val();

            var filingDocumentPhoto = $('.filing-document-photo').val();//备案文件

            // 方案信息
            var schemeType = $("input[name=schemeType]:checked").val();//匹配方式
            var componentPlanArray = [];
            var schemeId = "";
            var schemeTypeId = '';
            if (schemeType === '2') {
                // 组合方案
                $('#zuhefangan').find('.layui-row').each(function (index, that) {
                    var planTypeId = $(that).find('select[name=planType]').val();
                    if (isBlank(planTypeId)) {
                        return true;
                    }
                    var planType = $(that).find('.planType').find("option:selected").text();
                    var planId = $(that).find(".planId").val();
                    var name = $(that).find(".planName").find("option:selected").text();
                    var code = $(that).find(".planCode").val();
                    var componentPlan = {
                        planTypeId: planTypeId,
                        planType: planType,
                        planId: planId,
                        name: name,
                        code: code
                    }
                    componentPlanArray.push(componentPlan);
                });
            } else {
                // 标准方案
                schemeId = $('#showSchemeId').find('.planId').val();
                schemeTypeId = $('#showSchemeId').find('select[name=planType]').val();
            }
            // 设计图纸
           /* var designDrawings = $('input[name=attach]').val();*/
             var zjpbImg = $('.zjpbImg').val();//组件排布图
            var zjzxImg = $('.zjzxImg').val();//组件走线图
            var zjcsImg = $('.zjcsImg').val();//支架侧视图
            var zjhsImg = $('.zjhsImg').val();//支架后视图
            var nbqwzImg = $('.nbqwzImg').val();//逆变器位置
            var pdxwzImg = $('.pdxwzImg').val();//配电箱位置

            /*var designDrawings='';
            $(".attachFileImg").each(function(){
                var imgSrc=$(this).val();
                designDrawings+=','+imgSrc;
            })
            if(!isBlank(designDrawings)){
                designDrawings=designDrawings.substring(1);
            }
            var designDrawingsName = '';*/
            var designDrawings = $('input[name=attach]').val();
            var designDrawingsName = $('input[name=attachName]').val();
            // 电器材料
            var electricArray = [];
            // 组件
            $('.assembly').find('.layui-row').each(function (index, that) {
                var itemId = $(that).find('select[name=assembly]').val();
                if (!isBlank(itemId)) {
                    var itemType = '3';
                    var num = $(that).find('input[name=optionVal]').val();
                    var item = {
                        itemId: itemId,
                        itemType: itemType,
                        num: num
                    }
                    electricArray.push(item);
                }
            });
            // 逆变器
            $('.inverter').find('.layui-row').each(function (index, that) {
                var itemId = $(that).find('select[name=inverter]').val();
                if (!isBlank(itemId)) {
                    var itemType = '1';
                    var num = $(that).find('input[name=optionVal]').val();
                    var item = {
                        itemId: itemId,
                        itemType: itemType,
                        num: num
                    }
                    electricArray.push(item);
                }
            });
            // 并网箱
            $('.grid-connection').find('.layui-row').each(function (index, that) {
                var itemId = $(that).find('select[name=gridConnection]').val();
                if (!isBlank(itemId)) {
                    var itemType = '2';
                    var num = $(that).find('input[name=optionVal]').val();
                    var item = {
                        itemId: itemId,
                        itemType: itemType,
                        num: num
                    }
                    electricArray.push(item);
                }
            });
            // 支架
            $('.grid-support').find('.layui-row').each(function (index, that) {
                var itemId = $(that).find('select[name=gridSupport]').val();
                if (!isBlank(itemId)) {
                    var itemType = '4';
                    var num = $(that).find('input[name=optionVal]').val();
                    var item = {
                        itemId: itemId,
                        itemType: itemType,
                        num: num
                    }
                    electricArray.push(item);
                }
            });
            var index=layer.load(2, {shade: [0.5,'#fff'], content:''});

            var schemeRemarks = $("#schemeRemarks").val();//方案备注

            var order = {
                projectId: projectId,
                projectName:projectName,
                estimateCapacity: estimateCapacity,
                tenantName: tenantName,
                mobile: mobile,
                idCode: idCode,
                roofType: roofType,
                province: province,
                city: city,
                area: area,
                address: address,
                distance: distance,
                azimuth: azimuth,
                angle: angle,
                buildingHeight: buildingHeight,
                repaymentMethod: repaymentMethod,
                remarks: remarks,
                shootType: shootType,
                houseOwnership: houseOwnership,
                filingDocumentPhoto: filingDocumentPhoto,
                roofPhotoFacade: roofPhotoFacade,
                roofPhotoInterior: roofPhotoInterior,
                dimensionsPhotoThickness: dimensionsPhotoThickness,
                idCardFront: idCardFront,
                idCardBack: idCardBack,
                surveyRecord: surveyRecord,
                surveyRecord2: surveyRecord2,
                roofPhotoOne: roofPhotoOne,
                roofPhotoTwo: roofPhotoTwo,
                roofPhotoThree: roofPhotoThree,
                roofPhotoFour: roofPhotoFour,
                roofPhotoFive: roofPhotoFive,
                roofPhotoSix: roofPhotoSix,
                roofPhotoSeven: roofPhotoSeven,
                houseSupplementOne: houseSupplementOne,
                houseSupplementTwo: houseSupplementTwo,
                detailSupplementOne: detailSupplementOne,
                detailSupplementTwo: detailSupplementTwo,
                schemeType: schemeType,
                schemeId: schemeId,
                schemeTypeId: schemeTypeId,
                composePlanLists: componentPlanArray,
                designDrawings: designDrawings,
                designDrawingsName: designDrawingsName,
                itemList: electricArray,
                type: '0',
                schemeRemarks: schemeRemarks,
                bankName: bankName,
                bankCode: bankCode,
                residenceBooklet:residenceBooklet,
                bankCard:bankCard,
                age:age,
                gender:gender,
                zjpbImg: zjpbImg,
                zjzxImg: zjzxImg,
                zjcsImg: zjcsImg,
                zjhsImg: zjhsImg,
                nbqwzImg: nbqwzImg,
                pdxwzImg: pdxwzImg,
                bpName: bpName,
                bpIdCard: bpIdCard,
                bpMobile: bpMobile,
                bpCardFront: bpCardFront,
                bpCardBack: bpCardBack,
                bpFile: bpFile,
                tssBankNum:tssBankNum,
                tssBankNumName:tssBankNumName
            };



            savetemFlag = true;
            saveFlag = true;
            console.log( JSON.stringify(order));
            $.ajax({
                url: "${ctx}/customerEntry/saveCustomerEntry",
                type: "POST",
                contentType: "application/json;charsetset=UTF-8",
                data: JSON.stringify(order)
                , success: function (result) {
                    if (result.code === '200') {
                        var index = parent.layer.getFrameIndex(window.name);
                        layer.msg("保存成功", {icon: 1, time: 1000}, function () {
                            parent.layer.close(index);
                            parent.table.reload('test');
                        })
                    } else {
                        layer.msg(result.errMsg, {icon: 2});
                    }
                    savetemFlag = false;
                    saveFlag = false;
                }, error: function () {
                    layer.msg("保存失败", {icon: 2});
                    savetemFlag = false;
                    saveFlag = false;
                },complete: function () {
                    layer.close(index);
                }
            })
        })


        //保存
        var saveFlag = false;
        $(".saveOrder").click(function () {
            if (saveFlag) {
                return;
            }

            var projectId = $("#projectId").val();  //信息来源

            if (isBlank(projectId)) {
                layer.msg("请选择项目名称!", {icon: 2});
                return ;
            }
            var projectName=$("input[name=projectName]").val();
            var tenantName = $("input[name=tenantName]").val();//业主姓名
            if (isBlank(tenantName)) {
                layer.msg("业主姓名不能为空", {icon: 2});
                return
            }
            var mobile = $("input[name=mobile]").val();//联系方式
            if (isBlank(mobile)) {
                layer.msg("联系方式不能为空", {icon: 2});
                return;
            }
            if (!isPhoneNo($.trim(mobile))) {
                layer.msg("联系方式格式不正确", {icon: 2});
                return;
            }
            var idCode = $("input[name=idCode]").val();//身份证号
            // if (isBlank(idCode)) {
            //     layer.msg("身份证号不能为空", {icon: 2});
            //     return;
            // }
            // if (!IsCard($.trim(idCode))) {
            //     layer.msg("身份证号格式不正确", {icon: 2});
            //     return;
            // }
            var age=$("input[name='age']").val(); //年龄
            var gender=$("input[name='gender']:checked").val(); //性别
            var roofType = $("#roofType").val(); //屋顶类型
            if (isBlank(roofType)) {
                layer.msg("屋顶类型不能为空", {icon: 2});
                return;
            }
            var province = $("#province").find("option:selected").val();//省
            if (isBlank(province)) {
                layer.msg("省不能为空", {icon: 2});
                return;
            }
            var city = $("#city").find("option:selected").val();//市
            if (isBlank(city)) {
                layer.msg("市不能为空", {icon: 2});
                return;
            }
            var area = $("#area").find("option:selected").val();//区
            if (isBlank(area)) {
                layer.msg("区不能为空", {icon: 2});
                return;
            }
            var address = $("input[name=customerAddress]").val();//用户地址
            if (isBlank(address)) {
                layer.msg("详细地址不能为空", {icon: 2});
                return;
            }
            var distance = $("#distance").val(); // 并网距离
            if (!isBlank(distance) && !isNumber($.trim(distance))) {
                layer.msg("并网距离格式不正确", {icon: 2});
                return;
            }
            var azimuth = $("#azimuth").val(); //方位角
            if (isBlank(azimuth)) {
                layer.msg("方位角不能为空", {icon: 2});
                return;
            }
            var angle = $('input[name=angle]').val();
            if (azimuth !== '1') {
                if (isBlank(angle)) {
                    layer.msg("角度不能为空", {icon: 2});
                    return;
                }
                if (!number.test(angle)) {
                    layer.msg("角度格式不正确", {icon: 2});
                    return;
                }
                if (parseInt(angle) >= 90) {
                    layer.msg("方位角角度,限制输入0-90", {icon: 2});
                    return;
                }
            }
            var buildingHeight = $("input[name=buildingHeight]").val();//建筑高度
            if (!isBlank(buildingHeight) && !isNumber($.trim(buildingHeight))) {
                layer.msg("建筑高度格式不正确", {icon: 2});
                return;
            }
            var repaymentMethod = $("#repaymentMethod").val(); //还款方式
            if (isBlank(repaymentMethod)) {
                layer.msg("划转方式不能为空", {icon: 2});
                return;
            }
            var bankName = $("#bankName").val(); //开户银行
            if (isBlank(bankName)) {
                layer.msg("开户银行不能为空", {icon: 2});
                return;
            }
            var bankCode = $("#bankCode").val(); //银行账号
            if (isBlank(bankCode)) {
                layer.msg("银行账号不能为空", {icon: 2});
                return;
            }
            var residenceBooklet ;//户口本复印件

            $(".residenceBooklet").each(function () {
                if (isBlank(residenceBooklet)) {
                    residenceBooklet = $(this).val();
                } else {
                    residenceBooklet = residenceBooklet + "," + $(this).val();
                }
            });
           /* if(isBlank(residenceBooklet)){
                layer.msg('户口本复印件不能为空', {icon: 2});
                return;
            }*/
            var bankCard=$(".bankCard").val(); //银行卡照片
            if(isBlank(bankCard)){
                layer.msg('银行卡照片不能为空', {icon: 2});
                return;
            }
            if(isBlank(tssBankNum)){
                layer.msg('联行号不能为空', {icon: 2});
                return;
            }
            var remarks = $("textarea[name=remarks]").val();//备注
            var shootType = $("input[name=shootType]:checked").val();// 拍摄方式
            var houseOwnership;//房产证
            $(".house-ownership").each(function () {
                if (isBlank(houseOwnership)) {
                    houseOwnership = $(this).val();
                } else {
                    houseOwnership = houseOwnership + "," + $(this).val();
                }
            });
            if (isBlank(houseOwnership)) {
                layer.msg('房产证不能为空', {icon: 2});
                return;
            }
            var idCardFront = $('.id-card-front').val();//身份证正面
            if (isBlank(idCardFront)) {
                layer.msg('身份证正面不能为空', {icon: 2});
                return;
            }
            var idCardBack = $('.id-card-back').val();//身份证反面
            if (isBlank(idCardBack)) {
                layer.msg('身份证反面不能为空', {icon: 2});
                return;
            }
            var surveyRecord = $('.survey-record').val();//踏勘记录1
            if (isBlank(surveyRecord)) {
                layer.msg('踏勘记录表1不能为空', {icon: 2});
                return;
            }
            var surveyRecord2 = $('.survey-record2').val();//踏勘记录2

            var pic1 = $('.pic1').val();//无人机拍摄 俯拍图
            var pic2 = $('.pic2').val();//无人机拍摄 角度南
            var pic3 = $('.pic3').val();//无人机拍摄 补充图1
            var pic4 = $('.pic4').val();//无人机拍摄 补充图2
            var pic5 = $('.pic5').val();//手机拍摄 南侧
            var pic6 = $('.pic6').val();//手机拍摄 东南
            var pic7 = $('.pic7').val();//手机拍摄 西南
            var pic8 = $('.pic8').val();//手机拍摄 东北
          //  var roofValue1 = $('.roof-value20').val();//无人机拍摄 屋顶视频
            var roofValue = $('.roof-value').val();//手机拍摄 屋顶视频
            var pic10 = $('.pic10').val();//手机拍摄 补充图1
            var pic11 = $('.pic11').val();//手机拍摄 补充图2
            var filingDocumentPhoto = $('.filing-document-photo').val();//备案文件
            var roofPhotoOne;
            var roofPhotoTwo;
            var roofPhotoThree;
            var roofPhotoFour;
            var roofPhotoFive;
            var roofPhotoSix;

            var roofPhotoFacade1 = $('.roof-photo-facade-01').val(); //无人机拍摄 房屋外观照片
            var roofPhotoFacade2 = $('.roof-photo-facade-02').val(); //手机拍摄 房屋外观照片
            var roofPhotoFacade;

            var roofPhotoInterior1 = $('.roof-photo-interior-01').val(); //无人机拍摄 房屋内部照片
            var roofPhotoInterior2 = $('.roof-photo-interior-02').val(); //手机拍摄 房屋内部照片
            var roofPhotoInterior;

            var dimensionsPhotoThickness1 = $('.dimensions-photo-thickness-01').val(); //无人机拍摄 楼顶厚度照片
            var dimensionsPhotoThickness2 = $('.dimensions-photo-thickness-02').val(); //手机拍摄 楼顶厚度照片
            var dimensionsPhotoThickness;

            if (shootType === '1') {
                if (isBlank(pic1)) {
                    layer.msg('俯拍图不能为空', {icon: 2});
                    return;
                }
                roofPhotoOne = pic1;
                if (isBlank(pic2)) {
                    layer.msg('角度南不能为空', {icon: 2});
                    return;
                }
                roofValue = roofValue1;
                roofPhotoFacade = roofPhotoFacade1;
                roofPhotoInterior = roofPhotoInterior1;
                dimensionsPhotoThickness = dimensionsPhotoThickness1;
                roofPhotoTwo = pic2;
                roofPhotoThree = pic3;
                roofPhotoFour = pic4;
            } else if (shootType === '2') {
                if (isBlank(pic5)) {
                    layer.msg('南侧图不能为空', {icon: 2});
                    return;
                }
                roofPhotoOne = pic5;
                if (isBlank(pic6)) {
                    layer.msg('东南图不能为空', {icon: 2});
                    return;
                }
                roofPhotoTwo = pic6;
                if (isBlank(pic7)) {
                    layer.msg('西南图不能为空', {icon: 2});
                    return;
                }
                if (isBlank(roofValue)) {
                    layer.msg('屋顶视频不能为空', {icon: 2});
                    return;
                }
                roofPhotoFacade = roofPhotoFacade2;
                roofPhotoInterior = roofPhotoInterior2;
                dimensionsPhotoThickness = dimensionsPhotoThickness2;
                roofPhotoThree = pic7;
                /*if (isBlank(pic8)) {
                    layer.msg('东北图不能为空', {icon: 2});
                    return;
                }
                roofPhotoFour = pic8;*/
                roofPhotoFour = pic10;
                roofPhotoFive = pic11;
            }

            // if (isBlank(roofPhotoFacade)) {
            //     layer.msg('房屋外观照片不能为空', {icon: 2});
            //     return;
            // }
            if (isBlank(roofPhotoInterior)) {
                layer.msg('房屋内部照片不能为空', {icon: 2});
                return;
            }
            if (isBlank(dimensionsPhotoThickness)) {
                layer.msg('楼顶厚度照片不能为空', {icon: 2});
                return;
            }
            // 方案信息
            var schemeType = $("input[name=schemeType]:checked").val();//匹配方式
            var componentPlanArray = [];
            var schemeId = "";
            var schemeTypeId = '';
            if (schemeType === '2') {
                // 组合方案
                var componentPlanFlag = false;
                $('#zuhefangan').find('.layui-row').each(function (index, that) {

                    var planType = $(that).find('.planType').find("option:selected").text();
                    var planTypeId = $(that).find('select[name=planType]').val();
                    if (isBlank(planTypeId)) {
                        layer.msg('请选择第'+(index+1)+'行方案类型');
                        componentPlanFlag = true;
                        return false;
                    }
                    var planId = $(that).find(".planId").val();
                    if (isBlank(planId)) {
                        layer.msg('请选择第'+(index+1)+'行方案名称');
                        componentPlanFlag = true;
                        return false;
                    }
                    var name = $(that).find(".planName").find("option:selected").text();
                    var code = $(that).find(".planCode").val();
                    var componentPlan = {
                        planTypeId: planTypeId,
                        planType: planType,
                        planId: planId,
                        name: name,
                        code: code
                    }
                    componentPlanArray.push(componentPlan);
                });
                if (componentPlanFlag) {
                    return;
                }
            } else {
                // 标准方案
                schemeId = $('#showSchemeId').find('.planId').val();
                if (isBlank(schemeId)) {
                    layer.msg('请选择方案类型', {icon: 2});
                    return;
                }
                schemeTypeId = $('#showSchemeId').find('select[name=planType]').val();
                if (isBlank(schemeTypeId)) {
                    layer.msg('请选择方案名称', {icon: 2});
                    return;
                }
            }
            var designDrawings='';
            $(".attachFileImg").each(function(){
                var imgSrc=$(this).val();
                designDrawings+=','+imgSrc;
            })
           /* // 设计图纸
            var designDrawings = $('input[name=attach]').val();
            var designDrawingsName = $('input[name=attachName]').val();*/
            if (isBlank(designDrawings)) {
                layer.msg('请上传设计图纸', {icon: 2});
                return;
            }
            designDrawings=designDrawings.substring(1);
            // 电器材料
            var electricArray = [];
            // 组件
            var assemblyFlag = false;
            $('.assembly').find('.layui-row').each(function (index, that) {
                var itemId = $(that).find('select[name=assembly]').val();
                if (isBlank(itemId)) {
                    layer.msg('请选择第'+(index + 1) +'个组件');
                    assemblyFlag = true;
                    return false;
                }
                var itemType = '3';
                var num = $(that).find('input[name=optionVal]').val();
                if (isBlank(num)) {
                    layer.msg('请输入第'+(index + 1) +'个组件的数量');
                    assemblyFlag = true;
                    return false;
                }
                if (!number.test(num)) {
                    layer.msg('第'+(index + 1) +'个组件的数量格式不正确');
                    assemblyFlag = true;
                    return false;
                }
                var item = {
                    itemId: itemId,
                    itemType: itemType,
                    num: num
                }
                electricArray.push(item);
            });
            if (assemblyFlag) {
                return;
            }
            // 逆变器
            var inverterFlag = false;
            $('.inverter').find('.layui-row').each(function (index, that) {
                var itemId = $(that).find('select[name=inverter]').val();
                if (isBlank(itemId)) {
                    layer.msg('请选择第'+(index + 1) +'个逆变器');
                    inverterFlag = true;
                    return false;
                }
                var itemType = '1';
                var num = $(that).find('input[name=optionVal]').val();
                if (isBlank(num)) {
                    layer.msg('请输入第'+(index + 1) +'个逆变器的数量');
                    inverterFlag = true;
                    return false;
                }
                if (!number.test(num)) {
                    layer.msg('第'+(index + 1) +'个逆变器的数量格式不正确');
                    inverterFlag = true;
                    return false;
                }
                var item = {
                    itemId: itemId,
                    itemType: itemType,
                    num: num
                }
                electricArray.push(item);
            });
            if (inverterFlag) {
                return;
            }
            // 并网箱
            var gridConnectionFlag = false;
            $('.grid-connection').find('.layui-row').each(function (index, that) {
                var itemId = $(that).find('select[name=gridConnection]').val();
                if (!isBlank(itemId)) {
                    var itemType = '2';
                    var num = $(that).find('input[name=optionVal]').val();
                    if (isBlank(num)) {
                        layer.msg('请输入第'+(index + 1) +'个并网箱的数量');
                        gridConnectionFlag = true;
                        return false;
                    }
                    if (!number.test(num)) {
                        layer.msg('第'+(index + 1) +'个并网箱的数量格式不正确');
                        gridConnectionFlag = true;
                        return false;
                    }
                    var item = {
                        itemId: itemId,
                        itemType: itemType,
                        num: num
                    }
                    electricArray.push(item);
                }
            });
            if (gridConnectionFlag) {
                return;
            }
            // 支架
            var gridSupportFlag = false;
            $('.grid-support').find('.layui-row').each(function (index, that) {
                var itemId = $(that).find('select[name=gridSupport]').val();
                if (!isBlank(itemId)) {
                    var itemType = '4';
                    var num = $(that).find('input[name=optionVal]').val();
                    if (isBlank(num)) {
                        layer.msg('请输入第'+(index + 1) +'个支架的数量');
                        gridSupportFlag = true;
                        return false;
                    }
                    if (!number.test(num)) {
                        layer.msg('第'+(index + 1) +'个支架的数量格式不正确');
                        gridSupportFlag = true;
                        return false;
                    }
                    var item = {
                        itemId: itemId,
                        itemType: itemType,
                        num: num
                    }
                    electricArray.push(item);
                }
            });
            if (gridSupportFlag) {
                return;
            }
            var index=layer.load(2, {shade: [0.5,'#fff'], content:''});

            var schemeRemarks = $("#schemeRemarks").val();//方案备注

            var order = {
                projectId: projectId,
                projectName:projectName,
                tenantName: tenantName,
                mobile: mobile,
                idCode: idCode,
                roofType: roofType,
                province: province,
                city: city,
                area: area,
                address: address,
                distance: distance,
                azimuth: azimuth,
                angle: angle,
                buildingHeight: buildingHeight,
                repaymentMethod: repaymentMethod,
                remarks: remarks,
                shootType: shootType,
                houseOwnership: houseOwnership,
                filingDocumentPhoto: filingDocumentPhoto,
                roofPhotoFacade: roofPhotoFacade,
                roofPhotoInterior: roofPhotoInterior,
                dimensionsPhotoThickness: dimensionsPhotoThickness,
                idCardFront: idCardFront,
                idCardBack: idCardBack,
                surveyRecord: surveyRecord,
                surveyRecord2: surveyRecord2,
                roofPhotoOne: roofPhotoOne,
                roofPhotoTwo: roofPhotoTwo,
                roofPhotoThree: roofPhotoThree,
                roofPhotoFour: roofPhotoFour,
                roofPhotoFive: roofPhotoFive,
                roofPhotoSix: roofPhotoSix,
                roofValue: roofValue,
                schemeType: schemeType,
                schemeId: schemeId,
                schemeTypeId: schemeTypeId,
                composePlanLists: componentPlanArray,
                designDrawings: designDrawings,
                designDrawingsName: '',
                itemList: electricArray,
                schemeRemarks: schemeRemarks,
                type: '1',
                bankName: bankName,
                bankCode: bankCode,
                tssBankNum:tssBankNum,
                age:age,
                gender:gender
            };
            saveFlag = true;
            savetemFlag = true;
            $.ajax({
                url: "${ctx}/customerEntry/saveCustomerEntry",
                type: "POST",
                contentType: "application/json;charsetset=UTF-8",
                data: JSON.stringify(order)
                , success: function (result) {
                    if (result.code === '200') {
                        var index = parent.layer.getFrameIndex(window.name);
                        layer.msg("提交成功", {icon: 1, time: 1000}, function () {
                            parent.layer.close(index);
                            parent.table.reload('test');
                        })
                    } else {
                        layer.msg(result.errMsg, {icon: 2});
                    }
                    saveFlag = false;
                    savetemFlag = false;

                }, error: function () {
                    layer.msg("保存失败", {icon: 2});
                    saveFlag = false;
                    savetemFlag = false;
                },complete: function () {
                    layer.close(index);
                }
            })
        })

        //取消
        $(".cancelorder").click(function () {
            $(this).addClass("layui-hide");
            $(".uodateorder").addClass("layui-hide");
            $(".xiugaiOrder").removeClass("layui-hide");

            window.location.reload();
        })


        // 验证手机号
        function isPhoneNo(phone) {
            // var tel = /(^1\d{10}$)|(^(\d{3,4}\-)?\d{5,9}$)/;
            var tel = /^1[3|4|5|6|7|8|9][0-9]{9}$/;
            return tel.test($.trim(phone));
        }

        function IsCard(str) {
            var reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
            return reg.test(str);
        }

        function isNumber(value) {
            var z_reg = /^(([0-9])|([1-9]([0-9]+)))(.[0-9]+)?$/;
            return z_reg.test(value);
        };

        var tssBankXm = xmSelect.render({
            el: '#tssBank',
            name: 'tssBank',
            radio: true,
            tips: '请输入查询',
            size: 'mini',
            style: {
                height: '30px',
            },
            paging: true,
            pageSize: 6,
            clickClose: true,
            filterable: true,
            remoteSearch: true,
            remoteMethod: function (val, cb, show) {
                searchVal(val, cb, {
                    name: val
                }, 'name');
            },
            on: function (data) {
                if (data.isAdd && data.arr.length > 0) {
                    appendTr(data);
                }
            }
        });

        function searchVal(val, cb, searchData, filed) {
            if (!isBlank(val)) {
                $.ajax({
                    type: 'post',
                    url: '${ctx}/sysSettings/linkNumber/findLinkNumberList',
                    data: searchData,
                    async: false,
                    dataType: 'json',
                    success: function (d) {
                        let arr = [];
                        for (let i = 0; i < d.length; i++) {
                            let data = {};
                            data.name = d[i].columns.bank_name;
                            data.value = d[i].columns.number;
                            data.origin = d[i];
                            arr.push(data);
                        }
                        cb(arr);
                    }
                });
            } else {
                cb([]);
            }
        }

        function appendTr(data) {
            let d = data.arr[0].origin;
            tssBankNum = d.columns.number;
            tssBankNumName = d.columns.bank_name;
        }
    });

    function deletePlan(that) {
        $(that).closest(".layui-row").remove();
        var numco = 0;
        $(".componentNum").each(function () {
            if (!isBlank($(this).val())) {
                numco = numco + parseInt($(this).val());
            }
        });
        $("#componentCount").val(parseInt(numco));
    }

    function savePlan(that) {
        // var componentSpec = $("#componentSpec").val();
        // if (isBlank(componentSpec)) {
        //     layer.msg("请输入组件规格", {icon: 2});
        //     return
        // }
        var planType = $(that).parents(".planbiao").find(".planType").val();
        var planName = $(that).parents(".planbiao").find(".planName").val();
        // var componentNum = $(that).parents(".planbiao").find(".componentNum").val();
        if (isBlank(planType)) {
            layer.msg("请选择方案类型", {icon: 2});
            return
        }
        if (isBlank(planName)) {
            layer.msg("请选择方案名称", {icon: 2});
            return
        }
        // if (isBlank(componentNum)) {
        //     layer.msg("请输入组件块数", {icon: 2});
        //     return
        // }


        $(that).hide();
        $(that).next().removeClass("layui-hide")

        var html = '';
        html += '<div class="layui-row addplan">';
        html += '<div class="planbiao">';
        html += '<div class="layui-col-lg3 layui-col-sm3">';
        html += '<label class="layui-form-label"><i class="mark">*</i>方案类型：</label>';
        html += '<div class="layui-input-block">';
        html += '<select lay-filter="planType" name="planType" class="planType" lay-search>';
        html += '<option value="">请选择</option>';
        <c:forEach items="${insta}" var="ins">
        html += '<option value="${ins.columns.id}">${ins.columns.name}</option>';
        </c:forEach>
        html += '</select>';
        html += '</div> </div>';
        html += '<div class="layui-col-lg3 layui-col-sm3 " >';
        html += '<label class="layui-form-label"><i class="mark">*</i>方案名称：</label>';
        html += '<div class="layui-input-block pos-r">';
        html += '<select  lay-filter="planName" name="planName" class="planName" lay-search>';
        html += '<option value="">请选择</option>';
        html += '</select>';
        html += '</div> </div>';
        html += ' <div class="layui-col-lg1 layui-col-sm1 " >';
        html += '<label class="layui-form-label"><i class="mark">*</i>参考图纸：</label>';
        html += '<div class="layui-input-block pos-r view-attachment">';
        html += '';
        html += '</div> </div>';
        html += '<div class="layui-col-lg2 layui-col-sm2" style="text-align: center" >';
        html += '<input type="hidden" class="planId">';
        html += '<input type="hidden" class="planCode">';
        html += '<button type="button" class="layui-btn " onclick="savePlan(this)">新增方案</button>';
        html += '<button type="button" class="layui-btn layui-btn-primary deletePlan layui-hide" onclick="deletePlan(this)">删除</button>';
        html += '</div> </div></div>';
        $(that).parents(".zuhefangan").append(html);
        form.render('select');
    }

    // 新增组件
    function add1(that) {
        $(that).addClass('layui-hide');
        $(that).next().removeClass('layui-hide');
        var html = '';
        html += '<div class="layui-row assemblyDiv">';
        html += '<div class="layui-col-lg5 layui-col-sm7">';
        html += '<label class="layui-form-label"><i class="mark">*</i>组件：</label>';
        html += '<div class="layui-input-block">';
        html += '<div class="layui-inline">';
        html += '<select lay-filter="assembly" name="assembly" class="assembly" lay-search>';
        html += assemblyOptionHtml;
        html += '</select>';
        html += '<span class="pos-a h-32 lh-32 layui-span-unit" style="right: 30px" >W</span>';
        html += '</div>';
        html += '<span class="layui-inline">X </span>';
        html += '<div class="layui-inline">';
        html += '<input type="text" class="layui-input" style="width: 85px;" placeholder="数量" name="optionVal">';
        html += '</div>';
        html += '</div>';
        html += '</div>';
        html += '<div class="layui-col-lg3 layui-col-sm3">';
        html += '<i class="layui-icon layui-icon-add-circle" style="color: #1b6073;font-size: 25px;" onclick="add1(this)"></i>';
        html += '<i class="layui-icon layui-icon-delete" style="color: #1b6073;font-size: 25px;" onclick="delete1(this)"></i>';
        html += '</div>';
        html += '</div>';
        $(that).closest('.assembly').append(html);
        form.render('select');
    }

    // 新增逆变器
    function add2(that) {
        $(that).addClass('layui-hide');
        $(that).next().removeClass('layui-hide');
        var html = '';
        html += '<div class="layui-row inverterDiv">';
        html += '<div class="layui-col-lg5 layui-col-sm7">';
        html += '<label class="layui-form-label"><i class="mark">*</i>逆变器：</label>';
        html += '<div class="layui-input-block">';
        html += '<div class="layui-inline">';
        html += '<select lay-filter="inverter" name="inverter" class="inverter" lay-search>';
        html += inverterOptionHtml;
        html += '</select>';
        html += '</div>';
        html += '<span class="layui-inline">X </span>';
        html += '<div class="layui-inline">';
        html += '<input type="text" class="layui-input" style="width: 85px;" placeholder="数量" name="optionVal">';
        html += '</div>';
        html += '</div>';
        html += '</div>';
        html += '<div class="layui-col-lg3 layui-col-sm3">';
        html += '<i class="layui-icon layui-icon-add-circle" style="color: #1b6073;font-size: 25px;" onclick="add2(this)"></i>';
        html += '<i class="layui-icon layui-icon-delete" style="color: #1b6073;font-size: 25px;" onclick="delete2(this)"></i>';
        html += '</div>';
        html += '</div>';
        $(that).closest('.inverter').append(html);
        form.render('select');
    }

    // 新增并网箱
    function add3(that) {
        $(that).addClass('layui-hide');
        $(that).next().removeClass('layui-hide');
        var html = '';
        html += '<div class="layui-row connectionDiv">';
        html += '<div class="layui-col-lg5 layui-col-sm7">';
        html += '<label class="layui-form-label">并网箱：</label>';
        html += '<div class="layui-input-block">';
        html += '<div class="layui-inline">';
        html += '<select lay-filter="grid-connection" name="gridConnection" class="grid-connection" lay-search>';
        html += gridConnectionOptionHtml;
        html += '</select>';
        html += '</div>';
        html += '<span class="layui-inline">X </span>';
        html += '<div class="layui-inline">';
        html += '<input type="text" class="layui-input" style="width: 85px;" placeholder="数量" name="optionVal">';
        html += '</div>';
        html += '</div>';
        html += '</div>';
        html += '<div class="layui-col-lg3 layui-col-sm3">';
        html += '<i class="layui-icon layui-icon-add-circle" style="color: #1b6073;font-size: 25px;" onclick="add3(this)"></i>';
        html += '<i class="layui-icon layui-icon-delete" style="color: #1b6073;font-size: 25px;" onclick="delete3(this)"></i>';
        html += '</div>';
        html += '</div>';
        $(that).closest('.grid-connection').append(html);
        form.render('select');
    }

    function add4(that) {
        $(that).addClass('layui-hide');
        $(that).next().removeClass('layui-hide');
        var html = '';
        html += '<div class="layui-row supportDiv">';
        html += '<div class="layui-col-lg5 layui-col-sm7">';
        html += '<label class="layui-form-label">支架：</label>';
        html += '<div class="layui-input-block">';
        html += '<div class="layui-inline">';
        html += '<select lay-filter="grid-support" name="gridSupport" class="grid-support" lay-search>';
        html += supportOptionHtml;
        html += '</select>';
        html += '</div>';
        html += '<span class="layui-inline">X </span>';
        html += '<div class="layui-inline">';
        html += '<input type="text" class="layui-input" style="width: 85px;" placeholder="数量" name="optionVal">';
        html += '</div>';
        html += '</div>';
        html += '</div>';
        html += '<div class="layui-col-lg3 layui-col-sm3">';
        html += '<i class="layui-icon layui-icon-add-circle" style="color: #1b6073;font-size: 25px;" onclick="add4(this)"></i>';
        html += '<i class="layui-icon layui-icon-delete" style="color: #1b6073;font-size: 25px;" onclick="delete4(this)"></i>';
        html += '</div>';
        html += '</div>';
        $(that).closest('.grid-support').append(html);
        form.render('select');
    }

    // 删除组件、逆变器、并网箱
    function delete1(that) {
        if (!$(that).parents(".assemblyDiv").next().hasClass("assemblyDiv")) {
            $(that).parents(".assemblyDiv").prev().find(".layui-icon-add-circle").removeClass("layui-hide");
        }
        $(that).closest(".layui-row").remove();
        if ($('.assembly').find('.layui-row').length < 2) {
            $('.assembly').find(".layui-icon-add-circle").removeClass("layui-hide");
            $('.assembly').find(".layui-icon-delete").addClass("layui-hide");
        }

    }

    function delete2(that) {
        if (!$(that).parents(".inverterDiv").next().hasClass("inverterDiv")) {
            $(that).parents(".inverterDiv").prev().find(".layui-icon-add-circle").removeClass("layui-hide");
        }
        $(that).closest(".layui-row").remove();
        if ($('.inverter').find('.layui-row').length < 2) {
            $('.inverter').find(".layui-icon-add-circle").removeClass("layui-hide");
            $('.inverter').find(".layui-icon-delete").addClass("layui-hide");
        }

    }

    function delete3(that) {
        if (!$(that).parents(".connectionDiv").next().hasClass("connectionDiv")) {
            $(that).parents(".connectionDiv").prev().find(".layui-icon-add-circle").removeClass("layui-hide");
        }
        $(that).closest(".layui-row").remove();
        if ($('.grid-connection').find('.layui-row').length < 2) {
            $('.grid-connection').find(".layui-icon-add-circle").removeClass("layui-hide");
            $('.grid-connection').find(".layui-icon-delete").addClass("layui-hide");
        }

    }

    function delete4(that) {
        if (!$(that).parents(".supportDiv").next().hasClass("supportDiv")) {
            $(that).parents(".supportDiv").prev().find(".layui-icon-add-circle").removeClass("layui-hide");
        }
        $(that).closest(".layui-row").remove();
        if ($('.grid-support').find('.layui-row').length < 2) {
            $('.grid-support').find(".layui-icon-add-circle").removeClass("layui-hide");
            $('.grid-support').find(".layui-icon-delete").addClass("layui-hide");
        }

    }

    // 初始化电器材料下拉选
    function initElectricSelect() {
        $.get('${ctx}/planManage/findAllElectric', function(result){
            if (result.code === '200') {
                var electricArray = result.data;
                assemblyOptionHtml += '<option value="">请选择</option>';
                inverterOptionHtml += '<option value="">请选择</option>';
                gridConnectionOptionHtml += '<option value="">请选择</option>';
                supportOptionHtml += '<option value="">请选择</option>';
                for (var i = 0; i < electricArray.length; i++) {
                    var electric = electricArray[i];
                    var type = electric.columns.type;
                    var id = electric.columns.id;
                    var model = electric.columns.model;
                    if (type === '1') {
                        inverterOptionHtml += '<option value="'+id+'">'+model+'</option>';
                    } else if (type === '2') {
                        gridConnectionOptionHtml += '<option value="'+id+'">'+model+'</option>';
                    } else if (type === '4') {
                        supportOptionHtml += '<option value="'+id+'">'+model+'</option>';
                    } else {
                        assemblyOptionHtml += '<option value="'+id+'" data-power="'+model+'">'+model+'</option>';
                    }
                }
                $('select[name=assembly]').empty().append(assemblyOptionHtml);
                $('select[name=inverter]').empty().append(inverterOptionHtml);
                $('select[name=gridConnection]').empty().append(gridConnectionOptionHtml);
                $('select[name=gridSupport]').empty().append(supportOptionHtml);

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

    }


    function openMap() {
        parent.layer.open({
            type: 2,
            title: '业主定位',
            content: '${ctx}/customerEntry/toPositionPage',
            area: ['80%', '80%']
        });
    }

    //改变规格值
    function checkSpce(va) {
        if (isBlank(va)) {
            layer.msg("请输入组件规格", {icon: 2});
            return
        }
        if (va > 0) {
            //清空之前的数据
            $(".addplan").remove();
            //获取数据
            $(".deletePlan").hide();
            $(".savePlan").show();
            var projectId = $("#projectId").val();
            $.ajax({
                url: "${ctx}/planManage/findPlanByAssembly",
                type: "POST",
                data: {
                    assembly: va,
                    projectId: projectId
                }
                , success: function (result) {
                    $(".planType").empty();
                    $(".planName").empty();
                    $(".componentNum").val('');
                    $("#componentCount").val('0');
                    plan_html = "<option value=''>请选择</option>";
                    plan_type_html = "<option value=''>请选择</option>";
                    console.log(result);
                    var length = result.length;
                    // var plan_html ="<option value=''>请选择</option>";
                    for (var i = 0; i < length; i++) {
                        plan_type_html += "<option value='" + result[i].columns.id + "' title='" + result[i].columns.assembly_count + "' date='" + result[i].columns.code + "'>" + result[i].columns.plan_type + "</option>";
                        plan_html += "<option value='" + result[i].columns.id + "' title='" + result[i].columns.assembly_count + "' date='" + result[i].columns.code + "'>" + result[i].columns.name + "</option>";
                    }

                    $(".planType").append(plan_type_html);
                    $(".planName").append(plan_html);
                    form.render('select');
                }
            })
        }
    }

    function componentCounta() {
        var numco = 0;
        $(".componentNum").each(function () {
            if (!isBlank($(this).val())) {
                numco = numco + parseInt($(this).val());
            }
        });
        $("#componentCount").val(parseInt(numco));
    }


    function isBlank(val) {
        if (val == null || val == '' || val == undefined) {
            return true;
        }
        return false;
    }

    function delImg(that, id) {
        $("#" + id).show();
        $(that).parent().remove();
        if('uploader'==id){
            quaimgsCount--;
            $("#uploader").show();
        }
    }

    // 关闭弹框
    function cancel() {
        var index = parent.layer.getFrameIndex(window.name);//先得到当前iframe层的索引
        parent.layer.close(index); //再执行关闭
    }

    function checkAngle() {
        var angle = $('#angle').val();
        if (isBlank(angle)) {
            return;
        }
        if (parseInt(angle) > 90) {
            layer.msg("方位角不能超过90度");
            $('#angle').val('');

            return;
        }
    }

    function change(){
        var age=$("#age").val();
        if(age>=65){
            $("#bcxx").removeClass("hide");
        }else{
            $("#bcxx").addClass("hide");
        }
    }

</script>
</body>
</html>
