3ebffdea599f3e9904bd1a68f8483eccc7a86832.svn-base 13.1 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 iscad = '${iscad}';
		$(document).ready(function() {
			$("#fileinp").change(function () {
				var value = $("#fileinp").val();
				if(!value){
					value = "请选择房屋分户图...";
				} 
		        $("#filetext").html(value); 
		    })
		});
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
        	return false;
        }
		function checkUnfined(value){
			if(typeof(value)=='undefined'){
		 		return ""; 
		 	}
		 	return value;
		}
		
		function choiceFwxx(bdcdyh){
			//弹出窗口的宽度; 
			var iWidth=1100; 
			//弹出窗口的高度;
	       	var iHeight=600;
	       	//获得窗口的垂直位置 
	       	var iTop = (window.screen.height - 30 - iHeight) / 2;
	       	//获得窗口的水平位置 
	       	var iLeft = (window.screen.width - 10 - iWidth) / 2;
       		var url = "${ctx}/reg/bus/regBusBdcqzsdjxx/openHouseInfoView?cxfs=${cxfs}&iscad=1&DJLX=${DJLX}&bdcdyh="+bdcdyh+"&isyw=1";
	       	window.open(url, "窗口", "width=" + iWidth + ", height=" + iHeight + ",top=" + iTop + ",left=" + iLeft + ",toolbar=no, menubar=no, scrollbars=yes, resizable=no,location=no, status=no,alwaysRaised=yes,depended=yes");
		}
		 
		//动态添加checkbox 
		function innerCheckBox(tbtdObj, hobject){
			var $v=$(tbtdObj); //转化为jQuery对象  
			var innerCheckBox = "<div class='btnc'><input id="+hobject.id+" name='fwxx' onclick=\"choiceFwxx('"+hobject.bdcdyh+"')\""+
									"value="+hobject.shbw+" class='btn btn-primary btn-mini btn-info' type='button'/></div>"; 
			$v.find(".isinfo").before(innerCheckBox);
		}
		
	window.onload = function(){
			
			//给楼盘表中填值 
			//开始根据后台返回的所有户信息,进行遍历填值  
			var h_json = ${fns:toJson(regBaseAllHList)};
			for(var i = 0; i < h_json.length; i++){
			    var positionxy_c = h_json[i].xyposition; ////户坐标位置 [获取到层房序号,也就是一层上的户型号,获取到3、4位]
				var begin_c = h_json[i].beginc; ////户其实层 
				var end_c = h_json[i].endc; ////户终止层 
				var shbw_c = h_json[i].shbw; //室号部位取值 
				var step_c = end_c - begin_c + 1; //户所跨的层数 
				var hhao = h_json[i].hh;//户 号 
				if(begin_c<0 && end_c>0){ //跨层有负层时 
					step_c = step_c - 1; 
				}
				var colvalue = "01";//这里的colvalue值需要考虑到100层【10001】以上,1000层以上就不考虑了
				if(positionxy_c.indexOf("-") != -1){
					positionxy_c = positionxy_c.replace("-", "");
				}
				if(positionxy_c.length>=6){//100100 
					colvalue = parseInt(positionxy_c.substring(3,6));
				}else if(positionxy_c.length>=4){//10001 \01100 
					if(end_c >= 100){
						colvalue = parseInt(positionxy_c.substring(3,5));
					}else{
						//竖向层小于100 时;横向大于等于100 时 
						if(hhao >= 100){// 10100 - 99100 
							if(end_c >= 10){
								colvalue = parseInt(positionxy_c.substring(2,5));
							}else{
								colvalue = parseInt(positionxy_c.substring(1,4));
							}
						}else{
							colvalue = parseInt(positionxy_c.substring(2,4));
						}
					}
				}else if(positionxy_c.length>=3){
					if(end_c >= 100){
						colvalue = parseInt(positionxy_c.substring(1,4));
					}else{
						colvalue = parseInt(positionxy_c.substring(1,3));
					}
				} 
				if(begin_c == end_c){ //不跨层填值处理 
					fillTdWithoutStep(end_c, colvalue, shbw_c, h_json[i]);
				}else{
					fillTdWithStep(end_c, begin_c, colvalue, step_c, shbw_c, h_json[i]);
				}
			}
			
			//循环填值完后,再把当前表格循环一次,如果发现户坐标位置一样的话 就纵向合并 
			vert_merger();
			$(".shbwtext").text("");
		};
	
		
		//带有跨行的户信息填值 - 除过行表头和列表头 
		function fillTdWithStep(rc,rm,col,sl,htm,hobject){
			var tb = document.getElementById("zchtableid");
			var x1;
			for (var ii=1;ii<tb.rows.length;ii++){
				px = parseInt(tb.rows[ii].cells[0].innerText);//每行的第一列层值 
				if (px==rc) {
					x1=ii;
				}
				if (px<rc & px>=rm) {
					fillTdWithoutDifferenceColorAndHtml(tb.rows[ii].cells[col+1], hobject, htm);
					//tb.rows[ii].cells[col+1].innerHTML = "<div class='hhao'><div class='shbwtext'>"+htm+"</div></div>";
					//tb.rows[ii].cells[col+1].setAttribute("style","background-color:#D6EEF3");
					//加详细信息 
					//innerDetailInfo(tb.rows[ii].cells[col+1], hobject);
					//加选择信息 
					innerCheckBox(tb.rows[ii].cells[col+1], hobject);
				}
			}
			fillTdWithoutDifferenceColorAndHtml(tb.rows[x1].cells[col+1], hobject, htm);
			//tb.rows[x1].cells[col+1].innerHTML = "<div class='hhao'><div class='shbwtext'>"+htm+"</div></div>";
			//tb.rows[x1].cells[col+1].setAttribute("style","background-color:#D6EEF3");
			//innerDetailInfo(tb.rows[x1].cells[col+1], hobject); 
			innerCheckBox(tb.rows[x1].cells[col+1], hobject);
		}
		
		//选中一层数据  |注意:当checkbox disabled时不能进行操作
		function selectC(ch){
			$("#"+ch).find("input[type=checkbox]").each(function() {
				//当checkbox disabled时不进行操作,直接跳出 
				if($(this).prop("disabled")){
					return true; //跳出当前循环,进入下一个循环;相当于 javascript 中的 continue 效果
				}
				if($(this).is(":checked")) {
	            	$(this).attr("checked", false);
				}else{
					$(this).attr("checked", true);
				}
	        });
		}
		
		//只有一层的情况填值  - 除过行表头和列表头 
		//终止层、层房序号、房名称 
		function fillTdWithoutStep(row,col,htm,hobject){
			var tb = document.getElementById("zchtableid");
			for (var ii=1;ii<tb.rows.length;ii++) {
				px=parseInt(tb.rows[ii].cells[0].innerText);
				if (px==row) {
					fillTdWithoutDifferenceColorAndHtml(tb.rows[ii].cells[col+1], hobject, htm);
					//tb.rows[ii].cells[col+1].innerHTML = "<div class='hhao'><div class='shbwtext'>"+htm+"</div></div>";
					//tb.rows[ii].cells[col+1].setAttribute("style","background-color:#D6EEF3");
					//innerDetailInfo(tb.rows[ii].cells[col+1], hobject);
					innerCheckBox(tb.rows[ii].cells[col+1], hobject);
				}
			}
		}
		
		function vert_merger(){
			var tb = document.getElementById("zchtableid");
			var xx,yy,s1;
			var collh=tb.rows[0].cells.length-1;//列数 
			var rowlh=tb.rows.length-1;//行数 
			for(var jj=collh;jj>=2;jj--){//从最大列数递减开始遍历 
				s1=1;
				for(var ii=rowlh;ii>1;ii--){//从最大行数递减开始遍历 
					xx = tb.rows[ii].cells[jj].innerHTML;  //获取要合并的上层单元格的值 
					yy = tb.rows[ii-1].cells[jj].innerHTML;//获取要合并的下层单元格的值 
					if(xx == yy&&xx!==""){
						tb.rows[ii].deleteCell(jj);//删除上层的单元格 
						s1++;//计算需要合并的行数 
						tb.rows[ii-1].cells[jj].rowSpan = s1;//把需要合并的行数赋值给 rowspan,完成层的上下合并 
					}else{
						s1=1;
					}
				}
			}
		}
		
		function submitFht(){
			var form = $("#searchForm");
			var ids = [];
			$(".hselect").each(function(i,o){
				 var id = $(o).attr("id");
				if($(o).is(':checked')){
					ids[ids.length] = id;
				}
			});
			if(ids.length <=0){
				alert("请选择分户图对应的房屋信息");
				return;
			}
			if(!$("#fileinp").val()){
				alert("请上传分户图的CAD文件");
				return;
			}
			$("#hids").val(JSON.stringify(ids));
			form.attr("action","${ctx}/jy/fw/jyFw/uploadFht");
			form.submit();
		}
		
		function selectHH(intS){
		    $("."+intS).each(function() {
		    	var checkbox  = $(this).find("input[type='checkbox']");
			    var isChecked = checkbox.is(":checked");
			    if(checkbox.prop("disabled")){
					return true; //跳出当前循环,进入下一个循环;相当于 javascript 中的 continue 效果
				}
			    if (isChecked) {
 			        checkbox.attr("checked",false);
			    } else {
			    	checkbox.attr("checked", true);
			    }
  	        });
		}
		 
		function deleteFht(hid){
			if(!confirm ('确认要删除当前分户图信息吗?'))
			{
				return;
			} 
			var form = $("#searchForm");
			$("#hid").val(hid);
			form.attr("action","${ctx}/jy/fw/jyFw/deleteFht");
			form.submit();
		}
		
		function fillTdWithoutDifferenceColorAndHtml(td, hobject, htm){
			if(hobject == undefined || hobject == null || td == undefined || td == null){
				return;
			}
			 
			var fht = "<div style='padding:0 0 10px 20px;' >"
			        + "<input type='checkbox' class='hselect' id="+'"'+hobject.id+'"'+">" 
					+"</div>";
			var hcss = 	"hhao_qf"; 
			 
		 	if(hobject.fhtCad){
		 		hcss =  "hhao_xf" ; 
		 		var fht = "<div style='padding:0 0 10px 20px;' >"
				        + "<a target='view_window' href='/ODM/userfiles/"+hobject.fhtCad+"' >CAD</a>" ;
				        //href='/ODM/userfiles/"+hobject.fhtCad+"'
				        
				        if(iscad == '1'){
				        	fht = fht
				        	+ "<label style='float: right; color: red; padding-right: 10px;' onclick='deleteFht("+'"'+hobject.id+'"'+")'>X</label>"

				        }
				        fht = fht + "</div>";
		 	} 
			
		 	if(hobject.fhtImage){
		 		hcss =  "hhao_ms" ; 
		 		
		 		var fht = "<div style='padding:0 0 10px 10px;' >";
		 			if(hobject.fhtCad){
		 				fht = fht
		 				+ "<a  style=' color: red;' target='view_window' href='/ODM/userfiles/"+hobject.fhtCad+"' >CAD</a>"
			       		+ "&nbsp;&nbsp;&nbsp;&nbsp;";
			       		//href='/ODM/userfiles/"+hobject.fhtCad+"'
		 			}
		 			fht = fht
			        + "<a style=' color: red;' target='view_window' href='/ODM/userfiles/"+hobject.fhtImage+"'  >合成图</a>";
			         
			         
			        	fht = fht
			        	+ "<label style='float: right; color: red; padding-right: 10px;' onclick='deleteFht("+'"'+hobject.id+'"'+")'>X</label>"

			       
			        fht = fht + "</div>";
		 	} 
		 	 
			td.innerHTML = "<div style='width:140px;height:50px;border:0px solid red;text-align:left; ' class=' "+hcss+"'><div class='isinfo'>"+fht+"</div></div>";
		}
	 
		
	</script>
	<style type="text/css">
		#fileinp{
		    position: absolute;
		    left: 0;
		    top: 0;
		    visibility: hidden;
		}
		#btnFile{
		    cursor: pointer;
		    padding: 5px 10px;
		    background: #FFF;
		    color: #eea931;
		    border: solid 1px #eea931;
		    border-radius: 5px;
		    height: 31px;
		    width: 81px;
		} 
	</style>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a href="#">楼盘信息表</a></li>
		
	</ul>
	<sys:message content="${message}"/>
	<div class="form-horizontal">
	<div class="current_fwinfo">当前楼盘信息:项目【${XMMC}】,建筑物【${JZWMC}】,实测建筑面积【${ZSCJZMJ}】㎡;一共【${cCount}】层,【${hCount}】户</div>  

	<br>	 
	<table class="zchtable-form" id="zchtableid">
		<tr>
			<td><div class="chao">层号</div></td>
			<td><div class="cgaik">层概况</div></td>
			<c:forEach items="${requestScope.intS}" var="intS" varStatus="statusmch">
				<td><div class="cinfo">${intS}
						<input id="btnSelectH" class="btn btn-primary btn-xs" type="button"
							value="(反)选" onclick="javascript:selectHH('${intS}');"/>
						</div>
					</div>
				</td>
			</c:forEach>
		</tr>
		<c:forEach items="${requestScope.regBaseCList}" var="regBaseC" varStatus="status">
			<tr id="${regBaseC.ch}">
				<td> 
				    <div class="chao">${regBaseC.sjc} &nbsp;&nbsp;<input id="btnSelectC" class="btn btn-primary btn-xs" type="button"  
						value="(反)选" onclick="javascript:selectC('${regBaseC.ch}');"/>
				    </div>
				</td>
				<td>
					<div class="cgaik">
						<fmt:formatNumber value="${regBaseC.chjzmj}" 
			                pattern="#0.##" 
			                var="formattedNumber"/>
						${formattedNumber}&nbsp;
					</div>
				</td>
				<c:set value="${'option'}${status.index}" var="option" />
				<c:forEach items="${requestScope.intS}" var="intS" varStatus="statush">
					<td  class="${intS}">
					</td>
				</c:forEach>
			</tr>
		</c:forEach>
	</table>
	<br>
	
	<form:form id="searchForm" modelAttribute="regBaseZrz"  enctype="multipart/form-data" action="${ctx}/jy/fw/jyFw/uploadFht" method="post" class="breadcrumb form-search"> 
	<input name = 'bdcdyh' type="hidden" value ="${cbdcdyh}">
	<input name = 'iscad' type="hidden" value ="${iscad}"> 
	<input name = 'hids' id="hids" type="hidden" >
	<input name = 'hid' id="hid" type="hidden" >
	
	<c:if test="${ not empty iscad and iscad == '1'}">
	<div class="ul-form" style="margin: 10px 0px"> 
		 <label for="fileinp" style="line-height: 50px;">
		      <a id="btnFile"> 选择文件 </a><span id="filetext" style="padding-left: 10px;">请选择房屋分户图...</span>
		      <input type="file" id="fileinp" accept=".dwg" name="fileinp">
		 </label> 
	</div>	 

	</c:if>
	<div class="ul-form">
		<span style="padding: 5px 50px;">
			<input id="btnCancel" class="btn btn-primary" type="button" value="关闭" onclick="window.close()"/> 
		</span>
		
		<c:if test="${ iscad eq '1'}">
		<span style="padding: 5px 50px;">
		<input id="btnCancel" class="btn btn-primary" type="button" value="确认" onclick="submitFht()"/>
		</span>
		</c:if>
	</div>
	</form:form>
	<sys:message content="${message}"/>
	</div>
</body>
</html>