From b55bce7086c4ecb34e612ce44f00331d761273c5 Mon Sep 17 00:00:00 2001 From: zhc077 <565291854@qq.com> Date: Sun, 10 Nov 2024 12:27:46 +0800 Subject: [PATCH] =?UTF-8?q?=E9=97=AE=E9=A2=98=E4=BF=AE=E6=94=B9=2011.10?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/jeecg/config/shiro/ShiroConfig.java | 5 +- .../controller/SysDepartController.java | 28 +++ .../system/service/ISysDepartService.java | 1 + .../service/impl/SysDepartServiceImpl.java | 47 ++++ jeecgboot-vue3/src/api/common/api.ts | 8 + .../jeecg/components/JSelectDept4FaRen.vue | 207 ++++++++++++++++++ .../modal/DeptSelectModal4FaRen.vue | 131 +++++++++++ .../system/loginmini/MiniRegister4faren.vue | 3 +- 8 files changed, 428 insertions(+), 2 deletions(-) create mode 100644 jeecgboot-vue3/src/components/Form/src/jeecg/components/JSelectDept4FaRen.vue create mode 100644 jeecgboot-vue3/src/components/Form/src/jeecg/components/modal/DeptSelectModal4FaRen.vue diff --git a/jeecg-boot/jeecg-boot-base-core/src/main/java/org/jeecg/config/shiro/ShiroConfig.java b/jeecg-boot/jeecg-boot-base-core/src/main/java/org/jeecg/config/shiro/ShiroConfig.java index a76b18e..a9d5810 100644 --- a/jeecg-boot/jeecg-boot-base-core/src/main/java/org/jeecg/config/shiro/ShiroConfig.java +++ b/jeecg-boot/jeecg-boot-base-core/src/main/java/org/jeecg/config/shiro/ShiroConfig.java @@ -185,7 +185,10 @@ public class ShiroConfig { filterChainDefinitionMap.put("/sys/user/userRegister4Faren", "anon"); //法人注册接口 filterChainDefinitionMap.put("/sys/user/userRegister4Shenbaoren", "anon");//申报人注册 - filterChainDefinitionMap.put("/sys/sysDepart/queryDepartTreeSync", "anon");//申报人用户注册 + + filterChainDefinitionMap.put("/sys/sysDepart/queryDepartTreeSync", "anon");//申报人注册时,选择部门列表 + + filterChainDefinitionMap.put("/sys/sysDepart/queryDepartTreeSync4FaRen", "anon");//法人注册时,选择部门列表 diff --git a/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/SysDepartController.java b/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/SysDepartController.java index d90e3a4..803fd42 100644 --- a/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/SysDepartController.java +++ b/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/SysDepartController.java @@ -44,6 +44,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.*; +import java.util.stream.Collectors; /** *

@@ -170,6 +171,33 @@ public class SysDepartController { return result; } + /** + * @description: 法人注册时,只显示市和县区科技局,不显示下属单位 + * @param: [parentId, ids, primaryKey] + * @return: org.jeecg.common.api.vo.Result> + * @author: z.h.c + * @date: 24/11/9 16:07 + */ + @RequestMapping(value = "/queryDepartTreeSync4FaRen", method = RequestMethod.GET) + public Result> queryDepartTreeSync4FaRen(@RequestParam(name = "pid", required = false) String parentId, + @RequestParam(name = "ids", required = false) String ids, + @RequestParam(name = "primaryKey", required = false) String primaryKey) { + Result> result = new Result<>(); + try { +// parentId = "1839495887972130817"; + List sysDeparts = sysDepartService.list(new LambdaQueryWrapper().eq(SysDepart::getParentId, "1839495887972130817")); + ids = Optional.ofNullable(sysDeparts).orElse(new LinkedList<>()).stream().map(e -> e.getId()).collect(Collectors.joining(",")); + List list = sysDepartService.queryTreeListByPid4FaRen(parentId, ids, primaryKey); + result.setResult(list); + result.setSuccess(true); + } catch (Exception e) { + log.error(e.getMessage(), e); + result.setSuccess(false); + result.setMessage("查询失败"); + } + return result; + } + /** * 获取某个部门的所有父级部门的ID * diff --git a/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/ISysDepartService.java b/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/ISysDepartService.java index 95503a8..23404eb 100644 --- a/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/ISysDepartService.java +++ b/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/ISysDepartService.java @@ -148,6 +148,7 @@ public interface ISysDepartService extends IService{ * @return */ List queryTreeListByPid(String parentId,String ids, String primaryKey); + List queryTreeListByPid4FaRen(String parentId,String ids, String primaryKey); /** * 获取某个部门的所有父级部门的ID diff --git a/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysDepartServiceImpl.java b/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysDepartServiceImpl.java index 279ad83..3d1ad59 100644 --- a/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysDepartServiceImpl.java +++ b/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysDepartServiceImpl.java @@ -645,6 +645,53 @@ public class SysDepartServiceImpl extends ServiceImpl queryTreeListByPid4FaRen(String parentId,String ids, String primaryKey) { + /*Consumer> square = i -> { + if (oConvertUtils.isNotEmpty(ids)) { + if (CommonConstant.DEPART_KEY_ORG_CODE.equals(primaryKey)) { + i.in(SysDepart::getOrgCode, ids.split(SymbolConstant.COMMA)); + } else { + i.in(SysDepart::getId, ids.split(SymbolConstant.COMMA)); + } + } else { + if(oConvertUtils.isEmpty(parentId)){ + i.and(q->q.isNull(true,SysDepart::getParentId).or().eq(true,SysDepart::getParentId,"")); + }else{ + i.eq(true,SysDepart::getParentId,parentId); + } + } + };*/ + LambdaQueryWrapper lqw=new LambdaQueryWrapper<>(); + + lqw.in(SysDepart::getId,ids.split(SymbolConstant.COMMA)); +// i.in(SysDepart::getOrgCode, ids.split(SymbolConstant.COMMA)); + //------------------------------------------------------------------------------------------------ + //是否开启系统管理模块的 SASS 控制 + /*if(MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL){ + lqw.eq(SysDepart::getTenantId, oConvertUtils.getInt(TenantContext.getTenant(), 0)); + }*/ + //------------------------------------------------------------------------------------------------ + lqw.eq(true,SysDepart::getDelFlag,CommonConstant.DEL_FLAG_0.toString()); +// lqw.func(square); + //update-begin---author:wangshuai ---date:20220527 for:[VUEN-1143]排序不对,vue3和2应该都有问题,应该按照升序排------------ + lqw.orderByAsc(SysDepart::getDepartOrder); + //update-end---author:wangshuai ---date:20220527 for:[VUEN-1143]排序不对,vue3和2应该都有问题,应该按照升序排-------------- + List list = list(lqw); + //update-begin---author:wangshuai ---date:20220316 for:[JTC-119]在部门管理菜单下设置部门负责人 创建用户的时候不需要处理 + //设置用户id,让前台显示 +// this.setUserIdsByDepList(list); + //update-end---author:wangshuai ---date:20220316 for:[JTC-119]在部门管理菜单下设置部门负责人 创建用户的时候不需要处理 + List records = new ArrayList<>(); + for (int i = 0; i < list.size(); i++) { + SysDepart depart = list.get(i); + SysDepartTreeModel treeModel = new SysDepartTreeModel(depart); + //TODO 异步树加载key拼接__+时间戳,以便于每次展开节点会刷新数据 + //treeModel.setKey(treeModel.getKey()+"__"+System.currentTimeMillis()); + records.add(treeModel); + } + return records; + } + @Override public JSONObject queryAllParentIdByDepartId(String departId) { JSONObject result = new JSONObject(); diff --git a/jeecgboot-vue3/src/api/common/api.ts b/jeecgboot-vue3/src/api/common/api.ts index 47d5cfb..7772087 100644 --- a/jeecgboot-vue3/src/api/common/api.ts +++ b/jeecgboot-vue3/src/api/common/api.ts @@ -8,6 +8,7 @@ enum Api { userList = '/sys/user/list', roleList = '/sys/role/list', queryDepartTreeSync = '/sys/sysDepart/queryDepartTreeSync', + queryDepartTreeSync4FaRen = '/sys/sysDepart/queryDepartTreeSync4FaRen', queryTreeList = '/sys/sysDepart/queryTreeList', loadTreeData = '/sys/category/loadTreeData', loadDictItem = '/sys/category/loadDictItem/', @@ -51,6 +52,13 @@ export const getRoleList = (params) => { export const queryDepartTreeSync = (params?) => { return defHttp.get({ url: Api.queryDepartTreeSync, params }); }; + +// 法人注册时,弹出列表只显示市和县区科技局,不显示下属单位 add by zhc 11.10 +export const queryDepartTreeSync4FaRen = (params?) => { + return defHttp.get({ url: Api.queryDepartTreeSync4FaRen, params }); +}; + + /** * 获取部门树列表 */ diff --git a/jeecgboot-vue3/src/components/Form/src/jeecg/components/JSelectDept4FaRen.vue b/jeecgboot-vue3/src/components/Form/src/jeecg/components/JSelectDept4FaRen.vue new file mode 100644 index 0000000..6429ee3 --- /dev/null +++ b/jeecgboot-vue3/src/components/Form/src/jeecg/components/JSelectDept4FaRen.vue @@ -0,0 +1,207 @@ + + + + diff --git a/jeecgboot-vue3/src/components/Form/src/jeecg/components/modal/DeptSelectModal4FaRen.vue b/jeecgboot-vue3/src/components/Form/src/jeecg/components/modal/DeptSelectModal4FaRen.vue new file mode 100644 index 0000000..ec88712 --- /dev/null +++ b/jeecgboot-vue3/src/components/Form/src/jeecg/components/modal/DeptSelectModal4FaRen.vue @@ -0,0 +1,131 @@ + + + diff --git a/jeecgboot-vue3/src/views/system/loginmini/MiniRegister4faren.vue b/jeecgboot-vue3/src/views/system/loginmini/MiniRegister4faren.vue index 506adcf..1085f79 100644 --- a/jeecgboot-vue3/src/views/system/loginmini/MiniRegister4faren.vue +++ b/jeecgboot-vue3/src/views/system/loginmini/MiniRegister4faren.vue @@ -41,7 +41,7 @@

- +
@@ -126,6 +126,7 @@ import eyeKImg from '/@/assets/loginmini/icon/icon-eye-k.png'; import eyeGImg from '/@/assets/loginmini/icon/icon-eye-g.png'; import JSelectDept from '/@/components/Form/src/jeecg/components/JSelectDept.vue'; + import JSelectDept4FaRen from '/@/components/Form/src/jeecg/components/JSelectDept4FaRen.vue'; import { useI18n } from '/@/hooks/web/useI18n'; import codeImg from '/@/assets/images/checkcode.png';