<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('涉密人员申请')" />
    <th:block th:include="include :: select2-css" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<style>
    .select2-container--bootstrap.select2-container--disabled .select2-selection, .select2-container--bootstrap.select2-container--disabled .select2-selection--multiple .select2-selection__choice {
        background: none;
    }
    .select2-container--bootstrap .select2-selection--multiple .select2-selection__choice {
        color: #fff;
        background-color: #1AB394 !important;
        border: 1px solid #1AB394;
        border-radius: 4px;
        cursor: default;
        float: left;
        margin: 5px 0 0 6px;
        padding: 0 6px;
    }
</style>
<body>
<div class="main-content">
    <form class="form-horizontal" id="form-user-edit" th:object="${user}">
        <input name="userId"  type="hidden"  th:field="*{userId}" />
        <input name="deptId"  type="hidden"  th:field="*{deptId}" id="treeId"/>
        <h4 class="form-header h4">基本信息</h4>
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">人员姓名：</label>
                    <div class="col-sm-8">
                        <input name="userName" disabled placeholder="请输入人员姓名" class="form-control" type="text" maxlength="30" th:field="*{userName}" required>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">所属单位：</label>
                    <div class="col-sm-8">
                        <div class="input-group">
                            <input class="form-control" disabled type="text" name="deptName" id="treeName" th:field="*{dept.deptName}">
                            <span class="input-group-addon"><i class="fa fa-search"></i></span>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">手机号码：</label>
                    <div class="col-sm-8">
                        <div class="input-group">
                            <input name="phonenumber" disabled placeholder="请输入手机号码" class="form-control" type="text" maxlength="11" th:field="*{phonenumber}">
                            <span class="input-group-addon"><i class="fa fa-mobile"></i></span>
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">邮箱：</label>
                    <div class="col-sm-8">
                        <div class="input-group">
                            <input name="email" disabled class="form-control email" type="text" maxlength="50" placeholder="请输入邮箱" th:field="*{email}">
                            <span class="input-group-addon"><i class="fa fa-envelope"></i></span>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">登录账号：</label>
                    <div class="col-sm-8">
                        <input class="form-control" disabled type="text" readonly="true" th:field="*{loginName}"/>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">身份证号码：</label>
                    <div class="col-sm-8">
                        <input disabled class="form-control" type="text"  th:field="*{cerno}">
                    </div>
                </div>
            </div>
            <input type="hidden" id="status">
        </div>
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">岗位：</label>
                    <div class="col-sm-8">
                        <select id="post" disabled class="form-control select2-multiple" multiple>
                            <option th:each="post:${posts}" th:value="${post.postId}" th:text="${post.postName}" th:selected="${post.flag}" th:disabled="${post.status == '1'}"></option>
                        </select>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">用户性别：</label>
                    <div class="col-sm-8">
                        <select name="sex" disabled class="form-control m-b" th:with="type=${@dict.getType('sys_user_sex')}">
                            <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{sex}"></option>
                        </select>
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">角色：</label>
                    <div class="col-sm-8">
                        <label th:each="role:${roles}" class="check-box">
                            <input name="role" disabled type="checkbox" th:value="${role.roleId}" th:text="${role.roleName}" th:checked="${role.flag}">
                        </label>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">健康状况：</label>
                    <div class="col-sm-8">
                        <input name="helthy" disabled class="form-control"  th:field="*{helthy}" type="text">
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">用户地区：</label>
                    <div class="col-sm-8">
                        <input name="userarea" disabled class="form-control" th:field="*{userarea}" type="text">
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">民族：</label>
                    <div class="col-sm-8">
                        <select name="nation" disabled class="form-control m-b" th:with="type=${@dict.getType('sys_user_nation')}">
                            <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                        </select>
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">出生年月：</label>
                    <div class="col-sm-8">
                        <div class="input-group date">
                            <input name="birthday" disabled th:value="${#dates.format(user.birthday, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
                            <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">政治面貌：</label>
                    <div class="col-sm-8">
                        <select name="politics" disabled class="form-control m-b" th:with="type=${@dict.getType('sys_user_politics')}">
                            <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                        </select>
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">是否持有护照或港澳通行证：</label>
                    <div class="col-sm-8">
                        <div class="radio-box" th:each="dict : ${@dict.getType('sys_user_passport')}">
                            <input type="radio" disabled th:id="${dict.dictCode}" name="havePassport" th:value="${dict.dictValue}" th:field="*{havePassport}">
                            <label th:for="${dict.dictCode}" th:text="${dict.dictLabel}"></label>
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label ">是否具有出入境备案：</label>
                    <div class="col-sm-8">
                        <div class="radio-box" th:each="dict : ${@dict.getType('sys_user_passport')}">
                            <input type="radio" disabled th:id="${dict.dictCode}" name="entryexitFiling" th:value="${dict.dictValue}" th:field="*{entryexitFiling}">
                            <label th:for="${dict.dictCode}" th:text="${dict.dictLabel}"></label>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">涉密程度：</label>
                    <div class="col-sm-8">
                        <select name="shemichengdu" disabled class="form-control m-b" th:with="type=${@dict.getType('sys_user_shemi')}">
                            <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                        </select>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">学历：</label>
                    <div class="col-sm-8">
                        <input name="graduate" disabled th:field="*{graduate}" class="form-control" type="text">
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">保密协议签订书：</label>
                    <div class="col-sm-8">
                        <span class="btn btn-white btn-file">
                            <span class="fileinput-filename" onclick="downloadFile()">文件下载</span>
                            <input type="hidden" id="fileUrl" name="confAgreement" th:field="*{confAgreement}" >
					    </span>
                        <span class="fileinput-filename">[[*{confName}]]</span>
                        <a href="#" class="close fileinput-exists" data-dismiss="fileinput" style="float: none"> </a>
                    </div>
                </div>
            </div>
        </div>
        <h4 class="form-header h4">其他信息</h4>
        <div class="row">
            <div class="col-sm-12">
                <div class="form-group">
                    <label class="col-xs-2 control-label">备注：</label>
                    <div class="col-xs-10">
                        <textarea name="remark" disabled maxlength="500" class="form-control" rows="3">[[*{remark}]]</textarea>
                    </div>
                </div>
            </div>
        </div>
    </form>
</div>
<div class="row">
    <div class="col-sm-offset-5 col-sm-10">
        <button type="button" class="btn btn-sm btn-primary" onclick="pass()"><i class="fa fa-check"></i>提 交</button>&nbsp;
        <button type="button" class="btn btn-sm btn-danger" onclick="closeItem()"><i class="fa fa-reply-all"></i>关 闭 </button>
        <div style="display: none;" class="sysuser_name" th:text="${sysuser.userName}"></div>
    </div>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: select2-js" />
<th:block th:include="include :: datetimepicker-js" />
<script type="text/javascript">
    function downloadFile(){
        var fileUrl = $("#fileUrl").val();
        window.location.href = ctx + "common/download/resource?resource=" + encodeURI(fileUrl) ;
    }
    var prefix = ctx + "system/userApply";
    function pass(){
        let id = $("input[name='userId']").val()
        $.ajax({
            type : "GET",
            url : prefix + '/submit/' + id,
            async : false,
            beforeSend: function () {
                $.modal.loading("正在处理中，请稍候...");
            },
            success: function(result) {
                $.operate.successTabCallback(result);
            }
        });
    }

    $("input[name='birthday']").datetimepicker({
        format: "yyyy-mm-dd",
        minView: "month",
        autoclose: true
    });

    $(function() {
        $('#post').select2({
            placeholder: "请选择岗位",
            allowClear: true
        });
    })
</script>
</body>
</html>
