bug修改。

This commit is contained in:
Renpc-kilig 2022-01-27 10:32:46 +08:00
parent ba124cc818
commit 71f12613f9
22 changed files with 923 additions and 43 deletions

View File

@ -108,4 +108,14 @@ public class BuildingController extends DefaultBaseController {
return new SuccessResultData<>(buildingService.count(params)); return new SuccessResultData<>(buildingService.count(params));
} }
/**
* 区域下数据数量
* 需要传入 areaParentId 统计该地区下级信息
*/
@GetMapping("data-counts")
public List<Map<String, Object>> dataCount(){
Map<String, Object> params = requestParams();
return buildingService.dataCount(params);
}
} }

View File

@ -108,4 +108,14 @@ public class BuildingHouseController extends DefaultBaseController {
return new SuccessResultData<>(buildingHouseService.count(params)); return new SuccessResultData<>(buildingHouseService.count(params));
} }
/**
* 区域下数据数量
* 需要传入 areaParentId 统计该地区下级信息
*/
@GetMapping("data-counts")
public List<Map<String, Object>> dataCount(){
Map<String, Object> params = requestParams();
return buildingHouseService.dataCount(params);
}
} }

View File

@ -129,4 +129,14 @@ public class ResidentialController extends DefaultBaseController {
return gridRemoteService.getGridList(sendUrl, areaCode, accessToken); return gridRemoteService.getGridList(sendUrl, areaCode, accessToken);
} }
/**
* 区域下数据数量
* 需要传入 areaParentId 统计该地区下级信息
*/
@GetMapping("data-counts")
public List<Map<String, Object>> dataCount(){
Map<String, Object> params = requestParams();
return residentialService.dataCount(params);
}
} }

View File

@ -123,4 +123,6 @@ public interface IBuildingDao {
* @throws UpdateException * @throws UpdateException
*/ */
void updateGrid(Map<String, Object> params) throws UpdateException; void updateGrid(Map<String, Object> params) throws UpdateException;
Integer dataCount(Map<String, Object> params) throws SearchException;
} }

View File

@ -135,4 +135,6 @@ public interface IBuildingHouseDao {
* @return * @return
*/ */
List<BuildingHouseDTO> getIdsByBuildingId(Map<String, Object> params); List<BuildingHouseDTO> getIdsByBuildingId(Map<String, Object> params);
Integer dataCount(Map<String, Object> params) throws SearchException;
} }

View File

@ -117,4 +117,5 @@ public interface IResidentialDao {
*/ */
Integer count(Map<String, Object> params) throws SearchException; Integer count(Map<String, Object> params) throws SearchException;
Integer dataCount(Map<String, Object> params) throws SearchException;
} }

View File

@ -190,4 +190,11 @@ public interface IBuildingService {
* @param params * @param params
*/ */
void updateGrid(Map<String, Object> params); void updateGrid(Map<String, Object> params);
/**
* 区域下数量
* @param params
* @return
*/
List<Map<String, Object>> dataCount(Map<String, Object> params);
} }

View File

