<!doctype html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <base th:href="${#request.getContextPath() + '/'}">
    <meta charset="utf-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
    <link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
    <link rel="stylesheet" type="text/css" href="assets/js/vendor/viewer/viewer.min.css">
    <style>
        .left140 > .layui-form-label {width: 140px;}
        .left140 > .layui-form-pane, .left140 > .layui-input-block {margin-left: 140px;}
        .left180 > .layui-form-label {width: 180px;}
        .left180 > .layui-form-pane, .left180 > .layui-input-block {margin-left: 180px;}
        .left240 > .layui-form-label {width: 240px;}
        .left240 > .layui-form-pane, .left240 > .layui-input-block {margin-left: 240px;}
    </style>
</head>
<body>
<div class="layui-fluid layui-anim layui-anim-fadein">
    <div class="layui-card">
        <div class="layui-card-header">
            <span class="layui-breadcrumb" lay-filter="breadcrumb" style="visibility: visible;">
              <a class="close" href="javascript:void(0);">上级列表</a><span lay-separator="">/</span>
              <a href="javascript:void(0);"><cite>编辑内容</cite></a>
            </span>
        </div>
        <div class="layui-card-body" style="padding: 15px;">
            <form class="layui-form layui-form-pane" lay-filter="dataForm">
                <blockquote class="layui-elem-quote">基本信息</blockquote>
                <div class="layui-row">
                    <div class="layui-col-xs6">
                        <div class="layui-form-item">
                            <label class="layui-form-label">组织名称</label>
                            <div class="layui-input-block">
                                <input type="text" id="organizationName" name="organizationName" class="layui-input" value="" placeholder="请输入组织名称"  maxlength="255" lay-verify="required">
                            </div>
                        </div>
                    </div>
                    <div class="layui-col-xs6">
                        <div class="layui-form-item">
                            <label class="layui-form-label">组织类型</label>
                            <div class="layui-input-block layui-form" id="organizationTypeIdSelectTemplateBox" lay-filter="organizationTypeIdSelectTemplateBox"></div>
                            <script id="organizationTypeIdSelectTemplate" type="text/html">
                                <select id="organizationTypeId" name="organizationTypeId" lay-verify="required" lay-search>
                                    <option value="">请选择组织类型</option>
                                    {{# for(var i = 0, item; item = d[i++];) { }}
                                    <option value="{{item.dataId}}|{{item.dataName}}">{{item.dataName}}</option>
                                    {{# } }}
                                </select>
                            </script>
                        </div>
                    </div>
                </div>
                <div class="layui-row">
                    <div class="layui-col-xs6">
                        <div class="layui-form-item">
                            <label class="layui-form-label">所在地区</label>
                            <div class="layui-input-block">
                                <input type="hidden" id="areaCode" name="areaCode">
                                <input type="text" id="areaName" name="areaName" class="layui-input" value="" placeholder="请选择地区" maxlength="255" readonly lay-verify="required"  style="cursor:pointer;">
                            </div>
                        </div>
                    </div>
                    <div class="layui-col-xs6">
                        <div class="layui-form-item">
                            <label class="layui-form-label">所属网格</label>
                            <div class="layui-input-block layui-form" id="gridCodeSelectTemplateBox" lay-filter="gridCodeSelectTemplateBox"></div>
                            <script id="gridCodeSelectTemplate" type="text/html">
                                <select id="gridCode" name="gridCode" lay-search>
                                    <option value="">请选择网格</option>
                                    {{# for(var i = 0, item; item = d[i++];) { }}
                                    <option value="{{item.gridCode}}|{{item.gridName}}">{{item.gridName}}</option>
                                    {{# } }}
                                </select>
                            </script>
                        </div>
                    </div>
                </div>
                <div class="layui-row">
                    <div class="layui-col-xs6">
                        <div class="layui-form-item" pane>
                            <label class="layui-form-label">组织状态</label>
                            <div class="layui-input-block">
                                <input type="radio" name="organizationStatus" value="0" title="不正常">
                                <input type="radio" name="organizationStatus" value="1" title="正常" checked>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="layui-row">
                    <div class="layui-col-xs12">
                        <div class="layui-form-item layui-form-text">
                            <label class="layui-form-label">组织简介</label>
                            <div class="layui-input-block">
                                <textarea id="organizationSummary" name="organizationSummary" class="layui-textarea" placeholder="请输入组织简介"></textarea>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="layui-row">
                    <div class="layui-col-xs12">
                        <div class="layui-form-item left180">
                            <label class="layui-form-label">统一社会信用代码</label>
                            <div class="layui-input-block">
                                <input type="text" id="businessRegNo" name="businessRegNo" class="layui-input" value="" placeholder="请输入统一社会信用代码"  maxlength="255" lay-verify="required">
                            </div>
                        </div>
                    </div>
                </div>
                <div class="layui-row">
                    <div class="layui-col-xs12">
                        <div class="layui-form-item layui-form-text">
                            <label class="layui-form-label">营业执照</label>
                            <div class="layui-input-block">
                                <input type="hidden" id="businessLicense" name="businessLicense">
                                <div class="layui-btn-container" id="businessLicenseFileBox" style="border: 1px solid #e6e6e6;"></div>
                                <script id="businessLicenseFileDownload" type="text/html">
                                    {{# var fileName = 'businessLicense'; }}
                                    {{# if(d[fileName].length > 0) { }}
                                    {{#    var files = d[fileName];}}
                                    {{#    for(var i = 0, item = files[i]; item = files[i++];) { }}
                                    <div class="upload-image-box">
                                <span class="upload-image-span">
                                    <img src="route/file/download/false/{{item.fileId}}" align="加载失败">
                                </span>
                                        <a class="layui-btn layui-btn-xs layui-btn-danger text-danger remove-image" href="javascript:void(0);" lay-form-button data-id="{{item.fileId}}" data-name="{{fileName}}" lay-filter="businessLicenseRemoveFile">
                                            <i class="fa fa-trash-o"></i>
                                        </a>
                                    </div>
                                    {{#    } }}
                                    {{# } }}
                                    {{# if(d[fileName].length < 9) { }}
                                    <div class="upload-image-box" style="width: auto; height: auto; padding: 5px;">
                                        <a href="javascript:void(0);" lay-form-button data-explain="营业执照" data-name="businessLicense" lay-filter="businessLicenseUploadFile">
                                            <i class="fa fa-plus-square-o" style="font-size: 70px;"></i>
                                        </a>
                                    </div>
                                    {{# } }}
                                </script>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="layui-row">
                    <div class="layui-col-xs6">
                        <div class="layui-form-item left180">
                            <label class="layui-form-label">营业执照开始时间</label>
                            <div class="layui-input-block">
                                <input type="text" id="businessLicenseStartDate" name="businessLicenseStartDate" class="layui-input" value="" placeholder="请输入营业执照开始时间"  maxlength="10">
                            </div>
                        </div>
                    </div>
                    <div class="layui-col-xs6">
                        <div class="layui-form-item left180">
                            <label class="layui-form-label">营业执照结束时间</label>
                            <div class="layui-input-block">
                                <input type="text" id="businessLicenseEndDate" name="businessLicenseEndDate" class="layui-input" value="" placeholder="请输入营业执照结束时间"  maxlength="10">
                            </div>
                        </div>
                    </div>
                </div>
                <div class="layui-row">
                    <div class="layui-col-xs6">
                        <div class="layui-form-item">
                            <label class="layui-form-label">登记证号</label>
                            <div class="layui-input-block">
                                <input type="text" id="registrationNo" name="registrationNo" class="layui-input" value="" placeholder="请输入登记证号"  maxlength="255">
                            </div>
                        </div>
                    </div>
                    <div class="layui-col-xs6">
                        <div class="layui-form-item left180">
                            <label class="layui-form-label">登记管理机关代码</label>
                            <div class="layui-input-block">
                                <input type="text" id="registrationAuthorityNo" name="registrationAuthorityNo" class="layui-input" value="" placeholder="请输入登记管理机关代码"  maxlength="255">
                            </div>
                        </div>
                    </div>
                </div>
                <blockquote class="layui-elem-quote">法人信息</blockquote>
                <div class="layui-row">
                    <div class="layui-col-xs6">
                        <div class="layui-form-item">
                            <label class="layui-form-label">法人姓名</label>
                            <div class="layui-input-block">
                                <input type="text" id="legalPersonName" name="legalPersonName" class="layui-input" value="" placeholder="请输入法人姓名"  maxlength="255">
                            </div>
                        </div>
                    </div>
                    <div class="layui-col-xs6">
                        <div class="layui-form-item">
                            <label class="layui-form-label">住所</label>
                            <div class="layui-input-block">
                                <input type="text" id="residence" name="residence" class="layui-input" value="" placeholder="请输入住所"  maxlength="255">
                            </div>
                        </div>
                    </div>
                </div>
                <div class="layui-row">
                    <div class="layui-col-xs6">
                        <div class="layui-form-item">
                            <label class="layui-form-label">批准日期</label>
                            <div class="layui-input-block">
                                <input type="text" id="approvalDate" name="approvalDate" class="layui-input" value="" placeholder="请输入批准日期"  maxlength="10">
                            </div>
                        </div>
                    </div>
                </div>
                <blockquote class="layui-elem-quote">负责人信息</blockquote>
                <div class="layui-row">
                    <div class="layui-col-xs6">
                        <div class="layui-form-item">
                            <label class="layui-form-label">负责人姓名</label>
                            <div class="layui-input-block">
                                <input type="text" id="masterName" name="masterName" class="layui-input" value="" placeholder="请输入负责人姓名"  maxlength="255">
                            </div>
                        </div>
                    </div>
                    <div class="layui-col-xs6">
                        <div class="layui-form-item left140">
                            <label class="layui-form-label">负责人联系方式</label>
                            <div class="layui-input-block">
                                <input type="text" id="masterPhone" name="masterPhone" class="layui-input" value="" placeholder="请输入负责人联系方式"  maxlength="255">
                            </div>
                        </div>
                    </div>
                </div>
                <div class="layui-row">
                    <div class="layui-col-xs6">
                        <div class="layui-form-item left140">
                            <label class="layui-form-label">负责人证件代码</label>
                            <div class="layui-input-block layui-form" id="masterIdCardCodeSelectTemplateBox" lay-filter="masterIdCardCodeSelectTemplateBox"></div>
                            <script id="masterIdCardCodeSelectTemplate" type="text/html">
                                <select id="masterIdCardCode" name="masterIdCardCode" lay-search>
                                    <option value="">请选择类型</option>
                                    {{# for(var i = 0, item; item = d[i++];) { }}
                                    <option value="{{item.dataId}}|{{item.dataName}}">{{item.dataName}}</option>
                                    {{# } }}
                                </select>
                            </script>
                        </div>
                    </div>
                    <div class="layui-col-xs6">
                        <div class="layui-form-item left140">
                            <label class="layui-form-label">负责人证件号码</label>
                            <div class="layui-input-block">
                                <input type="text" id="masterIdCard" name="masterIdCard" class="layui-input" value="" placeholder="请输入负责人证件号码"  maxlength="255">
                            </div>
                        </div>
                    </div>
                </div>
                <div class="layui-row">
                    <div class="layui-col-xs12">
                        <div class="layui-form-item layui-form-text">
                            <label class="layui-form-label">负责人证件正面</label>
                            <div class="layui-input-block">
                                <input type="hidden" id="masterIdCardFront" name="masterIdCardFront">
                                <div class="layui-btn-container" id="masterIdCardFrontFileBox" style="border: 1px solid #e6e6e6;"></div>
                                <script id="masterIdCardFrontFileDownload" type="text/html">
                                    {{# var fileName = 'masterIdCardFront'; }}
                                    {{# if(d[fileName].length > 0) { }}
                                    {{#    var files = d[fileName];}}
                                    {{#    for(var i = 0, item = files[i]; item = files[i++];) { }}
                                    <div class="upload-image-box">
                                <span class="upload-image-span">
                                    <img src="route/file/download/false/{{item.fileId}}" align="加载失败">
                                </span>
                                        <a class="layui-btn layui-btn-xs layui-btn-danger text-danger remove-image" href="javascript:void(0);" lay-form-button data-id="{{item.fileId}}" data-name="{{fileName}}" lay-filter="masterIdCardFrontRemoveFile">
                                            <i class="fa fa-trash-o"></i>
                                        </a>
                                    </div>
                                    {{#    } }}
                                    {{# } }}
                                    {{# if(d[fileName].length < 1) { }}
                                    <div class="upload-image-box" style="width: auto; height: auto; padding: 5px;">
                                        <a href="javascript:void(0);" lay-form-button data-explain="负责人证件正面" data-name="masterIdCardFront" lay-filter="masterIdCardFrontUploadFile">
                                            <i class="fa fa-plus-square-o" style="font-size: 70px;"></i>
                                        </a>
                                    </div>
                                    {{# } }}
                                </script>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="layui-row">
                    <div class="layui-col-xs12">
                        <div class="layui-form-item layui-form-text">
                            <label class="layui-form-label">负责人证件背面</label>
                            <div class="layui-input-block">
                                <input type="hidden" id="masterIdCardBack" name="masterIdCardBack">
                                <div class="layui-btn-container" id="masterIdCardBackFileBox" style="border: 1px solid #e6e6e6;"></div>
                                <script id="masterIdCardBackFileDownload" type="text/html">
                                    {{# var fileName = 'masterIdCardBack'; }}
                                    {{# if(d[fileName].length > 0) { }}
                                    {{#    var files = d[fileName];}}
                                    {{#    for(var i = 0, item = files[i]; item = files[i++];) { }}
                                    <div class="upload-image-box">
                                <span class="upload-image-span">
                                    <img src="route/file/download/false/{{item.fileId}}" align="加载失败">
                                </span>
                                        <a class="layui-btn layui-btn-xs layui-btn-danger text-danger remove-image" href="javascript:void(0);" lay-form-button data-id="{{item.fileId}}" data-name="{{fileName}}" lay-filter="masterIdCardBackRemoveFile">
                                            <i class="fa fa-trash-o"></i>
                                        </a>
                                    </div>
                                    {{#    } }}
                                    {{# } }}
                                    {{# if(d[fileName].length < 1) { }}
                                    <div class="upload-image-box" style="width: auto; height: auto; padding: 5px;">
                                        <a href="javascript:void(0);" lay-form-button data-explain="负责人证件背面" data-name="masterIdCardBack" lay-filter="masterIdCardBackUploadFile">
                                            <i class="fa fa-plus-square-o" style="font-size: 70px;"></i>
                                        </a>
                                    </div>
                                    {{# } }}
                                </script>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="layui-row">
                    <div class="layui-col-xs12">
                        <div class="layui-form-item">
                            <label class="layui-form-label">办公地址</label>
                            <div class="layui-input-block">
                                <input type="text" id="officeAddress" name="officeAddress" class="layui-input" value="" placeholder="请输入办公地址"  maxlength="255">
                            </div>
                        </div>
                    </div>
                </div>
                <blockquote class="layui-elem-quote">治保负责人信息</blockquote>
                <div class="layui-row">
                    <div class="layui-col-xs6">
                        <div class="layui-form-item left140">
                            <label class="layui-form-label">治保负责人姓名</label>
                            <div class="layui-input-block">
                                <input type="text" id="securityPersonName" name="securityPersonName" class="layui-input" value="" placeholder="请输入治保负责人姓名"  maxlength="255">
                            </div>
                        </div>
                    </div>
                    <div class="layui-col-xs6">
                        <div class="layui-form-item left180">
                            <label class="layui-form-label">治保负责人联系方式</label>
                            <div class="layui-input-block">
                                <input type="text" id="securityPersonPhone" name="securityPersonPhone" class="layui-input" value="" placeholder="请输入治保负责人联系方式"  maxlength="255">
                            </div>
                        </div>
                    </div>
                </div>
                <blockquote class="layui-elem-quote">其他信息</blockquote>
                <div class="layui-row">
                    <div class="layui-col-xs6">
                        <div class="layui-form-item">
                            <label class="layui-form-label">关注度</label>
                            <div class="layui-input-block layui-form" id="degreeOfConcernIdSelectTemplateBox" lay-filter="degreeOfConcernIdSelectTemplateBox"></div>
                            <script id="degreeOfConcernIdSelectTemplate" type="text/html">
                                <select id="degreeOfConcernId" name="degreeOfConcernId" lay-search>
                                    <option value="">请选择关注度</option>
                                    {{# for(var i = 0, item; item = d[i++];) { }}
                                    <option value="{{item.dataId}}|{{item.dataName}}">{{item.dataName}}</option>
                                    {{# } }}
                                </select>
                            </script>
                        </div>
                    </div>
                    <div class="layui-col-xs6">
                        <div class="layui-form-item left240" pane>
                            <label class="layui-form-label">是否具备建立中共党组织条件</label>
                            <div class="layui-input-block">
                                <input type="radio" name="canEstablishPartyOrg" value="0" title="否" checked>
                                <input type="radio" name="canEstablishPartyOrg" value="1" title="是">
                            </div>
                        </div>
                    </div>
                </div>
                <div class="layui-row">
                    <div class="layui-col-xs6">
                        <div class="layui-form-item left140" pane>
                            <label class="layui-form-label">是否有党组织</label>
                            <div class="layui-input-block">
                                <input type="radio" name="hasPartyOrg" value="0" title="否" checked>
                                <input type="radio" name="hasPartyOrg" value="1" title="是">
                            </div>
                        </div>
                    </div>
                    <div class="layui-col-xs6">
                        <div class="layui-form-item left140">
                            <label class="layui-form-label">中共党员数量</label>
                            <div class="layui-input-block">
                                <input type="number" id="partyOrgTotalPerson" name="partyOrgTotalPerson" class="layui-input" value="" placeholder="请输入中共党员数量">
                            </div>
                        </div>
                    </div>
                </div>
                <div class="layui-row">
                    <div class="layui-col-xs6">
                        <div class="layui-form-item left140" pane>
                            <label class="layui-form-label">是否有工会</label>
                            <div class="layui-input-block">
                                <input type="radio" name="hasLabourUnion" value="0" title="否" checked>
                                <input type="radio" name="hasLabourUnion" value="1" title="是">
                            </div>
                        </div>
                    </div>
                    <div class="layui-col-xs6">
                        <div class="layui-form-item left140">
                            <label class="layui-form-label">工会会员数量</label>
                            <div class="layui-input-block">
                                <input type="number" id="labourUnionTotalPerson" name="labourUnionTotalPerson" class="layui-input" value="" placeholder="请输入工会会员数量">
                            </div>
                        </div>
                    </div>
                </div>
                <div class="layui-row">
                    <div class="layui-col-xs6">
                        <div class="layui-form-item left140" pane>
                            <label class="layui-form-label">是否有共青团</label>
                            <div class="layui-input-block">
                                <input type="radio" name="hasCommunistYouthLeague" value="0" title="否" checked>
                                <input type="radio" name="hasCommunistYouthLeague" value="1" title="是">
                            </div>
                        </div>
                    </div>
                    <div class="layui-col-xs6">
                        <div class="layui-form-item left140">
                            <label class="layui-form-label">共青团团员数量</label>
                            <div class="layui-input-block">
                                <input type="number" id="communistYouthLeagueTotalPerson" name="communistYouthLeagueTotalPerson" class="layui-input" value="" placeholder="请输入共青团团员数量">
                            </div>
                        </div>
                    </div>
                </div>
                <div class="layui-row">
                    <div class="layui-col-xs6">
                        <div class="layui-form-item" pane>
                            <label class="layui-form-label">是否有妇联</label>
                            <div class="layui-input-block">
                                <input type="radio" name="hasWomenFederation" value="0" title="否" checked>
                                <input type="radio" name="hasWomenFederation" value="1" title="是">
                            </div>
                        </div>
                    </div>
                    <div class="layui-col-xs6">
                        <div class="layui-form-item">
                            <label class="layui-form-label">妇女数量</label>
                            <div class="layui-input-block">
                                <input type="number" id="womenTotalPerson" name="womenTotalPerson" class="layui-input" value="" placeholder="请输入妇女数量">
                            </div>
                        </div>
                    </div>
                </div>
                <div class="layui-row">
                    <div class="layui-col-xs6">
                        <div class="layui-form-item">
                            <label class="layui-form-label">资金来源</label>
                            <div class="layui-input-block">
                                <input type="text" id="sourceOfFunds" name="sourceOfFunds" class="layui-input" value="" placeholder="请输入资金来源"  maxlength="255">
                            </div>
                        </div>
                    </div>
                    <div class="layui-col-xs6">
                        <div class="layui-form-item left140" pane>
                            <label class="layui-form-label">是否有境外背景</label>
                            <div class="layui-input-block">
                                <input type="radio" name="hasOverseasBackground" value="0" title="否" checked>
                                <input type="radio" name="hasOverseasBackground" value="1" title="是">
                            </div>
                        </div>
                    </div>
                </div>
                <div class="layui-row">
                    <div class="layui-col-xs12">
                        <div class="layui-form-item">
                            <label class="layui-form-label">备注</label>
                            <div class="layui-input-block">
                                <input type="text" id="remarks" name="remarks" class="layui-input" value="" placeholder="请输入备注"  maxlength="255">
                            </div>
                        </div>
                    </div>
                </div>

                <div class="layui-row">
                    <div class="layui-col-xs12">
                        <div class="layui-form-item layui-form-text">
                            <label class="layui-form-label">门面照片</label>
                            <div class="layui-input-block">
                                <input type="hidden" id="facadePhotos" name="facadePhotos">
                                <div class="layui-btn-container" id="facadePhotosFileBox" style="border: 1px solid #e6e6e6;"></div>
                                <script id="facadePhotosFileDownload" type="text/html">
                                    {{# var fileName = 'facadePhotos'; }}
                                    {{# if(d[fileName].length > 0) { }}
                                    {{#    var files = d[fileName];}}
                                    {{#    for(var i = 0, item = files[i]; item = files[i++];) { }}
                                    <div class="upload-image-box">
                                <span class="upload-image-span">
                                    <img src="route/file/download/false/{{item.fileId}}" align="加载失败">
                                </span>
                                        <a class="layui-btn layui-btn-xs layui-btn-danger text-danger remove-image" href="javascript:void(0);" lay-form-button data-id="{{item.fileId}}" data-name="{{fileName}}" lay-filter="facadePhotosRemoveFile">
                                            <i class="fa fa-trash-o"></i>
                                        </a>
                                    </div>
                                    {{#    } }}
                                    {{# } }}
                                    {{# if(d[fileName].length < 9) { }}
                                    <div class="upload-image-box" style="width: auto; height: auto; padding: 5px;">
                                        <a href="javascript:void(0);" lay-form-button data-explain="门面照片" data-name="facadePhotos" lay-filter="facadePhotosUploadFile">
                                            <i class="fa fa-plus-square-o" style="font-size: 70px;"></i>
                                        </a>
                                    </div>
                                    {{# } }}
                                </script>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="layui-row">
                    <div class="layui-col-xs12">
                        <div class="layui-form-item layui-form-text">
                            <label class="layui-form-label">工作场所照片</label>
                            <div class="layui-input-block">
                                <input type="hidden" id="workplacePhotos" name="workplacePhotos">
                                <div class="layui-btn-container" id="workplacePhotosFileBox" style="border: 1px solid #e6e6e6;"></div>
                                <script id="workplacePhotosFileDownload" type="text/html">
                                    {{# var fileName = 'workplacePhotos'; }}
                                    {{# if(d[fileName].length > 0) { }}
                                    {{#    var files = d[fileName];}}
                                    {{#    for(var i = 0, item = files[i]; item = files[i++];) { }}
                                    <div class="upload-image-box">
                                <span class="upload-image-span">
                                    <img src="route/file/download/false/{{item.fileId}}" align="加载失败">
                                </span>
                                        <a class="layui-btn layui-btn-xs layui-btn-danger text-danger remove-image" href="javascript:void(0);" lay-form-button data-id="{{item.fileId}}" data-name="{{fileName}}" lay-filter="workplacePhotosRemoveFile">
                                            <i class="fa fa-trash-o"></i>
                                        </a>
                                    </div>
                                    {{#    } }}
                                    {{# } }}
                                    {{# if(d[fileName].length < 9) { }}
                                    <div class="upload-image-box" style="width: auto; height: auto; padding: 5px;">
                                        <a href="javascript:void(0);" lay-form-button data-explain="工作场所照片" data-name="workplacePhotos" lay-filter="workplacePhotosUploadFile">
                                            <i class="fa fa-plus-square-o" style="font-size: 70px;"></i>
                                        </a>
                                    </div>
                                    {{# } }}
                                </script>
                            </div>
                        </div>
                    </div>
                </div>
                <input type="hidden" id="organizationLng" name="organizationLng">
                <input type="hidden" id="organizationLat" name="organizationLat">
                <div class="layui-form-item layui-layout-admin">
                    <div class="layui-input-block">
                        <div class="layui-footer" style="left: 0;">
                            <button type="button" class="layui-btn" lay-submit lay-filter="submitForm">提交编辑</button>
                            <button type="button" class="layui-btn layui-btn-primary close">返回上级</button>
                        </div>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
<script src="assets/util.js"></script>
<script src="assets/js/vendor/viewer/viewer.min.js"></script>
<script src="assets/layuiadmin/layui/layui.js"></script>
<script>
    layui.config({
        base: 'assets/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'form', 'laydate', 'laytpl'], function(){
        var $ = layui.$;
        var form = layui.form;
        var laytpl = layui.laytpl;
        var laydate = layui.laydate;
        var organizationId = top.restAjax.params(window.location.href).organizationId;
        var viewerObj = {};


        function closeBox() {
            parent.layer.close(parent.layer.getFrameIndex(window.name));
        }

        // 初始化组织类型ID下拉选择
        function initOrganizationTypeIdSelect(selectValue) {
            top.restAjax.get(top.restAjax.path('api/mongo/data/list/parent-id/9041ffbf-6fb6-4a0d-909b-92aff2d0f432', []), {}, null, function(code, data, args) {
                laytpl(document.getElementById('organizationTypeIdSelectTemplate').innerHTML).render(data, function(html) {
                    document.getElementById('organizationTypeIdSelectTemplateBox').innerHTML = html;
                });
                form.render('select', 'organizationTypeIdSelectTemplateBox');

                var selectObj = {};
                selectObj['organizationTypeId'] = selectValue;
                form.val('dataForm', selectObj);
            }, function(code, data) {
                top.dialog.msg(data.msg);
            });
        }

        function initMasterIdCardCodeSelect(selectValue) {
            top.restAjax.get(top.restAjax.path('api/mongo/data/list/parent-id/76c5044f-805a-4313-b1e8-79e966b97c0d', []), {}, null, function(code, data, args) {
                laytpl(document.getElementById('masterIdCardCodeSelectTemplate').innerHTML).render(data, function(html) {
                    document.getElementById('masterIdCardCodeSelectTemplateBox').innerHTML = html;
                });
                form.render('select', 'masterIdCardCodeSelectTemplateBox');

                var selectObj = {};
                selectObj['masterIdCardCode'] = selectValue;
                form.val('dataForm', selectObj);
            }, function(code, data) {
                top.dialog.msg(data.msg);
            });
        }

        // 初始化网格编码下拉选择
        function initGridCodeSelect(areaCode, selectValue) {
            if(!areaCode) {
                laytpl(document.getElementById('gridCodeSelectTemplate').innerHTML).render([], function(html) {
                    document.getElementById('gridCodeSelectTemplateBox').innerHTML = html;
                });
                form.render('select', 'gridCodeSelectTemplateBox');
                return;
            }
            top.restAjax.get(top.restAjax.path('api/grid/list/area-code/{areaCode}', [areaCode]), {}, null, function(code, data, args) {
                laytpl(document.getElementById('gridCodeSelectTemplate').innerHTML).render(data, function(html) {
                    document.getElementById('gridCodeSelectTemplateBox').innerHTML = html;
                });
                form.render('select', 'gridCodeSelectTemplateBox');

                var selectObj = {};
                selectObj['gridCode'] = selectValue;
                form.val('dataForm', selectObj);
            }, function(code, data) {
                top.dialog.msg(data.msg);
            });
        }

        function refreshDownloadTemplet(fileName, file) {
            var dataRander = {};
            dataRander[fileName] = file;

            laytpl(document.getElementById(fileName +'FileDownload').innerHTML).render(dataRander, function(html) {
                document.getElementById(fileName +'FileBox').innerHTML = html;
            });
        }

        // 初始化文件列表
        function initFileList(fileName, ids, callback) {
            var dataForm = {};
            dataForm[fileName] = ids;
            form.val('dataForm', dataForm);

            if(!ids) {
                refreshDownloadTemplet(fileName, []);
                if(callback) {
                    callback(fileName, []);
                }
                return;
            }

            top.restAjax.get(top.restAjax.path('api/file/list', []), {
                ids: ids
            }, null, function(code, data) {
                refreshDownloadTemplet(fileName, data);
                if(callback) {
                    callback(fileName, data);
                }
            }, function(code, data) {
                top.dialog.msg(data.msg);
            });
        }

        // 初始化营业执照图片上传
        function initBusinessLicenseUploadFile() {
            var files = $('#businessLicense').val();
            initFileList('businessLicense', files, function(fileName) {
                var viewer = new Viewer(document.getElementById(fileName +'FileBox'), {navbar: false});
                viewerObj[fileName] = viewer;
            });

            form.on('button(businessLicenseUploadFile)', function(obj) {
                var name = this.dataset.name;
                var explain = this.dataset.explain;
                top.dialog.file({
                    type: 'image',
                    title: '上传'+ explain,
                    width: '400px',
                    height: '420px',
                    maxFileCount: '1',
                    onClose: function() {
                        var uploadFileArray = top.dialog.dialogData.uploadFileArray;
                        if(typeof(uploadFileArray) != 'undefined' && uploadFileArray.length > 0) {
                            var files = $('#'+ name).val();
                            for(var j = 0, file = uploadFileArray[j]; file = uploadFileArray[j++];) {
                                if(files.length > 0) {
                                    files += ',';
                                }
                                files += file.data;
                            }
                            initFileList(name, files, function(fileName) {
                                viewerObj[fileName].update();
                            });
                        }
                    }
                });
            });

            form.on('button(businessLicenseRemoveFile)', function(obj) {
                var name = this.dataset.name;
                var id = this.dataset.id;
                var files = $('#'+ name).val().replace(id, '');
                files = files.replace(/\,+/g, ',');
                if(files.charAt(0) == ',') {
                    files = files.substring(1);
                }
                if(files.charAt(files.length - 1) == ',') {
                    files = files.substring(0, files.length - 1);
                }
                initFileList(name, files, function(fileName) {
                    viewerObj[fileName].update();
                });
            });
        }

        // 初始化负责人证件正面图片上传
        function initMasterIdCardFrontUploadFile() {
            var files = $('#masterIdCardFront').val();
            initFileList('masterIdCardFront', files, function(fileName) {
                var viewer = new Viewer(document.getElementById(fileName +'FileBox'), {navbar: false});
                viewerObj[fileName] = viewer;
            });

            form.on('button(masterIdCardFrontUploadFile)', function(obj) {
                var name = this.dataset.name;
                var explain = this.dataset.explain;
                top.dialog.file({
                    type: 'image',
                    title: '上传'+ explain,
                    width: '400px',
                    height: '420px',
                    maxFileCount: '1',
                    onClose: function() {
                        var uploadFileArray = top.dialog.dialogData.uploadFileArray;
                        if(typeof(uploadFileArray) != 'undefined' && uploadFileArray.length > 0) {
                            var files = $('#'+ name).val();
                            for(var j = 0, file = uploadFileArray[j]; file = uploadFileArray[j++];) {
                                if(files.length > 0) {
                                    files += ',';
                                }
                                files += file.data;
                            }
                            initFileList(name, files, function(fileName) {
                                viewerObj[fileName].update();
                            });
                        }
                    }
                });
            });

            form.on('button(masterIdCardFrontRemoveFile)', function(obj) {
                var name = this.dataset.name;
                var id = this.dataset.id;
                var files = $('#'+ name).val().replace(id, '');
                files = files.replace(/\,+/g, ',');
                if(files.charAt(0) == ',') {
                    files = files.substring(1);
                }
                if(files.charAt(files.length - 1) == ',') {
                    files = files.substring(0, files.length - 1);
                }
                initFileList(name, files, function(fileName) {
                    viewerObj[fileName].update();
                });
            });
        }

        // 初始化负责人证件背面图片上传
        function initMasterIdCardBackUploadFile() {
            var files = $('#masterIdCardBack').val();
            initFileList('masterIdCardBack', files, function(fileName) {
                var viewer = new Viewer(document.getElementById(fileName +'FileBox'), {navbar: false});
                viewerObj[fileName] = viewer;
            });

            form.on('button(masterIdCardBackUploadFile)', function(obj) {
                var name = this.dataset.name;
                var explain = this.dataset.explain;
                top.dialog.file({
                    type: 'image',
                    title: '上传'+ explain,
                    width: '400px',
                    height: '420px',
                    maxFileCount: '1',
                    onClose: function() {
                        var uploadFileArray = top.dialog.dialogData.uploadFileArray;
                        if(typeof(uploadFileArray) != 'undefined' && uploadFileArray.length > 0) {
                            var files = $('#'+ name).val();
                            for(var j = 0, file = uploadFileArray[j]; file = uploadFileArray[j++];) {
                                if(files.length > 0) {
                                    files += ',';
                                }
                                files += file.data;
                            }
                            initFileList(name, files, function(fileName) {
                                viewerObj[fileName].update();
                            });
                        }
                    }
                });
            });

            form.on('button(masterIdCardBackRemoveFile)', function(obj) {
                var name = this.dataset.name;
                var id = this.dataset.id;
                var files = $('#'+ name).val().replace(id, '');
                files = files.replace(/\,+/g, ',');
                if(files.charAt(0) == ',') {
                    files = files.substring(1);
                }
                if(files.charAt(files.length - 1) == ',') {
                    files = files.substring(0, files.length - 1);
                }
                initFileList(name, files, function(fileName) {
                    viewerObj[fileName].update();
                });
            });
        }

        // 初始化关注度ID下拉选择
        function initDegreeOfConcernIdSelect(selectValue) {
            top.restAjax.get(top.restAjax.path('api/mongo/data/list/parent-id/6f046742-7399-4c57-bfe2-d159470f4b45', []), {}, null, function(code, data, args) {
                laytpl(document.getElementById('degreeOfConcernIdSelectTemplate').innerHTML).render(data, function(html) {
                    document.getElementById('degreeOfConcernIdSelectTemplateBox').innerHTML = html;
                });
                form.render('select', 'degreeOfConcernIdSelectTemplateBox');

                var selectObj = {};
                selectObj['degreeOfConcernId'] = selectValue;
                form.val('dataForm', selectObj);
            }, function(code, data) {
                top.dialog.msg(data.msg);
            });
        }

        // 初始化门面照片图片上传
        function initFacadePhotosUploadFile() {
            var files = $('#facadePhotos').val();
            initFileList('facadePhotos', files, function(fileName) {
                var viewer = new Viewer(document.getElementById(fileName +'FileBox'), {navbar: false});
                viewerObj[fileName] = viewer;
            });

            form.on('button(facadePhotosUploadFile)', function(obj) {
                var name = this.dataset.name;
                var explain = this.dataset.explain;
                top.dialog.file({
                    type: 'image',
                    title: '上传'+ explain,
                    width: '400px',
                    height: '420px',
                    maxFileCount: '1',
                    onClose: function() {
                        var uploadFileArray = top.dialog.dialogData.uploadFileArray;
                        if(typeof(uploadFileArray) != 'undefined' && uploadFileArray.length > 0) {
                            var files = $('#'+ name).val();
                            for(var j = 0, file = uploadFileArray[j]; file = uploadFileArray[j++];) {
                                if(files.length > 0) {
                                    files += ',';
                                }
                                files += file.data;
                            }
                            initFileList(name, files, function(fileName) {
                                viewerObj[fileName].update();
                            });
                        }
                    }
                });
            });

            form.on('button(facadePhotosRemoveFile)', function(obj) {
                var name = this.dataset.name;
                var id = this.dataset.id;
                var files = $('#'+ name).val().replace(id, '');
                files = files.replace(/\,+/g, ',');
                if(files.charAt(0) == ',') {
                    files = files.substring(1);
                }
                if(files.charAt(files.length - 1) == ',') {
                    files = files.substring(0, files.length - 1);
                }
                initFileList(name, files, function(fileName) {
                    viewerObj[fileName].update();
                });
            });
        }

        // 初始化工作场所照片图片上传
        function initWorkplacePhotosUploadFile() {
            var files = $('#workplacePhotos').val();
            initFileList('workplacePhotos', files, function(fileName) {
                var viewer = new Viewer(document.getElementById(fileName +'FileBox'), {navbar: false});
                viewerObj[fileName] = viewer;
            });

            form.on('button(workplacePhotosUploadFile)', function(obj) {
                var name = this.dataset.name;
                var explain = this.dataset.explain;
                top.dialog.file({
                    type: 'image',
                    title: '上传'+ explain,
                    width: '400px',
                    height: '420px',
                    maxFileCount: '1',
                    onClose: function() {
                        var uploadFileArray = top.dialog.dialogData.uploadFileArray;
                        if(typeof(uploadFileArray) != 'undefined' && uploadFileArray.length > 0) {
                            var files = $('#'+ name).val();
                            for(var j = 0, file = uploadFileArray[j]; file = uploadFileArray[j++];) {
                                if(files.length > 0) {
                                    files += ',';
                                }
                                files += file.data;
                            }
                            initFileList(name, files, function(fileName) {
                                viewerObj[fileName].update();
                            });
                        }
                    }
                });
            });

            form.on('button(workplacePhotosRemoveFile)', function(obj) {
                var name = this.dataset.name;
                var id = this.dataset.id;
                var files = $('#'+ name).val().replace(id, '');
                files = files.replace(/\,+/g, ',');
                if(files.charAt(0) == ',') {
                    files = files.substring(1);
                }
                if(files.charAt(files.length - 1) == ',') {
                    files = files.substring(0, files.length - 1);
                }
                initFileList(name, files, function(fileName) {
                    viewerObj[fileName].update();
                });
            });
        }


        // 初始化内容
        function initData() {
            var loadLayerIndex;
            top.restAjax.get(top.restAjax.path('api/organization/get/{organizationId}', [organizationId]), {}, null, function(code, data) {
                var dataFormData = {};
                for(var i in data) {
                    dataFormData[i] = data[i] +'';
                }
                form.val('dataForm', dataFormData);
                form.render(null, 'dataForm');
                initOrganizationTypeIdSelect(data['organizationTypeId'] +'|'+ data['organizationTypeName']);
                initGridCodeSelect(data['areaCode'], data['gridCode'] +'|'+ data['gridName']);
                initBusinessLicenseUploadFile();
                initMasterIdCardCodeSelect(data['masterIdCardCode'] +'|'+ data['masterIdCardCodeName']);
                initMasterIdCardFrontUploadFile();
                initMasterIdCardBackUploadFile();
                initDegreeOfConcernIdSelect(data['degreeOfConcernId'] +'|'+ data['degreeOfConcernName']);
                initFacadePhotosUploadFile();
                initWorkplacePhotosUploadFile();
            }, function(code, data) {
                top.dialog.msg(data.msg);
            }, function() {
                loadLayerIndex = top.dialog.msg(top.dataMessage.loading, {icon: 16, time: 0, shade: 0.3});
            }, function() {
                top.dialog.close(loadLayerIndex);
            });
        }
        initData();
        
        // 提交表单
        form.on('submit(submitForm)', function(formData) {
            top.dialog.confirm(top.dataMessage.commit, function(index) {
                top.dialog.close(index);
                var loadLayerIndex;
                setOrganizationField(formData);
                top.restAjax.put(top.restAjax.path('api/organization/update/{organizationId}', [organizationId]), formData.field, null, function(code, data) {
                    var layerIndex = top.dialog.msg(top.dataMessage.updateSuccess, {
                        time: 0,
                        btn: [top.dataMessage.button.yes, top.dataMessage.button.no],
                        shade: 0.3,
                        yes: function(index) {
                            top.dialog.close(index);
                            window.location.reload();
                        },
                        btn2: function() {
                            closeBox();
                        }
                    });
                }, function(code, data) {
                    top.dialog.msg(data.msg);
                }, function() {
                    loadLayerIndex = top.dialog.msg(top.dataMessage.committing, {icon: 16, time: 0, shade: 0.3});
                }, function() {
                    top.dialog.close(loadLayerIndex);
                });
            });
            return false;
        });

        $('.close').on('click', function() {
            closeBox();
        });

        $('#areaName').on('click', function() {
            top.dialog.open({
                title: '选择地区',
                url: top.restAjax.path('route/mongo/area/get-select?areaName={areaName}', [encodeURI($('#areaName').val())]),
                width: '600px',
                height: '225px',
                onClose: function() {
                    var selectedAreaArray = top.dialog.dialogData.selectedAreaArray;
                    var areaCode = '';
                    var areaName = '';
                    if(selectedAreaArray.length > 0) {
                        areaCode = selectedAreaArray[selectedAreaArray.length - 1].areaCode;
                        for(var i = 0, item; item = selectedAreaArray[i++];) {
                            if(areaName) {
                                areaName += ',';
                            }
                            areaName += item.areaName;
                        }
                    }
                    $('#areaCode').val(areaCode);
                    $('#areaName').val(areaName);
                    initGridCodeSelect(areaCode);
                }
            })
        });

        // 校验
        form.verify({
        });
    });
</script>
</body>
</html>