FLbs4amap_wev8.js 22 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
	if(typeof(MEC_NS) == 'undefined'){
	MEC_NS = {};
}

MEC_NS.FLbs4amap = function(type, id, mecJson){
	this.type = type;
	if(!id){
		id = new UUID().toString();
	}
	this.id = id;
	if(!mecJson){
		mecJson = this.getDefaultMecJson();
	}
	this.mecJson = mecJson;
    var that = this;
    require(['mec'], function(mec){
        that.remark = function(){
            return mec.remark(that.mecJson.fieldlabel);
        };
    });
};

/*获取id。 必需的方法*/
MEC_NS.FLbs4amap.prototype.getID = function(){
	return this.id;
};

/*获取设计的html, 页面上怎么显示控件完全依赖于此方法。 必需的方法*/
MEC_NS.FLbs4amap.prototype.getDesignHtml = function(){
	return getDesignHtml(this);
};

/*获取构建属性编辑窗体的html,添加和单击控件后会调用此方法,由此方法去构建属性编辑窗体。 必需的方法*/
MEC_NS.FLbs4amap.prototype.getAttrDlgHtml = function(){
	var theId = this.id;
	
	var limitPointTip = "";
	if(_userLanguage=="8"){
		limitPointTip = "The content here is a coordinate information format: longitude, latitude can be: 1. fixed coordinates, such as 121.522443,31.082311 2., get page parameters, such as {coordinate} 3. data set references, such as {data.coordinate}";
	}else if(_userLanguage=="9"){
		limitPointTip = "此處內容為一個座標資訊,格式為:經度,緯度
可以是:
1.固定的座標,如:121.522443,31.082311
2.獲取頁面參數,如:{coordinate}
3.數据集引用,如:{data.coordinate}" ;
	}else{
		limitPointTip = "此处内容为一个坐标信息,格式为:经度,纬度
可以是:
1. 固定的坐标,如:121.522443,31.082311
2. 获取页面参数,如:{coordinate}
3. 数据集引用, 如:{data.coordinate}";
	}
	
	var htm = "<div id=\"MADFLbs4amap_"+theId+"\" class=\"MADFLbs4amap_Container\">"
							+"<div class=\"title\">"+SystemEnv.getHtmlNoteName(4650)+"</div>"
							+"<div class=\"form-group\">"
							+"<div class=\"row\">"
								+"<span class=\"col-2 span-control\">"+SystemEnv.getHtmlNoteName(4607)+"</span>"  //所属表单:
							    +"<div class=\"col-m-8\"><select class=\"form-control\" data-autobind id=\"formid_"+theId+"\" onchange=\"MADFLbs4amap_FormChange('"+theId+"')\">"+Mec_GetFormOptionHtml()+"</select></div>"
							+"</div>"
							
							+"<div class=\"row\">"
                                +"<span class=\"col-2 span-control\">"+SystemEnv.getHtmlNoteName(4563)+"</span>"  //数据保存:
                                +"<div class=\"col-m-8\"><select class=\"form-control\" data-autobind id=\"savetype_"+theId+"\" onchange=\"MADFLbs4amap_SavetypeChange('"+theId+"')\">"
                                    +"<option value=\"1\">"+SystemEnv.getHtmlNoteName(4564)+"</option>"  //只保存经纬度
                                    +"<option value=\"2\">"+SystemEnv.getHtmlNoteName(4565)+"</option>"  //只保存地址中文名称
                                    +"<option value=\"3\">"+SystemEnv.getHtmlNoteName(4566)+"</option>"  //既保存经纬度,同时保存地址中文名称
                                +"</select></div>"
                            +"</div>"
                            +"<div id=\"MADFLbs4amap_LngLat_"+theId+"\">"
    							+"<div class=\"row\">"
    								+"<span class=\"col-2 span-control\">"+SystemEnv.getHtmlNoteName(5459)+"</span>"  //经度字段:
    								+"<div class=\"col-m-8 required\"><select class=\"form-control requireded\" data-autobind id=\"lngFieldname_" + theId + "\"></select></div>"
    							+"</div>"
    							+"<div class=\"row\">"
											+"<span class=\"col-2 span-control\">"+SystemEnv.getHtmlNoteName(5460)+"</span>"  //纬度字段:
											+"<div class=\"col-m-8 required\"><select class=\"form-control requireded\" data-autobind id=\"latFieldname_" + theId + "\"></select></div>"
											+"</div>"
									+"</div>"
									+"<div class=\"row\" id=\"MADFLbs4amap_Address_"+theId+"\">"
											+"<span class=\"col-2 span-control\">"+SystemEnv.getHtmlNoteName(5053)+"</span>"  //中文字段:
											+"<div class=\"col-m-8 required\"><select class=\"MADFLbs4amap_Select requireded\" data-autobind id=\"addressFieldname_" + theId + "\"></select></div>"
									+"</div>"
							+"<div class=\"row\">"
								+"<span class=\"col-2 span-control\">"+SystemEnv.getHtmlNoteName(4514)+"</span>"  //显示名称:
								+"<div class=\"col-m-8\"><input class=\"form-control\" data-autobind='fieldlabel' id=\"fieldlabel_"+theId+"\" type=\"text\" "+MLanguage.ATTR+"/></div>"
							+"</div>"
							
							+"<div class=\"row\">"
								+"<span class=\"col-2 span-control\">"+SystemEnv.getHtmlNoteName(4568)+"</span>"  //定位类型:
								+"<div class=\"col-m-8\"><select class=\"form-control\" id=\"postype_"+theId+"\" onchange=\"MADFLbs4amap_changePosType('"+theId+"');\">"
									+"<option value=\"1\">"+SystemEnv.getHtmlNoteName(4569)+"</option>"  //只显示当前位置,不显示周围热点
									+"<option value=\"2\">"+SystemEnv.getHtmlNoteName(4570)+"</option>"  //显示当前位置和周围热点
									+"<option value=\"3\">"+SystemEnv.getHtmlNoteName(4571)+"</option>"  //显示当前位置和周围热点,并允许改变位置
								+"</select></div>"
							+"</div>"
							+"<div class=\"row\" style=\"display:none;\">"
								+"<span class=\"col-2 span-control\">"+SystemEnv.getHtmlNoteName(4318)+"</span>"  //按钮名称:
								+"<div class=\"col-m-8\"><input class=\"form-control\" id=\"btntext_"+theId+"\" type=\"text\" /></div>"
							+"</div>"
							+"<div class=\"row poi-content\" style=\"position: relative;display:none;\">"
								+"<span class=\"col-2 span-control\">"+SystemEnv.getHtmlNoteName(4572)+"</span>"  //搜索半径:
								+"<div class=\"col-m-8\"><input class=\"form-control\" id=\"poiradius_"+theId+"\" type=\"text\" /></div>"
								+"<div style=\"position: absolute;right: 8px;top: 7px;color: #999;font-size: 13px;\">"+SystemEnv.getHtmlNoteName(5059)+"</div>"//米
							+"</div>"
							+"<div class=\"row poi-content\" style=\"display:none;\">"
								+"<span class=\"col-2 span-control ml-5\" >"+SystemEnv.getHtmlNoteName(4573)+"</span>"  //热点个数:
								+"<div class=\"col-m-8\"><input class=\"form-control\" id=\"numpois_"+theId+"\" type=\"text\"/></div>"
							+"</div>"
							+"<div class=\"row\" style=\"display:none;\">"
								+"<span class=\"col-2 span-control\">"+SystemEnv.getHtmlNoteName(4319)+"</span>"  //回调脚本:
								/*+"<textarea class=\"MADFLbs4amap_Text\" id=\"backscript_"+theId+"\" style=\"height: 80px;padding: 2px 4px;\"></textarea>"*/
								+"<div class=\"col-4 click-control\" id=\"scriptdiv_"+theId+"\">"
									+"<input id=\"backscript_"+theId+"\" type=\"hidden\" value=\"\"/>"+SystemEnv.getHtmlNoteName(4574)  //单击
								+"</div>"
							+"</div>"
							+"<div class=\"row\">"
								+"<span class=\"col-2 span-control\">"+SystemEnv.getHtmlNoteName(4531)+"</span>"  //显示类型:
								+"<div class=\"col-m-8\"><select class=\"form-control\" data-autobind id=\"showType_"+theId+"\">"
									+"<option value=\"1\">"+SystemEnv.getHtmlNoteName(4532)+"</option>"  //可编辑
									+"<option value=\"2\">"+SystemEnv.getHtmlNoteName(4533)+"</option>"  //只读
									+"<option value=\"3\">"+SystemEnv.getHtmlNoteName(4534)+"</option>"  //必填
								+"</select></div>"
							+"</div>"
							+"<div class=\"row\">"
								+"<span class=\"col-2 span-control\">"+SystemEnv.getHtmlNoteName(4575)+"</span>"  //当前位置:
								+"<div class=\"col pd-4\"><input type=\"checkbox\" id=\"isShowCurrLocation_"+theId+"\" /><span class=\"font-12 ml-5\">"+SystemEnv.getHtmlNoteName(4576)+"</span></div>"
							+"</div>"
							+"<div class=\"row\">"
								+"<span class=\"col-2 span-control\">"+SystemEnv.getHtmlNoteName(5054)+"</span>"	//定位限制:
								+"<div class=\"col pd-4\"><input type=\"checkbox\" id=\"limitEnabled_"+theId+"\" onclick=\"MADFLbs4amap_ShowLimitContent(this, '"+theId+"');\"/><span class=\"font-12 ml-5\">"+SystemEnv.getHtmlNoteName(5055)+"</span></div>"	//限制在指定点多少米范围内可以定位
							+"</div>"
							+"<div id=\"limitContent_"+theId+"\" style=\"display: none;\">"
							
							+ "<div class=\"row\">"
								+ "<span class=\"col-2 span-control\" style=\"vertical-align: top;\">"+SystemEnv.getHtmlNoteName(5056)+"</span>"	//指定点坐标:
								+ "<div class=\"col-m-8\"><textarea class=\"area-control\" style=\"height:120px;\" id=\"limitPoint_"+theId+"\" placeholder=\""+limitPointTip+"\"></textarea></div>"
							+ "</div>"
							+ "<div class=\"row\">"
								+ "<span class=\"col-2 span-control\">"+SystemEnv.getHtmlNoteName(4842)+"</span>"  //坐标类型:
								+ "<span class=\"col-m-8 multi-checkbox\">"
									+ "<span>"
										+ "<input type=\"checkbox\" name=\"limitCoordinateType_"+theId+"\" value=\"1\"/><span class=\"cbboxLabel\">"+SystemEnv.getHtmlNoteName(4843)+"</span>"  //高德/腾讯
									+ "</span>"
									+ "<span>"
										+ "<input type=\"checkbox\" name=\"limitCoordinateType_"+theId+"\" value=\"2\"/><span class=\"cbboxLabel\">"+SystemEnv.getHtmlNoteName(4844)+"</span>" //百度
									+ "</span>"
									+ "<span>"
										+ "<input type=\"checkbox\" name=\"limitCoordinateType_"+theId+"\" value=\"3\"/><span class=\"cbboxLabel\">GPS</span>" 
									+ "</span>"
								+ "</span>"
							+ "</div>"
							+"<div class=\"row\" style=\"position: relative;\">"
								+"<span class=\"col-2 span-control\">"+SystemEnv.getHtmlNoteName(5058)+"</span>"	//限制范围:
								+"<div class=\"col-m-8\"><input class=\"form-control\" id=\"limitRadius_"+theId+"\" type=\"text\" /></div>"
								+"<div style=\"position: absolute;right: 8px;top: 7px;color: #999;font-size: 13px;\">"+SystemEnv.getHtmlNoteName(5059)+"</div>"	//米
							+"</div>"
							+"<div class=\"row\">"
								+"<span class=\"col-2 span-control\">"+SystemEnv.getHtmlNoteName(5060)+"</span>"	//提示文本:
								+"<div class=\"col-m-8\"><input class=\"form-control\" id=\"limitTip_"+theId+"\" type=\"text\" "+MLanguage.ATTR+"/></div>"
							+"</div>"
							
							+"</div>"
							+"</div>"
							+"<div class=\"bottom\"><div class=\"save-btn\" onclick=\"refreshMecDesign('"+theId+"');\">"+SystemEnv.getHtmlNoteName(3451)+"</div></div>"  //确定
					 +"</div>";
	htm += "<div class=\"MAD_Alert\">"+SystemEnv.getHtmlNoteName(4115)+"</div>";  //已生成到布局
	
	return htm;
};

