开发区省市区改为下拉框

This commit is contained in:
majintao
2024-07-04 17:57:27 +08:00
parent 521b1af36b
commit d4aacf7a14
6 changed files with 313 additions and 313 deletions
@@ -125,7 +125,7 @@ public class DevelopmentZoneController {
entity.setNameEn(StringUtils.isBlank(model.getNameEn()) ? "" : model.getNameEn()); entity.setNameEn(StringUtils.isBlank(model.getNameEn()) ? "" : model.getNameEn());
entity.setType(StringUtils.isBlank(model.getType()) ? "" : model.getType()); entity.setType(StringUtils.isBlank(model.getType()) ? "" : model.getType());
entity.setUrl(StringUtils.isBlank(model.getUrl()) ? "" : model.getUrl()); entity.setUrl(StringUtils.isBlank(model.getUrl()) ? "" : model.getUrl());
entity.setCityName(StringUtils.isBlank(model.getCityName()) ? "" : model.getCityName()); entity.setCityName1(StringUtils.isBlank(model.getCityName1()) ? "" : model.getCityName1());
entity.setDistrict(StringUtils.isBlank(model.getDistrict()) ? "" : model.getDistrict()); entity.setDistrict(StringUtils.isBlank(model.getDistrict()) ? "" : model.getDistrict());
//记录操作人员 //记录操作人员
entity.setOperator(user.getRealName()); entity.setOperator(user.getRealName());
@@ -198,8 +198,8 @@ public class DevelopmentZoneController {
if (StringUtils.isNotBlank(model.getUrl())) { if (StringUtils.isNotBlank(model.getUrl())) {
udata.put("url", model.getUrl()); udata.put("url", model.getUrl());
} }
if (StringUtils.isNotBlank(model.getCityName())) { if (StringUtils.isNotBlank(model.getCityName1())) {
udata.put("cityName", model.getCityName()); udata.put("city", model.getCityName1());
} }
if (StringUtils.isNotBlank(model.getDistrict())){ if (StringUtils.isNotBlank(model.getDistrict())){
udata.put("district", model.getDistrict()); udata.put("district", model.getDistrict());
@@ -230,7 +230,7 @@ public class DevelopmentZoneController {
public JsonModel districtsAction(DevelopmentZoneModel model) { public JsonModel districtsAction(DevelopmentZoneModel model) {
JsonModel jsonModel = new JsonModel(); JsonModel jsonModel = new JsonModel();
List<String> districts = developmentZoneService.findDistricts(model.getCityName()); List<String> districts = developmentZoneService.findDistricts(model.getCityName1());
jsonModel.setJsonModel(districts); jsonModel.setJsonModel(districts);
return jsonModel; return jsonModel;
} }
@@ -33,6 +33,8 @@ public class DevelopmentZoneModel extends BaseModel {
private DevelopmentZone developmentZone; private DevelopmentZone developmentZone;
private List<DevelopmentZone> developmentZoneList; private List<DevelopmentZone> developmentZoneList;
private String cityName1;
public String getAlias() { public String getAlias() {
return alias; return alias;
} }
@@ -184,4 +186,12 @@ public class DevelopmentZoneModel extends BaseModel {
public void setDevelopmentZoneList(List<DevelopmentZone> developmentZoneList) { public void setDevelopmentZoneList(List<DevelopmentZone> developmentZoneList) {
this.developmentZoneList = developmentZoneList; this.developmentZoneList = developmentZoneList;
} }
public String getCityName1() {
return cityName1;
}
public void setCityName1(String cityName1) {
this.cityName1 = cityName1;
}
} }
@@ -1,18 +1,17 @@
<#ftl attributes={"content_type":"text/html; charset=UTF-8"}> <#ftl attributes={"content_type":"text/html; charset=UTF-8"}>
<#compress> <#compress>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
"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">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns="http://www.w3.org/1999/html"> <head>
<head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>开发区围栏列表</title> <title>开发区围栏列表</title>
<link rel="stylesheet" type="text/css" href="../style/main.css?v=${version}"/> <link rel="stylesheet" type="text/css" href="../style/main.css?v=${version}" />
<script type="text/javascript" src="../js/My97DatePicker/WdatePicker.js"></script> <script type="text/javascript" src="../js/My97DatePicker/WdatePicker.js"></script>
</head> </head>
<body> <body>
<#include "/common_js.ftl" /> <#include "/common_js.ftl" />
<#include "/layout/header.ftl" /> <#include "/layout/header.ftl" />
<div class="main-content"> <div class="main-content">
<div class="menuButton"> <div class="menuButton">
<a href="../developmentZone/list" class="list">开发区列表</a>&nbsp;&nbsp; <a href="../developmentZone/list" class="list">开发区列表</a>&nbsp;&nbsp;
</div> </div>
@@ -26,7 +25,11 @@
<table> <table>
<tr> <tr>
<td> <td>
<@d_city defaultValue="" callback="changeCity" callbackField="display" name="cityDisplay" /> <#if developmentZone??>
<@d_city defaultValue="${developmentZone.cityName1!}" callback="changeCity" callbackField="display" name="cityDisplay" />
<#else>
<@d_city defaultValue="上海" callback="changeCity" callbackField="display" name="cityDisplay" />
</#if>
</td> </td>
<td> <td>
<label for="province">所在省份:</label> <label for="province">所在省份:</label>
@@ -38,40 +41,27 @@
</#if> </#if>
</select> </select>
<label for="cityName">城市:</label> <label for="cityName1">城市:</label>
<select id="cityName" name="cityName" onchange="updateDistrict()"> <select id="cityName1" name="cityName1" onchange="updateDistrict()">
<!-- Options for cities will be populated by JavaScript --> <!-- Options for cities will be populated by JavaScript -->
</select> </select>
<label for="district">区域:</label> <label for="district">区域:</label>
<select id="district" name="district"> <select id="district" name="district">
<!-- Options for districts will be populated by JavaScript --> <!-- Options for districts will be populated by JavaScript -->
</select> </select>
<label for="name">开发区名称:</label> <input id="name" name="name" type="text" <label for="name">开发区名称:</label> <input id="name" name="name" type="text" placeholder="必填" value="<#if developmentZone??>${developmentZone.name!}</#if>"/>
placeholder="必填"
value="<#if developmentZone??>${developmentZone.name!}</#if>"/>
<label for="alias">别名:</label> <label for="alias">别名:</label>
<input id="alias" name="alias" type="text" placeholder="多个别名用,隔开" <input id="alias" name="alias" type="text" placeholder="多个别名用,隔开" value="<#if developmentZone??><#list (developmentZone.alias)! as alia>${alia + ','}</#list><#else></#if>"/>
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="nameEn">开发区名称拼音:</label> <input id="nameEn" name="nameEn" type="text"
value="<#if developmentZone??>${developmentZone.nameEn!}</#if>"/>
</br> </br>
<label for="level">级别:</label> <input id="level" name="level" type="text" <label for="level">级别:</label> <input id="level" name="level" type="text" placeholder="必填" value="<#if developmentZone??>${developmentZone.level!}</#if>"/>
placeholder="必填" <label for="address">地址:</label> <input id="address" name="address" type="text" value="<#if developmentZone??>${developmentZone.address!}</#if>"/><br>
value="<#if developmentZone??>${developmentZone.level!}</#if>"/> <label for="area">所在地区:</label> <input id="area" name="area" type="text" value="<#if developmentZone??>${developmentZone.area!}</#if>"/>
<label for="address">地址:</label> <input id="address" name="address" type="text" <label for="buildDate">建立年代:</label><input id="buildDate" name="buildDate" type="text" value="<#if developmentZone??>${developmentZone.buildDate!}</#if>"/>
value="<#if developmentZone??>${developmentZone.address!}</#if>"/><br> <label for="type">类型:</label><input id="type" name="type" type="text" value="<#if developmentZone??>${developmentZone.type!}</#if>"/>
<label for="area">所在地区:</label> <input id="area" name="area" type="text" <label for="url">URL:</label><input id="url" name="url" type="text" value="<#if developmentZone??>${developmentZone.url!}</#if>"/><br>
value="<#if developmentZone??>${developmentZone.area!}</#if>"/> <label for="industry">主导产业:</label><input id="industry" name="industry" type="text" value="<#if developmentZone??>${developmentZone.industry!}</#if>"/>
<label for="buildDate">建立年代:</label><input id="buildDate" name="buildDate" type="text" <label for="block">区块:</label><input id="block" name="block" type="text" value="<#if developmentZone??>${developmentZone.block!}</#if>"/><br/>
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="提交"/> <input id="saveOrUpdate" type="button" value="提交"/>
</td> </td>
@@ -85,17 +75,17 @@
</table> </table>
</form> </form>
</div> </div>
</div> </div>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script> <script>
$(document).ready(function () { $(document).ready(function() {
fetchProvinces(); fetchProvinces();
$('#province').change(function () { $('#province').change(function() {
updateCityAndDistrict(); updateCityAndDistrict();
}); });
$('#cityName').change(function () { $('#cityName1').change(function() {
updateDistrict(); updateDistrict();
}); });
}); });
@@ -105,15 +95,15 @@
type: 'GET', type: 'GET',
url: '../developmentZone/provinces', url: '../developmentZone/provinces',
dataType: 'json', dataType: 'json',
success: function (data) { success: function(data) {
let provinceSelect = $('#province'); let provinceSelect = $('#province');
provinceSelect.empty(); provinceSelect.empty();
provinceSelect.append('<option value="">请选择省份</option>'); provinceSelect.append('<option value="">请选择省份</option>');
$.each(data, function (index, province) { $.each(data, function(index, province) {
provinceSelect.append('<option value="' + province + '">' + province + '</option>'); provinceSelect.append('<option value="' + province + '">' + province + '</option>');
}); });
}, },
error: function () { error: function() {
// 处理错误 // 处理错误
} }
}); });
@@ -121,7 +111,7 @@
function updateCityAndDistrict() { function updateCityAndDistrict() {
let province = $('#province').val(); let province = $('#province').val();
let citySelect = $('#cityName'); let citySelect = $('#cityName1');
let districtSelect = $('#district'); let districtSelect = $('#district');
citySelect.empty(); citySelect.empty();
@@ -133,14 +123,14 @@
$.ajax({ $.ajax({
type: 'GET', type: 'GET',
url: '../developmentZone/cities', url: '../developmentZone/cities',
data: {province: province}, data: { province: province },
dataType: 'json', dataType: 'json',
success: function (data) { success: function(data) {
$.each(data, function (index, city) { $.each(data, function(index, city) {
citySelect.append('<option value="' + city + '">' + city + '</option>'); citySelect.append('<option value="' + city + '">' + city + '</option>');
}); });
}, },
error: function () { error: function() {
// 处理错误 // 处理错误
} }
}); });
@@ -148,67 +138,64 @@
} }
function updateDistrict() { function updateDistrict() {
let cityName = $('#cityName').val(); let cityName1 = $('#cityName1').val();
let districtSelect = $('#district'); let districtSelect = $('#district');
districtSelect.empty(); districtSelect.empty();
districtSelect.append('<option value="">请选择区域</option>'); districtSelect.append('<option value="">请选择区域</option>');
if (cityName) { if (cityName1) {
$.ajax({ $.ajax({
type: 'GET', type: 'GET',
url: '../developmentZone/districts', url: '../developmentZone/districts',
data: {cityName: cityName}, data: { cityName1: cityName1 },
dataType: 'json', dataType: 'json',
success: function (data) { success: function(data) {
$.each(data, function (index, district) { $.each(data, function(index, district) {
districtSelect.append('<option value="' + district + '">' + district + '</option>'); districtSelect.append('<option value="' + district + '">' + district + '</option>');
}); });
}, },
error: function () { error: function() {
// 处理错误 // 处理错误
} }
}); });
} }
} }
</script> </script>
<script type="text/javascript" <script type="text/javascript" src="https://api.map.baidu.com/api?v=2.0&ak=3E63A744012f88c9a73a2f051aece58b"></script>
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>
<script type="text/javascript" <link rel="stylesheet" href="https://api.map.baidu.com/library/DrawingManager/1.4/src/DrawingManager_min.css" />
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="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"> <script type="application/javascript">
var map = new BMap.Map("allmap"); // 创建Map实例 var map = new BMap.Map("allmap"); // 创建Map实例
if ($("#cityDisplay").val()) { if($("#cityDisplay").val()) {
map.centerAndZoom($("#cityDisplay").val(), 13); map.centerAndZoom($("#cityDisplay").val(), 13);
} else { }else {
map.centerAndZoom('上海', 13); map.centerAndZoom('上海', 13);
} }
map.enableScrollWheelZoom(true); map.enableScrollWheelZoom(true);
function changeCity(display) { function changeCity(display){
clearAll(); clearAll();
map.centerAndZoom(display, 13); map.centerAndZoom(display, 13);
} }
var overlays = []; var overlays = [];
var overlaycomplete = function (e) { var overlaycomplete = function(e){
overlays.push(e.overlay); overlays.push(e.overlay);
var points = e.overlay.getPath(); var points = e.overlay.getPath();
var bdShape = []; var bdShape = [];
for (var i = 0; i < points.length; i++) { for(var i=0;i<points.length;i++) {
var location = []; var location = [];
location.push(points[i].lng); location.push(points[i].lng );
location.push(points[i].lat); location.push(points[i].lat );
bdShape.push(location); bdShape.push(location);
} }
$("#bdShape").val(bdShape.join(";")); $("#bdShape").val(bdShape.join(";"));
@@ -217,8 +204,8 @@
}; };
var styleOptions = { var styleOptions = {
strokeColor: "red", //边线颜色。 strokeColor:"red", //边线颜色。
fillColor: "red", //填充颜色。当参数为空时,圆形将没有填充效果。 fillColor:"red", //填充颜色。当参数为空时,圆形将没有填充效果。
strokeWeight: 1, //边线的宽度,以像素为单位。 strokeWeight: 1, //边线的宽度,以像素为单位。
strokeOpacity: 0.8, //边线透明度,取值范围0 - 1。 strokeOpacity: 0.8, //边线透明度,取值范围0 - 1。
fillOpacity: 0.6, //填充的透明度,取值范围0 - 1。 fillOpacity: 0.6, //填充的透明度,取值范围0 - 1。
@@ -239,16 +226,15 @@
}); });
//添加鼠标绘制工具监听事件,用于获取绘制结果 //添加鼠标绘制工具监听事件,用于获取绘制结果
drawingManager.addEventListener('overlaycomplete', overlaycomplete); drawingManager.addEventListener('overlaycomplete', overlaycomplete);
function clearAll() { function clearAll() {
for (var i = 0; i < overlays.length; i++) { for(var i = 0; i < overlays.length; i++){
map.removeOverlay(overlays[i]); map.removeOverlay(overlays[i]);
} }
overlays.length = 0; overlays.length = 0;
} }
// 添加点击覆盖物事件监听器 // 添加点击覆盖物事件监听器
map.addEventListener("click", function (e) { map.addEventListener("click", function(e) {
// 判断点击的是否是已存在的覆盖物 // 判断点击的是否是已存在的覆盖物
if (e.overlay) { if (e.overlay) {
// 如果是多边形或折线,则可以编辑 // 如果是多边形或折线,则可以编辑
@@ -265,11 +251,11 @@
}); });
// 添加覆盖物编辑完成事件监听器 // 添加覆盖物编辑完成事件监听器
map.addEventListener("overlaycomplete", function (e) { map.addEventListener("overlaycomplete", function(e) {
// 判断新增的覆盖物是否是多边形或折线 // 判断新增的覆盖物是否是多边形或折线
if (e.overlay instanceof BMap.Polygon || e.overlay instanceof BMap.Polyline) { if (e.overlay instanceof BMap.Polygon || e.overlay instanceof BMap.Polyline) {
// 添加覆盖物编辑完成事件监听器 // 添加覆盖物编辑完成事件监听器
e.overlay.addEventListener("lineupdate", function () { e.overlay.addEventListener("lineupdate", function() {
// 编辑完成后获取更新后的路径点,并更新表单中的数据 // 编辑完成后获取更新后的路径点,并更新表单中的数据
var points = e.overlay.getPath(); var points = e.overlay.getPath();
var bdShape = []; var bdShape = [];
@@ -284,7 +270,7 @@
} }
}); });
$("#saveOrUpdate").click(function () { $("#saveOrUpdate").click(function(){
// 更新表单中的点位置数据 // 更新表单中的点位置数据
updatePolygonPoints(); updatePolygonPoints();
@@ -294,11 +280,11 @@
data: $("#form1").serialize(), data: $("#form1").serialize(),
dataType: 'json', dataType: 'json',
timeout: 100000, timeout: 100000,
success: function (data) { success: function(data) {
alert(data.msg); alert(data.msg);
location.href = "list"; location.href="list";
}, },
error: function () { error : function() {
} }
}); });
@@ -327,8 +313,8 @@
fetchProvinces() fetchProvinces()
</script> </script>
</body> </body>
</html> </html>
</#compress> </#compress>
@@ -62,7 +62,7 @@
<td>${it.level!}</td> <td>${it.level!}</td>
<td>${it.province!}</td> <td>${it.province!}</td>
<td>${it.cityName!}</td> <td>${it.cityName1!}</td>
<td>${it.district!}</td> <td>${it.district!}</td>
<td>${it.block!}</td> <td>${it.block!}</td>
<td> <td>
@@ -33,7 +33,7 @@
</tr> </tr>
<tr> <tr>
<td>城市</td> <td>城市</td>
<td>${developmentZone.cityName!}</td> <td>${developmentZone.cityName1!}</td>
</tr> </tr>
<tr> <tr>
<td>区域</td> <td>区域</td>
@@ -32,7 +32,7 @@ public class DevelopmentZone implements MongoEntity {
private String block; private String block;
private String operator; private String operator;
private String cityName; private String cityName1;
private String district; private String district;
//增加别名字段 //增加别名字段
@@ -186,15 +186,19 @@ public class DevelopmentZone implements MongoEntity {
this.operator = operator; this.operator = operator;
} }
@Column(name = "city") @Column(name = "city")
public String getCityName() { public String getCityName1() {
return cityName; return cityName1;
} }
public void setCityName(String cityName) { public void setCityName1(String cityName1) {
this.cityName = cityName; this.cityName1 = cityName1;
} }
@Column(name = "district") @Column(name = "district")
public String getDistrict() { public String getDistrict() {
return district; return district;