diff --git a/common/src/main/resources/static/adminlte/css/skins/skin-blue-light2.css b/common/src/main/resources/static/adminlte/css/skins/skin-blue-light2.css index 8500c65b..a2d4ead2 100644 --- a/common/src/main/resources/static/adminlte/css/skins/skin-blue-light2.css +++ b/common/src/main/resources/static/adminlte/css/skins/skin-blue-light2.css @@ -200,4 +200,4 @@ th[aria-selected=true] .ui-jqgrid-sortable {color:#1890ff;} .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus {background:#f5f5f5;} .ui-jqgrid tr.ui-state-highlight.ui-row-ltr td {background-color:#e5f3ff;} /* .ui-jqgrid tr.ui-row-ltr td {border-right:0!important;} */ -.ui-jqgrid tr.ui-row-ltr td:last-child {border-right:1px solid #eaeaea!important;} +.ui-jqgrid tr.ui-row-ltr td:last-child {border-color:#eaeaea!important;} diff --git a/modules/core/src/main/java/com/jeesite/modules/sys/utils/EmpUtils.java b/modules/core/src/main/java/com/jeesite/modules/sys/utils/EmpUtils.java index 9bf7d81d..dfcdde88 100644 --- a/modules/core/src/main/java/com/jeesite/modules/sys/utils/EmpUtils.java +++ b/modules/core/src/main/java/com/jeesite/modules/sys/utils/EmpUtils.java @@ -24,7 +24,7 @@ import com.jeesite.modules.sys.service.OfficeService; */ public class EmpUtils { - // 部门和公司缓存常量 + // 机构和公司缓存常量 public static final String CACHE_OFFICE_ALL_LIST = "officeAllList"; public static final String CACHE_COMPANY_ALL_LIST = "companyAllList"; public static final String CACHE_COMPANY_OFFICE_LIST = "employeeOfficeList"; @@ -91,7 +91,8 @@ public class EmpUtils { } /** - * 获取当前附属部门对象列表 + * 获取当前附属机构对象列表 + * @author ThinkGem */ public static List getEmployeeOfficeList(){ List list = UserUtils.getCache(CACHE_COMPANY_OFFICE_LIST); @@ -103,37 +104,9 @@ public class EmpUtils { } /** - * 获取所有部门编码,包括附属部门(数据权限用) - * @return - * @author ThinkGem - */ - public static String[] getOfficeCodes(){ - List list = ListUtils.newArrayList(); - list.add(getOffice().getOfficeCode()); - getEmployeeOfficeList().forEach(e -> { - list.add(e.getOfficeCode()); - }); - return list.toArray(new String[list.size()]); - } - - /** - * 获取所有部门编码,包括附属部门(数据权限用) - * @return - * @author ThinkGem - */ - public static String[] getOfficeParentCodess(){ - List list = ListUtils.newArrayList(); - list.add(getOffice().getParentCodes()); - getEmployeeOfficeList().forEach(e -> { - list.add(e.getParentCodes()); - }); - return list.toArray(new String[list.size()]); - } - - /** - * 获取部门对象 + * 根据机构编码获取机构对象 * @param officeCode - * @return + * @author ThinkGem */ public static Office getOffice(String officeCode){ List officeList = getOfficeAllList(); @@ -146,15 +119,16 @@ public class EmpUtils { } /** - * 获取当前员工附属部门 + * 获取当前员工机构 + * @author ThinkGem */ public static Office getOffice(){ return getEmployee().getOffice(); } /** - * 获取所有的机构 - * @return + * 获取当前员工所有的机构 + * @author ThinkGem */ public static List getOfficeAllList(){ @SuppressWarnings("unchecked") @@ -169,16 +143,93 @@ public class EmpUtils { } /** - * 获取当前公司对象 + * 获取当前员工所有机构编码,包括附属机构(数据权限用) + * @author ThinkGem */ - public static Company getCompany(){ - return getEmployee().getCompany(); + public static String[] getOfficeCodes(){ + List list = ListUtils.newArrayList(); + list.add(getOffice().getOfficeCode()); + getEmployeeOfficeList().forEach(e -> { + list.add(e.getOfficeCode()); + }); + return list.toArray(new String[list.size()]); } /** - * 获取公司对象 + * 根据机构类型,获取当前员工所有机构编码,包括附属机构(数据权限用) + * @author ThinkGem + */ + public static String[] getOfficeCodesByType(String type){ + List list = ListUtils.newArrayList(); + Office office = getOffice(); + if (type.equals(office.getOfficeType())){ + list.add(office.getOfficeCode()); + }else{ + Office parent = getOffice().getParentByType(type); + if (parent != null){ + list.add(parent.getOfficeCode()); + } + } + getEmployeeOfficeList().forEach(e -> { + Office office2 = getOffice(e.getOfficeCode()); + if (type.equals(office2.getOfficeType())){ + list.add(office2.getOfficeCode()); + }else{ + Office parent2 = office2.getParentByType(type); + if (parent2 != null){ + list.add(parent2.getOfficeCode()); + } + } + }); + return list.toArray(new String[list.size()]); + } + + /** + * 获取当前员工所有上级机构编码,包括附属机构(数据权限用) + * @author ThinkGem + */ + public static String[] getOfficeParentCodess(){ + List list = ListUtils.newArrayList(); + list.add(getOffice().getParentCodes()); + getEmployeeOfficeList().forEach(e -> { + list.add(e.getParentCodes()); + }); + return list.toArray(new String[list.size()]); + } + + /** + * 根据机构类型,获取当前员工所有机构编码,包括附属机构(数据权限用) + * @author ThinkGem + */ + public static String[] getOfficeParentCodessByType(String type){ + List list = ListUtils.newArrayList(); + Office office = getOffice(); + if (type.equals(office.getOfficeType())){ + list.add(office.getParentCodes()); + }else{ + Office parent = getOffice().getParentByType(type); + if (parent != null){ + list.add(parent.getParentCodes()); + } + } + getEmployeeOfficeList().forEach(e -> { + Office office2 = getOffice(e.getOfficeCode()); + if (type.equals(office2.getOfficeType())){ + list.add(office2.getParentCodes()); + }else{ + Office parent2 = office2.getParentByType(type); + if (parent2 != null){ + list.add(parent2.getParentCodes()); + } + } + }); + return list.toArray(new String[list.size()]); + } + + /** + * 根据公司编码获取公司对象 * @param companyCode - * @return + * @author ThinkGem */ public static Company getCompany(String companyCode){ List companyList = getCompanyAllList(); @@ -191,8 +242,16 @@ public class EmpUtils { } /** - * 获取所有的公司 - * @return + * 获取当前员工公司对象 + * @author ThinkGem + */ + public static Company getCompany(){ + return getEmployee().getCompany(); + } + + /** + * 获取当前员工所有的公司 + * @author ThinkGem */ public static List getCompanyAllList(){ @SuppressWarnings("unchecked") @@ -208,7 +267,7 @@ public class EmpUtils { /** * 清除指定用户缓存,不包括改用的SESSION缓存 - * @param user + * @author ThinkGem */ public static void removeCache(String key){ if (StringUtils.inString(key, CACHE_OFFICE_ALL_LIST, CACHE_COMPANY_ALL_LIST)){ diff --git a/modules/core/src/main/resources/config/jeesite-core.yml b/modules/core/src/main/resources/config/jeesite-core.yml index 7638ceba..74820b1f 100644 --- a/modules/core/src/main/resources/config/jeesite-core.yml +++ b/modules/core/src/main/resources/config/jeesite-core.yml @@ -181,9 +181,9 @@ role: Office: { #控制类型的类名 : "用来获取控制表名和主键字段名,如果为 NONE,则代表是不控制该类型权限", ctrlTypeClass: "com.jeesite.modules.sys.entity.Office", - #控制数据的类名: "指定一个静态类名,方便 ctrlDataAttrName 得到权限数据,如:当前部门编码、公司编码", + #控制数据的类名: "指定一个静态类名,方便 ctrlDataAttrName 得到权限数据,如:当前机构编码、当前公司编码、当前行业编码等", ctrlDataClass: "com.jeesite.modules.sys.utils.EmpUtils", - #控制数据的类名下的属性名 : "可看做类下的 get 方法,如:EmpUtils.getOffices(),支持返回字符串或字符串数组类型", + #控制数据的类名下的属性名 : "可看做 ctrlDataClass 下的 get 方法,如:EmpUtils.getOfficeCodes(),支持返回字符串或字符串数组类型", ctrlDataAttrName: "officeCodes", #控制数据的所有上级编码 : "用于控制数据为树表的情况,为数组时,必须与 ctrlDataAttrName 返回的长度相同,不是树表设置为空", ctrlDataParentCodesAttrName: "officeParentCodess" diff --git a/modules/core/src/main/resources/i18n/core/msg/i18n_en.properties b/modules/core/src/main/resources/i18n/core/msg/i18n_en.properties index d5d3dd2e..e3abacdc 100644 --- a/modules/core/src/main/resources/i18n/core/msg/i18n_en.properties +++ b/modules/core/src/main/resources/i18n/core/msg/i18n_en.properties @@ -68,7 +68,7 @@ 模板名称=Template name 归属模块=Module 模板内容=Template content -模板内容语法格式=Template content syntax format +语法格式=Content syntax format # =========== 消息相关字典 ===========