Commit 449b5259 by 宋祥

1.调整页面

parent ba480d8d
......@@ -256,8 +256,10 @@ public class HPSqlConstant {
// 查询
public static final String QUERY = "HPPZ010.query";
// 查询
public static final String QUERY_TREE_NODE = "HPPZ010.queryTreeNode";
// 查询菜单树
public static final String QUERY_PAGE_TREE = "HPPZ010.queryPageTree";
// 查询组织树
public static final String QUERY_ORG_TREE = "HPPZ010.queryOrgTree";
// 查询用户数据权限
public static final String QUERY_USER_AUTH = "HPPZ010.queryUserAuth";
}
......
......@@ -15,7 +15,7 @@ import com.baosight.iplat4j.core.util.StringUtils;
* Copyrigth:Baosight Software LTD.co Copyright (c) 2019. <br>
*
* @version 1.0
* @history 2024-03-21 10:15:34 create
* @history 2024-03-27 18:22:41 create
*/
public class HPPZ010 extends DaoEPBase {
......@@ -32,8 +32,10 @@ public class HPPZ010 extends DaoEPBase {
public static final String FIELD_UPDATED_TIME = "updatedTime"; /* 更新时间*/
public static final String FIELD_PAGE_ENAME = "pageEname"; /* 页面英文名*/
public static final String FIELD_PAGE_CNAME = "pageCname"; /* 页面中文名*/
public static final String FIELD_CUSTOM_AUTH = "customAuth"; /* 自定义权限*/
public static final String FIELD_DEP_AUTH = "depAuth"; /* 部门权限*/
public static final String FIELD_AUTH_DEP_CODE = "authDepCode"; /* 权限部门编码*/
public static final String FIELD_AUTH_DEP_NAME = "authDepName"; /* 权限部门名称*/
public static final String FIELD_AUTH_TYPE = "authType"; /* 权限类型*/
public static final String FIELD_LINKAGE_FLAG = "linkageFlag"; /* 0-不联动,1-联动*/
public static final String COL_ID = "ID";
public static final String COL_COMPANY_CODE = "COMPANY_CODE"; /* 企业编码*/
......@@ -46,8 +48,10 @@ public class HPPZ010 extends DaoEPBase {
public static final String COL_UPDATED_TIME = "UPDATED_TIME"; /* 更新时间*/
public static final String COL_PAGE_ENAME = "PAGE_ENAME"; /* 页面英文名*/
public static final String COL_PAGE_CNAME = "PAGE_CNAME"; /* 页面中文名*/
public static final String COL_CUSTOM_AUTH = "CUSTOM_AUTH"; /* 自定义权限*/
public static final String COL_DEP_AUTH = "DEP_AUTH"; /* 部门权限*/
public static final String COL_AUTH_DEP_CODE = "AUTH_DEP_CODE"; /* 权限部门编码*/
public static final String COL_AUTH_DEP_NAME = "AUTH_DEP_NAME"; /* 权限部门名称*/
public static final String COL_AUTH_TYPE = "AUTH_TYPE"; /* 权限类型*/
public static final String COL_LINKAGE_FLAG = "LINKAGE_FLAG"; /* 0-不联动,1-联动*/
public static final String QUERY = "HPPZ010.query";
public static final String COUNT = "HPPZ010.count";
......@@ -55,7 +59,7 @@ public class HPPZ010 extends DaoEPBase {
public static final String UPDATE = "HPPZ010.update";
public static final String DELETE = "HPPZ010.delete";
private Long id;
private Long id = new Long(0);
private String companyCode = " "; /* 企业编码*/
private String depCode = " "; /* 部门编码*/
private String createdBy = " "; /* 创建人*/
......@@ -66,8 +70,10 @@ public class HPPZ010 extends DaoEPBase {
private String updatedTime = " "; /* 更新时间*/
private String pageEname = " "; /* 页面英文名*/
private String pageCname = " "; /* 页面中文名*/
private String customAuth = " "; /* 自定义权限*/
private String depAuth = " "; /* 部门权限*/
private String authDepCode = " "; /* 权限部门编码*/
private String authDepName = " "; /* 权限部门名称*/
private String authType = " "; /* 权限类型*/
private Integer linkageFlag; /* 0-不联动,1-联动*/
/**
* initialize the metadata.
......@@ -120,12 +126,20 @@ public class HPPZ010 extends DaoEPBase {
eiColumn.setDescName("页面中文名");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_CUSTOM_AUTH);
eiColumn.setDescName("自定义权限");
eiColumn = new EiColumn(FIELD_AUTH_DEP_CODE);
eiColumn.setDescName("权限部门编码");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_DEP_AUTH);
eiColumn.setDescName("部门权限");
eiColumn = new EiColumn(FIELD_AUTH_DEP_NAME);
eiColumn.setDescName("权限部门名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_AUTH_TYPE);
eiColumn.setDescName("权限类型");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_LINKAGE_FLAG);
eiColumn.setDescName("0-不联动,1-联动");
eiMetadata.addMeta(eiColumn);
......@@ -315,36 +329,68 @@ public class HPPZ010 extends DaoEPBase {
this.pageCname = pageCname;
}
/**
* get the customAuth - 自定义权限.
* @return the customAuth
* get the authDepCode - 权限部门编码.
* @return the authDepCode
*/
public String getAuthDepCode() {
return this.authDepCode;
}
/**
* set the authDepCode - 权限部门编码.
*
* @param authDepCode - 权限部门编码
*/
public void setAuthDepCode(String authDepCode) {
this.authDepCode = authDepCode;
}
/**
* get the authDepName - 权限部门名称.
* @return the authDepName
*/
public String getAuthDepName() {
return this.authDepName;
}
/**
* set the authDepName - 权限部门名称.
*
* @param authDepName - 权限部门名称
*/
public void setAuthDepName(String authDepName) {
this.authDepName = authDepName;
}
/**
* get the authType - 权限类型.
* @return the authType
*/
public String getCustomAuth() {
return this.customAuth;
public String getAuthType() {
return this.authType;
}
/**
* set the customAuth - 自定义权限.
* set the authType - 权限类型.
*
* @param customAuth - 自定义权限
* @param authType - 权限类型
*/
public void setCustomAuth(String customAuth) {
this.customAuth = customAuth;
public void setAuthType(String authType) {
this.authType = authType;
}
/**
* get the depAuth - 部门权限.
* @return the depAuth
* get the linkageFlag - 0-不联动,1-联动.
* @return the linkageFlag
*/
public String getDepAuth() {
return this.depAuth;
public Integer getLinkageFlag() {
return this.linkageFlag;
}
/**
* set the depAuth - 部门权限.
* set the linkageFlag - 0-不联动,1-联动.
*
* @param depAuth - 部门权限
* @param linkageFlag - 0-不联动,1-联动
*/
public void setDepAuth(String depAuth) {
this.depAuth = depAuth;
public void setLinkageFlag(Integer linkageFlag) {
this.linkageFlag = linkageFlag;
}
/**
* get the value from Map.
......@@ -365,8 +411,10 @@ public class HPPZ010 extends DaoEPBase {
setUpdatedTime(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UPDATED_TIME)), updatedTime));
setPageEname(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PAGE_ENAME)), pageEname));
setPageCname(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PAGE_CNAME)), pageCname));
setCustomAuth(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CUSTOM_AUTH)), customAuth));
setDepAuth(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_DEP_AUTH)), depAuth));
setAuthDepCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_AUTH_DEP_CODE)), authDepCode));
setAuthDepName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_AUTH_DEP_NAME)), authDepName));
setAuthType(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_AUTH_TYPE)), authType));
setLinkageFlag(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_LINKAGE_FLAG)), linkageFlag));
}
/**
......@@ -387,8 +435,10 @@ public class HPPZ010 extends DaoEPBase {
map.put(FIELD_UPDATED_TIME, StringUtils.toString(updatedTime, eiMetadata.getMeta(FIELD_UPDATED_TIME)));
map.put(FIELD_PAGE_ENAME, StringUtils.toString(pageEname, eiMetadata.getMeta(FIELD_PAGE_ENAME)));
map.put(FIELD_PAGE_CNAME, StringUtils.toString(pageCname, eiMetadata.getMeta(FIELD_PAGE_CNAME)));
map.put(FIELD_CUSTOM_AUTH, StringUtils.toString(customAuth, eiMetadata.getMeta(FIELD_CUSTOM_AUTH)));
map.put(FIELD_DEP_AUTH, StringUtils.toString(depAuth, eiMetadata.getMeta(FIELD_DEP_AUTH)));
map.put(FIELD_AUTH_DEP_CODE, StringUtils.toString(authDepCode, eiMetadata.getMeta(FIELD_AUTH_DEP_CODE)));
map.put(FIELD_AUTH_DEP_NAME, StringUtils.toString(authDepName, eiMetadata.getMeta(FIELD_AUTH_DEP_NAME)));
map.put(FIELD_AUTH_TYPE, StringUtils.toString(authType, eiMetadata.getMeta(FIELD_AUTH_TYPE)));
map.put(FIELD_LINKAGE_FLAG, StringUtils.toString(linkageFlag, eiMetadata.getMeta(FIELD_LINKAGE_FLAG)));
return map;
}
......
......@@ -32,7 +32,10 @@ public class HPPZ010A extends DaoEPBase {
public static final String FIELD_ORG_CNAME = "orgCname"; /* 组织机构名称*/
public static final String FIELD_PAGE_ENAME = "pageEname"; /* 页面英文名*/
public static final String FIELD_PAGE_CNAME = "pageCname"; /* 页面中文名*/
public static final String FIELD_CUSTOM_AUTH = "customAuth"; /* 自定义权限*/
public static final String FIELD_AUTH_DEP_CODE = "authDepCode"; /* 权限部门编码*/
public static final String FIELD_AUTH_DEP_NAME = "authDepName"; /* 权限部门名称*/
public static final String FIELD_AUTH_TYPE = "authType"; /* 权限类型*/
public static final String FIELD_LINKAGE_FLAG = "linkageFlag"; /* 0-不联动,1-联动*/
private String companyCode = " "; /* 企业编码*/
private String userId = " "; /* 用户ID*/
......@@ -44,7 +47,10 @@ public class HPPZ010A extends DaoEPBase {
private String orgCname = " "; /* 组织机构名称*/
private String pageEname = " "; /* 页面英文名*/
private String pageCname = " "; /* 页面中文名*/
private String customAuth = " "; /* 自定义权限*/
private String authDepCode = " "; /* 权限部门编码*/
private String authDepName = " "; /* 权限部门名称*/
private String authType = " "; /* 权限类型*/
private Integer linkageFlag; /* 0-不联动,1-联动*/
/**
* initialize the metadata.
......@@ -92,10 +98,21 @@ public class HPPZ010A extends DaoEPBase {
eiColumn.setDescName("页面中文名");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_CUSTOM_AUTH);
eiColumn.setDescName("自定义权限");
eiColumn = new EiColumn(FIELD_AUTH_DEP_CODE);
eiColumn.setDescName("权限部门编码");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_AUTH_DEP_NAME);
eiColumn.setDescName("权限部门名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_AUTH_TYPE);
eiColumn.setDescName("权限类型");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_LINKAGE_FLAG);
eiColumn.setDescName("0-不联动,1-联动");
eiMetadata.addMeta(eiColumn);
}
/**
......@@ -185,12 +202,36 @@ public class HPPZ010A extends DaoEPBase {
this.pageCname = pageCname;
}
public String getCustomAuth() {
return customAuth;
public String getAuthDepCode() {
return authDepCode;
}
public void setAuthDepCode(String authDepCode) {
this.authDepCode = authDepCode;
}
public String getAuthDepName() {
return authDepName;
}
public void setAuthDepName(String authDepName) {
this.authDepName = authDepName;
}
public String getAuthType() {
return authType;
}
public void setAuthType(String authType) {
this.authType = authType;
}
public Integer getLinkageFlag() {
return linkageFlag;
}
public void setCustomAuth(String customAuth) {
this.customAuth = customAuth;
public void setLinkageFlag(Integer linkageFlag) {
this.linkageFlag = linkageFlag;
}
/**
......@@ -211,7 +252,10 @@ public class HPPZ010A extends DaoEPBase {
setOrgCname(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ORG_CNAME)), orgCname));
setPageEname(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PAGE_ENAME)), pageEname));
setPageCname(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PAGE_CNAME)), pageCname));
setCustomAuth(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CUSTOM_AUTH)), customAuth));
setAuthDepCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_AUTH_DEP_CODE)), authDepCode));
setAuthDepName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_AUTH_DEP_NAME)), authDepName));
setAuthType(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_AUTH_TYPE)), authType));
setLinkageFlag(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_LINKAGE_FLAG)), linkageFlag));
}
/**
......@@ -231,7 +275,10 @@ public class HPPZ010A extends DaoEPBase {
map.put(FIELD_ORG_CNAME, StringUtils.toString(orgCname, eiMetadata.getMeta(FIELD_ORG_CNAME)));
map.put(FIELD_PAGE_ENAME, StringUtils.toString(pageEname, eiMetadata.getMeta(FIELD_PAGE_ENAME)));
map.put(FIELD_PAGE_CNAME, StringUtils.toString(pageCname, eiMetadata.getMeta(FIELD_PAGE_CNAME)));
map.put(FIELD_CUSTOM_AUTH, StringUtils.toString(customAuth, eiMetadata.getMeta(FIELD_CUSTOM_AUTH)));
map.put(FIELD_AUTH_DEP_CODE, StringUtils.toString(authDepCode, eiMetadata.getMeta(FIELD_AUTH_DEP_CODE)));
map.put(FIELD_AUTH_DEP_NAME, StringUtils.toString(authDepName, eiMetadata.getMeta(FIELD_AUTH_DEP_NAME)));
map.put(FIELD_AUTH_TYPE, StringUtils.toString(authType, eiMetadata.getMeta(FIELD_AUTH_TYPE)));
map.put(FIELD_LINKAGE_FLAG, StringUtils.toString(linkageFlag, eiMetadata.getMeta(FIELD_LINKAGE_FLAG)));
return map;
}
......
......@@ -6,7 +6,6 @@ import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.hpjx.hp.constant.HPSqlConstant;
import com.baosight.hpjx.hp.pz.domain.HPPZ010;
import com.baosight.hpjx.hp.pz.domain.HPPZ010A;
import com.baosight.hpjx.hp.pz.tools.HPPZTools;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.EiInfoUtils;
......@@ -73,7 +72,7 @@ public class ServiceHPPZ010 extends ServiceBase {
* @param inInfo
* @return
*/
public EiInfo queryTreeNode(EiInfo inInfo) {
public EiInfo queryPageTree(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
String node = MapUtils.getString(queryMap, "node");
......@@ -85,7 +84,28 @@ public class ServiceHPPZ010 extends ServiceBase {
// 管理员查所有
params.put("isUserAdmin", LoginUserDetails.isUserAdmin(loginName) ? CommonConstant.YesNo.YES
: CommonConstant.YesNo.NO);
List results = dao.query(HPSqlConstant.HpPz010.QUERY_TREE_NODE, params);
List results = dao.query(HPSqlConstant.HpPz010.QUERY_PAGE_TREE, params);
inInfo.addBlock(node).addRows(results);
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "查询失败");
}
return inInfo;
}
/**
* 查询树节点
*
* @param inInfo
* @return
*/
public EiInfo queryOrgTree(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
String node = MapUtils.getString(queryMap, "node");
String parentNode = StringUtils.isEmpty(node) || "$".equals(node) ? "root" : node;
Map params = new HashMap();
params.put("node", parentNode);
List results = dao.query(HPSqlConstant.HpPz010.QUERY_ORG_TREE, params);
inInfo.addBlock(node).addRows(results);
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "查询失败");
......@@ -150,7 +170,7 @@ public class ServiceHPPZ010 extends ServiceBase {
HPPZ010 fPz010 = new HPPZ010();
fPz010.fromMap(resultRow);
AssertUtils.isEmpty(fPz010.getPageEname(), "请选择菜单");
AssertUtils.isEmpty(fPz010.getDepAuth(), "请选择部门");
AssertUtils.isEmpty(fPz010.getAuthDepCode(), "请选择部门");
}
}
......@@ -164,12 +184,11 @@ public class ServiceHPPZ010 extends ServiceBase {
HPPZ010 fPz010 = new HPPZ010();
fPz010.fromMap(resultRow);
// 当前企业是否已经设置过权限
HPPZ010 dbPz010 = HPPZTools.HpPz010.getByPage(fPz010.getPageEname(), fPz010.getDepAuth());
HPPZ010 dbPz010 = HPPZTools.HpPz010.getByPage(fPz010.getPageEname(), fPz010.getAuthDepCode());
if (dbPz010 == null) {
DaoUtils.insert(HPPZ010.INSERT, fPz010);
} else {
dbPz010.setCustomAuth(fPz010.getCustomAuth());
dbPz010.setDepAuth(fPz010.getDepAuth());
dbPz010.setAuthType(fPz010.getAuthType());
DaoUtils.update(HPPZ010.UPDATE, dbPz010);
}
}
......
......@@ -14,8 +14,10 @@
UPDATED_TIME as "updatedTime", <!-- 更新时间 -->
PAGE_ENAME as "pageEname", <!-- 页面英文名 -->
PAGE_CNAME as "pageCname", <!-- 页面中文名 -->
CUSTOM_AUTH as "customAuth", <!-- 自定义权限 -->
DEP_AUTH as "depAuth" <!-- 部门权限 -->
AUTH_DEP_CODE as "authDepCode", <!-- 权限部门编码 -->
AUTH_DEP_NAME as "authDepName", <!-- 权限部门名称 -->
AUTH_TYPE as "authType", <!-- 权限类型 -->
LINKAGE_FLAG as "linkageFlag" <!-- 0-不联动,1-联动 -->
</sql>
<sql id="condition">
......@@ -34,14 +36,20 @@
<isNotEmpty prepend=" AND " property="pageCname">
PAGE_CNAME = #pageCname#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depAuth">
DEP_AUTH = #depAuth#
<isNotEmpty prepend=" AND " property="authDepCode">
AUTH_DEP_CODE = #authDepCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="authDepName">
AUTH_DEP_NAME = #authDepName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="authType">
AUTH_TYPE = #authType#
</isNotEmpty>
</sql>
<sql id="customCondition">
<isNotEmpty prepend=" AND " property="depAuths">
DEP_AUTH IN <iterate close=")" open="(" conjunction="," property="depAuths">#depAuths[]#</iterate>
<isNotEmpty prepend=" AND " property="authDepCodes">
AUTH_DEP_CODE IN <iterate close=")" open="(" conjunction="," property="authDepCodes">#authDepCodes[]#</iterate>
</isNotEmpty>
</sql>
......@@ -79,7 +87,7 @@
</select>
<!-- 查询树节点 -->
<select id="queryTreeNode" resultClass="java.util.HashMap">
<select id="queryPageTree" resultClass="java.util.HashMap">
SELECT
TREE_ENAME AS "parent",
NODE_ENAME AS "label",
......@@ -118,6 +126,24 @@
ORDER BY NODE_SORT_ID ASC
</select>
<!-- 组织机构子节点树查询 -->
<select id="queryOrgTree" resultClass="java.util.HashMap">
SELECT
ORG_ID as "label",
ORG_CNAME as "text",
ORG_NODE_TYPE as "leaf",
ORG_TYPE as "type",
PARENT_ORG_ID as "parentOrgId"
FROM ${platSchema}.TXSOG01
WHERE 1=1
AND IS_DELETED = '0'
AND COMPANY_CODE = #companyCode#
<isNotEmpty prepend=" AND " property="node">
PARENT_ORG_ID = #node#
</isNotEmpty>
ORDER BY SORT_INDEX ASC
</select>
<!-- 查询用户数据权限 -->
<select id="queryUserAuth" resultClass="com.baosight.hpjx.hp.pz.domain.HPPZ010A">
SELECT
......@@ -130,7 +156,7 @@
C.ORG_CNAME AS "orgCname",
D.PAGE_ENAME AS "pageEname",
D.PAGE_CNAME AS "pageCname",
D.CUSTOM_AUTH AS "customAuth"
D.AUTH_TYPE AS "authType"
FROM ${platSchema}.XS_USER A
LEFT JOIN ${platSchema}.TXSOG02 B ON A.USER_ID = B.USER_ID
LEFT JOIN ${platSchema}.TXSOG01 C ON B.ORG_ID = C.ORG_ID
......@@ -164,11 +190,14 @@
CREATED_TIME, <!-- 创建时间 -->
PAGE_ENAME, <!-- 页面英文名 -->
PAGE_CNAME, <!-- 页面中文名 -->
CUSTOM_AUTH, <!-- 自定义权限 -->
DEP_AUTH <!-- 部门权限 -->
AUTH_DEP_CODE, <!-- 权限部门编码 -->
AUTH_DEP_NAME, <!-- 权限部门名称 -->
AUTH_TYPE, <!-- 权限类型 -->
LINKAGE_FLAG <!-- 0-不联动,1-联动 -->
) VALUES (
#companyCode#, #depCode#, #createdBy#, #createdName#, #createdTime#,
#pageEname#, #pageCname#, #customAuth#, #depAuth#
#companyCode#, #depCode#, #createdBy#, #createdName#, #createdTime#,
#pageEname#, #pageCname#, #authDepCode#, #authDepName#, #authType#,
#linkageFlag#
)
</insert>
......@@ -177,9 +206,9 @@
</delete>
<update id="update">
UPDATE ${hpjxSchema}.T_HPPZ010
SET CUSTOM_AUTH = #customAuth#, <!-- 权限类型 -->
DEP_AUTH = #depAuth#, <!-- 部门权限 -->
UPDATE ${hpjxSchema}.T_HPPZ010
SET AUTH_TYPE = #authType#, <!-- 权限类型 -->
LINKAGE_FLAG = #linkageFlag#, <!-- 0-不联动,1-联动 -->
<include refid="updateRevise"/>
WHERE ID = #id#
</update>
......
......@@ -558,12 +558,12 @@ public class HPPZTools {
* 查询菜单权限
*
* @param pageEname
* @param depAuth
* @param depCode
* @return
*/
public static HPPZ010 getByPage(String pageEname, String depAuth) {
public static HPPZ010 getByPage(String pageEname, String depCode) {
AssertUtils.isEmpty(pageEname, "页面号不能为空");
AssertUtils.isEmpty(depAuth, "部门不能为空");
AssertUtils.isEmpty(depCode, "部门不能为空");
String companyCode = UserSessionUtils.getCompanyCode();
if (StringUtils.isBlank(companyCode)) {
return null;
......@@ -571,7 +571,7 @@ public class HPPZTools {
Map queryMap = new HashMap();
queryMap.put(HPPZ010.FIELD_COMPANY_CODE, companyCode);
queryMap.put(HPPZ010.FIELD_PAGE_ENAME, pageEname);
queryMap.put(HPPZ010.FIELD_DEP_AUTH, depAuth);
queryMap.put(HPPZ010.FIELD_AUTH_DEP_CODE, depCode);
List<HPPZ010> results = DaoBase.getInstance().query(HPPZ010.QUERY, queryMap);
return CollectionUtils.isEmpty(results) ? null : results.get(0);
}
......@@ -592,7 +592,7 @@ public class HPPZTools {
Map queryMap = new HashMap();
queryMap.put(HPPZ010.FIELD_COMPANY_CODE, companyCode);
queryMap.put(HPPZ010.FIELD_PAGE_ENAME, pageEname);
queryMap.put("depAuths", depCodes);
queryMap.put("authDepCodes", depCodes);
return DaoBase.getInstance().query(HPPZ010.QUERY, queryMap);
}
......
......@@ -255,20 +255,20 @@ public class SqlMapDaoLogProxy extends SqlMapDao {
* @param dbPz010
*/
private List<String> buildDepCondition(HPPZ010 dbPz010) {
String customAuth = dbPz010.getCustomAuth();
if (StringUtils.isBlank(customAuth) || AuthTypeEnum.NO_AUTH.getCode().equals(customAuth)) {
String authType = dbPz010.getAuthType();
if (StringUtils.isBlank(authType) || AuthTypeEnum.NO_AUTH.getCode().equals(authType)) {
return Arrays.asList(AuthTypeEnum.NO_AUTH.getCode());
}
String depAuth = dbPz010.getDepAuth();
String authDepCode = dbPz010.getAuthDepCode();
// 看全部
if (AuthTypeEnum.ONLY_COMPANY.getCode().equals(customAuth)) {
if (AuthTypeEnum.ONLY_COMPANY.getCode().equals(authType)) {
return Arrays.asList(AuthTypeEnum.ALL.getCode());
} else if (AuthTypeEnum.ONLY_FACTORY.getCode().equals(customAuth)) {
} else if (AuthTypeEnum.ONLY_FACTORY.getCode().equals(authType)) {
// 查询当前部门所在的厂及子集
Org factoryOrg = HPXSTools.XsOrg.queryFactory(depAuth);
Org factoryOrg = HPXSTools.XsOrg.queryFactory(authDepCode);
return HPXSTools.XsOrg.queryChildren(factoryOrg.getOrgId());
} else if (AuthTypeEnum.ONLY_DEPT.getCode().equals(customAuth)) {
return HPXSTools.XsOrg.queryChildren(depAuth);
} else if (AuthTypeEnum.ONLY_DEPT.getCode().equals(authType)) {
return HPXSTools.XsOrg.queryChildren(authDepCode);
} else {
return Arrays.asList(AuthTypeEnum.NO_AUTH.getCode());
}
......
......@@ -4,9 +4,20 @@ $(function () {
"pageTree": {
// ROOT: {label: "root", text: "系统菜单", leaf: true}
select: function (e) {
treeNodeSelect(this.dataItem(e.node));
pageTreeSelect(this.dataItem(e.node));
},
selectTreeNode: {}
selectTreeNode: {
leaf: false
}
},
"orgTree": {
// ROOT: {label: "root", text: "系统菜单", leaf: true}
select: function (e) {
orgTreeSelect(this.dataItem(e.node));
},
selectTreeNode: {
leaf: false
}
}
};
......@@ -19,13 +30,9 @@ $(function () {
*/
$(window).load(function () {
// 禁用Input
disableInput(true);
// 全选框绑定事件
allInputEvent();
// 子项绑定事件
customAuthInputEvent();
// 部门绑定事件
depAuthInputEvent()
disableInput();
// 权限类型绑定事件
authTypeInputEvent();
});
/**
......@@ -33,17 +40,8 @@ $(window).load(function () {
*
* @returns {*|jQuery|HTMLElement}
*/
let listCustomInput = function () {
return $("input:radio[name='result-0-customAuth']");
}
/**
* Input集合
*
* @returns {*|jQuery|HTMLElement}
*/
let listDepInput = function () {
return $("input:radio[name='result-0-depAuth']");
let listAuthTypeInput = function () {
return $("input:radio[name='result-0-authType']");
}
/**
......@@ -52,12 +50,8 @@ let listDepInput = function () {
* @param bool
*/
let clearCheckedInput = function () {
// 全选
// $("input:checkbox[name='result-0-authAll']").prop('checked', 'false');
// 权限子项
checkedCustomInput(false);
// 部门子项
checkedDepInput(false);
checkedAuthTypeInput(false);
}
/**
......@@ -65,53 +59,32 @@ let clearCheckedInput = function () {
*
* @param bool
*/
let checkedCustomInput = function (bool) {
listCustomInput().prop('checked', bool);
}
/**
* 选中或取消Input,部门子项
*
* @param bool
*/
let checkedDepInput = function (bool) {
listDepInput().prop('checked', bool);
let checkedAuthTypeInput = function (bool) {
listAuthTypeInput().prop('checked', bool);
}
/**
* 禁用或启用Input
*/
let disableInput = function (bool) {
// 全选
// $("input:checkbox[name='result-0-authAll']").attr('readonly', bool);
let disableInput = function () {
let bool = false;
let orgNode = IPLATUI.EFTree.orgTree.selectTreeNode.label;
let pageNode = IPLATUI.EFTree.pageTree.selectTreeNode.label;
let pageLeaf = IPLATUI.EFTree.pageTree.selectTreeNode.leaf;
if (isBlank(orgNode) || isBlank(pageNode) || pageLeaf) {
bool = true;
}
// 数据权限
listCustomInput().each(function () {
$(this).attr('readonly', bool);
});
// 部门权限
listDepInput().each(function () {
listAuthTypeInput().each(function () {
$(this).attr('readonly', bool);
});
}
/**
* 全选框绑定事件
*/
let allInputEvent = function () {
$("input:checkbox[name='result-0-authAll']").on("change", function () {
if ($(this).prop('readonly')) {
$(this).attr('checked', false);
return;
}
listDepInput().prop('checked', this.checked);
});
}
/**
* 数据权限绑定事件
*/
let customAuthInputEvent = function () {
$("input:radio[name='result-0-customAuth']").on("change", function () {
let authTypeInputEvent = function () {
$("input:radio[name='result-0-authType']").on("change", function () {
if ($(this).prop('readonly')) {
$(this).prop('checked', '');
return;
......@@ -120,61 +93,38 @@ let customAuthInputEvent = function () {
}
/**
* 组织部门绑定事件
* 菜单树节点选中
*
* @param e
*/
let depAuthInputEvent = function () {
$("input:radio[name='result-0-depAuth']").on("change", function () {
if ($(this).prop('readonly')) {
$(this).prop('checked', '');
return;
}
// 判断全选框是选中还是不选中
// setAllInput();
// 加载部门权限
let pageTreeSelect = function (nodeData) {
// 设置选择的节点
setSelectPageTreeNode(nodeData);
// 清空选项
clearCheckedInput();
// 启用Input/禁用Input
disableInput();
// 叶子节点渲染权限
if (!nodeData.leaf) {
showAuthInput();
});
}
/**
* 设置全选框选中或取消
*/
let setAllInput = function (){
// 判断全选框是选中还是不选中
let allCheckBool = true;
// listCustomInput().each(function () {
// if ($(this).prop('checked') == false) {
// allCheckBool = false;
// }
// })
listDepInput().each(function () {
if ($(this).prop('checked') == false) {
allCheckBool = false;
}
})
// 全选
// $("input:checkbox[name='result-0-authAll']").prop('checked', allCheckBool);
}
}
/**
* 树节点选中
* 组织树节点选中
*
* @param e
*/
let treeNodeSelect = function (nodeData) {
let orgTreeSelect = function (nodeData) {
// 设置选择的节点
setSelectTreeNode(nodeData);
setSelectOrgTreeNode(nodeData);
// 非叶子节点清空显示
if (nodeData.leaf) {
// 禁用Input
disableInput(true);
// 清空选项
clearCheckedInput();
} else {
// 启用Input
disableInput(false);
// 渲染权限
showAuthInput();
}
let pageLeaf = IPLATUI.EFTree.pageTree.selectTreeNode.leaf;
disableInput(pageLeaf);
// 清空选项
clearCheckedInput();
// 渲染权限
showAuthInput();
}
/**
......@@ -182,27 +132,38 @@ let treeNodeSelect = function (nodeData) {
*
* @param nodeData
*/
let setSelectTreeNode = function (nodeData) {
let setSelectPageTreeNode = function (nodeData) {
IPLATUI.EFTree.pageTree.selectTreeNode.label = nodeData.label;
IPLATUI.EFTree.pageTree.selectTreeNode.text = nodeData.text;
IPLATUI.EFTree.pageTree.selectTreeNode.leaf = nodeData.leaf;
}
/**
* 设置选择的节点
*
* @param nodeData
*/
let setSelectOrgTreeNode = function (nodeData) {
IPLATUI.EFTree.orgTree.selectTreeNode.label = nodeData.label;
IPLATUI.EFTree.orgTree.selectTreeNode.text = nodeData.text;
IPLATUI.EFTree.orgTree.selectTreeNode.leaf = nodeData.leaf;
}
/**
* 显示权限选择框
*
* @param node
*/
let showAuthInput = function () {
let depAuth = $("input:radio[name='result-0-depAuth']:checked").val();
let node = IPLATUI.EFTree.pageTree.selectTreeNode.label;
if(isBlank(depAuth) || isBlank(node)){
let depCode = IPLATUI.EFTree.orgTree.selectTreeNode.label;
let pageEname = IPLATUI.EFTree.pageTree.selectTreeNode.label;
if (isBlank(depCode) || isBlank(pageEname)) {
return;
}
// 渲染权限
let inInfo = new EiInfo();
inInfo.set("inqu_status-0-depAuth", depAuth);
inInfo.set("inqu_status-0-pageEname", node);
inInfo.set("inqu_status-0-pageEname", pageEname);
inInfo.set("inqu_status-0-authDepCode", depCode);
EiCommunicator.send("HPPZ010", "getByPage", inInfo, {
onSuccess: getByPageSuccess,
onFail: function (res) {
......@@ -218,7 +179,7 @@ let showAuthInput = function () {
*/
let getByPageSuccess = function (res) {
// 清空权限子项
checkedCustomInput(false);
checkedAuthTypeInput(false);
if (res.status < 0) {
message(res.msg);
return;
......@@ -227,19 +188,14 @@ let getByPageSuccess = function (res) {
if (resultRows.length == 0) {
return;
}
let customAuth = resultRows[0]['customAuth'];
if(!isBlank(customAuth)){
let customAuths = customAuth.split(',');
listCustomInput().each(function () {
for (let i = 0; i < customAuths.length; i++) {
if ($(this).val() == customAuths[i]) {
$(this).prop('checked', 'true');
}
let authType = resultRows[0]['authType'];
if (!isBlank(authType)) {
listAuthTypeInput().each(function () {
if ($(this).val() == authType) {
$(this).prop('checked', 'true');
}
})
}
// 判断全选框是选中还是不选中
// setAllInput();
}
/**
......@@ -247,41 +203,35 @@ let getByPageSuccess = function (res) {
*/
let save = function () {
// 检查是否选择的叶子节点
let selectTreeNode = IPLATUI.EFTree.pageTree.selectTreeNode;
if (selectTreeNode.leaf) {
message("【" + selectTreeNode.text + "】不是叶子节点,请选择菜单树叶子节点进行授权");
let pageNode = IPLATUI.EFTree.pageTree.selectTreeNode;
if (isBlank(pageNode.label)) {
message("请选择菜单");
return;
}
if (pageNode.leaf) {
message("【" + pageNode.text + "】不是叶子节点,请选择菜单树叶子节点进行授权");
return;
}
let orgNode = IPLATUI.EFTree.orgTree.selectTreeNode;
if (isBlank(orgNode.label)) {
message("请选择部门");
return;
}
JSUtils.confirm("确定对勾选中的数据做\"保存\"操作? ", {
ok: saveOk
ok: saveOk(pageNode, orgNode)
});
}
/**
* 保存确认
*/
let saveOk = function () {
let selectTreeNode = IPLATUI.EFTree.pageTree.selectTreeNode;
if (isBlank(selectTreeNode)) {
message("请选择菜单");
return;
}
let depAuth = $("input:radio[name='result-0-depAuth']:checked").val();
if (isBlank(depAuth)) {
message("请选择部门");
return;
}
let customAuth = '';
listCustomInput().each(function () {
if ($(this).prop('checked')) {
customAuth += ('' == customAuth ? $(this).val() : ',' + $(this).val());
}
})
let saveOk = function (pageNode, orgNode) {
let inInfo = new EiInfo();
inInfo.set("result-0-pageEname", selectTreeNode.label);
inInfo.set("result-0-pageCname", selectTreeNode.text);
inInfo.set("result-0-customAuth", customAuth);
inInfo.set("result-0-depAuth", depAuth);
inInfo.set("result-0-pageEname", pageNode.label);
inInfo.set("result-0-pageCname", pageNode.text);
inInfo.set("result-0-authDepCode", orgNode.label);
inInfo.set("result-0-authDepName", orgNode.text);
inInfo.set("result-0-authType", $("input:radio[name='result-0-authType']:checked").val());
EiCommunicator.send("HPPZ010", "save", inInfo, {
onSuccess: function (res) {
message(res.msg);
......
......@@ -20,53 +20,54 @@
<EF:EFPage>
<div class="row" style="margin: 0 -10px;">
<div class="col-md-3">
<div class="col-md-4">
<EF:EFRegion title="系统菜单树" id="tree" fitHeight="true">
<EF:EFTree bindId="pageTree" ename="node" textField="text" valueField="label" hasChildren="leaf"
serviceName="HPPZ010" methodName="queryTreeNode">
serviceName="HPPZ010" methodName="queryPageTree">
</EF:EFTree>
</EF:EFRegion>
</div>
<div class="col-md-9">
<EF:EFRegion title="组织机构" id="org">
<c:forEach items="${requestScope.orgMap}" var="entry">
<c:forEach items="${entry.value}" var="item" varStatus="i">
<c:if test="${item.orgType == 'factory'}">
<c:if test="${i.index == 0}">
<div class="row">
<div class="col-md-9">
</c:if>
<c:if test="${i.index != 0}">
</div>
</div>
<div class="row">
<div class="col-md-9">
</c:if>
</c:if>
<EF:EFInput cname="${item.orgCname}" blockId="result" ename="depAuth" row="0"
value="${item.orgId}" colWidth="3" type="radio" inline="true"/>
</c:forEach>
</div>
</div>
</c:forEach>
<div class="col-md-4">
<EF:EFRegion title="组织机构树" id="tree" fitHeight="true">
<EF:EFTree bindId="orgTree" ename="node" textField="text" valueField="label" hasChildren="leaf"
serviceName="HPPZ010" methodName="queryOrgTree">
</EF:EFTree>
</EF:EFRegion>
</div>
<div class="col-md-4">
<EF:EFRegion title="数据查看范围" id="result">
<div class="row">
<div class="col-md-9">
<EF:EFInput cname="不可查看" blockId="result" ename="customAuth" row="0" value="noAuth" colWidth="3"
type="radio" inline="true"/>
<EF:EFInput cname="本企业" blockId="result" ename="customAuth" row="0" value="onlyCompany"
<div class="col-md-12">
<EF:EFInput cname="父子联动" blockId="result" ename="authType" row="0" value="onlyCompany"
colWidth="3" type="checkBox" inline="true"/>
</div>
</div>
<div class="row">
<div class="col-md-12">
<EF:EFInput cname="本公司" blockId="result" ename="authType" row="0" value="onlyCompany"
colWidth="3" type="radio" inline="true"/>
<EF:EFInput cname="本厂" blockId="result" ename="customAuth" row="0" value="onlyFactory"
</div>
</div>
<div class="row">
<div class="col-md-9">
<EF:EFInput cname="本厂" blockId="result" ename="authType" row="0" value="onlyFactory"
colWidth="3" type="radio" inline="true"/>
<EF:EFInput cname="本部门" blockId="result" ename="customAuth" row="0" value="onlyDept"
</div>
</div>
<div class="row">
<div class="col-md-6">
<EF:EFInput cname="本部门" blockId="result" ename="authType" row="0" value="onlyDept"
colWidth="3" type="radio" inline="true"/>
</div>
</div>
</EF:EFRegion>
<EF:EFRegion title="提示" hidden="true">
<span style="color: red">1:仅叶子节点页面可设置数据权限。</span>
<div class="row">
<div class="col-md-6">
<EF:EFInput cname="不可查看" blockId="result" ename="authType" row="0" value="noAuth" colWidth="3"
type="radio" inline="true"/>
</div>
</div>
</EF:EFRegion>
</div>
</div>
......
......@@ -28,7 +28,7 @@
<EF:EFOptions blockId="org_record_block_id" valueField="valueField" textField="textField"/>
</EF:EFComboColumn>
<EF:EFColumn ename="orgCname" cname="组织机构名称" enable="false" width="140" align="center"/>
<EF:EFComboColumn ename="customAuth" cname="数据权限" enable="false" width="140" align="center">
<EF:EFComboColumn ename="authType" cname="数据权限" enable="false" width="140" align="center">
<EF:EFCodeOption codeName="hpjx.hppz.authType"/>
</EF:EFComboColumn>
</EF:EFGrid>
......
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