开发区省市区改为下拉框

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,7 +1,6 @@
<#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" />
@@ -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>
@@ -95,7 +85,7 @@
updateCityAndDistrict(); updateCityAndDistrict();
}); });
$('#cityName').change(function () { $('#cityName1').change(function() {
updateDistrict(); updateDistrict();
}); });
}); });
@@ -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();
@@ -148,17 +138,17 @@
} }
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) {
@@ -174,15 +164,12 @@
</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" <script type="text/javascript" src="https://api.map.baidu.com/library/DrawingManager/1.4/src/DrawingManager_min.js"></script>
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" /> <link rel="stylesheet" href="https://api.map.baidu.com/library/DrawingManager/1.4/src/DrawingManager_min.css" />
<!--加载检索信息窗口--> <!--加载检索信息窗口-->
<script type="text/javascript" <script type="text/javascript" src="https://api.map.baidu.com/library/SearchInfoWindow/1.4/src/SearchInfoWindow_min.js"></script>
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" /> <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">
@@ -239,7 +226,6 @@
}); });
//添加鼠标绘制工具监听事件,用于获取绘制结果 //添加鼠标绘制工具监听事件,用于获取绘制结果
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]);
@@ -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;