修改网格员编辑和选择的一些问题
This commit is contained in:
parent
cd2e2c9308
commit
eb582339ce
6
pom.xml
6
pom.xml
@ -170,12 +170,6 @@
|
||||
<artifactId>junit</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>tools</artifactId>
|
||||
<version>1.8.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
@ -1,29 +0,0 @@
|
||||
package com.cm.systemcity.controller.apis.kpi;
|
||||
|
||||
import com.cm.common.base.AbstractController;
|
||||
import com.cm.common.constants.ISystemConstant;
|
||||
import com.cm.common.result.SuccessResult;
|
||||
import com.cm.common.result.SuccessResultData;
|
||||
import com.cm.systemcity.service.kpi.IKpiService;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@Api(tags = ISystemConstant.API_TAGS_SYSTEM_PREFIX + "网格员接口")
|
||||
@RestController
|
||||
@RequestMapping(ISystemConstant.API_PREFIX + "/kpi")
|
||||
public class KpiController extends AbstractController {
|
||||
|
||||
@Autowired
|
||||
private IKpiService kpiService;
|
||||
|
||||
@GetMapping("update-community-boss-day-count/{level}")
|
||||
public SuccessResultData<String> updateCommunityBossDayCount(@PathVariable("level") Integer level,
|
||||
@RequestParam("dayDate") String dayDate) {
|
||||
long startTime = System.currentTimeMillis();
|
||||
kpiService.updateCommunityBossDayCount(dayDate, level);
|
||||
long endTime = System.currentTimeMillis();
|
||||
return new SuccessResultData<>("used "+ (endTime - startTime) +" ms");
|
||||
}
|
||||
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
package com.cm.systemcity.dao.kpi;
|
||||
|
||||
import com.cm.systemcity.pojo.pos.kpi.CommunityBossDayCountPO;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Repository
|
||||
public interface IKpiDao {
|
||||
|
||||
void saveCommunityBossDayCount(Map<String, Object> params);
|
||||
|
||||
void deleteCommunityBossDayCount(Map<String, Object> params);
|
||||
|
||||
void updateCommunityBossDayCount(Map<String, Object> params);
|
||||
|
||||
CommunityBossDayCountPO getCommunityBossDayCountPO(Map<String, Object> params);
|
||||
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
package com.cm.systemcity.pojo.pos.kpi;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
|
||||
@Data
|
||||
@ToString
|
||||
public class CommunityBossDayCountPO {
|
||||
|
||||
private Long id;
|
||||
private String userId;
|
||||
private String dayDate;
|
||||
private Integer isSignin;
|
||||
private Integer isSigninLate;
|
||||
private Integer isSignout;
|
||||
private Integer isSignoutEarly;
|
||||
private Double workDistance;
|
||||
private Integer savePopulationCount;
|
||||
private Integer updatePopulationCount;
|
||||
|
||||
}
|
@ -330,7 +330,7 @@ public class BindingDepartmentServiceServiceImpl extends BaseService implements
|
||||
zTreeDTO.setId(item.getDictId());
|
||||
zTreeDTO.setName(item.getDictName());
|
||||
if (reportCase.getAreaId().equals(item.getDictId())) {
|
||||
zTreeDTO.setName(item.getDictName() + "---->【优先分派】");
|
||||
zTreeDTO.setName("【优先】" + item.getDictName());
|
||||
}
|
||||
zTreeDTO.setIsParent(true);
|
||||
zTreeDTOS.add(zTreeDTO);
|
||||
@ -348,7 +348,7 @@ public class BindingDepartmentServiceServiceImpl extends BaseService implements
|
||||
zTreeDTO.setId(item.getCommunityId());
|
||||
zTreeDTO.setName(item.getCommunityName());
|
||||
if (reportCase.getCommunityId().equals(item.getCommunityId())) {
|
||||
zTreeDTO.setName(item.getCommunityName() + "---->【优先分派】");
|
||||
zTreeDTO.setName("【优先】" + item.getCommunityName());
|
||||
}
|
||||
zTreeDTO.setIsParent(false);
|
||||
zTreeDTOS.add(zTreeDTO);
|
||||
|
@ -115,46 +115,10 @@ public class CommunityBossServiceImpl extends AbstractService implements ICommun
|
||||
public SuccessResult removeCommunityBoss(Map<String, Object> params) throws RemoveException {
|
||||
List<String> list = Arrays.asList(params.get("communityBossIds").toString().split("_"));
|
||||
Map<String, Object> query = new HashMap<>(8);
|
||||
// 查询当前删除的人是否还有其他网格身份,如果没有,将该人员下所有片区删除
|
||||
for (String communityBossId : list) {
|
||||
// 查询用户ID
|
||||
query.clear();
|
||||
query.put("communityBossId", communityBossId);
|
||||
CommunityBossDTO communityBoss = communityBossDao.getCommunityBoss(query);
|
||||
// 执行删除
|
||||
query.clear();
|
||||
List<String> communityBossIds = new ArrayList<>();
|
||||
communityBossIds.add(communityBossId);
|
||||
query.put("communityBossIds", communityBossIds);
|
||||
setUpdateInfo(query);
|
||||
communityBossDao.removeCommunityBoss(query);
|
||||
communityBossDao.deleteCommunityAndGridUserBind(query);
|
||||
// 其他网格身份
|
||||
query.clear();
|
||||
String communityBossUserId = communityBoss.getCommunityBossUserId();
|
||||
List<String> communityBossUserIds = new ArrayList<>();
|
||||
communityBossUserIds.add(communityBossUserId);
|
||||
query.put("communityBossUserIds", communityBossUserIds);
|
||||
List<CommunityBossDTO> communityBossDTOS = communityBossService.listCommunityBoss(query);
|
||||
if (communityBossDTOS == null || communityBossDTOS.size() == 0) {
|
||||
// 若没有其他网格身份,删除所有片区
|
||||
List<String> userIds = new ArrayList<>();
|
||||
userIds.add(communityBoss.getCommunityBossId());
|
||||
userIds.add(communityBoss.getCommunityBossUserId());
|
||||
query.clear();
|
||||
query.put("userIds", StringUtils.join(userIds, ","));
|
||||
List<Map<String, Object>> gridList = userPointsDao.listMapGrid(query);
|
||||
// 将查询到的所有网格删掉
|
||||
List<String> delArray = new ArrayList<>();
|
||||
for (Map<String, Object> delItem : gridList) {
|
||||
String delGridId = delItem.get("grid_id").toString();
|
||||
delArray.add(delGridId);
|
||||
gridService.deleteGridByGridIds(delArray);
|
||||
}
|
||||
}
|
||||
}
|
||||
// TODO mongoDb缓存
|
||||
// clearCommunityBossCollection();
|
||||
query.put("communityBossIds", list);
|
||||
setUpdateInfo(query);
|
||||
// 不删除网格
|
||||
removeCommunityBoss(query);
|
||||
return new SuccessResult();
|
||||
}
|
||||
|
||||
|
@ -1,15 +0,0 @@
|
||||
package com.cm.systemcity.service.kpi;
|
||||
|
||||
/**
|
||||
* 绩效考核
|
||||
*/
|
||||
public interface IKpiService {
|
||||
|
||||
/**
|
||||
* 更新4、5级网格员日统计
|
||||
* @param date
|
||||
*/
|
||||
void updateCommunityBossDayCount(String date, int level);
|
||||
|
||||
|
||||
}
|
@ -1,99 +0,0 @@
|
||||
package com.cm.systemcity.service.kpi.impl;
|
||||
|
||||
import com.cm.systemcity.dao.kpi.IKpiDao;
|
||||
import com.cm.systemcity.pojo.dtos.communityboss.CommunityBossDTO;
|
||||
import com.cm.systemcity.pojo.dtos.usersignin.UserSigninDTO;
|
||||
import com.cm.systemcity.pojo.dtos.usersignout.UserSignoutDTO;
|
||||
import com.cm.systemcity.pojo.pos.kpi.CommunityBossDayCountPO;
|
||||
import com.cm.systemcity.pojo.pos.userlocation.UserLocationPO;
|
||||
import com.cm.systemcity.service.communityboss.ICommunityBossService;
|
||||
import com.cm.systemcity.service.kpi.IKpiService;
|
||||
import com.cm.systemcity.service.userlocation.IUserLocationService;
|
||||
import com.cm.systemcity.service.usersignin.IUserSigninService;
|
||||
import com.cm.systemcity.service.usersignout.IUserSignoutService;
|
||||
import com.cm.systemcity.utils.KpiUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class KpiServiceImpl implements IKpiService {
|
||||
|
||||
@Autowired
|
||||
private IKpiDao kpiDao;
|
||||
@Autowired
|
||||
private ICommunityBossService communityBossService;
|
||||
@Autowired
|
||||
private IUserSigninService userSigninService;
|
||||
@Autowired
|
||||
private IUserSignoutService userSignoutService;
|
||||
@Autowired
|
||||
private IUserLocationService userLocationService;
|
||||
|
||||
@Override
|
||||
public void updateCommunityBossDayCount(String date, int level) {
|
||||
// communityBoss表中的level位1-4,对应的是2-5级网格员
|
||||
final int communityBossLevel = level - 1;
|
||||
List<CommunityBossDTO> communityBoss4DTOList = communityBossService.listCommunityBossByLevel(communityBossLevel);
|
||||
List<String> userIds = communityBoss4DTOList.stream().map(CommunityBossDTO::getCommunityBossUserId).filter(StringUtils::isNotBlank).collect(Collectors.toList());
|
||||
Map<String, List<UserSigninDTO>> userSigninMap = KpiUtil.mapSignIn(userSigninService, userIds, date);
|
||||
Map<String, List<UserSignoutDTO>> userSignoutMap = KpiUtil.mapSignOut(userSignoutService, userIds, date);
|
||||
// 删除当日数据
|
||||
deleteCommunityBossDayCount(date, communityBossLevel);
|
||||
communityBoss4DTOList.forEach(communityBossDTO -> {
|
||||
String userId = communityBossDTO.getCommunityBossUserId();
|
||||
List<UserSigninDTO> userSigninDTOS = userSigninMap.get(userId);
|
||||
int isSignin = userSigninDTOS == null || userSigninDTOS.size() == 0 ? 0 : 1;
|
||||
int isSigninLate = userSigninDTOS == null || userSigninDTOS.size() == 0 ? 0 : Integer.parseInt(userSigninDTOS.get(0).getIsLate());
|
||||
List<UserSignoutDTO> userSignoutDTOS = userSignoutMap.get(userId);
|
||||
int isSignout = userSignoutDTOS == null || userSignoutDTOS.size() == 0 ? 0 : 1;
|
||||
int isSignoutEarly = userSignoutDTOS == null || userSignoutDTOS.size() == 0 ? 0 : Integer.parseInt(userSignoutDTOS.get(0).getIsEarly());
|
||||
double workDistance = KpiUtil.calculateWorkDistance(userLocationService, userId, date);
|
||||
double savePopulationCount = 0;
|
||||
double updatePopulationCount = 0;
|
||||
// 新增
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("userId", userId);
|
||||
params.put("dayDate", date);
|
||||
params.put("isSignin", isSignin);
|
||||
params.put("isSigninLate", isSigninLate);
|
||||
params.put("isSignout", isSignout);
|
||||
params.put("isSignoutEarly", isSignoutEarly);
|
||||
params.put("workDistance", workDistance);
|
||||
params.put("savePopulationCount", savePopulationCount);
|
||||
params.put("updatePopulationCount", updatePopulationCount);
|
||||
params.put("level", communityBossLevel);
|
||||
kpiDao.saveCommunityBossDayCount(params);
|
||||
});
|
||||
}
|
||||
|
||||
private void deleteCommunityBossDayCount(String date, int level) {
|
||||
Map<String, Object> params = new HashMap<>(4);
|
||||
params.put("dayDate", date);
|
||||
params.put("level", level);
|
||||
kpiDao.deleteCommunityBossDayCount(params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 网格员日统计
|
||||
*
|
||||
* @param userId
|
||||
* @param date
|
||||
* @param level
|
||||
* @return
|
||||
*/
|
||||
private CommunityBossDayCountPO getCommunityBossDayCountPO(String userId, String date, int level) {
|
||||
Map<String, Object> params = new HashMap<>(8);
|
||||
params.put("userId", userId);
|
||||
params.put("dayDate", date);
|
||||
params.put("level", level);
|
||||
return kpiDao.getCommunityBossDayCountPO(params);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,89 +0,0 @@
|
||||
package com.cm.systemcity.utils;
|
||||
|
||||
import com.cm.common.utils.point.Point;
|
||||
import com.cm.common.utils.point.PointUtil;
|
||||
import com.cm.systemcity.pojo.dtos.usersignin.UserSigninDTO;
|
||||
import com.cm.systemcity.pojo.dtos.usersignout.UserSignoutDTO;
|
||||
import com.cm.systemcity.pojo.pos.userlocation.UserLocationPO;
|
||||
import com.cm.systemcity.service.userlocation.IUserLocationService;
|
||||
import com.cm.systemcity.service.usersignin.IUserSigninService;
|
||||
import com.cm.systemcity.service.usersignout.IUserSignoutService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class KpiUtil {
|
||||
|
||||
/**
|
||||
* 签到map
|
||||
*
|
||||
* @param userSigninService
|
||||
* @param userIds
|
||||
* @return
|
||||
*/
|
||||
public static Map<String, List<UserSigninDTO>> mapSignIn(IUserSigninService userSigninService, List<String> userIds, String day) {
|
||||
List<UserSigninDTO> userSigninDTOS = userSigninService.listUserSignInByUserIdsAndDay(userIds, day);
|
||||
Map<String, List<UserSigninDTO>> userSigninMap = new HashMap<>();
|
||||
userSigninDTOS.forEach(userSigninDTO -> {
|
||||
List<UserSigninDTO> userSigninDTOList = userSigninMap.get(userSigninDTO.getUserId());
|
||||
if (userSigninDTOList == null) {
|
||||
userSigninDTOList = new ArrayList<>();
|
||||
}
|
||||
userSigninDTOList.add(userSigninDTO);
|
||||
userSigninMap.put(userSigninDTO.getCreator(), userSigninDTOList);
|
||||
});
|
||||
return userSigninMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 签退map
|
||||
*
|
||||
* @param userSignoutService
|
||||
* @param userIds
|
||||
* @return
|
||||
*/
|
||||
public static Map<String, List<UserSignoutDTO>> mapSignOut(IUserSignoutService userSignoutService, List<String> userIds, String day) {
|
||||
List<UserSignoutDTO> userSignoutDTOS = userSignoutService.listUserSignOutByUserIdsAndDay(userIds, day);
|
||||
Map<String, List<UserSignoutDTO>> userSigninMap = new HashMap<>();
|
||||
userSignoutDTOS.forEach(userSignoutDTO -> {
|
||||
List<UserSignoutDTO> userSignoutDTOList = userSigninMap.get(userSignoutDTO.getUserId());
|
||||
if (userSignoutDTOList == null) {
|
||||
userSignoutDTOList = new ArrayList<>();
|
||||
}
|
||||
userSignoutDTOList.add(userSignoutDTO);
|
||||
userSigninMap.put(userSignoutDTO.getCreator(), userSignoutDTOList);
|
||||
});
|
||||
return userSigninMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算工作距离
|
||||
*
|
||||
* @param userLocationService
|
||||
* @param userId
|
||||
* @param day af535c78-f0ba-4ccf-891b-cf7c6e42e9e8
|
||||
* @return
|
||||
*/
|
||||
public static Double calculateWorkDistance(IUserLocationService userLocationService, String userId, String day) {
|
||||
double workDistance = 0D;
|
||||
if(!StringUtils.equals(userId, "af535c78-f0ba-4ccf-891b-cf7c6e42e9e8")) {
|
||||
return workDistance;
|
||||
}
|
||||
List<UserLocationPO> userLocationPOS = userLocationService.listUserLocationPOByUserIdAndDate(userId, day);
|
||||
Point tempPoint = null;
|
||||
for (UserLocationPO userLocationPO : userLocationPOS) {
|
||||
Point point = new Point(Double.parseDouble(userLocationPO.getUserLatitude()), Double.parseDouble(userLocationPO.getUserLongitude()));
|
||||
if (tempPoint == null) {
|
||||
tempPoint = point;
|
||||
continue;
|
||||
}
|
||||
workDistance += PointUtil.getDistance(tempPoint, point);
|
||||
tempPoint = point;
|
||||
}
|
||||
return workDistance;
|
||||
}
|
||||
|
||||
}
|
@ -1,90 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.cm.systemcity.dao.kpi.IKpiDao">
|
||||
|
||||
<resultMap id="communityBossDayCountPO" type="com.cm.systemcity.pojo.pos.kpi.CommunityBossDayCountPO">
|
||||
<id column="id" property="id"/>
|
||||
<result column="user_id" property="userId"/>
|
||||
<result column="day_date" property="dayDate"/>
|
||||
<result column="is_signin" property="isSignin"/>
|
||||
<result column="is_signin_late" property="isSigninLate"/>
|
||||
<result column="is_signout" property="isSignout"/>
|
||||
<result column="is_signout_early" property="isSignoutEarly"/>
|
||||
<result column="work_distance" property="workDistance"/>
|
||||
<result column="save_population_count" property="savePopulationCount"/>
|
||||
<result column="update_population_count" property="updatePopulationCount"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 保存网格员日统计 -->
|
||||
<insert id="saveCommunityBossDayCount" parameterType="map">
|
||||
INSERT INTO kpi_community_boss_${level}_day_count(
|
||||
user_id,
|
||||
day_date,
|
||||
is_signin,
|
||||
is_signin_late,
|
||||
is_signout,
|
||||
is_signout_early,
|
||||
work_distance,
|
||||
save_population_count,
|
||||
update_population_count
|
||||
) VALUES (
|
||||
#{userId},
|
||||
#{dayDate},
|
||||
#{isSignin},
|
||||
#{isSigninLate},
|
||||
#{isSignout},
|
||||
#{isSignoutEarly},
|
||||
#{workDistance},
|
||||
#{savePopulationCount},
|
||||
#{updatePopulationCount}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<!-- 删除网格员日统计 -->
|
||||
<delete id="deleteCommunityBossDayCount" parameterType="map">
|
||||
DELETE FROM
|
||||
kpi_community_boss_${level}_day_count
|
||||
WHERE
|
||||
day_date = #{dayDate}
|
||||
</delete>
|
||||
|
||||
<!-- 修改网格员日统计 -->
|
||||
<update id="updateCommunityBossDayCount" parameterType="map">
|
||||
UPDATE
|
||||
kpi_community_boss_${level}_day_count
|
||||
SET
|
||||
is_signin = #{isSignin},
|
||||
is_signin_late = #{isSigninLate},
|
||||
is_signout = #{isSignout},
|
||||
is_signout_early = #{isSignoutEarly},
|
||||
work_distance = #{workDistance},
|
||||
save_population_count = #{savePopulationCount},
|
||||
update_population_count = #{updatePopulationCount}
|
||||
WHERE
|
||||
user_id = #{userId}
|
||||
AND
|
||||
day_date = #{dayDate}
|
||||
</update>
|
||||
|
||||
<!-- 详情 -->
|
||||
<select id="getCommunityBossDayCountPO" parameterType="map" resultMap="communityBossDayCountPO">
|
||||
SELECT
|
||||
id,
|
||||
user_id,
|
||||
day_date,
|
||||
is_signin,
|
||||
is_signin_late,
|
||||
is_signout,
|
||||
is_signout_early,
|
||||
work_distance,
|
||||
save_population_count,
|
||||
update_population_count
|
||||
FROM
|
||||
kpi_community_boss_${level}_day_count
|
||||
WHERE
|
||||
user_id = #{userId}
|
||||
AND
|
||||
day_date = #{dayDate}
|
||||
</select>
|
||||
|
||||
</mapper>
|
@ -27,8 +27,7 @@
|
||||
</select>
|
||||
</script>
|
||||
<div class="layui-inline">
|
||||
<input type="text" id="keywords" class="layui-input" style="height: 38px;width:150px;"
|
||||
autocomplete="off" placeholder="姓名|用户账号">
|
||||
<input type="text" id="keywords" class="layui-input" style="height: 38px;width:150px;" autocomplete="off" placeholder="姓名|用户账号">
|
||||
</div>
|
||||
<button type="button" id="search" class="layui-btn layui-btn-sm">
|
||||
<i class="fa fa-lg fa-search"></i> 搜索
|
||||
@ -41,6 +40,12 @@
|
||||
<button type="button" class="layui-btn layui-btn-sm" lay-event="saveEvent">
|
||||
<i class="fa fa-lg fa-plus"></i> 新增
|
||||
</button>
|
||||
<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-danger layui-btn-sm" lay-event="removeEvent">
|
||||
<i class="fa fa-lg fa-trash"></i> 删除
|
||||
</button>
|
||||
</div>
|
||||
</script>
|
||||
</div>
|
||||
@ -201,12 +206,12 @@
|
||||
function update(id) {
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: false,
|
||||
title: '修改三级网格长',
|
||||
closeBtn: 0,
|
||||
area: ['100%', '100%'],
|
||||
shadeClose: true,
|
||||
area: ['50%', '70%'],
|
||||
shadeClose: false,
|
||||
anim: 2,
|
||||
content: top.restAjax.path('route/communityboss/update.html?communityBossId={id}', [id]),
|
||||
content: top.restAjax.path('route/communityboss/update-level2.html?communityBossId={id}', [id]),
|
||||
end: function() {
|
||||
reloadTable(1);
|
||||
}
|
||||
|
@ -41,9 +41,9 @@
|
||||
<button type="button" class="layui-btn layui-btn-sm" lay-event="saveEvent">
|
||||
<i class="fa fa-lg fa-plus"></i> 新增
|
||||
</button>
|
||||
<!--<button type="button" class="layui-btn layui-btn-normal layui-btn-sm" lay-event="updateEvent">
|
||||
<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>
|
||||
<button type="button" class="layui-btn layui-btn-danger layui-btn-sm" lay-event="removeEvent">
|
||||
<i class="fa fa-lg fa-trash"></i> 删除
|
||||
</button>
|
||||
@ -92,18 +92,6 @@
|
||||
}
|
||||
initArea();
|
||||
|
||||
// 社区列表格式化
|
||||
function communitiesFormatter(val, row) {
|
||||
var value = '';
|
||||
for(var i = 0, item = val[i]; item = val[i++];) {
|
||||
if(value.length > 0) {
|
||||
value += ','
|
||||
}
|
||||
value += item.communityName;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
// 新增
|
||||
function save() {
|
||||
layer.open({
|
||||
@ -124,12 +112,12 @@
|
||||
function update(id) {
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: false,
|
||||
title: '修改四级网格长',
|
||||
closeBtn: 0,
|
||||
area: ['100%', '100%'],
|
||||
shadeClose: true,
|
||||
area: ['50%', '70%'],
|
||||
shadeClose: false,
|
||||
anim: 2,
|
||||
content: top.restAjax.path('route/communityboss/update.html?communityBossId={id}', [id]),
|
||||
content: top.restAjax.path('route/communityboss/update-level3.html?communityBossId={id}', [id]),
|
||||
end: function() {
|
||||
reloadTable(1);
|
||||
}
|
||||
@ -230,13 +218,12 @@
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'communities', width: 200, title: '社区', align:'center',
|
||||
{field: 'communityNames', width: 200, title: '社区', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
rowData = communitiesFormatter(rowData);
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
|
@ -31,7 +31,7 @@
|
||||
<select id="communityId" name="communityId">
|
||||
<option value="">选择社区(村)</option>
|
||||
{{# for(var i = 0, item; item = d[i++];) { }}
|
||||
<option value="{{item.community_id}}">{{item.community_name}}</option>
|
||||
<option value="{{item.community_id}}">{{item.community_name}}{{item.community_id}}</option>
|
||||
{{# } }}
|
||||
</select>
|
||||
</script>
|
||||
|
@ -195,7 +195,6 @@
|
||||
document.getElementById('parentGridBox').innerHTML = html;
|
||||
});
|
||||
form.render();
|
||||
console.log(data);
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
});
|
||||
|
@ -9,6 +9,9 @@
|
||||
<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-select dl {height: 150px}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="">
|
||||
@ -174,12 +177,13 @@
|
||||
// 选择社区
|
||||
form.on('select(communityChange)', function(data) {
|
||||
formObject.communityId = data.value;
|
||||
initCommunityBossParentSelect(data.value == '' ? '' : data.value);
|
||||
initCommunityBossParentSelect(data.value);
|
||||
});
|
||||
|
||||
// 初始化上级网格长
|
||||
function initCommunityBossParentSelect(selectValue) {
|
||||
if(typeof (selectValue) === 'undefined' || selectValue == ''){
|
||||
var areaId = $('#areaId').val()
|
||||
if(!areaId){
|
||||
laytpl(document.getElementById('parentGridTemplate').innerHTML).render([], function(html) {
|
||||
document.getElementById('parentGridBox').innerHTML = html;
|
||||
});
|
||||
@ -188,15 +192,14 @@
|
||||
}
|
||||
top.restAjax.get(top.restAjax.path('api/communityboss/listcommunityboss', []),
|
||||
{
|
||||
areaId: formObject.areaId,
|
||||
communityId: selectValue,
|
||||
areaId: areaId,
|
||||
communityId: selectValue ? selectValue : '',
|
||||
communityBossLevel: communityBossLevel -1
|
||||
}, null, function(code, data, args) {
|
||||
laytpl(document.getElementById('parentGridTemplate').innerHTML).render(data, function(html) {
|
||||
document.getElementById('parentGridBox').innerHTML = html;
|
||||
});
|
||||
form.render();
|
||||
console.log(data);
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
});
|
||||
|
@ -179,24 +179,23 @@
|
||||
|
||||
// 初始化上级网格长
|
||||
function initCommunityBossParentSelect(selectValue) {
|
||||
if(typeof (selectValue) === 'undefined' || selectValue == ''){
|
||||
var areaId = $('#areaId').val();
|
||||
if(!areaId) {
|
||||
laytpl(document.getElementById('parentGridTemplate').innerHTML).render([], function(html) {
|
||||
document.getElementById('parentGridBox').innerHTML = html;
|
||||
});
|
||||
form.render();
|
||||
return;
|
||||
}
|
||||
top.restAjax.get(top.restAjax.path('api/communityboss/listcommunityboss', []),
|
||||
{
|
||||
areaId: formObject.areaId,
|
||||
communityId: selectValue,
|
||||
top.restAjax.get(top.restAjax.path('api/communityboss/listcommunityboss', []), {
|
||||
areaId: areaId,
|
||||
communityId: selectValue ? selectValue : '',
|
||||
communityBossLevel: communityBossLevel -1
|
||||
}, null, function(code, data, args) {
|
||||
laytpl(document.getElementById('parentGridTemplate').innerHTML).render(data, function(html) {
|
||||
document.getElementById('parentGridBox').innerHTML = html;
|
||||
});
|
||||
form.render();
|
||||
console.log(data);
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
});
|
||||
|
277
src/main/resources/static/route/communityboss/update-level2.html
Normal file
277
src/main/resources/static/route/communityboss/update-level2.html
Normal file
@ -0,0 +1,277 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<base href="/servicecity/">
|
||||
<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-select dl {height: 150px !important;}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-body" style="padding: 15px;">
|
||||
<form class="layui-form" lay-filter="dataForm">
|
||||
<div class="row">
|
||||
<div class="layui-inline layui-form" id="areaSelectBox"></div>
|
||||
<script id="areaSelectTemplate" type="text/html">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label" style="width: 100px;"><span style="color: #cc0000">*</span>所属街镇</label>
|
||||
<div class="layui-input-block" style="margin-left: 130px;">
|
||||
<select id="areaId" name="areaId" lay-filter="areaChange" lay-verify="required">
|
||||
<option value="">选择街镇</option>
|
||||
{{# for(var i = 0, item; item = d[i++];) { }}
|
||||
<option value="{{item.dictId}}">{{item.dictName}}</option>
|
||||
{{# } }}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="layui-inline layui-form" id="parentGridBox"></div>
|
||||
<script id="parentGridTemplate" type="text/html">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label" style="width: 100px;"><span style="color: #cc0000">*</span>上级网格长</label>
|
||||
<div class="layui-input-block" style="margin-left: 130px;">
|
||||
<select id="communityBossParentId" name="communityBossParentId" lay-filter="communityBossParentChange" lay-verify="required">
|
||||
<option value="">选择上级网格长</option>
|
||||
{{# for(var i = 0, item; item = d[i++];) { }}
|
||||
<option value="{{item.communityBossId}}" data-community-boss-parent-user-id="{{item.communityBossUserId}}">
|
||||
{{item.communityBossName}}
|
||||
</option>
|
||||
{{# } }}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label" style="width: 100px;"><span style="color: #cc0000">*</span>选择人员</label>
|
||||
<div class="layui-input-block" style="margin-left: 130px;">
|
||||
<input type="text" name="communityBossName" id="communityBossName" placeholder="点击选择人员"
|
||||
class="layui-input" style="cursor: pointer" lay-verify="required">
|
||||
<input type="hidden" name="communityBossUserId" id="communityBossUserId" value="">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="layui-inline layui-form" id="communityBox"></div>
|
||||
<script id="communityTemplate" type="text/html">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label" style="width: 100px;"><span style="color: #cc0000">*</span>所属社区(村)</label>
|
||||
<div class="layui-input-block" style="margin-left: 130px;">
|
||||
<select id="communityId" name="communityId" lay-filter="communityChange" lay-verify="required">
|
||||
<option value="">选择社区(村)</option>
|
||||
{{# for(var i = 0, item; item = d[i++];) { }}
|
||||
<option value="{{item.communityId}}">{{item.communityName}}</option>
|
||||
{{# } }}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item layui-form-text">
|
||||
<label class="layui-form-label" style="width: 100px;">补充描述信息</label>
|
||||
<div class="layui-input-block" style="margin-left: 130px;">
|
||||
<textarea name="gridSummary" placeholder="补充描述信息" class="layui-textarea"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item layui-layout-admin">
|
||||
<div class="layui-input-block">
|
||||
<div class="layui-footer" style="left: 0;">
|
||||
<button 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>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="assets/layuiadmin/layui/layui.js"></script>
|
||||
<script type="text/javascript">
|
||||
layui.config({
|
||||
base: 'assets/layuiadmin/' //静态资源所在路径
|
||||
}).extend({
|
||||
index: 'lib/index' //主入口模块
|
||||
}).use(['index', 'form', 'laytpl'], function () {
|
||||
var $ = layui.$;
|
||||
var form = layui.form;
|
||||
var laytpl = layui.laytpl;
|
||||
var communityBossId = top.restAjax.params(window.location.href).communityBossId;
|
||||
|
||||
var communityBossLevel = 2;
|
||||
$('.layui-card').height($(window).height());
|
||||
|
||||
var formObject = {
|
||||
communityBossUserId: null,
|
||||
communityBossUsername: null,
|
||||
communityBossName: null,
|
||||
communityBossParentUserId: '0',
|
||||
communityBossParentName: null,
|
||||
communityBossLevel: communityBossLevel,
|
||||
areaId: null,
|
||||
areaName: null,
|
||||
communityId: null,
|
||||
communityName: null,
|
||||
districtId: null,
|
||||
districtName: null,
|
||||
buildingId: null,
|
||||
buildingName: null,
|
||||
gridSummary: null
|
||||
};
|
||||
|
||||
function init() {
|
||||
top.restAjax.get(top.restAjax.path('api/communityboss/getcommunityboss/{communityBossId}', [communityBossId]), {}, null, function (code, data) {
|
||||
var dataFormData = {};
|
||||
for (var i in data) {
|
||||
dataFormData[i] = data[i];
|
||||
}
|
||||
|
||||
initAreaSelect(dataFormData['areaId'], function () {
|
||||
initCommunitySelect(dataFormData['areaId'], dataFormData['communityId'], function () {});
|
||||
initCommunityBossParentSelect(dataFormData['communityBossParentId']);
|
||||
});
|
||||
form.val('dataForm', dataFormData);
|
||||
form.render();
|
||||
}, function (code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
});
|
||||
|
||||
};
|
||||
init();
|
||||
|
||||
// 初始化街镇
|
||||
function initAreaSelect(selectValue, callback) {
|
||||
top.restAjax.get(top.restAjax.path('api/dict/listdict/9d179f05-3ea0-48f7-853c-d3b7124b791c', []), {}, null, function (code, data, args) {
|
||||
laytpl(document.getElementById('areaSelectTemplate').innerHTML).render(data, function (html) {
|
||||
document.getElementById('areaSelectBox').innerHTML = html;
|
||||
});
|
||||
form.val('dataForm', {areaId: selectValue});
|
||||
form.render();
|
||||
callback();
|
||||
}, function (code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
});
|
||||
}
|
||||
|
||||
// 选择街道
|
||||
form.on('select(areaChange)', function (data) {
|
||||
initCommunitySelect(data.value);
|
||||
initCommunityBossParentSelect();
|
||||
});
|
||||
|
||||
// 初始化社区
|
||||
function initCommunitySelect(areaId, selectValue, callback) {
|
||||
if (!areaId) {
|
||||
laytpl(document.getElementById('parentGridTemplate').innerHTML).render([], function (html) {
|
||||
document.getElementById('parentGridBox').innerHTML = html;
|
||||
});
|
||||
form.render();
|
||||
return;
|
||||
}
|
||||
top.restAjax.get(top.restAjax.path('api/community/listcommunity?areaId={areaId}', [areaId]), {}, null, function (code, data, args) {
|
||||
laytpl(document.getElementById('communityTemplate').innerHTML).render(data, function (html) {
|
||||
document.getElementById('communityBox').innerHTML = html;
|
||||
});
|
||||
form.val('dataForm', {communityId: selectValue});
|
||||
form.render();
|
||||
callback()
|
||||
}, function (code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
});
|
||||
}
|
||||
|
||||
// 选择社区
|
||||
form.on('select(communityChange)', function (data) {
|
||||
initCommunityBossParentSelect(data.value);
|
||||
});
|
||||
|
||||
// 初始化上级网格长
|
||||
function initCommunityBossParentSelect(selectValue) {
|
||||
top.restAjax.get(top.restAjax.path('api/communityboss/listcommunityboss', []),
|
||||
{
|
||||
areaId: $('#areaId').val(),
|
||||
communityId: '',
|
||||
communityBossLevel: communityBossLevel - 1
|
||||
}, null, function (code, data, args) {
|
||||
laytpl(document.getElementById('parentGridTemplate').innerHTML).render(data, function (html) {
|
||||
document.getElementById('parentGridBox').innerHTML = html;
|
||||
});
|
||||
form.val('dataForm', {communityBossParentId: selectValue});
|
||||
form.val('dataForm', {communityBossParentId: selectValue});
|
||||
form.render();
|
||||
}, function (code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
});
|
||||
}
|
||||
|
||||
// 选择人员-按钮绑定
|
||||
$(document).on('click', '#communityBossName', function () {
|
||||
selectGridUser();
|
||||
});
|
||||
|
||||
// 选择人员
|
||||
function selectGridUser() {
|
||||
top.dialog.dialogData.selectedUserIds = $('#communityBossUserId').val();
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: '选择人员',
|
||||
closeBtn: 0,
|
||||
area: ['45%', '95%'],
|
||||
shadeClose: false,
|
||||
anim: 2,
|
||||
content: top.restAjax.path('route/communityboss/select-grid-user.html', []),
|
||||
end: function () {
|
||||
var selectedUsers = top.dialog.dialogData.selectedUsers;
|
||||
if (selectedUsers.length == 0) {
|
||||
$('#communityBossUserId').val('');
|
||||
$('#communityBossName').val('');
|
||||
}
|
||||
if (selectedUsers.length > 0) {
|
||||
$('#communityBossUserId').val(selectedUsers[0].userId);
|
||||
$('#communityBossName').val(selectedUsers[0].userName + '[' + selectedUsers[0].userUsername + ']');
|
||||
}
|
||||
top.dialog.dialogData.selectedUserIds = '';
|
||||
top.dialog.dialogData.selectedUsers = [];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
form.on('submit(submitForm)', function (formData) {
|
||||
top.dialog.confirm(top.dataMessage.commit, function (index) {
|
||||
top.dialog.close(index);
|
||||
formData.field['communityBossLevel'] = communityBossLevel;
|
||||
formData.field['communityBossParentUserId'] = $('#communityBossParentId').find('option:selected').data().communityBossParentUserId;
|
||||
formData.field['areaName'] = $('#areaId').find('option:selected').text();
|
||||
top.restAjax.put(top.restAjax.path('api/communityboss/updatecommunityboss/{communityBossId}', [communityBossId]), formData.field, null, function (code, data) {
|
||||
top.dialog.msg("修改完成");
|
||||
closeBox();
|
||||
}, function (code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
});
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
function closeBox() {
|
||||
parent.layer.close(parent.layer.getFrameIndex(window.name));
|
||||
}
|
||||
|
||||
$('.close').on('click', function () {
|
||||
closeBox();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
288
src/main/resources/static/route/communityboss/update-level3.html
Normal file
288
src/main/resources/static/route/communityboss/update-level3.html
Normal file
@ -0,0 +1,288 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<base href="/servicecity/">
|
||||
<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-select dl {height: 150px !important;}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-body" style="padding: 15px;">
|
||||
<form class="layui-form" lay-filter="dataForm">
|
||||
<div class="row">
|
||||
<div class="layui-inline layui-form" id="areaSelectBox"></div>
|
||||
<script id="areaSelectTemplate" type="text/html">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label" style="width: 100px;"><span style="color: #cc0000">*</span>所属街镇</label>
|
||||
<div class="layui-input-block" style="margin-left: 130px;">
|
||||
<select id="areaId" name="areaId" lay-filter="areaChange" lay-verify="required">
|
||||
<option value="">选择街镇</option>
|
||||
{{# for(var i = 0, item; item = d[i++];) { }}
|
||||
<option value="{{item.dictId}}">{{item.dictName}}</option>
|
||||
{{# } }}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="layui-inline layui-form" id="communityBox"></div>
|
||||
<script id="communityTemplate" type="text/html">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label" style="width: 100px;"><span style="color: #cc0000">*</span>所属社区(村)</label>
|
||||
<div class="layui-input-block" style="margin-left: 130px;">
|
||||
<select id="communityId" name="communityId" lay-filter="communityChange" lay-verify="required">
|
||||
<option value="">选择社区(村)</option>
|
||||
{{# for(var i = 0, item; item = d[i++];) { }}
|
||||
<option value="{{item.communityId}}">{{item.communityName}}</option>
|
||||
{{# } }}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="layui-inline layui-form" id="parentGridBox"></div>
|
||||
<script id="parentGridTemplate" type="text/html">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label" style="width: 100px;"><span style="color: #cc0000">*</span>上级网格长</label>
|
||||
<div class="layui-input-block" style="margin-left: 130px;">
|
||||
<select id="communityBossParentId" name="communityBossParentId" lay-filter="communityBossParentChange" lay-verify="required">
|
||||
<option value="">选择上级网格长</option>
|
||||
{{# for(var i = 0, item; item = d[i++];) { }}
|
||||
<option value="{{item.communityBossId}}" data-community-boss-parent-user-id="{{item.communityBossUserId}}">
|
||||
{{item.communityBossName}}
|
||||
</option>
|
||||
{{# } }}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label" style="width: 100px;"><span style="color: #cc0000">*</span>选择人员</label>
|
||||
<div class="layui-input-block" style="margin-left: 130px;">
|
||||
<input type="text" name="communityBossName" id="communityBossName" placeholder="点击选择人员"
|
||||
class="layui-input" style="cursor: pointer" lay-verify="required">
|
||||
<input type="hidden" name="communityBossUserId" id="communityBossUserId" value="">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item layui-form-text">
|
||||
<label class="layui-form-label" style="width: 100px;">补充描述信息</label>
|
||||
<div class="layui-input-block" style="margin-left: 130px;">
|
||||
<textarea name="gridSummary" placeholder="补充描述信息" class="layui-textarea"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item layui-layout-admin">
|
||||
<div class="layui-input-block">
|
||||
<div class="layui-footer" style="left: 0;">
|
||||
<button 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>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="assets/layuiadmin/layui/layui.js"></script>
|
||||
<script type="text/javascript">
|
||||
layui.config({
|
||||
base: 'assets/layuiadmin/' //静态资源所在路径
|
||||
}).extend({
|
||||
index: 'lib/index' //主入口模块
|
||||
}).use(['index', 'form', 'laytpl'], function () {
|
||||
var $ = layui.$;
|
||||
var form = layui.form;
|
||||
var laytpl = layui.laytpl;
|
||||
var communityBossId = top.restAjax.params(window.location.href).communityBossId;
|
||||
|
||||
var communityBossLevel = 3;
|
||||
$('.layui-card').height($(window).height());
|
||||
|
||||
var formObject = {
|
||||
communityBossUserId: null,
|
||||
communityBossUsername: null,
|
||||
communityBossName: null,
|
||||
communityBossParentUserId: '0',
|
||||
communityBossParentName: null,
|
||||
communityBossLevel: communityBossLevel,
|
||||
areaId: null,
|
||||
areaName: null,
|
||||
communityId: null,
|
||||
communityName: null,
|
||||
districtId: null,
|
||||
districtName: null,
|
||||
buildingId: null,
|
||||
buildingName: null,
|
||||
gridSummary: null
|
||||
};
|
||||
|
||||
function init() {
|
||||
top.restAjax.get(top.restAjax.path('api/communityboss/getcommunityboss/{communityBossId}', [communityBossId]), {}, null, function (code, data) {
|
||||
var dataFormData = {};
|
||||
for (var i in data) {
|
||||
dataFormData[i] = data[i];
|
||||
}
|
||||
|
||||
initAreaSelect(dataFormData['areaId'], function () {
|
||||
initCommunitySelect(dataFormData['areaId'], dataFormData['communityId'], function () {
|
||||
initCommunityBossParentSelect(dataFormData['communityId'], dataFormData['communityBossParentId']);
|
||||
});
|
||||
});
|
||||
form.val('dataForm', dataFormData);
|
||||
form.render();
|
||||
}, function (code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
});
|
||||
|
||||
};
|
||||
init();
|
||||
|
||||
// 初始化街镇
|
||||
function initAreaSelect(selectValue, callback) {
|
||||
top.restAjax.get(top.restAjax.path('api/dict/listdict/9d179f05-3ea0-48f7-853c-d3b7124b791c', []), {}, null, function (code, data, args) {
|
||||
laytpl(document.getElementById('areaSelectTemplate').innerHTML).render(data, function (html) {
|
||||
document.getElementById('areaSelectBox').innerHTML = html;
|
||||
});
|
||||
form.val('dataForm', {areaId: selectValue});
|
||||
form.render();
|
||||
callback();
|
||||
}, function (code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
});
|
||||
}
|
||||
|
||||
// 选择街道
|
||||
form.on('select(areaChange)', function (data) {
|
||||
initCommunitySelect(data.value);
|
||||
initCommunityBossParentSelect();
|
||||
});
|
||||
|
||||
// 初始化社区
|
||||
function initCommunitySelect(areaId, selectValue, callback) {
|
||||
if (!areaId) {
|
||||
laytpl(document.getElementById('parentGridTemplate').innerHTML).render([], function (html) {
|
||||
document.getElementById('parentGridBox').innerHTML = html;
|
||||
});
|
||||
form.render();
|
||||
return;
|
||||
}
|
||||
top.restAjax.get(top.restAjax.path('api/community/listcommunity?areaId={areaId}', [areaId]), {}, null, function (code, data, args) {
|
||||
laytpl(document.getElementById('communityTemplate').innerHTML).render(data, function (html) {
|
||||
document.getElementById('communityBox').innerHTML = html;
|
||||
});
|
||||
form.val('dataForm', {communityId: selectValue});
|
||||
form.render();
|
||||
callback()
|
||||
}, function (code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
});
|
||||
}
|
||||
|
||||
// 选择社区
|
||||
form.on('select(communityChange)', function (data) {
|
||||
initCommunityBossParentSelect(data.value);
|
||||
});
|
||||
|
||||
// 初始化上级网格长
|
||||
function initCommunityBossParentSelect(communityId, selectValue) {
|
||||
var areaId = $('#areaId').val();
|
||||
if(!areaId) {
|
||||
if (!communityId) {
|
||||
laytpl(document.getElementById('parentGridTemplate').innerHTML).render([], function (html) {
|
||||
document.getElementById('parentGridBox').innerHTML = html;
|
||||
});
|
||||
form.render();
|
||||
return;
|
||||
}
|
||||
}
|
||||
top.restAjax.get(top.restAjax.path('api/communityboss/listcommunityboss', []),
|
||||
{
|
||||
areaId: $('#areaId').val(),
|
||||
communityId: communityId ? communityId : '',
|
||||
communityBossLevel: communityBossLevel - 1
|
||||
}, null, function (code, data, args) {
|
||||
laytpl(document.getElementById('parentGridTemplate').innerHTML).render(data, function (html) {
|
||||
document.getElementById('parentGridBox').innerHTML = html;
|
||||
});
|
||||
form.val('dataForm', {communityBossParentId: selectValue});
|
||||
form.val('dataForm', {communityBossParentId: selectValue});
|
||||
form.render();
|
||||
}, function (code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
});
|
||||
}
|
||||
|
||||
// 选择人员-按钮绑定
|
||||
$(document).on('click', '#communityBossName', function () {
|
||||
selectGridUser();
|
||||
});
|
||||
|
||||
// 选择人员
|
||||
function selectGridUser() {
|
||||
top.dialog.dialogData.selectedUserIds = $('#communityBossUserId').val();
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: '选择人员',
|
||||
closeBtn: 0,
|
||||
area: ['45%', '95%'],
|
||||
shadeClose: false,
|
||||
anim: 2,
|
||||
content: top.restAjax.path('route/communityboss/select-grid-user.html', []),
|
||||
end: function () {
|
||||
var selectedUsers = top.dialog.dialogData.selectedUsers;
|
||||
if (selectedUsers.length == 0) {
|
||||
$('#communityBossUserId').val('');
|
||||
$('#communityBossName').val('');
|
||||
}
|
||||
if (selectedUsers.length > 0) {
|
||||
$('#communityBossUserId').val(selectedUsers[0].userId);
|
||||
$('#communityBossName').val(selectedUsers[0].userName + '[' + selectedUsers[0].userUsername + ']');
|
||||
}
|
||||
top.dialog.dialogData.selectedUserIds = '';
|
||||
top.dialog.dialogData.selectedUsers = [];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
form.on('submit(submitForm)', function (formData) {
|
||||
top.dialog.confirm(top.dataMessage.commit, function (index) {
|
||||
top.dialog.close(index);
|
||||
formData.field['communityBossLevel'] = communityBossLevel;
|
||||
formData.field['communityBossParentUserId'] = $('#communityBossParentId').find('option:selected').data().communityBossParentUserId;
|
||||
formData.field['areaName'] = $('#areaId').find('option:selected').text();
|
||||
top.restAjax.put(top.restAjax.path('api/communityboss/updatecommunityboss/{communityBossId}', [communityBossId]), formData.field, null, function (code, data) {
|
||||
top.dialog.msg("修改完成");
|
||||
closeBox();
|
||||
}, function (code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
});
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
function closeBox() {
|
||||
parent.layer.close(parent.layer.getFrameIndex(window.name));
|
||||
}
|
||||
|
||||
$('.close').on('click', function () {
|
||||
closeBox();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -132,12 +132,12 @@
|
||||
for(var i in data) {
|
||||
dataFormData[i] = data[i];
|
||||
}
|
||||
formObject.areaId = dataFormData['areaId'];
|
||||
formObject.communityId = dataFormData['communityId'];
|
||||
initAreaSelect(formObject.areaId);
|
||||
initCommunitySelect(formObject.areaId, formObject.communityId);
|
||||
initAreaSelect(dataFormData['areaId'], function() {
|
||||
initCommunitySelect(dataFormData['areaId'], dataFormData['communityId'], function () {
|
||||
initCommunityBossParentSelect(dataFormData['communityId'], dataFormData['communityBossParentId']);
|
||||
});
|
||||
});
|
||||
form.val('dataForm', dataFormData);
|
||||
initCommunityBossParentSelect(formObject.communityId, dataFormData['communityBossParentId']);
|
||||
form.render();
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
@ -146,13 +146,14 @@
|
||||
init();
|
||||
|
||||
// 初始化街镇
|
||||
function initAreaSelect(selectValue) {
|
||||
function initAreaSelect(selectValue, callback) {
|
||||
top.restAjax.get(top.restAjax.path('api/dict/listdict/9d179f05-3ea0-48f7-853c-d3b7124b791c', []), {}, null, function(code, data, args) {
|
||||
laytpl(document.getElementById('areaSelectTemplate').innerHTML).render(data, function(html) {
|
||||
document.getElementById('areaSelectBox').innerHTML = html;
|
||||
});
|
||||
form.val('dataForm', {areaId : selectValue});
|
||||
form.val('dataForm', {areaId: selectValue});
|
||||
form.render();
|
||||
callback();
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
});
|
||||
@ -160,15 +161,13 @@
|
||||
|
||||
// 选择街道
|
||||
form.on('select(areaChange)', function(data) {
|
||||
formObject.areaId = data.value;
|
||||
initCommunitySelect(data.value == '' ? '' : data.value, '');
|
||||
formObject.communityId = '';
|
||||
initCommunitySelect(data.value);
|
||||
initCommunityBossParentSelect('','');
|
||||
});
|
||||
|
||||
// 初始化社区
|
||||
function initCommunitySelect(areaId, selectValue) {
|
||||
if(typeof (areaId) === 'undefined' || areaId == ''){
|
||||
function initCommunitySelect(areaId, selectValue, callback) {
|
||||
if(!areaId){
|
||||
laytpl(document.getElementById('communityTemplate').innerHTML).render([], function(html) {
|
||||
document.getElementById('communityBox').innerHTML = html;
|
||||
});
|
||||
@ -179,8 +178,9 @@
|
||||
laytpl(document.getElementById('communityTemplate').innerHTML).render(data, function(html) {
|
||||
document.getElementById('communityBox').innerHTML = html;
|
||||
});
|
||||
form.val('dataForm', {communityId : selectValue});
|
||||
form.val('dataForm', {communityId: selectValue});
|
||||
form.render();
|
||||
callback();
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
});
|
||||
@ -189,22 +189,22 @@
|
||||
// 选择社区
|
||||
form.on('select(communityChange)', function(data) {
|
||||
formObject.communityId = data.value;
|
||||
initCommunityBossParentSelect(data.value == '' ? '' : data.value, '');
|
||||
initCommunityBossParentSelect(data.value);
|
||||
});
|
||||
|
||||
// 初始化上级网格长
|
||||
function initCommunityBossParentSelect(communityId, selectValue) {
|
||||
if(typeof (communityId) === 'undefined' || communityId == ''){
|
||||
var areaId = $('#areaId').val();
|
||||
if(!areaId){
|
||||
laytpl(document.getElementById('parentGridTemplate').innerHTML).render([], function(html) {
|
||||
document.getElementById('parentGridBox').innerHTML = html;
|
||||
});
|
||||
form.render();
|
||||
return;
|
||||
}
|
||||
top.restAjax.get(top.restAjax.path('api/communityboss/listcommunityboss', []),
|
||||
{
|
||||
areaId: formObject.areaId,
|
||||
communityId: communityId,
|
||||
top.restAjax.get(top.restAjax.path('api/communityboss/listcommunityboss', []), {
|
||||
areaId: areaId,
|
||||
communityId: communityId ? communityId : '',
|
||||
communityBossLevel: communityBossLevel -1
|
||||
}, null, function(code, data, args) {
|
||||
laytpl(document.getElementById('parentGridTemplate').innerHTML).render(data, function(html) {
|
||||
|
@ -54,8 +54,7 @@
|
||||
<div class="layui-form-item layui-form-text">
|
||||
<label class="layui-form-label"><span style="color: red">*</span>处理人员</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" class="layui-input" id="handleUserName" name="handleUserName" placeholder="请选择处理人"
|
||||
style="cursor: pointer;" readonly="readonly" lay-verify="required">
|
||||
<input type="text" class="layui-input" id="handleUserName" name="handleUserName" placeholder="请选择处理人" style="cursor: pointer;" readonly="readonly" lay-verify="required">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -127,7 +126,7 @@
|
||||
}
|
||||
initData();
|
||||
|
||||
$(document).on('click', '#handleUserName', function(){
|
||||
$(document).on('click', '#handleUserName', function() {
|
||||
selectNPerson();
|
||||
});
|
||||
|
||||
@ -140,8 +139,8 @@
|
||||
shadeClose: false,
|
||||
closeBtn: 1,
|
||||
shade: 0.3,
|
||||
area: ['60%', '90%'],
|
||||
content: 'route/reportcase/select-street-person.html?single=false&selectedUserIds=' + handleUserId,
|
||||
area: ['80%', '88%'],
|
||||
content: 'route/reportcase/select-street-person.html?reportCaseId='+ reportCaseId +'&single=false&selectedUserIds=' + handleUserId,
|
||||
end: function () {
|
||||
handleUserId = '';
|
||||
handleUserName = '';
|
||||
|
@ -112,19 +112,19 @@
|
||||
$('#areaId').val(areaId);
|
||||
$('#areaName').val(areaName);
|
||||
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: '案件转派',
|
||||
closeBtn: 1,
|
||||
area: ['50%', '80%'],
|
||||
shadeClose: false,
|
||||
shade : 0.3,
|
||||
anim: 2,
|
||||
content: top.restAjax.path('route/reportcase/case_assign.html?reportCaseId=0208cfb8-07fa-478c-8c65-80a944371e04', []),
|
||||
end: function() {
|
||||
reloadTable();
|
||||
}
|
||||
});
|
||||
// layer.open({
|
||||
// type: 2,
|
||||
// title: '案件转派',
|
||||
// closeBtn: 1,
|
||||
// area: ['50%', '80%'],
|
||||
// shadeClose: false,
|
||||
// shade : 0.3,
|
||||
// anim: 2,
|
||||
// content: top.restAjax.path('route/reportcase/case_assign.html?reportCaseId=0208cfb8-07fa-478c-8c65-80a944371e04', []),
|
||||
// end: function() {
|
||||
// reloadTable();
|
||||
// }
|
||||
// });
|
||||
|
||||
// 初始化表格
|
||||
function initTable() {
|
||||
|
@ -22,6 +22,12 @@
|
||||
background-color: #009688;
|
||||
border-color: #009688;
|
||||
}
|
||||
.dept-selector .selector-tree .selector-tree-wrapper {
|
||||
overflow: auto;
|
||||
}
|
||||
.list-group {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
@ -64,6 +70,7 @@
|
||||
var hrefParams = top.restAjax.params(window.location.href);
|
||||
var selectedUserIds = hrefParams.selectedUserIds;
|
||||
var reportCaseId = hrefParams.reportCaseId;
|
||||
var $win = $(window);
|
||||
if(typeof (selectedUserIds) === 'undefined'){
|
||||
selectedUserIds = '';
|
||||
}
|
||||
@ -78,6 +85,10 @@
|
||||
|
||||
$(function() {
|
||||
$('#app').fadeTo(1000, 1);
|
||||
$('#users').css({
|
||||
height: ($win.height() - 158) +'px',
|
||||
overflow: 'auto'
|
||||
})
|
||||
initThree();
|
||||
initSelectedUsers();
|
||||
top.dialog.dialogData.selectedDepartmentUsers = null;
|
||||
@ -141,7 +152,7 @@
|
||||
} else {
|
||||
avatarDom = '<img class="user-avatar" src="route/file/downloadfile/false/'+ item.userAvatar +'"/> ';
|
||||
}
|
||||
userDom += '<a id="user_' + item.userId + '" href="javascript:;" class="users list-group-item" onclick="selectUser(\''+ item.userId +'\', \''+ item.userName +'\', \''+ item.phone +'\')">'+ avatarDom + item.userName +' ['+ item.phone + ']' + item.prefixUserName + '</a>';
|
||||
userDom += '<a id="user_' + item.userId + '" href="javascript:;" class="users list-group-item" onclick="selectUser(\''+ item.userId +'\', \''+ item.userName +'\', \''+ item.phone +'\')">'+ avatarDom + item.userName + '['+ item.phone + ']<br/>' + item.prefixUserName + '</a>';
|
||||
}
|
||||
$('#users').append(userDom);
|
||||
}, function(code, data) {
|
||||
|
Loading…
Reference in New Issue
Block a user