6c02e19f0da1404262d5ac2feb44e058964c32c6.svn-base 6.89 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 saveList = new Array();
		var submitBz = false;
		var submitList = new Array();
		$(document).ready(function() {
			
		});
		
		function page(n,s){
			if (saveList.length > 0) {
				alert("请先保存!");
				return false;
			} else  {
				$("#pageNo").val(n);
				$("#pageSize").val(s);
				$("#searchForm").submit();
	        	return false;
			}
        }
		
		function getUrl(){
			var bdcdyhStr = "";
			var fybhStr = "";
			var submitBz = true;
			//saveList是添加过房源编号的数据的下标的数组
			$.each(saveList, function(index, item){
				var saveIndex = saveList[index];
				var fybhValue = $("input[id='fybhSave']")[saveIndex].value;
				var bdcdyhValue = $("input[id='bdcdyhSave']")[saveIndex].value;
				
				/* if (fybhValue.length < 6) {
					alert("存在格式不正确房源编号,保存失败!");
					submitBz = false;
					return false;
				} */
				
				fybhStr = fybhStr + fybhValue + ";";
				bdcdyhStr = bdcdyhStr + bdcdyhValue + ";";
			});
			
			if (submitBz) {
				$.ajax({ 
					type:"POST",
					url:"${ctx}/reg/base/regBaseH/saveFybh",
					cache: false,
					data:"bdcdyhStr="+bdcdyhStr+"&fybhStr="+fybhStr,
					async:true, 
					success:function(modelmap){
						 success = modelmap.success;
						 if(success == 0){
							 alert("保存成功!");
							 saveList = new Array();
						 }else{
							 alert(modelmap.msg);
							 saveList = new Array();
						 }
					}
				 });
			} else {
				saveList = new Array();
			}
		}
		
		function getquery(){
			var shbw = $("#shbwtext").val();
			var bdcdyh = $("#bdcdyhtext").val();
			var zl = $("#zltext").val();
			var url = "${ctx}/reg/base/regBaseH/ycslhlist?shbw="+shbw+"&bdcdyh="+bdcdyh+"&zl="+zl;
			window.location = url;
		}
		
		function changeFybh(index){
			//获取改变后的fybh的值  如果为空并且已经存在在list中就去掉  
			var fybh = $("input[id='fybhSave']")[index].value;
			var test = /^[0-9]*$/; //正则表达式验证
			/* if (fybh != null && fybh != '' && fybh.length < 6) {
				alert("请输入6位房源编号!");  //输入的fybh里有一个格式不对就不能提交
			} */
			
			if (fybh == null || fybh == '') {
				saveList.splice(saveList.indexOf(index), 1); //去掉空值对应的在list中index元素
			} else if (saveList.indexOf(index) == -1) {  //如果不为空就把对应行数加到list里
				saveList.push(index);
			}
			console.log(saveList);
		}
		
	</script>
	<style type="text/css">
		.inlineDiv{
			float:left;
		}
		
		.inlineDiv1{
			float:left;
			width: 100%;
			margin-right: -4%;
		}
		
		.inlineDiv2{
			display: none;
			float:left;
			width: 41%;
			/* border-left: 1px solid red; */
		}
		
		.input-medium{
			width:80px;
		}
		
		#searchForm{
			width:95%;
		}
		
		#searchFormResult{
			width:95%;
			margin-top: -10px;
		}
		
	</style>
