<form class="form-horizontal" id="userDetailForm">
    <input class="hidden" name="userId" th:value="${user.userId}">
    <div class="box-body">
        <div class="form-group">
            <label  class="col-sm-3 control-label">用户名 :</label>
            <div class="col-sm-8">
                <input  name="username" class="form-control" readonly="readonly" min="3" require="必填项"  placeholder="" th:value="${user.username}">
            </div>
        </div>
        <div class="form-group">
            <label  class="col-sm-3 control-label">邮箱 :</label>
            <div class="col-sm-8">
                <input name="email" class="form-control" placeholder="" th:value="${user.email}">
            </div>
        </div>
        <div class="form-group">
            <label  class="col-sm-3 control-label">电话 :</label>

            <div class="col-sm-8">
                <input name="phone" class="form-control" placeholder="" th:value="${user.phone}">
            </div>
        </div>
        <div class="form-group">
            <label  class="col-sm-3 control-label">性别 :</label>
            <div class="col-sm-8">
                <select name="sex" class="form-control" require="必填项">
                    <option th:selected="${user.sex==1}" value="1">男</option>
                    <option th:selected="${user.sex==2}" value="2">女</option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label  class="col-sm-3 control-label">年龄 :</label>
            <div class="col-sm-8">
                <input name="age" class="form-control" placeholder="" th:value="${user.age}">
            </div>
        </div>
    </div>
    <!-- /.box-body -->
    <div class="box-footer">
        <div class="pull-right">
            <button type="button" id="saveDetailUser" class="btn btn-info">确定</button>
            <button type="button" data-dismiss="modal" class="btn btn-default">取消</button>
        </div>
    </div>
    <!-- /.box-footer -->
</form>
<script>
    $(function () {
        $("#saveDetailUser").on('click', function () {
            if (doValidForm(userDetailForm)) {
                Core.mask("#saveDetailUser");
                Core.postAjax("[[@{/user/edit}]]",$("#userDetailForm").serialize(),function (data) {
                    if (data.ret==0) {
                        Core.unmask("#saveDetailUser");
                        $("#userDetailModal").modal("hide");
                        $("#myModal").modal("hide");
                        Core.refreshTable("#table",true);
                    }
                    layer.msg(data.msg);
                })
            }
        });
    });
</script>