<%@ page import="com.jeeplus.modules.sys.utils.UserUtils" %>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/webpage/include/taglib.jsp"%>
<html>
<head>
	<title>选择工作流角色</title>
	<meta name="decorator" content="default"/>


	<style>
		.widthClass{
			display: inline-block;
		}
		.shows .input-group{
			width: 48%!important;
		}
	</style>
	<style>
		body{
			background-color:transparent;
			filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#26FFFFFF, endColorstr=#26FFFFFF);
			color:#ffffff;
			background-color:rgba(255,255,255,0);
			height:100%;
		}
	</style>
</head>
<body>
<div class="wrapper wrapper-content">
	<sys:message content="${message}"/>
	<div class="layui-row">
		<div class="full-width fl">
			<div class="contentShadow layui-row" id="queryDiv">
				<form:form id="searchForm" modelAttribute="sysRoleActivity" action="${ctx}/sys/office/treeDataRoleActivitys" method="post" class="form-inline">
					<div class="commonQuery ">
						<div class="layui-item query athird">
							<label class="layui-form-label">角色名称:</label>
							<div class="layui-input-block">
								<form:input path="name" htmlEscape="false" maxlength="20"  class=" form-control layui-input"/>
							</div>
						</div>
						<div class="layui-item query athird">
							<label class="layui-form-label">角色类型:</label>
							<div class="layui-input-block with-icon">
								<form:select path="type" class="form-control required simple-select">
									<form:option value="" label=""/>
									<form:options items="${fns:getDictList('sys_role_type')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
								</form:select>
							</div>
						</div>
						<div class="layui-item athird">
							<div class="input-group">
								<a href="#" id="moresee"><i class="glyphicon glyphicon-menu-down"></i></a>
								<button id="searchReset" class="fixed-btn searchReset fr" onclick="resetSearch()">重置</button>
								<button id="searchQuery" class="fixed-btn searchQuery fr" onclick="search()">查询</button>
							</div>
						</div>
						<div style="    clear:both;"></div>
					</div>
					<div id="moresees" style="clear:both;display:none;">
						<div style="clear:both;"></div>
					</div>
				</form:form>
			</div>
		</div>

		<div class="full-width fl">
			<div class="contentShadow layui-form contentDetails">

				<table class="oa-table layui-table" id="contentTable">
					<thead>
					<tr>
						<th width="40" style="text-align: center"><input type="checkbox" class="i-checks"></th>
						<th width="40%" style="text-align: center">角色名称</th>
						<th style="text-align: center">角色类型</th>
						<th style="text-align: center">备注</th>
					</tr>
					</thead>
					<tbody>
					<c:forEach items="${roleList}" var="sysRoleActivity" varStatus="index">
						<tr id="${index.index}">
							<td style="text-align:center;"> <input type="checkbox" id="${sysRoleActivity.id}" class="i-checks"></td>
							<td class="codelabe0">${sysRoleActivity.name}</td>
							<td class="codelabe1">${fns:getDictLabel(sysRoleActivity.type, 'sys_role_type', '')}</td>
							<td class="codelabe2" style="display: none">${sysRoleActivity.type}</td>
							<td class="codelabe3" >${sysRoleActivity.remarks}</td>
						</tr>
					</c:forEach>

					</tbody>
				</table>

				<!-- 分页代码 -->
				<table:page page="${page}"></table:page>
				<div style="clear: both;"></div>
			</div>
		</div>
	</div>
</div>
<script>
</script>
<script type="text/javascript">
    $(document).ready(function() {
        //搜索框收放
        $('#moresee').click(function(){
            if($('#moresees').is(':visible'))
            {
                $('#moresees').slideUp(0,resizeListWindow1);
                $('#moresee i').removeClass("glyphicon glyphicon-menu-up").addClass("glyphicon glyphicon-menu-down");
            }else{
                $('#moresees').slideDown(0,resizeListWindow1);
                $('#moresee i').removeClass("glyphicon glyphicon-menu-down").addClass("glyphicon glyphicon-menu-up");
            }
        });
        laydate.render({
            elem: '#beginDate',
            event: 'focus',
            type : 'date'
        });
        laydate.render({
            elem: '#endDate',
            event: 'focus',
            type : 'date'
        });
        $('#contentTable thead tr th input.i-checks').on('ifChecked', function(event){ //ifCreated 事件应该在插件初始化之前绑定
            $('#contentTable tbody tr td input.i-checks').iCheck('check');
        });
        $('#contentTable thead tr th input.i-checks').on('ifUnchecked', function(event){ //ifCreated 事件应该在插件初始化之前绑定
            $('#contentTable tbody tr td input.i-checks').iCheck('uncheck');
        });
    });

    function getSelectedItem(){
        var isSingle=${isSingle};
        var size = $("#contentTable tbody tr td input.i-checks:checked").size();
        if(size == 0 ){
            top.layer.alert('请至少选择一条数据!', {icon: 0, title:'警告'});
            return "-1";
        }
        if(isSingle){//单选
            if(size >1 ){
                top.layer.alert('请选择一条数据!', {icon: 0, title:'警告'});
                return "-1";
            }
            var id =  $("#contentTable tbody tr td input.i-checks:checked").attr("id");
            var name = $("#contentTable tbody tr td input.i-checks:checked").parent().parent().parent().find(".codelabe0").html();
            var typeName = $("#contentTable tbody tr td input.i-checks:checked").parent().parent().parent().find(".codelabel").html();
            var type = $("#contentTable tbody tr td input.i-checks:checked").parent().parent().parent().find(".codelabe2").html();
            var remarks = $("#contentTable tbody tr td input.i-checks:checked").parent().parent().parent().find(".codelabe3").html();
            var data = {'id':id,'name':name,'typeName':typeName,'type':type,'remarks':remarks};
            return data;
		}else{
            var arr=new Array();
            $("#contentTable tbody tr td input.i-checks:checked").each(function () {
                var id =  $(this).attr("id");
                var name = $(this).parent().parent().parent().find(".codelabe0").html();
                var typeName = $(this).parent().parent().parent().find(".codelabe1").html();
                var type = $(this).parent().parent().parent().find(".codelabe2").html();
                var remarks = $(this).parent().parent().parent().find(".codelabe3").html();
                var data = {'id':id,'name':name,'typeName':typeName,'type':type,'remarks':remarks};
                arr.push(data);
            })
            return arr;
		}
    }
</script>
</body>
</html>