/*构建属性编辑窗体完成后调用此方法,主要用于一些必须要使用js对页面进行后置操作时,无需要此方法可至空。 不必需的方法,有此方法系统自动调用*/
MEC_NS.FLbs4amap.prototype.afterAttrDlgBuild = function(){
	var theId = this.id;
	var $attrContainer = $("#MADFLbs4amap_" + theId);
	
	var formid =  Mec_FiexdUndefinedVal(this.mecJson["formid"]);// Form mec_id
	var lngFieldname =  Mec_FiexdUndefinedVal(this.mecJson["lngFieldname"]);// 对应字段
	var latFieldname =  Mec_FiexdUndefinedVal(this.mecJson["latFieldname"]);// 对应字段
	var fieldlabel = Mec_FiexdUndefinedVal(this.mecJson["fieldlabel"], "所在位置");// 显示名称
	var savetype = Mec_FiexdUndefinedVal(this.mecJson["savetype"], "1");// 数据保存
	var addressFieldname =  Mec_FiexdUndefinedVal(this.mecJson["addressFieldname"]);// 地址中文名称字段
	var postype = this.mecJson["postype"];// 定位类型
	var btntext = this.mecJson["btntext"];// 按钮名称
	var poiradius = this.mecJson["poiradius"];// poi半径
	var numpois = Mec_FiexdUndefinedVal(this.mecJson["numpois"], "12");// poi数量
	var backscript = this.mecJson["backscript"];// 回调脚本
	if(backscript && backscript != ""){
		backscript = decodeURIComponent(backscript);
	}
	var required = Mec_FiexdUndefinedVal(this.mecJson["required"], "0");// 是否必填
	var readonly = Mec_FiexdUndefinedVal(this.mecJson["readonly"], "0");// 是否只读
	if(required == "1"){
		$("#showType_"+theId).val("3");
	}else if(readonly == "1"){
		$("#showType_"+theId).val("2");
	}else{
		$("#showType_"+theId).val("1");
	}
	
	$("#formid_"+theId).val(formid);
	MADFLbs4amap_FormChange(theId, lngFieldname, latFieldname, addressFieldname);
	MLanguage.setValue($("#fieldlabel_"+theId), fieldlabel);
	$("#savetype_"+theId).val(savetype);
	$("#postype_"+theId).val(postype);
	$("#btntext_"+theId).val(btntext);
	$("#poiradius_"+theId).val(poiradius);
	$("#numpois_"+theId).val(numpois);
	$("#backscript_"+theId).val(backscript);
	
	var isShowCurrLocation = Mec_FiexdUndefinedVal(this.mecJson["isShowCurrLocation"]);
	if(isShowCurrLocation == "1"){
		$("#isShowCurrLocation_"+theId).checked();
	}
	
	MADFLbs4amap_SavetypeChange(theId);
	MADFLbs4amap_changePosType(theId);
	
	$("#scriptdiv_"+theId).click(function(){
		SL_AddScriptToField($("#backscript_"+theId));
	});
	
	var limitEnabled = Mec_FiexdUndefinedVal(this.mecJson["limitEnabled"], "0");
	if(limitEnabled == "1"){
		$("#limitEnabled_"+theId).checked();
		$("#limitContent_"+theId).show();
	}
	$("#limitPoint_"+theId).val(Mec_FiexdUndefinedVal(this.mecJson["limitPoint"]));
	
	var limitCoordinateType = Mec_FiexdUndefinedVal(this.mecJson["limitCoordinateType"], "2");
	var $limitCoordinateType = $("input[type='checkbox'][name='limitCoordinateType_"+theId+"'][value='"+limitCoordinateType+"']");
	if($limitCoordinateType.length > 0){
		$limitCoordinateType.checked();
	}
	
	$("#limitRadius_"+theId).val(Mec_FiexdUndefinedVal(this.mecJson["limitRadius"], "1000"));
	
	MLanguage.setValue($("#limitTip_"+theId), Mec_FiexdUndefinedVal(this.mecJson["limitTip"]));
	
	$("#MADFLbs4amap_"+theId).checkbox();
	$('#formid_' + theId, $attrContainer).on("select2:opening.formbefore", function () {
		var $this = $(this);
		var value = $this.val();
		$(this).html(Mec_GetFormOptionHtml()).val(value);
	});
};

