增加筛选条件
This commit is contained in:
parent
9e571ca41d
commit
89b0f56ce7
@ -23,7 +23,9 @@ import ink.wgink.service.group.service.IGroupUserService;
|
||||
import ink.wgink.service.position.service.IPositionUserService;
|
||||
import ink.wgink.service.role.service.IRoleUserService;
|
||||
import ink.wgink.service.user.service.IUserService;
|
||||
import ink.wgink.util.ArrayListUtil;
|
||||
import ink.wgink.util.thread.CachedThreadPoolUtil;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -113,9 +115,58 @@ public class CoreManageServiceImpl extends DefaultBaseService implements ICoreMa
|
||||
PageHelper.startPage(page.getPage(), page.getRows());
|
||||
List<UserDTO> userDTOs = listUser(page.getParams());
|
||||
PageInfo<UserDTO> pageInfo = new PageInfo<>(userDTOs);
|
||||
setUserDetail(userDTOs);
|
||||
return new SuccessResultList<>(userDTOs, pageInfo.getPageNum(), pageInfo.getTotal());
|
||||
}
|
||||
|
||||
private void setUserDetail(List<UserDTO> userDTOS) {
|
||||
List<String> userIds = ArrayListUtil.listBeanStringIdValue(userDTOS, "userId", UserDTO.class);
|
||||
if (userIds.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
List<DepartmentPO> departmentPOS = departmentUserService.listDepartmentPOByUserIds(userIds);
|
||||
List<RolePO> rolePOS = roleUserService.listRolePOByUserIds(userIds);
|
||||
List<PositionPO> positionPOS = positionUserService.listPositionPOByUserIds(userIds);
|
||||
List<GroupPO> groupPOS = groupUserService.listGroupPOByUserIds(userIds);
|
||||
userDTOS.forEach(userDTO -> {
|
||||
List<String> departmentIds = new ArrayList<>();
|
||||
List<String> departmentNames = new ArrayList<>();
|
||||
departmentPOS.forEach(departmentPO -> {
|
||||
departmentIds.add(departmentPO.getDepartmentId());
|
||||
departmentNames.add(departmentPO.getDepartmentName());
|
||||
});
|
||||
userDTO.setDepartmentIds(StringUtils.join(departmentIds, ","));
|
||||
userDTO.setDepartmentNames(StringUtils.join(departmentNames, ","));
|
||||
|
||||
List<String> roleIds = new ArrayList<>();
|
||||
List<String> roleNames = new ArrayList<>();
|
||||
rolePOS.forEach(rolePO -> {
|
||||
roleIds.add(rolePO.getRoleId());
|
||||
roleNames.add(rolePO.getRoleName());
|
||||
});
|
||||
userDTO.setRoleIds(StringUtils.join(roleIds, ","));
|
||||
userDTO.setRoleNames(StringUtils.join(roleNames, ","));
|
||||
|
||||
List<String> positionIds = new ArrayList<>();
|
||||
List<String> positionNames = new ArrayList<>();
|
||||
positionPOS.forEach(positionPO -> {
|
||||
positionIds.add(positionPO.getPositionId());
|
||||
positionNames.add(positionPO.getPositionName());
|
||||
});
|
||||
userDTO.setPositionIds(StringUtils.join(positionIds, ","));
|
||||
userDTO.setPositionNames(StringUtils.join(positionNames, ","));
|
||||
|
||||
List<String> groupIds = new ArrayList<>();
|
||||
List<String> groupNames = new ArrayList<>();
|
||||
groupPOS.forEach(groupPO -> {
|
||||
groupIds.add(groupPO.getGroupId());
|
||||
groupNames.add(groupPO.getGroupName());
|
||||
});
|
||||
userDTO.setGroupIds(StringUtils.join(groupIds, ","));
|
||||
userDTO.setGroupNames(StringUtils.join(groupNames, ","));
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置部门导航
|
||||
*
|
||||
|
@ -54,6 +54,10 @@
|
||||
AND
|
||||
t1.user_type != #{excludeUserType}
|
||||
</if>
|
||||
<if test="noDepartment != null and (noDepartment == true or noDepartment == 'true')">
|
||||
AND
|
||||
t1.user_id NOT IN (SELECT st1.user_id FROM sys_department_user st1)
|
||||
</if>
|
||||
<!-- 组织部门用户 -->
|
||||
<if test="departmentId != null and departmentId != ''">
|
||||
AND
|
||||
@ -106,6 +110,10 @@
|
||||
)
|
||||
</if>
|
||||
<!-- 角色 -->
|
||||
<if test="noRole != null and (noRole == true or noRole == 'true')">
|
||||
AND
|
||||
t1.user_id NOT IN (SELECT st2.user_id FROM sys_role_user st2)
|
||||
</if>
|
||||
<if test="roleId != null and roleId != ''">
|
||||
AND
|
||||
t1.user_id IN (
|
||||
@ -132,6 +140,10 @@
|
||||
)
|
||||
</if>
|
||||
<!-- 用户职位 -->
|
||||
<if test="noPosition != null and (noPosition == true or noPosition == 'true')">
|
||||
AND
|
||||
t1.user_id NOT IN (SELECT st3.user_id FROM sys_position_user st3)
|
||||
</if>
|
||||
<if test="positionId != null and positionId != ''">
|
||||
AND
|
||||
t1.user_id IN (
|
||||
@ -158,6 +170,10 @@
|
||||
)
|
||||
</if>
|
||||
<!-- 用户组 -->
|
||||
<if test="noGroup != null and (noGroup == true or noGroup == 'true')">
|
||||
AND
|
||||
t1.user_id NOT IN (SELECT st4.user_id FROM sys_group_user st4)
|
||||
</if>
|
||||
<if test="groupId != null and groupId != ''">
|
||||
AND
|
||||
t1.user_id IN (
|
||||
|
@ -10,7 +10,7 @@ function closeBox() {
|
||||
* @param $
|
||||
* @param layuiInputTree
|
||||
*/
|
||||
function initMultiSelectInputTree($, layuiInputTree) {
|
||||
function initMultiSelectInputTree($, treeselect) {
|
||||
/**
|
||||
* 设置选择数据
|
||||
* @param ids
|
||||
@ -32,112 +32,129 @@ function initMultiSelectInputTree($, layuiInputTree) {
|
||||
|
||||
// 组织部门选择
|
||||
function initDepartmentSelect() {
|
||||
layuiInputTree.initMultiSelect({
|
||||
id: 'departmentNames',
|
||||
treeselect.init({
|
||||
isSingle: false,
|
||||
name: 'departmentIds',
|
||||
explain: '组织部门',
|
||||
url: 'api/department/listztree',
|
||||
checkboxType: {Y: '', N: ''},
|
||||
getSelectedDatas: function () {
|
||||
var selectedDepartments = []
|
||||
setSelectedData(selectedDepartments, $('#departmentIds').val(), $('#departmentNames').val());
|
||||
return selectedDepartments;
|
||||
idsUrl: 'api/department/list/ids',
|
||||
key: {
|
||||
id: 'id',
|
||||
name: 'name',
|
||||
title: 'title',
|
||||
pId: 'pId',
|
||||
checked: 'checked',
|
||||
children: 'children',
|
||||
isParent: 'isParent',
|
||||
isHidden: 'isHidden',
|
||||
url: 'url'
|
||||
},
|
||||
onConfirm: function (zTree, selectedNodes) {
|
||||
if (selectedNodes.length == 0) {
|
||||
$('#departmentIds').val('');
|
||||
return;
|
||||
}
|
||||
var departmentIds = '';
|
||||
$.each(selectedNodes, function (index, item) {
|
||||
if (departmentIds != '') {
|
||||
departmentIds += ',';
|
||||
}
|
||||
departmentIds += item.id;
|
||||
})
|
||||
$('#departmentIds').val(departmentIds);
|
||||
onInitSelectedDataFilter: function(selectedData) {
|
||||
console.log(selectedData);
|
||||
$.each(selectedData, function(i, item) {
|
||||
item.id = item.departmentId;
|
||||
item.name = item.departmentName;
|
||||
});
|
||||
},
|
||||
onSelect: function(selectedNodeArray) {
|
||||
},
|
||||
onDelete: function(selectedNodeArray) {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 角色选择
|
||||
function initRoleSelect() {
|
||||
layuiInputTree.initMultiSelect({
|
||||
id: 'roleNames',
|
||||
treeselect.init({
|
||||
isSingle: false,
|
||||
name: 'roleIds',
|
||||
explain: '角色',
|
||||
url: 'api/role/listztree',
|
||||
checkboxType: {Y: '', N: ''},
|
||||
getSelectedDatas: function () {
|
||||
var selectedRoles = [];
|
||||
setSelectedData(selectedRoles, $('#roleIds').val(), $('#roleNames').val());
|
||||
return selectedRoles;
|
||||
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'
|
||||
},
|
||||
onConfirm: function (zTree, selectedNodes) {
|
||||
if (selectedNodes.length == 0) {
|
||||
$('#roleIds').val('');
|
||||
return;
|
||||
}
|
||||
var roleIds = '';
|
||||
$.each(selectedNodes, function (index, item) {
|
||||
if (roleIds != '') {
|
||||
roleIds += ',';
|
||||
}
|
||||
roleIds += item.id;
|
||||
})
|
||||
$('#roleIds').val(roleIds);
|
||||
onInitSelectedDataFilter: function(selectedData) {
|
||||
$.each(selectedData, function(i, item) {
|
||||
item.id = item.roleId;
|
||||
item.name = item.roleName;
|
||||
});
|
||||
},
|
||||
onSelect: function(selectedNodeArray) {
|
||||
},
|
||||
onDelete: function(selectedNodeArray) {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 职位选择
|
||||
function initPositionSelect() {
|
||||
layuiInputTree.initMultiSelect({
|
||||
id: 'positionNames',
|
||||
treeselect.init({
|
||||
isSingle: false,
|
||||
name: 'positionIds',
|
||||
explain: '职位',
|
||||
url: 'api/position/listztree',
|
||||
checkboxType: {Y: '', N: ''},
|
||||
getSelectedDatas: function () {
|
||||
var selectedPositions = [];
|
||||
setSelectedData(selectedPositions, $('#positionIds').val(), $('#positionNames').val());
|
||||
return selectedPositions;
|
||||
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'
|
||||
},
|
||||
onConfirm: function (zTree, selectedNodes) {
|
||||
if (selectedNodes.length == 0) {
|
||||
$('#positionIds').val('');
|
||||
return;
|
||||
}
|
||||
var positionIds = '';
|
||||
$.each(selectedNodes, function (index, item) {
|
||||
if (positionIds != '') {
|
||||
positionIds += ',';
|
||||
}
|
||||
positionIds += item.id;
|
||||
})
|
||||
$('#positionIds').val(positionIds);
|
||||
onInitSelectedDataFilter: function(selectedData) {
|
||||
$.each(selectedData, function(i, item) {
|
||||
item.id = item.positionId;
|
||||
item.name = item.positionName;
|
||||
});
|
||||
},
|
||||
onSelect: function(selectedNodeArray) {
|
||||
},
|
||||
onDelete: function(selectedNodeArray) {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 组选择
|
||||
function initGroupSelect() {
|
||||
layuiInputTree.initMultiSelect({
|
||||
id: 'groupNames',
|
||||
treeselect.init({
|
||||
isSingle: false,
|
||||
name: 'groupIds',
|
||||
explain: '组',
|
||||
url: 'api/group/listztree',
|
||||
checkboxType: {Y: '', N: ''},
|
||||
getSelectedDatas: function () {
|
||||
var selectedGroups = [];
|
||||
setSelectedData(selectedGroups, $('#groupIds').val(), $('#groupNames').val());
|
||||
return selectedGroups;
|
||||
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'
|
||||
},
|
||||
onConfirm: function (zTree, selectedNodes) {
|
||||
if (selectedNodes.length == 0) {
|
||||
$('#groupIds').val('');
|
||||
return;
|
||||
}
|
||||
var groupIds = '';
|
||||
$.each(selectedNodes, function (index, item) {
|
||||
if (groupIds != '') {
|
||||
groupIds += ',';
|
||||
}
|
||||
groupIds += item.id;
|
||||
})
|
||||
$('#groupIds').val(groupIds);
|
||||
onInitSelectedDataFilter: function(selectedData) {
|
||||
$.each(selectedData, function(i, item) {
|
||||
item.id = item.groupId;
|
||||
item.name = item.groupName;
|
||||
});
|
||||
},
|
||||
onSelect: function(selectedNodeArray) {
|
||||
},
|
||||
onDelete: function(selectedNodeArray) {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -10,6 +10,12 @@
|
||||
<link rel="stylesheet" href="assets/js/vendor/viewer/viewer.min.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>
|
||||
.test-table-reload-btn {margin-bottom: 10px; display: flex;}
|
||||
.test-table-reload-btn .layui-inline {margin-right: 5px; display: flex; align-items: center;}
|
||||
.test-table-reload-btn .search-item .select-container {border: 1px solid silver; padding: 0 10px; height: 28px; display: flex; align-items: center}
|
||||
.test-table-reload-btn .layui-inline .layui-form-checkbox[lay-skin=primary] span {padding-right: 0px;}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="layui-anim layui-anim-fadein">
|
||||
@ -18,7 +24,45 @@
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-body">
|
||||
<blockquote id="selectedDepartmentName" class="layui-elem-quote"></blockquote>
|
||||
<div class="test-table-reload-btn" style="margin-bottom: 10px;">
|
||||
<div class="test-table-reload-btn">
|
||||
<div class="layui-inline layui-form search-item">
|
||||
<select id="searchLevel" name="searchLevel" lay-filter="searchLevelFilter">
|
||||
<option value="this">本级</option>
|
||||
<option value="global">全局</option>
|
||||
</select>
|
||||
</div>
|
||||
<div id="noDepartmentContainer" class="layui-inline layui-form search-item">
|
||||
<input type="checkbox" name="noDepartment" title="无部门" lay-skin="primary" lay-filter="noDepartmentFilter">
|
||||
</div>
|
||||
<!-- 角色 start -->
|
||||
<div class="layui-inline layui-form search-item">
|
||||
<input type="checkbox" name="noRole" title="无角色" lay-skin="primary" lay-filter="noRoleFilter">
|
||||
</div>
|
||||
<div id="roleContainer" class="layui-inline layui-form search-item">
|
||||
<input type="hidden" id="roleId" name="roleId">
|
||||
<div id="roleIdContainer" class="select-container">请选择角色</div>
|
||||
</div>
|
||||
<!-- 角色 end -->
|
||||
<!-- 职位 start -->
|
||||
<div class="layui-inline layui-form search-item">
|
||||
<input type="checkbox" name="noPosition" title="无职位" lay-skin="primary" lay-filter="noPositionFilter">
|
||||
</div>
|
||||
<div id="positionContainer" class="layui-inline layui-form search-item">
|
||||
<input type="hidden" id="positionId" name="roleId">
|
||||
<div id="positionIdContainer" class="select-container">请选择职位</div>
|
||||
</div>
|
||||
<!-- 职位 end -->
|
||||
<!-- 组 start -->
|
||||
<div class="layui-inline layui-form search-item">
|
||||
<input type="checkbox" name="noGroup" title="无组" lay-skin="primary" lay-filter="noGroupFilter">
|
||||
</div>
|
||||
<div id="groupContainer" class="layui-inline layui-form search-item">
|
||||
<input type="hidden" id="groupId" name="roleId">
|
||||
<div id="groupIdContainer" class="select-container">请选择组</div>
|
||||
</div>
|
||||
<!-- 组 end -->
|
||||
</div>
|
||||
<div class="test-table-reload-btn">
|
||||
<input type="hidden" id="userExpand" th:value="${userExpand}" th:if="${userExpand}">
|
||||
<div class="layui-inline">
|
||||
<input type="text" id="keywords" class="layui-input search-item" placeholder="输入用户名、昵称">
|
||||
@ -40,30 +84,13 @@
|
||||
<option value="-2">审核不通过</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<input type="hidden" id="roleId">
|
||||
<input type="text" id="roleName" class="layui-input search-item search-item-width-100" placeholder="选择角色">
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<input type="hidden" id="positionId">
|
||||
<input type="text" id="positionName" class="layui-input search-item search-item-width-100" placeholder="选择职位">
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<input type="hidden" id="groupId">
|
||||
<input type="text" id="groupName" class="layui-input search-item search-item-width-100" placeholder="选择用户组">
|
||||
</div>
|
||||
<div class="layui-inline layui-form search-item">
|
||||
<select id="searchLevel" name="searchLevel">
|
||||
<option value="this">本级</option>
|
||||
<option value="global">全局</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="layui-btn-group">
|
||||
<button type="button" id="search" class="layui-btn layui-btn-sm">
|
||||
<i class="fa fa-lg fa-search"></i> 搜索
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<table class="layui-hide" id="dataTable" lay-filter="dataTable"></table>
|
||||
<!-- 表头按钮组 -->
|
||||
<script type="text/html" id="headerToolBar">
|
||||
@ -84,27 +111,32 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="assets/js/common/layui-input-tree.js"></script>
|
||||
<script src="assets/layuiadmin/layui/layui.js"></script>
|
||||
<script th:inline="javascript">
|
||||
layui.config({
|
||||
base: 'assets/layuiadmin/'
|
||||
}).extend({
|
||||
index: 'lib/index'
|
||||
}).use(['index', 'table', 'laydate', 'upload', 'ztree'], function() {
|
||||
index: 'lib/index',
|
||||
treeselect: 'custom/treeselect'
|
||||
}).use(['index', 'table', 'form', 'laydate', 'upload', 'treeselect'], function() {
|
||||
var $ = layui.$;
|
||||
var $win = $(window);
|
||||
var table = layui.table;
|
||||
var form = layui.form;
|
||||
var admin = layui.admin;
|
||||
var layer = layui.layer;
|
||||
var laydate = layui.laydate;
|
||||
var treeselect = layui.treeselect;
|
||||
var resizeTimeout = null;
|
||||
var expandOption = [[${expandOption}]];
|
||||
var layuiInputTree = new LayuiInputTree(layui);
|
||||
var queryParams = top.restAjax.params(window.location.href);
|
||||
var departmentId = queryParams.departmentId;
|
||||
var tableUserUrl = 'api/core/manage/listpage-user';
|
||||
var tableUrl = tableUserUrl + '?departmentId={departmentId}';
|
||||
var noDepartment = false;
|
||||
var noRole = false;
|
||||
var noPosition = false;
|
||||
var noGroup = false;
|
||||
|
||||
// 初始化表格
|
||||
function initTable() {
|
||||
@ -129,6 +161,30 @@
|
||||
return '<span class="layui-badge">类型错误</span>';
|
||||
}
|
||||
},
|
||||
{field:'departmentNames', width: 160, title: '组织机构', sort: true, align:'center',
|
||||
templet: function(item) {
|
||||
if(!item.departmentNames) {
|
||||
return '-';
|
||||
}
|
||||
return item.departmentNames;
|
||||
}
|
||||
},
|
||||
{field:'roleNames', width: 160, title: '角色', sort: true, align:'center',
|
||||
templet: function(item) {
|
||||
if(!item.roleNames) {
|
||||
return '-';
|
||||
}
|
||||
return item.roleNames;
|
||||
}
|
||||
},
|
||||
{field:'positionNames', width: 160, title: '职位', sort: true, align:'center',
|
||||
templet: function(item) {
|
||||
if(!item.positionNames) {
|
||||
return '-';
|
||||
}
|
||||
return item.positionNames;
|
||||
}
|
||||
},
|
||||
{field:'userState', width:80, title: '状态', sort: true, align:'center',
|
||||
templet: function(item) {
|
||||
var value;
|
||||
@ -164,6 +220,14 @@
|
||||
return item.userEmail;
|
||||
}
|
||||
},
|
||||
{field:'groupNames', width: 160, title: '组', sort: true, align:'center',
|
||||
templet: function(item) {
|
||||
if(!item.groupNames) {
|
||||
return '-';
|
||||
}
|
||||
return item.groupNames;
|
||||
}
|
||||
},
|
||||
{field:'userExpiredDate', width:180, title: '账号过期时间', align:'center',
|
||||
templet: function(item) {
|
||||
if(!item.userExpiredDate) {
|
||||
@ -235,7 +299,7 @@
|
||||
id: 'dataTable',
|
||||
url: top.restAjax.path(tableUrl, [departmentId]),
|
||||
width: admin.screen() > 1 ? '100%' : '',
|
||||
height: $win.height() - 122,
|
||||
height: $win.height() - 162,
|
||||
limit: 20,
|
||||
limits: [20, 40, 60, 80, 100, 200],
|
||||
toolbar: '#headerToolBar',
|
||||
@ -266,9 +330,13 @@
|
||||
endTime: $('#endTime').val(),
|
||||
userType: $('#userType').val(),
|
||||
userState: $('#userState').val(),
|
||||
roleId: $('#roleId').val(),
|
||||
positionId: $('#positionId').val(),
|
||||
groupId: $('#groupId').val()
|
||||
noDepartment: noDepartment,
|
||||
noRole: noRole,
|
||||
roleId: noRole ? '' : $('#roleId').val(),
|
||||
noPosition: noPosition,
|
||||
positionId: noPosition ? '' : $('#positionId').val(),
|
||||
noGroup: noGroup,
|
||||
groupId: noGroup ? '' : $('#groupId').val()
|
||||
},
|
||||
page: {
|
||||
curr: currentPage
|
||||
@ -311,49 +379,93 @@
|
||||
}
|
||||
// 初始化下拉树
|
||||
function initSelectInputTree() {
|
||||
// 角色下拉树选择
|
||||
layuiInputTree.initSelect({
|
||||
id: 'roleName',
|
||||
// 角色初始化
|
||||
treeselect.init({
|
||||
isSingle: true,
|
||||
name: 'roleId',
|
||||
explain: '角色',
|
||||
url: 'api/role/listztree',
|
||||
getSelectedData: function() {
|
||||
return {id: $('#roleId').val(), name: $('#roleName').val()}
|
||||
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'
|
||||
},
|
||||
onConfirm: function(zTree, selectedNode) {
|
||||
if(!selectedNode) {
|
||||
$('#roleId').val('');
|
||||
return;
|
||||
}
|
||||
$('#roleId').val(selectedNode.id);
|
||||
onInitSelectedDataFilter: function(selectedData) {
|
||||
$.each(selectedData, function(i, item) {
|
||||
item.id = item.roleId;
|
||||
item.name = item.roleName;
|
||||
});
|
||||
},
|
||||
onSelect: function(selectedNodeArray) {
|
||||
},
|
||||
onDelete: function(selectedNodeArray) {
|
||||
}
|
||||
})
|
||||
|
||||
// 职位下拉树选择
|
||||
layuiInputTree.initSelect({
|
||||
id: 'positionName',
|
||||
treeselect.init({
|
||||
isSingle: true,
|
||||
name: 'positionId',
|
||||
explain: '职位',
|
||||
url: 'api/position/listztree',
|
||||
getSelectedData: function() {
|
||||
return {id: $('#positionId').val(), name: $('#positionName').val()}
|
||||
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'
|
||||
},
|
||||
onConfirm: function(zTree, selectedNode) {
|
||||
if(!selectedNode) {
|
||||
$('#positionId').val('');
|
||||
return;
|
||||
}
|
||||
$('#positionId').val(selectedNode.id);
|
||||
onInitSelectedDataFilter: function(selectedData) {
|
||||
$.each(selectedData, function(i, item) {
|
||||
item.id = item.positionId;
|
||||
item.name = item.positionName;
|
||||
});
|
||||
},
|
||||
onSelect: function(selectedNodeArray) {
|
||||
},
|
||||
onDelete: function(selectedNodeArray) {
|
||||
}
|
||||
})
|
||||
|
||||
// 用户组下拉树选择
|
||||
layuiInputTree.initSelect({
|
||||
id: 'groupName',
|
||||
treeselect.init({
|
||||
isSingle: true,
|
||||
name: 'groupId',
|
||||
explain: '组',
|
||||
url: 'api/group/listztree',
|
||||
getSelectedData: function() {
|
||||
return {id: $('#groupId').val(), name: $('#groupName').val()}
|
||||
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'
|
||||
},
|
||||
onConfirm: function(zTree, selectedNode) {
|
||||
if(!selectedNode) {
|
||||
$('#groupId').val('');
|
||||
return;
|
||||
}
|
||||
$('#groupId').val(selectedNode.id);
|
||||
onInitSelectedDataFilter: function(selectedData) {
|
||||
$.each(selectedData, function(i, item) {
|
||||
item.id = item.groupId;
|
||||
item.name = item.groupName;
|
||||
});
|
||||
},
|
||||
onSelect: function(selectedNodeArray) {
|
||||
},
|
||||
onDelete: function(selectedNodeArray) {
|
||||
}
|
||||
})
|
||||
}
|
||||
@ -507,6 +619,50 @@
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#noDepartmentContainer').hide();
|
||||
form.on('select(searchLevelFilter)', function(data) {
|
||||
if(data.value === 'this') {
|
||||
$('#noDepartmentContainer').hide();
|
||||
$('input[name="noDepartment"]').prop('checked', false);
|
||||
noDepartment = false;
|
||||
} else {
|
||||
$('#noDepartmentContainer').show();
|
||||
}
|
||||
form.render('checkbox');
|
||||
});
|
||||
|
||||
form.on('checkbox(noDepartmentFilter)', function(data) {
|
||||
noDepartment = data.elem.checked;
|
||||
console.log(1)
|
||||
});
|
||||
|
||||
form.on('checkbox(noRoleFilter)', function(data) {
|
||||
noRole = data.elem.checked;
|
||||
if(noRole) {
|
||||
$('#roleContainer').hide();
|
||||
} else {
|
||||
$('#roleContainer').show();
|
||||
}
|
||||
});
|
||||
|
||||
form.on('checkbox(noPositionFilter)', function(data) {
|
||||
noPosition = data.elem.checked;
|
||||
if(noPosition) {
|
||||
$('#positionContainer').hide();
|
||||
} else {
|
||||
$('#positionContainer').show();
|
||||
}
|
||||
});
|
||||
|
||||
form.on('checkbox(noGroupFilter)', function(data) {
|
||||
noGroup = data.elem.checked;
|
||||
if(noGroup) {
|
||||
$('#groupContainer').hide();
|
||||
} else {
|
||||
$('#groupContainer').show();
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
@ -90,34 +90,42 @@
|
||||
</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>
|
||||
<label class="layui-form-label">组织部门*</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="hidden" id="departmentIds" name="departmentIds">
|
||||
<input type="text" id="departmentNames" name="departmentNames" class="layui-input" placeholder="勾选组织部门" lay-verify="required">
|
||||
<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">
|
||||
<input type="text" id="roleNames" name="roleNames" class="layui-input" placeholder="勾选角色">
|
||||
<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">
|
||||
<input type="text" id="positionNames" name="positionNames" class="layui-input" placeholder="勾选职位">
|
||||
<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">
|
||||
<input type="text" id="groupNames" name="groupNames" class="layui-input" placeholder="勾选组">
|
||||
<div id="groupIdsContainer" 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;">
|
||||
@ -138,21 +146,22 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="assets/js/common/layui-input-tree.js"></script>
|
||||
<!--<script src="assets/js/common/layui-input-tree.js"></script>-->
|
||||
<script src="assets/js/core/manage/department-user.js"></script>
|
||||
<script src="assets/layuiadmin/layui/layui.js"></script>
|
||||
<script>
|
||||
layui.config({
|
||||
base: 'assets/layuiadmin/' //静态资源所在路径
|
||||
}).extend({
|
||||
index: 'lib/index' //主入口模块
|
||||
}).use(['index', 'form', 'laydate', 'ztree'], function () {
|
||||
index: 'lib/index', //主入口模块
|
||||
treeselect: 'custom/treeselect'
|
||||
}).use(['index', 'form', 'laydate', 'treeselect'], function () {
|
||||
var $ = layui.$;
|
||||
var laydate = layui.laydate;
|
||||
var form = layui.form;
|
||||
var layuiInputTree = new LayuiInputTree(layui);
|
||||
var treeselect = layui.treeselect;
|
||||
|
||||
initMultiSelectInputTree($, layuiInputTree);
|
||||
initMultiSelectInputTree($, treeselect);
|
||||
initDate(laydate);
|
||||
|
||||
// 提交表单
|
||||
|
@ -88,34 +88,42 @@
|
||||
</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>
|
||||
<label class="layui-form-label">组织部门*</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="hidden" id="departmentIds" name="departmentIds">
|
||||
<input type="text" id="departmentNames" name="departmentNames" class="layui-input" placeholder="勾选组织部门" lay-verify="required">
|
||||
<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">
|
||||
<input type="text" id="roleNames" name="roleNames" class="layui-input" placeholder="勾选角色">
|
||||
<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">
|
||||
<input type="text" id="positionNames" name="positionNames" class="layui-input" placeholder="勾选职位">
|
||||
<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">
|
||||
<input type="text" id="groupNames" name="groupNames" class="layui-input" placeholder="勾选组">
|
||||
<div id="groupIdsContainer" 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;">
|
||||
@ -136,22 +144,21 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="assets/js/common/layui-input-tree.js"></script>
|
||||
<script src="assets/js/core/manage/department-user.js"></script>
|
||||
<script src="assets/layuiadmin/layui/layui.js"></script>
|
||||
<script>
|
||||
layui.config({
|
||||
base: 'assets/layuiadmin/' //静态资源所在路径
|
||||
}).extend({
|
||||
index: 'lib/index' //主入口模块
|
||||
}).use(['index', 'form', 'laydate', 'ztree'], function(){
|
||||
index: 'lib/index', //主入口模块
|
||||
treeselect: 'custom/treeselect'
|
||||
}).use(['index', 'form', 'laydate', 'treeselect'], function(){
|
||||
var $ = layui.$;
|
||||
var laydate = layui.laydate;
|
||||
var form = layui.form;
|
||||
var layuiInputTree = new LayuiInputTree(layui);
|
||||
var treeselect = layui.treeselect;
|
||||
var userId = top.restAjax.params(window.location.href).userId;
|
||||
|
||||
initMultiSelectInputTree($, layuiInputTree);
|
||||
initDate(laydate);
|
||||
|
||||
// 初始化
|
||||
@ -182,6 +189,8 @@
|
||||
} else {
|
||||
$('#userAvatar').val($('#userAvatar').val());
|
||||
}
|
||||
|
||||
initMultiSelectInputTree($, treeselect);
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
}, function() {
|
||||
|
Loading…
Reference in New Issue
Block a user