@ -18,10 +18,13 @@ import cn.com.tenlion.systemhouse.service.buildinghouse.IBuildingHouseService;
import cn.com.tenlion.systemhouse.service.community.ICommunityService; import cn.com.tenlion.systemhouse.service.community.ICommunityService;
import cn.com.tenlion.systemhouse.service.grid.IGridService; import cn.com.tenlion.systemhouse.service.grid.IGridService;
import cn.com.tenlion.systemhouse.service.residential.IResidentialService; import cn.com.tenlion.systemhouse.service.residential.IResidentialService;
import cn.com.tenlion.systemhouse.utils.CheckDataUtils;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import ink.wgink.common.base.DefaultBaseService; import ink.wgink.common.base.DefaultBaseService;
import ink.wgink.exceptions.SaveException; import ink.wgink.exceptions.SaveException;
import ink.wgink.module.dictionary.pojo.dtos.AreaDTO;
import ink.wgink.mongo.module.dictionary.service.IMongoAreaService;
import ink.wgink.pojo.ListPage; import ink.wgink.pojo.ListPage;
import ink.wgink.pojo.result.SuccessResultList; import ink.wgink.pojo.result.SuccessResultList;
import ink.wgink.util.map.HashMapUtil; import ink.wgink.util.map.HashMapUtil;
@ -57,6 +60,8 @@ public class BuildingServiceImpl extends DefaultBaseService implements IBuilding
private KafkaTemplate kafkaTemplate; private KafkaTemplate kafkaTemplate;
@Autowired @Autowired
private ICommunityService communityService; private ICommunityService communityService;
@Autowired
private IMongoAreaService mongoAreaService;
@Override @Override
public void save(BuildingVO buildingVO) { public void save(BuildingVO buildingVO) {
@ -251,7 +256,7 @@ public class BuildingServiceImpl extends DefaultBaseService implements IBuilding
// 楼宇层数 // 楼宇层数
Integer floor = Integer.valueOf(buildingVO.getFloorCount()); Integer floor = Integer.valueOf(buildingVO.getFloorCount());
// 每层户数 // 每层户数
Integer countOfFloor = buildingVO.getFloorCount(); Integer countOfFloor = buildingVO.getHouseCount();
int i = 1; int i = 1;
if(value.equals("buildingUnitNum")) { if(value.equals("buildingUnitNum")) {
i = Integer.valueOf(BuildingDTO.getUnitCount()) + 1; i = Integer.valueOf(BuildingDTO.getUnitCount()) + 1;
@ -393,6 +398,26 @@ public class BuildingServiceImpl extends DefaultBaseService implements IBuilding
@Override @Override
public List<BuildingDTO> list(Map<String, Object> params) { public List<BuildingDTO> list(Map<String, Object> params) {
if(params.get("areaCode") == null && params.get("areaParentId") != null){
String areaParentId = "110889";
if(!"".equals(params.get("areaParentId").toString())){
areaParentId = params.get("areaParentId").toString();
}
AreaDTO parentDTO = mongoAreaService.get(areaParentId);
params.put("areaCode", parentDTO.getAreaCode());
}
if(params.get("areaCode") != null && !"".equals(params.get("areaCode").toString())){
String areaCoed = params.get("areaCode").toString();
String[] areaCodeSplit = CheckDataUtils.splitStringByLength(areaCoed, 2);
String areaCodeLike = "";
for(int i = 5 ; i >= 0; i--){
if(!"00".equals(areaCodeSplit[i])){
areaCodeLike = areaCoed.substring(0, (i + 1) * 2 );
break;
}
}
params.put("areaCodeLike",areaCodeLike);
}
return buildingDao.list(params); return buildingDao.list(params);
} }
@ -420,6 +445,57 @@ public class BuildingServiceImpl extends DefaultBaseService implements IBuilding
return count == null ? 0 : count; return count == null ? 0 : count;
} }
@Override
public List<Map<String, Object>> dataCount(Map<String, Object> params) {
// 110889 乌兰察布市
String areaParentId = "110889";
if(params.get("areaParentId") != null
&& params.get("areaParentId").toString().length() > 0){
areaParentId = params.get("areaParentId").toString();
}
List<AreaDTO> areaDTOS = mongoAreaService.listByParentId(areaParentId);
List<Map<String, Object>> areaList = new ArrayList<>();
int totalPeopleNum = 0;
for(AreaDTO item : areaDTOS){
Map<String, Object> temp = new HashMap<>(16);
// 查询是否存在子节点
List<AreaDTO> subAreaList = mongoAreaService.listByParentId(item.getAreaId());
temp.put("hasSubArea","false");
if(subAreaList != null && subAreaList.size() > 0){
temp.put("hasSubArea","true");
}
temp.put("areaId",item.getAreaId());
temp.put("areaParentId",item.getAreaParentId());
temp.put("areaCode",item.getAreaCode());
temp.put("areaName",item.getAreaName());
String[] areaCodeSplit = CheckDataUtils.splitStringByLength(item.getAreaCode(), 2);
String areaCodeLike = "";
for(int i = 5 ; i >= 0; i--){
if(!"00".equals(areaCodeSplit[i])){
areaCodeLike = item.getAreaCode().substring(0, (i + 1) * 2 );
break;
}
}
// 查询人员数量
params.clear();
params.put("areaCodeLike", areaCodeLike);
Integer counts = buildingDao.dataCount(params);
temp.put("areaPeopleNum", counts);
areaList.add(temp);
totalPeopleNum += counts;
}
AreaDTO parentDTO = mongoAreaService.get(areaParentId);
Map<String, Object> totalMap = new HashMap<>(16);
totalMap.put("hasSubArea","false");
totalMap.put("areaId", parentDTO.getAreaId());
totalMap.put("areaParentId", "");
totalMap.put("areaCode" , parentDTO.getAreaCode());
totalMap.put("areaName", "合计");
totalMap.put("areaPeopleNum", totalPeopleNum);
areaList.add(totalMap);
return areaList;
}
@Override @Override
public void updateGrid(Map<String, Object> params) { public void updateGrid(Map<String, Object> params) {
buildingDao.updateGrid(params); buildingDao.updateGrid(params);

View File

@ -196,4 +196,11 @@ public interface IBuildingHouseService {
* @param params * @param params
*/ */
void updateGrid(Map<String, Object> params); void updateGrid(Map<String, Object> params);
/**
* 区域下数量
* @param params
* @return
*/
List<Map<String, Object>> dataCount(Map<String, Object> params);
} }

View File

@ -18,9 +18,11 @@ import cn.com.tenlion.systemhouse.service.buildinghouse.IBuildingHouseService;
import cn.com.tenlion.systemhouse.service.grid.IGridService; import cn.com.tenlion.systemhouse.service.grid.IGridService;
import cn.com.tenlion.systemhouse.service.houseuser.IHouseUserService; import cn.com.tenlion.systemhouse.service.houseuser.IHouseUserService;
import cn.com.tenlion.systemhouse.service.residential.IResidentialService; import cn.com.tenlion.systemhouse.service.residential.IResidentialService;
import cn.com.tenlion.systemhouse.utils.CheckDataUtils;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import ink.wgink.common.base.DefaultBaseService; import ink.wgink.common.base.DefaultBaseService;
import ink.wgink.module.dictionary.pojo.dtos.AreaDTO; import ink.wgink.module.dictionary.pojo.dtos.AreaDTO;
import ink.wgink.mongo.module.dictionary.service.IMongoAreaService;
import ink.wgink.pojo.ListPage; import ink.wgink.pojo.ListPage;
import ink.wgink.pojo.result.SuccessResultList; import ink.wgink.pojo.result.SuccessResultList;
import ink.wgink.util.map.HashMapUtil; import ink.wgink.util.map.HashMapUtil;
@ -57,6 +59,8 @@ public class BuildingHouseServiceImpl extends DefaultBaseService implements IBui
private IGridService gridService; private IGridService gridService;
@Autowired @Autowired
private KafkaTemplate kafkaTemplate; private KafkaTemplate kafkaTemplate;
@Autowired
private IMongoAreaService mongoAreaService;
@Override @Override
public void save(BuildingHouseVO buildingHouseVO) { public void save(BuildingHouseVO buildingHouseVO) {
@ -186,6 +190,26 @@ public class BuildingHouseServiceImpl extends DefaultBaseService implements IBui
@Override @Override
public List<BuildingHouseDTO> list(Map<String, Object> params) { public List<BuildingHouseDTO> list(Map<String, Object> params) {
if(params.get("areaCode") == null && params.get("areaParentId") != null){
String areaParentId = "110889";
if(!"".equals(params.get("areaParentId").toString())){
areaParentId = params.get("areaParentId").toString();
}
AreaDTO parentDTO = mongoAreaService.get(areaParentId);
params.put("areaCode", parentDTO.getAreaCode());
}
if(params.get("areaCode") != null && !"".equals(params.get("areaCode").toString())){
String areaCoed = params.get("areaCode").toString();
String[] areaCodeSplit = CheckDataUtils.splitStringByLength(areaCoed, 2);
String areaCodeLike = "";
for(int i = 5 ; i >= 0; i--){
if(!"00".equals(areaCodeSplit[i])){
areaCodeLike = areaCoed.substring(0, (i + 1) * 2 );
break;
}
}
params.put("areaCodeLike",areaCodeLike);
}
if(!com.alibaba.excel.util.StringUtils.isEmpty(params.get("keywords"))) { if(!com.alibaba.excel.util.StringUtils.isEmpty(params.get("keywords"))) {
List<HouseUserDTO> houseUserDTOS = houseUserService.list(params); List<HouseUserDTO> houseUserDTOS = houseUserService.list(params);
if(null != houseUserDTOS && houseUserDTOS.size() > 0) { if(null != houseUserDTOS && houseUserDTOS.size() > 0) {
@ -235,6 +259,57 @@ public class BuildingHouseServiceImpl extends DefaultBaseService implements IBui
return count == null ? 0 : count; return count == null ? 0 : count;
} }
@Override
public List<Map<String, Object>> dataCount(Map<String, Object> params) {
// 110889 乌兰察布市
String areaParentId = "110889";
if(params.get("areaParentId") != null
&& params.get("areaParentId").toString().length() > 0){
areaParentId = params.get("areaParentId").toString();
}
List<AreaDTO> areaDTOS = mongoAreaService.listByParentId(areaParentId);
List<Map<String, Object>> areaList = new ArrayList<>();
int totalPeopleNum = 0;
for(AreaDTO item : areaDTOS){
Map<String, Object> temp = new HashMap<>(16);
// 查询是否存在子节点
List<AreaDTO> subAreaList = mongoAreaService.listByParentId(item.getAreaId());
temp.put("hasSubArea","false");
if(subAreaList != null && subAreaList.size() > 0){
temp.put("hasSubArea","true");
}
temp.put("areaId",item.getAreaId());
temp.put("areaParentId",item.getAreaParentId());
temp.put("areaCode",item.getAreaCode());
temp.put("areaName",item.getAreaName());
String[] areaCodeSplit = CheckDataUtils.splitStringByLength(item.getAreaCode(), 2);
String areaCodeLike = "";
for(int i = 5 ; i >= 0; i--){
if(!"00".equals(areaCodeSplit[i])){
areaCodeLike = item.getAreaCode().substring(0, (i + 1) * 2 );
break;
}
}
// 查询人员数量
params.clear();
params.put("areaCodeLike", areaCodeLike);
Integer counts = buildingHouseDao.dataCount(params);
temp.put("areaPeopleNum", counts);
areaList.add(temp);
totalPeopleNum += counts;
}
AreaDTO parentDTO = mongoAreaService.get(areaParentId);
Map<String, Object> totalMap = new HashMap<>(16);
totalMap.put("hasSubArea","false");
totalMap.put("areaId", parentDTO.getAreaId());
totalMap.put("areaParentId", "");
totalMap.put("areaCode" , parentDTO.getAreaCode());
totalMap.put("areaName", "合计");
totalMap.put("areaPeopleNum", totalPeopleNum);
areaList.add(totalMap);
return areaList;
}
@Override @Override
public void delAllByBuildingId(Map<String, Object> params) { public void delAllByBuildingId(Map<String, Object> params) {
List<BuildingHouseDTO> ids = buildingHouseDao.getIdsByBuildingId(params); List<BuildingHouseDTO> ids = buildingHouseDao.getIdsByBuildingId(params);

View File

@ -185,4 +185,10 @@ public interface IResidentialService {
*/ */
Integer count(Map<String, Object> params); Integer count(Map<String, Object> params);
/**
* 区域下数量
* @param params
* @return
*/
List<Map<String, Object>> dataCount(Map<String, Object> params);
} }

View File

@ -15,6 +15,7 @@ import cn.com.tenlion.systemhouse.service.community.ICommunityService;
import cn.com.tenlion.systemhouse.service.grid.IGridService; import cn.com.tenlion.systemhouse.service.grid.IGridService;
import cn.com.tenlion.systemhouse.service.grid.impl.GridServiceImpl; import cn.com.tenlion.systemhouse.service.grid.impl.GridServiceImpl;
import cn.com.tenlion.systemhouse.service.residential.IResidentialService; import cn.com.tenlion.systemhouse.service.residential.IResidentialService;
import cn.com.tenlion.systemhouse.utils.CheckDataUtils;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import ink.wgink.common.base.DefaultBaseService; import ink.wgink.common.base.DefaultBaseService;
import ink.wgink.exceptions.SearchException; import ink.wgink.exceptions.SearchException;
@ -55,6 +56,8 @@ public class ResidentialServiceImpl extends DefaultBaseService implements IResid
private IBuildingService buildingService; private IBuildingService buildingService;
@Autowired @Autowired
private KafkaTemplate kafkaTemplate; private KafkaTemplate kafkaTemplate;
@Autowired
private IMongoAreaService mongoAreaService;
@Override @Override
public void save(ResidentialVO residentialVO) { public void save(ResidentialVO residentialVO) {
@ -207,6 +210,26 @@ public class ResidentialServiceImpl extends DefaultBaseService implements IResid
@Override @Override
public List<ResidentialDTO> list(Map<String, Object> params) { public List<ResidentialDTO> list(Map<String, Object> params) {
if(params.get("areaCode") == null && params.get("areaParentId") != null){
String areaParentId = "110889";
if(!"".equals(params.get("areaParentId").toString())){
areaParentId = params.get("areaParentId").toString();
}
AreaDTO parentDTO = mongoAreaService.get(areaParentId);
params.put("areaCode", parentDTO.getAreaCode());
}
if(params.get("areaCode") != null && !"".equals(params.get("areaCode").toString())){
String areaCoed = params.get("areaCode").toString();
String[] areaCodeSplit = CheckDataUtils.splitStringByLength(areaCoed, 2);
String areaCodeLike = "";
for(int i = 5 ; i >= 0; i--){
if(!"00".equals(areaCodeSplit[i])){
areaCodeLike = areaCoed.substring(0, (i + 1) * 2 );
break;
}
}
params.put("areaCodeLike",areaCodeLike);
}
List<ResidentialDTO> residentialDTOList =residentialDao.list(params); List<ResidentialDTO> residentialDTOList =residentialDao.list(params);
if(null != residentialDTOList && residentialDTOList.size() > 0) { if(null != residentialDTOList && residentialDTOList.size() > 0) {
for(ResidentialDTO residentialDTO: residentialDTOList) { for(ResidentialDTO residentialDTO: residentialDTOList) {
@ -243,6 +266,57 @@ public class ResidentialServiceImpl extends DefaultBaseService implements IResid
return count == null ? 0 : count; return count == null ? 0 : count;
} }
@Override
public List<Map<String, Object>> dataCount(Map<String, Object> params) {
// 110889 乌兰察布市
String areaParentId = "110889";
if(params.get("areaParentId") != null
&& params.get("areaParentId").toString().length() > 0){
areaParentId = params.get("areaParentId").toString();
}
List<AreaDTO> areaDTOS = mongoAreaService.listByParentId(areaParentId);
List<Map<String, Object>> areaList = new ArrayList<>();
int totalPeopleNum = 0;
for(AreaDTO item : areaDTOS){
Map<String, Object> temp = new HashMap<>(16);
// 查询是否存在子节点
List<AreaDTO> subAreaList = mongoAreaService.listByParentId(item.getAreaId());
temp.put("hasSubArea","false");
if(subAreaList != null && subAreaList.size() > 0){
temp.put("hasSubArea","true");
}
temp.put("areaId",item.getAreaId());
temp.put("areaParentId",item.getAreaParentId());
temp.put("areaCode",item.getAreaCode());
temp.put("areaName",item.getAreaName());
String[] areaCodeSplit = CheckDataUtils.splitStringByLength(item.getAreaCode(), 2);
String areaCodeLike = "";
for(int i = 5 ; i >= 0; i--){
if(!"00".equals(areaCodeSplit[i])){
areaCodeLike = item.getAreaCode().substring(0, (i + 1) * 2 );
break;
}
}
// 查询人员数量
params.clear();
params.put("areaCodeLike", areaCodeLike);
Integer counts = residentialDao.dataCount(params);
temp.put("areaPeopleNum", counts);
areaList.add(temp);
totalPeopleNum += counts;
}
AreaDTO parentDTO = mongoAreaService.get(areaParentId);
Map<String, Object> totalMap = new HashMap<>(16);
totalMap.put("hasSubArea","false");
totalMap.put("areaId", parentDTO.getAreaId());
totalMap.put("areaParentId", "");
totalMap.put("areaCode" , parentDTO.getAreaCode());
totalMap.put("areaName", "合计");
totalMap.put("areaPeopleNum", totalPeopleNum);
areaList.add(totalMap);
return areaList;
}
private AreaDTO getAreaMsg(String areaId) { private AreaDTO getAreaMsg(String areaId) {
if(!StringUtils.isEmpty(areaId)) { if(!StringUtils.isEmpty(areaId)) {
AreaDTO areaDTO = areaService.get(areaId); AreaDTO areaDTO = areaService.get(areaId);

View File

@ -0,0 +1,25 @@
package cn.com.tenlion.systemhouse.utils;
public class CheckDataUtils {
public static String[] splitStringByLength(String src, int length) {
//检查参数是否合法
if (null == src || src.equals("")) {
return null;
}
if (length <= 0) {
return null;
}
//获取整个字符串可以被切割成字符子串的个数
int n = (src.length() + length - 1) / length;
String[] split = new String[n];
for (int i = 0; i < n; i++) {
if (i < (n -1)) {
split[i] = src.substring(i * length, (i + 1) * length);
} else {
split[i] = src.substring(i * length);
}
}
return split;
}
}

View File

@ -341,6 +341,9 @@
house_building t1 house_building t1
WHERE WHERE
t1.is_delete = 0 t1.is_delete = 0
<if test="areaCodeLike != null and areaCodeLike != ''">
AND t1.location_code LIKE CONCAT(#{areaCodeLike}, '%')
</if>
<if test="keywords != null and keywords != ''"> <if test="keywords != null and keywords != ''">
AND ( AND (
t1.id LIKE CONCAT('%', #{keywords}, '%') t1.id LIKE CONCAT('%', #{keywords}, '%')
@ -472,4 +475,23 @@
t1.is_delete = 0 t1.is_delete = 0
</select> </select>
<!-- 区域下数据数量 -->
<select id="dataCount" parameterType="map" resultType="Integer">
SELECT
COUNT(*)
FROM
house_building t1
WHERE
t1.is_delete = 0
<if test="showOther != null">
AND (t1.location_code = '' OR t1.location_code IS NULL)
</if>
<if test="areaCode != null and areaCode != ''">
AND t1.location_code = #{areaCode}
</if>
<if test="areaCodeLike != null and areaCodeLike !=''">
AND t1.location_code LIKE CONCAT(#{areaCodeLike}, '%')
</if>
</select>
</mapper> </mapper>

View File

@ -239,6 +239,9 @@
house_building_house t1 LEFT JOIN house_building t2 ON t1.building_id = t2.building_id AND t2.is_delete = 0 house_building_house t1 LEFT JOIN house_building t2 ON t1.building_id = t2.building_id AND t2.is_delete = 0
WHERE WHERE
t1.is_delete = 0 t1.is_delete = 0
<if test="areaCodeLike != null and areaCodeLike != ''">
AND t1.location_code LIKE CONCAT(#{areaCodeLike}, '%')
</if>
<if test="keywords != null and keywords != ''"> <if test="keywords != null and keywords != ''">
AND ( AND (
t1.building_name LIKE CONCAT('%', #{keywords}, '%') t1.building_name LIKE CONCAT('%', #{keywords}, '%')
@ -359,4 +362,23 @@
t1.is_delete = 0 t1.is_delete = 0
</select> </select>
<!-- 区域下数据数量 -->
<select id="dataCount" parameterType="map" resultType="Integer">
SELECT
COUNT(*)
FROM
house_building_house t1
WHERE
t1.is_delete = 0
<if test="showOther != null">
AND (t1.location_code = '' OR t1.location_code IS NULL)
</if>
<if test="areaCode != null and areaCode != ''">
AND t1.location_code = #{areaCode}
</if>
<if test="areaCodeLike != null and areaCodeLike !=''">
AND t1.location_code LIKE CONCAT(#{areaCodeLike}, '%')
</if>
</select>
</mapper> </mapper>

View File

@ -395,6 +395,9 @@
t1.residential_name LIKE CONCAT('%', #{keywords}, '%') t1.residential_name LIKE CONCAT('%', #{keywords}, '%')
) )
</if> </if>
<if test="areaCodeLike != null and areaCodeLike != ''">
AND t1.location_code LIKE CONCAT(#{areaCodeLike}, '%')
</if>
<if test="residentialIds != null and residentialIds.size > 0"> <if test="residentialIds != null and residentialIds.size > 0">
AND AND
t1.residential_id IN t1.residential_id IN
@ -500,4 +503,23 @@
t1.is_delete = 0 t1.is_delete = 0
</select> </select>
<!-- 区域下数据数量 -->
<select id="dataCount" parameterType="map" resultType="Integer">
SELECT
COUNT(*)
FROM
house_residential t1
WHERE
t1.is_delete = 0
<if test="showOther != null">
AND (t1.location_code = '' OR t1.location_code IS NULL)
</if>
<if test="areaCode != null and areaCode != ''">
AND t1.location_code = #{areaCode}
</if>
<if test="areaCodeLike != null and areaCodeLike !=''">
AND t1.location_code LIKE CONCAT(#{areaCodeLike}, '%')
</if>
</select>
</mapper> </mapper>

View File

@ -12,8 +12,57 @@
</head> </head>
<body> <body>
<div class="layui-fluid layui-anim layui-anim-fadein"> <div class="layui-fluid layui-anim layui-anim-fadein">
<div class="layui-row"> <div class="layui-row layui-col-space5">
<div class="layui-col-md12"> <div class="layui-col-md3 layui-col-sm3">
<div class="layui-card" id="left-card-div" style="">
<div class="layui-card-body">
<div style="padding: 10px 0px; border-bottom: 1px solid #DDDDDD;text-align: right">
<!--<button typeof="button" class="layui-btn layui-btn-normal layui-btn-sm">数据图表</button>-->
<button typeof="button" id="backToArea" class="layui-btn layui-btn-sm">返回上级</button>
</div>
<div>
<table class="layui-table">
<colgroup>
<col width="200">
<col width="150">
</colgroup>
<thead>
<tr>
<th style="text-align: center;">行政区域</th>
<th style="text-align: center;">数量</th>
</tr>
</thead>
<tbody id="areaUserCountBox"></tbody>
<script type="text/html" id="areaUserCountTemplate">
{{# for(var i = 0, item; item = d[i++];) { }}
<tr>
<td>
{{# if(item.hasSubArea == 'false'){ }}
<a href="javascript:void(0)" data-hansubarea="{{item.hasSubArea}}">{{item.areaName}}</a>
{{# } }}
{{# if(item.hasSubArea == 'true'){ }}
<a href="javascript:void(0)" class="change-area" style="color: #0a54a6;text-decoration: underline"
data-areaid="{{item.areaId}}" data-areacode="{{item.areaCode}}">{{item.areaName}}</a>
{{# } }}
</td>
<td style="text-align: center;">
{{# if(item.areaPeopleNum == '0'){ }}
<a href="javascript:void(0)">{{item.areaPeopleNum}}</a>
{{# } }}
{{# if(item.areaPeopleNum != '0'){ }}
<a href="javascript:void(0)" class="people-event" style="color: #0a54a6;text-decoration: underline"
data-areacode="{{item.areaCode}}">{{item.areaPeopleNum}}</a>
{{# } }}
</td>
</tr>
{{# } }}
</script>
</table>
</div>
</div>
</div>
</div>
<div class="layui-col-md9 layui-col-sm9">
<div class="layui-card"> <div class="layui-card">
<div class="layui-card-body"> <div class="layui-card-body">
<div class="test-table-reload-btn" style="margin-bottom: 10px;"> <div class="test-table-reload-btn" style="margin-bottom: 10px;">
@ -57,17 +106,68 @@
base: 'assets/layuiadmin/' base: 'assets/layuiadmin/'
}).extend({ }).extend({
index: 'lib/index' index: 'lib/index'
}).use(['index', 'table', 'laydate', 'common'], function() { }).use(['index', 'table', 'laytpl', 'laydate', 'common'], function() {
var $ = layui.$; var $ = layui.$;
var $win = $(window); var $win = $(window);
var table = layui.table; var table = layui.table;
var admin = layui.admin; var admin = layui.admin;
var laydate = layui.laydate; var laydate = layui.laydate;
var laytpl = layui.laytpl;
var common = layui.common; var common = layui.common;
var resizeTimeout = null; var resizeTimeout = null;
var tableUrl = 'api/building/listpage'; var tableUrl = 'api/building/listpage';
var residentialId = top.restAjax.params(window.location.href).residentialId; var residentialId = top.restAjax.params(window.location.href).residentialId;
var areaParentId = [''];
var areaCode = '';
$('#left-card-div').height($win.height() - 30);
$('#left-card-div').css('overflow', 'auto');
function initData(){
initDate();
initTable();
listAreaUserCounts();
}
initData();
function listAreaUserCounts(){
var loadIndex = layer.load(0,{shade : 0.3});
top.restAjax.get(top.restAjax.path('api/building/data-counts', []),
{areaParentId : areaParentId[areaParentId.length - 1]}, null, function (code, data) {
laytpl(document.getElementById('areaUserCountTemplate').innerHTML).render(data, function(html) {
document.getElementById('areaUserCountBox').innerHTML = html;
});
layer.close(loadIndex);
}, function (code, data) {
top.dialog.msg(data.msg);
});
}
// 绑定点击区域切换事件
$(document).on('click', '.change-area', function(){
areaParentId.push($(this).data().areaid);
areaCode = '';
listAreaUserCounts();
reloadTable();
});
// 点击人员查看人员列表
$(document).on('click', '.people-event', function(){
areaCode = $(this).data().areacode;
reloadTable();
});
// 返回上级
$(document).on('click', '#backToArea',function(){
if(areaParentId.length > 1){
areaParentId.splice(areaParentId.length - 1, 1);
}
areaCode = '';
listAreaUserCounts();
reloadTable();
});
// 初始化表格 // 初始化表格
function initTable() { function initTable() {
if(residentialId) { if(residentialId) {
@ -183,10 +283,8 @@
var data = obj.data; var data = obj.data;
// 任务转派 // 任务转派
if('addLeader' == obj.event) { if('addLeader' == obj.event) {
console.log(data)
addLeader(data); addLeader(data);
}else if('houseList' == obj.event) { }else if('houseList' == obj.event) {
console.log(data)
houseList(data); houseList(data);
} }
}); });
@ -198,7 +296,9 @@
where: { where: {
keywords: $('#keywords').val(), keywords: $('#keywords').val(),
startTime: $('#startTime').val(), startTime: $('#startTime').val(),
endTime: $('#endTime').val() endTime: $('#endTime').val(),
areaParentId : areaParentId[areaParentId.length -1],
areaCode : areaCode
}, },
page: { page: {
curr: currentPage curr: currentPage
@ -240,8 +340,6 @@
} }
}); });
} }
initTable();
initDate();
// 事件 - 页面变化 // 事件 - 页面变化
$win.on('resize', function() { $win.on('resize', function() {
clearTimeout(resizeTimeout); clearTimeout(resizeTimeout);

View File

@ -12,8 +12,57 @@
</head> </head>
<body> <body>
<div class="layui-fluid layui-anim layui-anim-fadein"> <div class="layui-fluid layui-anim layui-anim-fadein">
<div class="layui-row"> <div class="layui-row layui-col-space5">
<div class="layui-col-md12"> <div class="layui-col-md3 layui-col-sm3">
<div class="layui-card" id="left-card-div" style="">
<div class="layui-card-body">
<div style="padding: 10px 0px; border-bottom: 1px solid #DDDDDD;text-align: right">
<!--<button typeof="button" class="layui-btn layui-btn-normal layui-btn-sm">数据图表</button>-->
<button typeof="button" id="backToArea" class="layui-btn layui-btn-sm">返回上级</button>
</div>
<div>
<table class="layui-table">
<colgroup>
<col width="200">
<col width="150">
</colgroup>
<thead>
<tr>
<th style="text-align: center;">行政区域</th>
<th style="text-align: center;">数量</th>
</tr>
</thead>
<tbody id="areaUserCountBox"></tbody>
<script type="text/html" id="areaUserCountTemplate">
{{# for(var i = 0, item; item = d[i++];) { }}
<tr>
<td>
{{# if(item.hasSubArea == 'false'){ }}
<a href="javascript:void(0)" data-hansubarea="{{item.hasSubArea}}">{{item.areaName}}</a>
{{# } }}
{{# if(item.hasSubArea == 'true'){ }}
<a href="javascript:void(0)" class="change-area" style="color: #0a54a6;text-decoration: underline"
data-areaid="{{item.areaId}}" data-areacode="{{item.areaCode}}">{{item.areaName}}</a>
{{# } }}
</td>
<td style="text-align: center;">
{{# if(item.areaPeopleNum == '0'){ }}
<a href="javascript:void(0)">{{item.areaPeopleNum}}</a>
{{# } }}
{{# if(item.areaPeopleNum != '0'){ }}
<a href="javascript:void(0)" class="people-event" style="color: #0a54a6;text-decoration: underline"
data-areacode="{{item.areaCode}}">{{item.areaPeopleNum}}</a>
{{# } }}
</td>
</tr>
{{# } }}
</script>
</table>
</div>
</div>
</div>
</div>
<div class="layui-col-md9 layui-col-sm9">
<div class="layui-card"> <div class="layui-card">
<div class="layui-card-body"> <div class="layui-card-body">
<div class="test-table-reload-btn" style="margin-bottom: 10px;"> <div class="test-table-reload-btn" style="margin-bottom: 10px;">
@ -51,16 +100,67 @@
base: 'assets/layuiadmin/' base: 'assets/layuiadmin/'
}).extend({ }).extend({
index: 'lib/index' index: 'lib/index'
}).use(['index', 'table', 'laydate', 'common'], function() { }).use(['index', 'table', 'laytpl', 'laydate', 'common'], function() {
var $ = layui.$; var $ = layui.$;
var $win = $(window); var $win = $(window);
var table = layui.table; var table = layui.table;
var admin = layui.admin; var admin = layui.admin;
var laydate = layui.laydate; var laydate = layui.laydate;
var laytpl = layui.laytpl;
var common = layui.common; var common = layui.common;
var resizeTimeout = null; var resizeTimeout = null;
var tableUrl = 'api/buildinghouse/listpage?houseStatus={houseStatus}'; var tableUrl = 'api/buildinghouse/listpage?houseStatus={houseStatus}';
var areaParentId = [''];
var areaCode = '';
$('#left-card-div').height($win.height() - 30);
$('#left-card-div').css('overflow', 'auto');
function initData(){
initDate();
initTable();
listAreaUserCounts();
}
initData();
function listAreaUserCounts(){
var loadIndex = layer.load(0,{shade : 0.3});
top.restAjax.get(top.restAjax.path('api/buildinghouse/data-counts', []),
{areaParentId : areaParentId[areaParentId.length - 1]}, null, function (code, data) {
laytpl(document.getElementById('areaUserCountTemplate').innerHTML).render(data, function(html) {
document.getElementById('areaUserCountBox').innerHTML = html;
});
layer.close(loadIndex);
}, function (code, data) {
top.dialog.msg(data.msg);
});
}
// 绑定点击区域切换事件
$(document).on('click', '.change-area', function(){
areaParentId.push($(this).data().areaid);
areaCode = '';
listAreaUserCounts();
reloadTable();
});
// 点击人员查看人员列表
$(document).on('click', '.people-event', function(){
areaCode = $(this).data().areacode;
reloadTable();
});
// 返回上级
$(document).on('click', '#backToArea',function(){
if(areaParentId.length > 1){
areaParentId.splice(areaParentId.length - 1, 1);
}
areaCode = '';
listAreaUserCounts();
reloadTable();
});
// 初始化表格 // 初始化表格
function initTable() { function initTable() {
table.render({ table.render({
@ -142,7 +242,9 @@
where: { where: {
keywords: $('#keywords').val(), keywords: $('#keywords').val(),
startTime: $('#startTime').val(), startTime: $('#startTime').val(),
endTime: $('#endTime').val() endTime: $('#endTime').val(),
areaParentId : areaParentId[areaParentId.length -1],
areaCode : areaCode
}, },
page: { page: {
curr: currentPage curr: currentPage
@ -163,9 +265,6 @@
}); });
} }
initTable();
initDate();
// 事件 - 页面变化 // 事件 - 页面变化
$win.on('resize', function() { $win.on('resize', function() {
clearTimeout(resizeTimeout); clearTimeout(resizeTimeout);

View File

@ -12,8 +12,57 @@
</head> </head>
<body> <body>
<div class="layui-fluid layui-anim layui-anim-fadein"> <div class="layui-fluid layui-anim layui-anim-fadein">
<div class="layui-row"> <div class="layui-row layui-col-space5">
<div class="layui-col-md12"> <div class="layui-col-md3 layui-col-sm3">
<div class="layui-card" id="left-card-div" style="">
<div class="layui-card-body">
<div style="padding: 10px 0px; border-bottom: 1px solid #DDDDDD;text-align: right">
<!--<button typeof="button" class="layui-btn layui-btn-normal layui-btn-sm">数据图表</button>-->
<button typeof="button" id="backToArea" class="layui-btn layui-btn-sm">返回上级</button>
</div>
<div>
<table class="layui-table">
<colgroup>
<col width="200">
<col width="150">
</colgroup>
<thead>
<tr>
<th style="text-align: center;">行政区域</th>
<th style="text-align: center;">数量</th>
</tr>
</thead>
<tbody id="areaUserCountBox"></tbody>
<script type="text/html" id="areaUserCountTemplate">
{{# for(var i = 0, item; item = d[i++];) { }}
<tr>
<td>
{{# if(item.hasSubArea == 'false'){ }}
<a href="javascript:void(0)" data-hansubarea="{{item.hasSubArea}}">{{item.areaName}}</a>
{{# } }}
{{# if(item.hasSubArea == 'true'){ }}
<a href="javascript:void(0)" class="change-area" style="color: #0a54a6;text-decoration: underline"
data-areaid="{{item.areaId}}" data-areacode="{{item.areaCode}}">{{item.areaName}}</a>
{{# } }}
</td>
<td style="text-align: center;">
{{# if(item.areaPeopleNum == '0'){ }}
<a href="javascript:void(0)">{{item.areaPeopleNum}}</a>
{{# } }}
{{# if(item.areaPeopleNum != '0'){ }}
<a href="javascript:void(0)" class="people-event" style="color: #0a54a6;text-decoration: underline"
data-areacode="{{item.areaCode}}">{{item.areaPeopleNum}}</a>
{{# } }}
</td>
</tr>
{{# } }}
</script>
</table>
</div>
</div>
</div>
</div>
<div class="layui-col-md9 layui-col-sm9">
<div class="layui-card"> <div class="layui-card">
<div class="layui-card-body"> <div class="layui-card-body">
<div class="test-table-reload-btn" style="margin-bottom: 10px;"> <div class="test-table-reload-btn" style="margin-bottom: 10px;">
@ -51,16 +100,67 @@
base: 'assets/layuiadmin/' base: 'assets/layuiadmin/'
}).extend({ }).extend({
index: 'lib/index' index: 'lib/index'
}).use(['index', 'table', 'laydate', 'common'], function() { }).use(['index', 'table', 'laytpl', 'laydate', 'common'], function() {
var $ = layui.$; var $ = layui.$;
var $win = $(window); var $win = $(window);
var table = layui.table; var table = layui.table;
var admin = layui.admin; var admin = layui.admin;
var laydate = layui.laydate; var laydate = layui.laydate;
var laytpl = layui.laytpl;
var common = layui.common; var common = layui.common;
var resizeTimeout = null; var resizeTimeout = null;
var tableUrl = 'api/buildinghouse/listpage?houseStatus={houseStatus}'; var tableUrl = 'api/buildinghouse/listpage?houseStatus={houseStatus}';
var areaParentId = [''];
var areaCode = '';
$('#left-card-div').height($win.height() - 30);
$('#left-card-div').css('overflow', 'auto');
function initData(){
initDate();
initTable();
listAreaUserCounts();
}
initData();
function listAreaUserCounts(){
var loadIndex = layer.load(0,{shade : 0.3});
top.restAjax.get(top.restAjax.path('api/buildinghouse/data-counts', []),
{areaParentId : areaParentId[areaParentId.length - 1]}, null, function (code, data) {
laytpl(document.getElementById('areaUserCountTemplate').innerHTML).render(data, function(html) {
document.getElementById('areaUserCountBox').innerHTML = html;
});
layer.close(loadIndex);
}, function (code, data) {
top.dialog.msg(data.msg);
});
}
// 绑定点击区域切换事件
$(document).on('click', '.change-area', function(){
areaParentId.push($(this).data().areaid);
areaCode = '';
listAreaUserCounts();
reloadTable();
});
// 点击人员查看人员列表
$(document).on('click', '.people-event', function(){
areaCode = $(this).data().areacode;
reloadTable();
});
// 返回上级
$(document).on('click', '#backToArea',function(){
if(areaParentId.length > 1){
areaParentId.splice(areaParentId.length - 1, 1);
}
areaCode = '';
listAreaUserCounts();
reloadTable();
});
// 初始化表格 // 初始化表格
function initTable() { function initTable() {
table.render({ table.render({
@ -176,7 +276,9 @@
where: { where: {
keywords: $('#keywords').val(), keywords: $('#keywords').val(),
startTime: $('#startTime').val(), startTime: $('#startTime').val(),
endTime: $('#endTime').val() endTime: $('#endTime').val(),
areaParentId : areaParentId[areaParentId.length -1],
areaCode : areaCode
}, },
page: { page: {
curr: currentPage curr: currentPage
@ -197,9 +299,6 @@
}); });
} }
initTable();
initDate();
// 事件 - 页面变化 // 事件 - 页面变化
$win.on('resize', function() { $win.on('resize', function() {
clearTimeout(resizeTimeout); clearTimeout(resizeTimeout);

View File

@ -12,8 +12,57 @@
</head> </head>
<body> <body>
<div class="layui-fluid layui-anim layui-anim-fadein"> <div class="layui-fluid layui-anim layui-anim-fadein">
<div class="layui-row"> <div class="layui-row layui-col-space5">
<div class="layui-col-md12"> <div class="layui-col-md3 layui-col-sm3">
<div class="layui-card" id="left-card-div" style="">
<div class="layui-card-body">
<div style="padding: 10px 0px; border-bottom: 1px solid #DDDDDD;text-align: right">
<!--<button typeof="button" class="layui-btn layui-btn-normal layui-btn-sm">数据图表</button>-->
<button typeof="button" id="backToArea" class="layui-btn layui-btn-sm">返回上级</button>
</div>
<div>
<table class="layui-table">
<colgroup>
<col width="200">
<col width="150">
</colgroup>
<thead>
<tr>
<th style="text-align: center;">行政区域</th>
<th style="text-align: center;">数量</th>
</tr>
</thead>
<tbody id="areaUserCountBox"></tbody>
<script type="text/html" id="areaUserCountTemplate">
{{# for(var i = 0, item; item = d[i++];) { }}
<tr>
<td>
{{# if(item.hasSubArea == 'false'){ }}
<a href="javascript:void(0)" data-hansubarea="{{item.hasSubArea}}">{{item.areaName}}</a>
{{# } }}
{{# if(item.hasSubArea == 'true'){ }}
<a href="javascript:void(0)" class="change-area" style="color: #0a54a6;text-decoration: underline"
data-areaid="{{item.areaId}}" data-areacode="{{item.areaCode}}">{{item.areaName}}</a>
{{# } }}
</td>
<td style="text-align: center;">
{{# if(item.areaPeopleNum == '0'){ }}
<a href="javascript:void(0)">{{item.areaPeopleNum}}</a>
{{# } }}
{{# if(item.areaPeopleNum != '0'){ }}
<a href="javascript:void(0)" class="people-event" style="color: #0a54a6;text-decoration: underline"
data-areacode="{{item.areaCode}}">{{item.areaPeopleNum}}</a>
{{# } }}
</td>
</tr>
{{# } }}
</script>
</table>
</div>
</div>
</div>
</div>
<div class="layui-col-md9 layui-col-sm9">
<div class="layui-card"> <div class="layui-card">
<div class="layui-card-body"> <div class="layui-card-body">
<div class="test-table-reload-btn" style="margin-bottom: 10px;"> <div class="test-table-reload-btn" style="margin-bottom: 10px;">
@ -51,16 +100,68 @@
base: 'assets/layuiadmin/' base: 'assets/layuiadmin/'
}).extend({ }).extend({
index: 'lib/index' index: 'lib/index'
}).use(['index', 'table', 'laydate', 'common'], function() { }).use(['index', 'table', 'laytpl', 'laydate', 'common'], function() {
var $ = layui.$; var $ = layui.$;
var $win = $(window); var $win = $(window);
var table = layui.table; var table = layui.table;
var admin = layui.admin; var admin = layui.admin;
var laydate = layui.laydate; var laydate = layui.laydate;
var laytpl = layui.laytpl;
var common = layui.common; var common = layui.common;
var resizeTimeout = null; var resizeTimeout = null;
var tableUrl = 'api/buildinghouse/listpage'; var tableUrl = 'api/buildinghouse/listpage';
var buildingId = top.restAjax.params(window.location.href).buildingId; var buildingId = top.restAjax.params(window.location.href).buildingId;
var areaParentId = [''];
var areaCode = '';
$('#left-card-div').height($win.height() - 30);
$('#left-card-div').css('overflow', 'auto');
function initData(){
initDate();
initTable();
listAreaUserCounts();
}
initData();
function listAreaUserCounts(){
var loadIndex = layer.load(0,{shade : 0.3});
top.restAjax.get(top.restAjax.path('api/buildinghouse/data-counts', []),
{areaParentId : areaParentId[areaParentId.length - 1]}, null, function (code, data) {
laytpl(document.getElementById('areaUserCountTemplate').innerHTML).render(data, function(html) {
document.getElementById('areaUserCountBox').innerHTML = html;
});
layer.close(loadIndex);
}, function (code, data) {
top.dialog.msg(data.msg);
});
}
// 绑定点击区域切换事件
$(document).on('click', '.change-area', function(){
areaParentId.push($(this).data().areaid);
areaCode = '';
listAreaUserCounts();
reloadTable();
});
// 点击人员查看人员列表
$(document).on('click', '.people-event', function(){
areaCode = $(this).data().areacode;
reloadTable();
});
// 返回上级
$(document).on('click', '#backToArea',function(){
if(areaParentId.length > 1){
areaParentId.splice(areaParentId.length - 1, 1);
}
areaCode = '';
listAreaUserCounts();
reloadTable();
});
// 初始化表格 // 初始化表格
function initTable() { function initTable() {
if(buildingId) { if(buildingId) {
@ -145,7 +246,9 @@
where: { where: {
keywords: $('#keywords').val(), keywords: $('#keywords').val(),
startTime: $('#startTime').val(), startTime: $('#startTime').val(),
endTime: $('#endTime').val() endTime: $('#endTime').val(),
areaParentId : areaParentId[areaParentId.length -1],
areaCode : areaCode
}, },
page: { page: {
curr: currentPage curr: currentPage
@ -166,9 +269,6 @@
}); });
} }
initTable();
initDate();
// 事件 - 页面变化 // 事件 - 页面变化
$win.on('resize', function() { $win.on('resize', function() {
clearTimeout(resizeTimeout); clearTimeout(resizeTimeout);

View File

@ -211,7 +211,7 @@
// 初始化性别下拉选择 // 初始化性别下拉选择
function initSexSelect() { function initSexSelect() {
top.restAjax.get(top.restAjax.path('api/mongo/data/list-all/parent-id/{dataParentId}', ['52038eeb-9d55-4eaa-b3e3-c70a33bdc135']), {}, null, function(code, data, args) { top.restAjax.get(top.restAjax.path('api/mongo/data/list-all/parent-id/{dataParentId}', ['4ef46940-76ab-4758-b5f0-0cbc93ffc660']), {}, null, function(code, data, args) {
laytpl(document.getElementById('sexSelectTemplate').innerHTML).render(data, function(html) { laytpl(document.getElementById('sexSelectTemplate').innerHTML).render(data, function(html) {
document.getElementById('sexSelectTemplateBox').innerHTML = html; document.getElementById('sexSelectTemplateBox').innerHTML = html;
}); });
@ -223,7 +223,7 @@
// 初始化民族下拉选择 // 初始化民族下拉选择
function initNationSelect() { function initNationSelect() {
top.restAjax.get(top.restAjax.path('api/mongo/data/list-all/parent-id/{dataParentId}', ['a6a9a1b1-651f-42a8-84db-8095041d8a5a']), {}, null, function(code, data, args) { top.restAjax.get(top.restAjax.path('api/mongo/data/list-all/parent-id/{dataParentId}', ['a981579c-572b-4fd1-8e76-5d17df97f6a4']), {}, null, function(code, data, args) {
laytpl(document.getElementById('nationSelectTemplate').innerHTML).render(data, function(html) { laytpl(document.getElementById('nationSelectTemplate').innerHTML).render(data, function(html) {
document.getElementById('nationSelectTemplateBox').innerHTML = html; document.getElementById('nationSelectTemplateBox').innerHTML = html;
}); });
@ -235,7 +235,7 @@
// 初始化政治面貌下拉选择 // 初始化政治面貌下拉选择
function initOutlookSelect() { function initOutlookSelect() {
top.restAjax.get(top.restAjax.path('api/mongo/data/list-all/parent-id/{dataParentId}', ['616350d7-03c0-4b48-861c-ca4d7ed8555f']), {}, null, function(code, data, args) { top.restAjax.get(top.restAjax.path('api/mongo/data/list-all/parent-id/{dataParentId}', ['b2c96de0-3df8-41db-99b1-bc4e24ac6c24']), {}, null, function(code, data, args) {
laytpl(document.getElementById('outlookSelectTemplate').innerHTML).render(data, function(html) { laytpl(document.getElementById('outlookSelectTemplate').innerHTML).render(data, function(html) {
document.getElementById('outlookSelectTemplateBox').innerHTML = html; document.getElementById('outlookSelectTemplateBox').innerHTML = html;
}); });
@ -247,7 +247,7 @@
// 初始化学历下拉选择 // 初始化学历下拉选择
function initEducationSelect() { function initEducationSelect() {
top.restAjax.get(top.restAjax.path('api/mongo/data/list-all/parent-id/{dataParentId}', ['c93682ac-a1a0-4acc-b0bc-828fb86e4b00']), {}, null, function(code, data, args) { top.restAjax.get(top.restAjax.path('api/mongo/data/list-all/parent-id/{dataParentId}', ['d6b9f026-6ea9-456a-b48b-0c18d502523b']), {}, null, function(code, data, args) {
laytpl(document.getElementById('educationSelectTemplate').innerHTML).render(data, function(html) { laytpl(document.getElementById('educationSelectTemplate').innerHTML).render(data, function(html) {
document.getElementById('educationSelectTemplateBox').innerHTML = html; document.getElementById('educationSelectTemplateBox').innerHTML = html;
}); });

View File

@ -12,8 +12,57 @@
</head> </head>
<body> <body>
<div class="layui-fluid layui-anim layui-anim-fadein"> <div class="layui-fluid layui-anim layui-anim-fadein">
<div class="layui-row"> <div class="layui-row layui-col-space5">
<div class="layui-col-md12"> <div class="layui-col-md3 layui-col-sm3">
<div class="layui-card" id="left-card-div" style="">
<div class="layui-card-body">
<div style="padding: 10px 0px; border-bottom: 1px solid #DDDDDD;text-align: right">
<!--<button typeof="button" class="layui-btn layui-btn-normal layui-btn-sm">数据图表</button>-->
<button typeof="button" id="backToArea" class="layui-btn layui-btn-sm">返回上级</button>
</div>
<div>
<table class="layui-table">
<colgroup>
<col width="200">
<col width="150">
</colgroup>
<thead>
<tr>
<th style="text-align: center;">行政区域</th>
<th style="text-align: center;">数量</th>
</tr>
</thead>
<tbody id="areaUserCountBox"></tbody>
<script type="text/html" id="areaUserCountTemplate">
{{# for(var i = 0, item; item = d[i++];) { }}
<tr>
<td>
{{# if(item.hasSubArea == 'false'){ }}
<a href="javascript:void(0)" data-hansubarea="{{item.hasSubArea}}">{{item.areaName}}</a>
{{# } }}
{{# if(item.hasSubArea == 'true'){ }}
<a href="javascript:void(0)" class="change-area" style="color: #0a54a6;text-decoration: underline"
data-areaid="{{item.areaId}}" data-areacode="{{item.areaCode}}">{{item.areaName}}</a>
{{# } }}
</td>
<td style="text-align: center;">
{{# if(item.areaPeopleNum == '0'){ }}
<a href="javascript:void(0)">{{item.areaPeopleNum}}</a>
{{# } }}
{{# if(item.areaPeopleNum != '0'){ }}
<a href="javascript:void(0)" class="people-event" style="color: #0a54a6;text-decoration: underline"
data-areacode="{{item.areaCode}}">{{item.areaPeopleNum}}</a>
{{# } }}
</td>
</tr>
{{# } }}
</script>
</table>
</div>
</div>
</div>
</div>
<div class="layui-col-md9 layui-col-sm9">
<div class="layui-card"> <div class="layui-card">
<div class="layui-card-body"> <div class="layui-card-body">
<div class="test-table-reload-btn" style="margin-bottom: 10px;"> <div class="test-table-reload-btn" style="margin-bottom: 10px;">
@ -57,16 +106,68 @@
base: 'assets/layuiadmin/' base: 'assets/layuiadmin/'
}).extend({ }).extend({
index: 'lib/index' index: 'lib/index'
}).use(['index', 'table', 'laydate', 'common'], function() { }).use(['index', 'table', 'laydate', 'laytpl', 'common','util'], function() {
var $ = layui.$; var $ = layui.$;
var $win = $(window); var $win = $(window);
var table = layui.table; var table = layui.table;
var admin = layui.admin; var admin = layui.admin;
var laydate = layui.laydate; var laydate = layui.laydate;
var laytpl = layui.laytpl;
var util = layui.util;
var common = layui.common; var common = layui.common;
var resizeTimeout = null; var resizeTimeout = null;
var tableUrl = 'api/residential/listpage'; var tableUrl = 'api/residential/listpage';
var areaParentId = [''];
var areaCode = '';
$('#left-card-div').height($win.height() - 30);
$('#left-card-div').css('overflow', 'auto');
function initData(){
initDate();
initTable();
listAreaUserCounts();
}
initData();
function listAreaUserCounts(){
var loadIndex = layer.load(0,{shade : 0.3});
top.restAjax.get(top.restAjax.path('api/residential/data-counts', []),
{areaParentId : areaParentId[areaParentId.length - 1]}, null, function (code, data) {
laytpl(document.getElementById('areaUserCountTemplate').innerHTML).render(data, function(html) {
document.getElementById('areaUserCountBox').innerHTML = html;
});
layer.close(loadIndex);
}, function (code, data) {
top.dialog.msg(data.msg);
});
}
// 绑定点击区域切换事件
$(document).on('click', '.change-area', function(){
areaParentId.push($(this).data().areaid);
areaCode = '';
listAreaUserCounts();
reloadTable();
});
// 点击人员查看人员列表
$(document).on('click', '.people-event', function(){
areaCode = $(this).data().areacode;
reloadTable();
});
// 返回上级
$(document).on('click', '#backToArea',function(){
if(areaParentId.length > 1){
areaParentId.splice(areaParentId.length - 1, 1);
}
areaCode = '';
listAreaUserCounts();
reloadTable();
});
// 初始化表格 // 初始化表格
function initTable() { function initTable() {
table.render({ table.render({
@ -167,7 +268,7 @@
return rowData; return rowData;
} }
}, },
{field: 'community', width: 180, title: '社区', align:'center', {field: 'communityName', width: 180, title: '社区', align:'center',
templet: function(row) { templet: function(row) {
var rowData = row[this.field]; var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
@ -176,13 +277,14 @@
return rowData; return rowData;
} }
}, },
{field: 'remake', width: 180, title: '备注', align:'center', {field: 'remake', width: 180, maxHeight: 38, title: '备注', align:'center',
templet: function(row) { templet: function(row) {
var rowData = row[this.field]; var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-'; return '-';
} }
return rowData; var rowData2 = '<div class="title_content">'+rowData+'</div>';
return rowData2;
} }
}, },
{field: 'addIntroduction', fixed: 'right', width: 150, title: '小区简介', align:'center', {field: 'addIntroduction', fixed: 'right', width: 150, title: '小区简介', align:'center',
@ -199,6 +301,9 @@
} }
] ]
], ],
done: function (res, curr, count) {
bindHeight()
},
page: true, page: true,
parseData: function(data) { parseData: function(data) {
return { return {
@ -211,6 +316,14 @@
}); });
} }
//固定列
function bindHeight(){
$(".layui-table-main tr").each(function (index, val) {
$($(".layui-table-fixed-l .layui-table-body tbody tr")[index]).height($(val).height());
$($(".layui-table-fixed-r .layui-table-body tbody tr")[index]).height($(val).height());
});
}
//监听行单击事件 //监听行单击事件
table.on('tool(dataTable)', function(obj){ table.on('tool(dataTable)', function(obj){
var data = obj.data; var data = obj.data;
@ -252,7 +365,9 @@
where: { where: {
keywords: $('#keywords').val(), keywords: $('#keywords').val(),
startTime: $('#startTime').val(), startTime: $('#startTime').val(),
endTime: $('#endTime').val() endTime: $('#endTime').val(),
areaParentId : areaParentId[areaParentId.length -1],
areaCode : areaCode
}, },
page: { page: {
curr: currentPage curr: currentPage
@ -294,8 +409,6 @@
} }
}); });
} }
initTable();
initDate();
// 事件 - 页面变化 // 事件 - 页面变化
$win.on('resize', function() { $win.on('resize', function() {
clearTimeout(resizeTimeout); clearTimeout(resizeTimeout);