</head>
<body>
	<!-- <ul class="nav nav-tabs">
		<li class="active"><a href="#">户信息列表</a></li>
	</ul> -->
	<div id="ODM" class="inlineDiv1">
		<form:form id="searchForm" modelAttribute="regBaseH" action="${ctx}/reg/base/regBaseH/ycslhlist" 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" id="lpgjcx">
				<li>不动产单元号&nbsp;<form:input path="bdcdyh" id="bdcdyhtext" htmlEscape="false"  maxlength="28"  class="input-large"/>
				</li>
				<li>&nbsp;&nbsp;坐落&nbsp;<form:input path="zl" id="zltext" htmlEscape="false"  maxlength="28"  class="input-large"/>
				</li>
				<li>&nbsp;&nbsp;室号部位&nbsp;<form:input path="shbw" id="shbwtext" htmlEscape="false"  maxlength="28"  class="input-large"/>
				</li>
				<!-- <li class="btns"><input id="btnSubmit" class="btn btn-primary" type="button"   ?shbw=${shbw}&bdcdyh=${bdcdyh}&zl=${zl} onclick="getquery()" value="查询"/></li> -->
				<li class="btns"><input id="btnSubmit" class="btn btn-primary" type="submit"  value="查询"/></li>
				<li id="btns_1"><input class="btn btn-primary" type="button"  onclick="getUrl()"  value="保 存"/><a id="aaa"></a></li>
				<li class="clearfix"></li>
			</ul>
		</form:form>
		<form:form class="breadcrumb form-search" id="searchFormResult">
			<c:forEach items="${page.list}" var="regBaseH" varStatus="hlist">
			<ul class="ul-form">
				<li >不动产单元号&nbsp;
					<input id="bdcdyhSave"  htmlEscape="false" readOnly="true"  value="${regBaseH.bdcdyh}" maxlength="28" class="input-large"/>
				</li>
				<li >&nbsp;坐落&nbsp;
					<input htmlEscape="false" readOnly="true"  value="${regBaseH.zl}" class="input-large"/>
				</li>
				<li>&nbsp;室号部位&nbsp;
					<input htmlEscape="false" readOnly="true" value="${regBaseH.shbw}"  class="input-medium"/>
				</li>
				<li>&nbsp;房源编号&nbsp;
					<c:if test="${regBaseH.rights eq '2'}">
						<input id="fybhSave" htmlEscape="false" readOnly="true" value="${regBaseH.fybh}" class="input-medium"/>
					</c:if>
					<c:if test="${regBaseH.rights ne '2'}">
						<input id="fybhSave" htmlEscape="false" type="text" value="${regBaseH.fybh}" maxlength="6" onchange="changeFybh(${hlist.index})" class="input-medium"/>
					</c:if>
				</li>
			</ul>
			</c:forEach>
		</form:form>
		<div class="pagination" style="width: 730px">${page}</div>
	</div>
	<%-- <div id="FC"  class="inlineDiv2">
		<form:form id="searchForm" modelAttribute="regBaseH" action="${ctx}/reg/base/regBaseH/alllist?shbw=${shbw}" 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;
					<input path="shbw" id="shbwtext" htmlEscape="false"  maxlength="28"    class="input-large"/>
				</li>
				<li class="btns"><input id="btnSubmit" class="btn btn-primary" type="button"  onclick="getquery()" value="查询"/></li>
				<li id="btns_1"><input class="btn btn-primary" type="button"  onclick="getUrl()"  value="保 存"/></li>
				<li class="clearfix"></li>
			</ul>
			<c:forEach items="${page.list}" var="regBaseH">
			<ul class="ul-form">
				<li>&nbsp;&nbsp;室号部位
					<input path="shbw"  htmlEscape="false" readOnly="true" value="${regBaseH.shbw}"  class="input-medium"/>
				</li>
				<li>&nbsp;&nbsp;室号部位
					<input path="shbw"  htmlEscape="false" readOnly="true" value="${regBaseH.shbw}"  class="input-medium"/>
				</li>
				<li>&nbsp;&nbsp;室号部位
					<input path="shbw"  htmlEscape="false" readOnly="true" value="${regBaseH.shbw}"  class="input-medium"/>
				</li>
			</ul>
			</c:forEach>
		</form:form>
		<div class="pagination" style="width: 500px; height:20px; display: inline;" >${page}</div>
	</div> --%>
	
</body>
</html>