<%@ tag language="java" pageEncoding="UTF-8"%>
<%@ include file="/webpage/include/taglib.jsp"%>
<%@ attribute name="id" type="java.lang.String" required="true" description="编号"%>
<%@ attribute name="name" type="java.lang.String" required="true" description="隐藏域名称（ID）"%>
<%@ attribute name="value" type="java.lang.String" required="true" description="隐藏域值（ID）"%>
<%@ attribute name="labelName" type="java.lang.String" required="false" description="输入框名称（Name）"%>
<%@ attribute name="labelValue" type="java.lang.String" required="false" description="输入框值（Name）"%>
<%@ attribute name="fieldLabels" type="java.lang.String" required="false" description="表格Th里显示的名字"%>
<%@ attribute name="fieldKeys" type="java.lang.String" required="false" description="表格Td里显示的值"%>
<%@ attribute name="searchLabel" type="java.lang.String" required="false" description="表格Td里显示的值"%>
<%@ attribute name="searchKey" type="java.lang.String" required="false" description="表格Td里显示的值"%>
<%@ attribute name="title" type="java.lang.String" required="true" description="选择框标题"%>
<%@ attribute name="url" type="java.lang.String" required="true" description="数据地址"%>
<%@ attribute name="isAll" type="java.lang.Boolean" required="true" description="所在公司所有数据还是权限数据"%>
<%@ attribute name="isSingle" type="java.lang.Boolean" required="true" description="表格是否可多选"%>
<%@ attribute name="cssClass" type="java.lang.String" required="false" description="css样式"%>
<%@ attribute name="cssStyle" type="java.lang.String" required="false" description="css样式"%>
<%@ attribute name="disabled" type="java.lang.String" required="false" description="是否限制选择，如果限制，设置为disabled"%>
<script type="text/javascript">
    function searchGrid${id}(){
        top.layer.open({
            type: 2,
            area: ['90%','90%'],
            title:"${title}",
            skin:"two-btns",
            name:'friend',
            content: encodeURI("${url}?url=${url}&isAll=${isAll}&isSingle=${isSingle}") ,
            btn: ['确定', '关闭'],
            yes: function(index, layero){
                var iframeWin = layero.find('iframe')[0].contentWindow; //得到iframe页的窗口对象，执行iframe页的方法：iframeWin.method();
                var item = iframeWin.getSelectedItem();
                if(item == "-1"){
                    return;
                }
                if(${isSingle}){//单选
                    selectUserInfo(item);
                }else{//多选
                    var ids = [], names = [];
                    for (var i=0;i<item.length;i++){
                        ids.push(item[i].id);
                        names.push(item[i].name);
                    }
                    var arr=ids.join(",").replace(/u_/ig,"");
                    selectUserInfo(arr);
                }
                top.layer.close(index);//关闭对话框。

            },
            cancel: function(index){
            }
        });
    };
</script>
<span class="input-group-btn" style="width: 30px">
	       		 <a href="javascript:void(0);" style="font-size:14px;" onclick="searchGrid${id}($('#${id}Id').val(),'${id}')" id="${id}Button"  class="nav-btn nav-btn-add"><i class="fa fa-search-plus"></i> 选择</a>
			 </span>
<label id="${id}Name-error" class="error" for="${id}Name" style="display:none"></label>
