<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>业务类别管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			/*getRegion();*/
			getType();
		});
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
        	return false;
        }

		function getRegion(){
			var selectNode = $("#supplementArea");
			selectNode.empty();//每次需要将上一次的数据进行清空
			$("#supplementArea").append("<option value=''>请选择</option>");
			var  ts_describe=  $("#supplementGroup").val();
			if(ts_describe != null && ts_describe != ''){
				$.ajax({
					type: "POST",
					url: "${ctx}/report/ctBbtcRegion/getRegionList?groupId="+ts_describe,
					dataType: "json",
					success: function(returnedData) {
						var data1 = returnedData.ctBbtcRegionList;
//                            console.log(data1[0].name);
//                            console.log(data2[0].name);
						/* var selectNode = $("#area");
                         selectNode.empty();//每次需要将上一次的数据进行清空
                         $("#area").append("<option value=''>请选择</option>");*/
						if (data1 != '') {
							var slsb=document.getElementById("supplementArea");
							for (var i = 0;i < data1.length;i++){
								slsb.append(new Option(data1[i].name,data1[i].id));
							}
						}
						var area="${ctBbtcBusCategory.supplementArea}";
						if( area != null && area != ''){
							$("#supplementArea").val(area);
						}
					},error:function(data){
						alert(系统错误);
					}
				});
			}else{
				/*  top.$.jBox.tip('请选择被举报集团', 'warning');*/
			}

		}

		/*跟据  集团区域   查询类型*/
		function getType(){
			var selectNode = $("#supplementType");
			selectNode.empty();//每次需要将上一次的数据进行清空
			selectNode.append("<option value=''>请选择</option>");

			var  ts_describe1=  $("#supplementGroup").val();
			/*var  ts_describe2=  $("#supplementArea").val();*/
			if(ts_describe1 != null && ts_describe1 != ''){
				$.ajax({
					type: "POST",
					url: "${ctx}/report/ctBbtcBusType/getTypeList?groupId="+ts_describe1,
					dataType: "json",
					success: function(returnedData) {
						var data2 = returnedData.ctBbtcTypeList;

						if (data2 != '') {
							var slsb=document.getElementById("supplementType");
							for (var i = 0;i < data2.length;i++){
								slsb.append(new Option(data2[i].typeName,data2[i].parentId));
							}
						}
						var type="${ctBbtcBusCategory.typeName}";
						if( type != null && type != ''){
							$("#supplementType").val(type);
						}
					},error:function(data){
						alert("系统错误");
					}
				});
			}else{
				/*top.$.jBox.tip('请选择所属集团', 'warning');*/
			}

		}

		function resetPageNo() {
			$("#pageNo").val(0);
		}

	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/report/ctBbtcBusCategory/">业务类别列表</a></li>
		<shiro:hasPermission name="report:ctBbtcBusCategory:edit"><li><a href="${ctx}/report/ctBbtcBusCategory/form">业务类别添加</a></li></shiro:hasPermission>
	</ul>
	<form:form id="searchForm" modelAttribute="ctBbtcBusCategory" action="${ctx}/report/ctBbtcBusCategory/" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<ul class="ul-form">
			<li><label>所属集团：</label>
				<form:select id="supplementGroup" path="ctBbtcGroup" class="input-small required" onchange="getType()" cssStyle="width: 160px">
					<form:option value="">请选择</form:option>
					<form:options items="${fns:getDictList('supplement_group')}" itemLabel="label" itemValue="id"
								  htmlEscape="false"/>
				</form:select>
			</li>

		<%--	<li><label>所属区域：</label>
					&lt;%&ndash; <select id="supplementArea" path="supplementArea" class="input-small required" onchange="resetPageNo();">
                         <option value="">请选择</option>
                             &lt;%&ndash;<options items="${ctBbtcRegionList}" itemLabel="name" itemValue="id"&ndash;%&gt;
                             &lt;%&ndash;htmlEscape="false"/></select>&ndash;%&gt;
                     </select>&ndash;%&gt;
				<form:select id="supplementArea"  onchange="getType();" path="supplementArea" class="input-medium " cssStyle="width: 160px" htmlEscape="false">
					<form:option value="">请选择</form:option>
				</form:select>
			</li>--%>
			<li><label>业务类型：</label>
				<form:select id="supplementType"  onchange="resetPageNo();" path="typeName" class="input-small required" cssStyle="width: 160px">
					<form:option value="">请选择</form:option>
				</form:select>
			</li>
			<li>&nbsp;&nbsp;<label style="width: auto;">业务类别名称：</label>
				<form:input path="name" htmlEscape="false" maxlength="255" class="input-medium"/>
			</li>
			<li class="btns"><input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/></li>
			<li class="clearfix"></li>

		</ul>
	</form:form>
	<sys:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th>业务类别编码</th>
				<th>业务类别名称</th>
				<th>所属集团</th>
				<%--<th>所属区域</th>--%>
				<th>所属业务类型</th>
				<shiro:hasPermission name="report:ctBbtcBusCategory:edit"><th>操作</th></shiro:hasPermission>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${page.list}" var="ctBbtcBusCategory">
			<tr>
				<td><a href="${ctx}/report/ctBbtcBusCategory/form?id=${ctBbtcBusCategory.id}">
					${ctBbtcBusCategory.number}
				</a></td>
				<td>
					${ctBbtcBusCategory.name}
				</td>
				<td align="center">
						${ctBbtcBusCategory.ctBbtcGroup}
				<%--	<c:if test="${ctBbtcBusCategory.ctBbtcGroup eq '3437402691677202102'}">集团本部</c:if>
					<c:if test="${ctBbtcBusCategory.ctBbtcGroup eq '3510129313047280678'}">区域集团</c:if>
					<c:if test="${ctBbtcBusCategory.ctBbtcGroup eq '3565898923067676254'}">服务集团</c:if>
					<c:if test="${ctBbtcBusCategory.ctBbtcGroup eq '3806696792996264972'}">文化集团</c:if>
					<c:if test="${ctBbtcBusCategory.ctBbtcGroup eq '3770618512934949260'}">文旅集团</c:if>--%>
					<c:if test="${ctBbtcBusCategory.ctBbtcGroup eq null}">--</c:if>
				</td>
				<%--<td>
						${ctBbtcBusCategory.supplementArea}
				</td>--%>
				<td>
					${ctBbtcBusCategory.typeName}
				</td>
				<shiro:hasPermission name="report:ctBbtcBusCategory:edit"><td>
    				<a href="${ctx}/report/ctBbtcBusCategory/form?id=${ctBbtcBusCategory.id}">修改</a>
					<a href="${ctx}/report/ctBbtcBusCategory/delete?id=${ctBbtcBusCategory.id}" onclick="return confirmx('确认要删除该业务类别吗？', this.href)">删除</a>
				</td></shiro:hasPermission>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>