//表单类控件更新所属表单相关信息的函数,当表单delete或change时触发
MEC_NS.FLbs4amap.prototype.updateFormWithInfo = function (eventType) {
	var theId = this.id;

	if (eventType === 'delete') {
		$('#formid_' + theId).empty();
		$('#lngFieldname_' + theId).empty();
		$('#latFieldname_' + theId).empty();
		$('#addressFieldname_' + theId).empty();
	} else {
		MADFLbs4amap_FormChange(theId);
	}
}

MEC_NS.FLbs4amap.prototype.updateMecJsonByForm = function () {
	this.mecJson['lngFieldname'] = '';
	this.mecJson['latFieldname'] = '';
	this.mecJson['addressFieldname'] = '';
}

/*获取JSON*/
MEC_NS.FLbs4amap.prototype.getMecJson = function(){
	var theId = this.id;
	
	this.mecJson["id"] = theId;
	this.mecJson["mectype"] = this.type;
	
	var $attrContainer = $("#MADFLbs4amap_"+theId);
	if($attrContainer.length > 0){
		var formid = Mec_FiexdUndefinedVal($("#formid_"+theId).val());
		var lngFieldname = Mec_FiexdUndefinedVal($("#lngFieldname_"+theId).val());
		var latFieldname = Mec_FiexdUndefinedVal($("#latFieldname_"+theId).val());
		var fieldlabel = MLanguage.getValue($("#fieldlabel_"+theId));
		var savetype = Mec_FiexdUndefinedVal($("#savetype_"+theId).val());
		var addressFieldname = Mec_FiexdUndefinedVal($("#addressFieldname_"+theId).val());
		var postype = Mec_FiexdUndefinedVal($("#postype_"+theId).val());
		var btntext = Mec_FiexdUndefinedVal($("#btntext_"+theId).val());
		var poiradius = Mec_FiexdUndefinedVal($("#poiradius_"+theId).val());
		var numpois = Mec_FiexdUndefinedVal($("#numpois_"+theId).val());
		var backscript = Mec_FiexdUndefinedVal($("#backscript_"+theId).val());
		backscript = encodeURIComponent(backscript);
		
		//检查字段是否设置
		var fieldname = !!lngFieldname && !!latFieldname;
		if(savetype == "2"){
            fieldname = !!addressFieldname;
        }else if(savetype == "3"){
            fieldname = fieldname && !!addressFieldname;
        }
		this.mecJson["fieldname"] = fieldname;
		
		var showType = $("#showType_"+theId).val();
		this.mecJson["formid"] = formid;
		this.mecJson["lngFieldname"] = lngFieldname;
		this.mecJson["latFieldname"] = latFieldname;
		this.mecJson["fieldlabel"] = fieldlabel;
		this.mecJson["savetype"] = savetype;
		this.mecJson["addressFieldname"] = addressFieldname;
		this.mecJson["postype"] = postype;
		this.mecJson["btntext"] = btntext;
		this.mecJson["poiradius"] = poiradius;
		this.mecJson["numpois"] = numpois;
		this.mecJson["backscript"] = backscript;
		this.mecJson["isShowCurrLocation"] = $("#isShowCurrLocation_"+theId).is(':checked') ? "1" : "0";
		if(showType == "1"){
			this.mecJson["required"] = "0";
			this.mecJson["readonly"] = "0";
		}else if(showType == "2"){
			this.mecJson["required"] = "0";
			this.mecJson["readonly"] = "1";
		}else{
			this.mecJson["required"] = "1";
			this.mecJson["readonly"] = "0";
		}
		
		this.mecJson["limitEnabled"] = $("#limitEnabled_"+theId).is(':checked') ? "1" : "0";
		this.mecJson["limitPoint"] = $("#limitPoint_"+theId).val();
		this.mecJson["limitCoordinateType"] = $("input[type='checkbox'][name='limitCoordinateType_"+theId+"']:checked").val();
		this.mecJson["limitRadius"] = $("#limitRadius_"+theId).val();
		this.mecJson["limitTip"] = MLanguage.getValue($("#limitTip_"+theId));
	}
	return this.mecJson;
};

