<!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">
</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">
                <div class="layui-form-item">
                    <input type="hidden" id="homicideName" name="homicideName" class="layui-input" value="" placeholder="请输入案件名称"  maxlength="100">
                    <input type="hidden" id="homicideCode" name="homicideCode" class="layui-input" value="" placeholder="请输入案件编号"  maxlength="50">
                    <label class="layui-form-label">案件名称<span style="color: red;vertical-align: middle;">*</span></label>
                    <div class="layui-input-block layui-form" id="homicideIdSelectTemplateBox" lay-filter="homicideIdSelectTemplateBox"></div>
                    <script id="homicideIdSelectTemplate" type="text/html">
                        <select id="homicideId" name="homicideId" lay-filter="homicideId" lay-verify="required" lay-search>
                            <option value="">请选择案件</option>
                            {{# for(var i = 0, item; item = d[i++];) { }}
                            <option value="{{item.homicideId}},{{item.homicideCode}}">{{item.homicideName}}</option>
                            {{# } }}
                        </select>
                    </script>
                </div>
                <div class="layui-form-item layui-row">
                    <div class="layui-col-lg6">
                        <input type="hidden" id="cardCodeName" name="cardCodeName" class="layui-input" value="" placeholder="请输入证件代码名称"  maxlength="50">
                        <input type="hidden" id="cardCodeCode" name="cardCodeCode" class="layui-input" value="" placeholder="请输入证件代码编码"  maxlength="3">
                        <label class="layui-form-label">证件代码<span style="color: red;vertical-align: middle;">*</span></label>
                        <div class="layui-input-block layui-form" id="cardCodeSelectTemplateBox" lay-filter="cardCodeSelectTemplateBox"></div>
                        <script id="cardCodeSelectTemplate" type="text/html">
                            <select id="cardCode" name="cardCode" lay-filter="cardCode" lay-verify="required" lay-search>
                                <option value="">请选择证件代码</option>
                                {{# for(var i = 0, item; item = d[i++];) { }}
                                <option value="{{item.dataId}},{{item.dataSummary}}">{{item.dataName}}</option>
                                {{# } }}
                            </select>
                        </script>
                    </div>
                    <div class="layui-col-lg6">
                        <label class="layui-form-label">证件号码<span style="color: red;vertical-align: middle;">*</span></label>
                        <div class="layui-input-block">
                            <input type="text" id="cardNum" name="cardNum" class="layui-input" value="" placeholder="请输入证件号码"  lay-verify="required" maxlength="30">
                        </div>
                    </div>
                </div>
                <div class="layui-form-item layui-row">
                    <div class="layui-col-lg6">
                        <label class="layui-form-label">姓名<span style="color: red;vertical-align: middle;">*</span></label>
                        <div class="layui-input-block">
                            <input type="text" id="name" name="name" class="layui-input" value="" placeholder="请输入姓名"  lay-verify="required" maxlength="80">
                        </div>
                    </div>
                    <div class="layui-col-lg6">
                        <label class="layui-form-label">曾用名</label>
                        <div class="layui-input-block">
                            <input type="text" id="beforeName" name="beforeName" class="layui-input" value="" placeholder="请输入曾用名"  maxlength="50">
                        </div>
                    </div>
                </div>
                <div class="layui-form-item layui-row">
                    <div class="layui-col-lg6">
                        <input type="hidden" id="sexName" name="sexName" class="layui-input" value="" placeholder="请输入性别名称"  maxlength="50">
                        <input type="hidden" id="sexCode" name="sexCode" class="layui-input" value="" placeholder="请输入性别编码"  maxlength="1">
                        <label class="layui-form-label">性别<span style="color: red;vertical-align: middle;">*</span></label>
                        <div class="layui-input-block layui-form" id="sexSelectTemplateBox" lay-filter="sexSelectTemplateBox"></div>
                        <script id="sexSelectTemplate" type="text/html">
                            <select id="sex" name="sex" lay-filter="sex" lay-verify="required" lay-search>
                                <option value="">请选择性别</option>
                                {{# for(var i = 0, item; item = d[i++];) { }}
                                <option value="{{item.dataId}},{{item.dataSummary}}">{{item.dataName}}</option>
                                {{# } }}
                            </select>
                        </script>
                    </div>
                    <div class="layui-col-lg6">
                        <label class="layui-form-label">出生日期<span style="color: red;vertical-align: middle;">*</span></label>
                        <div class="layui-input-block">
                            <input type="text" id="birthday" name="birthday" class="layui-input" value="" placeholder="请选择出生日期" readonly style="cursor: pointer;" lay-verify="required">
                        </div>
                    </div>
                </div>
                <div class="layui-form-item layui-row">
                    <div class="layui-col-lg6">
                        <input type="hidden" id="nationalityName" name="nationalityName" class="layui-input" value="" placeholder="请输入国籍(地区)名称"  maxlength="50">
                        <input type="hidden" id="nationalityCode" name="nationalityCode" class="layui-input" value="" placeholder="请输入国籍(地区)编码"  maxlength="3">
                        <label class="layui-form-label">国籍(地区)</label>
                        <div class="layui-input-block layui-form" id="nationalitySelectTemplateBox" lay-filter="nationalitySelectTemplateBox"></div>
                        <script id="nationalitySelectTemplate" type="text/html">
                            <select id="nationality" name="nationality" lay-filter="nationality" lay-search>
                                <option value="">请选择国籍(地区)</option>
                                {{# for(var i = 0, item; item = d[i++];) { }}
                                <option value="{{item.dataId}},{{item.dataSummary}}">{{item.dataName}}</option>
                                {{# } }}
                            </select>
                        </script>
                    </div>
                    <div class="layui-col-lg6">
                        <input type="hidden" id="nationName" name="nationName" class="layui-input" value="" placeholder="请输入民族名称"  maxlength="50">
                        <input type="hidden" id="nationCode" name="nationCode" class="layui-input" value="" placeholder="请输入民族编码"  maxlength="2">
                        <label class="layui-form-label">民族</label>
                        <div class="layui-input-block layui-form" id="nationSelectTemplateBox" lay-filter="nationSelectTemplateBox"></div>
                        <script id="nationSelectTemplate" type="text/html">
                            <select id="nation" name="nation" lay-filter="nation" lay-search>
                                <option value="">请选择民族</option>
                                {{# for(var i = 0, item; item = d[i++];) { }}
                                <option value="{{item.dataId}},{{item.dataSummary}}">{{item.dataName}}</option>
                                {{# } }}
                            </select>
                        </script>
                    </div>
                </div>
                <div class="layui-form-item">
                    <input type="hidden" id="nativePlace" name="nativePlace" class="layui-input" value="" placeholder="请输入籍贯名称"  maxlength="50">
                    <input type="hidden" id="nativePlaceCode" name="nativePlaceCode" class="layui-input" value="" placeholder="请输入籍贯编码"  maxlength="12">
                    <label class="layui-form-label">籍贯</label>
                    <div class="layui-input-block">
                        <input type="text" id="nativePlaceName" name="nativePlaceName" class="layui-input" value="" placeholder="请输入籍贯"  maxlength="100">
                    </div>
                </div>
                <div class="layui-form-item layui-row">
                    <div class="layui-col-lg6">
                        <input type="hidden" id="maritalName" name="maritalName" class="layui-input" value="" placeholder="请输入婚姻状况名称"  maxlength="50">
                        <input type="hidden" id="maritalCode" name="maritalCode" class="layui-input" value="" placeholder="请输入婚姻状况编码"  maxlength="2">
                        <label class="layui-form-label">婚姻状况</label>
                        <div class="layui-input-block layui-form" id="maritalSelectTemplateBox" lay-filter="maritalSelectTemplateBox"></div>
                        <script id="maritalSelectTemplate" type="text/html">
                            <select id="marital" name="marital" lay-filter="marital" lay-search>
                                <option value="">请选择婚姻状况</option>
                                {{# for(var i = 0, item; item = d[i++];) { }}
                                <option value="{{item.dataId}},{{item.dataSummary}}">{{item.dataName}}</option>
                                {{# } }}
                            </select>
                        </script>
                    </div>
                    <div class="layui-col-lg6">
                        <input type="hidden" id="politicalOutlookName" name="politicalOutlookName" class="layui-input" value="" placeholder="请输入政治面貌名称"  maxlength="50">
                        <input type="hidden" id="politicalOutlookCode" name="politicalOutlookCode" class="layui-input" value="" placeholder="请输入政治面貌编码"  maxlength="2">
                        <label class="layui-form-label">政治面貌</label>
                        <div class="layui-input-block layui-form" id="politicalOutlookSelectTemplateBox" lay-filter="politicalOutlookSelectTemplateBox"></div>
                        <script id="politicalOutlookSelectTemplate" type="text/html">
                            <select id="politicalOutlook" name="politicalOutlook" lay-filter="politicalOutlook" lay-search>
                                <option value="">请选择政治面貌</option>
                                {{# for(var i = 0, item; item = d[i++];) { }}
                                <option value="{{item.dataId}},{{item.dataSummary}}">{{item.dataName}}</option>
                                {{# } }}
                            </select>
                        </script>
                    </div>
                </div>
                <div class="layui-form-item layui-row">
                    <div class="layui-col-lg6">
                        <input type="hidden" id="educationName" name="educationName" class="layui-input" value="" placeholder="请输入学历名称"  maxlength="50">
                        <input type="hidden" id="educationCode" name="educationCode" class="layui-input" value="" placeholder="请输入学历编码"  maxlength="2">
                        <label class="layui-form-label">学历</label>
                        <div class="layui-input-block layui-form" id="educationSelectTemplateBox" lay-filter="educationSelectTemplateBox"></div>
                        <script id="educationSelectTemplate" type="text/html">
                            <select id="education" name="education" lay-filter="education" lay-search>
                                <option value="">请选择学历</option>
                                {{# for(var i = 0, item; item = d[i++];) { }}
                                <option value="{{item.dataId}},{{item.dataSummary}}">{{item.dataName}}</option>
                                {{# } }}
                            </select>
                        </script>
                    </div>
                    <div class="layui-col-lg6">
                        <input type="hidden" id="religiousName" name="religiousName" class="layui-input" value="" placeholder="请输入宗教信仰名称" maxlength="50">
                        <input type="hidden" id="religiousCode" name="religiousCode" class="layui-input" value="" placeholder="请输入宗教信仰编码" maxlength="2">
                        <label class="layui-form-label">宗教信仰</label>
                        <div class="layui-input-block layui-form" id="religiousSelectTemplateBox" lay-filter="religiousSelectTemplateBox"></div>
                        <script id="religiousSelectTemplate" type="text/html">
                            <select id="religious" name="religious" lay-filter="religious" lay-search>
                                <option value="">请选择宗教信仰</option>
                                {{# for(var i = 0, item; item = d[i++];) { }}
                                <option value="{{item.dataId}},{{item.dataSummary}}">{{item.dataName}}</option>
                                {{# } }}
                            </select>
                        </script>
                    </div>
                </div>
                <div class="layui-form-item layui-row">
                    <div class="layui-col-lg6">
                        <input type="hidden" id="workTypeName" name="workTypeName" class="layui-input" value="" placeholder="请输入字典表名称"  maxlength="50">
                        <input type="hidden" id="workTypeCode" name="workTypeCode" class="layui-input" value="" placeholder="请输入字典表编码"  maxlength="5">
                        <label class="layui-form-label">职业类别</label>
                        <div class="layui-input-block layui-form" id="workTypeSelectTemplateBox" lay-filter="workTypeSelectTemplateBox"></div>
                        <script id="workTypeSelectTemplate" type="text/html">
                            <select id="workType" name="workType" lay-filter="workType" lay-search>
                                <option value="">请选择职业类别</option>
                                {{# for(var i = 0, item; item = d[i++];) { }}
                                <option value="{{item.dataId}},{{item.dataSummary}}">{{item.dataName}}</option>
                                {{# } }}
                            </select>
                        </script>
                    </div>
                    <div class="layui-col-lg6">
                        <label class="layui-form-label">职业</label>
                        <div class="layui-input-block">
                            <input type="text" id="work" name="work" class="layui-input" value="" placeholder="请输入职业"  maxlength="30">
                        </div>
                    </div>
                </div>
                <div class="layui-form-item layui-row">
                    <div class="layui-col-lg6">
                        <label class="layui-form-label">服务处所</label>
                        <div class="layui-input-block">
                            <input type="text" id="servicePremises" name="servicePremises" class="layui-input" value="" placeholder="请输入服务处所"  maxlength="100">
                        </div>
                    </div>
                    <!--<div class="layui-col-lg6">
                        <input type="hidden" id="householdRegister" name="householdRegister" class="layui-input" value="" placeholder="请输入户籍地名称"  maxlength="50">
                        <input type="hidden" id="householdRegisterCode" name="householdRegisterCode" class="layui-input" value="" placeholder="请输入户籍地编码"  maxlength="12">
                        <label class="layui-form-label">户籍地<span style="color: red;vertical-align: middle;">*</span></label>
                        <div class="layui-input-block">
                            <input type="text" id="householdRegisterName" name="householdRegisterName" class="layui-input" value="" lay-verify="required" placeholder="请输入户籍地" readonly maxlength="100">
                        </div>
                    </div>-->
                    <div class="layui-col-lg6">
                        <label class="layui-form-label" style="width: 126px;">户籍门(楼)祥址</label>
                        <div class="layui-input-block" style="margin-left: 126px;">
                            <input type="text" id="householdRegisterAddress" name="householdRegisterAddress" class="layui-input" value="" placeholder="请输入户籍门(楼)祥址" maxlength="80">
                        </div>
                    </div>
                </div>
                <!--<div class="layui-form-item">
                    <input type="hidden" id="currentResidence" name="currentResidence" class="layui-input" value="" placeholder="请输入现住地名称"  maxlength="50">
                    <input type="hidden" id="currentResidenceCode" name="currentResidenceCode" class="layui-input" value="" placeholder="请输入现住地编码"  maxlength="12">
                    <label class="layui-form-label">现住地</label>
                    <div class="layui-input-block">
                        <input type="text" id="currentResidenceName" name="currentResidenceName" class="layui-input" value="" placeholder="点击选择现住地" readonly maxlength="100">
                    </div>
                </div>-->
                <div class="layui-form-item">
                    <label class="layui-form-label" style="width: 126px;">现住门(楼)祥址</label>
                    <div class="layui-input-block" style="margin-left: 126px;">
                        <input type="text" id="currentResidenceAddress" name="currentResidenceAddress" class="layui-input" value="" placeholder="请输入现住门(楼)祥址"  maxlength="80">
                    </div>
                </div>
                <div class="layui-form-item layui-row" pane>
                    <div class="layui-col-lg4" pane>
                        <label class="layui-form-label" style="width: 191px;">是否为严重精神障碍患者<span style="color: red;vertical-align: middle;">*</span></label>
                        <div class="layui-input-block" style="margin-left: 191px;">
                            <input type="radio" name="isMental" lay-filter="isMental" value="0" title="否" checked>
                            <input type="radio" name="isMental" lay-filter="isMental" value="1" title="是">
                        </div>
                    </div>
                    <div class="layui-col-lg4" pane>
                        <label class="layui-form-label" style="width: 135px;">是否为未成年人<span style="color: red;vertical-align: middle;">*</span></label>
                        <div class="layui-input-block" style="margin-left: 135px;">
                            <input type="radio" name="isJuveniles" lay-filter="isJuveniles" value="0" title="否" checked>
                            <input type="radio" name="isJuveniles" lay-filter="isJuveniles" value="1" title="是">
                        </div>
                    </div>
                    <div class="layui-col-lg4" pane>
                        <label class="layui-form-label" style="width: 122px;">是否为青少年<span style="color: red;vertical-align: middle;">*</span></label>
                        <div class="layui-input-block" style="margin-left: 122px;">
                            <input type="radio" name="isTeenagers" lay-filter="isTeenagers" value="0" title="否" checked>
                            <input type="radio" name="isTeenagers" lay-filter="isTeenagers" value="1" title="是">
                        </div>
                    </div>
                </div>
                <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/js/vendor/wangEditor/wangEditor.min.js"></script>
<script src="assets/js/vendor/ckplayer/ckplayer/ckplayer.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 wangEditor = window.wangEditor;
        var wangEditorObj = {};
        var viewerObj = {};

        // 案件名称change事件
        form.on('select(homicideId)', function(data){
            if(!data.value) {

            }else {
                var valueArr = data.value.split(',');
                if(2 == valueArr.length) {
                    var text = $('#homicideId option:selected').text();
                    $('#homicideId option:selected').val(valueArr[0]);
                    $('#homicideName').val(text);
                    $('#homicideCode').val(valueArr[1]);
                }
            }
            form.render("select");
        });

        // 证件代码change事件
        form.on('select(cardCode)', function(data){
            if(!data.value) {

            }else {
                var valueArr = data.value.split(',');
                if(2 == valueArr.length) {
                    var text = $('#cardCode option:selected').text();
                    $('#cardCode option:selected').val(valueArr[0]);
                    $('#cardCodeName').val(text);
                    $('#cardCodeCode').val(valueArr[1]);
                }
            }
            form.render("select");
        });

        // 性别change事件
        form.on('select(sex)', function(data){
            if(!data.value) {

            }else {
                var valueArr = data.value.split(',');
                if(2 == valueArr.length) {
                    var text = $('#sex option:selected').text();
                    $('#sex option:selected').val(valueArr[0]);
                    $('#sexName').val(text);
                    $('#sexCode').val(valueArr[1]);
                }
            }
            form.render("select");
        });

        // 国籍(地区)change事件
        form.on('select(nationality)', function(data){
            if(!data.value) {

            }else {
                var valueArr = data.value.split(',');
                if(2 == valueArr.length) {
                    var text = $('#nationality option:selected').text();
                    $('#nationality option:selected').val(valueArr[0]);
                    $('#nationalityName').val(text);
                    $('#nationalityCode').val(valueArr[1]);
                }
            }
            form.render("select");
        });

        // 民族change事件
        form.on('select(nation)', function(data){
            if(!data.value) {

            }else {
                var valueArr = data.value.split(',');
                if(2 == valueArr.length) {
                    var text = $('#nation option:selected').text();
                    $('#nation option:selected').val(valueArr[0]);
                    $('#nationName').val(text);
                    $('#nationCode').val(valueArr[1]);
                }
            }
            form.render("select");
        });

        // 婚姻状况change事件
        form.on('select(marital)', function(data){
            if(!data.value) {

            }else {
                var valueArr = data.value.split(',');
                if(2 == valueArr.length) {
                    var text = $('#marital option:selected').text();
                    $('#marital option:selected').val(valueArr[0]);
                    $('#maritalName').val(text);
                    $('#maritalCode').val(valueArr[1]);
                }
            }
            form.render("select");
        });

        // 政治面貌change事件
        form.on('select(politicalOutlook)', function(data){
            if(!data.value) {

            }else {
                var valueArr = data.value.split(',');
                if(2 == valueArr.length) {
                    var text = $('#politicalOutlook option:selected').text();
                    $('#politicalOutlook option:selected').val(valueArr[0]);
                    $('#politicalOutlookName').val(text);
                    $('#politicalOutlookCode').val(valueArr[1]);
                }
            }
            form.render("select");
        });

        // 学历change事件
        form.on('select(education)', function(data){
            if(!data.value) {

            }else {
                var valueArr = data.value.split(',');
                if(2 == valueArr.length) {
                    var text = $('#education option:selected').text();
                    $('#education option:selected').val(valueArr[0]);
                    $('#educationName').val(text);
                    $('#educationCode').val(valueArr[1]);
                }
            }
            form.render("select");
        });

        // 宗教信仰change事件
        form.on('select(religious)', function(data){
            if(!data.value) {

            }else {
                var valueArr = data.value.split(',');
                if(2 == valueArr.length) {
                    var text = $('#religious option:selected').text();
                    $('#religious option:selected').val(valueArr[0]);
                    $('#religiousName').val(text);
                    $('#religiousCode').val(valueArr[1]);
                }
            }
            form.render("select");
        });

        // 职业类别change事件
        form.on('select(workType)', function(data){
            if(!data.value) {

            }else {
                var valueArr = data.value.split(',');
                if(2 == valueArr.length) {
                    var text = $('#workType option:selected').text();
                    $('#workType option:selected').val(valueArr[0]);
                    $('#workTypeName').val(text);
                    $('#workTypeCode').val(valueArr[1]);
                }
            }
            form.render("select");
        });

        // 选择籍贯
        /*$(document).on('click', '#nativePlaceName', function() {
            top.dialog.open({
                title: '选择地区',
                url: top.restAjax.path('route/mongo/area/get-select?areaName={areaName}', [encodeURI($('#nativePlaceName').val())]),
                width: '800px',
                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;
                        }
                    }
                    $('#nativePlaceCode').val(areaCode);
                    $('#nativePlaceName').val(areaName);
                }
            })
        });*/

        // 选择户籍地
        /*$(document).on('click', '#householdRegisterName', function() {
            top.dialog.open({
                title: '选择地区',
                url: top.restAjax.path('route/mongo/area/get-select?areaName={areaName}', [encodeURI($('#householdRegisterName').val())]),
                width: '800px',
                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;
                        }
                    }
                    $('#householdRegisterCode').val(areaCode);
                    $('#householdRegisterName').val(areaName);
                }
            })
        });*/

        // 选择现住地
        $(document).on('click', '#currentResidenceName', function() {
            top.dialog.open({
                title: '选择地区',
                url: top.restAjax.path('route/mongo/area/get-select?areaName={areaName}', [encodeURI($('#currentResidenceName').val())]),
                width: '800px',
                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;
                        }
                        $('#currentResidenceCode').val(areaCode);
                        $('#currentResidenceName').val(areaName);
                    }
                }
            })
        });

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

        // 初始化案件ID下拉选择
        function initHomicideIdSelect() {
            top.restAjax.get(top.restAjax.path('api/homicide/list', []), {}, null, function(code, data, args) {
                laytpl(document.getElementById('homicideIdSelectTemplate').innerHTML).render(data, function(html) {
                    document.getElementById('homicideIdSelectTemplateBox').innerHTML = html;
                });
                console.log(data)
                form.render('select', 'homicideIdSelectTemplateBox');
            }, function(code, data) {
                top.dialog.msg(data.msg);
            });
        }

        // 初始化证件代码下拉选择
        function initCardCodeSelect() {
            top.restAjax.get(top.restAjax.path('api/mongo/data/list-all/parent-id/{dataParentId}', ['76c5044f-805a-4313-b1e8-79e966b97c0d']), {}, null, function(code, data, args) {
                laytpl(document.getElementById('cardCodeSelectTemplate').innerHTML).render(data, function(html) {
                    document.getElementById('cardCodeSelectTemplateBox').innerHTML = html;
                });
                form.render('select', 'cardCodeSelectTemplateBox');
            }, function(code, data) {
                top.dialog.msg(data.msg);
            });
        }

        // 初始化性别下拉选择
        function initSexSelect() {
            top.restAjax.get(top.restAjax.path('api/mongo/data/list-all/parent-id/{dataParentId}', ['4ef46940-76ab-4758-b5f0-0cbc93ffc660']), {}, null, function(code, data, args) {
                laytpl(document.getElementById('sexSelectTemplate').innerHTML).render(data, function(html) {
                    document.getElementById('sexSelectTemplateBox').innerHTML = html;
                });
                form.render('select', 'sexSelectTemplateBox');
            }, function(code, data) {
                top.dialog.msg(data.msg);
            });
        }

        // 初始化国籍(地区)下拉选择
        function initNationalitySelect() {
            top.restAjax.get(top.restAjax.path('api/mongo/data/list-all/parent-id/{dataParentId}', ['1c9098f8-155a-453e-8766-51d8df1556b3']), {}, null, function(code, data, args) {
                laytpl(document.getElementById('nationalitySelectTemplate').innerHTML).render(data, function(html) {
                    document.getElementById('nationalitySelectTemplateBox').innerHTML = html;
                });
                form.render('select', 'nationalitySelectTemplateBox');
            }, function(code, data) {
                top.dialog.msg(data.msg);
            });
        }

        // 初始化民族下拉选择
        function initNationSelect() {
            top.restAjax.get(top.restAjax.path('api/mongo/data/list-all/parent-id/{dataParentId}', ['a981579c-572b-4fd1-8e76-5d17df97f6a4']), {}, null, function(code, data, args) {
                laytpl(document.getElementById('nationSelectTemplate').innerHTML).render(data, function(html) {
                    document.getElementById('nationSelectTemplateBox').innerHTML = html;
                });
                form.render('select', 'nationSelectTemplateBox');
            }, function(code, data) {
                top.dialog.msg(data.msg);
            });
        }

        // 初始化婚姻状况下拉选择
        function initMaritalSelect() {
            top.restAjax.get(top.restAjax.path('api/mongo/data/list-all/parent-id/{dataParentId}', ['91bdd01b-e9d2-4a2b-98b5-45e25d3cd8ae']), {}, null, function(code, data, args) {
                laytpl(document.getElementById('maritalSelectTemplate').innerHTML).render(data, function(html) {
                    document.getElementById('maritalSelectTemplateBox').innerHTML = html;
                });
                form.render('select', 'maritalSelectTemplateBox');
            }, function(code, data) {
                top.dialog.msg(data.msg);
            });
        }

        // 初始化政治面貌下拉选择
        function initPoliticalOutlookSelect() {
            top.restAjax.get(top.restAjax.path('api/mongo/data/list-all/parent-id/{dataParentId}', ['b2c96de0-3df8-41db-99b1-bc4e24ac6c24']), {}, null, function(code, data, args) {
                laytpl(document.getElementById('politicalOutlookSelectTemplate').innerHTML).render(data, function(html) {
                    document.getElementById('politicalOutlookSelectTemplateBox').innerHTML = html;
                });
                form.render('select', 'politicalOutlookSelectTemplateBox');
            }, function(code, data) {
                top.dialog.msg(data.msg);
            });
        }

        // 初始化学历下拉选择
        function initEducationSelect() {
            top.restAjax.get(top.restAjax.path('api/mongo/data/list-all/parent-id/{dataParentId}', ['d6b9f026-6ea9-456a-b48b-0c18d502523b']), {}, null, function(code, data, args) {
                laytpl(document.getElementById('educationSelectTemplate').innerHTML).render(data, function(html) {
                    document.getElementById('educationSelectTemplateBox').innerHTML = html;
                });
                form.render('select', 'educationSelectTemplateBox');
            }, function(code, data) {
                top.dialog.msg(data.msg);
            });
        }

        // 初始化宗教信仰下拉选择
        function initReligiousSelect() {
            top.restAjax.get(top.restAjax.path('api/mongo/data/list-all/parent-id/{dataParentId}', ['792e5742-d302-4943-b04c-161f406ea7ca']), {}, null, function(code, data, args) {
                laytpl(document.getElementById('religiousSelectTemplate').innerHTML).render(data, function(html) {
                    document.getElementById('religiousSelectTemplateBox').innerHTML = html;
                });
                form.render('select', 'religiousSelectTemplateBox');
            }, function(code, data) {
                top.dialog.msg(data.msg);
            });
        }

        // 初始化职业类别下拉选择
        function initWorkTypeSelect() {
            top.restAjax.get(top.restAjax.path('api/mongo/data/list-all/parent-id/{dataParentId}', ['5867642c-2b79-4bea-adc9-477a5b784159']), {}, null, function(code, data, args) {
                laytpl(document.getElementById('workTypeSelectTemplate').innerHTML).render(data, function(html) {
                    document.getElementById('workTypeSelectTemplateBox').innerHTML = html;
                });
                form.render('select', 'workTypeSelectTemplateBox');
            }, function(code, data) {
                top.dialog.msg(data.msg);
            });
        }

        // 初始化出生日期日期
        function initBirthdayDate() {
            laydate.render({
                elem: '#birthday',
                type: 'date',
                value: new Date(),
                trigger: 'click'
            });
        }

        // 初始化内容
        function initData() {
            initHomicideIdSelect();
            initCardCodeSelect();
            initSexSelect();
            initBirthdayDate();
            initNationalitySelect();
            initNationSelect();
            initMaritalSelect();
            initPoliticalOutlookSelect();
            initEducationSelect();
            initReligiousSelect();
            initWorkTypeSelect();
        }
        initData();

        // 提交表单
        form.on('submit(submitForm)', function(formData) {
            top.dialog.confirm(top.dataMessage.commit, function(index) {
                top.dialog.close(index);
                var loadLayerIndex;
                top.restAjax.post(top.restAjax.path('api/homicidesuspect/save', []), formData.field, null, function(code, data) {
                    var layerIndex = top.dialog.msg(top.dataMessage.commitSuccess, {
                        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();
        });
    });
</script>
</body>
</html>