dictOfDjxlList.jsp 5.32 KB
<%@ 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() {
			$("tbody > tr").bind("click",function(){
		        if($(this).find('input:checkbox').is(':checked')){
		        	$(this).removeClass("trBgcolor");
		        	$(this).find('input:checkbox').prop('checked', false);
		        }else{
		        	$(this).find('input:checkbox').prop('checked', true);
					$(this).addClass("trBgcolor");
		        }
			});
			
			var djxlStrList = "${djxlStrList}";
			djxlStrList = djxlStrList.substring(1, djxlStrList.length-1);
			var djxlStrListArr = [];
			djxlStrListArr = djxlStrList.split(",");
			
			var currentViewDjxlArr = [];
			$("tbody > tr").each(function(i){
				currentViewDjxlArr.push($(this).find('input:checkbox').val());
	        });
			
			//alert("currentViewDjxlArr: "+currentViewDjxlArr+" ; djxlStrListArr: "+djxlStrListArr);
			
			for(var i=0;i<currentViewDjxlArr.length;i++){
				for(var j=0;j<djxlStrListArr.length;j++){
					if(currentViewDjxlArr[i] == djxlStrListArr[j].replace(" ","")){
						$("#"+currentViewDjxlArr[i]).attr("checked",true);
						$("#"+currentViewDjxlArr[i]).parent().parent().addClass("trBgcolor");
					}
				}
			}
		});
		
		//CheckBox 全选 |注意:当checkbox disabled时不能进行操作 
		function selectAll(){
			var a = document.getElementsByTagName("input");
			for(var i = 0;i<a.length;i++){
				if(a[i].type == "checkbox" && a[i].disabled != true){ 
					a[i].checked = true;
				}
			}
			$("tbody > tr").each(function(i){    
	             $(this).addClass("trBgcolor");
	        });
		}
		//全不选择  |注意:当checkbox disabled时不能进行操作
		function unselectAll(){
			var a = document.getElementsByTagName("input");
			for(var i = 0;i<a.length;i++){
				if(a[i].type == "checkbox" && a[i].disabled != true){
					a[i].checked = false;
				}
			}
			$("tbody > tr").each(function(i){    
	             $(this).removeClass("trBgcolor");
	        });
		}
		
		function djxlOfficeSubmit(){
			var chk_value =[];
			$('input[name="djxl"]:checked').each(function(){
				chk_value.push($(this).val());
			});
			if(chk_value.length == 0){
				alert('你还没有选择任何登记小类!');
				chk_value =[];
				return;
			}
			var chk_value_str = chk_value.join("-");
			$.ajax({ 
				type:"POST", 
				url:"${ctx}/sys/setdjxl/sysDjxlOffice/savebat", 
				cache: false, 
				data:"chk_value_str="+ chk_value_str +"&officeid=${officeid}",
			    async : false,  
				success:function(modelmap){
					if(modelmap.issucess == 1){
						 //预留给父页面写上或者弹出提示的话语,比如当前您选择了****的业务
						 alert("您当前选择了登记业务小类:"+chk_value_str);
						 //然后关闭当前弹出的子页面 
						 window.close();
					}
				}
			});
			
			//alert(chk_value_str);
			//document.inputForms.action = "${ctx}/sys/setdjxl/sysDjxlOffice/savebat?chk_value_str="+ chk_value_str +"&officeid=${officeid}";
			//document.inputForms.submit();
		}
	</script>
</head>
<body> 
<!-- 	<div> -->
<%-- 	<form:form id="inputForms" name="inputForms" modelAttribute="sysDjxlOffice" action="${ctx}/sys/setdjxl/sysDjxlOffice/listofdjxlquery" class="breadcrumb form-search"> --%>
		
<!-- 		<li><label>标签内容:</label> -->
<%-- 			<form:input path="label" id = "labelid" htmlEscape="false" maxlength="28" class="input-medium"/> --%>
<!-- 		</li> -->
<!-- 		<li class="btns"><input id="btnSubmit" class="btn btn-primary" type="submit" value="选择"/></li> -->
<%-- 	</form:form> --%>
<!-- 	</div> -->
	<form:form id="inputForms" name="inputForms" modelAttribute="sysDjxlOffice" action="${ctx}/sys/setdjxl/sysDjxlOffice/save" method="post" class="breadcrumb form-search">
		<input id="btnSubmit" class="btn btn-primary" type="button" value="保  存" onclick="javascript:djxlOfficeSubmit();"/>&nbsp;&nbsp;&nbsp;&nbsp;
		<input id="btnSelectAll" class="btn btn-primary" type="button"  value="全   选" onclick="javascript:selectAll();"/>&nbsp;&nbsp;&nbsp;&nbsp;
		<input id="btnunSelectAll" class="btn btn-primary" type="button"  value="全不选" onclick="javascript:unselectAll();"/>
		<span class="help-inline">当前机构:;选择下面列表中的业务登记小类,作为本机构用户在初审可以办理的业务小类;可全选或者单个选;</span>
		<br><br>
		<table id="contentTable" class="table table-bordered table-condensed">
			<thead><tr><th>键值</th><th>标签</th><th>选择该机构所属小类</th></tr></thead>
			<tbody>
			<c:forEach items="${djxlList}" var="djxlDict">
				<tr>
					<td><label>${djxlDict.value}</label></td>
					<td><label>${djxlDict.label}</label></td>
					<td><input id="${djxlDict.value}" name="djxl" value="${djxlDict.value}" class="" type="checkbox"/></td>
				</tr>
			</c:forEach>
			</tbody>
		</table>
		<input id="btnSubmit" class="btn btn-primary" type="button" value="保  存" onclick="javascript:djxlOfficeSubmit();"/>&nbsp;&nbsp;&nbsp;&nbsp;
		<input id="btnSelectAll" class="btn btn-primary" type="button"  value="全   选" onclick="javascript:selectAll();"/>&nbsp;&nbsp;&nbsp;&nbsp;
		<input id="btnunSelectAll" class="btn btn-primary" type="button"  value="全不选" onclick="javascript:unselectAll();"/>
	</form:form>
	
</body>
</html>