创建小区时新增所在地和网格选择
This commit is contained in:
parent
3f7c13d75a
commit
c825c64844
@ -1,16 +1,20 @@
|
||||
package cn.com.tenlion.systemhouse.controller.api.residential;
|
||||
|
||||
import cn.com.tenlion.systemhouse.pojo.dtos.grid.GridDTO;
|
||||
import cn.com.tenlion.systemhouse.pojo.dtos.residential.ResidentialDTO;
|
||||
import cn.com.tenlion.systemhouse.pojo.vos.residential.ResidentialVO;
|
||||
import cn.com.tenlion.systemhouse.remote.grid.IGridRemoteService;
|
||||
import cn.com.tenlion.systemhouse.service.residential.IResidentialService;
|
||||
import ink.wgink.annotation.CheckRequestBodyAnnotation;
|
||||
import ink.wgink.common.base.DefaultBaseController;
|
||||
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||
import ink.wgink.module.oauth2.manager.OAuth2ClientTokenManager;
|
||||
import ink.wgink.pojo.ListPage;
|
||||
import ink.wgink.pojo.result.ErrorResult;
|
||||
import ink.wgink.pojo.result.SuccessResult;
|
||||
import ink.wgink.pojo.result.SuccessResultData;
|
||||
import ink.wgink.pojo.result.SuccessResultList;
|
||||
import ink.wgink.properties.ApiPathProperties;
|
||||
import io.swagger.annotations.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@ -33,6 +37,10 @@ public class ResidentialController extends DefaultBaseController {
|
||||
|
||||
@Autowired
|
||||
private IResidentialService residentialService;
|
||||
@Autowired
|
||||
private IGridRemoteService gridRemoteService;
|
||||
@Autowired
|
||||
private ApiPathProperties apiPathProperties;
|
||||
|
||||
@ApiOperation(value = "新增小区管理表", notes = "新增小区管理表接口")
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@ -108,4 +116,17 @@ public class ResidentialController extends DefaultBaseController {
|
||||
return new SuccessResultData<>(residentialService.count(params));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "网格列表", notes = "网格列表接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "areaCode", value = "地区编码", paramType = "query", dataType = "String")
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("grid-list/{areaCode}")
|
||||
public List<GridDTO> getGridList(@PathVariable("areaCode") String areaCode) {
|
||||
String sendUrl = apiPathProperties.getUserCenter();
|
||||
// String sendUrl = "http://192.168.28.87:8081/systembase/";
|
||||
String accessToken = OAuth2ClientTokenManager.getInstance().getToken().getAccessToken();
|
||||
return gridRemoteService.getGridList(sendUrl, areaCode, accessToken);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,199 @@
|
||||
package cn.com.tenlion.systemhouse.pojo.dtos.grid;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @ClassName: GridDTO
|
||||
* @Description: 网格实体类
|
||||
* @Author: CodeFactory
|
||||
* @Date: 2021-10-20 16:00:09
|
||||
* @Version: 3.0
|
||||
**/
|
||||
@ApiModel
|
||||
public class GridDTO {
|
||||
|
||||
@ApiModelProperty(name = "areaCode", value = "区域编码")
|
||||
private String areaCode;
|
||||
@ApiModelProperty(name = "areaName", value = "区域名称")
|
||||
private String areaName;
|
||||
@ApiModelProperty(name = "fillColor", value = "填充颜色")
|
||||
private String fillColor;
|
||||
@ApiModelProperty(name = "gmtCreate", value = "添加时间")
|
||||
private String gmtCreate;
|
||||
@ApiModelProperty(name = "gmtModified", value = "修改时间")
|
||||
private String gmtModified;
|
||||
@ApiModelProperty(name = "gridCode", value = "网格编码")
|
||||
private String gridCode;
|
||||
@ApiModelProperty(name = "gridDuty", value = "网格职责")
|
||||
private String gridDuty;
|
||||
@ApiModelProperty(name = "gridGroupId", value = "网格组ID")
|
||||
private String gridGroupId;
|
||||
@ApiModelProperty(name = "gridId", value = "主键")
|
||||
private String gridId;
|
||||
@ApiModelProperty(name = "gridName", value = "网格名称")
|
||||
private String gridName;
|
||||
@ApiModelProperty(name = "gridSquare", value = "网格面积")
|
||||
private int gridSquare;
|
||||
@ApiModelProperty(name = "gridSummary", value = "网格描述")
|
||||
private String gridSummary;
|
||||
@ApiModelProperty(name = "relationId", value = "关联ID")
|
||||
private String relationId;
|
||||
@ApiModelProperty(name = "pointArray", value = "网格点列表")
|
||||
private List<PointArrayBean> pointArray;
|
||||
@ApiModelProperty(name = "relationIdArray", value = "关联ID列表")
|
||||
private List<?> relationIdArray;
|
||||
|
||||
public String getAreaCode() {
|
||||
return areaCode;
|
||||
}
|
||||
|
||||
public void setAreaCode(String areaCode) {
|
||||
this.areaCode = areaCode;
|
||||
}
|
||||
|
||||
public String getAreaName() {
|
||||
return areaName;
|
||||
}
|
||||
|
||||
public void setAreaName(String areaName) {
|
||||
this.areaName = areaName;
|
||||
}
|
||||
|
||||
public String getFillColor() {
|
||||
return fillColor;
|
||||
}
|
||||
|
||||
public void setFillColor(String fillColor) {
|
||||
this.fillColor = fillColor;
|
||||
}
|
||||
|
||||
public String getGmtCreate() {
|
||||
return gmtCreate;
|
||||
}
|
||||
|
||||
public void setGmtCreate(String gmtCreate) {
|
||||
this.gmtCreate = gmtCreate;
|
||||
}
|
||||
|
||||
public String getGmtModified() {
|
||||
return gmtModified;
|
||||
}
|
||||
|
||||
public void setGmtModified(String gmtModified) {
|
||||
this.gmtModified = gmtModified;
|
||||
}
|
||||
|
||||
public String getGridCode() {
|
||||
return gridCode;
|
||||
}
|
||||
|
||||
public void setGridCode(String gridCode) {
|
||||
this.gridCode = gridCode;
|
||||
}
|
||||
|
||||
public String getGridDuty() {
|
||||
return gridDuty;
|
||||
}
|
||||
|
||||
public void setGridDuty(String gridDuty) {
|
||||
this.gridDuty = gridDuty;
|
||||
}
|
||||
|
||||
public String getGridGroupId() {
|
||||
return gridGroupId;
|
||||
}
|
||||
|
||||
public void setGridGroupId(String gridGroupId) {
|
||||
this.gridGroupId = gridGroupId;
|
||||
}
|
||||
|
||||
public String getGridId() {
|
||||
return gridId;
|
||||
}
|
||||
|
||||
public void setGridId(String gridId) {
|
||||
this.gridId = gridId;
|
||||
}
|
||||
|
||||
public String getGridName() {
|
||||
return gridName;
|
||||
}
|
||||
|
||||
public void setGridName(String gridName) {
|
||||
this.gridName = gridName;
|
||||
}
|
||||
|
||||
public int getGridSquare() {
|
||||
return gridSquare;
|
||||
}
|
||||
|
||||
public void setGridSquare(int gridSquare) {
|
||||
this.gridSquare = gridSquare;
|
||||
}
|
||||
|
||||
public String getGridSummary() {
|
||||
return gridSummary;
|
||||
}
|
||||
|
||||
public void setGridSummary(String gridSummary) {
|
||||
this.gridSummary = gridSummary;
|
||||
}
|
||||
|
||||
public String getRelationId() {
|
||||
return relationId;
|
||||
}
|
||||
|
||||
public void setRelationId(String relationId) {
|
||||
this.relationId = relationId;
|
||||
}
|
||||
|
||||
public List<PointArrayBean> getPointArray() {
|
||||
return pointArray;
|
||||
}
|
||||
|
||||
public void setPointArray(List<PointArrayBean> pointArray) {
|
||||
this.pointArray = pointArray;
|
||||
}
|
||||
|
||||
public List<?> getRelationIdArray() {
|
||||
return relationIdArray;
|
||||
}
|
||||
|
||||
public void setRelationIdArray(List<?> relationIdArray) {
|
||||
this.relationIdArray = relationIdArray;
|
||||
}
|
||||
|
||||
public static class PointArrayBean {
|
||||
private String gridId;
|
||||
private String lat;
|
||||
private String lng;
|
||||
|
||||
public String getGridId() {
|
||||
return gridId;
|
||||
}
|
||||
|
||||
public void setGridId(String gridId) {
|
||||
this.gridId = gridId;
|
||||
}
|
||||
|
||||
public String getLat() {
|
||||
return lat;
|
||||
}
|
||||
|
||||
public void setLat(String lat) {
|
||||
this.lat = lat;
|
||||
}
|
||||
|
||||
public String getLng() {
|
||||
return lng;
|
||||
}
|
||||
|
||||
public void setLng(String lng) {
|
||||
this.lng = lng;
|
||||
}
|
||||
}
|
||||
}
|
@ -81,6 +81,12 @@ public class ResidentialDTO {
|
||||
private String area5Lng;
|
||||
@ApiModelProperty(name = "area5Lat", value = "下派状态")
|
||||
private String area5Lat;
|
||||
@ApiModelProperty(name = "location", value = "所在地")
|
||||
private String location;
|
||||
@ApiModelProperty(name = "locationCode", value = "所在地编码")
|
||||
private String locationCode;
|
||||
@ApiModelProperty(name = "grid", value = "所属网格")
|
||||
private String grid;
|
||||
|
||||
public String getResidentialId() {
|
||||
return residentialId == null ? "" : residentialId.trim();
|
||||
@ -329,4 +335,28 @@ public class ResidentialDTO {
|
||||
public void setArea5Lat(String area5Lat) {
|
||||
this.area5Lat = area5Lat;
|
||||
}
|
||||
|
||||
public String getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
public void setLocation(String location) {
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
public String getLocationCode() {
|
||||
return locationCode;
|
||||
}
|
||||
|
||||
public void setLocationCode(String locationCode) {
|
||||
this.locationCode = locationCode;
|
||||
}
|
||||
|
||||
public String getGrid() {
|
||||
return grid;
|
||||
}
|
||||
|
||||
public void setGrid(String grid) {
|
||||
this.grid = grid;
|
||||
}
|
||||
}
|
||||
|
@ -56,6 +56,12 @@ public class ResidentialVO {
|
||||
private String community;
|
||||
@ApiModelProperty(name = "remake", value = "备注")
|
||||
private String remake;
|
||||
@ApiModelProperty(name = "location", value = "所在地")
|
||||
private String location;
|
||||
@ApiModelProperty(name = "locationCode", value = "所在地编码")
|
||||
private String locationCode;
|
||||
@ApiModelProperty(name = "grid", value = "所属网格")
|
||||
private String grid;
|
||||
|
||||
public String getResidentialName() {
|
||||
return residentialName == null ? "" : residentialName.trim();
|
||||
@ -217,5 +223,27 @@ public class ResidentialVO {
|
||||
this.remake = remake;
|
||||
}
|
||||
|
||||
public String getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
public void setLocation(String location) {
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
public String getLocationCode() {
|
||||
return locationCode;
|
||||
}
|
||||
|
||||
public void setLocationCode(String locationCode) {
|
||||
this.locationCode = locationCode;
|
||||
}
|
||||
|
||||
public String getGrid() {
|
||||
return grid;
|
||||
}
|
||||
|
||||
public void setGrid(String grid) {
|
||||
this.grid = grid;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,26 @@
|
||||
package cn.com.tenlion.systemhouse.remote.grid;
|
||||
|
||||
import cn.com.tenlion.systemhouse.pojo.dtos.grid.GridDTO;
|
||||
import cn.com.tenlion.systemhouse.pojo.dtos.population.PopulationDTO;
|
||||
import ink.wgink.annotation.rpc.rest.RemoteService;
|
||||
import ink.wgink.annotation.rpc.rest.method.RemoteGetMethod;
|
||||
import ink.wgink.annotation.rpc.rest.params.RemotePathParams;
|
||||
import ink.wgink.annotation.rpc.rest.params.RemoteQueryParams;
|
||||
import ink.wgink.annotation.rpc.rest.params.RemoteServerParams;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName: IGridRemoteService
|
||||
* @Description: 调取网格信息
|
||||
* @Author: CodeFactory
|
||||
* @Date: 2021-09-24 17:03:54
|
||||
* @Version: 3.0
|
||||
**/
|
||||
@RemoteService
|
||||
public interface IGridRemoteService {
|
||||
|
||||
@RemoteGetMethod("/resource/grid/list/area-code/{areaCode}")
|
||||
List<GridDTO> getGridList(@RemoteServerParams String remotePath, @RemotePathParams("areaCode") String areaCode, @RemoteQueryParams("access_token") String access_token);
|
||||
|
||||
}
|
@ -110,7 +110,7 @@ public class ResidentialServiceImpl extends DefaultBaseService implements IResid
|
||||
@Override
|
||||
public ResidentialDTO get(Map<String, Object> params) {
|
||||
ResidentialDTO residentialDTO = residentialDao.get(params);
|
||||
if(null != residentialDTO) {
|
||||
/*if(null != residentialDTO) {
|
||||
AreaDTO area1DTO = getAreaMsg(residentialDTO.getArea1Id());
|
||||
residentialDTO.setArea1Lng(area1DTO.getAreaLng());
|
||||
residentialDTO.setArea1Lat(area1DTO.getAreaLat());
|
||||
@ -130,7 +130,7 @@ public class ResidentialServiceImpl extends DefaultBaseService implements IResid
|
||||
AreaDTO area5DTO = getAreaMsg(residentialDTO.getArea5Id());
|
||||
residentialDTO.setArea5Lng(area5DTO.getAreaLng());
|
||||
residentialDTO.setArea5Lat(area5DTO.getAreaLat());
|
||||
}
|
||||
}*/
|
||||
return residentialDTO;
|
||||
}
|
||||
|
||||
|
@ -24,6 +24,9 @@
|
||||
<result column="phone" property="phone"/>
|
||||
<result column="community" property="community"/>
|
||||
<result column="remake" property="remake"/>
|
||||
<result column="location" property="location"/>
|
||||
<result column="location_code" property="locationCode"/>
|
||||
<result column="grid" property="grid"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="residentialBO" type="cn.com.tenlion.systemhouse.pojo.bos.residential.ResidentialBO">
|
||||
@ -98,6 +101,9 @@
|
||||
phone,
|
||||
community,
|
||||
remake,
|
||||
location,
|
||||
location_code,
|
||||
grid,
|
||||
creator,
|
||||
gmt_create,
|
||||
modifier,
|
||||
@ -125,6 +131,9 @@
|
||||
#{phone},
|
||||
#{community},
|
||||
#{remake},
|
||||
#{location},
|
||||
#{locationCode},
|
||||
#{grid},
|
||||
#{creator},
|
||||
#{gmtCreate},
|
||||
#{modifier},
|
||||
@ -224,6 +233,15 @@
|
||||
</if>
|
||||
<if test="remake != null and remake != ''">
|
||||
remake = #{remake},
|
||||
</if>
|
||||
<if test="location != null and location != ''">
|
||||
location = #{location},
|
||||
</if>
|
||||
<if test="locationCode != null and locationCode != ''">
|
||||
location_code = #{locationCode},
|
||||
</if>
|
||||
<if test="grid != null and grid != ''">
|
||||
grid = #{grid},
|
||||
</if>
|
||||
gmt_modified = #{gmtModified},
|
||||
modifier = #{modifier},
|
||||
@ -255,6 +273,9 @@
|
||||
t1.phone,
|
||||
t1.community,
|
||||
t1.remake,
|
||||
t1.location,
|
||||
t1.location_code,
|
||||
t1.grid,
|
||||
t1.residential_id
|
||||
FROM
|
||||
house_residential t1
|
||||
@ -358,6 +379,9 @@
|
||||
t1.phone,
|
||||
t1.community,
|
||||
t1.remake,
|
||||
t1.location,
|
||||
t1.location_code,
|
||||
t1.grid,
|
||||
1
|
||||
FROM
|
||||
house_residential t1
|
||||
|
@ -68,83 +68,22 @@
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item layui-row">
|
||||
<!-- 一级区域 -->
|
||||
<div class="layui-col-lg4">
|
||||
<label class="layui-form-label" style="width: 150px;">一级地区</label>
|
||||
<input type="hidden" id="area1Id" name="area1Id" class="layui-input" value="" placeholder="请输入一级区域ID" maxlength="36">
|
||||
<input type="hidden" id="area1Name" name="area1Name" class="layui-input" value="" placeholder="请输入一级区域名称" maxlength="255">
|
||||
<div class="layui-input-block layui-form" id="area1SelectTemplateBox" lay-filter="area1SelectTemplateBox" style="margin-left: 150px;"></div>
|
||||
<script id="area1SelectTemplate" type="text/html">
|
||||
<select id="area1" name="area1" lay-filter="area1">
|
||||
<option value="">请选择一级地区名称</option>
|
||||
{{# for(var i = 0, item; item = d[i++];) { }}
|
||||
<option value="{{item.areaId}},{{item.areaLng}},{{item.areaLat}},{{item.areaName}}">{{item.areaName}}</option>
|
||||
{{# } }}
|
||||
</select>
|
||||
</script>
|
||||
</div>
|
||||
|
||||
<!-- 二级区域 -->
|
||||
<div class="layui-col-lg4">
|
||||
<label class="layui-form-label" style="width: 150px;">二级地区</label>
|
||||
<input type="hidden" id="area2Id" name="area2Id" class="layui-input" value="" placeholder="请输入一级区域ID" maxlength="36">
|
||||
<input type="hidden" id="area2Name" name="area2Name" class="layui-input" value="" placeholder="请输入一级区域名称" maxlength="255">
|
||||
<div class="layui-input-block layui-form" id="area2SelectTemplateBox" lay-filter="area2SelectTemplateBox" style="margin-left: 150px;"></div>
|
||||
<script id="area2SelectTemplate" type="text/html">
|
||||
<select id="area2" name="area2" lay-filter="area2">
|
||||
<option value="">请选择二级地区名称</option>
|
||||
{{# for(var i = 0, item; item = d[i++];) { }}
|
||||
<option value="{{item.areaId}},{{item.areaLng}},{{item.areaLat}},{{item.areaName}}">{{item.areaName}}</option>
|
||||
{{# } }}
|
||||
</select>
|
||||
</script>
|
||||
</div>
|
||||
|
||||
<!-- 三级区域 -->
|
||||
<div class="layui-col-lg4">
|
||||
<label class="layui-form-label" style="width: 150px;">三级地区</label>
|
||||
<input type="hidden" id="area3Id" name="area3Id" class="layui-input" value="" placeholder="请输入一级区域ID" maxlength="36">
|
||||
<input type="hidden" id="area3Name" name="area3Name" class="layui-input" value="" placeholder="请输入一级区域名称" maxlength="255">
|
||||
<div class="layui-input-block layui-form" id="area3SelectTemplateBox" lay-filter="area3SelectTemplateBox" style="margin-left: 150px;"></div>
|
||||
<script id="area3SelectTemplate" type="text/html">
|
||||
<select id="area3" name="area3" lay-filter="area3">
|
||||
<option value="">请选择三级地区名称</option>
|
||||
{{# for(var i = 0, item; item = d[i++];) { }}
|
||||
<option value="{{item.areaId}},{{item.areaLng}},{{item.areaLat}},{{item.areaName}}">{{item.areaName}}</option>
|
||||
{{# } }}
|
||||
</select>
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item layui-row">
|
||||
<!-- 四级区域 -->
|
||||
<div class="layui-col-lg6">
|
||||
<label class="layui-form-label" style="width: 150px;">四级地区</label>
|
||||
<input type="hidden" id="area4Id" name="area4Id" class="layui-input" value="" placeholder="请输入一级区域ID" maxlength="36">
|
||||
<input type="hidden" id="area4Name" name="area4Name" class="layui-input" value="" placeholder="请输入一级区域名称" maxlength="255">
|
||||
<div class="layui-input-block layui-form" id="area4SelectTemplateBox" lay-filter="area4SelectTemplateBox" style="margin-left: 150px;"></div>
|
||||
<script id="area4SelectTemplate" type="text/html">
|
||||
<select id="area4" name="area4" lay-filter="area4">
|
||||
<option value="">请选择四级地区名称</option>
|
||||
{{# for(var i = 0, item; item = d[i++];) { }}
|
||||
<option value="{{item.areaId}},{{item.areaLng}},{{item.areaLat}},{{item.areaName}}">{{item.areaName}}</option>
|
||||
{{# } }}
|
||||
</select>
|
||||
</script>
|
||||
<label class="layui-form-label">所在地</label>
|
||||
<input type="hidden" id="locationCode" name="locationCode" class="layui-input" value="" placeholder="请输入一级区域名称" maxlength="255">
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="location" name="location" class="layui-input" value="" placeholder="点击选择所在地" maxlength="11">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 五级区域 -->
|
||||
<div class="layui-col-lg6">
|
||||
<label class="layui-form-label" style="width: 150px;">五级地区</label>
|
||||
<input type="hidden" id="area5Id" name="area5Id" class="layui-input" value="" placeholder="请输入一级区域ID" maxlength="36">
|
||||
<input type="hidden" id="area5Name" name="area5Name" class="layui-input" value="" placeholder="请输入一级区域名称" maxlength="255">
|
||||
<div class="layui-input-block layui-form" id="area5SelectTemplateBox" lay-filter="area5SelectTemplateBox" style="margin-left: 150px;"></div>
|
||||
<script id="area5SelectTemplate" type="text/html">
|
||||
<select id="area5" name="area5" lay-filter="area5">
|
||||
<option value="">请选择五级地区名称</option>
|
||||
<label class="layui-form-label">所属网格</label>
|
||||
<div class="layui-input-block layui-form" id="gridSelectTemplateBox" lay-filter="gridSelectTemplateBox"></div>
|
||||
<script id="gridSelectTemplate" type="text/html">
|
||||
<select id="grid" name="grid" lay-filter="grid">
|
||||
<option value="">请选择网格</option>
|
||||
{{# for(var i = 0, item; item = d[i++];) { }}
|
||||
<option value="{{item.areaId}},{{item.areaLng}},{{item.areaLat}},{{item.areaName}}">{{item.areaName}}</option>
|
||||
<option value="{{item.gridId}}">{{item.gridName}}</option>
|
||||
{{# } }}
|
||||
</select>
|
||||
</script>
|
||||
@ -211,6 +150,52 @@
|
||||
var wangEditor = window.wangEditor;
|
||||
var wangEditorObj = {};
|
||||
|
||||
// 选择所在地
|
||||
$(document).on('click', '#location', function() {
|
||||
top.dialog.open({
|
||||
title: '选择地区',
|
||||
url: top.restAjax.path('route/area/get-select?areaName={areaName}', [encodeURI($('#location').val())]),
|
||||
width: '800px',
|
||||
height: '225px',
|
||||
onClose: function () {
|
||||
var selectedAreaArray = top.dialog.dialogData.selectedAreaArray;
|
||||
var areaCode = '';
|
||||
var areaName = '';
|
||||
if (selectedAreaArray.length > 0) {
|
||||
areaCode = selectedAreaArray[selectedAreaArray.length - 1].areaCode;
|
||||
for (var i = 0, item; item = selectedAreaArray[i++];) {
|
||||
if (areaName) {
|
||||
areaName += ',';
|
||||
}
|
||||
areaName += item.areaName;
|
||||
}
|
||||
}
|
||||
$('#locationCode').val(areaCode);
|
||||
$('#location').val(areaName);
|
||||
initGridSelect(areaCode);
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
// 初始化地区网格
|
||||
function initGridSelect(areaCode) {
|
||||
if(!areaCode) {
|
||||
laytpl(document.getElementById('gridSelectTemplate').innerHTML).render([], function(html) {
|
||||
document.getElementById('gridSelectTemplateBox').innerHTML = html;
|
||||
});
|
||||
form.render('select', 'gridSelectTemplateBox');
|
||||
return;
|
||||
}
|
||||
top.restAjax.get(top.restAjax.path('api/residential/grid-list/{areaCode}', [areaCode]), {}, null, function(code, data, args) {
|
||||
laytpl(document.getElementById('gridSelectTemplate').innerHTML).render(data, function(html) {
|
||||
document.getElementById('gridSelectTemplateBox').innerHTML = html;
|
||||
});
|
||||
form.render('select', 'gridSelectTemplateBox');
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
});
|
||||
}
|
||||
|
||||
// 初始化任务一级地区下拉选择
|
||||
function initArea1Select() {
|
||||
top.restAjax.get(top.restAjax.path('api/area/listbyparentid/0', []), {}, null, function(code, data, args) {
|
||||
@ -481,11 +466,15 @@
|
||||
// 初始化内容
|
||||
function initData() {
|
||||
initRemakeRichText();
|
||||
initArea1Select();
|
||||
initGridSelect();
|
||||
var lng = '113.137743';
|
||||
var lat = '41.002057';
|
||||
initMap(lng, lat);
|
||||
/*initArea1Select();
|
||||
initArea2Select();
|
||||
initArea3Select();
|
||||
initArea4Select();
|
||||
initArea5Select();
|
||||
initArea5Select();*/
|
||||
}
|
||||
initData();
|
||||
|
||||
|
@ -68,83 +68,22 @@
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item layui-row">
|
||||
<!-- 一级区域 -->
|
||||
<div class="layui-col-lg4">
|
||||
<label class="layui-form-label" style="width: 150px;">一级地区</label>
|
||||
<input type="hidden" id="area1Id" name="area1Id" class="layui-input" value="" placeholder="请输入一级区域ID" maxlength="36">
|
||||
<input type="hidden" id="area1Name" name="area1Name" class="layui-input" value="" placeholder="请输入一级区域名称" maxlength="255">
|
||||
<div class="layui-input-block layui-form" id="area1SelectTemplateBox" lay-filter="area1SelectTemplateBox" style="margin-left: 150px;"></div>
|
||||
<script id="area1SelectTemplate" type="text/html">
|
||||
<select id="area1" name="area1" lay-filter="area1">
|
||||
<option value="">请选择一级地区名称</option>
|
||||
{{# for(var i = 0, item; item = d[i++];) { }}
|
||||
<option value="{{item.areaId}},{{item.areaLng}},{{item.areaLat}},{{item.areaName}}">{{item.areaName}}</option>
|
||||
{{# } }}
|
||||
</select>
|
||||
</script>
|
||||
</div>
|
||||
|
||||
<!-- 二级区域 -->
|
||||
<div class="layui-col-lg4">
|
||||
<label class="layui-form-label" style="width: 150px;">二级地区</label>
|
||||
<input type="hidden" id="area2Id" name="area2Id" class="layui-input" value="" placeholder="请输入一级区域ID" maxlength="36">
|
||||
<input type="hidden" id="area2Name" name="area2Name" class="layui-input" value="" placeholder="请输入一级区域名称" maxlength="255">
|
||||
<div class="layui-input-block layui-form" id="area2SelectTemplateBox" lay-filter="area2SelectTemplateBox" style="margin-left: 150px;"></div>
|
||||
<script id="area2SelectTemplate" type="text/html">
|
||||
<select id="area2" name="area2" lay-filter="area2">
|
||||
<option value="">请选择二级地区名称</option>
|
||||
{{# for(var i = 0, item; item = d[i++];) { }}
|
||||
<option value="{{item.areaId}},{{item.areaLng}},{{item.areaLat}},{{item.areaName}}">{{item.areaName}}</option>
|
||||
{{# } }}
|
||||
</select>
|
||||
</script>
|
||||
</div>
|
||||
|
||||
<!-- 三级区域 -->
|
||||
<div class="layui-col-lg4">
|
||||
<label class="layui-form-label" style="width: 150px;">三级地区</label>
|
||||
<input type="hidden" id="area3Id" name="area3Id" class="layui-input" value="" placeholder="请输入一级区域ID" maxlength="36">
|
||||
<input type="hidden" id="area3Name" name="area3Name" class="layui-input" value="" placeholder="请输入一级区域名称" maxlength="255">
|
||||
<div class="layui-input-block layui-form" id="area3SelectTemplateBox" lay-filter="area3SelectTemplateBox" style="margin-left: 150px;"></div>
|
||||
<script id="area3SelectTemplate" type="text/html">
|
||||
<select id="area3" name="area3" lay-filter="area3">
|
||||
<option value="">请选择三级地区名称</option>
|
||||
{{# for(var i = 0, item; item = d[i++];) { }}
|
||||
<option value="{{item.areaId}},{{item.areaLng}},{{item.areaLat}},{{item.areaName}}">{{item.areaName}}</option>
|
||||
{{# } }}
|
||||
</select>
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item layui-row">
|
||||
<!-- 四级区域 -->
|
||||
<div class="layui-col-lg6">
|
||||
<label class="layui-form-label" style="width: 150px;">四级地区</label>
|
||||
<input type="hidden" id="area4Id" name="area4Id" class="layui-input" value="" placeholder="请输入一级区域ID" maxlength="36">
|
||||
<input type="hidden" id="area4Name" name="area4Name" class="layui-input" value="" placeholder="请输入一级区域名称" maxlength="255">
|
||||
<div class="layui-input-block layui-form" id="area4SelectTemplateBox" lay-filter="area4SelectTemplateBox" style="margin-left: 150px;"></div>
|
||||
<script id="area4SelectTemplate" type="text/html">
|
||||
<select id="area4" name="area4" lay-filter="area4">
|
||||
<option value="">请选择四级地区名称</option>
|
||||
{{# for(var i = 0, item; item = d[i++];) { }}
|
||||
<option value="{{item.areaId}},{{item.areaLng}},{{item.areaLat}},{{item.areaName}}">{{item.areaName}}</option>
|
||||
{{# } }}
|
||||
</select>
|
||||
</script>
|
||||
<label class="layui-form-label">所在地</label>
|
||||
<input type="hidden" id="locationCode" name="locationCode" class="layui-input" value="" placeholder="请输入一级区域名称" maxlength="255">
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="location" name="location" class="layui-input" value="" placeholder="点击选择所在地" maxlength="11">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 五级区域 -->
|
||||
<div class="layui-col-lg6">
|
||||
<label class="layui-form-label" style="width: 150px;">五级地区</label>
|
||||
<input type="hidden" id="area5Id" name="area5Id" class="layui-input" value="" placeholder="请输入一级区域ID" maxlength="36">
|
||||
<input type="hidden" id="area5Name" name="area5Name" class="layui-input" value="" placeholder="请输入一级区域名称" maxlength="255">
|
||||
<div class="layui-input-block layui-form" id="area5SelectTemplateBox" lay-filter="area5SelectTemplateBox" style="margin-left: 150px;"></div>
|
||||
<script id="area5SelectTemplate" type="text/html">
|
||||
<select id="area5" name="area5" lay-filter="area5">
|
||||
<option value="">请选择五级地区名称</option>
|
||||
<label class="layui-form-label">所属网格</label>
|
||||
<div class="layui-input-block layui-form" id="gridSelectTemplateBox" lay-filter="gridSelectTemplateBox"></div>
|
||||
<script id="gridSelectTemplate" type="text/html">
|
||||
<select id="grid" name="grid" lay-filter="grid">
|
||||
<option value="">请选择网格</option>
|
||||
{{# for(var i = 0, item; item = d[i++];) { }}
|
||||
<option value="{{item.areaId}},{{item.areaLng}},{{item.areaLat}},{{item.areaName}}">{{item.areaName}}</option>
|
||||
<option value="{{item.gridId}}">{{item.gridName}}</option>
|
||||
{{# } }}
|
||||
</select>
|
||||
</script>
|
||||
@ -214,6 +153,56 @@
|
||||
var wangEditor = window.wangEditor;
|
||||
var wangEditorObj = {};
|
||||
|
||||
// 选择所在地
|
||||
$(document).on('click', '#location', function() {
|
||||
top.dialog.open({
|
||||
title: '选择地区',
|
||||
url: top.restAjax.path('route/area/get-select?areaName={areaName}', [encodeURI($('#location').val())]),
|
||||
width: '800px',
|
||||
height: '225px',
|
||||
onClose: function () {
|
||||
var selectedAreaArray = top.dialog.dialogData.selectedAreaArray;
|
||||
var areaCode = '';
|
||||
var areaName = '';
|
||||
if (selectedAreaArray.length > 0) {
|
||||
areaCode = selectedAreaArray[selectedAreaArray.length - 1].areaCode;
|
||||
for (var i = 0, item; item = selectedAreaArray[i++];) {
|
||||
if (areaName) {
|
||||
areaName += ',';
|
||||
}
|
||||
areaName += item.areaName;
|
||||
}
|
||||
}
|
||||
$('#locationCode').val(areaCode);
|
||||
$('#location').val(areaName);
|
||||
initGridSelect(areaCode);
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
// 初始化地区网格
|
||||
function initGridSelect(areaCode, selectValue) {
|
||||
if(!areaCode) {
|
||||
laytpl(document.getElementById('gridSelectTemplate').innerHTML).render([], function(html) {
|
||||
document.getElementById('gridSelectTemplateBox').innerHTML = html;
|
||||
});
|
||||
form.render('select', 'gridSelectTemplateBox');
|
||||
return;
|
||||
}
|
||||
top.restAjax.get(top.restAjax.path('api/residential/grid-list/{areaCode}', [areaCode]), {}, null, function(code, data, args) {
|
||||
laytpl(document.getElementById('gridSelectTemplate').innerHTML).render(data, function(html) {
|
||||
document.getElementById('gridSelectTemplateBox').innerHTML = html;
|
||||
});
|
||||
form.render('select', 'gridSelectTemplateBox');
|
||||
|
||||
var selectObj = {};
|
||||
selectObj['grid'] = selectValue;
|
||||
form.val('dataForm', selectObj);
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
});
|
||||
}
|
||||
|
||||
// 初始化任务一级地区下拉选择
|
||||
function initArea1Select(selectValue, value, dataValue) {
|
||||
if(!dataValue) {
|
||||
@ -528,7 +517,7 @@
|
||||
}
|
||||
form.val('dataForm', dataFormData);
|
||||
form.render(null, 'dataForm');
|
||||
var area1Data = data['area1Id'] + ',' + data['area1Lng'] + ',' + data['area1Lat'] + ',' + data['area1Name'];
|
||||
/*var area1Data = data['area1Id'] + ',' + data['area1Lng'] + ',' + data['area1Lat'] + ',' + data['area1Name'];
|
||||
var area2Data = data['area2Id'] + ',' + data['area2Lng'] + ',' + data['area2Lat'] + ',' + data['area2Name'];
|
||||
var area3Data = data['area3Id'] + ',' + data['area3Lng'] + ',' + data['area3Lat'] + ',' + data['area3Name'];
|
||||
var area4Data = data['area4Id'] + ',' + data['area4Lng'] + ',' + data['area4Lat'] + ',' + data['area4Name'];
|
||||
@ -537,9 +526,15 @@
|
||||
initArea2Select(area1Data, area2Data, area2Data);
|
||||
initArea3Select(area2Data, area3Data, area3Data);
|
||||
initArea4Select(area3Data, area4Data, area4Data);
|
||||
initArea5Select(area4Data, area5Data, area5Data);
|
||||
|
||||
initArea5Select(area4Data, area5Data, area5Data);*/
|
||||
initGridSelect(data['locationCode'], data['grid']);
|
||||
if(!data['longitude']) {
|
||||
var lng = '113.137743';
|
||||
var lat = '41.002057';
|
||||
initMap(lng, lat);
|
||||
}else {
|
||||
initMap(data['longitude'], data['latitude']);
|
||||
}
|
||||
initRemakeRichText(data['remake']);
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
|
Loading…
Reference in New Issue
Block a user