MEC_NS.FLbs4amap.prototype.getDefaultMecJson = function(){
	var theId = this.id;
	
	var defMecJson = {};
	defMecJson["id"] = theId;
	defMecJson["fieldlabel"] = SystemEnv.getHtmlNoteName( 4941 );//所在位置
	defMecJson["savetype"] = "1";
	defMecJson["postype"] = "1";
    defMecJson["latFieldname"] = "";
    defMecJson["lngFieldname"] = "";
    defMecJson["addressFieldname"] = "";
	defMecJson["btntext"] = SystemEnv.getHtmlNoteName(3451);  //确定
	defMecJson["poiradius"] = "500";
	defMecJson["numpois"] = "12";
	defMecJson["limitEnabled"] = "0";
	defMecJson["limitPoint"] = "";
	defMecJson["limitCoordinateType"] = "1";
	defMecJson["limitRadius"] = "1000";
	defMecJson["limitTip"] = SystemEnv.getHtmlNoteName(5261);  //当前位置超出限制范围
	return defMecJson;
};

MEC_NS.FLbs4amap.prototype.validate = function () {
	var mecJson = this.mecJson;
	var savetype = mecJson.savetype;
	var latFieldname = mecJson.latFieldname;
	var lngFieldname = mecJson.lngFieldname;
	var addressFieldname = mecJson.addressFieldname;
	var isValid = ((savetype == '1' && latFieldname && lngFieldname) ||
		(savetype == '2' && addressFieldname) ||
		(savetype == '3' && latFieldname && lngFieldname && addressFieldname));
	var mec_id = this.id;
	var $pluginAttr = $('#MAD_' + mec_id);

	if(isValid){
		return true;
	}else{
		switch (savetype) {
			case '1':
				!latFieldname && $pluginAttr.find('#latFieldname_' + mec_id).parents('.col-m-8').validate({
					value: latFieldname,
					rules: [{
						msg: '"' + SystemEnv.getHtmlNoteName(5460).replace(/[\:\:]/g, '') + '" ' + SystemEnv.getHtmlNoteName(6041) // 经度字段
					}]
				});
				!lngFieldname && $pluginAttr.find('#lngFieldname_' + mec_id).parents('.col-m-8').validate({
					value: lngFieldname,
					rules: [{
						msg: '"' + SystemEnv.getHtmlNoteName(5459).replace(/[\:\:]/g, '') + '" ' + SystemEnv.getHtmlNoteName(6041) // 纬度字段
					}]
				});
				break;
			case '2':
				!addressFieldname && $pluginAttr.find('#addressFieldname_' + mec_id).parents('.col-m-8').validate({
					value: addressFieldname,
					rules: [{
						msg: '"' + SystemEnv.getHtmlNoteName(5053).replace(/[\:\:]/g, '') + '" ' + SystemEnv.getHtmlNoteName(6041) // 中文字段
					}]
				});
				break;
			case '3':
				!latFieldname && $pluginAttr.find('#latFieldname_' + mec_id).parents('.col-m-8').validate({
					value: latFieldname,
					rules: [{
						msg: '"' + SystemEnv.getHtmlNoteName(5460).replace(/[\:\:]/g, '') + '" ' + SystemEnv.getHtmlNoteName(6041) // 经度字段
					}]
				});
				!lngFieldname && $pluginAttr.find('#lngFieldname_' + mec_id).parents('.col-m-8').validate({
					value: lngFieldname,
					rules: [{
						msg: '"' + SystemEnv.getHtmlNoteName(5459).replace(/[\:\:]/g, '') + '" ' + SystemEnv.getHtmlNoteName(6041) // 纬度字段
					}]
				});
				!addressFieldname && $pluginAttr.find('#addressFieldname_' + mec_id).parents('.col-m-8').validate({
					value: addressFieldname,
					rules: [{
						msg: '"' + SystemEnv.getHtmlNoteName(5053).replace(/[\:\:]/g, '') + '" ' + SystemEnv.getHtmlNoteName(6041) // 中文字段
					}]
				});
				break;
		}
		return !!isValid;
	}
}

