新增了部门查询接口
This commit is contained in:
parent
3cf18d5ca4
commit
9bd46411bc
@ -30,6 +30,14 @@ public interface IDepartmentBaseService {
|
|||||||
*/
|
*/
|
||||||
List<DepartmentDTO> list(Map<String, Object> params);
|
List<DepartmentDTO> list(Map<String, Object> params);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门列表
|
||||||
|
*
|
||||||
|
* @param ids
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<DepartmentDTO> listByIds(List<String> ids);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 部门列表
|
* 部门列表
|
||||||
*
|
*
|
||||||
@ -309,4 +317,5 @@ public interface IDepartmentBaseService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Integer countAllByAreaCode(String areaCode);
|
Integer countAllByAreaCode(String areaCode);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package ink.wgink.interfaces.department;
|
package ink.wgink.interfaces.department;
|
||||||
|
|
||||||
import ink.wgink.pojo.ListPage;
|
import ink.wgink.pojo.ListPage;
|
||||||
|
import ink.wgink.pojo.dtos.department.DepartmentDTO;
|
||||||
import ink.wgink.pojo.dtos.department.DepartmentUserDTO;
|
import ink.wgink.pojo.dtos.department.DepartmentUserDTO;
|
||||||
import ink.wgink.pojo.result.SuccessResultList;
|
import ink.wgink.pojo.result.SuccessResultList;
|
||||||
|
|
||||||
@ -111,4 +112,18 @@ public interface IDepartmentUserBaseService {
|
|||||||
*/
|
*/
|
||||||
void setUser(List<DepartmentUserDTO> departmentUserDTOs);
|
void setUser(List<DepartmentUserDTO> departmentUserDTOs);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门列表
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<DepartmentDTO> listDepartmentBySelf();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门列表
|
||||||
|
*
|
||||||
|
* @param userId 用户ID
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<DepartmentDTO> listDepartmentByUserId(String userId);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package ink.wgink.login.oauth2.client.controller.apis.department;
|
package ink.wgink.login.oauth2.client.controller.apis.department;
|
||||||
|
|
||||||
import ink.wgink.common.base.DefaultBaseController;
|
import ink.wgink.common.base.DefaultBaseController;
|
||||||
|
import ink.wgink.exceptions.ParamsException;
|
||||||
import ink.wgink.interfaces.consts.ISystemConstant;
|
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||||
import ink.wgink.login.oauth2.client.service.department.IDepartmentService;
|
import ink.wgink.login.oauth2.client.service.department.IDepartmentService;
|
||||||
import ink.wgink.pojo.ListPage;
|
import ink.wgink.pojo.ListPage;
|
||||||
@ -9,6 +10,7 @@ import ink.wgink.pojo.dtos.department.DepartmentDTO;
|
|||||||
import ink.wgink.pojo.result.ErrorResult;
|
import ink.wgink.pojo.result.ErrorResult;
|
||||||
import ink.wgink.pojo.result.SuccessResultData;
|
import ink.wgink.pojo.result.SuccessResultData;
|
||||||
import ink.wgink.pojo.result.SuccessResultList;
|
import ink.wgink.pojo.result.SuccessResultList;
|
||||||
|
import ink.wgink.pojo.vos.IdsVO;
|
||||||
import io.swagger.annotations.*;
|
import io.swagger.annotations.*;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@ -47,6 +49,16 @@ public class DepartmentController extends DefaultBaseController {
|
|||||||
return departmentService.listAll(params);
|
return departmentService.listAll(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "组织部门列表", notes = "组织部门列表接口")
|
||||||
|
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||||
|
@PostMapping("list/ids")
|
||||||
|
public List<DepartmentDTO> listByIds(@RequestBody IdsVO idsVO) {
|
||||||
|
if (idsVO.getIds().isEmpty()) {
|
||||||
|
throw new ParamsException("id列表不能为空");
|
||||||
|
}
|
||||||
|
return departmentService.listByIds(idsVO.getIds());
|
||||||
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "组织部门zTree列表", notes = "组织部门zTree列表接口")
|
@ApiOperation(value = "组织部门zTree列表", notes = "组织部门zTree列表接口")
|
||||||
@ApiImplicitParams({
|
@ApiImplicitParams({
|
||||||
@ApiImplicitParam(name = "id", value = "父ID", paramType = "query", dataType = "String")
|
@ApiImplicitParam(name = "id", value = "父ID", paramType = "query", dataType = "String")
|
||||||
|
@ -4,15 +4,17 @@ import ink.wgink.common.base.DefaultBaseController;
|
|||||||
import ink.wgink.interfaces.consts.ISystemConstant;
|
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||||
import ink.wgink.login.oauth2.client.service.department.IDepartmentUserService;
|
import ink.wgink.login.oauth2.client.service.department.IDepartmentUserService;
|
||||||
import ink.wgink.pojo.ListPage;
|
import ink.wgink.pojo.ListPage;
|
||||||
|
import ink.wgink.pojo.dtos.department.DepartmentDTO;
|
||||||
import ink.wgink.pojo.dtos.department.DepartmentUserDTO;
|
import ink.wgink.pojo.dtos.department.DepartmentUserDTO;
|
||||||
import ink.wgink.pojo.result.ErrorResult;
|
import ink.wgink.pojo.result.ErrorResult;
|
||||||
import ink.wgink.pojo.result.SuccessResult;
|
|
||||||
import ink.wgink.pojo.result.SuccessResultList;
|
import ink.wgink.pojo.result.SuccessResultList;
|
||||||
import io.swagger.annotations.*;
|
import io.swagger.annotations.*;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@ -59,4 +61,21 @@ public class DepartmentUserController extends DefaultBaseController {
|
|||||||
return departmentUserService.listUserId(departmentId);
|
return departmentUserService.listUserId(departmentId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "自己的部门列表", notes = "自己的部门列表接口")
|
||||||
|
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||||
|
@GetMapping("list-department/self")
|
||||||
|
public List<DepartmentDTO> listDepartmentBySelf() {
|
||||||
|
return departmentUserService.listDepartmentBySelf();
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "组织部门用户ID列表", notes = "组织部门用户ID列表接口")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "departmentId", value = "部门ID", paramType = "path"),
|
||||||
|
})
|
||||||
|
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||||
|
@GetMapping("list-department/user-id/{userId}")
|
||||||
|
public List<DepartmentDTO> listDepartmentByUserId(@PathVariable("userId") String userId) {
|
||||||
|
return departmentUserService.listDepartmentByUserId(userId);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,27 @@
|
|||||||
|
package ink.wgink.login.oauth2.client.controller.route.department;
|
||||||
|
|
||||||
|
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName: DepartmentRouteController
|
||||||
|
* @Description: 部门接口
|
||||||
|
* @Author: wanggeng
|
||||||
|
* @Date: 2022/1/11 10:14 PM
|
||||||
|
* @Version: 1.0
|
||||||
|
*/
|
||||||
|
@Api(tags = ISystemConstant.ROUTE_TAGS_PREFIX + "组织部门接口")
|
||||||
|
@Controller
|
||||||
|
@RequestMapping(ISystemConstant.ROUTE_PREFIX + "/department")
|
||||||
|
public class DepartmentRouteController {
|
||||||
|
|
||||||
|
@GetMapping("list-tree-check")
|
||||||
|
public ModelAndView selectUser() {
|
||||||
|
return new ModelAndView("department/list-tree-check");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -17,7 +17,7 @@ import org.springframework.web.servlet.ModelAndView;
|
|||||||
* @Date: 2021/2/13 12:03 下午
|
* @Date: 2021/2/13 12:03 下午
|
||||||
* @Version: 1.0
|
* @Version: 1.0
|
||||||
*/
|
*/
|
||||||
@Api(tags = ISystemConstant.ROUTE_TAGS_PREFIX + "组织部门接口")
|
@Api(tags = ISystemConstant.ROUTE_TAGS_PREFIX + "组织部门用户接口")
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping(ISystemConstant.ROUTE_PREFIX + "/department/user")
|
@RequestMapping(ISystemConstant.ROUTE_PREFIX + "/department/user")
|
||||||
public class DepartmentUserRouteController {
|
public class DepartmentUserRouteController {
|
||||||
|
@ -27,6 +27,9 @@ public interface IDepartmentRemoteService {
|
|||||||
@RemoteGetMethod("/list")
|
@RemoteGetMethod("/list")
|
||||||
List<DepartmentDTO> list(@RemoteServerParams String userCenter, @RemoteQueryParams("access_token") String accessToken, @RemoteQueryParamsMap Map<String, Object> params);
|
List<DepartmentDTO> list(@RemoteServerParams String userCenter, @RemoteQueryParams("access_token") String accessToken, @RemoteQueryParamsMap Map<String, Object> params);
|
||||||
|
|
||||||
|
@RemotePostMethod("/list/ids")
|
||||||
|
List<DepartmentDTO> listByIds(@RemoteServerParams String userCenter, @RemoteQueryParams("access_token") String accessToken, @RemoteJsonBodyParams IdsVO idsVO);
|
||||||
|
|
||||||
@RemoteGetMethod("/get/{departmentId}")
|
@RemoteGetMethod("/get/{departmentId}")
|
||||||
DepartmentDTO get(@RemoteServerParams String userCenter, @RemotePathParams("departmentId") String departmentId, @RemoteQueryParams("access_token") String accessToken);
|
DepartmentDTO get(@RemoteServerParams String userCenter, @RemotePathParams("departmentId") String departmentId, @RemoteQueryParams("access_token") String accessToken);
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ import ink.wgink.annotation.rpc.rest.RemoteService;
|
|||||||
import ink.wgink.annotation.rpc.rest.method.RemoteGetMethod;
|
import ink.wgink.annotation.rpc.rest.method.RemoteGetMethod;
|
||||||
import ink.wgink.annotation.rpc.rest.method.RemotePostMethod;
|
import ink.wgink.annotation.rpc.rest.method.RemotePostMethod;
|
||||||
import ink.wgink.annotation.rpc.rest.params.*;
|
import ink.wgink.annotation.rpc.rest.params.*;
|
||||||
|
import ink.wgink.pojo.dtos.department.DepartmentDTO;
|
||||||
import ink.wgink.pojo.dtos.department.DepartmentUserDTO;
|
import ink.wgink.pojo.dtos.department.DepartmentUserDTO;
|
||||||
import ink.wgink.pojo.result.SuccessResultList;
|
import ink.wgink.pojo.result.SuccessResultList;
|
||||||
import ink.wgink.pojo.vos.IdsVO;
|
import ink.wgink.pojo.vos.IdsVO;
|
||||||
@ -51,4 +52,6 @@ public interface IDepartmentUserRemoteService {
|
|||||||
@RemoteGetMethod("/list/{departmentId}")
|
@RemoteGetMethod("/list/{departmentId}")
|
||||||
List<DepartmentUserDTO> list(@RemoteServerParams String userCenter, @RemotePathParams("departmentId") String departmentId, @RemoteQueryParams("access_token") String accessToken, @RemoteQueryParamsMap Map<String, Object> params);
|
List<DepartmentUserDTO> list(@RemoteServerParams String userCenter, @RemotePathParams("departmentId") String departmentId, @RemoteQueryParams("access_token") String accessToken, @RemoteQueryParamsMap Map<String, Object> params);
|
||||||
|
|
||||||
|
@RemoteGetMethod("/list-department/user-id/{userId}")
|
||||||
|
List<DepartmentDTO> listDepartmentByUserId(@RemoteServerParams String userCenter, @RemoteQueryParams("access_token") String accessToken, @RemotePathParams("userId") String userId);
|
||||||
}
|
}
|
||||||
|
@ -43,6 +43,13 @@ public class DepartmentServiceImpl extends DefaultBaseService implements IDepart
|
|||||||
return departmentRemoteService.list(apiPathProperties.getUserCenter(), OAuth2ClientTokenManager.getInstance().getToken().getAccessToken(), params);
|
return departmentRemoteService.list(apiPathProperties.getUserCenter(), OAuth2ClientTokenManager.getInstance().getToken().getAccessToken(), params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<DepartmentDTO> listByIds(List<String> ids) {
|
||||||
|
IdsVO idsVO = new IdsVO();
|
||||||
|
idsVO.setIds(ids);
|
||||||
|
return departmentRemoteService.listByIds(apiPathProperties.getUserCenter(), OAuth2ClientTokenManager.getInstance().getToken().getAccessToken(), idsVO);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<DepartmentDTO> listByParentId(String departmentParentId) {
|
public List<DepartmentDTO> listByParentId(String departmentParentId) {
|
||||||
Map<String, Object> params = getHashMap(2);
|
Map<String, Object> params = getHashMap(2);
|
||||||
|
@ -6,12 +6,15 @@ import ink.wgink.login.oauth2.client.remote.department.IDepartmentUserRemoteServ
|
|||||||
import ink.wgink.login.oauth2.client.service.department.IDepartmentUserService;
|
import ink.wgink.login.oauth2.client.service.department.IDepartmentUserService;
|
||||||
import ink.wgink.module.oauth2.manager.OAuth2ClientTokenManager;
|
import ink.wgink.module.oauth2.manager.OAuth2ClientTokenManager;
|
||||||
import ink.wgink.pojo.ListPage;
|
import ink.wgink.pojo.ListPage;
|
||||||
|
import ink.wgink.pojo.dtos.department.DepartmentDTO;
|
||||||
|
import ink.wgink.pojo.dtos.department.DepartmentSimpleDTO;
|
||||||
import ink.wgink.pojo.dtos.department.DepartmentUserDTO;
|
import ink.wgink.pojo.dtos.department.DepartmentUserDTO;
|
||||||
import ink.wgink.pojo.dtos.user.UserDTO;
|
import ink.wgink.pojo.dtos.user.UserDTO;
|
||||||
import ink.wgink.pojo.result.SuccessResultList;
|
import ink.wgink.pojo.result.SuccessResultList;
|
||||||
import ink.wgink.pojo.vos.IdsVO;
|
import ink.wgink.pojo.vos.IdsVO;
|
||||||
import ink.wgink.properties.ApiPathProperties;
|
import ink.wgink.properties.ApiPathProperties;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@ -115,4 +118,21 @@ public class DepartmentUserServiceImpl extends DefaultBaseService implements IDe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<DepartmentDTO> listDepartmentBySelf() {
|
||||||
|
List<DepartmentDTO> departmentDTOs = new ArrayList<>();
|
||||||
|
List<DepartmentSimpleDTO> departmentSimpleDTOs = securityComponent.getCurrentUser().getDepartments();
|
||||||
|
departmentSimpleDTOs.forEach(departmentSimpleDTO -> {
|
||||||
|
DepartmentDTO departmentDTO = new DepartmentDTO();
|
||||||
|
BeanUtils.copyProperties(departmentSimpleDTO, departmentDTO);
|
||||||
|
departmentDTOs.add(departmentDTO);
|
||||||
|
});
|
||||||
|
return departmentDTOs;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<DepartmentDTO> listDepartmentByUserId(String userId) {
|
||||||
|
return departmentUserRemoteService.listDepartmentByUserId(apiPathProperties.getUserCenter(), OAuth2ClientTokenManager.getInstance().getToken().getAccessToken(), userId);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,218 @@
|
|||||||
|
<!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">
|
||||||
|
<link rel="stylesheet" href="assets/js/vendor/zTree3/css/metroStyle/metroStyle.css"/>
|
||||||
|
<link rel="stylesheet" href="assets/layuiadmin/style/common.css" media="all">
|
||||||
|
<style>
|
||||||
|
.card-body-left {border-right: 1px dotted silver;}
|
||||||
|
.card-body-right {padding: 5px;}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="layui-anim layui-anim-fadein">
|
||||||
|
<div class="layui-row" style="padding-right: 0px;">
|
||||||
|
<div class="layui-card">
|
||||||
|
<div class="layui-card-body left-tree-wrap">
|
||||||
|
<div id="treeBox" class="layui-col-xs6 card-body-left">
|
||||||
|
<ul id="tree" class="ztree"></ul>
|
||||||
|
</div>
|
||||||
|
<div id="checkedNodeBox" class="layui-col-xs6 card-body-right layui-btn-container"></div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-item layui-layout-admin">
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<div class="layui-footer" style="padding: 0px;">
|
||||||
|
<div class="layui-btn-group">
|
||||||
|
<button type="button" class="layui-btn layui-btn-sm submit">确定</button>
|
||||||
|
<button type="button" class="layui-btn layui-btn-sm layui-btn-primary close">返回</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script src="assets/layuiadmin/layui/layui.js"></script>
|
||||||
|
<script>
|
||||||
|
var common;
|
||||||
|
layui.config({
|
||||||
|
base: 'assets/layuiadmin/'
|
||||||
|
}).extend({
|
||||||
|
index: 'lib/index'
|
||||||
|
}).use(['index', 'ztree', 'common'], function() {
|
||||||
|
common = layui.common;
|
||||||
|
var $ = layui.$;
|
||||||
|
var $win = $(window);
|
||||||
|
var resizeTimeout = null;
|
||||||
|
var zTree;
|
||||||
|
var checkedIds = top.dialog.dialogData.checkedIds ? top.dialog.dialogData.checkedIds : [];
|
||||||
|
var checkedNodes = [];
|
||||||
|
var checkedDepartmentMap = new Map();
|
||||||
|
top.dialog.dialogData.checkedNodes = [];
|
||||||
|
|
||||||
|
function closeBox() {
|
||||||
|
parent.layer.close(parent.layer.getFrameIndex(window.name));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 初始化大小
|
||||||
|
function initSize() {
|
||||||
|
$('#treeBox').css({
|
||||||
|
height: $win.height() - 52,
|
||||||
|
overflow: 'auto'
|
||||||
|
});
|
||||||
|
$('#checkedNodeBox').css({
|
||||||
|
height: $win.height() - 52,
|
||||||
|
overflow: 'auto'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 勾选节点
|
||||||
|
* @param id
|
||||||
|
* @param name
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
|
function getCheckedNode(id, name) {
|
||||||
|
return '<button type="button" class="layui-btn layui-btn-xs">'+ name +' <i class="fa fa-times remove-checked-department" data-department-id="'+ id +'"></i></button>'
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化勾选节点
|
||||||
|
*/
|
||||||
|
function initCheckNodes(callback) {
|
||||||
|
if(!checkedIds || checkedIds.length == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
top.restAjax.post(top.restAjax.path('api/department/list/ids', []), {
|
||||||
|
ids: checkedIds
|
||||||
|
}, null, function(code, data) {
|
||||||
|
$('#checkedNodeBox').empty();
|
||||||
|
var checkedNodes = '';
|
||||||
|
for(var i = 0, item; item = data[i++];) {
|
||||||
|
checkedNodes += getCheckedNode(item.departmentId, item.departmentName);
|
||||||
|
checkedDepartmentMap.set(item.departmentId, {
|
||||||
|
id: item.departmentId,
|
||||||
|
name: item.departmentName
|
||||||
|
});
|
||||||
|
}
|
||||||
|
$('#checkedNodeBox').append(checkedNodes);
|
||||||
|
callback ? callback() : '';
|
||||||
|
}, function(code, data) {
|
||||||
|
top.dialog.msg(data.msg);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 刷新选择的节点
|
||||||
|
function refreshCheckedNodes() {
|
||||||
|
var nodes = zTree.getCheckedNodes(true);
|
||||||
|
$('#checkedNodeBox').empty();
|
||||||
|
var checkedNodes = '';
|
||||||
|
for(var i = 0, item; item = nodes[i++];) {
|
||||||
|
checkedNodes += getCheckedNode(item.id, item.name);
|
||||||
|
}
|
||||||
|
$('#checkedNodeBox').append(checkedNodes);
|
||||||
|
}
|
||||||
|
// 初始化树
|
||||||
|
function initThree() {
|
||||||
|
var setting = {
|
||||||
|
check: {
|
||||||
|
enable: true,
|
||||||
|
chkboxType : {'Y': '', 'N': ''},
|
||||||
|
},
|
||||||
|
async: {
|
||||||
|
enable: true,
|
||||||
|
autoLoad: true,
|
||||||
|
type: 'get',
|
||||||
|
url: top.restAjax.path('api/department/listztree', []),
|
||||||
|
autoParam: ['id'],
|
||||||
|
otherParam: {},
|
||||||
|
dataFilter: function (treeId, parentNode, childNodes) {
|
||||||
|
if (!childNodes) return null;
|
||||||
|
for (var i = 0, l = childNodes.length; i < l; i++) {
|
||||||
|
childNodes[i].name = childNodes[i].name.replace(/\.n/g, '.');
|
||||||
|
}
|
||||||
|
return childNodes;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
callback: {
|
||||||
|
onAsyncSuccess: function(event, treeId, treeNode) {
|
||||||
|
// 初始化已选则数据
|
||||||
|
checkedDepartmentMap.forEach(function(item) {
|
||||||
|
var node = zTree.getNodeByParam('id', item.id);
|
||||||
|
if(!node) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
zTree.checkNode(node, true, false);
|
||||||
|
})
|
||||||
|
},
|
||||||
|
onCheck: function(event, treeId, treeNode) {
|
||||||
|
if(treeNode.checked) {
|
||||||
|
checkedDepartmentMap.set(treeNode.id, {
|
||||||
|
id: treeNode.id,
|
||||||
|
name: treeNode.name
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
checkedDepartmentMap.delete(treeNode.id);
|
||||||
|
}
|
||||||
|
refreshCheckedNodes();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
zTree = $.fn.zTree.init($("#tree"), setting);
|
||||||
|
}
|
||||||
|
|
||||||
|
function initCheckedDepartmentMap() {
|
||||||
|
var checkedDepartments = checkedNodes;
|
||||||
|
if(!checkedDepartments) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for(var i = 0, item; item = checkedDepartments[i++];){
|
||||||
|
checkedDepartmentMap.set(item.departmentId, item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
initSize();
|
||||||
|
initCheckNodes(function() {
|
||||||
|
initCheckedDepartmentMap();
|
||||||
|
initThree();
|
||||||
|
});
|
||||||
|
|
||||||
|
// 事件 - 页面变化
|
||||||
|
$win.on('resize', function() {
|
||||||
|
clearTimeout(resizeTimeout);
|
||||||
|
resizeTimeout = setTimeout(function() {
|
||||||
|
initSize();
|
||||||
|
}, 500);
|
||||||
|
});
|
||||||
|
|
||||||
|
$('.close').on('click', function() {
|
||||||
|
closeBox();
|
||||||
|
});
|
||||||
|
|
||||||
|
// 删除
|
||||||
|
$(document).on('click', '.remove-checked-department', function() {
|
||||||
|
var departmentId = this.dataset.departmentId;
|
||||||
|
checkedDepartmentMap.delete(departmentId);
|
||||||
|
var node = zTree.getNodeByParam('id', departmentId);
|
||||||
|
zTree.checkNode(node, false, false);
|
||||||
|
refreshCheckedNodes();
|
||||||
|
})
|
||||||
|
|
||||||
|
$('.submit').on('click', function() {
|
||||||
|
checkedDepartmentMap.forEach(function(item) {
|
||||||
|
checkedNodes.push(item);
|
||||||
|
});
|
||||||
|
top.dialog.dialogData.checkedNodes = checkedNodes;
|
||||||
|
closeBox();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -1,6 +1,7 @@
|
|||||||
package ink.wgink.service.department.controller.resources;
|
package ink.wgink.service.department.controller.resources;
|
||||||
|
|
||||||
import ink.wgink.common.base.DefaultBaseController;
|
import ink.wgink.common.base.DefaultBaseController;
|
||||||
|
import ink.wgink.exceptions.ParamsException;
|
||||||
import ink.wgink.interfaces.consts.ISystemConstant;
|
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||||
import ink.wgink.pojo.ListPage;
|
import ink.wgink.pojo.ListPage;
|
||||||
import ink.wgink.pojo.dtos.ZTreeDTO;
|
import ink.wgink.pojo.dtos.ZTreeDTO;
|
||||||
@ -45,6 +46,19 @@ public class DepartmentResourceController extends DefaultBaseController {
|
|||||||
return departmentService.list(params);
|
return departmentService.list(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "组织部门列表", notes = "组织部门列表接口")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "departmentParentId", value = "组织部门上级ID", paramType = "path")
|
||||||
|
})
|
||||||
|
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||||
|
@PostMapping("list/ids")
|
||||||
|
public List<DepartmentDTO> listByIds(@RequestBody IdsVO idsVO) {
|
||||||
|
if (idsVO.getIds().isEmpty()) {
|
||||||
|
throw new ParamsException("id列表不能为空");
|
||||||
|
}
|
||||||
|
return departmentService.listByIds(idsVO.getIds());
|
||||||
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "组织部门列表", notes = "组织部门列表接口")
|
@ApiOperation(value = "组织部门列表", notes = "组织部门列表接口")
|
||||||
@ApiImplicitParams({
|
@ApiImplicitParams({
|
||||||
@ApiImplicitParam(name = "departmentParentId", value = "组织部门上级ID", paramType = "path")
|
@ApiImplicitParam(name = "departmentParentId", value = "组织部门上级ID", paramType = "path")
|
||||||
|
@ -3,6 +3,7 @@ package ink.wgink.service.department.controller.resources;
|
|||||||
import ink.wgink.common.base.DefaultBaseController;
|
import ink.wgink.common.base.DefaultBaseController;
|
||||||
import ink.wgink.interfaces.consts.ISystemConstant;
|
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||||
import ink.wgink.pojo.ListPage;
|
import ink.wgink.pojo.ListPage;
|
||||||
|
import ink.wgink.pojo.dtos.department.DepartmentDTO;
|
||||||
import ink.wgink.pojo.dtos.department.DepartmentUserDTO;
|
import ink.wgink.pojo.dtos.department.DepartmentUserDTO;
|
||||||
import ink.wgink.pojo.result.ErrorResult;
|
import ink.wgink.pojo.result.ErrorResult;
|
||||||
import ink.wgink.pojo.result.SuccessResultList;
|
import ink.wgink.pojo.result.SuccessResultList;
|
||||||
@ -116,4 +117,22 @@ public class DepartmentUserResourceController extends DefaultBaseController {
|
|||||||
return departmentUserService.listPage(departmentId, page);
|
return departmentUserService.listPage(departmentId, page);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ApiOperation(value = "自己的部门列表", notes = "自己的部门列表接口")
|
||||||
|
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||||
|
@GetMapping("list-department/self")
|
||||||
|
public List<DepartmentDTO> listDepartmentBySelf() {
|
||||||
|
return departmentUserService.listDepartmentBySelf();
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "组织部门用户ID列表", notes = "组织部门用户ID列表接口")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "departmentId", value = "部门ID", paramType = "path"),
|
||||||
|
})
|
||||||
|
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||||
|
@GetMapping("list-department/user-id/{userId}")
|
||||||
|
public List<DepartmentDTO> listDepartmentByUserId(@PathVariable("userId") String userId) {
|
||||||
|
return departmentUserService.listDepartmentByUserId(userId);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -92,6 +92,11 @@ public class DepartmentRouteController {
|
|||||||
return new ModelAndView("department/list-tree-select");
|
return new ModelAndView("department/list-tree-select");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("list-tree-check")
|
||||||
|
public ModelAndView listTreeCheck() {
|
||||||
|
return new ModelAndView("department/list-tree-check");
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("list-tree-user")
|
@GetMapping("list-tree-user")
|
||||||
public ModelAndView listTreeUser() {
|
public ModelAndView listTreeUser() {
|
||||||
return new ModelAndView("department/list-tree-user");
|
return new ModelAndView("department/list-tree-user");
|
||||||
|
@ -190,6 +190,13 @@ public class DepartmentServiceImpl extends DefaultBaseService implements IDepart
|
|||||||
return destDepartmentDTOs;
|
return destDepartmentDTOs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<DepartmentDTO> listByIds(List<String> ids) {
|
||||||
|
Map<String, Object> params = getHashMap(2);
|
||||||
|
params.put("departmentIds", ids);
|
||||||
|
return list(params);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<DepartmentDTO> listByParentId(String departmentParentId) {
|
public List<DepartmentDTO> listByParentId(String departmentParentId) {
|
||||||
Map<String, Object> params = getHashMap(2);
|
Map<String, Object> params = getHashMap(2);
|
||||||
|
@ -5,6 +5,7 @@ import ink.wgink.exceptions.SearchException;
|
|||||||
import ink.wgink.interfaces.consts.ISystemConstant;
|
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||||
import ink.wgink.interfaces.user.IUserBaseService;
|
import ink.wgink.interfaces.user.IUserBaseService;
|
||||||
import ink.wgink.pojo.ListPage;
|
import ink.wgink.pojo.ListPage;
|
||||||
|
import ink.wgink.pojo.dtos.department.DepartmentDTO;
|
||||||
import ink.wgink.pojo.dtos.department.DepartmentSimpleDTO;
|
import ink.wgink.pojo.dtos.department.DepartmentSimpleDTO;
|
||||||
import ink.wgink.pojo.dtos.department.DepartmentUserDTO;
|
import ink.wgink.pojo.dtos.department.DepartmentUserDTO;
|
||||||
import ink.wgink.pojo.dtos.user.UserDTO;
|
import ink.wgink.pojo.dtos.user.UserDTO;
|
||||||
@ -16,6 +17,7 @@ import ink.wgink.service.department.service.IDepartmentAdjustmentService;
|
|||||||
import ink.wgink.service.department.service.IDepartmentService;
|
import ink.wgink.service.department.service.IDepartmentService;
|
||||||
import ink.wgink.service.department.service.IDepartmentUserService;
|
import ink.wgink.service.department.service.IDepartmentUserService;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@ -384,4 +386,27 @@ public class DepartmentUserServiceImpl extends DefaultBaseService implements IDe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<DepartmentDTO> listDepartmentBySelf() {
|
||||||
|
List<DepartmentDTO> departmentDTOs = new ArrayList<>();
|
||||||
|
List<DepartmentSimpleDTO> departmentSimpleDTOs = securityComponent.getCurrentUser().getDepartments();
|
||||||
|
departmentSimpleDTOs.forEach(departmentSimpleDTO -> {
|
||||||
|
DepartmentDTO departmentDTO = new DepartmentDTO();
|
||||||
|
BeanUtils.copyProperties(departmentSimpleDTO, departmentDTO);
|
||||||
|
departmentDTOs.add(departmentDTO);
|
||||||
|
});
|
||||||
|
return departmentDTOs;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<DepartmentDTO> listDepartmentByUserId(String userId) {
|
||||||
|
Map<String, Object> params = getHashMap(2);
|
||||||
|
params.put("userId", userId);
|
||||||
|
List<String> departmentIds = departmentUserDao.listDepartmentId(params);
|
||||||
|
if (departmentIds.isEmpty()) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
return departmentService.listByIds(departmentIds);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,218 @@
|
|||||||
|
<!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">
|
||||||
|
<link rel="stylesheet" href="assets/js/vendor/zTree3/css/metroStyle/metroStyle.css"/>
|
||||||
|
<link rel="stylesheet" href="assets/layuiadmin/style/common.css" media="all">
|
||||||
|
<style>
|
||||||
|
.card-body-left {border-right: 1px dotted silver;}
|
||||||
|
.card-body-right {padding: 5px;}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="layui-anim layui-anim-fadein">
|
||||||
|
<div class="layui-row" style="padding-right: 0px;">
|
||||||
|
<div class="layui-card">
|
||||||
|
<div class="layui-card-body left-tree-wrap">
|
||||||
|
<div id="treeBox" class="layui-col-xs6 card-body-left">
|
||||||
|
<ul id="tree" class="ztree"></ul>
|
||||||
|
</div>
|
||||||
|
<div id="checkedNodeBox" class="layui-col-xs6 card-body-right layui-btn-container"></div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-item layui-layout-admin">
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<div class="layui-footer" style="padding: 0px;">
|
||||||
|
<div class="layui-btn-group">
|
||||||
|
<button type="button" class="layui-btn layui-btn-sm submit">确定</button>
|
||||||
|
<button type="button" class="layui-btn layui-btn-sm layui-btn-primary close">返回</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script src="assets/layuiadmin/layui/layui.js"></script>
|
||||||
|
<script>
|
||||||
|
var common;
|
||||||
|
layui.config({
|
||||||
|
base: 'assets/layuiadmin/'
|
||||||
|
}).extend({
|
||||||
|
index: 'lib/index'
|
||||||
|
}).use(['index', 'ztree', 'common'], function() {
|
||||||
|
common = layui.common;
|
||||||
|
var $ = layui.$;
|
||||||
|
var $win = $(window);
|
||||||
|
var resizeTimeout = null;
|
||||||
|
var zTree;
|
||||||
|
var checkedIds = top.dialog.dialogData.checkedIds ? top.dialog.dialogData.checkedIds : [];
|
||||||
|
var checkedNodes = [];
|
||||||
|
var checkedDepartmentMap = new Map();
|
||||||
|
top.dialog.dialogData.checkedNodes = [];
|
||||||
|
|
||||||
|
function closeBox() {
|
||||||
|
parent.layer.close(parent.layer.getFrameIndex(window.name));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 初始化大小
|
||||||
|
function initSize() {
|
||||||
|
$('#treeBox').css({
|
||||||
|
height: $win.height() - 52,
|
||||||
|
overflow: 'auto'
|
||||||
|
});
|
||||||
|
$('#checkedNodeBox').css({
|
||||||
|
height: $win.height() - 52,
|
||||||
|
overflow: 'auto'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 勾选节点
|
||||||
|
* @param id
|
||||||
|
* @param name
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
|
function getCheckedNode(id, name) {
|
||||||
|
return '<button type="button" class="layui-btn layui-btn-xs">'+ name +' <i class="fa fa-times remove-checked-department" data-department-id="'+ id +'"></i></button>'
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化勾选节点
|
||||||
|
*/
|
||||||
|
function initCheckNodes(callback) {
|
||||||
|
if(!checkedIds || checkedIds.length == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
top.restAjax.post(top.restAjax.path('api/department/list/ids', []), {
|
||||||
|
ids: checkedIds
|
||||||
|
}, null, function(code, data) {
|
||||||
|
$('#checkedNodeBox').empty();
|
||||||
|
var checkedNodes = '';
|
||||||
|
for(var i = 0, item; item = data[i++];) {
|
||||||
|
checkedNodes += getCheckedNode(item.departmentId, item.departmentName);
|
||||||
|
checkedDepartmentMap.set(item.departmentId, {
|
||||||
|
id: item.departmentId,
|
||||||
|
name: item.departmentName
|
||||||
|
});
|
||||||
|
}
|
||||||
|
$('#checkedNodeBox').append(checkedNodes);
|
||||||
|
callback ? callback() : '';
|
||||||
|
}, function(code, data) {
|
||||||
|
top.dialog.msg(data.msg);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 刷新选择的节点
|
||||||
|
function refreshCheckedNodes() {
|
||||||
|
var nodes = zTree.getCheckedNodes(true);
|
||||||
|
$('#checkedNodeBox').empty();
|
||||||
|
var checkedNodes = '';
|
||||||
|
for(var i = 0, item; item = nodes[i++];) {
|
||||||
|
checkedNodes += getCheckedNode(item.id, item.name);
|
||||||
|
}
|
||||||
|
$('#checkedNodeBox').append(checkedNodes);
|
||||||
|
}
|
||||||
|
// 初始化树
|
||||||
|
function initThree() {
|
||||||
|
var setting = {
|
||||||
|
check: {
|
||||||
|
enable: true,
|
||||||
|
chkboxType : {'Y': '', 'N': ''},
|
||||||
|
},
|
||||||
|
async: {
|
||||||
|
enable: true,
|
||||||
|
autoLoad: true,
|
||||||
|
type: 'get',
|
||||||
|
url: top.restAjax.path('api/department/listztree', []),
|
||||||
|
autoParam: ['id'],
|
||||||
|
otherParam: {},
|
||||||
|
dataFilter: function (treeId, parentNode, childNodes) {
|
||||||
|
if (!childNodes) return null;
|
||||||
|
for (var i = 0, l = childNodes.length; i < l; i++) {
|
||||||
|
childNodes[i].name = childNodes[i].name.replace(/\.n/g, '.');
|
||||||
|
}
|
||||||
|
return childNodes;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
callback: {
|
||||||
|
onAsyncSuccess: function(event, treeId, treeNode) {
|
||||||
|
// 初始化已选则数据
|
||||||
|
checkedDepartmentMap.forEach(function(item) {
|
||||||
|
var node = zTree.getNodeByParam('id', item.id);
|
||||||
|
if(!node) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
zTree.checkNode(node, true, false);
|
||||||
|
})
|
||||||
|
},
|
||||||
|
onCheck: function(event, treeId, treeNode) {
|
||||||
|
if(treeNode.checked) {
|
||||||
|
checkedDepartmentMap.set(treeNode.id, {
|
||||||
|
id: treeNode.id,
|
||||||
|
name: treeNode.name
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
checkedDepartmentMap.delete(treeNode.id);
|
||||||
|
}
|
||||||
|
refreshCheckedNodes();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
zTree = $.fn.zTree.init($("#tree"), setting);
|
||||||
|
}
|
||||||
|
|
||||||
|
function initCheckedDepartmentMap() {
|
||||||
|
var checkedDepartments = checkedNodes;
|
||||||
|
if(!checkedDepartments) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for(var i = 0, item; item = checkedDepartments[i++];){
|
||||||
|
checkedDepartmentMap.set(item.departmentId, item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
initSize();
|
||||||
|
initCheckNodes(function() {
|
||||||
|
initCheckedDepartmentMap();
|
||||||
|
initThree();
|
||||||
|
});
|
||||||
|
|
||||||
|
// 事件 - 页面变化
|
||||||
|
$win.on('resize', function() {
|
||||||
|
clearTimeout(resizeTimeout);
|
||||||
|
resizeTimeout = setTimeout(function() {
|
||||||
|
initSize();
|
||||||
|
}, 500);
|
||||||
|
});
|
||||||
|
|
||||||
|
$('.close').on('click', function() {
|
||||||
|
closeBox();
|
||||||
|
});
|
||||||
|
|
||||||
|
// 删除
|
||||||
|
$(document).on('click', '.remove-checked-department', function() {
|
||||||
|
var departmentId = this.dataset.departmentId;
|
||||||
|
checkedDepartmentMap.delete(departmentId);
|
||||||
|
var node = zTree.getNodeByParam('id', departmentId);
|
||||||
|
zTree.checkNode(node, false, false);
|
||||||
|
refreshCheckedNodes();
|
||||||
|
})
|
||||||
|
|
||||||
|
$('.submit').on('click', function() {
|
||||||
|
checkedDepartmentMap.forEach(function(item) {
|
||||||
|
checkedNodes.push(item);
|
||||||
|
});
|
||||||
|
top.dialog.dialogData.checkedNodes = checkedNodes;
|
||||||
|
closeBox();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
Reference in New Issue
Block a user