开发区省市区改为下拉框
This commit is contained in:
+29
-5
@@ -33,9 +33,9 @@ public class DevelopmentZoneController {
|
||||
if (pager.getCurrentPage() > 100) {
|
||||
pager.setCurrentPage(1);
|
||||
}
|
||||
long countDev = developmentZoneService.countDev(model.getProvince(),model.getName(), model.getLevel());
|
||||
long countDev = developmentZoneService.countDev(model.getProvince(), model.getName(), model.getLevel());
|
||||
pager.setTotalRows((int) countDev);
|
||||
List<DevelopmentZone> developmentZones = developmentZoneService.findDevelopmentZone(model.getProvince(),model.getName(), model.getLevel(), pager);
|
||||
List<DevelopmentZone> developmentZones = developmentZoneService.findDevelopmentZone(model.getProvince(), model.getName(), model.getLevel(), pager);
|
||||
model.setDevelopmentZoneList(developmentZones);
|
||||
model.setPager(pager);
|
||||
return model;
|
||||
@@ -113,7 +113,7 @@ public class DevelopmentZoneController {
|
||||
}
|
||||
|
||||
entity.setLevel(model.getLevel());
|
||||
String aliasString = model.getAlias().replaceAll(",",",");
|
||||
String aliasString = model.getAlias().replaceAll(",", ",");
|
||||
List<String> alias = Arrays.asList(aliasString.split("\\s*,\\s*"));
|
||||
entity.setAlias(alias);
|
||||
entity.setAddress(StringUtils.isBlank(model.getAddress()) ? "" : model.getAddress());
|
||||
@@ -126,6 +126,7 @@ public class DevelopmentZoneController {
|
||||
entity.setType(StringUtils.isBlank(model.getType()) ? "" : model.getType());
|
||||
entity.setUrl(StringUtils.isBlank(model.getUrl()) ? "" : model.getUrl());
|
||||
entity.setCityName(StringUtils.isBlank(model.getCityName()) ? "" : model.getCityName());
|
||||
entity.setDistrict(StringUtils.isBlank(model.getDistrict()) ? "" : model.getDistrict());
|
||||
//记录操作人员
|
||||
entity.setOperator(user.getRealName());
|
||||
developmentZoneService.saveDevelopmentZone(entity);
|
||||
@@ -168,8 +169,8 @@ public class DevelopmentZoneController {
|
||||
shape.put("coordinates", coordinates);
|
||||
udata.put("shape", shape);
|
||||
}
|
||||
if (StringUtils.isNotBlank(model.getAlias()) ){
|
||||
String aliasString = model.getAlias().replaceAll(",",",");
|
||||
if (StringUtils.isNotBlank(model.getAlias())) {
|
||||
String aliasString = model.getAlias().replaceAll(",", ",");
|
||||
List<String> alias = Arrays.asList(aliasString.split("\\s*,\\s*"));
|
||||
udata.put("alias", alias);
|
||||
}
|
||||
@@ -200,6 +201,9 @@ public class DevelopmentZoneController {
|
||||
if (StringUtils.isNotBlank(model.getCityName())) {
|
||||
udata.put("cityName", model.getCityName());
|
||||
}
|
||||
if (StringUtils.isNotBlank(model.getDistrict())){
|
||||
udata.put("district", model.getDistrict());
|
||||
}
|
||||
udata.put("createTime", new Date());
|
||||
//记录操作人员
|
||||
udata.put("operator", user.getRealName());
|
||||
@@ -210,6 +214,26 @@ public class DevelopmentZoneController {
|
||||
return ret;
|
||||
}
|
||||
|
||||
public JsonModel provincesAction() {
|
||||
JsonModel model = new JsonModel();
|
||||
List<String> provinces = developmentZoneService.findProvinces();
|
||||
model.setJsonModel(provinces);
|
||||
return model;
|
||||
}
|
||||
|
||||
public JsonModel citiesAction(DevelopmentZoneModel model) {
|
||||
JsonModel jsonModel = new JsonModel();
|
||||
List<String> cities = developmentZoneService.findCities(model.getProvince());
|
||||
jsonModel.setJsonModel(cities);
|
||||
return jsonModel;
|
||||
}
|
||||
|
||||
public JsonModel districtsAction(DevelopmentZoneModel model) {
|
||||
JsonModel jsonModel = new JsonModel();
|
||||
List<String> districts = developmentZoneService.findDistricts(model.getCityName());
|
||||
jsonModel.setJsonModel(districts);
|
||||
return jsonModel;
|
||||
}
|
||||
|
||||
public void setDevelopmentZoneService(DevelopmentZoneService developmentZoneService) {
|
||||
this.developmentZoneService = developmentZoneService;
|
||||
|
||||
@@ -1,218 +1,334 @@
|
||||
<#ftl attributes={"content_type":"text/html; charset=UTF-8"}>
|
||||
<#compress>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xmlns="http://www.w3.org/1999/html">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>开发区围栏列表</title>
|
||||
<link rel="stylesheet" type="text/css" href="../style/main.css?v=${version}" />
|
||||
<script type="text/javascript" src="../js/My97DatePicker/WdatePicker.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<#include "/common_js.ftl" />
|
||||
<#include "/layout/header.ftl" />
|
||||
<div class="main-content">
|
||||
<div class="menuButton">
|
||||
<a href="../developmentZone/list" class="list">开发区列表</a>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xmlns="http://www.w3.org/1999/html">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
||||
<title>开发区围栏列表</title>
|
||||
<link rel="stylesheet" type="text/css" href="../style/main.css?v=${version}"/>
|
||||
<script type="text/javascript" src="../js/My97DatePicker/WdatePicker.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<#include "/common_js.ftl" />
|
||||
<#include "/layout/header.ftl" />
|
||||
<div class="main-content">
|
||||
<div class="menuButton">
|
||||
<a href="../developmentZone/list" class="list">开发区列表</a>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<form id="form1">
|
||||
<#if developmentZone??>
|
||||
<input id="id" name="id" type="hidden" value="${developmentZone.id!}"/>
|
||||
</#if>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<@d_city defaultValue="" callback="changeCity" callbackField="display" name="cityDisplay" />
|
||||
</td>
|
||||
<td>
|
||||
<label for="province">所在省份:</label>
|
||||
<select id="province" name="province" onchange="updateCityAndDistrict()">
|
||||
<#if province??>
|
||||
<option value="${province}">${province}</option>
|
||||
<#else>
|
||||
<option value="">请选择省份</option>
|
||||
</#if>
|
||||
</select>
|
||||
|
||||
<label for="cityName">城市:</label>
|
||||
<select id="cityName" name="cityName" onchange="updateDistrict()">
|
||||
<!-- Options for cities will be populated by JavaScript -->
|
||||
</select>
|
||||
<label for="district">区域:</label>
|
||||
<select id="district" name="district">
|
||||
<!-- Options for districts will be populated by JavaScript -->
|
||||
</select>
|
||||
<label for="name">开发区名称:</label> <input id="name" name="name" type="text"
|
||||
placeholder="必填"
|
||||
value="<#if developmentZone??>${developmentZone.name!}</#if>"/>
|
||||
<label for="alias">别名:</label>
|
||||
<input id="alias" name="alias" type="text" placeholder="多个别名用,隔开"
|
||||
value="<#if developmentZone??><#list (developmentZone.alias)! as alia>${alia + ','}</#list><#else></#if>"/>
|
||||
<label for="nameEn">开发区名称拼音:</label> <input id="nameEn" name="nameEn" type="text"
|
||||
value="<#if developmentZone??>${developmentZone.nameEn!}</#if>"/>
|
||||
</br>
|
||||
<label for="level">级别:</label> <input id="level" name="level" type="text"
|
||||
placeholder="必填"
|
||||
value="<#if developmentZone??>${developmentZone.level!}</#if>"/>
|
||||
<label for="address">地址:</label> <input id="address" name="address" type="text"
|
||||
value="<#if developmentZone??>${developmentZone.address!}</#if>"/><br>
|
||||
<label for="area">所在地区:</label> <input id="area" name="area" type="text"
|
||||
value="<#if developmentZone??>${developmentZone.area!}</#if>"/>
|
||||
<label for="buildDate">建立年代:</label><input id="buildDate" name="buildDate" type="text"
|
||||
value="<#if developmentZone??>${developmentZone.buildDate!}</#if>"/>
|
||||
<label for="type">类型:</label><input id="type" name="type" type="text"
|
||||
value="<#if developmentZone??>${developmentZone.type!}</#if>"/>
|
||||
<label for="url">URL:</label><input id="url" name="url" type="text"
|
||||
value="<#if developmentZone??>${developmentZone.url!}</#if>"/><br>
|
||||
<label for="industry">主导产业:</label><input id="industry" name="industry" type="text"
|
||||
value="<#if developmentZone??>${developmentZone.industry!}</#if>"/>
|
||||
<label for="block">区块:</label><input id="block" name="block" type="text"
|
||||
value="<#if developmentZone??>${developmentZone.block!}</#if>"/><br/>
|
||||
<input id="saveOrUpdate" type="button" value="提交"/>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<input name="bdShape" id="bdShape" type="hidden"/>
|
||||
<div id="allmap" style="width:100%;height:900px;"></div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
fetchProvinces();
|
||||
|
||||
<div>
|
||||
<form id="form1">
|
||||
<#if developmentZone??>
|
||||
<input id="id" name="id" type="hidden" value="${developmentZone.id!}"/>
|
||||
</#if>
|
||||
$('#province').change(function () {
|
||||
updateCityAndDistrict();
|
||||
});
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<#if developmentZone??>
|
||||
<@d_city defaultValue="${developmentZone.cityName!}" callback="changeCity" callbackField="display" name="cityDisplay" />
|
||||
<#else>
|
||||
<@d_city defaultValue="上海" callback="changeCity" callbackField="display" name="cityDisplay" />
|
||||
</#if>
|
||||
</td>
|
||||
<td>
|
||||
<label for="name">开发区名称:</label> <input id="name" name="name" type="text" placeholder="必填" value="<#if developmentZone??>${developmentZone.name!}</#if>"/>
|
||||
<label for="alias">别名:</label>
|
||||
<input id="alias" name="alias" type="text" placeholder="多个别名用,隔开" value="<#if developmentZone??><#list (developmentZone.alias)! as alia>${alia + ','}</#list><#else></#if>"/>
|
||||
<label for="nameEn">开发区名称拼音:</label> <input id="nameEn" name="nameEn" type="text" value="<#if developmentZone??>${developmentZone.nameEn!}</#if>"/>
|
||||
<label for="province">所在省份:</label> <input id="province" name="province" type="text" placeholder="必填" value="<#if developmentZone??>${developmentZone.province!}</#if>"/><br>
|
||||
<label for="cityName">城市:</label><input id="cityName" name="cityName" type="text" value="<#if developmentZone??>${developmentZone.cityName!}</#if>"/>
|
||||
<label for="district">区域:</label><input id="district" name="district" type="text" value="<#if developmentZone??>${developmentZone.district!}</#if>"/>
|
||||
<label for="level">级别:</label> <input id="level" name="level" type="text" placeholder="必填" value="<#if developmentZone??>${developmentZone.level!}</#if>"/>
|
||||
<label for="address">地址:</label> <input id="address" name="address" type="text" value="<#if developmentZone??>${developmentZone.address!}</#if>"/><br>
|
||||
<label for="area">所在地区:</label> <input id="area" name="area" type="text" value="<#if developmentZone??>${developmentZone.area!}</#if>"/>
|
||||
<label for="buildDate">建立年代:</label><input id="buildDate" name="buildDate" type="text" value="<#if developmentZone??>${developmentZone.buildDate!}</#if>"/>
|
||||
<label for="type">类型:</label><input id="type" name="type" type="text" value="<#if developmentZone??>${developmentZone.type!}</#if>"/>
|
||||
<label for="url">URL:</label><input id="url" name="url" type="text" value="<#if developmentZone??>${developmentZone.url!}</#if>"/><br>
|
||||
<label for="industry">主导产业:</label><input id="industry" name="industry" type="text" value="<#if developmentZone??>${developmentZone.industry!}</#if>"/>
|
||||
<label for="block">区块:</label><input id="block" name="block" type="text" value="<#if developmentZone??>${developmentZone.block!}</#if>"/><br/>
|
||||
<input id="saveOrUpdate" type="button" value="提交"/>
|
||||
</td>
|
||||
$('#cityName').change(function () {
|
||||
updateDistrict();
|
||||
});
|
||||
});
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<input name="bdShape" id="bdShape" type="hidden"/>
|
||||
<div id="allmap" style="width:100%;height:900px;"></div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript" src="https://api.map.baidu.com/api?v=2.0&ak=3E63A744012f88c9a73a2f051aece58b"></script>
|
||||
<!--加载鼠标绘制工具-->
|
||||
<script type="text/javascript" src="https://api.map.baidu.com/library/DrawingManager/1.4/src/DrawingManager_min.js"></script>
|
||||
<link rel="stylesheet" href="https://api.map.baidu.com/library/DrawingManager/1.4/src/DrawingManager_min.css" />
|
||||
<!--加载检索信息窗口-->
|
||||
<script type="text/javascript" src="https://api.map.baidu.com/library/SearchInfoWindow/1.4/src/SearchInfoWindow_min.js"></script>
|
||||
<link rel="stylesheet" href="https://api.map.baidu.com/library/SearchInfoWindow/1.4/src/SearchInfoWindow_min.css" />
|
||||
|
||||
<script type="application/javascript">
|
||||
var map = new BMap.Map("allmap"); // 创建Map实例
|
||||
if($("#cityDisplay").val()) {
|
||||
map.centerAndZoom($("#cityDisplay").val(), 13);
|
||||
}else {
|
||||
map.centerAndZoom('上海', 13);
|
||||
}
|
||||
map.enableScrollWheelZoom(true);
|
||||
|
||||
function changeCity(display){
|
||||
clearAll();
|
||||
map.centerAndZoom(display, 13);
|
||||
}
|
||||
|
||||
var overlays = [];
|
||||
var overlaycomplete = function(e){
|
||||
overlays.push(e.overlay);
|
||||
var points = e.overlay.getPath();
|
||||
|
||||
var bdShape = [];
|
||||
for(var i=0;i<points.length;i++) {
|
||||
var location = [];
|
||||
location.push(points[i].lng );
|
||||
location.push(points[i].lat );
|
||||
bdShape.push(location);
|
||||
}
|
||||
$("#bdShape").val(bdShape.join(";"));
|
||||
// 在创建多边形后立即启用编辑
|
||||
e.overlay.enableEditing();
|
||||
};
|
||||
|
||||
var styleOptions = {
|
||||
strokeColor:"red", //边线颜色。
|
||||
fillColor:"red", //填充颜色。当参数为空时,圆形将没有填充效果。
|
||||
strokeWeight: 1, //边线的宽度,以像素为单位。
|
||||
strokeOpacity: 0.8, //边线透明度,取值范围0 - 1。
|
||||
fillOpacity: 0.6, //填充的透明度,取值范围0 - 1。
|
||||
strokeStyle: 'solid' //边线的样式,solid或dashed。
|
||||
}
|
||||
//实例化鼠标绘制工具
|
||||
var drawingManager = new BMapLib.DrawingManager(map, {
|
||||
isOpen: true, //是否开启绘制模式
|
||||
enableDrawingTool: true, //是否显示工具栏
|
||||
drawingToolOptions: {
|
||||
anchor: BMAP_ANCHOR_TOP_RIGHT, //位置
|
||||
offset: new BMap.Size(5, 5), //偏离值
|
||||
},
|
||||
circleOptions: styleOptions, //圆的样式
|
||||
polylineOptions: styleOptions, //线的样式
|
||||
polygonOptions: styleOptions, //多边形的样式
|
||||
rectangleOptions: styleOptions //矩形的样式
|
||||
});
|
||||
//添加鼠标绘制工具监听事件,用于获取绘制结果
|
||||
drawingManager.addEventListener('overlaycomplete', overlaycomplete);
|
||||
function clearAll() {
|
||||
for(var i = 0; i < overlays.length; i++){
|
||||
map.removeOverlay(overlays[i]);
|
||||
}
|
||||
overlays.length = 0;
|
||||
}
|
||||
|
||||
// 添加点击覆盖物事件监听器
|
||||
map.addEventListener("click", function(e) {
|
||||
// 判断点击的是否是已存在的覆盖物
|
||||
if (e.overlay) {
|
||||
// 如果是多边形或折线,则可以编辑
|
||||
if (e.overlay instanceof BMap.Polygon || e.overlay instanceof BMap.Polyline) {
|
||||
// 开启覆盖物编辑功能
|
||||
e.overlay.enableEditing();
|
||||
}
|
||||
// 如果是标记点,则可以拖动
|
||||
else if (e.overlay instanceof BMap.Marker) {
|
||||
// 开启标记点拖动功能
|
||||
e.overlay.enableDragging();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// 添加覆盖物编辑完成事件监听器
|
||||
map.addEventListener("overlaycomplete", function(e) {
|
||||
// 判断新增的覆盖物是否是多边形或折线
|
||||
if (e.overlay instanceof BMap.Polygon || e.overlay instanceof BMap.Polyline) {
|
||||
// 添加覆盖物编辑完成事件监听器
|
||||
e.overlay.addEventListener("lineupdate", function() {
|
||||
// 编辑完成后获取更新后的路径点,并更新表单中的数据
|
||||
var points = e.overlay.getPath();
|
||||
var bdShape = [];
|
||||
for (var i = 0; i < points.length; i++) {
|
||||
var location = [];
|
||||
location.push(points[i].lng);
|
||||
location.push(points[i].lat);
|
||||
bdShape.push(location);
|
||||
function fetchProvinces() {
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '../developmentZone/provinces',
|
||||
dataType: 'json',
|
||||
success: function (data) {
|
||||
let provinceSelect = $('#province');
|
||||
provinceSelect.empty();
|
||||
provinceSelect.append('<option value="">请选择省份</option>');
|
||||
$.each(data, function (index, province) {
|
||||
provinceSelect.append('<option value="' + province + '">' + province + '</option>');
|
||||
});
|
||||
},
|
||||
error: function () {
|
||||
// 处理错误
|
||||
}
|
||||
$("#bdShape").val(bdShape.join(";"));
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$("#saveOrUpdate").click(function(){
|
||||
// 更新表单中的点位置数据
|
||||
updatePolygonPoints();
|
||||
function updateCityAndDistrict() {
|
||||
let province = $('#province').val();
|
||||
let citySelect = $('#cityName');
|
||||
let districtSelect = $('#district');
|
||||
|
||||
jQuery.ajax({
|
||||
type: 'POST',
|
||||
url: '../developmentZone/saveOrUpdate',
|
||||
data: $("#form1").serialize(),
|
||||
dataType: 'json',
|
||||
timeout: 100000,
|
||||
success: function(data) {
|
||||
alert(data.msg);
|
||||
location.href="list";
|
||||
citySelect.empty();
|
||||
districtSelect.empty();
|
||||
citySelect.append('<option value="">请选择城市</option>');
|
||||
districtSelect.append('<option value="">请选择区域</option>');
|
||||
|
||||
if (province) {
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '../developmentZone/cities',
|
||||
data: {province: province},
|
||||
dataType: 'json',
|
||||
success: function (data) {
|
||||
$.each(data, function (index, city) {
|
||||
citySelect.append('<option value="' + city + '">' + city + '</option>');
|
||||
});
|
||||
},
|
||||
error: function () {
|
||||
// 处理错误
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function updateDistrict() {
|
||||
let cityName = $('#cityName').val();
|
||||
let districtSelect = $('#district');
|
||||
|
||||
districtSelect.empty();
|
||||
districtSelect.append('<option value="">请选择区域</option>');
|
||||
|
||||
if (cityName) {
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '../developmentZone/districts',
|
||||
data: {cityName: cityName},
|
||||
dataType: 'json',
|
||||
success: function (data) {
|
||||
$.each(data, function (index, district) {
|
||||
districtSelect.append('<option value="' + district + '">' + district + '</option>');
|
||||
});
|
||||
},
|
||||
error: function () {
|
||||
// 处理错误
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<script type="text/javascript"
|
||||
src="https://api.map.baidu.com/api?v=2.0&ak=3E63A744012f88c9a73a2f051aece58b"></script>
|
||||
<!--加载鼠标绘制工具-->
|
||||
<script type="text/javascript"
|
||||
src="https://api.map.baidu.com/library/DrawingManager/1.4/src/DrawingManager_min.js"></script>
|
||||
<link rel="stylesheet" href="https://api.map.baidu.com/library/DrawingManager/1.4/src/DrawingManager_min.css"/>
|
||||
<!--加载检索信息窗口-->
|
||||
<script type="text/javascript"
|
||||
src="https://api.map.baidu.com/library/SearchInfoWindow/1.4/src/SearchInfoWindow_min.js"></script>
|
||||
<link rel="stylesheet" href="https://api.map.baidu.com/library/SearchInfoWindow/1.4/src/SearchInfoWindow_min.css"/>
|
||||
|
||||
<script type="application/javascript">
|
||||
var map = new BMap.Map("allmap"); // 创建Map实例
|
||||
if ($("#cityDisplay").val()) {
|
||||
map.centerAndZoom($("#cityDisplay").val(), 13);
|
||||
} else {
|
||||
map.centerAndZoom('上海', 13);
|
||||
}
|
||||
map.enableScrollWheelZoom(true);
|
||||
|
||||
function changeCity(display) {
|
||||
clearAll();
|
||||
map.centerAndZoom(display, 13);
|
||||
}
|
||||
|
||||
var overlays = [];
|
||||
var overlaycomplete = function (e) {
|
||||
overlays.push(e.overlay);
|
||||
var points = e.overlay.getPath();
|
||||
|
||||
var bdShape = [];
|
||||
for (var i = 0; i < points.length; i++) {
|
||||
var location = [];
|
||||
location.push(points[i].lng);
|
||||
location.push(points[i].lat);
|
||||
bdShape.push(location);
|
||||
}
|
||||
$("#bdShape").val(bdShape.join(";"));
|
||||
// 在创建多边形后立即启用编辑
|
||||
e.overlay.enableEditing();
|
||||
};
|
||||
|
||||
var styleOptions = {
|
||||
strokeColor: "red", //边线颜色。
|
||||
fillColor: "red", //填充颜色。当参数为空时,圆形将没有填充效果。
|
||||
strokeWeight: 1, //边线的宽度,以像素为单位。
|
||||
strokeOpacity: 0.8, //边线透明度,取值范围0 - 1。
|
||||
fillOpacity: 0.6, //填充的透明度,取值范围0 - 1。
|
||||
strokeStyle: 'solid' //边线的样式,solid或dashed。
|
||||
}
|
||||
//实例化鼠标绘制工具
|
||||
var drawingManager = new BMapLib.DrawingManager(map, {
|
||||
isOpen: true, //是否开启绘制模式
|
||||
enableDrawingTool: true, //是否显示工具栏
|
||||
drawingToolOptions: {
|
||||
anchor: BMAP_ANCHOR_TOP_RIGHT, //位置
|
||||
offset: new BMap.Size(5, 5), //偏离值
|
||||
},
|
||||
error : function() {
|
||||
circleOptions: styleOptions, //圆的样式
|
||||
polylineOptions: styleOptions, //线的样式
|
||||
polygonOptions: styleOptions, //多边形的样式
|
||||
rectangleOptions: styleOptions //矩形的样式
|
||||
});
|
||||
//添加鼠标绘制工具监听事件,用于获取绘制结果
|
||||
drawingManager.addEventListener('overlaycomplete', overlaycomplete);
|
||||
|
||||
function clearAll() {
|
||||
for (var i = 0; i < overlays.length; i++) {
|
||||
map.removeOverlay(overlays[i]);
|
||||
}
|
||||
overlays.length = 0;
|
||||
}
|
||||
|
||||
// 添加点击覆盖物事件监听器
|
||||
map.addEventListener("click", function (e) {
|
||||
// 判断点击的是否是已存在的覆盖物
|
||||
if (e.overlay) {
|
||||
// 如果是多边形或折线,则可以编辑
|
||||
if (e.overlay instanceof BMap.Polygon || e.overlay instanceof BMap.Polyline) {
|
||||
// 开启覆盖物编辑功能
|
||||
e.overlay.enableEditing();
|
||||
}
|
||||
// 如果是标记点,则可以拖动
|
||||
else if (e.overlay instanceof BMap.Marker) {
|
||||
// 开启标记点拖动功能
|
||||
e.overlay.enableDragging();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
// 添加覆盖物编辑完成事件监听器
|
||||
map.addEventListener("overlaycomplete", function (e) {
|
||||
// 判断新增的覆盖物是否是多边形或折线
|
||||
if (e.overlay instanceof BMap.Polygon || e.overlay instanceof BMap.Polyline) {
|
||||
// 添加覆盖物编辑完成事件监听器
|
||||
e.overlay.addEventListener("lineupdate", function () {
|
||||
// 编辑完成后获取更新后的路径点,并更新表单中的数据
|
||||
var points = e.overlay.getPath();
|
||||
var bdShape = [];
|
||||
for (var i = 0; i < points.length; i++) {
|
||||
var location = [];
|
||||
location.push(points[i].lng);
|
||||
location.push(points[i].lat);
|
||||
bdShape.push(location);
|
||||
}
|
||||
$("#bdShape").val(bdShape.join(";"));
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// 更新表单中的多边形点位置数据
|
||||
function updatePolygonPoints() {
|
||||
var polygons = map.getOverlays(BMap.Polygon);
|
||||
for (var i = 0; i < polygons.length; i++) {
|
||||
// 确保当前对象是一个多边形对象
|
||||
if (polygons[i] instanceof BMap.Polygon) {
|
||||
var points = polygons[i].getPath();
|
||||
var bdShape = [];
|
||||
for (var j = 0; j < points.length; j++) {
|
||||
var location = [];
|
||||
location.push(points[j].lng);
|
||||
location.push(points[j].lat);
|
||||
bdShape.push(location);
|
||||
$("#saveOrUpdate").click(function () {
|
||||
// 更新表单中的点位置数据
|
||||
updatePolygonPoints();
|
||||
|
||||
jQuery.ajax({
|
||||
type: 'POST',
|
||||
url: '../developmentZone/saveOrUpdate',
|
||||
data: $("#form1").serialize(),
|
||||
dataType: 'json',
|
||||
timeout: 100000,
|
||||
success: function (data) {
|
||||
alert(data.msg);
|
||||
location.href = "list";
|
||||
},
|
||||
error: function () {
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
// 更新表单中的多边形点位置数据
|
||||
function updatePolygonPoints() {
|
||||
var polygons = map.getOverlays(BMap.Polygon);
|
||||
for (var i = 0; i < polygons.length; i++) {
|
||||
// 确保当前对象是一个多边形对象
|
||||
if (polygons[i] instanceof BMap.Polygon) {
|
||||
var points = polygons[i].getPath();
|
||||
var bdShape = [];
|
||||
for (var j = 0; j < points.length; j++) {
|
||||
var location = [];
|
||||
location.push(points[j].lng);
|
||||
location.push(points[j].lat);
|
||||
bdShape.push(location);
|
||||
}
|
||||
// 将更新后的点位置数据更新到表单中
|
||||
$("#bdShape").val(bdShape.join(";"));
|
||||
}
|
||||
// 将更新后的点位置数据更新到表单中
|
||||
$("#bdShape").val(bdShape.join(";"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fetchProvinces()
|
||||
|
||||
</script>
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
</body>
|
||||
</html>
|
||||
</#compress>
|
||||
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
package com.fangjia.dal.mongo;
|
||||
|
||||
import com.fangjia.dal.MongoDaoImpl;
|
||||
import com.fangjia.dal.mongo.dao.AdministrativeMappingDao;
|
||||
import com.fangjia.dal.mongo.model.AdministrativeMapping;
|
||||
|
||||
public class AdministrativeMappingDaoImpl extends MongoDaoImpl<AdministrativeMapping> implements AdministrativeMappingDao {
|
||||
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
package com.fangjia.dal.mongo.dao;
|
||||
|
||||
|
||||
import com.fangjia.dal.MongoDao;
|
||||
import com.fangjia.dal.mongo.model.AdministrativeMapping;
|
||||
|
||||
public interface AdministrativeMappingDao extends MongoDao<AdministrativeMapping> {
|
||||
|
||||
}
|
||||
+255
@@ -0,0 +1,255 @@
|
||||
package com.fangjia.dal.mongo.model;
|
||||
|
||||
import com.fangjia.dal.MongoEntity;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Entity
|
||||
@Table(name = "business.administrative_mapping")
|
||||
public class AdministrativeMapping implements MongoEntity {
|
||||
|
||||
private String id;
|
||||
private String province;
|
||||
private String city;
|
||||
private String district;
|
||||
private String street;
|
||||
private String tjjStreetCode;
|
||||
private String streetPinyin;
|
||||
private String pid;
|
||||
private String tjjProvinceCode;
|
||||
|
||||
private String tjjCityCode;
|
||||
|
||||
private String tjjDistrictCode;
|
||||
|
||||
|
||||
private Integer tjjSourceYear;
|
||||
|
||||
private String mzbProvinceCode;
|
||||
|
||||
private String mzbCityCode;
|
||||
|
||||
private String mzbDistrictCode;
|
||||
|
||||
private String mzbDistrictName;
|
||||
|
||||
private String mzbStreetCode;
|
||||
private Integer mzbSourceYear;
|
||||
|
||||
private String type;
|
||||
private String districtShort;
|
||||
private String cityShort;
|
||||
private String provinceShort;
|
||||
|
||||
private List<String> alias;
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||
@Column(name = "_id")
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Column(name = "province")
|
||||
public String getProvince() {
|
||||
return province;
|
||||
}
|
||||
|
||||
public void setProvince(String province) {
|
||||
this.province = province;
|
||||
}
|
||||
|
||||
@Column(name = "city")
|
||||
public String getCity() {
|
||||
return city;
|
||||
}
|
||||
|
||||
public void setCity(String city) {
|
||||
this.city = city;
|
||||
}
|
||||
|
||||
@Column(name = "district")
|
||||
public String getDistrict() {
|
||||
return district;
|
||||
}
|
||||
|
||||
public void setDistrict(String district) {
|
||||
this.district = district;
|
||||
}
|
||||
|
||||
@Column(name = "street")
|
||||
public String getStreet() {
|
||||
return street;
|
||||
}
|
||||
|
||||
public void setStreet(String street) {
|
||||
this.street = street;
|
||||
}
|
||||
|
||||
@Column(name = "pid")
|
||||
public String getPid() {
|
||||
return pid;
|
||||
}
|
||||
|
||||
public void setPid(String pid) {
|
||||
this.pid = pid;
|
||||
}
|
||||
|
||||
@Column(name = "tjj_province_code")
|
||||
public String getTjjProvinceCode() {
|
||||
return tjjProvinceCode;
|
||||
}
|
||||
|
||||
public void setTjjProvinceCode(String tjjProvinceCode) {
|
||||
this.tjjProvinceCode = tjjProvinceCode;
|
||||
}
|
||||
|
||||
@Column(name = "tjj_city_code")
|
||||
public String getTjjCityCode() {
|
||||
return tjjCityCode;
|
||||
}
|
||||
|
||||
public void setTjjCityCode(String tjjCityCode) {
|
||||
this.tjjCityCode = tjjCityCode;
|
||||
}
|
||||
|
||||
@Column(name = "tjj_district_code")
|
||||
public String getTjjDistrictCode() {
|
||||
return tjjDistrictCode;
|
||||
}
|
||||
|
||||
public void setTjjDistrictCode(String tjjDistrictCode) {
|
||||
this.tjjDistrictCode = tjjDistrictCode;
|
||||
}
|
||||
|
||||
@Column(name = "tjj_street_code")
|
||||
public String getTjjStreetCode() {
|
||||
return tjjStreetCode;
|
||||
}
|
||||
|
||||
public void setTjjStreetCode(String tjjStreetCode) {
|
||||
this.tjjStreetCode = tjjStreetCode;
|
||||
}
|
||||
|
||||
@Column(name = "tjj_source_year")
|
||||
public Integer getTjjSourceYear() {
|
||||
return tjjSourceYear;
|
||||
}
|
||||
|
||||
public void setTjjSourceYear(Integer tjjSourceYear) {
|
||||
this.tjjSourceYear = tjjSourceYear;
|
||||
}
|
||||
|
||||
@Column(name = "mzb_province_code")
|
||||
public String getMzbProvinceCode() {
|
||||
return mzbProvinceCode;
|
||||
}
|
||||
|
||||
public void setMzbProvinceCode(String mzbProvinceCode) {
|
||||
this.mzbProvinceCode = mzbProvinceCode;
|
||||
}
|
||||
|
||||
@Column(name = "mzb_city_code")
|
||||
public String getMzbCityCode() {
|
||||
return mzbCityCode;
|
||||
}
|
||||
|
||||
public void setMzbCityCode(String mzbCityCode) {
|
||||
this.mzbCityCode = mzbCityCode;
|
||||
}
|
||||
|
||||
@Column(name = "mzb_district_code")
|
||||
public String getMzbDistrictCode() {
|
||||
return mzbDistrictCode;
|
||||
}
|
||||
|
||||
public void setMzbDistrictCode(String mzbDistrictCode) {
|
||||
this.mzbDistrictCode = mzbDistrictCode;
|
||||
}
|
||||
|
||||
@Column(name = "mzb_district_name")
|
||||
public String getMzbDistrictName() {
|
||||
return mzbDistrictName;
|
||||
}
|
||||
|
||||
public void setMzbDistrictName(String mzbDistrictName) {
|
||||
this.mzbDistrictName = mzbDistrictName;
|
||||
}
|
||||
|
||||
@Column(name = "mzb_street_code")
|
||||
public String getMzbStreetCode() {
|
||||
return mzbStreetCode;
|
||||
}
|
||||
|
||||
public void setMzbStreetCode(String mzbStreetCode) {
|
||||
this.mzbStreetCode = mzbStreetCode;
|
||||
}
|
||||
@Column(name = "mzb_source_year")
|
||||
public Integer getMzbSourceYear() {
|
||||
return mzbSourceYear;
|
||||
}
|
||||
|
||||
public void setMzbSourceYear(Integer mzbSourceYear) {
|
||||
this.mzbSourceYear = mzbSourceYear;
|
||||
}
|
||||
|
||||
@Column(name = "type")
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Column(name = "district_short")
|
||||
public String getDistrictShort() {
|
||||
return districtShort;
|
||||
}
|
||||
|
||||
public void setDistrictShort(String districtShort) {
|
||||
this.districtShort = districtShort;
|
||||
}
|
||||
|
||||
@Column(name = "city_short")
|
||||
public String getCityShort() {
|
||||
return cityShort;
|
||||
}
|
||||
|
||||
public void setCityShort(String cityShort) {
|
||||
this.cityShort = cityShort;
|
||||
}
|
||||
|
||||
@Column(name = "province_short")
|
||||
public String getProvinceShort() {
|
||||
return provinceShort;
|
||||
}
|
||||
|
||||
public void setProvinceShort(String provinceShort) {
|
||||
this.provinceShort = provinceShort;
|
||||
}
|
||||
|
||||
@Column(name = "alias")
|
||||
public List<String> getAlias() {
|
||||
return alias;
|
||||
}
|
||||
|
||||
public void setAlias(List<String> alias) {
|
||||
this.alias = alias;
|
||||
}
|
||||
|
||||
@Column(name = "street_pinyin")
|
||||
public String getStreetPinyin() {
|
||||
return streetPinyin;
|
||||
}
|
||||
|
||||
public void setStreetPinyin(String streetPinyin) {
|
||||
this.streetPinyin = streetPinyin;
|
||||
}
|
||||
}
|
||||
+3
-1
@@ -55,5 +55,7 @@ public interface DevelopmentZoneService {
|
||||
|
||||
public long countDev(String province,String name,String level);
|
||||
|
||||
|
||||
public List<String> findProvinces();
|
||||
public List<String> findCities(String province);
|
||||
public List<String> findDistricts(String city);
|
||||
}
|
||||
|
||||
+45
@@ -1,7 +1,9 @@
|
||||
package com.fangjia.service.mongo.fangjia;
|
||||
|
||||
import com.fangjia.dal.QueryParam;
|
||||
import com.fangjia.dal.mongo.dao.AdministrativeMappingDao;
|
||||
import com.fangjia.dal.mongo.dao.DevelopmentZoneDao;
|
||||
import com.fangjia.dal.mongo.model.AdministrativeMapping;
|
||||
import com.fangjia.dal.mongo.model.DevelopmentZone;
|
||||
import com.fangjia.dal.mongo.model.DevelopmentZone;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
@@ -14,6 +16,7 @@ import java.util.regex.Pattern;
|
||||
|
||||
public class DevelopmentZoneServiceImpl implements DevelopmentZoneService {
|
||||
private DevelopmentZoneDao developmentZoneDao;
|
||||
private AdministrativeMappingDao administrativeMappingDao;
|
||||
|
||||
|
||||
@Override
|
||||
@@ -76,8 +79,50 @@ public class DevelopmentZoneServiceImpl implements DevelopmentZoneService {
|
||||
return developmentZoneDao.findCountByParams(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> findProvinces() {
|
||||
List<QueryParam> queryParams = new ArrayList<QueryParam>();
|
||||
queryParams.add(new QueryParam("type", "Ê¡·Ý"));
|
||||
List<AdministrativeMapping> allProvince = administrativeMappingDao.findAllByParams(queryParams,null,0,100,new String[]{"province"});
|
||||
List<String> provinces = new ArrayList<String>();
|
||||
for (AdministrativeMapping mapping : allProvince) {
|
||||
provinces.add(mapping.getProvince());
|
||||
}
|
||||
return provinces;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> findCities(String province) {
|
||||
List<QueryParam> queryParams = new ArrayList<QueryParam>();
|
||||
queryParams.add(new QueryParam("type", "³ÇÊÐ"));
|
||||
queryParams.add(new QueryParam("province", province));
|
||||
List<AdministrativeMapping> allCity = administrativeMappingDao.findAllByParams(queryParams,null,0,1000,new String[]{"city"});
|
||||
List<String> cities = new ArrayList<String>();
|
||||
for (AdministrativeMapping mapping : allCity) {
|
||||
cities.add(mapping.getCity());
|
||||
}
|
||||
return cities;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> findDistricts(String city) {
|
||||
List<QueryParam> queryParams = new ArrayList<QueryParam>();
|
||||
queryParams.add(new QueryParam("type", "ÇøÓò"));
|
||||
queryParams.add(new QueryParam("city", city));
|
||||
List<AdministrativeMapping> allDistrict = administrativeMappingDao.findAllByParams(queryParams,null,0,1000,new String[]{"district"});
|
||||
List<String> districts = new ArrayList<String>();
|
||||
for (AdministrativeMapping mapping : allDistrict) {
|
||||
districts.add(mapping.getDistrict());
|
||||
}
|
||||
return districts;
|
||||
}
|
||||
|
||||
|
||||
public void setDevelopmentZoneDao(DevelopmentZoneDao developmentZoneDao) {
|
||||
this.developmentZoneDao = developmentZoneDao;
|
||||
}
|
||||
|
||||
public void setAdministrativeMappingDao(AdministrativeMappingDao administrativeMappingDao) {
|
||||
this.administrativeMappingDao = administrativeMappingDao;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user