<!-- 办公管理-业务绩效考核管理-平台常量修改 -->
<style>
    input::-webkit-outer-spin-button,
    input::-webkit-inner-spin-button {
        -webkit-appearance: none;
        appearance: none;
        margin: 0;
    }
</style>
<input type="hidden" value="update" id="type"/>
<div class="base-extend">
    <div class="modal fade businessDialog" id="myModal-updateRank" data-backdrop="static">
        <div class="modal-dialog" style="width:9rem;">
            <form class="form-horizontal" id="updateRankForm" autocomplete="off">
                <input type="hidden" name="id" th:value="${followRankLimitConst?.id}"/>
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal">
                        <span aria-hidden="true" style="font-size:0.18rem">×</span><span class="sr-only">关闭</span>
                    </button>
                    <span class="modal-title">修改职级</span>
                </div>
                <div class="modal-content" style="max-height:4.7rem;overflow-y:auto;overflow-x:hidden;">
                    <div class="newTabAddUpdateBox" style="position:static;border:none;padding-left:0.2rem;padding-right:0.2rem;padding-bottom:0;">
                        <span tag:token/>
                        <div class="row">
                            <table>
                                <tr>
                                    <td width="15%">
                                        <span class="required_fileds_star">职级</span>：
                                    </td>
                                    <td width="35%" class="enter">
                                        <input type="text"name="rank" id="rank" class="form-control" th:value="${followRankLimitConst?.rank}">
                                    </td>
                                </tr>
                                <tr>
                                    <td width="15%">
                                        <span class="required_fileds_star">一般跟投金额上限（元）</span>：
                                    </td>
                                    <td width="35%" class="enter">
                                        <input type="text" name="commonFollowAmountLimit" id="commonFollowAmountLimit" class="form-control" th:value="${followRankLimitConst?.commonFollowAmountLimit}">
                                    </td>
                                </tr>
                                <tr>
                                    <td width="15%">
                                        <span class="required_fileds_star">强制跟投金额上限（元）</span>：
                                    </td>
                                    <td width="35%" class="enter">
                                        <input type="text" name="constraintFollowAmountLimit" id="constraintFollowAmountLimit" class="form-control" th:value="${followRankLimitConst?.constraintFollowAmountLimit}">
                                    </td>
                                </tr>
                            </table>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button class="btn btn-default btn-white btn-info colorbtn updateRankSure" style='margin-bottom:0;'>确定</button>
                    <button class="btn btn-default btn-white btn-info canclebtn" data-dismiss="modal" style='margin-bottom:0;'>取消</button>
                </div>
            </form>
        </div>
    </div>
</div>


<script>
    $('.updateRankSure').removeClass("loadingCircle");


    //表单验证
    function rankFormValid(e){
        $("#updateRankForm").validate({
            promptPosition : "bottomLeft",
            submitHandler : function(form) {
                var formurl = '',tipword = '',formchoose = '';
                formurl = '/follow/rankLimit/do_update';
                tipword = '修改';
                formchoose = '#myModal-updateRank'
                var postdata = {
                    'token':$("[name=token]").val(),
                    'id':$("[name=id]").val(),
                    'rank':$("[name=rank]").val(),
                    'commonFollowAmountLimit':$("#commonFollowAmountLimit").val(),
                    'constraintFollowAmountLimit':$("#constraintFollowAmountLimit").val()
                };

                $('.updateRankSure').addClass("loadingCircle");
                $.ajax({
                    url:formurl,
                    type:'post',
                    data:postdata,
                    success:function(data){
                        if( data.success ){
                            new $.zui.Messager(tipword+'职级成功', {
                                type: 'success'
                            }).show();
                            $('.updateRankSure').removeClass("loadingCircle");
                            //关闭弹框
                            $(formchoose).modal("hide");
                            //弹框被隐藏, 且过渡效果执行完毕
                            $(formchoose).on('hidden.zui.modal', function(){
                                //刷新表格
                                $(".yk_rightcontent").load('/follow/rankLimit/list');
                                return false;
                            });
                        }else{
                            new $.zui.Messager(tipword+'职级失败:'+ data.msg, {
                                type: 'danger'
                            }).show();
                            $('.updateRankSure').removeClass("loadingCircle");
                        }
                    },
                    error:function(status){
                        new $.zui.Messager(tipword+'职级时出错:'+status, {
                            type: 'danger'
                        }).show();
                        $('.updateRankSure').removeClass("loadingCircle");
                    }
                })
            },
            rules : {
                'rank':{
                    required:true
                },
                'commonFollowAmountLimit':{
                    required : true,
                    // decimalLengthValid:true,
                    //decimalNumberValid:true,
                    //decimalPointValid:true
                },
                'constraintFollowAmountLimit':{//备注
                    required : true,
                }
            },
            messages : {
                'rank':{
                    required : "请输入职级"
                },
                'commonFollowAmountLimit':{
                    required : "请输入一般跟投金额上限"
                },
                'constraintFollowAmountLimit':{
                    required : "请输入强制跟投金额上限"
                }
            }
        })
    };
    rankFormValid();

    //确定保存按钮
    $(".updateRankSure").click(rankFormValid);

</script>
