@model string
<div class="main">

    <form class="form-horizontal form form-lg ui-formBind" method="post" id="_form" data-source="@Model">
        <div class="control-group">
            <label class="control-label">Api名称</label>
            <div class="controls">
                <input type="text" value="" class="form-control" maxlength="50" id="Name" name="Name" data-validate="dataType:'*',nullMsg:'请填写Api名称!'" />
                <span class="help-block">仅用于api的分类标识</span>
            </div>
        </div>

        <div class="control-group">
            <label class="control-label">Api控制器名称</label>
            <div class="controls">
                <input type="text" value="" class="form-control" maxlength="50" id="Controller" name="Controller" data-validate="dataType:'*',nullMsg:'请填写控制名称!'" />
                <span class="help-block">Api的控制器名称，不需要填写Controller后缀</span>
            </div>
        </div>

        <div class="control-group">
            <label class="control-label">Api方法名称</label>
            <div class="controls">
                <input type="text" value="" class="form-control" maxlength="50" id="Action" name="Action" data-validate="dataType:'*',nullMsg:'请填写方法名称!'" />
                <span class="help-block">Api的方法名称</span>
            </div>
        </div>

        <div class="control-group">
            <label class="control-label">备注/使用说明</label>
            <div class="controls">
                <textarea id="Remark" name="Remark" class="form-control textarea" style="height:100px"></textarea>
                <span class="help-block">留空则由系统自动生成当前字段表单代码</span>
            </div>
        </div>

        <div class="control-group">
            <label class="control-label">是否Token验证</label>
            <div class="controls">
                <select id="CheckApiToken" name="CheckApiToken" class="form-control form-control-sm">
                    <option value="1">是</option>
                    <option value="0">否</option>
                </select>
                <span class="help-block">如选择是，则每次请求会检测请求头中名为ApiToken的数据，ApiToken采用AppId+时间戳的对称加密密文。</span>
            </div>
        </div>

        <div class="control-group">
            <label class="control-label">UserToken验证</label>
            <div class="controls">
                <select id="CheckUserToken" name="CheckUserToken" class="form-control form-control-sm ui-show-hide">
                    <option value="0" hideObjs="#userSet">否</option>
                    <option value="1" showObjs="#userSet">是</option>
                </select>
                <span class="help-block">如选择是，每次请求会检测请求头中名为UserToken的数据。</span>
            </div>
        </div>

        <div id="userSet">
            <div class="control-group">
                <label class="control-label">选择有权限的角色</label>
                <div class="controls">
                    <select id="RoleIds" name="RoleIds" class="form-control ui-convertSelect" multiple style="display:block;height:120px;" data-custom-params="url:'@Url.Action("LoadListByIds","Role")'"></select>
                    <div class="btn-group btn-group-sm" style="margin-top:5px;">
                        <a href="javascript:void(0)" class="btn btn-default btn-sm ui-dialog" data-custom-params="title:'选择角色',url:'@Url.Action("Select","Role")?objname=#RoleIds',width:'500px',height:'90%',target:'self'">选择角色</a>
                        <a href="javascript:void(0)" class="btn btn-default btn-sm ui-removeSelectedOptions" title="按住Ctrl键可实现多选" data-custom-params="obj:'#RoleIds'">删除选中</a>
                    </div>
                    <span class="help-block">不选择则不对角色进行权限验证</span>
                </div>
            </div>

            <div class="control-group">
                <label class="control-label">选择有权限的会员组</label>
                <div class="controls">
                    <select id="MemberGroupIds" name="MemberGroupIds" class="form-control ui-convertSelect" multiple style="display:block;height:120px;" data-custom-params="url:'@Url.Action("LoadListByIds","MemberGroup")'"></select>
                    <div class="btn-group btn-group-sm" style="margin-top:5px;">
                        <a href="javascript:void(0)" class="btn btn-default btn-sm ui-dialog" data-custom-params="title:'选择会员组',url:'@Url.Action("Select","MemberGroup")?objname=#MemberGroupIds',width:'500px',height:'90%',target:'self'">选择会员组</a>
                        <a href="javascript:void(0)" class="btn btn-default btn-sm ui-removeSelectedOptions" title="按住Ctrl键可实现多选" data-custom-params="obj:'#MemberGroupIds'">删除选中</a>
                    </div>
                    <span class="help-block">不选择则不对会员组进行权限验证</span>
                </div>
            </div>

            <div class="control-group">
                <label class="control-label">选择有权限的部门组</label>
                <div class="controls">
                    <select id="DepartmentIds" name="DepartmentIds" class="form-control ui-convertSelect" multiple style="display:block;height:120px;" data-custom-params="url:'@Url.Action("LoadListByIds","DepartMent")',onlySelectFinal:true"></select>
                    <div class="btn-group btn-group-sm" style="margin-top:5px;">
                        <a href="javascript:void(0)" class="btn btn-default btn-sm ui-dialog" data-custom-params="title:'选择部门',url:'@Url.Action("Select","Department")?objname=#DepartmentIds',width:'500px',height:'90%',target:'self'">选择部门</a>
                        <a href="javascript:void(0)" class="btn btn-default btn-sm ui-removeSelectedOptions" title="按住Ctrl键可实现多选" data-custom-params="obj:'DepartmentIds'">删除选中</a>
                    </div>
                    <span class="help-block">不选择则不对部门进行权限验证</span>
                </div>
            </div>

            <div class="control-group">
                <label class="control-label">选择有权限的用户</label>
                <div class="controls">
                    <select id="Uids" name="Uids" class="form-control ui-convertSelect" multiple style="display:block;height:120px;" data-custom-params="url:'@Url.Action("LoadListByIds","Member")',textField: 'Username'"></select>
                    <div class="btn-group btn-group-sm" style="margin-top:5px;">
                        <a href="javascript:void(0)" class="btn btn-default btn-sm ui-dialog" data-custom-params="title:'选择用户',url:'@Url.Action("Select","Member")?objname=#Uids',width:'80%',height:'90%',target:'self'">选择用户</a>
                        <a href="javascript:void(0)" class="btn btn-default btn-sm ui-removeSelectedOptions" title="按住Ctrl键可实现多选" data-custom-params="obj:'Uids'">删除选中</a>
                    </div>
                    <span class="help-block">不选择则不对具体用户进行权限验证</span>
                </div>
            </div>
        </div>

        <div class="control-group">
            <label class="control-label"></label>
            <div class="controls">
                @Html.AntiForgeryToken()
                <input type="hidden" id="Id" name="Id" />
                <button type="button" class="btn btn-primary btn-sm ui-pagePost" data-custom-params="url:'@Url.Action()',callBack:'PostRefreshBack',beforeExecute:'BeforeExecute'" id="bt_submit">提交</button>
                <button type="button" class="btn btn-default btn-sm ui-closeDialog">关闭</button>
                <span class="help-block"></span>
            </div>
        </div>
    </form>
</div>
<script type="text/javascript">
    var data = $(".ui-formBind").attr("data-source");
    data = JsonParse(data);
    $("#userSet").FormBind({}, data.AuthorizeConfig);
    function BeforeExecute() {

        return true;
    }
</script>