dyhishouseHformgageGuideifm.jsp 6.8 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" >

		var selItems = new Array(); 
		
		$(document).ready(function() {});
		
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
        	return false;
        }
		
// 		$(function(){
// 			//CheckBox 全选 
// 			var a = document.getElementsByTagName("input");
// 			for(var i = 0;i<a.length;i++){
// 				if(a[i].type == "checkbox"){ 
// 					a[i].checked = false;
// 				}
// 			}
// 		});
		
		function AddSelItems(){
			var chk_value = [];
			$('input[name="Bdcqzsdjxx"]:checked').each(function(){
				chk_value.push($(this).val());
			});
			var checkedCount = $("input[type='checkbox']:checked").length;
			if(checkedCount == 0){
				alert("必须选择一条信息!");
				return;
			}
			var ids = chk_value.join(';');
			var successbj ="";
			$.ajax({ 
				type:"POST", 
				url:"${ctx}/reg/bus/regBusBdcqzsdjxx/isTransaction", 
				cache: false, 
				data:"id="+ids+"&bj=2&YWH=${YWH}",
			    async : false,  
				success:function(modelmap){
					successbj = modelmap.success;
					if(modelmap.success != 1){
						alert(modelmap.msg);
						return;
					}
				}
			});
			//设置选择的信息
			if(successbj == 1){
				$.ajax({ 
					type:"POST", 
					url:"${ctx}/reg/base/regBaseH/dyhishouseHgetInfoxf",
					cache: false, 
					data:"id="+ids,
				    async : false,  
					success:function(modelmap){
						var entity = modelmap.data;
						var bdcdyh = modelmap.bdcdyh;
						var success = indexOfBdcdyh(bdcdyh);
						if(success == "ok"){
							parent.document.getElementById("contentSelectedTable").innerHTML = 
								parent.document.getElementById("contentSelectedTable").innerHTML+entity;
						}else{
							alert("该笔房屋信息已添加,不能重复操作!");
							return;
						}
					}
				});
			}
		}
		
		function  indexOfBdcdyh(bdcdyh){
			var success = "ok";
			var bdcdyhList = bdcdyh.split(';');
			var trList = $("#contentSelectedTable",parent.document).find("tr"); 
			if(trList.length > 1){
			    for (var i=1;i<trList.length;i++) {
			        var tdArr = trList.eq(i).find("td");
			        var history = tdArr.eq(1).text();//获取已添加数据
					for(var j=0;j<bdcdyhList.length;j++){
				        if(bdcdyhList[j] == history){
				        	success = "error";
							break;
				        }
				    }
					if(success == 'error'){
						break;
					}
				}
			}
			return success;
		}
		
		function  indexOfSelItems(regBusCfdj){
			var index = -1;
			for (var i = 0; i < selItems.length; i++) {
		    }
		    index = i;
			return index;
		}
		
		
		 function addTr2(tab,regBaseH){
			var trHtml = "<tr><td>"+getObj(regBaseH.bdcdyh)+"</td><td>"+getObj(regBaseH.zrzh)+"</td><td>"+getObj(regBaseH.ch)+"</td><td>"+getObj(regBaseH.hh)+"</td><td>"+getObj(regBaseH.shbw)+"</td><td>"+getObj(regBaseH.zl)+"</td></tr>";
	        $("#"+tab+" > tbody").append(trHtml);
		 }
		 
		 function getObj(val){
		     if(isNotNull(val)){
		         return val;
		     }
		     return "";
		 }

		 function isNotNull(val){
		     if(val != null && val != 'null' && val != undefined && val != 'undefined' && val != ''){
		         return true ;
		     }
		     return false;
		 }
		
		
		function DestroySelItems(){
			selItems = null;
			selItems = new Array();
			$("#contentSelectedTable > tbody").html("");
		}
		
		function selectall(){
			var a = document.getElementsByTagName("input");
			for(var i = 0;i<a.length;i++){
				if(a[i].type == "checkbox"){ 
					a[i].checked = true;
				}
			}
		}
	</script>
</head>

<body>
<input type="hidden" id= "qlr" />
	<ul class="nav nav-tabs">
		<li class="active"><a href="#">房屋信息</a></li>
	</ul>
	<form:form id="searchForm"  modelAttribute="regBaseH"  action="${ctx}/reg/base/regBaseH/hishouseHformgageGuide?ywh=${YWH}&ifm=${1}&djxl=${djxl}"  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>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;不动产单元号:
				<form:input path="bdcdyh" htmlEscape="false" maxlength="30" class="input-medium"/>
			</li>
			<li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;坐落:
				<form:input path="zl" htmlEscape="false" maxlength="30" class="input-medium"/>
			</li>
			<li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;自然幢号:
				<form:input path="zrzh" htmlEscape="false" maxlength="30" class="input-medium"/>
			</li>
		</ul>
		<ul class="ul-form">
			<li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;层号:
				<form:input path="ch" htmlEscape="false" maxlength="30" class="input-medium"/>
			</li>
			<li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;户号:
				<form:input path="hh" htmlEscape="false" maxlength="30" class="input-medium"/>
			</li>
			<li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;室号部位:
				<form:input path="shbw" htmlEscape="false" maxlength="30" class="input-medium"/>
			</li>
			<li class="btns"><input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/></li>
			<li class="clearfix"></li>
		</ul>
		
	<sys:message content="${message}"/>

	<div id="srcBaseInfo"  class="control-group" >
			<fieldset>
					<table id="contentTable"  class="table table-striped table-bordered table-condensed" >
						<thead>
							<tr>
								<th>选择</th>
								<th>不动产单元号</th>
								<th>自然幢号</th>
								<th>层号</th>
								<th>户号</th>
								<th>室号部位</th>
								<th>坐落</th>
							</tr>
						</thead>
						<tbody>
						<c:forEach items="${page.list}" var="regBaseH">
							<tr>
<%-- 								<c:if test="${not empty WO}"> --%>
									<td><input type="checkbox" name="Bdcqzsdjxx"  id="${regBaseH.id}" value="${regBaseH.id}"/></td>
<%-- 								</c:if> --%>
								<td>
									${regBaseH.bdcdyh}
								</td>
								<td>
									${regBaseH.zrzh}
								</td>
								<td>
									${regBaseH.ch}
								</td>
								<td>
									${regBaseH.hh}
								</td>
								<td>
									${regBaseH.shbw}
								</td>
								<td>
									${regBaseH.zl}
								</td>
							</tr>
						</c:forEach>
						</tbody>
					</table>
					<div class="pagination">${page}</div>
			</fieldset>
	</div>
	<div id="btnGroup" class="control-group" >
		<input id="btnAddall" class="btn btn-primary"  type="button" onclick="selectall();" value="全选"/>
		<input id="btnAdd" class="btn btn-primary"  type="button" onclick="AddSelItems();" value="添加"/>
	</div>
	</form:form>
</body>
</html>