Commit a99a67be by 宋祥

1.角色关联部门

parent 86ac2833
......@@ -259,8 +259,17 @@ public enum DdynamicEnum {
* 编写:ly
*/
USER_ID_BLOCK_ID("user_id_block_id","userId","userName","factoryCode","groupCode", "HPSC008.queryUserId"),
/**
/**
* 模块:系统管理
* 用途:部门
* 编写:ly
*/
DEPT_CODE_BLOCK_ID("dept_code_block_id", "orgId", "orgCname", "factoryCode", "factoryName", "companyCode",
"companyName", "HGXSOrg.queryAll"),
/**
* 模块:系统管理
* 用途:生产组查询
* 编写:ly
......
......@@ -72,5 +72,7 @@ public class CommonConstant {
public static final String ROOT = "root";
// 项目档案ID
public static final String PROJ_ID = "projId";
// 企业管理员
public static final String COMPANY_MANAGE = "companyManage";
}
}
......@@ -3,6 +3,7 @@ package com.baosight.hggp.core.dao;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.DateUtils;
import com.baosight.hggp.util.ObjectUtils;
import com.baosight.iplat4j.core.data.DaoEPBase;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.web.threadlocal.UserSession;
......@@ -105,18 +106,25 @@ public class DaoUtils {
log.warn("写入创建人姓名失败", e);
}
// 创建人企业编码
String accountCode = UserSessionUtils.getAccountCode();
AssertUtils.isEmpty(accountCode, "当前用户未绑定公司,无法操作数据,请联系管理员!");
try {
String accountCode = BeanUtils.getProperty(bean, "accountCode");
if (StringUtils.isEmpty(accountCode)) {
accountCode = UserSessionUtils.getAccountCode();
AssertUtils.isEmpty(accountCode, "当前用户未绑定公司,无法操作数据,请联系管理员!");
}
BeanUtils.setProperty(bean, "accountCode", accountCode);
} catch (Exception e) {
log.warn("写入创建人企业编码失败", e);
}
// 创建人组织机构
List<String> orgIds = UserSessionUtils.getOrgId();
AssertUtils.isEmpty(orgIds, "当前用户未绑定部门,无法操作数据,请联系管理员!");
try {
BeanUtils.setProperty(bean, "depCode", orgIds.get(0));
String depCode = BeanUtils.getProperty(bean, "depCode");
if (StringUtils.isEmpty(depCode)) {
List<String> orgIds = UserSessionUtils.getOrgId();
AssertUtils.isEmpty(orgIds, "当前用户未绑定部门,无法操作数据,请联系管理员!");
depCode = orgIds.get(0);
}
BeanUtils.setProperty(bean, "depCode", depCode);
} catch (Exception e) {
log.warn("写入创建人部门编码失败", e);
}
......@@ -159,18 +167,25 @@ public class DaoUtils {
map.put("createdName", userName);
map.put("updatedName", "");
// 创建人企业编码
String accountCode = UserSessionUtils.getAccountCode();
AssertUtils.isEmpty(accountCode, "当前用户未绑定公司,无法操作数据,请联系管理员!");
try {
String accountCode = MapUtils.getString(map, "accountCode");
if (ObjectUtils.isEmpty(accountCode)) {
accountCode = UserSessionUtils.getAccountCode();
AssertUtils.isEmpty(accountCode, "当前用户未绑定公司,无法操作数据,请联系管理员!");
}
map.put("accountCode", accountCode);
} catch (Exception e) {
log.warn("写入创建人企业编码失败", e);
}
// 创建人部门编码
List<String> orgIds = UserSessionUtils.getOrgId();
AssertUtils.isEmpty(orgIds, "当前用户未绑定部门,无法操作数据,请联系管理员!");
try {
map.put("depCode", orgIds.get(0));
String depCode = MapUtils.getString(map, "depCode");
if (ObjectUtils.isEmpty(depCode)) {
List<String> orgIds = UserSessionUtils.getOrgId();
AssertUtils.isEmpty(orgIds, "当前用户未绑定部门,无法操作数据,请联系管理员!");
depCode = orgIds.get(0);
}
map.put("depCode", depCode);
} catch (Exception e) {
log.warn("写入创建人企业编码失败", e);
}
......
......@@ -388,12 +388,24 @@ public class HGSqlConstant {
// 已处理
public static final String DO_PROCESS = "HPZL001.doProcess";
// 已处理
public static final String DO_PROCESS2 = "HPZL001.doProcess2";
}
/**
* 用户群组
*
* @author:songx
* @date:2024/5/7,16:36
*/
public class HgXsUserGroup {
// 根据用户查询
public static final String QUERY_BY_USER = "HGXSUserGroup.queryByUser";
}
/**
* HPXSOrg SQL 定义
*
* @author:songx
......
package com.baosight.hggp.hg.xs.domain;
import java.io.Serializable;
/**
* @author:songx
* @date:2024/1/15,14:50
*/
public class UserGroup implements Serializable {
public static final String FIELD_ID = "id"; /* ID*/
public static final String FIELD_GROUP_ENAME = "groupEname"; /* 群组英文名*/
public static final String FIELD_GROUP_CNAME = "groupCname"; /* 群组中文名*/
public static final String FIELD_ACCOUNT_CODE = "accountCode"; /* 帐套代码*/
public static final String FIELD_USER_ID = "userId"; /* 用户ID*/
/**
* ID
*/
private String id;
/**
* 群组英文名
*/
private String groupEname;
/**
* 群组中文名
*/
private String groupCname;
/**
* 企业代码
*/
private String accountCode;
/**
* 用户ID
*/
private String userId;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getGroupEname() {
return groupEname;
}
public void setGroupEname(String groupEname) {
this.groupEname = groupEname;
}
public String getGroupCname() {
return groupCname;
}
public void setGroupCname(String groupCname) {
this.groupCname = groupCname;
}
public String getAccountCode() {
return accountCode;
}
public void setAccountCode(String accountCode) {
this.accountCode = accountCode;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
}
......@@ -3,6 +3,7 @@ package com.baosight.hggp.hg.xs.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.enums.OrgTypeEnum;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.util.CommonMethod;
import com.baosight.hggp.util.EiInfoUtils;
......@@ -58,8 +59,6 @@ public class ServiceHGXSOrg extends ServiceBase {
}
return inInfo;
}
/**
* @param inInfo
......@@ -79,5 +78,22 @@ public class ServiceHGXSOrg extends ServiceBase {
}
return inInfo;
}
/**
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "组织管理", operType = "查询", operDesc = "部门下拉框")
public EiInfo queryDeptComboBox(EiInfo inInfo) {
try {
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
List<DdynamicEnum> list = new ArrayList<>();
list.add(DdynamicEnum.DEPT_CODE_BLOCK_ID);
CommonMethod.initBlock(inInfo, list, queryRow, false);
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "查询部门失败");
}
return inInfo;
}
}
......@@ -69,8 +69,11 @@
<select id="queryAll" parameterClass="java.util.HashMap" resultClass="com.baosight.hggp.hg.xs.domain.Org">
SELECT
T2.LEVEL AS "level", T3.ORG_ID AS "orgId",
(CASE WHEN T3.ORG_TYPE = 'factory' THEN T3.ORG_CNAME ELSE CONCAT('[',T5.FACTORY_NAME,']',T3.ORG_CNAME) END) AS "orgCname",
T3.ORG_TYPE AS "orgType", T3.FACTORY_CODE AS "factoryCode", T5.FACTORY_NAME AS "factoryName"
(CASE WHEN T3.ORG_TYPE = 'factory' THEN T3.ORG_CNAME
WHEN T3.FACTORY_CODE != '' THEN CONCAT('[', T5.FACTORY_NAME, ']', T3.ORG_CNAME)
ELSE T3.ORG_CNAME END) AS "orgCname",
T3.ORG_TYPE AS "orgType", T3.FACTORY_CODE AS "factoryCode", T5.FACTORY_NAME AS "factoryName",
T3.COMPANY_CODE AS "companyCode", T5.COMPANY_NAME AS "companyName"
FROM (
SELECT
@CODES AS CODES,
......@@ -95,6 +98,9 @@
WHERE 1=1
AND FIND_IN_SET(T3.ORG_ID, T2.CODES)
AND T3.ORG_ID != 'root'
<isNotEmpty prepend=" AND " property="orgType">
T3.ORG_TYPE = #orgType#
</isNotEmpty>
ORDER BY T3.FACTORY_CODE ASC, T2.LEVEL ASC, T3.ORG_ID ASC
</select>
......@@ -150,7 +156,7 @@
<include refid="order"/>
</select>
<!-- 查询子集组信息,包括生产组和下料组(递归) -->
<!-- 查询子集组信息,包括生产组和下料组(递归) -->
<select id="queryGroupComboBox" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
SELECT
T2.LEVEL AS "level", T3.ORG_ID AS "orgId", CONCAT('[',T5.FACTORY_NAME,']',T3.ORG_CNAME) AS "orgCname",
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="HGXSUserGroup">
<sql id="column">
</sql>
<sql id="condition">
<isNotEmpty prepend=" AND " property="loginName">
LOGIN_NAME = #loginName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="loginNames">
LOGIN_NAME IN <iterate close=")" open="(" conjunction="," property="loginNames">#loginNames[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="userId">
USER_ID = #userId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="userIds">
USER_ID IN <iterate close=")" open="(" conjunction="," property="userIds">#userIds[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountCode">
ACCOUNT_CODE = #accountCode#
</isNotEmpty>
</sql>
<!-- 查询用户信息 -->
<select id="queryByUser" resultClass="com.baosight.hggp.hg.xs.domain.UserGroup">
SELECT
A.ID as "id", <!-- id -->
A.GROUP_ENAME as "groupEname", <!-- 群组英文名 -->
A.GROUP_CNAME as "groupCname", <!-- 群组中文名 -->
A.ACCOUNT_CODE as "accountCode", <!-- 企业编码 -->
B.MEMBER_ID as "userId" <!-- 用户ID -->
FROM ${platSchema}.XS_USER_GROUP A,
${platSchema}.XS_USER_GROUP_MEMBER B
WHERE 1=1
AND A.ID = B.PARENT_ID
AND B.MEMBER_TYPE = 'USER'
<isNotEmpty prepend=" AND " property="userIds">
B.MEMBER_ID IN <iterate close=")" open="(" conjunction="," property="userIds">#userIds[]#</iterate>
</isNotEmpty>
</select>
</sqlMap>
package com.baosight.hggp.hg.xs.tools;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.core.enums.OrgTypeEnum;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.constant.HGSqlConstant;
import com.baosight.hggp.hg.xs.domain.Org;
import com.baosight.hggp.hg.xs.domain.User;
import com.baosight.hggp.hg.xs.domain.UserGroup;
import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.MapUtils;
import com.baosight.hggp.util.ObjectUtils;
......@@ -151,6 +153,79 @@ public class HGXSTools {
}
/**
* 用户组
*
* @author:songx
* @date:2024/5/7,16:27
*/
public static class XsUserGroup {
/**
* 查询
*
* @param userIds
* @return
*/
public static List<UserGroup> listByUser(List<String> userIds) {
if (CollectionUtils.isEmpty(userIds)) {
return null;
}
Map queryMap = new HashMap();
queryMap.put("userIds", userIds);
return DaoBase.getInstance().query(HGSqlConstant.HgXsUserGroup.QUERY_BY_USER, queryMap);
}
/**
* 查询
*
* @param userIds
* @return
*/
public static Map<String, List<UserGroup>> mapByUser(List<String> userIds) {
List<UserGroup> results = listByUser(userIds);
if (CollectionUtils.isEmpty(results)) {
return null;
}
return results.stream().collect(Collectors.groupingBy(UserGroup::getUserId));
}
/**
* 设置项目信息
*
* @param inInfo
*/
public static void setIsManager(EiInfo inInfo) {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
List<String> userIds = ObjectUtils.listKey(resultRows, User.FIELD_USER_ID);
Map<String, List<UserGroup>> resultMap = mapByUser(userIds);
if (MapUtils.isEmpty(resultMap)) {
return;
}
for (Map resultRow : resultRows) {
String userId = MapUtils.getString(resultRow, User.FIELD_USER_ID);
List<UserGroup> dbUserGroups = resultMap.get(userId);
setIsManager(resultRow, dbUserGroups);
}
}
/**
* 设置项目信息
*
* @param resultRow
* @param dbUserGroups
*/
private static void setIsManager(Map resultRow, List<UserGroup> dbUserGroups) {
if (CollectionUtils.isEmpty(dbUserGroups)) {
resultRow.put("isManager", CommonConstant.YesNo.NO_0);
return;
}
boolean companyManageExists = dbUserGroups.stream().map(UserGroup::getGroupEname).anyMatch(item ->
CommonConstant.Field.COMPANY_MANAGE.equals(item));
resultRow.put("isManager", companyManageExists ? CommonConstant.YesNo.YES_1 : CommonConstant.YesNo.NO_0);
}
}
/**
* @author:songx
* @date:2024/2/4,10:35
*/
......@@ -201,6 +276,21 @@ public class HGXSTools {
}
/**
* 查询所属公司
*
* @param orgId
* @return
*/
public static Org queryCompany(String orgId) {
AssertUtils.isNull(orgId, "组织ID不能为空");
Map queryMap = new HashMap();
queryMap.put("orgId", orgId);
queryMap.put("orgType", OrgTypeEnum.COMPANY.getCode());
List<Org> results = DaoBase.getInstance().query(HGSqlConstant.HgXsOrg.QUERY_PARENT, queryMap);
return CollectionUtils.isEmpty(results) ? null : results.get(0);
}
/**
* 查询所属厂区
*
* @param orgId
......
......@@ -54,8 +54,8 @@ public class ServiceXSOG0801A extends ServiceEPBase {
// 查询组织
Org org = HGXSTools.XsOrg.get(parentOrgId);
if (OrgTypeEnum.COMPANY.getCode().equals(org.getOrgType())) {
condition = String.format(" ITEM_CODE IN ('%s', '%s', '%s')", OrgTypeEnum.COMPANY.getCode(),
OrgTypeEnum.FACTORY.getCode(), OrgTypeEnum.DEPT.getCode());
condition = String.format(" ITEM_CODE IN ('%s', '%s')", OrgTypeEnum.FACTORY.getCode(),
OrgTypeEnum.DEPT.getCode());
} else if (OrgTypeEnum.FACTORY.getCode().equals(org.getOrgType())) {
condition = String.format(" ITEM_CODE IN ('%s')", OrgTypeEnum.DEPT.getCode());
} else if (OrgTypeEnum.DEPT.getCode().equals(org.getOrgType())) {
......@@ -131,11 +131,19 @@ public class ServiceXSOG0801A extends ServiceEPBase {
row.put("factoryCode", orgId);
row.put("factoryName", row.get("orgCname"));
} else {
// 查询所属厂
Org factoryOrg = HGXSTools.XsOrg.queryFactory(queryRow.get("parentOrgId").toString());
row.put("factoryCode", factoryOrg == null ? "" : factoryOrg.getOrgId());
row.put("factoryName", factoryOrg == null ? "" : factoryOrg.getOrgCname());
}
// 公司代码
if (OrgTypeEnum.COMPANY.getCode().equals(row.get("orgType"))) {
row.put("companyCode", orgId);
row.put("companyName", row.get("orgCname"));
} else {
Org companyOrg = HGXSTools.XsOrg.queryCompany(queryRow.get("parentOrgId").toString());
row.put("companyCode", companyOrg == null ? "" : companyOrg.getOrgId());
row.put("companyName", companyOrg == null ? "" : companyOrg.getOrgCname());
}
newRows.add(row);
}
if (CollectionUtils.isEmpty(newRows)) {
......
package com.baosight.xservices.xs.og.service;
import com.baosight.hggp.core.constant.CodesetConstant;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.enums.OrgTypeEnum;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.core.tools.CodeValueTools;
......@@ -42,11 +43,17 @@ public class ServiceXSOG0801B extends ServiceEPBase {
// 回填父级ID
queryMap.put("parentOrgId", org.getParentOrgId());
String condition;
if (OrgTypeEnum.FACTORY.getCode().equals(org.getOrgType())) {
condition = String.format(" ITEM_CODE = '%s'", OrgTypeEnum.FACTORY.getCode());
if (OrgTypeEnum.COMPANY.getCode().equals(org.getOrgType())) {
condition = String.format(" ITEM_CODE IN ('%s', '%s')", OrgTypeEnum.FACTORY.getCode(),
OrgTypeEnum.DEPT.getCode());
} else if (OrgTypeEnum.FACTORY.getCode().equals(org.getOrgType())) {
condition = String.format(" ITEM_CODE IN ('%s')", OrgTypeEnum.DEPT.getCode());
} else if (OrgTypeEnum.DEPT.getCode().equals(org.getOrgType())) {
condition = String.format(" ITEM_CODE IN ('%s', '%s', '%s', '%s')", OrgTypeEnum.DEPT.getCode(),
OrgTypeEnum.PROD_GROUP.getCode(), OrgTypeEnum.CUT_GROUP.getCode(),
OrgTypeEnum.SYN_GROUP.getCode());
} else {
condition = String.format(" ITEM_CODE IN ('%s', '%s', '%s')", OrgTypeEnum.DEPT.getCode(),
OrgTypeEnum.PROD_GROUP.getCode(), OrgTypeEnum.CUT_GROUP.getCode());
condition = " ITEM_CODE = 'NOT CODE'";
}
List<Map> orgTypes = CodeValueTools.getCodeValues(CodesetConstant.XsOg.ORG_TYPE, condition);
inInfo.addBlock("orgTypeBlock").addRows(orgTypes);
......
......@@ -319,12 +319,14 @@
IS_DELETED, <!-- 逻辑删除(1-已删除|0-正常状态) -->
ACCOUNT_CODE, <!-- 企业编码 -->
FACTORY_CODE,
FACTORY_NAME
FACTORY_NAME,
COMPANY_CODE,
COMPANY_NAME
) VALUES (
#orgId#, #orgEname#, #orgCname#, #orgBriefName#, #orgType#, #parentOrgId#,
#establishDate#, #orgLevel#, #orgNodeType#, #sortIndex#, #recCreator#,
#recCreateTime#, #recRevisor#, #recReviseTime#, #archiveFlag#, #isDeleted#,
#accountCode#, #factoryCode#, #factoryName#
#accountCode#, #factoryCode#, #factoryName#, #companyCode#, #companyName#
)
</insert>
......
package com.baosight.xservices.xs.service;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.xs.tools.HGXSTools;
import com.baosight.iplat4j.core.cache.CacheManager;
import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant;
......@@ -37,6 +38,12 @@ public class ServiceXS3001 extends ServiceEPBase {
public ServiceXS3001() {
}
/**
* 用户列表查询
*
* @param inInfo
* @return
*/
public EiInfo query(EiInfo inInfo) {
if ("".equals(inInfo.getBlock("result").get("orderBy"))) {
inInfo.getBlock("result").set("orderBy", "loginName");
......@@ -46,6 +53,8 @@ public class ServiceXS3001 extends ServiceEPBase {
inInfo.set("inqu_status-0-accountCode", UserSessionUtils.getAccountCode());
}
EiInfo outInfo = super.query(inInfo, "XS01.query", new XS01());
// 用户是否管理员
HGXSTools.XsUserGroup.setIsManager(outInfo);
return outInfo;
}
......
package com.baosight.xservices.xs.service;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.enums.OrgTypeEnum;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.xs.tools.HGXSTools;
import com.baosight.hggp.util.CommonMethod;
import com.baosight.hggp.util.LogUtils;
import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.log.Logger;
import com.baosight.iplat4j.core.log.LoggerFactory;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
......@@ -14,15 +20,39 @@ import com.baosight.xservices.xs.domain.XS02;
import com.baosight.xservices.xs.util.LoginUserDetails;
import com.baosight.xservices.xs.util.UserSession;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/**
* @author:songx
* @date:2024/5/7,17:14
*/
public class ServiceXS3002 extends ServiceEPBase {
private static final Logger logger = LoggerFactory.getLogger(ServiceXS3002.class);
private String USER_TYPE = "USER";
public ServiceXS3002() {
}
/**
* 初始化
*
* @param inInfo
* @return
*/
public EiInfo initLoad(EiInfo inInfo) {
try {
Map queryMap = new HashMap();
queryMap.put("orgType", OrgTypeEnum.DEPT.getCode());
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.DEPT_CODE_BLOCK_ID), queryMap);
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
public EiInfo insert(EiInfo inInfo) {
EiInfo eiInfo = new EiInfo();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
......@@ -42,13 +72,18 @@ public class ServiceXS3002 extends ServiceEPBase {
return outInfo;
}
/**
* 查询
*
* @param inInfo
* @return
*/
public EiInfo query(EiInfo inInfo) {
// 非管理员仅查询所属企业用户组 added by songx at 2024-01-15
if (!LoginUserDetails.isUserAdmin(UserSessionUtils.getLoginName())) {
inInfo.set("inqu_status-0-accountCode", UserSessionUtils.getAccountCode());
}
EiInfo outInfo = super.query(inInfo, "XS02.query", new XS02());
return outInfo;
return super.query(inInfo, "XS02.query", new XS02());
}
public EiInfo update(EiInfo inInfo) {
......
......@@ -271,6 +271,8 @@ public class ServiceXSOrgManage extends ServiceEPBase {
insertMap.put("accountCode", inInfoRowMap.get("accountCode"));
insertMap.put("factoryCode", inInfoRowMap.get("factoryCode"));
insertMap.put("factoryName", inInfoRowMap.get("factoryName"));
insertMap.put("companyCode", inInfoRowMap.get("companyCode"));
insertMap.put("companyName", inInfoRowMap.get("companyName"));
if (insertFlag) {
this.dao.insert("XSOG01.insert", insertMap);
} else {
......
......@@ -44,7 +44,6 @@
<div id="splitter" class="i-fit-height">
<div id="left-pane" class="i-fit-height">
<div class="col-md-12" style="padding-left: 0;padding-right: 8px">
<%-- <EF:EFRegion id="inqu" title="用户查询" type="query" efRegionShowClear="true" efRegionSave="true">--%>
<EF:EFRegion id="resultRegion" title="用户信息" fitHeight="true">
<div class="row" id="inquRegion">
<EF:EFInput ename="inqu_status-0-loginName" cname="登录账号" placeholder="请输入登录账号" colWidth="6"/>
......@@ -54,29 +53,23 @@
<hr>
<EF:EFGrid blockId="result" autoDraw="no" personal="true">
<EF:EFColumn ename="loginName" cname="登录账号" readonly="true" style="text-align:left;"/>
<EF:EFColumn ename="userName" cname="用户姓名" style="text-align:left;"/>
<EF:EFColumn ename="accountCode" cname="企业编码" readonly="true" style="text-align:left;"/>
<EF:EFComboColumn ename="isManager" cname="是否管理员" valueField="valueField" textField="textField"
columnTemplate="#=textField#" align="center">
<EF:EFCodeOption codeName="hggp.common.yesNo"/>
</EF:EFComboColumn>
<EF:EFComboColumn ename="gender" cname="性别" valueField="valueField" textField="textField"
<EF:EFColumn ename="userName" cname="用户姓名" style="text-align:left;"/>
<EF:EFComboColumn ename="gender" cname="性别" valueField="valueField" textField="textField"
columnTemplate="#=textField#" align="center">
<EF:EFCodeOption codeName="xservices.xs.sex"/>
</EF:EFComboColumn>
<EF:EFColumn ename="mobile" style="text-align:right;" cname="手机" data-rules="mobile_phone"/>
<EF:EFColumn ename="email" cname="邮箱" data-rules="email" style="text-align:left;"/>
<EF:EFColumn ename="userId" cname="用户ID" readonly="false" primaryKey="true" hidden="true"/>
<EF:EFColumn ename="password" cname="用户密码" hidden="true"/>
<EF:EFComboColumn ename="status" cname="状态" style="text-align:center;" hidden="true">
<EF:EFCodeOption codeName="xservices.xs.userStatus" textField="label" valueField="value"/>
</EF:EFComboColumn>
<EF:EFComboColumn ename="isLocked" cname="是否锁定" style="text-align:center;" hidden="true">
<EF:EFCodeOption codeName="xservices.xs.userIsLocked" textField="label" valueField="value"/>
</EF:EFComboColumn>
<EF:EFComboColumn ename="status" cname="用户状态" style="text-align:center;" hidden="true">
<EF:EFColumn ename="password" cname="用户密码" hidden="true"/>
<EF:EFComboColumn ename="isLocked" cname="是否锁定" align="center">
<EF:EFCodeOption codeName="xservices.xs.userIsLocked" textField="label" valueField="value"/>
</EF:EFComboColumn>
<EF:EFComboColumn ename="isManager" cname="是否管理员" enable="false" align="center">
<EF:EFCodeOption codeName="hggp.common.yesNo"/>
</EF:EFComboColumn>
<EF:EFColumn ename="accountCode" cname="企业编码" readonly="true" style="text-align:left;"/>
<EF:EFComboColumn ename="status" cname="用户状态" style="text-align:center;" hidden="true">
<EF:EFCodeOption codeName="xservices.xs.userStatus" textField="label" valueField="value"/>
</EF:EFComboColumn>
<EF:EFComboColumn ename="userType" cname="用户类别" style="text-align:center;" hidden="true">
......
let deptCodeGlobalData = [];
$(function () {
setTimeout(() => {
......@@ -28,6 +30,22 @@ $(function () {
toolbarConfig: {
hidden: false
},
loadComplete: function (grid) {
grid.dataSource.bind("change", function (e) {
if (e.field == "deptCode") {
var item = e.items[0];
for (let k = 0; k < resultGrid.getCheckedRowsIndex() + 1; k++) {
for (let i = 0; i < deptCodeGlobalData.length; i++) {
if (deptCodeGlobalData[i]['textField'] === item.deptCode) {
resultGrid.setCellValue(item, 'factoryCode', deptCodeGlobalData[i]['param1Field']);
resultGrid.setCellValue(item, 'companyCode', deptCodeGlobalData[i]['param2Field']);
break;
}
}
}
}
});
}
},
"resultB": {
pageable: {
......@@ -209,6 +227,30 @@ $(function () {
});
/**
* 页面加载时执行
*/
$(window).load(function () {
// 部门
initDept();
});
/**
* 初始化部门
*/
let initDept = function () {
let inInfo = new EiInfo();
inInfo.set("inqu_status-0-orgType", 'dept');
EiCommunicator.send("HGXSOrg", "queryDeptComboBox", inInfo, {
onSuccess: function (ei) {
deptCodeGlobalData = ei.getBlock("dept_code_block_id").getMappedRows();
},
onFail: function (ei) {
}
}, {async: false});
}
function refreshQuery() {
resultGrid.dataSource.page(1);
}
......@@ -267,4 +309,4 @@ window.onload = ()=>{
}
resetGridHeight()
}
\ No newline at end of file
}
......@@ -10,8 +10,6 @@
<div id="left-pane" class="i-fit-height">
<div class="col-md-12" style="padding-left: 0;padding-right: 8px">
<EF:EFRegion id="userGroupTable" title="角色信息" fitHeight="true">
<%-- <EF:EFRegion id="inqu" title="用户组查询" type="query" efRegionShowClear="true" efRegionSave="true"--%>
<%-- style="padding-left:0;padding-right:0">--%>
<div class="row" id="inquRegion">
<EF:EFInput ename="inqu_status-0-groupEname" cname="角色英文名" placeholder="请输入角色英文名"
colWidth="6"/>
......@@ -19,21 +17,24 @@
colWidth="6"/>
</div>
<hr>
<%-- </EF:EFRegion>--%>
<%-- <EF:EFRegion id="userGroupTable" title="用户组信息" fitHeight="true">--%>
<EF:EFGrid blockId="result" autoDraw="no" personal="true" autoBind="true">
<EF:EFColumn ename="groupId" cname="用户群组ID" readonly="false" hidden="true" primaryKey="true"/>
<EF:EFColumn ename="groupEname" cname="角色英文名" style="text-align:left;" readonly="true"
required="true" data-regex="/^[@_a-zA-Z0-9]{1,32}$/"
data-errorprompt="对不起,用户组英文名只能是32位英文字母或数字字符或下划线或@符"/>
<EF:EFColumn ename="groupCname" cname="角色中文名" required="true" style="text-align:left;"/>
<EF:EFColumn ename="manageGroupEname" cname="管辖组英文名" style="text-align:left;" hidden="true"/>
<EF:EFColumn ename="groupCname" cname="角色中文名" required="true" style="text-align:left;"/>
<EF:EFComboColumn ename="deptCode" required="true" cname="所属部门" width="110" align="center"
defaultValue="" filter="contains">
<EF:EFOptions blockId="dept_code_block_id" valueField="valueField" textField="textField"/>
</EF:EFComboColumn>
<EF:EFColumn ename="factoryCode" cname="所属厂区" width="150" align="center" required="true" readonly="true"/>
<EF:EFColumn ename="companyCode" cname="所属公司" width="150" align="center" required="true" readonly="true"/>
<EF:EFColumn ename="manageGroupEname" cname="管辖组英文名" style="text-align:left;" hidden="true"/>
<EF:EFColumn ename="manageGroupCname" cname="管辖组中文名" style="text-align:left;" readonly="true"
hidden="true"/>
<EF:EFComboColumn ename="groupType" cname="群组类型" valueField="valueField" textField="textField"
defaultValue="NORMAL" columnTemplate="#=textField#" align="center"
required="true"
hidden="true">
required="true" hidden="true">
<EF:EFCodeOption codeName="iplat.xs.userGroup"/>
</EF:EFComboColumn>
<EF:EFColumn ename="sortIndex" cname="排序" style="text-align:right;" hidden="true"/>
......
$(function () {
IPLATUI.EFGrid = {
"result": {
columns: [{
field: "orgId",
template: function (e) {
// 新增时,组织机构编码需要置空
if (e.isNew()) {
e["orgId"] = "";
}
return e['orgId'];
}
}],
onSave: function (e) {
// 阻止后台保存请求,使用自定义保存
e.preventDefault();
save();
}
}
};
$("#ef_form_head").hide();
// 查询
$("#QUERY").on("click", query);
});
/**
* 页面加载时执行
*/
$(window).load(function () {
// 初始化查询
query();
});
/**
* 查询
*/
var query = function (e) {
resultGrid.dataSource.page(1);
};
/**
* 选择库存
*/
let save = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据")
return;
}
for (let i = 0; i < rows.length; i++) {
let orgCname = rows[i]['orgCname'];
if (isBlank(orgCname)) {
message("组织机构名称不能为空");
return;
}
let orgType = rows[i]['orgType'];
if (isBlank(orgType)) {
message("组织类型不能为空");
return;
}
let establishDate = rows[i]['establishDate'];
if (isBlank(establishDate)) {
message("成立时间不能为空");
return;
}
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "XSOG0801A", "save", true, function (e) {
var status = e.getStatus();
if (status !== -1) {
let parentOrgId = $("#inqu_status-0-parentOrgId").val();
parent.JSColorbox.setValueCallback(parentOrgId);
}
});
}
});
}
<!DOCTYPE html>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<EF:EFPage title="新增组织机构">
<EF:EFRegion id="inqu" title="查询条件">
<div class="row">
<EF:EFInput cname="角色英文名" blockId="result" ename="groupEname" row="0" type="hidden"/>
<EF:EFInput cname="角色中文名" blockId="result" ename="groupCname" row="0" type="hidden"/>
<EF:EFInput cname="所属" blockId="inqu_status" ename="orgEname" row="0" type="hidden"/>
<EF:EFInput cname="组织名称" blockId="inqu_status" ename="orgCname" row="0"/>
<EF:EFSelect cname="组织类型" blockId="inqu_status" ename="orgType" row="0" optionLabel="全部">
<EF:EFOptions blockId="orgTypeBlock" textField="label" valueField="value"/>
</EF:EFSelect>
</div>
</EF:EFRegion>
</EF:EFPage>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment