This commit is contained in:
wans 2022-11-30 00:37:10 +08:00
parent 04253b940e
commit 1af0a498aa
23 changed files with 716 additions and 85 deletions

View File

@ -37,6 +37,18 @@ public class GridController extends AbstractController {
@Qualifier("cityGridService")
private IGridService gridService;
/**
* 复制一个网格
* @return
* @throws Exception
*/
@PutMapping("update-copy-grid/{gridId}")
public SuccessResult updateCopyGrid(@PathVariable("gridId") String gridId,
@RequestBody Map<String, Object> params) throws Exception {
gridService.updateCopyGrid(gridId, params);
return new SuccessResult();
}
@ApiOperation(value = "新增网格", notes = "新增网格接口")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@PostMapping("save")

View File

@ -209,6 +209,14 @@ public class ReportCaseController extends AbstractController {
return reportCaseDTO;
}
@GetMapping("getreportcasefordel/{reportCaseId}")
public ReportCaseDTO getReportCaseForDel(@PathVariable("reportCaseId") String reportCaseId) throws SearchException {
Map<String, Object> params = getParams();
params.put("reportCaseId", reportCaseId);
ReportCaseDTO reportCaseDTO = reportCaseService.getReportCaseForDel(params);
return reportCaseDTO;
}
@ApiOperation(value = "分页上报案件列表", notes = "分页上报案件列表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "当前页码", paramType = "form", dataType = "Integer", defaultValue = "1"),

View File

@ -5,6 +5,7 @@ import com.cm.common.component.SecurityComponent;
import com.cm.common.constants.ISystemConstant;
import com.cm.common.exception.ParamsException;
import com.cm.common.exception.SearchException;
import com.cm.common.plugin.oauth.service.user.IUserService;
import com.cm.common.pojo.ListPage;
import com.cm.common.pojo.dtos.department.DepartmentSortDTO;
import com.cm.common.result.ErrorResult;
@ -26,6 +27,7 @@ import com.cm.systemcity.service.bindingdepartment.IBindingDepartmentService;
import com.cm.systemcity.service.community.ICommunityService;
import com.cm.systemcity.service.communityboss.ICommunityBossService;
import com.cm.systemcity.service.dict.IDictService;
import com.cm.systemcity.service.grid.IGridService;
import com.cm.systemcity.service.readstate.IReadStateService;
import com.cm.systemcity.service.reportcase.IReportCaseService;
import com.cm.systemcity.service.userlocation.IUserLocationService;
@ -73,6 +75,71 @@ public class DataReleaseController extends AbstractController {
private ICommunityBossService communityBossService;
@Autowired
private IBindingDepartmentService bindingDepartmentService;
@Autowired
private IGridService gridService;
/**
* 大数据网格详情页接口
*/
@GetMapping("get-big-data-grid-detail")
public Map<String, Object> listBigDataGridDetail(){
Map<String, Object> query = requestParams();
Map<String, Object> res = new HashMap<>(8);
if(query.get("gridId") == null || "".equals(query.get("gridId").toString())){
return res;
}
String gridId = query.get("gridId").toString();
// 查询网格信息
com.cm.systemcity.pojo.dtos.grid.GridDTO gridDTO = gridService.get(gridId);
res.put("gridInfo", gridDTO);
// 查询网格内所有网格员或专管员
List<Map<String, Object>> gridUserList = dataReleaseDao.listUserByGridId(gridId);
for(Map<String, Object> item : gridUserList){
// 判断用户是否为专管员
String userId = item.get("userId").toString();
Map<String, Object> roleObj = dataReleaseDao.getUserRoleForCheckNPerson(userId);
item.put("deptOrCommunity", "");
item.put("reportCaseNum", "0");
item.put("handleCaseNum", "0");
if(roleObj != null){
// 专管员
List<Map<String, Object>> usersDept = dataReleaseDao.listDepartmentByUserId(userId);
String deptNames = "";
for(Map<String, Object> deptItem : usersDept){
if("".equals(deptNames)){
deptNames += deptItem.get("departmentName").toString();
} else{
deptNames += "," + deptItem.get("departmentName").toString();
}
}
item.put("deptOrCommunity", deptNames);
// 查询案件信息
item.put("reportCaseNum", "-");
List<Map<String, Object>> handleCaseNum = dataReleaseDao.listHandleCaseByUserId(userId);
item.put("handleCaseNum", handleCaseNum.size());
} else {
// 网格员
query.put("communityBossUserId", userId);
CommunityBossDTO communityBoss = communityBossService.getCommunityBoss(query);
query.put("communityId", communityBoss.getCommunityId());
CommunityDTO community = communityService.getCommunity(query);
String deptOrCommunity = "";
deptOrCommunity += communityBoss.getAreaName();
if(community != null){
deptOrCommunity += "/" + community.getCommunityName();
}
item.put("deptOrCommunity", deptOrCommunity);
// 查询案件信息
query.put("creator", userId);
List<Map<String, Object>> listReport = dataReleaseDao.listReportCase(query);
item.put("reportCaseNum", listReport.size());
List<Map<String, Object>> handleCaseNum = dataReleaseDao.listHandleCaseByUserId(userId);
item.put("handleCaseNum", handleCaseNum.size());
}
}
res.put("gridUser", gridUserList == null ? new ArrayList<>(0) : gridUserList);
return res;
}
/**
* 大数据二级页面-地图大网格

View File

@ -24,6 +24,12 @@ public class GridRouteController {
@Autowired
private IConfigService configService;
@GetMapping("copy-grid")
public ModelAndView copyGrid() {
ModelAndView mv = new ModelAndView("grid/grid/default/copy-grid");
return mv;
}
@GetMapping("save")
public ModelAndView save() {
ModelAndView mv = new ModelAndView("grid/grid/default/save");

View File

@ -90,4 +90,14 @@ public interface IDataReleaseDao {
Integer countOfBasePopulation(Map<String, Object> query);
Map<String, Object> getDataArea(Map<String, Object> query);
Map<String, Object> getGridById(Map<String, Object> query);
List<Map<String, Object>> listUserByGridId(String gridId);
Map<String, Object> getUserRoleForCheckNPerson(String userId);
List<Map<String, Object>> listDepartmentByUserId(String userId);
List<Map<String, Object>> listHandleCaseByUserId(String userId);
}

View File

@ -374,4 +374,6 @@ public interface IReportCaseDao {
List<ReportCaseHandleDTO> listReportByCaseTypes(Map<String, Object> params);
List<ReportCaseDTO> listPageReportDelete(Map<String, Object> params);
ReportCaseDTO getReportCaseForDel(Map<String, Object> params);
}

View File

@ -26,6 +26,7 @@ public class EasyUITreeDTO implements Serializable {
private String areaId;
private String communityId;
private List<EasyUITreeDTO> children;
private String nodeTag;
public EasyUITreeDTO() {
}

View File

@ -123,17 +123,20 @@ public class AreaPointsServiceImpl extends AbstractService implements IAreaPoint
@Override
public List<EasyUITreeDTO> listAreaTree(Map<String, Object> params) throws SearchException, AccessTokenException {
mongoTemplate.remove(new Query(), "INDEX_PANEL_GRID_TREE");
List<EasyUITreeDTO> easyUITreeDTOs = mongoTemplate.find(new Query(), EasyUITreeDTO.class, "INDEX_PANEL_GRID_TREE");
if (easyUITreeDTOs.isEmpty()) {
easyUITreeDTOs = new ArrayList<>();
// 设置顶级标题
EasyUITreeDTO areaEasyUITreeDTO = createAreaTreeDTO("areaTop", "所有网格", "icon-area");
areaEasyUITreeDTO.setNodeTag("top");
// 设置街道
areaEasyUITreeDTO.setChildren(setArea());
easyUITreeDTOs.add(areaEasyUITreeDTO);
// 设置专管单位
EasyUITreeDTO nPeopleEasyUITreeDTO = createAreaTreeDTO("deptTop", "专管单位", "icon-person-type");
nPeopleEasyUITreeDTO.setNodeTag("top");
List<DepartmentSortDTO> departmentSortDTOs = bindingDepartmentService.listDepartmentForMainPanel(getHashMap(4));
nPeopleEasyUITreeDTO.setChildren(nPeopleToTreeDTO(departmentSortDTOs));
easyUITreeDTOs.add(nPeopleEasyUITreeDTO);
@ -160,6 +163,7 @@ public class AreaPointsServiceImpl extends AbstractService implements IAreaPoint
dto.setAreaId(item.getDictId());
//dto.setChildren(setGridUser(item.getDictId(), ""));
dto.setChildren(setCommunity(item.getDictId()));
dto.setNodeTag("street");
resList.add(dto);
}
return resList;
@ -179,6 +183,7 @@ public class AreaPointsServiceImpl extends AbstractService implements IAreaPoint
dto.setAreaId(areaId);
dto.setCommunityId(item.getCommunityId());
dto.setChildren(setGridUser(areaId, item.getCommunityId()));
dto.setNodeTag("community");
resList.add(dto);
}
return resList;
@ -197,6 +202,7 @@ public class AreaPointsServiceImpl extends AbstractService implements IAreaPoint
dto.setIconCls("icon-person");
dto.setAreaId(areaId);
dto.setChildren(new ArrayList<>());
dto.setNodeTag("user");
resList.add(dto);
}
return resList;
@ -213,6 +219,7 @@ public class AreaPointsServiceImpl extends AbstractService implements IAreaPoint
departmentSortDTOs.forEach(departmentSortDTO -> {
EasyUITreeDTO easyUITreeDTO = new EasyUITreeDTO("dept_" + departmentSortDTO.getDepartmentId(), departmentSortDTO.getDepartmentName(), null, "icon-person-type");
easyUITreeDTO.setChildren(setNPerson(departmentSortDTO.getDepartmentId()));
easyUITreeDTO.setNodeTag("dept");
resList.add(easyUITreeDTO);
});
return resList;
@ -231,6 +238,7 @@ public class AreaPointsServiceImpl extends AbstractService implements IAreaPoint
dto.setAreaId("");
dto.setDepartmentId(departmentId);
dto.setChildren(new ArrayList<>());
dto.setNodeTag("user");
resList.add(dto);
}
return resList;

View File

@ -312,4 +312,6 @@ public interface IGridService {
* @return
*/
SuccessResultList<List<GridDTO>> listPageNotMine(String token, ListPage page);
void updateCopyGrid(String gridId, Map<String, Object> params);
}

View File

@ -11,6 +11,8 @@ import com.cm.common.utils.WStringUtil;
import com.cm.common.utils.point.Point;
import com.cm.common.utils.point.PointUtil;
import com.cm.systemcity.dao.grid.IGridDao;
import com.cm.systemcity.pojo.dtos.community.CommunityDTO;
import com.cm.systemcity.pojo.dtos.dict.DictDTO;
import com.cm.systemcity.pojo.dtos.grid.GridDTO;
import com.cm.systemcity.pojo.dtos.grid.GridPointDTO;
import com.cm.systemcity.pojo.dtos.grid.GridRelationDTO;
@ -18,6 +20,8 @@ import com.cm.systemcity.pojo.pos.grid.GridPO;
import com.cm.systemcity.pojo.vos.grid.GridPointVO;
import com.cm.systemcity.pojo.vos.grid.GridVO;
import com.cm.systemcity.service.BaseService;
import com.cm.systemcity.service.community.ICommunityService;
import com.cm.systemcity.service.dict.IDictService;
import com.cm.systemcity.service.grid.IGridPointService;
import com.cm.systemcity.service.grid.IGridRelationService;
import com.cm.systemcity.service.grid.IGridService;
@ -51,6 +55,45 @@ public class GridServiceImpl extends BaseService implements IGridService {
private IGridRelationService gridRelationService;
@Autowired
private IGridPointService gridPointService;
@Autowired
private ICommunityService communityService;
@Override
public void updateCopyGrid(String gridId, Map<String, Object> params) {
Map<String, Object> copyMap = new HashMap<>(8);
copyMap.put("gridId", UUIDUtil.getUUID());
copyMap.put("gridName", params.get("gridName") == null ? "" : params.get("gridName").toString());
copyMap.put("gridSummary", params.get("gridSummary") == null ? "" : params.get("gridSummary").toString());
copyMap.put("gridGroupId", params.get("gridGroupId") == null ? "" : params.get("gridGroupId").toString());
copyMap.put("gridDuty", params.get("gridDuty") == null ? "" : params.get("gridDuty").toString());
String areaCode = params.get("areaCode") == null ? "" : params.get("areaCode").toString();
String area1 = params.get("area1") == null ? "" : params.get("area1").toString();
String gridCode = getSaveGridCode(areaCode + area1);
copyMap.put("gridCode", gridCode);
List<GridPointDTO> list = gridPointService.list(gridId);
List<GridPointVO> pointList = new ArrayList<>(0);
for(GridPointDTO item : list){
GridPointVO temp = new GridPointVO();
temp.setGridId(item.getGridId());
temp.setLat(item.getLat());
temp.setLng(item.getLng());
pointList.add(temp);
}
copyMap.put("gridSquare", getSquare(pointList));
copyMap.put("areaCode", areaCode + area1);
Map<String, Object> query = new HashMap<>(4);
query.put("communityId",area1);
CommunityDTO community = communityService.getCommunity(query);
copyMap.put("areaName", community.getAreaName() + "/" + community.getCommunityName());
// 查询被复制的网格
query.put("gridId", gridId);
GridDTO gridDTO = gridDao.get(query);
copyMap.put("fillColor",gridDTO.getFillColor());
setSaveInfo(copyMap);
gridDao.save(copyMap);
// 保存网格点
gridPointService.save(copyMap.get("gridId").toString(), pointList);
}
@Override
public void save(GridVO gridVO) throws Exception {

View File

@ -454,4 +454,6 @@ public interface IReportCaseService {
* @param query
*/
void updateBackDeleteCase(Map<String, Object> query);
ReportCaseDTO getReportCaseForDel(Map<String, Object> params);
}

View File

@ -253,6 +253,11 @@ public class ReportCaseServiceImpl extends BaseService implements IReportCaseSer
return reportCaseDao.getReportCase(params);
}
@Override
public ReportCaseDTO getReportCaseForDel(Map<String, Object> params) {
return reportCaseDao.getReportCaseForDel(params);
}
@Override
public ReportCaseDTO getReportCase(String token, Map<String, Object> params) throws SearchException {
ReportCaseDTO dto = reportCaseDao.getReportCase(params);
@ -710,6 +715,9 @@ public class ReportCaseServiceImpl extends BaseService implements IReportCaseSer
return new SuccessResult();
}
if(0 == handleStatus){
// 2022年10月25日 案件如果不处理需要管理员确认后才可退回 修改原来直接退回的逻辑
Map<String, Object> query = new HashMap<>(8);
query.put("caseId", params.get("caseId").toString());
query.put("reportCaseId", params.get("caseId").toString());

View File

@ -18,6 +18,7 @@ import com.cm.plugin.map.pojo.dto.GridDTO;
import com.cm.plugin.map.pojo.dto.GridPointDTO;
import com.cm.plugin.map.pojo.vo.GridVO;
import com.cm.plugin.map.service.IGridService;
import com.cm.systemcity.dao.datarelease.IDataReleaseDao;
import com.cm.systemcity.dao.reportcase.IReportCaseDao;
import com.cm.systemcity.dao.userpoints.IUserPointsDao;
import com.cm.systemcity.enums.MongoCollections;
@ -69,7 +70,7 @@ public class UserPointsServiceImpl extends AbstractService implements IUserPoint
@Autowired
private IUserService userService;
@Autowired
private IDictService dictService;
private IDataReleaseDao dataReleaseDao;
@Autowired
private IGridService gridService;
@Autowired

View File

@ -196,6 +196,9 @@
</if>
<if test="weChat == false">
AND t1.user_username NOT LIKE 'WX%'
AND t1.user_username NOT LIKE 'admin%'
AND t1.user_username NOT LIKE 'test%'
AND t1.user_username NOT LIKE '测试%'
</if>
<if test="userIds != null and userIds.size > 0">
AND

View File

@ -2,6 +2,50 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.cm.systemcity.dao.datarelease.IDataReleaseDao">
<select id="listHandleCaseByUserId" parameterType="string" resultType="map">
SELECT
*
FROM
city_report_case_handle
WHERE
creator = #{userId}
</select>
<select id="listDepartmentByUserId" parameterType="string" resultType="map">
SELECT
t1.department_id departmentId,
t2.department_name departmentName
FROM
sys_department_user t1
LEFT JOIN sys_department t2 ON t1.department_id = t2.department_id
WHERE
t1.user_id = #{userId}
</select>
<select id="getUserRoleForCheckNPerson" parameterType="string" resultType="map">
SELECT
*
FROM
sys_role_user
WHERE
user_id = #{userId}
AND role_id = 'bc405346-8714-4ded-89ac-9cc4d755f66a'
</select>
<select id="listUserByGridId" parameterType="string" resultType="map">
SELECT
t2.user_id userId,
t2.user_name userName,
t2.user_username userAccount,
t2.user_phone userPhone
FROM
map_grid_relation t1
LEFT JOIN sys_user t2 on t1.relation_id = t2.user_id
WHERE
t1.grid_id = #{gridId}
AND t2.is_delete = '0'
</select>
<select id="getDataArea" parameterType="map" resultType="map">
select * from data_area where area_id = #{areaId}
</select>
@ -159,6 +203,9 @@
<if test="modifiedEnd != null and modifiedEnd !=''">
AND gmt_modified <![CDATA[<=]]> #{modifiedEnd}
</if>
<if test="creator != null and creator !=''">
AND creator = #{userId}
</if>
ORDER BY gmt_create DESC
</select>

View File

@ -245,6 +245,7 @@
LEFT(t1.gmt_modified, 19) gmt_modified
FROM
map_grid t1
LEFT JOIN map_grid_relation t2 ON t1.grid_id = t2.grid_id
WHERE
t1.is_delete = 0
<if test="keywords != null and keywords != ''">
@ -253,6 +254,9 @@
OR
t1.grid_summary LIKE CONCAT('%', #{keywords}, '%')
</if>
<if test="userSearchSelect !=null and userSearchSelect !=''">
AND FIND_IN_SET(#{userSearchSelect}, t2.relation_id)
</if>
<if test="gridIds != null and gridIds.size > 0">
AND
t1.grid_id IN
@ -294,6 +298,7 @@
relation_id = #{excludeRelationId}
)
</if>
GROUP BY t1.grid_id
</select>
<!-- 网格列表group -->

View File

@ -418,6 +418,16 @@
</if>
</select>
<select id="getReportCaseForDel" parameterType="map" resultMap="reportCaseDTO">
SELECT
t1.*
FROM
city_report_case t1
WHERE
t1.report_case_id = #{reportCaseId}
LIMIT 1
</select>
<!-- 新增上报案件受理信息 -->
<insert id="saveReportCaseAccept" parameterType="map">
INSERT INTO city_report_case_accept(

View File

@ -0,0 +1,115 @@
<!doctype html>
<html lang="zh-CN">
<head>
<base href="/servicecity/">
<meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11,chrome=1"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<link rel="stylesheet" type="text/css" href="assets/js/vendor/layui/css/layui.css"/>
</head>
<body>
<div class="layui-fluid layui-anim layui-anim-fadein">
<div class="layui-card">
<div class="layui-card-body">
<div class="layui-row layui-form layui-form-pane">
<div class="layui-col-md12 layui-col-sm12">
<div class="layui-col-md4 layui-col-sm4">
<div class="layui-form-item">
<label class="layui-form-label">网格名称</label>
<div class="layui-input-block">
<input type="text" id="gridName" class="layui-input" value="" readonly="readonly">
</div>
</div>
</div>
<div class="layui-col-md8 layui-col-sm8">
<div class="layui-form-item">
<label class="layui-form-label">网格所属</label>
<div class="layui-input-block">
<input type="text" id="areaName" class="layui-input" value="" readonly="readonly">
</div>
</div>
</div>
</div>
</div>
<div class="layui-row layui-form layui-form-pane">
<table class="layui-table">
<colgroup>
<col width="150">
<col width="150">
<col width="150">
<col width="150">
</colgroup>
<thead>
<tr>
<th style="text-align: center">姓名 [登录账号]</th>
<th style="text-align: center">所属部门或社区</th>
<th style="text-align: center">上报案件</th>
<th style="text-align: center">处理案件</th>
</tr>
</thead>
<tbody id="gridUserBox"></tbody>
<script type="text/html" id="gridUserTemplate">
{{# for(var i = 0, item; item = d[i++];) { }}
<tr>
<td style="text-align: center">{{item.userName}}[{{item.userAccount}}]</td>
<td style="text-align: center">{{item.deptOrCommunity}}</td>
<td style="text-align: center">
<a class="layui-btn layui-btn-normal layui-btn-xs">{{item.reportCaseNum}}</a>
</td>
<td style="text-align: center">
<a class="layui-btn layui-btn-normal layui-btn-xs">{{item.handleCaseNum}}</a>
</td>
</tr>
{{# } }}
</script>
</table>
</div>
</div>
</div>
</div>
<script type="text/javascript" src="assets/layuiadmin/layui/layui.js"></script>
<script type="text/javascript" src="assets/js/jquery-3.5.1.min.js"></script>
<script type="text/javascript" src="assets/js/restajax.js"></script>
<script type="text/javascript">
layui.config({
base: 'assets/layuiadmin/'
}).extend({
index: 'lib/index'
}).use(['index', 'table', 'laytpl', 'dialog', 'restajax'], function() {
var $ = layui.$;
var laytpl = layui.laytpl;
var table = layui.table;
var dialog = layui.dialog;
var restAjax = layui.restajax;
var gridId = restAjax.params(window.location.href).gridId;
function init() {
initGridDetails();
}
init();
function initGridDetails () {
restAjax.get(restAjax.path('app/data-external-release/get-big-data-grid-detail', []), {gridId : gridId}, null, function(code, data) {
$('#gridName').val(data['gridInfo'].gridName);
$('#areaName').val(data['gridInfo'].areaName);
initGridUser(data['gridUser']);
}, function(code, data) {
dialog.msg(data.msg);
});
}
function initGridUser(gridUser) {
if(typeof (gridUser) === 'undefined'){
laytpl(document.getElementById('gridUserTemplate').innerHTML).render([], function(html) {
document.getElementById('gridUserBox').innerHTML = html;
});
}
laytpl(document.getElementById('gridUserTemplate').innerHTML).render(gridUser, function(html) {
document.getElementById('gridUserBox').innerHTML = html;
});
}
});
</script>
</body>
</html>

View File

@ -374,6 +374,20 @@
}
});
}
if(obj.event === 'caseFlowEvent'){
layer.open({
type: 2,
title: '案件流程',
closeBtn: 1,
area: ['50%', '60%'],
shadeClose: true,
anim: 2,
content: top.restAjax.path('route/reportcase/list_case_log.html?reportCaseId={id}',
[obj.data.reportCaseId]),
end: function() {
}
});
}
if(obj.event === 'reportBack'){
top.dialog.confirm('确定恢复案件吗?', function(index) {
top.dialog.close(index);

View File

@ -201,7 +201,7 @@
function initData(){
var loadLayerIndex;
top.restAjax.get(top.restAjax.path('api/reportcase/getreportcase/{reportCaseId}', [reportCaseId]), {}, null, function(code, data) {
top.restAjax.get(top.restAjax.path('api/reportcase/getreportcasefordel/{reportCaseId}', [reportCaseId]), {}, null, function(code, data) {
var dataFormData = {};
for(var i in data) {
dataFormData[i] = data[i];

View File

@ -112,6 +112,7 @@
<script type="text/javascript" src="assets/js/vue.min.js"></script>
<script type="text/javascript" src="assets/js/common.js"></script>
<script type="text/javascript" src="assets/js/baidu-map-0.0.1.min.js"></script>
<script type="text/javascript" src="assets/js/vendor/layer/layer.js"></script>
<script type="text/javascript">
new Vue({
el: '#wrap',
@ -175,12 +176,17 @@
},
// 点击获取片区人员信息
getAreaUsersInfo: function(gridId) {
top.dialog.open({
title: '人员详情',
url: top.restAjax.path('route/userlocation/list-user-detail.html?gridId={gridId}', [gridId]),
width: '400px',
height: '400px'
})
layer.open({
type: 2,
title: '网格详情',
closeBtn: 1,
area: ['60%', '80%'],
shadeClose: false,
anim: 2,
content: top.restAjax.path('route/bigdata/grid-card-detail.html?gridId={gridId}',[gridId]),
end: function() {
}
});
},
// 绘制片区
@ -197,6 +203,8 @@
// self.addBasePoint(allPointArray);
for(var i = 0, item = data[i]; item = data[i++];) {
var points = [];
item['pointArray'] = item['gridPointList'];
item['fillColor'] = item['gridColor'];
for(var j = 0, point = item.pointArray[j]; point = item.pointArray[j++];) {
points.push(
new BaiduMap.Point(point.lng, point.lat)
@ -234,89 +242,35 @@
method: 'get',
lines: true,
onSelect: function(node){
var id = node.id;
if(id == 'areaTop'){
if(node.nodeTag == 'top'){
self.map.clearMap();
self.map.setCenterAndZoom({
lng: '109.9169990478825',
lat: '40.59520202810689'
}, 13);
self.initGridUser("1");
self.initGridUserV2(node.nodeTag, 13);
}
},
onClick: function(node) {
self.map.clearMap();
var id = node.id;
if(id.indexOf("area_") != -1){
var areaId = node.areaId;
self.initGridUser("1", areaId);
if(areaId == '7ed23f06-566d-43b7-acd9-4f0b5db08974'){
self.map.setCenterAndZoom({
lng: '109.858461',
lat: '40.635068'
}, 14);
}
if(areaId == '6e922367-f21f-4daf-b38c-c55a67d9a35b'){
self.map.setCenterAndZoom({
lng: '109.911867',
lat: '40.588804'
}, 14);
}
if(areaId == '8d62a0cc-2c15-4355-906c-6720f8f3617e'){
self.map.setCenterAndZoom({
lng: '109.927803',
lat: '40.583821'
}, 14);
}
if(node.nodeTag == 'street'){
self.initGridUserV2(node.nodeTag, 13, node.areaId);
}
if(id.indexOf("community_") != -1){
var areaId = node.areaId;
var communityId = node.communityId;
self.initGridUser("1", areaId, communityId);
if(areaId == '7ed23f06-566d-43b7-acd9-4f0b5db08974'){
self.map.setCenterAndZoom({
lng: '109.858461',
lat: '40.635068'
}, 14);
}
if(areaId == '6e922367-f21f-4daf-b38c-c55a67d9a35b'){
self.map.setCenterAndZoom({
lng: '109.911867',
lat: '40.588804'
}, 14);
}
if(areaId == '8d62a0cc-2c15-4355-906c-6720f8f3617e'){
self.map.setCenterAndZoom({
lng: '109.927803',
lat: '40.583821'
}, 14);
}
if(node.nodeTag == 'community'){
self.initGridUserV2(node.nodeTag, 15, node.communityId);
}
if(id.indexOf("areaUser_") != -1){
var areaId = node.areaId;
if(node.nodeTag == 'dept'){
var deptId = node.id.replace(/dept_/g, '');
self.initGridUserV2(node.nodeTag, 13, deptId);
}
if(node.nodeTag == 'user'){
var userId = node.id.replace(/areaUser_/g, '');
self.initGridUser("1", areaId, '', '', userId);
self.initGridUserV2(node.nodeTag, 17, userId);
}
if(id == 'deptTop'){
self.map.setCenterAndZoom({
lng: '109.9169990478825',
lat: '40.59520202810689'
}, 13);
self.initGridUser("2");
}
if(id.indexOf("dept_") != -1){
self.map.setCenterAndZoom({
lng: '109.9169990478825',
lat: '40.59520202810689'
}, 13);
var departmentIds = node.id.replace(/dept_/g, '');
self.initGridUser("2", '', '', departmentIds, '');
}
if(id.indexOf('nPerson_') != -1) {
//self.initNPersonArea(id.replace(/n_/g, ''));
var departmentId = node.departmentId;
if(node.nodeTag == 'user' && id.indexOf('nPerson_') != -1){
var userId = node.id.replace(/nPerson_/g, '');
self.initGridUser("2", '', '', departmentId, userId);
self.initGridUserV2(node.nodeTag, 15, userId);
}
},
onLoadSuccess: function() {
@ -327,6 +281,34 @@
});
},
initGridUserV2 : function(nodeTag, zoom, nodeId){
if(!zoom){
zoom = 13
}
var self = this;
var params = {
nodeTag : typeof (nodeTag) === 'undefined' ? '' : nodeTag,
nodeId : typeof (nodeId) === 'undefined' ? '' : nodeId
}
top.restAjax.get(top.restAjax.path('app/data-external-release/list-map-grid', []), params, null, function(code, data) {
if(typeof (data) != 'undefined' && data.length > 0){
// 划片
self.takeUserArea(data);
if(data[0]['gridPointList'].length <= 0){
return;
}
if(nodeTag != 'top'){
self.map.setCenterAndZoom({
lng: data[0]['gridPointList'][0].lng,
lat: data[0]['gridPointList'][0].lat
}, zoom);
}
}
}, function(code, data) {
top.dialog.msg(data.msg);
});
},
// 加载化网格片区 userType: 1 网格员 2 专管员
initGridUser : function(userType, areaId, communityId, departmentIds, userIds){
var self = this;

View File

@ -0,0 +1,231 @@
<!doctype html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<base th:href="${#request.getContextPath() + '/'}">
<meta charset="utf-8">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
<style>
.layui-form-label-up {width: 100% !important; height: 30px !important; line-height: 30px !important; border: none !important; padding: 0px !important; font-size: 15px; background-color: transparent !important; text-align: left !important;}
.layui-input-block-down {margin: 0px !important; left: 0px !important;}
.layui-input-block-down .layui-form-select .layui-edge {top: 74%;}
.select-area {position: relative;}
.select-area .select-btn {position: absolute; top: 30px; right: 0px; width: 36%; border-color: #e6e6e6;}
.select-area .select-btn button {height: 38px; width: 50%;}
</style>
</head>
<body>
<div class="layui-anim layui-anim-fadein">
<div class="layui-card">
<div class="layui-card-body" style="padding: 15px;">
<form class="layui-form layui-form-pane" lay-filter="dataForm">
<div class="layui-row">
<div id="formContainer" class="layui-row">
<div class="layui-col-md12 layui-col-sm12">
<div class="layui-form-item">
<label class="layui-form-label">选择网格组</label>
<div class="layui-input-block">
<div class="layui-input-block layui-input-block-down layui-form" id="gridGroupIdTemplateBox" lay-filter="gridGroupIdTemplateBox"></div>
<script id="gridGroupIdTemplate" type="text/html">
<select id="gridGroupId" name="gridGroupId" lay-filter="gridGroupId">
<option value="">选择网格组</option>
{{# for(var i = 0, item; item = d[i++];) { }}
<option value="{{item.gridGroupId}}">{{item.gridGroupName}}</option>
{{# } }}
</select>
</script>
</div>
</div>
</div>
<div class="layui-col-md12 layui-col-sm12">
<div class="layui-form-item">
<label class="layui-form-label">网格名称</label>
<div class="layui-input-block">
<input type="text" id="gridName" name="gridName" class="layui-input" value="" placeholder="请输入网格名称" maxlength="255" lay-verify="required">
</div>
</div>
</div>
<div class="layui-col-md12 layui-col-sm12">
<div class="layui-form-item">
<label class="layui-form-label" style="width: 200px;"><span style="color: #cc0000">*</span>该网格要复制到哪?</label>
<div class="layui-input-block" style="margin-left: 200px;">
<div class="layui-col-xs4" id="area0Box"></div>
<script id="area0Template" type="text/html">
<select id="area0" name="area0" lay-filter="area0">
<option value="">选择街道或专管区域</option>
{{# for(var i = 0, item; item = d[i++];) { }}
<option value="{{item.areaId}}" data-area-code="{{item.areaCode}}">{{item.areaName}}</option>
{{# } }}
</select>
</script>
<div class="layui-col-xs4" id="area1Box"></div>
<script id="area1Template" 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.areaName}}</option>
{{# } }}
</select>
</script>
</div>
</div>
</div>
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">网格描述</label>
<div class="layui-input-block">
<textarea id="gridSummary" name="gridSummary" class="layui-textarea" placeholder="请输入网格描述" maxlength="255"></textarea>
</div>
</div>
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">网格职责</label>
<div class="layui-input-block">
<textarea id="gridDuty" name="gridDuty" class="layui-textarea" placeholder="请输入网格职责" maxlength="255"></textarea>
</div>
</div>
<div class="layui-form-item layui-layout-admin">
<div class="layui-input-block">
<div class="layui-footer" style="left: 0;">
<button id="confirmBtn" type="button" class="layui-btn" lay-submit lay-filter="submitForm">提交编辑</button>
<button type="button" class="layui-btn layui-btn-primary close">返回上级</button>
</div>
</div>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
<script src="assets/layuiadmin/layui/layui.js"></script>
<script th:inline="javascript">
layui.config({
base: 'assets/layuiadmin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'form', 'laydate', 'laytpl'], function(){
var $ = layui.$;
var $win = $(window);
var form = layui.form;
var laytpl = layui.laytpl;
var queryParams = top.restAjax.params(window.location.href);
var gridId = queryParams.gridId;
function initData() {
$(".layui-card").height($win.height() - 30);
top.restAjax.get(top.restAjax.path('api/grid/get/{gridId}', [gridId]), {}, null, function(code, data) {
var dataFormData = {};
for(var i in data) {
dataFormData[i] = data[i] +'';
}
form.val('dataForm', dataFormData);
form.render(null, 'dataForm');
initGridGroupSelect(data.gridGroupId);
initAreaSelect();
initDeptCommunitySelect('');
}, function (code, data) {
top.dialog.msg(data.msg);
});
}
initData();
// 初始化网格组下拉选择
function initGridGroupSelect(selectValue) {
top.restAjax.get(top.restAjax.path('api/grid-group/list', []), {
}, null, function(code, data) {
laytpl(document.getElementById("gridGroupIdTemplate").innerHTML).render(data, function(html) {
document.getElementById("gridGroupIdTemplateBox").innerHTML = html;
});
form.val('dataForm', {gridGroupId : selectValue});
form.render('select');
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
// 初始化 街道或专管区域
function initAreaSelect() {
top.restAjax.get(top.restAjax.path('api/community/list-community-area/parent-id/{parentId}', [0]), {
}, null, function(code, data) {
laytpl(document.getElementById("area0Template").innerHTML).render(data, function(html) {
document.getElementById("area0Box").innerHTML = html;
});
form.render('select');
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
form.on('select(area0)', function(data){
var area0Value = data.value
initDeptCommunitySelect(area0Value);
});
// 初始化 专管单位或社区
function initDeptCommunitySelect(parentId) {
if(typeof (parentId) === 'undefined' || parentId == ''){
laytpl(document.getElementById("area1Template").innerHTML).render([], function(html) {
document.getElementById("area1Box").innerHTML = html;
});
form.render('select');
return;
}
top.restAjax.get(top.restAjax.path('api/community/list-community-area/parent-id/{parentId}', [parentId]), {
}, null, function(code, data) {
laytpl(document.getElementById("area1Template").innerHTML).render(data, function(html) {
document.getElementById("area1Box").innerHTML = html;
});
form.render('select');
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
// 提交表单
form.on('submit(submitForm)', function(formData) {
formData.field['areaCode'] = $('#area0').find('option:selected').data().areaCode;
top.dialog.confirm(top.dataMessage.commit, function(index) {
top.dialog.close(index);
var loadLayerIndex;
top.restAjax.put(top.restAjax.path('api/grid/update-copy-grid/{gridId}', [gridId]), formData.field, null, function(code, data) {
var layerIndex = top.dialog.msg(top.dataMessage.commitSuccess, {
time: 0,
btn: [top.dataMessage.button.yes, top.dataMessage.button.no],
shade: 0.3,
yes: function(index) {
top.dialog.close(index);
window.location.reload();
},
btn2: function() {
closeBox();
}
});
}, function(code, data) {
top.dialog.msg(data.msg);
}, function() {
loadLayerIndex = top.dialog.msg(top.dataMessage.committing, {icon: 16, time: 0, shade: 0.3});
}, function() {
top.dialog.close(loadLayerIndex);
});
});
return false;
});
function closeBox() {
parent.layer.close(parent.layer.getFrameIndex(window.name));
}
$('.close').on('click', function() {
closeBox();
});
// 校验
form.verify({
});
});
</script>
</body>
</html>

View File

@ -23,20 +23,30 @@
<div class="layui-card-body">
<div class="test-table-reload-btn" style="margin-bottom: 10px;">
<div class="layui-inline">
<input type="text" id="keywords" class="layui-input search-item search-item-width-100" placeholder="输入关键字">
<input type="text" id="keywords" class="layui-input" style="height: 38px;width:150px;" placeholder="输入关键字">
</div>
<!-- 地区选择 -->
<div class="layui-inline">
<input type="hidden" id="areaName"/>
<input type="hidden" id="areaCode"/>
<span class="search-item-key">地区</span>
<div class="layui-inline layui-form search-item ">
<span class="search-item-key">地区</span>
<div class="layui-inline layui-form">
<select id="area0" name="area0" lay-filter="area0Select"></select>
</div>
<div class="layui-inline layui-form search-item ">
<div class="layui-inline layui-form">
<select id="area1" name="area1" lay-filter="area1Select"></select>
</div>
</div>
<div class="layui-inline layui-form" style="width: 210px" id="userSearchSelectBox">
<script id="userSearchSelectTemplate" type="text/html">
<select id="userSearchSelect" name="gridGroupId" lay-filter="userSearchSelect" lay-search>
<option value="">按姓名查询(支持拼音检索)</option>
{{# for(var i = 0, item; item = d[i++];) { }}
<option value="{{item.user_id}}">{{item.user_name}}[{{item.user_username}}]</option>
{{# } }}
</select>
</script>
</div>
<!-- 地区选择 -->
<div class="layui-btn-group">
<button type="button" id="search" class="layui-btn layui-btn-sm">
@ -55,6 +65,9 @@
<button type="button" class="layui-btn layui-btn-normal layui-btn-sm" lay-event="updateEvent">
<i class="fa fa-lg fa-edit"></i> 网格修改
</button>
<button type="button" class="layui-btn layui-btn-warm layui-btn-sm" lay-event="copyEvent">
<i class="fa fa-lg fa-copy"></i> 复制网格
</button>
<button type="button" class="layui-btn layui-btn-danger layui-btn-sm" lay-event="removeEvent">
<i class="fa fa-lg fa-trash"></i> 删除
</button>
@ -72,18 +85,39 @@
base: 'assets/layuiadmin/'
}).extend({
index: 'lib/index'
}).use(['index', 'table', 'laydate', 'common', 'dialog'], function() {
}).use(['index', 'table', 'laydate', 'common', 'dialog', 'laytpl', 'form'], function() {
var $ = layui.$;
var $win = $(window);
var table = layui.table;
var admin = layui.admin;
var laydate = layui.laydate;
var common = layui.common;
var laytpl = layui.laytpl;
var form = layui.form;
var resizeTimeout = null;
var tableUrl = 'api/grid/listpage';
var layuiSelect = new LayuiSelect(layui);
var selectedAreaArray = [];
function init(){
initUserSearchSelect();
}
init();
// 初始化 按user下拉框
function initUserSearchSelect() {
top.restAjax.get(top.restAjax.path('api/bindingdepartment/list-all-sys-user', []), {
}, null, function(code, data) {
console.log(data);
laytpl(document.getElementById("userSearchSelectTemplate").innerHTML).render(data, function(html) {
document.getElementById("userSearchSelectBox").innerHTML = html;
});
form.render('select');
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
// 初始化表格
function initTable() {
table.render({
@ -103,7 +137,7 @@
[
{type:'checkbox', fixed: 'left'},
{field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '<span>{{d.LAY_INDEX}}</span>'},
{field: 'gridName', width: 120, title: '网格名称', align:'center',
{field: 'gridName', width: 160, title: '网格名称', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
@ -112,7 +146,7 @@
return rowData;
}
},
{field: 'gridDuty', width: 120, title: '职责', align:'center',
{field: 'areaName', width: 220, title: '地区名称', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
@ -130,7 +164,7 @@
return rowData;
}
},
{field: 'areaName', width: 180, title: '地区名称', align:'center',
{field: 'gridDuty', width: 120, title: '职责', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
@ -186,7 +220,8 @@
keywords: $('#keywords').val(),
startTime: $('#startTime').val(),
endTime: $('#endTime').val(),
areaCodeLike: $('#areaCode').val()
areaCodeLike: $('#areaCode').val(),
userSearchSelect : $('#userSearchSelect').val()
},
page: {
curr: currentPage
@ -354,6 +389,25 @@
}
});
}
} else if(layEvent === 'copyEvent') {
if(checkDatas.length === 0) {
top.dialog.msg(top.dataMessage.table.selectEdit);
} else if(checkDatas.length > 1) {
top.dialog.msg(top.dataMessage.table.selectOneEdit);
} else {
layer.open({
type: 2,
title: '复制网格',
closeBtn: 1,
area: ['80%', '80%'],
shadeClose: true,
anim: 2,
content: top.restAjax.path('route/grid/copy-grid?gridId={gridId}', [checkDatas[0].gridId]),
end: function () {
reloadTable();
}
});
}
} else if(layEvent === 'removeEvent') {
if(checkDatas.length === 0) {
top.dialog.msg(top.dataMessage.table.selectDelete);