增加用户网格绑定区域接口,调整admin区域用户管理网格必须绑定地区
This commit is contained in:
parent
5541d61203
commit
6d259ced22
@ -0,0 +1,25 @@
|
||||
package cn.com.tenlion.usercenter.controller.api.helper;
|
||||
|
||||
import cn.com.tenlion.usercenter.service.helper.HelperService;
|
||||
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||
import ink.wgink.pojo.result.SuccessResult;
|
||||
import ink.wgink.pojo.result.SuccessResultData;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping(ISystemConstant.API_PREFIX + "/helper")
|
||||
public class HelperController {
|
||||
|
||||
@Autowired
|
||||
private HelperService helperService;
|
||||
|
||||
@GetMapping("update-no-area-grid-user")
|
||||
public SuccessResult updateNoAreaGridUser() throws Exception {
|
||||
Integer updateCount = helperService.updateNoAreaGridUser();
|
||||
return new SuccessResultData<>(updateCount);
|
||||
}
|
||||
|
||||
}
|
@ -39,12 +39,24 @@ public class AreaUserRouteController {
|
||||
return mv;
|
||||
}
|
||||
|
||||
@GetMapping("save-area-user-admin")
|
||||
public ModelAndView saveAreaUserAdmin() {
|
||||
ModelAndView mv = new ModelAndView("area/user/save-area-user-admin");
|
||||
return mv;
|
||||
}
|
||||
|
||||
@GetMapping("update-area-user")
|
||||
public ModelAndView updateAreaUser() {
|
||||
ModelAndView mv = new ModelAndView("area/user/update-area-user");
|
||||
return mv;
|
||||
}
|
||||
|
||||
@GetMapping("update-area-user-admin")
|
||||
public ModelAndView updateAreaUserAdmin() {
|
||||
ModelAndView mv = new ModelAndView("area/user/update-area-user-admin");
|
||||
return mv;
|
||||
}
|
||||
|
||||
@GetMapping("list-area")
|
||||
public ModelAndView listArea() {
|
||||
ModelAndView mv = new ModelAndView("area/user/list-area");
|
||||
@ -55,7 +67,9 @@ public class AreaUserRouteController {
|
||||
public ModelAndView listAreaAdmin() {
|
||||
ModelAndView mv = new ModelAndView("area/user/list-area-admin");
|
||||
if (securityComponent.isAdmin()) {
|
||||
mv.addObject("baseParentId", "0");
|
||||
mv.addObject("baseAreaParentId", "0");
|
||||
mv.addObject("baseAreaId", "110889");
|
||||
mv.addObject("baseAreaCode", "150900000000");
|
||||
} else {
|
||||
UserExpandPO userExpandPO = securityComponent.getExpandData(UserExpandPO.class);
|
||||
if (userExpandPO == null) {
|
||||
|
@ -0,0 +1,14 @@
|
||||
package cn.com.tenlion.usercenter.dao.helper;
|
||||
|
||||
import org.apache.kafka.common.protocol.types.Field;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Repository
|
||||
public interface IHelperDao {
|
||||
|
||||
List<Map<String, Object>> listNoAreaGridUser();
|
||||
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
package cn.com.tenlion.usercenter.service.helper;
|
||||
|
||||
import cn.com.tenlion.usercenter.dao.helper.IHelperDao;
|
||||
import cn.com.tenlion.usercenter.pojo.pos.userexpand.UserExpandPO;
|
||||
import cn.com.tenlion.usercenter.pojo.vos.userexpand.UserExpandVO;
|
||||
import cn.com.tenlion.usercenter.service.userexpand.IUserExpandService;
|
||||
import ink.wgink.common.base.DefaultBaseService;
|
||||
import ink.wgink.module.dictionary.pojo.dtos.AreaDTO;
|
||||
import ink.wgink.module.dictionary.service.IAreaService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
public class HelperService extends DefaultBaseService {
|
||||
|
||||
@Autowired
|
||||
private IHelperDao helperDao;
|
||||
@Autowired
|
||||
private IUserExpandService userExpandService;
|
||||
@Autowired
|
||||
private IAreaService areaService;
|
||||
|
||||
public Integer updateNoAreaGridUser() throws Exception {
|
||||
List<Map<String, Object>> noAreaGridUsers = helperDao.listNoAreaGridUser();
|
||||
int updateCount = 0;
|
||||
for (Map<String, Object> noAreaGridUser : noAreaGridUsers) {
|
||||
String areaCode = noAreaGridUser.get("grid_area_code").toString();
|
||||
String areaName = noAreaGridUser.get("grid_area_name").toString();
|
||||
String userId = noAreaGridUser.get("user_id").toString();
|
||||
AreaDTO areaDTO = areaService.getByCode(areaCode);
|
||||
if (areaDTO == null) {
|
||||
continue;
|
||||
}
|
||||
// 更新
|
||||
UserExpandVO userExpandVO = new UserExpandVO();
|
||||
userExpandVO.setAreaCode(areaCode);
|
||||
userExpandVO.setAreaName(areaName);
|
||||
userExpandVO.setUserLevel(Integer.parseInt(areaDTO.getAreaLevel()));
|
||||
userExpandService.update(userId, userExpandVO);
|
||||
updateCount++;
|
||||
}
|
||||
return updateCount;
|
||||
}
|
||||
|
||||
}
|
42
src/main/resources/mybatis/mapper/helper/helper-mapper.xml
Normal file
42
src/main/resources/mybatis/mapper/helper/helper-mapper.xml
Normal file
@ -0,0 +1,42 @@
|
||||
<?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="cn.com.tenlion.usercenter.dao.helper.IHelperDao">
|
||||
|
||||
<select id="listNoAreaGridUser" resultType="map">
|
||||
SELECT
|
||||
grid_id,
|
||||
grid_area_code,
|
||||
grid_area_name,
|
||||
user_id,
|
||||
user_username,
|
||||
user_name,
|
||||
user_phone,
|
||||
sue_user_id,
|
||||
sue_area_code,
|
||||
sue_area_name
|
||||
FROM (
|
||||
SELECT
|
||||
mgr.grid_id,
|
||||
mg.area_code grid_area_code,
|
||||
mg.area_name grid_area_name,
|
||||
mg.grid_code,
|
||||
su.user_id,
|
||||
su.user_username,
|
||||
su.user_name,
|
||||
su.user_phone,
|
||||
sue.user_id sue_user_id,
|
||||
sue.area_code sue_area_code,
|
||||
sue.area_name sue_area_name
|
||||
FROM
|
||||
map_grid_relation mgr
|
||||
INNER JOIN map_grid mg ON mgr.grid_id = mg.grid_id
|
||||
INNER JOIN sys_user su ON mgr.relation_id = su.user_id
|
||||
LEFT JOIN sys_user_expand sue ON su.user_id = sue.user_id
|
||||
) t
|
||||
WHERE
|
||||
t.grid_area_code IS NOT NULL AND grid_area_code != ''
|
||||
AND
|
||||
t.sue_area_code IS NULL OR t.sue_area_code = ''
|
||||
</select>
|
||||
|
||||
</mapper>
|
299
src/main/resources/static/assets/js/area/user/area-user-admin.js
Normal file
299
src/main/resources/static/assets/js/area/user/area-user-admin.js
Normal file
@ -0,0 +1,299 @@
|
||||
/**
|
||||
* 关闭窗口
|
||||
*/
|
||||
function closeBox() {
|
||||
parent.layer.close(parent.layer.getFrameIndex(window.name));
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化下拉树
|
||||
* @param $
|
||||
* @param layuiInputTree
|
||||
*/
|
||||
function initMultiSelectInputTree($, treeselect) {
|
||||
/**
|
||||
* 设置选择数据
|
||||
* @param ids
|
||||
* @param names
|
||||
*/
|
||||
function setSelectedData(selectedDatas, ids, names) {
|
||||
if (!ids) {
|
||||
return;
|
||||
}
|
||||
ids = ids.split(',');
|
||||
names = names.split(',');
|
||||
$.each(ids, function (index, item) {
|
||||
selectedDatas.push({
|
||||
id: item,
|
||||
name: names[index]
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// 组织部门选择
|
||||
function initDepartmentSelect() {
|
||||
treeselect.init({
|
||||
isSingle: false,
|
||||
name: 'departmentIds',
|
||||
explain: '组织部门',
|
||||
url: 'api/department/listztree',
|
||||
idsUrl: 'api/department/list/ids',
|
||||
key: {
|
||||
id: 'id',
|
||||
name: 'name',
|
||||
title: 'title',
|
||||
pId: 'pId',
|
||||
checked: 'checked',
|
||||
children: 'children',
|
||||
isParent: 'isParent',
|
||||
isHidden: 'isHidden',
|
||||
url: 'url'
|
||||
},
|
||||
onInitSelectedDataFilter: function(selectedData) {
|
||||
$.each(selectedData, function(i, item) {
|
||||
item.id = item.departmentId;
|
||||
item.name = item.departmentName;
|
||||
});
|
||||
},
|
||||
onSelect: function(selectedNodeArray) {
|
||||
},
|
||||
onDelete: function(selectedNodeArray) {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 角色选择
|
||||
function initRoleSelect() {
|
||||
treeselect.init({
|
||||
isSingle: false,
|
||||
name: 'roleIds',
|
||||
explain: '角色',
|
||||
url: 'api/role/listztree',
|
||||
idsUrl: 'api/role/list/role-ids',
|
||||
key: {
|
||||
id: 'id',
|
||||
name: 'name',
|
||||
title: 'title',
|
||||
pId: 'pId',
|
||||
checked: 'checked',
|
||||
children: 'children',
|
||||
isParent: 'isParent',
|
||||
isHidden: 'isHidden',
|
||||
url: 'url'
|
||||
},
|
||||
onInitSelectedDataFilter: function(selectedData) {
|
||||
$.each(selectedData, function(i, item) {
|
||||
item.id = item.roleId;
|
||||
item.name = item.roleName;
|
||||
});
|
||||
},
|
||||
onSelect: function(selectedNodeArray) {
|
||||
},
|
||||
onDelete: function(selectedNodeArray) {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 职位选择
|
||||
function initPositionSelect() {
|
||||
treeselect.init({
|
||||
isSingle: false,
|
||||
name: 'positionIds',
|
||||
explain: '职位',
|
||||
url: 'api/position/listztree',
|
||||
idsUrl: 'api/position/list/position-ids',
|
||||
key: {
|
||||
id: 'id',
|
||||
name: 'name',
|
||||
title: 'title',
|
||||
pId: 'pId',
|
||||
checked: 'checked',
|
||||
children: 'children',
|
||||
isParent: 'isParent',
|
||||
isHidden: 'isHidden',
|
||||
url: 'url'
|
||||
},
|
||||
onInitSelectedDataFilter: function(selectedData) {
|
||||
$.each(selectedData, function(i, item) {
|
||||
item.id = item.positionId;
|
||||
item.name = item.positionName;
|
||||
});
|
||||
},
|
||||
onSelect: function(selectedNodeArray) {
|
||||
},
|
||||
onDelete: function(selectedNodeArray) {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 组选择
|
||||
function initGroupSelect() {
|
||||
treeselect.init({
|
||||
isSingle: false,
|
||||
name: 'groupIds',
|
||||
explain: '组',
|
||||
url: 'api/group/listztree',
|
||||
idsUrl: 'api/group/list/group-ids',
|
||||
key: {
|
||||
id: 'id',
|
||||
name: 'name',
|
||||
title: 'title',
|
||||
pId: 'pId',
|
||||
checked: 'checked',
|
||||
children: 'children',
|
||||
isParent: 'isParent',
|
||||
isHidden: 'isHidden',
|
||||
url: 'url'
|
||||
},
|
||||
onInitSelectedDataFilter: function(selectedData) {
|
||||
$.each(selectedData, function(i, item) {
|
||||
item.id = item.groupId;
|
||||
item.name = item.groupName;
|
||||
});
|
||||
},
|
||||
onSelect: function(selectedNodeArray) {
|
||||
},
|
||||
onDelete: function(selectedNodeArray) {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 组选择
|
||||
function initAreaSelect() {
|
||||
treeselect.init({
|
||||
isSingle: true,
|
||||
name: 'areaId',
|
||||
explain: '地区',
|
||||
url: 'api/area/list-area-ztree',
|
||||
idsUrl: 'api/area/list/ids',
|
||||
key: {
|
||||
id: 'id',
|
||||
name: 'name',
|
||||
title: 'title',
|
||||
pId: 'pId',
|
||||
checked: 'checked',
|
||||
children: 'children',
|
||||
isParent: 'isParent',
|
||||
isHidden: 'isHidden',
|
||||
url: 'url'
|
||||
},
|
||||
onInitSelectedDataFilter: function(selectedData) {
|
||||
$.each(selectedData, function(i, item) {
|
||||
item.id = item.areaId;
|
||||
item.name = item.areaName;
|
||||
});
|
||||
},
|
||||
onSelect: function(selectedNodeArray) {
|
||||
$('#areaCode').val(selectedNodeArray[0].areaCode);
|
||||
},
|
||||
onDelete: function(selectedNodeArray) {
|
||||
$('#areaCode').val('');
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function initGridSelect() {
|
||||
$('#gridIdsContainer').text($('#gridNames').val() ? $('#gridNames').val() : '选择网格');
|
||||
$('#gridIdsContainer').on('click', function() {
|
||||
var areaCode = $('#areaCode').val();
|
||||
if(!areaCode) {
|
||||
top.dialog.msg('请选选择区域')
|
||||
return;
|
||||
}
|
||||
var oldGridIds = $('#gridIds').val() ? $('#gridIds').val().split(',') : [];
|
||||
var oldGridNames = $('#gridNames').val() ? $('#gridNames').val().split(',') : [];
|
||||
var oldGrids = [];
|
||||
$.each(oldGridIds, function(index, item) {
|
||||
oldGrids.push({
|
||||
gridId: item,
|
||||
gridName: oldGridNames[index]
|
||||
})
|
||||
});
|
||||
top.dialog.dialogData.oldSelectedGridList = oldGrids;
|
||||
top.dialog.open({
|
||||
title: '选择网格',
|
||||
url: top.restAjax.path('route/grid/list-select?selectType=checkbox&areaCode={areaCode}', [areaCode]),
|
||||
width: '800px',
|
||||
height: '80%',
|
||||
onClose: function() {
|
||||
var selectedGridList = top.dialog.dialogData.newSelectedGridList;
|
||||
var gridIds = '';
|
||||
var gridNames = '';
|
||||
$.each(selectedGridList, function(index, item) {
|
||||
if(gridIds) {
|
||||
gridIds += ',';
|
||||
gridNames += ',';
|
||||
}
|
||||
gridIds += item.gridId;
|
||||
gridNames += item.gridName;
|
||||
})
|
||||
$('#gridIds').val(gridIds);
|
||||
$('#gridNames').val(gridNames);
|
||||
$('#gridIdsContainer').text(gridNames ? gridNames : '选择网格');
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
initDepartmentSelect();
|
||||
initRoleSelect();
|
||||
initPositionSelect();
|
||||
initGroupSelect();
|
||||
initAreaSelect();
|
||||
initGridSelect();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param laydate
|
||||
*/
|
||||
function initDate(laydate) {
|
||||
laydate.render({
|
||||
elem: '#userExpiredDate',
|
||||
trigger: 'click',
|
||||
format: 'yyyy-MM-dd HH:mm:ss'
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置ID列表
|
||||
* @param $
|
||||
* @param formDataField
|
||||
*/
|
||||
function setIds($, formDataField) {
|
||||
var departmentIds = $('#departmentIds').val();
|
||||
if (departmentIds) {
|
||||
departmentIds = departmentIds.split(',');
|
||||
} else {
|
||||
departmentIds = [];
|
||||
}
|
||||
var roleIds = $('#roleIds').val();
|
||||
if (roleIds) {
|
||||
roleIds = roleIds.split(',');
|
||||
} else {
|
||||
roleIds = [];
|
||||
}
|
||||
var positionIds = $('#positionIds').val();
|
||||
if (positionIds) {
|
||||
positionIds = positionIds.split(',');
|
||||
} else {
|
||||
positionIds = [];
|
||||
}
|
||||
var groupIds = $('#groupIds').val();
|
||||
if (groupIds) {
|
||||
groupIds = groupIds.split(',');
|
||||
} else {
|
||||
groupIds = [];
|
||||
}
|
||||
var gridIds = $('#gridIds').val();
|
||||
if (gridIds) {
|
||||
gridIds = gridIds.split(',');
|
||||
} else {
|
||||
gridIds = [];
|
||||
}
|
||||
formDataField.departmentIds = departmentIds;
|
||||
formDataField.roleIds = roleIds;
|
||||
formDataField.positionIds = positionIds;
|
||||
formDataField.groupIds = groupIds;
|
||||
formDataField.gridIds = gridIds;
|
||||
}
|
@ -164,7 +164,7 @@ function initMultiSelectInputTree($, treeselect) {
|
||||
isSingle: true,
|
||||
name: 'areaId',
|
||||
explain: '地区',
|
||||
url: 'api/area/listztree',
|
||||
url: 'api/area/list-area-ztree',
|
||||
idsUrl: 'api/area/list/ids',
|
||||
key: {
|
||||
id: 'id',
|
||||
@ -205,7 +205,7 @@ function initMultiSelectInputTree($, treeselect) {
|
||||
top.dialog.dialogData.oldSelectedGridList = oldGrids;
|
||||
top.dialog.open({
|
||||
title: '选择网格',
|
||||
url: top.restAjax.path('route/grid/list-select?selectType=checkbox', []),
|
||||
url: top.restAjax.path('route/grid/list-select?selectType=checkbox&areaCode={areaCode}', [areaCode]),
|
||||
width: '800px',
|
||||
height: '80%',
|
||||
onClose: function() {
|
||||
|
@ -29,7 +29,6 @@
|
||||
<select id="searchLevel" name="searchLevel" lay-filter="searchLevelFilter">
|
||||
<option value="this">本级</option>
|
||||
<option value="part">局部</option>
|
||||
<option value="global">全局</option>
|
||||
</select>
|
||||
</div>
|
||||
<div id="noAreaContainer" class="layui-inline layui-form search-item">
|
||||
@ -597,7 +596,7 @@
|
||||
area: ['100%', '100%'],
|
||||
shadeClose: true,
|
||||
anim: 2,
|
||||
content: top.restAjax.path('route/area/user/save-area-user', []),
|
||||
content: top.restAjax.path('route/area/user/save-area-user-admin', []),
|
||||
end: function() {
|
||||
reloadTable();
|
||||
}
|
||||
@ -615,7 +614,7 @@
|
||||
area: ['100%', '100%'],
|
||||
shadeClose: true,
|
||||
anim: 2,
|
||||
content: top.restAjax.path('route/area/user/update-area-user?userId={id}', [checkDatas[0].userId]),
|
||||
content: top.restAjax.path('route/area/user/update-area-user-admin?userId={id}', [checkDatas[0].userId]),
|
||||
end: function() {
|
||||
reloadTable();
|
||||
}
|
||||
|
248
src/main/resources/templates/area/user/save-area-user-admin.html
Normal file
248
src/main/resources/templates/area/user/save-area-user-admin.html
Normal file
@ -0,0 +1,248 @@
|
||||
<!doctype html>
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<base th:href="${#request.getContextPath() + '/'}">
|
||||
<meta charset="utf-8">
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport"
|
||||
content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
||||
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
|
||||
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
|
||||
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
|
||||
</head>
|
||||
<body>
|
||||
<div class="layui-anim layui-anim-fadein">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header">
|
||||
<span class="layui-breadcrumb" lay-filter="breadcrumb" style="visibility: visible;">
|
||||
<a class="close" href="javascript:void(0);">上级列表</a><span lay-separator="">/</span>
|
||||
<a href="javascript:void(0);"><cite>新增内容</cite></a>
|
||||
</span>
|
||||
</div>
|
||||
<div class="layui-card-body" style="padding: 15px;">
|
||||
<form class="layui-form layui-form-pane" lay-filter="dataForm">
|
||||
<div class="layui-row">
|
||||
<div class="layui-col-md6 layui-col-sm8 layui-col-xs12">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">用户名 *</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="userUsername" lay-verify="userUsername" placeholder="请输入用户名" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">昵称 *</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="userName" lay-verify="required" placeholder="请输入昵称" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item" pane>
|
||||
<label class="layui-form-label">状态 *</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="radio" name="userState" value="0" title="正常" checked>
|
||||
<input type="radio" name="userState" value="1" title="锁定">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item" pane>
|
||||
<label class="layui-form-label">类型 *</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="radio" name="userType" value="1" title="系统用户">
|
||||
<input type="radio" name="userType" value="2" title="普通用户" checked>
|
||||
<input type="radio" name="userType" value="3" title="公共用户">
|
||||
</div>
|
||||
</div>
|
||||
<blockquote class="layui-elem-quote layui-quote-nm">
|
||||
<div><b>类型说明</b></div>
|
||||
<div>系统用户:具有后台登录权限且参与后台、APP业务的用户</div>
|
||||
<div>普通用户:具有APP登录权限且参与APP业务的用户</div>
|
||||
<div>公共用户:来自小程序、公众号等公共平台自动创建且参与此类业务的的用户</div>
|
||||
</blockquote>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">密码</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="password" name="userPassword" placeholder="请输入密码" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">手机</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" name="userPhone" placeholder="请输入手机" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">邮箱</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="userEmail" placeholder="请输入邮箱" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">过期时间</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="userExpiredDate" id="userExpiredDate"
|
||||
placeholder="请选择过期日期,空表示永不过期" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">备注</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="remarks" placeholder="请输入备注" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-md6 layui-col-sm8 layui-col-xs12">
|
||||
<!-- 组织部门 start -->
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">组织部门*</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="hidden" id="departmentIds" name="departmentIds">
|
||||
<div id="departmentIdsContainer" class="select-container">请选择组织部门</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 组织部门 end -->
|
||||
<!-- 角色 start -->
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">角色</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="hidden" id="roleIds" name="roleIds">
|
||||
<div id="roleIdsContainer" class="select-container">请选择角色</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 角色 end -->
|
||||
<!-- 职位 start -->
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">职位</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="hidden" id="positionIds" name="positionIds">
|
||||
<div id="positionIdsContainer" class="select-container">请选择职位</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 职位 end -->
|
||||
<!-- 组 start -->
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">组</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="hidden" id="groupIds" name="groupIds">
|
||||
<div id="groupIdsContainer" class="select-container">请选择组</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 组 end -->
|
||||
<!-- 区域 start -->
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">区域</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="hidden" id="areaId" name="areaId">
|
||||
<input type="hidden" id="areaCode" name="areaCode">
|
||||
<div id="areaIdContainer" class="select-container">请选择区域</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 区域 end -->
|
||||
<!-- 网格 start -->
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">网格</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="hidden" id="gridIds" name="gridIds">
|
||||
<input type="hidden" id="gridNames" name="gridNames">
|
||||
<div id="gridIdsContainer" class="select-container">选择网格</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 网格 end -->
|
||||
</div>
|
||||
<div class="layui-col-md2 layui-col-sm4 layui-col-xs12">
|
||||
<div class="layui-form-item" style="text-align: center;">
|
||||
<img id="avatarImage" src="assets/images/profile-photo.jpg" title="点击修改头像">
|
||||
<input type="hidden" id="userAvatar" name="userAvatar">
|
||||
</div>
|
||||
</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/js/area/user/area-user-admin.js?v=1"></script>
|
||||
<script src="assets/layuiadmin/layui/layui.js"></script>
|
||||
<script>
|
||||
layui.config({
|
||||
base: 'assets/layuiadmin/' //静态资源所在路径
|
||||
}).extend({
|
||||
index: 'lib/index', //主入口模块
|
||||
treeselect: 'custom/treeselect'
|
||||
}).use(['index', 'form', 'laydate', 'treeselect'], function () {
|
||||
var $ = layui.$;
|
||||
var laydate = layui.laydate;
|
||||
var form = layui.form;
|
||||
var treeselect = layui.treeselect;
|
||||
|
||||
initMultiSelectInputTree($, treeselect);
|
||||
initDate(laydate);
|
||||
|
||||
// 提交表单
|
||||
form.on('submit(submitForm)', function (formData) {
|
||||
top.dialog.confirm(top.dataMessage.commit, function (index) {
|
||||
top.dialog.close(index);
|
||||
var loadLayerIndex;
|
||||
setIds($, formData.field);
|
||||
top.restAjax.post(top.restAjax.path('api/area/user/save-user', []), formData.field, null, function (code, data) {
|
||||
var layerIndex = top.dialog.msg(top.dataMessage.commitSuccess, {
|
||||
time: 0,
|
||||
btn: [top.dataMessage.button.yes, top.dataMessage.button.no],
|
||||
shade: 0.3,
|
||||
yes: function (index) {
|
||||
top.dialog.close(index);
|
||||
window.location.reload();
|
||||
},
|
||||
btn2: function () {
|
||||
closeBox();
|
||||
}
|
||||
});
|
||||
}, function (code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
}, function () {
|
||||
loadLayerIndex = top.dialog.msg(top.dataMessage.committing, {icon: 16, time: 0, shade: 0.3});
|
||||
}, function () {
|
||||
top.dialog.close(loadLayerIndex);
|
||||
});
|
||||
});
|
||||
return false;
|
||||
});
|
||||
form.verify({
|
||||
userUsername: function (value, item) {
|
||||
if (!new RegExp('^[a-zA-Z0-9_\\s·]+$').test(value)) {
|
||||
return '用户名不能有特殊字符';
|
||||
}
|
||||
if (/(^\_)|(\__)|(\_+$)/.test(value)) {
|
||||
return '用户名首尾不能出现下划线\'_\'';
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$('#avatarImage').on('click', function () {
|
||||
top.dialog.open({
|
||||
url: 'route/file/uploadimage?fileId=' + $('#userAvatar').val(),
|
||||
title: '上传头像',
|
||||
width: '800px',
|
||||
height: '470px',
|
||||
onClose: function () {
|
||||
var uploadImage = top.dialog.dialogData.uploadImage;
|
||||
if (typeof (uploadImage) != 'undefined' && null != uploadImage && '' != uploadImage) {
|
||||
$('#avatarImage').attr('src', 'route/file/download/false/' + uploadImage);
|
||||
$('#userAvatar').val(uploadImage);
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
$('.close').on('click', function () {
|
||||
closeBox();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -131,6 +131,7 @@
|
||||
<label class="layui-form-label">区域</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="hidden" id="areaId" name="areaId">
|
||||
<input type="hidden" id="areaCode" name="areaCode">
|
||||
<div id="areaIdContainer" class="select-container">请选择区域</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -165,7 +166,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="assets/js/area/user/area-user.js"></script>
|
||||
<script src="assets/js/area/user/area-user.js?v=1"></script>
|
||||
<script src="assets/layuiadmin/layui/layui.js"></script>
|
||||
<script>
|
||||
layui.config({
|
||||
|
@ -0,0 +1,289 @@
|
||||
<!doctype html>
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<base th:href="${#request.getContextPath() + '/'}">
|
||||
<meta charset="utf-8">
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
||||
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
|
||||
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
|
||||
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
|
||||
</head>
|
||||
<body>
|
||||
<div class="layui-anim layui-anim-fadein">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header">
|
||||
<span class="layui-breadcrumb" lay-filter="breadcrumb" style="visibility: visible;">
|
||||
<a class="close" href="javascript:void(0);">上级列表</a><span lay-separator="">/</span>
|
||||
<a href="javascript:void(0);"><cite>编辑内容</cite></a>
|
||||
</span>
|
||||
</div>
|
||||
<div class="layui-card-body" style="padding: 15px;">
|
||||
<form class="layui-form layui-form-pane" lay-filter="dataForm">
|
||||
<div class="layui-row layui-col-space10">
|
||||
<div class="layui-col-md6 layui-col-sm8 layui-col-xs12">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">用户名 *</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="userUsername" lay-verify="userUsername" placeholder="请输入用户名" class="layui-input" readonly>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">昵称 *</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="userName" lay-verify="required" placeholder="请输入昵称" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item" pane>
|
||||
<label class="layui-form-label">状态 *</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="radio" name="userState" value="0" title="正常">
|
||||
<input type="radio" name="userState" value="1" title="锁定">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item" pane>
|
||||
<label class="layui-form-label">类型 *</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="radio" name="userType" value="1" title="系统用户">
|
||||
<input type="radio" name="userType" value="2" title="普通用户">
|
||||
<input type="radio" name="userType" value="3" title="公共用户">
|
||||
</div>
|
||||
</div>
|
||||
<blockquote class="layui-elem-quote layui-quote-nm">
|
||||
<div><b>类型说明</b></div>
|
||||
<div>系统用户:具有后台登录权限且参与后台、APP业务的用户</div>
|
||||
<div>普通用户:具有APP登录权限且参与APP业务的用户</div>
|
||||
<div>公共用户:来自小程序、公众号等公共平台自动创建且参与此类业务的的用户</div>
|
||||
</blockquote>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">新密码</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="password" name="userPassword" placeholder="修改密码,请输入新密码,不修改为空" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">手机</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" name="userPhone" placeholder="请输入手机" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">邮箱</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="userEmail" placeholder="请输入邮箱" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">过期时间</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="userExpiredDate" id="userExpiredDate" placeholder="请选择过期日期,空表示永不过期" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">备注</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="remarks" placeholder="请输入备注" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-md6 layui-col-sm8 layui-col-xs12">
|
||||
<!-- 组织部门 start -->
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">组织部门*</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="hidden" id="departmentIds" name="departmentIds">
|
||||
<div id="departmentIdsContainer" class="select-container">请选择组织部门</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 组织部门 end -->
|
||||
<!-- 角色 start -->
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">角色</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="hidden" id="roleIds" name="roleIds">
|
||||
<div id="roleIdsContainer" class="select-container">请选择角色</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 角色 end -->
|
||||
<!-- 职位 start -->
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">职位</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="hidden" id="positionIds" name="positionIds">
|
||||
<div id="positionIdsContainer" class="select-container">请选择职位</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 职位 end -->
|
||||
<!-- 组 start -->
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">组</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="hidden" id="groupIds" name="groupIds">
|
||||
<div id="groupIdsContainer" class="select-container">请选择组</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 组 end -->
|
||||
<!-- 区域 start -->
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">区域</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="hidden" id="areaId" name="areaId">
|
||||
<input type="hidden" id="areaCode" name="areaCode">
|
||||
<div id="areaIdContainer" class="select-container">请选择区域</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 区域 end -->
|
||||
<!-- 网格 start -->
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">网格</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="hidden" id="gridIds" name="gridIds">
|
||||
<input type="hidden" id="gridNames" name="gridNames">
|
||||
<div id="gridIdsContainer" class="select-container">选择网格</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 网格 end -->
|
||||
</div>
|
||||
<div class="layui-col-md2 layui-col-sm4 layui-col-xs12">
|
||||
<div class="layui-form-item" style="text-align: center;">
|
||||
<img id="avatarImage" src="assets/images/profile-photo.jpg" title="点击修改头像">
|
||||
<input type="hidden" id="userAvatar" name="userAvatar">
|
||||
</div>
|
||||
</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/js/area/user/area-user-admin.js?v=1"></script>
|
||||
<script src="assets/layuiadmin/layui/layui.js"></script>
|
||||
<script>
|
||||
layui.config({
|
||||
base: 'assets/layuiadmin/' //静态资源所在路径
|
||||
}).extend({
|
||||
index: 'lib/index', //主入口模块
|
||||
treeselect: 'custom/treeselect'
|
||||
}).use(['index', 'form', 'laydate', 'treeselect'], function(){
|
||||
var $ = layui.$;
|
||||
var laydate = layui.laydate;
|
||||
var form = layui.form;
|
||||
var treeselect = layui.treeselect;
|
||||
var userId = top.restAjax.params(window.location.href).userId;
|
||||
|
||||
initDate(laydate);
|
||||
|
||||
// 初始化
|
||||
function initData() {
|
||||
var loadLayerIndex;
|
||||
top.restAjax.get(top.restAjax.path('api/area/user/get-user/{userId}', [userId]), {}, null, function(code, data) {
|
||||
form.val('dataForm', {
|
||||
userAvatar: data.userAvatar,
|
||||
userUsername: data.userUsername,
|
||||
userName: data.userName,
|
||||
userType: data.userType +'',
|
||||
userState: data.userState +'',
|
||||
userPhone: data.userPhone,
|
||||
userEmail: data.userEmail.toString(),
|
||||
userExpiredDate: data.userExpiredDate,
|
||||
departmentIds: data.departmentIds,
|
||||
departmentNames: data.departmentNames,
|
||||
roleIds: data.roleIds,
|
||||
roleNames: data.roleNames,
|
||||
positionIds: data.positionIds,
|
||||
positionNames: data.positionNames,
|
||||
groupIds: data.groupIds,
|
||||
groupNames: data.groupNames,
|
||||
areaId: data.areaId,
|
||||
areaName: data.areaName,
|
||||
areaCode: data.areaCode,
|
||||
gridIds: data.gridIds,
|
||||
gridNames: data.gridNames
|
||||
});
|
||||
form.render(null, 'dataForm');
|
||||
if($('#userAvatar').val() != '') {
|
||||
$('#avatarImage').attr('src', 'route/file/download/true/' + $('#userAvatar').val());
|
||||
} else {
|
||||
$('#userAvatar').val($('#userAvatar').val());
|
||||
}
|
||||
|
||||
initMultiSelectInputTree($, treeselect);
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
}, function() {
|
||||
loadLayerIndex = top.dialog.msg(top.dataMessage.loading, {icon: 16, time: 0, shade: 0.3});
|
||||
}, function() {
|
||||
top.dialog.close(loadLayerIndex);
|
||||
});
|
||||
}
|
||||
initData();
|
||||
// 提交表单
|
||||
form.on('submit(submitForm)', function(formData) {
|
||||
top.dialog.confirm(top.dataMessage.commit, function(index) {
|
||||
top.dialog.close(index);
|
||||
var loadLayerIndex;
|
||||
setIds($, formData.field);
|
||||
top.restAjax.put(top.restAjax.path('api/area/user/update-user/{userId}', [userId]), formData.field, null, function(code, data) {
|
||||
var layerIndex = top.dialog.msg(top.dataMessage.commitSuccess, {
|
||||
time: 0,
|
||||
btn: [top.dataMessage.button.yes, top.dataMessage.button.no],
|
||||
shade: 0.3,
|
||||
yes: function(index) {
|
||||
top.dialog.close(index);
|
||||
window.location.reload();
|
||||
},
|
||||
btn2: function() {
|
||||
closeBox();
|
||||
}
|
||||
});
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
}, function() {
|
||||
loadLayerIndex = top.dialog.msg(top.dataMessage.committing, {icon: 16, time: 0, shade: 0.3});
|
||||
}, function() {
|
||||
top.dialog.close(loadLayerIndex);
|
||||
});
|
||||
});
|
||||
return false;
|
||||
});
|
||||
form.verify({
|
||||
userUsername: function(value, item) {
|
||||
if(!new RegExp('^[a-zA-Z0-9_\\s]+$').test(value)) {
|
||||
return '用户名不能有特殊字符';
|
||||
}
|
||||
if(/(^\_)|(\__)|(\_+$)/.test(value)){
|
||||
return '用户名首尾不能出现下划线\'_\'';
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$('#avatarImage').on('click', function() {
|
||||
top.dialog.open({
|
||||
url: 'route/file/uploadimage?fileId='+ $('#userAvatar').val(),
|
||||
title: '上传头像',
|
||||
width: '800px',
|
||||
height: '470px',
|
||||
onClose: function() {
|
||||
var uploadImage = top.dialog.dialogData.uploadImage;
|
||||
if(typeof(uploadImage) != 'undefined' && null != uploadImage && '' != uploadImage) {
|
||||
$('#avatarImage').attr('src', 'route/file/download/true/' + uploadImage);
|
||||
$('#userAvatar').val(uploadImage);
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
$('.close').on('click', function() {
|
||||
closeBox();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -129,6 +129,7 @@
|
||||
<label class="layui-form-label">区域</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="hidden" id="areaId" name="areaId">
|
||||
<input type="hidden" id="areaCode" name="areaCode">
|
||||
<div id="areaIdContainer" class="select-container">请选择区域</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -163,7 +164,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="assets/js/area/user/area-user.js"></script>
|
||||
<script src="assets/js/area/user/area-user.js?v=1"></script>
|
||||
<script src="assets/layuiadmin/layui/layui.js"></script>
|
||||
<script>
|
||||
layui.config({
|
||||
@ -203,6 +204,7 @@
|
||||
groupNames: data.groupNames,
|
||||
areaId: data.areaId,
|
||||
areaName: data.areaName,
|
||||
areaCode: data.areaCode,
|
||||
gridIds: data.gridIds,
|
||||
gridNames: data.gridNames
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user