regBaseZrzdrForm.jsp 55.5 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324
<%@ 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 src="${ctxStatic}/gis/js/init.js" type="text/javascript"></script>
    <script src="${ctxStatic}/gis/lib/OpenLayers.js" type="text/javascript"></script>
    <script src="${ctxStatic}/gis/lib/zdclient.js" type="text/javascript"></script>
    <script src="${ctxStatic}/gis/lib/jquery.orbit-1.2.3.js" type="text/javascript"></script>    
    <script src="${ctxStatic}/gis/js/global.js" type="text/javascript"></script>
    <script src="${ctxStatic}/gis/js/config.js" type="text/javascript"></script>
	<script src="${ctxStatic}/select3/AreaData_min.js" type="text/javascript"></script>
	<link href="${ctxStatic}/gis/lib/jqueryEasyui/easyui.css" rel="stylesheet" type="text/css" />
    <link href="${ctxStatic}/gis/lib/jqueryEasyui/icon.css" rel="stylesheet" type="text/css" />
    <script src="${ctxStatic}/gis/lib/jqueryEasyui/jquery.easyui.min.js" type="text/javascript"></script>
	
	<script type="text/javascript">
	  var mapreturnvale;
	  var mapreturnvaleList;
	  var regBaseZbinfoRowIdx = 0;
	  var ZBArray = new Array();
	  var ZBYXArray = new Array();
	  var zblisttemp="";
	  var daoru="";
	  var bj ="";
	  var zdjbxxvalue;
	  var lcxxvalue;
	  var chxxvalue;
	  var chxxid="";
	  var fid,result="";
	  var yts;
	  var xmid,zbxx,zdzddm,zdbdcdyh,Modelmap,xiugai;
	  var temptuceng,TempTUceng;
		$(document).ready(function() {
			//$("#name").focus();
			$("#inputForm").validate({
				submitHandler: function(form){
					loading('正在提交,请稍等...');
					form.submit();
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误,请先更正。");
					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
			regBaseZbinfoRowIdx = 0; regBaseZbinfoTpl = $("#regBaseZbZrzTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
			var data = ${fns:toJson(regBaseZrzchxx.regBaseZbinfoZrzList)};
		    for (var i=0; i<data.length; i++){
			  addRow('#regBaseZbinfoZrzList', regBaseZbinfoRowIdx, regBaseZbinfoTpl, data[i]);
			  regBaseZbinfoRowIdx = regBaseZbinfoRowIdx + 1;
	      }
			views();
			var daoru = "${daoru}";
			if(daoru == "1"){
                checkzb();
                zrzzbandzd();
				}
		});
		function views(){
			var viewid = "${VIEWS}";
			if(viewid == undefined || viewid == null || viewid ==""){
				var zced = "${zced}";
				if(zced == "1"){
					alert("此次幢修改不能选择新的宗地信息,其下属已有层信息存在!");
				}
				return;
			}
			$("input:not(:button,:submit,:hidden),select,textarea").attr("disabled","disabled");
			
		}
		
		function gobackzrzlist(){
			var url = "${ctx}/reg/base/regBaseZrz/list?XMID=${XMID}";
			window.location = url;
		}
		
		function submitGenTable(){
			$(".error").remove();
			var genCount = $("#genCount").attr("value");
			bj ="";
			//占地面积控制:当前项目所有幢信息种占地面积总和不能超过土地建筑面积 
			$.ajax({
				type:"POST",
				url:"${ctx}/reg/base/regBaseZrz/queryzdmjsum",
				cache: false,
				data:"zddm="+$("#zddmtext").val()+"&xmid=${XMID}&bsm="+$("#bsmtext").val(),
			    async : false,
				success:function(modelmap){
					var zrzdjmj = modelmap.zdmjsum;
					zrzdjmj = (parseFloat(zrzdjmj) + parseFloat($("#zzdmjtext").val())).toFixed(3);
					var zdmj = $("#zdjm").text();
					if(zdmj != undefined || zdmj != null || zdmj !=""){
						if(parseFloat(zrzdjmj) > parseFloat(zdmj)){
							alert("当前项目所有幢占地面积总和为"+zrzdjmj+",宗地面积为"+zdmj+",已超过宗地面积,请确认!");
							return;
						}else{
							bj ="0";
							document.inputForms.action = "${ctx}/reg/base/regBaseZrz/savebat?genCount="+ genCount;
						}
					}
				}
			});
			if($("#zddmtext").val() == ""){
				$("<label for='name' class='error'>必填信息</label>").insertAfter("#zddmtext");
				return;
			}
			if($("#gzwmctext").val() == ""){
				$("<label for='name' class='error'>必填信息</label>").insertAfter("#gzwmctext");
				return;
			}
// 			if($("#jgrqtext").val() == ""){
// 				$("<label for='name' class='error'>必填信息</label>").insertAfter("#jgrqtext");
// 				return;
// 			}
			if($("#zzdmjtext").val() == ""){
				$("<label for='name' class='error'>必填信息</label>").insertAfter("#zzdmjtext");
				return;
			}
			if($("#scjzmjtext").val() == ""){
				$("<label for='name' class='error'>必填信息</label>").insertAfter("#scjzmjtext");
				return;
			}
			if(parseFloat($("#scjzmjtext").val()) == 0){
				$("<label for='name' class='error'>建筑面积必须大于0</label>").insertAfter("#scjzmjtext");
				return;
			}
			if($("#dscstext").val() == ""){
				$("<label for='name' class='error'>必填信息</label>").insertAfter("#dscstext");
				return;
			}
			if($("#dxcstext").val() == ""){
				$("<label for='name' class='error'>必填信息</label>").insertAfter("#dxcstext");
				return;
			}
			if($("#zcstext").val() == ""){
				$("<label for='name' class='error'>必填信息</label>").insertAfter("#zcstext");
				return;
			}
			if($("#ghyttext").val() == ""){
				$("<label for='name' class='error'>必填信息</label>").insertAfter("#ghyttext");
				return;
			}
			if($("#fwjgtext").val() == ""){
				$("<label for='name' class='error'>必填信息</label>").insertAfter("#fwjgtext");
				return;
			}
			if($("#zdftfstext").val() == ""){
				$("<label for='name' class='error'>必填信息</label>").insertAfter("#zdftfstext");
				return;
			}
			if($("#jgrqtext").val() == ""){
				$("<label for='name' class='error'>必填信息</label>").insertAfter("#jgrqtext");
				return;
			}
		   //坐标以及其他校验合格,进入信息保存状态
			if(bj == '0'){
				//判断建筑物名称是否重复,重复的话不能提交 
				var xmid = "${XMID}";
				$.ajax({
					type:"POST",
					url:"${ctx}/reg/base/regBaseZrz/isgzwmc",
					cache: false,
					data:"gzwmc="+$("#gzwmctext").val()+"&xmid="+xmid,
				    async : false,
					success:function(modelmap){
						var ised = modelmap.data;
						if(ised == "1"){
							alert("已经存在此构筑物名称,请重新填写!");
							return;
						}else{
							if(document.getElementById("btnSubmit")){
								document.getElementById("btnSubmit").disabled="disabled";
							}
							if(document.getElementById("btnGenTable")){
								document.getElementById("btnGenTable").disabled="disabled";
							}
							//document.inputForms.submit();
							jiaoyanzrzzb();
						}
					}
				});
			} 
			
	}

		
		
		function submitZrz(data,zid){
			xiugai = data;
			zid = zid;
			console.log(zid);
			$(".error").remove();
			//占地面积控制:当前项目所有幢信息种占地面积总和不能超过土地建筑面积 
			$.ajax({
				type:"POST",
				url:"${ctx}/reg/base/regBaseZrz/queryzdmjsum",
				cache: false,
				data:"zddm="+$("#zddmtext").val()+"&xmid=${XMID}&bsm="+$("#bsmtext").val(),
			    async: false,
				success:function(modelmap){
					var zrzdjmj = modelmap.zdmjsum;
					zrzdjmj = (parseFloat(zrzdjmj) + parseFloat($("#zzdmjtext").val())).toFixed(3);
					var zdmj = $("#zdjm").text();
					if(zdmj != undefined || zdmj != null || zdmj !=""){
						if(parseFloat(zrzdjmj) > parseFloat(zdmj)){
							alert("当前项目所有幢占地面积总和为"+zrzdjmj+",宗地面积为"+zdmj+",已超过宗地面积,请确认!");
							return;
						}else{
							bj = "0";
							document.inputForms.action = "${ctx}/reg/base/regBaseZrz/save";
						}
					}
				}
			});
			if($("#gzwmctext").val() == ""){
				$("<label for='name' class='error'>必填信息</label>").insertAfter("#gzwmctext");
				return;
			}
// 			if($("#jgrqtext").val() == ""){
// 				$("<label for='name' class='error'>必填信息</label>").insertAfter("#jgrqtext");
// 				return;
// 			}
			if($("#zzdmjtext").val() == ""){
				$("<label for='name' class='error'>必填信息</label>").insertAfter("#zzdmjtext");
				return;
			}
			if($("#scjzmjtext").val() == ""){
				$("<label for='name' class='error'>必填信息</label>").insertAfter("#scjzmjtext");
				return;
			}
			if(parseFloat($("#scjzmjtext").val()) == 0){
				$("<label for='name' class='error'>建筑面积必须大于0</label>").insertAfter("#scjzmjtext");
				return;
			}
			if($("#dscstext").val() == ""){
				$("<label for='name' class='error'>必填信息</label>").insertAfter("#dscstext");
				return;
			}
			if($("#dxcstext").val() == ""){
				$("<label for='name' class='error'>必填信息</label>").insertAfter("#dxcstext");
				return;
			}
			if($("#zcstext").val() == ""){
				$("<label for='name' class='error'>必填信息</label>").insertAfter("#zcstext");
				return;
			} 
			if(false == checkzb()){
                return;
				}
			if(bj == '0'){
				//判断建筑物名称是否重复,重复的话不能提交 
				var xmid = "${XMID}";
				$.ajax({
					type:"POST",
					url:"${ctx}/reg/base/regBaseZrz/isgzwmcupdate",
					cache: false,
					data:"gzwmc="+$("#gzwmctext").val()+"&xmid="+xmid+"&bdcdyh="+$("#bdcdyhtext").val(),
				    async : false,
					success:function(modelmap){
						var ised = modelmap.data;
						if(ised == "1"){
							alert("此构筑物名称已经存在于其他幢,请重新填写!");
							return;
						}else{
							if(document.getElementById("btnSubmit")){
								document.getElementById("btnSubmit").disabled="disabled";
							}
							if(document.getElementById("btnGenTable")){
								document.getElementById("btnGenTable").disabled="disabled";
							}
							//document.inputForms.submit();
							jiaoyanzrzzb();
						}
					}
				});
			}
		}
		
		function winOpen() {
			var iWidth=1100;
	       	var iHeight=600;
	       	var iTop = (window.screen.height - 30 - iHeight) / 2;
	       	var iLeft = (window.screen.width - 10 - iWidth) / 2;
			window.open("${ctx}/reg/base/regBaseZdjbxx/fwlinklist?YWH=${YWH}&CXMID=${XMID}","zddmwindow",
					"height="+ iHeight +",width="+ iWidth +",top="+ iTop +",left="+ iLeft +",toolbar=no,menubar=no,scrollbars=yes, resizable=no,location=no, status=no");
			//window.open("${ctx}/reg/base/regBaseZdjbxx/form?YWH=${YWH}","zddmwindow", 
				//	"height="+ iHeight +",width="+ iWidth +",top="+ iTop +",left="+ iLeft +",toolbar=no,menubar=no,scrollbars=yes, resizable=no,location=no, status=no");
		}
		function isUsed(zddm, xmid){
			$.ajax({
				type:"POST",
				url:"${ctx}/reg/base/regBaseZrz/isused",
				cache: false,
				data:"zddm="+zddm+"&xmid"+xmid,
			    async : false,
				success:function(modelmap){
					var issjed = modelmap.data;
					if(issjed == "1"){
						alert("已经添加过收件信息了!如需变动,请直接在列表记录里进行修改!");
						return;
					}
				}
			});
		}
		function isUseds(xmid){
			$.ajax({ 
				type:"POST",
				url:"${ctx}/reg/base/regBaseZrz/isused",
				cache: false,
				data:"zddm="+zddm+"&xmid"+xmid,
			    async : false,
				success:function(modelmap){
					var issjed = modelmap.data;
					if(issjed == "1"){
						alert("已经添加过收件信息了!如需变动,请直接在列表记录里进行修改!");
						return;
					}
				}
			});
		}
		function gbwz(){
			var dscs = parseInt($("#dscstext").val());
			var dxcs =	parseInt($("#dxcstext").val());
			$("#zcstext").val(dscs+dxcs);
		}


		//自然幢坐标导入相关函数
		function xxdaoru(){
			$.jBox($("#importBox").html(), {title:"导入数据", buttons:{"关闭":true}, 
				bottomText:"导入文件不能超过5M,仅允许导入“xls”或“xlsx”格式文件!"});
		}
		
		
		function addRow(list, idx, tpl, row){
			$(list).append(Mustache.render(tpl, {
				idx: idx, delBtn: true, row: row
			}));
			$(list+idx).find("select").each(function(){
				$(this).val($(this).attr("data-value"));
			});
			for(var i=0;i<150;i++){
				$("#regBaseZbinfoZrzList"+i+"_sort").val(i+1);
				$("#regBaseZbinfoZrzList"+i+"_zbdmc").val("J"+(i+1));
			}
			
			$(list+idx).find("input[type='checkbox'], input[type='radio']").each(function(){
				var ss = $(this).attr("data-value").split(',');
				for (var i=0; i<ss.length; i++){
					if($(this).val() == ss[i]){
						$(this).attr("checked","checked");
					}
				}
			});
		}
		
		function delRow(obj, prefix){
			var id = $(prefix+"_id");
			var delFlag = $(prefix+"_delFlag");
			if (id.val() == ""){
				$(obj).parent().parent().remove();
			}else if(delFlag.val() == "0"){
				delFlag.val("1");
				$(obj).html("撤销删除").attr("title", "撤销删除");
				$(obj).parent().parent().addClass("error");
			}else if(delFlag.val() == "1"){
				delFlag.val("0");
				$(obj).html("删    除").attr("title", "删除");
				$(obj).parent().parent().removeClass("error");
			}
		}

		 function selectTuCeng(ListTucengNO)
	        {
	        	var tucengValue="";
	        	switch(ListTucengNO)
	        	{
	        	  case "A":
	        		  tucengValue=actualSvrcfg.SYQZDGDBP;
	        		  break;
	        	  case "B":
	        		  tucengValue=actualSvrcfg.SHYQZD_DB;
	        		  break;
	        	  case "S":
	        		  tucengValue=actualSvrcfg.SHYQZD_DS;
	        		  break;
	        	  case "X":
	        		  tucengValue=actualSvrcfg.SHYQZD_DX;
	        		  break;
	        	  case "C":
	        		  tucengValue=actualSvrcfg.ZJDGDBP;
	        		  break;
	        	  case "D":
	        		  tucengValue=actualSvrcfg.CBJYQZD_GD;
	        		  break;
	        	  case "E":
	        		  tucengValue=actualSvrcfg.CBJYQZD_LD;
	        		  break;
	        	  case "F":
	        		  tucengValue=actualSvrcfg.CBJYQZD_CD;
	        		  break;
	        	  case "I":
	        		  break;
	        	  case "J":
	        		  break;
	        	  default:break;
	        	
	        	}
	        	return tucengValue;
	        }		
	        
		function checkzb(){
			//坐标校验
              var zid='${regBaseZrz.id}';
				var tb = document.getElementById("chxxTable");
				var tempx,tempy,flag;
				 zblisttemp="";
				for (var i=1;i<tb.rows.length-1;i++){
					tempx = tb.rows[i].cells[3].getElementsByTagName("INPUT")[0].value;
				    tempy = tb.rows[i].cells[4].getElementsByTagName("INPUT")[0].value;
				    flag = 0;
					 //判断导入的数据格式,为文本则可导入
					  if((tempx.indexOf("E") != -1) || (tempy.indexOf("E") != -1)){
							 alert("导入的数据格式为 非文本 格式,无法导入,请修改后重新导入");
							 flag = 1;
							 var url ="${ctx}/reg/base/regBaseZrz/reimport?id="+zid;
							 window.location = url;
							 break;
							}
						 var arr = tempx.split(".");
						 var arr1 = tempy.split(".");
						 var NewIndex = 0;
						if((arr[0].length>=7)&&(arr1[0].length>=7))
					    {
							if($("#regBaseZbinfoList"+(i-1)+"_delFlag").val()=="0"){
								//坐标与GIS图XY坐标颠倒
							if((arr[0].length == 7)&&(arr1[0].length==8)){
							TempZBArray[i-1]=tempy+","+tempx;
						    TempZBYXArray[i-1]= new Zondy.Object.Point2D(parseFloat(tempy), parseFloat(tempx));	
							zblisttemp=zblisttemp+$("#regBaseZbinfoList"+(i-1)+"_zbdmc").val()+"["+$("#regBaseZbinfoList"+(i-1)+"_zby").val()+","+$("#regBaseZbinfoList"+(i-1)+"_zbx").val()+"] "+","+$("#regBaseZbinfoList"+(i-1)+"_id").val()+","+$("#regBaseZbinfoList"+(i-1)+"_delFlag").val()+","+$("#regBaseZbinfoList"+(i-1)+"_sort").val()+";";
							}
							//坐标正常,XY一一对应
							else if((arr[0].length == 8)&&(arr1[0].length==7)){
							  TempZBArray[i-1]=tempx+","+tempy;
						      TempZBYXArray[i-1]= new Zondy.Object.Point2D(parseFloat(tempx), parseFloat(tempy));
							   zblisttemp=zblisttemp+$("#regBaseZbinfoList"+(i-1)+"_zbdmc").val()+"["+$("#regBaseZbinfoList"+(i-1)+"_zbx").val()+","+$("#regBaseZbinfoList"+(i-1)+"_zby").val()+"] "+","+$("#regBaseZbinfoList"+(i-1)+"_id").val()+","+$("#regBaseZbinfoList"+(i-1)+"_delFlag").val()+","+$("#regBaseZbinfoList"+(i-1)+"_sort").val()+";";
							}else{
							  alert("第"+i+ "行坐标输入有误,请检查");
							  return false;	
							}
							}					
					        
					    }
						else
						{
							alert("第"+i+ "行坐标输入有误,请检查");
							return false;
						}
				}
				if(flag == 0){
				if((ZBYXArray.length<4)) {alert("请输入至少4个坐标点!");return false;}
				if(ZBArray[0]!=ZBArray[ZBArray.length-1])
				{
			    	 ZBArray[ZBArray.length]=ZBArray[0];
			    	 ZBYXArray[ZBYXArray.length]=ZBYXArray[0];
			    }
				}
			}
		
     //根据楼栋界址点找地
		function zrzzbandzd(){
          var quZrzObj = new Array();
          quZrzObj=ZBYXArray;
			  var geomObj = new Zondy.Object.Polygon(quZrzObj);    
			  geomObj.nearDis=0.001;
			  var queryStruct=new Zondy.Service.QueryFeatureStruct(
					  {
						  IncludeGeometry:true,
						  IncludeAttribute:true,
						  IncludeWebGraphic:false
						  });
			  var featureRule =Zondy.Service.QueryFeatureRule({
	                MustInside:true,
	                Intersect: false
	            });
	            var zrzZdtzm = '${regBaseZrzchxx.zdtzm}';
			  temptuceng = selectTuCeng(zrzZdtzm);
		  	 var queryParam=new Zondy.Service.QueryByLayerParameter(
		  			temptuceng,
		  			{ 
	                 geometry: geomObj,
	                 resultFormat: "json",
	                 isAsc: true,//排序 旧API文档没有
	                 rule: featureRule,
	                 struct:queryStruct
	                // where :  str
	                });
		 	queryParam.recordNumber=1000;
		
		var queryService=new Zondy.Service.QueryLayerFeature(queryParam,
			{
			ip: actualSvrcfg.ip,        //IP地址
			port: actualSvrcfg.port ,   //端口号
			requestType:"POST"
			});
		 queryService.query(frelationshipzddm);
		}
		
		function frelationshipzddm(data){
			result = "";
			result = data;
			console.log(result);
			if(result.TotalCount > 2){
				alert("该自然幢跨两块以上宗地存在,不符合国家规定,无法导入");
				return false;
			}
			 if(result.TotalCount == 2){
                   if(data.SFEleArray[0].AttValue[30] != data.SFEleArray[1].AttValue[30]){
                      alert("该自然幢跨宗地存在,宗地权利人不同,请确认!");
                      return false;
                      } 
                 else{
                	  var bdcdyhList = new Array();
          			   for(var i = 0;i<data.TotalCount;i++){
                          bdcdyhList[i] = data.SFEleArray[i].AttValue[5];
          				 }
                         $.ajax({
                             type:"POST",
                             url:"${ctx}/reg/base/regBaseZrz/queryzdzb",
                             cache:false,
                             data:"bdcdyhList="+ bdcdyhList,
                             async:false,
                             success:function(modelmap){
                                var zblist = modelmap.zblist;
                                var Objf = new Array();
               		    	    var quObjf = new Array();
               		    	    var Objs = new Array();
               		    	    var quObjs = new Array();
               				    var lengthzbf,lengthzbs;
               				    var r = /\[(.+?)\]/g;
               				    var tempf,temps;
               			        lengthzbf="";
               			        lengthzbs="";
               					lengthzbf=zblist[0];
               					console.log(zblist[0]);
               					lengthzbs=zblist[1];		
               					lengthzbf=lengthzbf.replace( /^\s+|\s+$/g, "" );
               					lengthzbs=lengthzbs.replace( /^\s+|\s+$/g, "" );
               					Objf=lengthzbf.match(r);
               					Objs=lengthzbs.match(r);
               					for(var i=0;i<Objf.length;i++)
               					{
               						tempf= Objf[i].substring(1,Objf[i].length-1);
               						tempf=tempf.replace( /^\s+|\s+$/g, "" );
               						lengthzbf=tempf.split(",");
               						if(lengthzbf.length==2)
               						{
               							quObjf[i] = new Zondy.Object.Point2D(parseFloat(lengthzbf[1]), parseFloat(lengthzbf[0]));
               							}
               					}
               					for(var j=0;j<Objs.length;j++)
               					{
               						temps= Objs[j].substring(1,Objs[j].length-1);
               						temps=temps.replace( /^\s+|\s+$/g, "" );
               						lengthzbs=temps.split(",");
               						if(lengthzbs.length==2)
               						{
               							quObjs[j] = new Zondy.Object.Point2D(parseFloat(lengthzbs[1]), parseFloat(lengthzbs[0]));
               							}
               					}
               	                var topParam = new Zondy.Service.TopAnalysis({
               	                     ip:actualSvrcfg.ip,
               	                     port:actualSvrcfg.port
               	                    });
               	                var RegObj = new Zondy.Object.GRegion([
               	                                                       new Zondy.Object.AnyLine([new Zondy.Object.Arc(quObjf)])]);
               	                 topParam.setReg(RegObj); 
               	                var regionObj = new Zondy.Object.GRegion([new Zondy.Object.AnyLine([new Zondy.Object.Arc(quObjs)])]);
               	                topParam.setRelativeObj(regionObj);
               	                topParam.nearDis = "0.005";
               	                topParam.execute(AnalysisOnSuccess,AnalysisError);
                                 }
                             })
                      } 
				} 
			if(result.TotalCount < 1){
                 alert("未找到相关宗地,请确认坐标是否正确或者宗地特征码是否正确");
                 return false;
				}
			if(result.TotalCount == 1){
			$.ajax({
				type:"POST",
				url:"${ctx}/reg/base/regBaseZrz/relationzddm",
				cache: false,
				data:"bdcdyh="+result.SFEleArray[0].AttValue[5],
			    async: false,
				success:function(modelmap){
					Modelmap = modelmap;
					zbxx = modelmap.zb;
					var Obj = new Array();
		    	    var quObj = new Array();
				    var lengthzb;
				    var r = /\[(.+?)\]/g;
				    var temp;
			        lengthzb="";
					lengthzb=zbxx;
					console.log("11  "+lengthzb);		
					lengthzb=lengthzb.replace( /^\s+|\s+$/g, "" );
					Obj=lengthzb.match(r);
					for(var i=0;i<Obj.length;i++)
					{
						temp= Obj[i].substring(1,Obj[i].length-1);
						temp=temp.replace( /^\s+|\s+$/g, "" );
						lengthzb=temp.split(",");
						if(lengthzb.length==2)
						{
							quObj[i] = new Zondy.Object.Point2D(parseFloat(lengthzb[1]), parseFloat(lengthzb[0]));
							}
					}
					
	                var topParam = new Zondy.Service.TopAnalysis({
	                     ip:actualSvrcfg.ip,
	                     port:actualSvrcfg.port
	                    });
	                var RegObj = new Zondy.Object.GRegion([
	                                                       new Zondy.Object.AnyLine([new Zondy.Object.Arc(ZBYXArray)])]);
	                 topParam.setReg(RegObj); 
	                var regionObj = new Zondy.Object.GRegion([new Zondy.Object.AnyLine([new Zondy.Object.Arc(quObj)])]);
	                topParam.setRelativeObj(regionObj);
	                topParam.nearDis = "0.005";
	                topParam.execute(AnalysisSuccess,AnalysisError);
				}
				});
			}
		}
       
        //宗地拓扑分析结果(相邻、相交、包含、相离)
		function AnalysisOnSuccess(data){
            if(data == "相邻"){
                  $("#zd1").append("<td><input type='radio' name='ZD' id='${regBaseZdjbxx.bdcdyh}' value='"+result.SFEleArray[0].AttValue[4]+"'/></td><td>"+result.SFEleArray[0].AttValue[4]+"</td><td>"+result.SFEleArray[0].AttValue[8]+"</td>");
                  $("#zd2").append("<td><input type='radio' name='ZD' id='${regBaseZdjbxx.bdcdyh}' value='"+result.SFEleArray[1].AttValue[4]+"'/></td><td>"+result.SFEleArray[1].AttValue[4]+"</td><td>"+result.SFEleArray[1].AttValue[8]+"</td>");
                 
                  $('#SelectZD').dialog('open');
                  $("#SelectZD").dialog("move",{top:$(document).scrollTop() + ($(window).height()-300) * 0.5});//带滚动条的div窗口居中显示
                   }
            else{
                alert("该自然幢跨宗地存在,所跨宗地不相邻,无法导入");
                return false;
                }
			}

		
		//自然幢是否相交分析结果
        function AnalysisSuccess(data){
            if(data == "包含"){
            	zdzddm = result.SFEleArray[0].AttValue[4];
                $("#zdqlr").html(Modelmap.zdqlr);
                $("#zdqllx").html(Modelmap.zdqllx);
                $("#zdjm").html(Modelmap.zdjm);
                $("#zdzl").html(Modelmap.zdzl);
                $("#zddmtext").val(Modelmap.zdzddm);
                $("#bdcdyhtext").val(Modelmap.zdbdcdyh);
                }else{
                	 $('#locationMistake').dialog('open');
   				     $("#locationMistake").dialog("move",{top:$(document).scrollTop() + ($(window).height()-300) * 0.5});//带滚动条的div窗口居中显示
                    }/* else{
                    	 $('#selectORCancleButton').dialog('open');	
     					$("#selectORCancleButton").dialog("move",{top:$(document).scrollTop() + ($(window).height()-300) * 0.5});//带滚动条的div窗口居中显示
                        } */
            
            } 
        function AnalysisError(data){
            console.log(data);
        } 

        function closetaqnchu()
 	   {
 		 var str1=$('input:radio[name="ZD"]:checked').val();
 		  console.log(str1);
 		  if(str1 == "" || str1 == undefined){
               alert("请选择一块宗地");
               return;
 	 		  }
 		 $('#SelectZD').dialog('close');
 		  $.ajax({ 
 			 type:"POST",
				url:"${ctx}/reg/base/regBaseZrz/relationzddm",
				cache: false,
				data:"bdcdyh="+str1,
			    async: false,
				success:function(modelmap){
			        $("#zdqlr").html(modelmap.zdqlr);
	                $("#zdqllx").html(modelmap.zdqllx);
	                $("#zdjm").html(modelmap.zdjm);
	                $("#zdzl").html(modelmap.zdzl);
	                $("#zddmtext").val(modelmap.zdzddm);
	                $("#bdcdyhtext").val(modelmap.zdbdcdyh);
					
				}
 		  })
 	   }

   	   function close(XMID){
   		   $('#selectZD').dialog('close');
		   var url ="${ctx}/reg/base/regBaseZrz/form?XMID="+XMID;
	       window.location = url;
   	   	   }
   	   
		//检验幢与宗地的关系,相离或相邻可以添加
		/* function jiaoyanzrzzd(){
			 //拓扑分析
			    var Obj = new Array();
	    	    var quObj = new Array();
			    var lengthzb;
			    var r = /\[(.+?)\]/g;
			    var temp;
		        lengthzb="";
		        console.log(zbxx);
				lengthzb=zbxx;		
				lengthzb=lengthzb.replace( /^\s+|\s+$/g, "" );
				Obj=lengthzb.match(r);
				for(var i=0;i<Obj.length;i++)
				{
					temp= Obj[i].substring(1,Obj[i].length-1);
					temp=temp.replace( /^\s+|\s+$/g, "" );
					lengthzb=temp.split(",");
					if(lengthzb.length==2)
					{
						quObj[i] = new Zondy.Object.Point2D(parseFloat(lengthzb[1]), parseFloat(lengthzb[0]));
						}
				}
				
                var topParam = new Zondy.Service.TopAnalysis({
                     ip:actualSvrcfg.ip,
                     port:actualSvrcfg.port
                    });
                var RegObj = new Zondy.Object.GRegion([
                                                       new Zondy.Object.AnyLine([new Zondy.Object.Arc(ZBYXArray)])]);
                 topParam.setReg(RegObj); 
                var regionObj = new Zondy.Object.GRegion([new Zondy.Object.AnyLine([new Zondy.Object.Arc(quObj)])]);
                topParam.setRelativeObj(regionObj);
                topParam.nearDis = "0.005";
                topParam.execute(AnalysisSuccess,AnalysisError);
			}*/

		//分析结果
       /* function AnalysisSuccess(data){
            
            if(data == "包含"){
            	jiaoyanzrzzb();
                }else{
                	 $('#locationMistake').dialog('open');
   				     $("#locationMistake").dialog("move",{top:$(document).scrollTop() + ($(window).height()-300) * 0.5});//带滚动条的div窗口居中显示
                    }/* else{
                    	 $('#selectORCancleButton').dialog('open');	
     					$("#selectORCancleButton").dialog("move",{top:$(document).scrollTop() + ($(window).height()-300) * 0.5});//带滚动条的div窗口居中显示
                        } */
            
           /* } 
        function AnalysisError(data){
            console.log(data);
        } 
		
		
		 function remainAddyaosu()
			{
				$('#selectORCancleButton').dialog('close');
				jiaoyanzrzzb();
			}
			function cancelAddyaosu(zid)
			{
				$('#selectORCancleButton').dialog('close');
				var url ="${ctx}/reg/base/regBaseZrz/reimport?id="+zid;
			    window.location = url;
			} */

			//检验同一宗地下,幢与幢之间的关系,相交或者包含不能添加
		function jiaoyanzrzzb(){
            var qupointObj = new Array();
            qupointObj = ZBYXArray;
            var gemoObj = new Zondy.Object.Polygon(qupointObj);
            gemoObj.nearGis = 0.0001;
            var queryStruct = new Zondy.Service.QueryFeatureStruct({
                    IncludeGeometry:true,
                 });
            var featureRule = new Zondy.Service.QueryFeatureRule({
                 Intersect:true
                });
            var tuceng = actualSvrcfg.ZRZ;
            var queryParam = new Zondy.Service.QueryByLayerParameter(tuceng,{
                  geometry:gemoObj,
                  resultFormat:"json",
                  rule:featureRule,
                  struct:queryStruct
                });
            queryParam.recordNumber = 100;
            var queryService = new Zondy.Service.QueryLayerFeature(queryParam,{
                   ip:actualSvrcfg.ip,
                   port:actualSvrcfg.port,
                   requestType:"POST"
                });
            queryService.query(queryjiaoyanzbSuccess);
			}
			

	   function queryjiaoyanzbSuccess(data){
               if(data.TotalCount>0){
                    $('#selectOkCancleButton').dialog('open');	
					$("#selectOkCancleButton").dialog("move",{top:$(document).scrollTop() + ($(window).height()-300) * 0.5});//带滚动条的div窗口居中显示
                   }
                else{
            	   addyaosu();
                   } 
		   }
	   
	   function continueAddyaosu()
		{
			$('#selectOkCancleButton').dialog('close');
			 addyaosu();
		}
		function cancelAdd(XMID)
		{
			$('#selectOkCancleButton').dialog('close');
			var url ="${ctx}/reg/base/regBaseZrz/form?XMID="+XMID;
		    window.location = url;
		}

		function cancelAddyaosu(XMID)
		{
			$('#locationMistake').dialog('close');
			var url ="${ctx}/reg/base/regBaseZrz/form?XMID="+XMID;
		    window.location = url;
		}
	 
		function addyaosu()
		{ 
			zdzddm = $("#zddmtext").val();
			var zdbdcdyh = $("#bdcdyhtext").val();
			var zbtemp="";
			for(j=0; j<ZBArray.length; j++){
			   zbtemp=zbtemp+"J"+(j+1)+"["+ZBArray[j].replace(" ","")+"] ";
		    }	
			$.ajax({ 
	  			type:"POST", //请求方式 
	  			url:"${ctx}/reg/base/regBaseZrz/savechxx1", //请求路径 
	  			cache: false,   //(默认: true,dataType为script和jsonp时默认为false) jQuery 1.2 新功能,设置为 false 将不缓存此页面。 
	  			//data:"zddmvalue="+ss+"&bdcdyhvalue="+""+"&qlrvalue="+"",  //传参 
	  			data:"xmzddm="+zdzddm+"&zdbdcdyh="+zdbdcdyh+"&jzdzb="+zbtemp+"&jzdzblist="+zblisttemp+"&cid=${regBaseZrzchxx.id}&lcid=${regBaseZrz.id}"+"&xmid=${XMID}"+"&xiugai="+xiugai+"&ghyt="+$("#ghyttext").val(),//chrymctext
	  			async:false,
	  	        //dataType: "html",   //返回值类型 
	  			success:function(modelmap){
		  			   xiugai = "";
	  				   chxxvalue = modelmap.regBaseZrzchxx;
	  				   console.log(chxxvalue.bdcdyh);
	  				   chxxid = chxxvalue.id;
	  				   lcxxvalue = modelmap.zbdcdyh;
		  			   zdjbxxvalue = modelmap.regBaseZdjbxx;
		  			   yts = modelmap.yts;
	  				  //---------------------根据chid查询到楼栋
		  			 var queryStruct = new Zondy.Service.QueryFeatureStruct();
		  				queryStruct.IncludeGeometry=true;
		  				temptuceng = actualSvrcfg.ZRZ;
		  				var str="CHID='"+chxxvalue.id +"'";
		  				var queryParam=new Zondy.Service.QueryByLayerParameter(temptuceng,{ 
		  	                   // geometry: line,
		  	                   resultFormat: "json",
		  	                   struct:queryStruct,
		  	                   where: str
		  	                   });
		  				var queryService=new Zondy.Service.QueryLayerFeature(queryParam,
		  						{
		  					ip: actualSvrcfg.ip,        //IP地址
		  					port: actualSvrcfg.port ,   //端口号
		  					requestType:"POST"
		  					});
		  				queryService.query(querydataSaveSuccess); 
		  				//------------------------------------	
	  			}
	  		});
		}
		
		 function querydataSaveSuccess(data)
		{
			if(data.TotalCount==0){
                 addloudong();
				}
			  else{
				 updatequyaosu(data.SFEleArray[0].FID,temptuceng); 
			  }
		}
		
		function addloudong()
		{
			var pointObj = new Array(); 
			var qupointObj = new Array();
			var lengthzb;
			var zbtemp="";
			for(var j=0; j<regBaseZbinfoRowIdx; j++){
				//pointObj[j]=$("#regBaseZbinfoList"+j+"_zbx").val()+","+$("#regBaseZbinfoList"+j+"_zby").val();
				zbtemp=zbtemp+$("#regBaseZbinfoZrzList"+j+"_zbdmc").val()+"["+$("#regBaseZbinfoZrzList"+j+"_zbx").val()+","+$("#regBaseZbinfoList"+j+"_zby").val()+"] "+"zbid="+$("#regBaseZbinfoZrzList"+j+"_id").val() +";";
			}
			zbtemp="";
			for(var i=0; i<ZBArray.length; i++){
			   zbtemp=zbtemp+"J"+(j+1)+"["+ZBArray[i]+"] ";
		    }			
			 /*for(var i=0;i<pointObj.length;i++)
			  {
                lengthzb=pointObj[i].split(",");
		        if(lengthzb.length==2)
		        {
			       qupointObj[i] = new Zondy.Object.Point2D(parseFloat(lengthzb[1]), parseFloat(lengthzb[0]));
		        }
		        else
		        {alert("该宗地坐标有误!");return false;}
		      }*/
		      
			  qupointObj=ZBYXArray;
			  var gArc = new Zondy.Object.Arc(qupointObj);              //构成区要素的弧段
			  var gAnyLine = new Zondy.Object.AnyLine([gArc]);        //构成区要素折线
			  var gRegion = new Zondy.Object.GRegion([gAnyLine]);     //构成区要素
			  var fGeom = new Zondy.Object.FeatureGeometry({ RegGeom: [gRegion] }); //构成区要素的几何信息
    
			 //设置区要素的图形参数信息
			  var cRegionInfo = new Zondy.Object.CRegionInfo({ EndColor: 533, FillColor:533, FillMode: 0, OutPenWidth: 1, OverMethod: 0, PatAngle: 1, PatColor: 1, PatHeight: 1, PatID: 0, PatWidth: 1 }); //区形状图形参数信息
			  var graphicInfo = new Zondy.Object.WebGraphicsInfo({ InfoType: 3, RegInfo: cRegionInfo }); //要素图形参数信
              //设置区要素的属性信息
              //var attValue = [0, , ,$("#qlrxmtext").val(),$("#zjlxtext").val(),$("#zjhmtext").val(),$("#seachprovtext").val(),$("#seachcitytext").val(),$("#seachdistricttext").val(),$("#zltext").val(),$("#zdmjtext").val(),$("#tfhtext").val(),$("#zdszdtext").val(),$("#zdszntext").val(),$("#zdszxtext").val(),$("#zdszbtext").val(),zbtemp,$("#zdt").val(),$("#chcode").val(),$("#chrymctext").val(),$("#chsjtext").val()];//$("#textnewyaosu").val()];
              var attValue = [0,,,chxxvalue.bsm,chxxvalue.zddm,chxxvalue.bdcdyh,$("#zrzhtext").val(), $("#ysdmtext").val(),$("#gzwmctext").val(),,($("#zzdmjtext").val())*1,$("#xmmctext").val(),$("#ghyttext").val(),($("#jzwgdtext").val())*1,($("#zydmjtext").val())*1,($("#ycjzmjtext").val())*1,($("#scjzmjtext").val())*1,($("#zcstext").val())*1,$("#dscstext").val(),$("#dxcstext").val(),,$("#fwjgtext").val(),yts,($("#ztstext").val())*1,$("#jzwjbyttext").val(),$("#zttext").val(),$("#dahtext").val(),"0",$("#bztext").val(),chxxvalue.id];//$("#textnewyaosu").val()];
             //创建一个新的区要素
             var newFeature = new Zondy.Object.Feature({ AttValue: attValue, fGeom: fGeom, GraphicInfo: graphicInfo });
             newFeature.setFType(3);
             //创建一个要素数据集
             var featureSet = new Zondy.Object.FeatureSet();
             var fldNumber = 30;
             var fldType = ["long",    "double", "double",   "long",  "string","string","string","string","string","date","double","string","string","double","double","double","double","long","string","string","double","string","string","long","string","string","string","string","string","string"];
             var fldName = ["mpLayer", "mpArea", "mpPerimeter", "BSM", "ZDDM", "BDCDYH","ZRZH",  "YSDM","JZWMC","JGRQ","ZZDMJ","XMMC","GHYT","JZWGD", "ZYDMJ","YCJZMJ", "SCJZMJ", "ZCS" ,"DSCS","DXCS", "DZSD", "FWJG", "YTMC","ZTS","JZWJBYT","ZT","DAH","islogout","BZ","CHID"];
              var cAttValue = new Zondy.Object.CAttStruct({ FldNumber: fldNumber, FldType: fldType, FldName: fldName });
             featureSet.AttStruct = cAttValue;
             featureSet.addFeature(newFeature);
            //创建一个要素编辑服务对象
            // var editDocFeature = new Zondy.Service.EditDocFeature(SvrCfg.tileMapName, 0,0, { ip: SvrCfg.ip,  port: SvrCfg.port });
            temptuceng=actualSvrcfg.ZRZ;
            if(temptuceng !="")
            {
    	       var editDocFeature = new Zondy.Service.EditLayerFeature(temptuceng, { ip: actualSvrcfg.ip,  port: actualSvrcfg.port });
               editDocFeature.add(featureSet, chxxsuccess);	 
				  //--------------------------------
			}
		}

		function chxxsuccess(data)
		{
			if (data == true) {
				alert("添加要素成功!");
				if(bj == '0'){
					//判断建筑物名称是否重复,重复的话不能提交 
					var xmid = "${XMID}";
					$.ajax({
						type:"POST",
						url:"${ctx}/reg/base/regBaseZrz/isgzwmc",
						cache: false,
						data:"gzwmc="+$("#gzwmctext").val()+"&xmid="+xmid,
					    async : false,
						success:function(modelmap){
							var ised = modelmap.data;
							if(ised == "1"){
								alert("已经存在此构筑物名称,请重新填写!");
								return;
							}else{
								if(document.getElementById("btnSubmit")){
									document.getElementById("btnSubmit").disabled="disabled";
								}
								if(document.getElementById("btnGenTable")){
									document.getElementById("btnGenTable").disabled="disabled";
								}
								document.inputForms.action = "${ctx}/reg/base/regBaseZrz/save1?chxxid="+chxxid;
								document.inputForms.submit();
							}
						}
					});
				}
				 /* var url ="${ctx}/reg/base/regBaseZrz/list?XMID=${regBaseZrz.xmid}&cid=" + chxxvalue.id;
				 window.location = url; */
			}
		    else {
		        alert("添加要素失败!");
		    }
		}
		
		function updatequyaosu(fid,tuceng)
		{  
			fid = fid;
			var editDocFeature = new Zondy.Service.EditLayerFeature(tuceng, { ip: actualSvrcfg.ip,  port: actualSvrcfg.port });			   
			editDocFeature.deletes(fid, deleteonSuccess);	
		}	
		
		function deleteonSuccess(data) 
		{
			if(data == true){
				addloudong();
			}else{
                    alert("更新修改失败,请检查参数是否填写完整");
				}
				
		}
		function updateSuccess(data)
		{ 
			if (data == true) {
	         alert("更新成功!");
	         return true;
	         /* var url ="${ctx}/reg/base/regBaseZrz/list?XMID=${regBaseZrz.xmid}&daoru=true";
 			 window.location = url; */
	          }
	        else {
	         alert("更新失败,请检查参数是否填写完整!");
	        }		 
		}
		
	</script>
	<style>
		.otable-form{width:100%;border-color:#dddddd;border:1px solid #ddd;}
		.otable-form,.table-form td{background-color:#fdfdfd;padding:2px;}
		.otable-form td.tit{background:#fafafa;text-align:right;padding-right:3px;white-space:nowrap;}
	</style>
</head>
<body>
	<ul class="nav nav-tabs">
		<li><a href="${ctx}/reg/base/regBaseZrz/list?XMID=${XMID}">自然幢信息列表</a></li>
		<shiro:hasPermission name="reg:base:regBaseZrz:edit"><li><a href="${ctx}/reg/base/regBaseZrz/form?XMID=${XMID}">自然幢信息添加</a></li></shiro:hasPermission>
		<li class="active"><a href="${ctx}/reg/base/regBaseZrz/form?id=${regBaseZrz.id}">自然幢信息(自动)<shiro:hasPermission name="reg:base:regBaseZrz:edit">${not empty regBaseZrz.id?'修改':'添加'}</shiro:hasPermission><shiro:lacksPermission name="reg:base:regBaseZrz:edit">查看</shiro:lacksPermission></a></li>
	</ul><br/>
	<div id="importBox" class="hide">
	        <form id="importForm" action="${ctx}/reg/base/regBaseZrz/importZrzFile?XMID=${XMID}" method="post" enctype="multipart/form-data"
			class="form-search" style="padding-left:20px;text-align:center;" onsubmit="loading('正在导入,请稍等...');"><br/>
			<input id="uploadFile" name="file" type="file" style="width:330px"/><br/><br/>  
			<input id="btnImportSubmit" class="btn btn-primary" type="submit" value="   导    入   " />
			<a href="${ctx}/reg/base/regBaseZrz/importFileTemplate">下载模板</a>
		</form>
	 </div>
	<form:form id="inputForm" name="inputForms" modelAttribute="regBaseZrz" action="${ctx}/reg/base/regBaseZrz/save1" method="post" class="form-horizontal">
		<form:hidden path="id"/>
		<input id="xmid" name="xmid" type="hidden" value="${XMID}" />
		
		<c:if test="${empty regBaseZrz.id}">
			<div class="current_fwinfo">
				宗地权利人【<span id="zdqlr"></span>】,宗地权利类型【<span id="zdqllx"></span>】,
				宗地面积【<span id="zdjm"></span>】 宗地坐落【<span id="zdzl"></span>
				<input id="btndaoru" class="btn btn-primary" type="button" value="界址点导入" onclick="xxdaoru()"/>
			</div>
		</c:if>
		
		<c:if test="${not empty regBaseZrz.id}">
			<div class="current_fwinfo">
				宗地权利人【<span id="zdqlr">${zdqlr}</span>】,宗地权利类型【<span id="zdqllx">${fns:getDictLabel(zdqllx, 'reg_bus_qllx', '')}</span>】,
				宗地面积【<span id="zdjm">${zdjm}</span>】 宗地坐落【<span id="zdzl">${zdzl}</span>
			</div>
		</c:if>
		<sys:message content="${message}"/>
		<table class="otable-form" >
			<tr>
				<td class="tit">标识码:</td>
				<td>
					<c:if test="${empty regBaseZrz.id}">
					<form:input path="bsm" htmlEscape="false" id="bsmtext" value="${BSM}" readOnly="true" class="input-small digits" maxlength="6"/>
					</c:if>
					<c:if test="${not empty regBaseZrz.id}">
					<form:input path="bsm" htmlEscape="false" id="bsmtext" readOnly="true" class="input-small digits" maxlength="6"/>
					</c:if>
				</td>
				<td class="tit">要素代码:</td>
				<td><form:input path="ysdm" id="ysdmtext" value="2001030110" readOnly="true" htmlEscape="false" maxlength="10" class="input-small"/></td>
				<td class="tit">不动产单元号:</td>
				<td><form:input path="bdcdyh" id="bdcdyhtext" htmlEscape="false" readOnly="true" maxlength="28" class="input-small"/></td>
				 <td class="tit">宗地代码:</td>
				<td><form:input path="zddm" id="zddmtext" value="${regBaseXm.zddm}" 
						readOnly="true" htmlEscape="false"
						 maxlength="19" class="input-large required"/>
					<span class="help-inline"><font color="red">*</font> </span>
					<%-- <c:if test="${empty zced}">
						<input id="btnChoice" class="btn btn-primary" type="button" value="请选择已发证的宗地" 
							onclick="javascript:winOpen();"/>
					</c:if> --%>
				</td>
				<%-- <td class="tit">宗地特征码:</td>
				 <td><form:select id="zdtzmTxt" path="" class="input-small required">
				        <form:option value="" label=""/>
					   <form:options items="${fns:getDictList('reg_bus_zdtzm')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
					</form:select> 
					<span class="help-inline"><font color="red">*</font> </span>
				</td>  --%>
			</tr>
			<tr>
				<td class="tit">自然幢号:</td>
				<td><form:input path="zrzh" id="zrzhtext" htmlEscape="false" value="${ZRZH}" readOnly="true" maxlength="24" class="input-small required"/>
				<span class="help-inline"><font color="red">*</font> </span></td>
				<td class="tit">项目名称:</td>
				<td><form:input path="xmmc" id="xmmctext" value="${regBaseXm.xmmc}" readOnly="true" htmlEscape="false" maxlength="100" class="input-small "/></td>
				<td class="tit">建筑物名称:</td>
				<td><form:input path="gzwmc" id="gzwmctext" htmlEscape="false" maxlength="100" class="input-small required"/>
					<span class="help-inline"><font color="red">*</font> </span></td>
				<td class="tit">竣工日期:</td>
				<td><input name="jgrq" type="text" id="jgrqtext" readonly="readonly" maxlength="20" class="input-medium Wdate"
					value="<fmt:formatDate value="${regBaseZrz.jgrq}" pattern="yyyy-MM-dd"/>"
					onclick="WdatePicker({dateFmt:'yyyy-MM-dd' });"/>
				</td>
			</tr>
			<tr>
				<td class="tit">建筑物高度:</td>
				<td><form:input path="jzwgd" id="jzwgdtext" htmlEscape="false" class="input-small  number"/><font size="3">m</font></td>
				<td class="tit">幢占地面积:</td>
				<td><form:input path="zzdmj" id="zzdmjtext" htmlEscape="false"  class="input-small  number required"/><font size="4"></font>
					<span class="help-inline"><font color="red">*</font> </span>
				</td>
				<td class="tit">幢用地面积:</td>
				<td><form:input path="zydmj" id="zydmjtext" htmlEscape="false" class="input-small  number"/><font size="4"></font></td>
				<%--
				<td class="tit">预测建筑面积:</td>
				<td><form:input path="ycjzmj" htmlEscape="false" class="input-small  number"/><font size="4"></font></td>
				 --%>
				<td class="tit">状态:</td>
				<td><form:select path="zt" class="input-small " id="zttext">
					<form:option value="1" label="有效"/>
					<form:options items="${fns:getDictList('reg_bus_bdcdyzt')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
				</form:select></td>
			</tr>
			<tr>
				<td class="tit">建筑面积:</td>
				<td><form:input path="scjzmj" id="scjzmjtext" htmlEscape="false" class="input-small number required"/><font size="4"></font>
					<span class="help-inline"><font color="red">*</font> </span>
				</td>
				<td class="tit">总层数:</td>
				<td><form:input path="zcs" id="zcstext" htmlEscape="false" maxlength="4" readonly="true"  class="input-small digits required"/> 
					<span class="help-inline"><font color="red">*</font> </span>
				</td>
				<td class="tit">地上层数:</td>
				<td><form:input path="dscs" id="dscstext" htmlEscape="false" onkeyup="gbwz()" maxlength="4" class="input-small digits required"/>
					<span class="help-inline"><font color="red">*</font> </span>
				</td>
				<td class="tit">地下层数:</td>
				<td><form:input path="dxcs" id="dxcstext" htmlEscape="false" maxlength="4" onkeyup="gbwz()" class="input-small digits required"/>
					<span class="help-inline"><font color="red">*</font> </span>
				</td>
			</tr>
			<tr>
				<td class="tit">规划用途:</td>
				<td><form:select path="ghyt" id="ghyttext" class="input-small required">
						<form:option value="" label=""/>
						<form:options items="${fns:getDictList('reg_bus_fwyt')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
					</form:select>
					<span class="help-inline"><font color="red">*</font> </span>
				</td>
				<td class="tit">房屋结构:</td>
				<td><form:select path="fwjg" id="fwjgtext" class="input-small required">
						<form:option value="" label=""/>
						<form:options items="${fns:getDictList('reg_bus_fwjg')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
					</form:select>
					<span class="help-inline"><font color="red">*</font> </span>
				</td>
				<td class="tit">总套数:</td>
				<td><form:input path="zts" id="ztstext" htmlEscape="false" maxlength="6" class="input-small  digits"/></td>
				<td class="tit">宗地分摊方式:</td>
				<td><form:select path="zdftfs" id="zdftfstext" class="input-small required">
						<form:option value="" label=""/>
						<form:options items="${fns:getDictList('reg_bus_zdftfs')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
					</form:select>
					<span class="help-inline"><font color="red">*</font> </span>
				</td>
			</tr>
			<tr>
				<td class="tit">建筑物基本用途:</td>
				<td><form:textarea path="jzwjbyt" id="jzwjbyttext" htmlEscape="false" rows="2" maxlength="200" class="input-medium "/></td>
				<td class="tit">档案号:</td>
				<td><form:input path="dah" id="dahtext" htmlEscape="false" maxlength="50" class="input-small "/></td>
				<td class="tit">备注:</td>
				<td colspan="3"><form:textarea path="bz" id="bztext" htmlEscape="false" rows="2" maxlength="200" class="input-xlarge "/></td>
			</tr>
			</table>
<%-- 	<form:form id="inputForm" modelAttribute="regBaseZrz" action="${ctx}/reg/base/regBaseZrz/zrzzbxxsave" method="post" class="form-horizontal">
 --%>		
		
		<div class="control-group">
			<label class="control-group">界址点坐标:</label>
			<div class="controls">
				<table id="chxxTable" class="table table-striped table-bordered table-condensed">
					<thead>
						<tr>
							<th class="hide"></th>
							<th>序号</th>
							<th>坐标点名称</th>
							<th>X坐标值</th>
							<th>Y坐标值</th>
							<shiro:hasPermission name="reg:base:regBaseZrz:edit"><th width="100">&nbsp;操   作</th></shiro:hasPermission>
						</tr>
					</thead>
					<tbody id="regBaseZbinfoZrzList">
					</tbody>
					<shiro:hasPermission name="reg:base:regBaseZrz:edit"><tfoot>
						<tr><td colspan="5"><a href="#" onclick="addRow('#regBaseZbinfoZrzList', regBaseZbinfoZrzRowIdx, regBaseZbinfoTpl);regBaseZbinfoZrzRowIdx = regBaseZbinfoZrzRowIdx + 1;" class="btn">新增</a></td></tr>
					</tfoot></shiro:hasPermission>
				</table>
				<script type="text/template" id="regBaseZbZrzTpl">//<!--
						<tr id="regBaseZbinfoZrzList{{idx}}">
							<td class="hide">
								<input id="regBaseZbinfoZrzList{{idx}}_id" name="regBaseZbinfoZrzList[{{idx}}].id" type="hidden" value="{{row.id}}"/>
								<input id="regBaseZbinfoZrzList{{idx}}_delFlag" name="regBaseZbinfoZrzList[{{idx}}].delFlag" type="hidden" value="0"/>
							</td>
							<td>
								<input id="regBaseZbinfoZrzList{{idx}}_sort" name="regBaseZbinfoZrzList[{{idx}}].sort" type="text" value="{{row.sort}}" maxlength="100" class="input-small "/>
							</td>
							<td>
								<input id="regBaseZbinfoZrzList{{idx}}_zbdmc" name="regBaseZbinfoZrzList[{{idx}}].zbdmc" type="text" value="{{row.zbdmc}}" maxlength="100" class="input-small "/>
							</td>
                            <c:if test="${not empty VIEWS}">
							<td>
								<input id="regBaseZbinfoZrzList{{idx}}_zbx" name="regBaseZbinfoZrzList[{{idx}}].zbx" type="text" value="{{row.zbx}}" maxlength="50" readonly="true" class="input-small "/>
							</td>
							<td>
								<input id="regBaseZbinfoZrzList{{idx}}_zby" name="regBaseZbinfoZrzList[{{idx}}].zby" type="text" value="{{row.zby}}" maxlength="50" readonly="true" class="input-small "/>
							</td>
                            </c:if>
                            <c:if test="${empty VIEWS}">
							<td>
								<input id="regBaseZbinfoZrzList{{idx}}_zbx" name="regBaseZbinfoZrzList[{{idx}}].zbx" type="text" value="{{row.zbx}}" maxlength="50" class="input-small "/>
							</td>
							<td>
								<input id="regBaseZbinfoZrzList{{idx}}_zby" name="regBaseZbinfoZrzList[{{idx}}].zby" type="text" value="{{row.zby}}" maxlength="50" class="input-small "/>
							</td>
                            </c:if>
							<shiro:hasPermission name="reg:base:regBaseZrz:edit"><td class="text-center" width="100">
								{{#delBtn}}<a class="btn btn-primary" onclick="delRow(this, '#regBaseZbinfoZrzList{{idx}}')" title="删除">    </a>{{/delBtn}}
							</td></shiro:hasPermission>
						</tr>//-->
					</script>
				<script type="text/javascript">
					var regBaseZbinfoZrzRowIdx = 0, regBaseZbinfoTpl = $("#regBaseZbZrzTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
					$(document).ready(function() {
						var data = ${fns:toJson(regBaseZrz.regBaseZbinfoZrzList)};
						for (var i=0; i<data.length; i++){
							addRow('#regBaseZbinfoZrzList', regBaseZbinfoZrzRowIdx, regBaseZbinfoTpl, data[i]);
							regBaseZbinfoZrzRowIdx = regBaseZbinfoZrzRowIdx + 1;
						}
					});
				</script>
			</div>
		</div>
		<%-- <div class="form-actions">
			<c:if test="${empty VIEWS}">
			<shiro:hasPermission name="reg:base:regBaseZrz:edit"><input id="btnSubmit" class="btn btn-primary" type="button" onclick="javascript:{this.disabled=true;checkzb();}" value="保 存"/>&nbsp;</shiro:hasPermission>
			</c:if>
			<input id="btnCancel" class="btn" type="button" value="返 回" onclick="gotoZrzList();"/>
		</div> --%>
	
			<!-- 
			<tr>
				<td class="tit">备注信息:</td>
				<td colspan="7"><form:textarea path="remarks" htmlEscape="false" rows="4" maxlength="255" class="input-small "/></td>
			</tr>
			 -->
		</table>
		<!-- 
		<div id="user_ts"></div>
		<input id="btnGenTable" class="btn" type="button" value="新 增" onclick="javascript:genTables()"/>
		 -->
		<div class="form-actions">
			<c:if test="${empty VIEWS}">
				<c:if test="${not empty regBaseZrz.id}">
				<shiro:hasPermission name="reg:base:regBaseZrz:edit">
					<input id="btnSubmit" class="btn btn-primary" type="button" onclick="submitZrz('1','${regBaseZrz.id}');" value="保 存"/>&nbsp;&nbsp;&nbsp;&nbsp;
				</shiro:hasPermission>
				</c:if>
				<c:if test="${empty regBaseZrz.id}">
				<shiro:hasPermission name="reg:base:regBaseZrz:edit">
					<input id="btnGenTable" class="btn btn-primary" type="button" value="保存" onclick="submitGenTable()"/>
				</shiro:hasPermission>
				<input id="genCount" name="genCount" type="hidden" value="1" class="input-mini digits required"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				</c:if>
				
			</c:if>
			<input id="btnCancel" class="btn" type="button" value="返 回" onclick="gobackzrzlist()"/>
		</div>
	</form:form>
	 <div id="selectOkCancleButton"  class="easyui-dialog" title="提示信息!"  maximizable="false"  minimizable="false" collapsible="false"  border="false" resizable="false" closable="true" closed="true" style="color:#1E90FF;left:300px;top:200px; width:300px; height:200px;padding: 5px" resizable="false">	   
            <label class="control-label"><br/>&nbsp;&nbsp;&nbsp;&nbsp;该自然幢与其他自然幢相交,是否继续。<br/><span><font color="red">选择‘是’,继续添加,选择‘否’,重新导入或还原为初始坐标!</font></span></label>
            <br/>
            <div>
			<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
			<input class="btn btn-primary" type="button" onclick="javascript:{this.disabled=true;continueAddyaosu();}" value="是"/>&nbsp;
		     &nbsp;&nbsp;&nbsp;&nbsp;
			<input id="btnCancel" class="btn" type="button" value="否" onclick="cancelAdd('${XMID}')"/>
			</div>
        </div>
		<div text-align="center" id="locationMistake"  class="easyui-dialog" title="提示信息!"  maximizable="false"  minimizable="false" collapsible="false"  border="false" resizable="false" closable="true" closed="true" style="color:#1E90FF;left:300px;top:200px; width:300px; height:200px;padding: 5px" resizable="false">    
            <label class="control-label"><br/><font color="red">该自然幢坐标不在宗地范围跨宗地存在,请重新导入或修改</font><br/></label>
            <br/>
            <div>
			<br/>
			<input id="btnCancel" class="btn" type="button" value="确定" onclick="cancelAddyaosu('${XMID}')"/>
			</div>
        </div>
	 <div id="SelectZD"  class="easyui-dialog" title="该自然幢所在的宗地"  maximizable="false"  minimizable="false" collapsible="false"  border="false" resizable="false" closable="true" closed="true" style="color:#1E90FF;left:150px;top:200px; width:600px; height:200px;padding: 5px" resizable="false">	<form style="padding:10px 20px 10px 40px;">    
           <table class="table table-bordered table-condensed"> 
              <tr>
                <td>选择</td>
                <td>不动产单元号</td>
                <td>面积</td>
              </tr>
              <tr id="zd1">
                  
              </tr>
              <tr id="zd2">
              
              </tr>
           </table>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <input class="btn btn-primary" type="button"  value="确定" onclick="closetaqnchu();">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                 <input id="btnCancel" class="btn" type="button"  value="取消" onclick="close('${XMID}');">	                 
           </div>
</body>
</html>