function MADFLbs4amap_FormChange(mec_id, selectedLngField, selectedLatField, selectedAddressField){
	var formidObj = $("#formid_"+mec_id);
	var formid = formidObj.val();
	Mec_GetFieldOptionHtml(formid, "lngFieldname_"+mec_id, selectedLngField);
	Mec_GetFieldOptionHtml(formid, "latFieldname_"+mec_id, selectedLatField);
	Mec_GetFieldOptionHtml(formid, "addressFieldname_"+mec_id, selectedAddressField);
}

function MADFLbs4amap_SavetypeChange(mec_id){
	var $Entry = $("#MADFLbs4amap_" + mec_id);
	
	var savetype = $("#savetype_" + mec_id, $Entry).val();
	if(savetype == "1"){
		$("#MADFLbs4amap_Address_"+mec_id, $Entry).hide();
		$("#MADFLbs4amap_LngLat_"+mec_id, $Entry).show();
	}else if(savetype == "2"){
	    $("#MADFLbs4amap_Address_"+mec_id, $Entry).show();
        $("#MADFLbs4amap_LngLat_"+mec_id, $Entry).hide();
	}else if(savetype == "3"){
	    $("#MADFLbs4amap_Address_"+mec_id, $Entry).show();
        $("#MADFLbs4amap_LngLat_"+mec_id, $Entry).show();
	}
}

function MADFLbs4amap_ShowLimitContent(cbObj, mec_id){
	setTimeout(function(){	//checkbox用了插件,不延时checkbox的checked状态获取不准确
		if(cbObj.checked){
			var locationType = $("#postype_" + mec_id).val();
			if(locationType === '3'){
				$(cbObj).removeAttr("checked");
				alert(SystemEnv.getHtmlNoteName(5243));//当定位类型为允许改变位置时,无法设定定位限制!
			}else{
				$("#limitContent_"+mec_id).show();
			}
		}else{
			$("#limitContent_"+mec_id).hide();
		}
	},100);
}

function MADFLbs4amap_changePosType(mec_id){
	var v = $("#postype_" + mec_id).val();
	var $attrContainer = $("#MADFLbs4amap_"+mec_id);
	if(v == "1"){
		$(".poi-content", $attrContainer).hide();
	}else{
		$(".poi-content", $attrContainer).show();
		if(v == '3'){
			var $limit = $('#limitEnabled_'+mec_id);
			setTimeout(function(){	//checkbox用了插件,不延时checkbox的checked状态获取不准确
				if($limit[0].checked){
					$limit.removeAttr("checked");
					MADFLbs4amap_ShowLimitContent($limit[0],mec_id);
					alert(SystemEnv.getHtmlNoteName(5243));//当定位类型为允许改变位置时,无法设定定位限制!
				}
			},100);
		}
	}
}