地址簙
创建一个地址簿控件,这是一个私有封装。用于显示和修改被表单数据源绑定的数据,自动通过平台各类权限配置控制其读、写、隐藏状态。
运行
PC端 |
移动端 |
配置字段属性
标题
参见单行标题
默认值
参见单行默认值
长度
参见单行长度
地址簿类型
地址簿分为人员、部门、单位、角色、岗位、群组等六种类型
分类维度 组织、岗位、角色、群组,必须至少勾选一个分类维度
显示兼任
默认不开启,开启后,结构将显示组织模型添加兼职信息时,是否显示属性为是的兼职人员。有关兼职的设置请参见 https://docs.awspaas.com/user-manual/aws-pass-console-user-manual-org-vue/organization/usermap.html 。 注: 兼职是否显示在6.3.1.0626 版本后提供一个总开关AWS Portal门户 应用参数地址薄显示兼职人员(addressDisplayMap) 详细见该参数说明
只有类型是人员时,显示该属性
分类维度 只有组织一个维度,默认勾选且禁选
分类维度 组织、岗位、角色,必须至少勾选一个分类维度
分类维度 组织、岗位、角色,必须至少勾选一个分类维度
分类维度 只有组织一个维度,默认勾选且禁选
允许多选
默认开启多选,允许选择多个值;不开启时,只允许选择一个值
- 分隔符
仅在开启允许多选
时可用,多值之间可用逗号
或空格
分隔
限制选人范围
根部门 输入根部门ID,多个用竖线分隔,支持@公式
部门层级 只显示部门层级范围内的部门,例如【从1到3】
- 群组 输入群组ID,多个用竖线分隔,支持@公式
只有类型是人员、部门时,显示该属性
限制单位范围
默认不开启,开启后显示选择限制单位范围
属性,如果不选择选项,默认显示自己所在实体单位及有权限访问的实体单位;如选择了,显示配置的并且有权限的单位(包括实体单位和虚拟单位)且必须选择自己所在的单位
只有类型是人员、部门时,显示该属性
自定义数据回显
默认不开启,不开启则默认回显至当前字段;开启后显示取值字段、回填字段这两属性
取值字段指定取值字段
回填字段指定回填字段,
取值字段
和回填字段
个数和次序必须匹配
高级
数据源接口 一个继承com.actionsoft.bpms.ui.dict.address.base.AddressUISourceDataAbs的类,由自定义的Java程序控制树形节点的内容
import com.actionsoft.bpms.server.UserContext; import com.actionsoft.bpms.ui.dict.address.base.AddressUISourceDataAbs; import com.actionsoft.bpms.util.UtilSerialize; import com.actionsoft.bpms.util.UtilString; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; public class DatasourceTest extends AddressUISourceDataAbs { /** * 获取地址簿树跟节点 * * @param appId 应用id * @param filter 地址簿配置 * @param context 用户上下文 * @return */ public JSONArray getOrgTreeData(String appId, JSONObject filter, UserContext context) { JSONArray treeData = new JSONArray(); String companyList = filter.getString("companyList"); String rootDetpId = filter.getString("rootDetpId"); int layerFrom = -1; int layerTo = 9999; String layerFromStr = filter.getString("layerFrom"); if (!UtilString.isEmpty(layerFromStr)) layerFrom = Integer.parseInt(layerFromStr); String layerToStr = filter.getString("layerTo"); if (!UtilString.isEmpty(layerToStr)) layerTo = Integer.parseInt(layerToStr); String sourceField = filter.getString("sourceField"); String leafType = filter.getString("leafType"); JSONObject company1 = new JSONObject(); company1.put("id", "comppany1"); company1.put("name", "公司1"); company1.put("iconCls", "company"); company1.put("iconFont", ""); company1.put("open", "true"); company1.put("nocheck", Boolean.valueOf(true)); company1.put("type", "company"); company1.put("COMPANYNAME", "公司1"); company1.put("COMPANYID", "comppany1"); company1.put("COMPANYNO", "0101"); treeData.add(company1); JSONObject dept1 = new JSONObject(); dept1.put("iconCls", "dept"); dept1.put("iconFont", ""); dept1.put("pid", "comppany1"); dept1.put("type", "dept"); if (leafType.equals("dept")) dept1.put("leaf", Boolean.valueOf(true)); dept1.put("open", Boolean.valueOf(false)); dept1.put("layer", "1"); dept1.put("size", "2"); dept1.put("sourceId", "dept1"); dept1.put("id", "dept1"); dept1.put("name", "部门1"); dept1.put("type", "dept"); dept1.put("fullPathName", "/"); String str1; String field; if (!UtilString.isEmpty(sourceField)) { JSONObject temp = new JSONObject(); temp.put("COMPANYNAME", ""); temp.put("COMPANYID", "company1"); temp.put("COMPANYNO", "0101"); temp.put("DEPTNAME", "部门1"); temp.put("DEPTID", "dept1"); temp.put("DEPTFULLPATHID", "dept1"); temp.put("DEPTFULLPATHNAME", "/"); temp.put("DEPTNO", ""); temp.put("DEPTZONE", ""); temp.put("DEPTTYPE", ""); temp.put("EXT1", ""); temp.put("EXT2", ""); temp.put("EXT3", ""); temp.put("EXT4", ""); temp.put("EXT5", ""); String[] sourceFields = sourceField.split(","); String[] arrayOfString1 = sourceFields; int i = arrayOfString1.length; for (str1 = 0; str1 < i; str1++) { field = arrayOfString1[str1]; dept1.put(field, temp.getString(field)); } } treeData.add(dept1); JSONObject dept2 = new JSONObject(); dept2.put("iconCls", "dept"); dept2.put("iconFont", ""); dept2.put("pid", "comppany1"); dept2.put("type", "dept"); if (leafType.equals("dept")) dept2.put("leaf", Boolean.valueOf(true)); dept2.put("open", Boolean.valueOf(false)); dept2.put("layer", "1"); dept2.put("size", "2"); dept2.put("sourceId", "dept2"); dept2.put("id", "dept2"); dept2.put("name", "部门2"); dept2.put("type", "dept"); dept2.put("fullPathName", "/"); if (!UtilString.isEmpty(sourceField)) { JSONObject temp = new JSONObject(); temp.put("COMPANYNAME", "公司1"); temp.put("COMPANYID", "company1"); temp.put("COMPANYNO", "0101"); temp.put("DEPTNAME", "部门2"); temp.put("DEPTID", "dept2"); temp.put("DEPTFULLPATHID", "dept2"); temp.put("DEPTFULLPATHNAME", "/"); temp.put("DEPTNO", "222"); temp.put("DEPTZONE", ""); temp.put("DEPTTYPE", ""); temp.put("EXT1", ""); temp.put("EXT2", ""); temp.put("EXT3", ""); temp.put("EXT4", ""); temp.put("EXT5", ""); String[] sourceFields = sourceField.split(","); String[] arrayOfString2 = sourceFields; str1 = arrayOfString2.length; for (field = 0; field < str1; field++) { String field = arrayOfString2[field]; dept2.put(field, temp.getString(field)); } } treeData.add(dept2); return treeData; } /** * 获取地址簿树子节点 移动端时从根目录开始pid=='' && pType == ''时是根目录 * * @param appId 应用id * @param filter 地址簿配置 * @param context 用户上下文 * @param pid 父节点id * @param pType 父节点类型 * @return */ public JSONArray getSubJsonData(String appId, JSONObject filter, UserContext context, String pid, String pType) { JSONArray treeData = new JSONArray(); String companyList = filter.getString("companyList"); String rootDetpId = filter.getString("rootDetpId"); int layerFrom = -1; int layerTo = 9999; String layerFromStr = filter.getString("layerFrom"); if (!UtilString.isEmpty(layerFromStr)) layerFrom = Integer.parseInt(layerFromStr); String layerToStr = filter.getString("layerTo"); if (!UtilString.isEmpty(layerToStr)) layerTo = Integer.parseInt(layerToStr); String sourceField = filter.getString("sourceField"); String leafType = filter.getString("leafType"); if (UtilString.isEmpty(pType)) { JSONObject company1 = new JSONObject(); company1.put("id", "comppany1"); company1.put("name", ""); company1.put("iconCls", "company"); company1.put("iconFont", ""); company1.put("open", "true"); company1.put("nocheck", Boolean.valueOf(true)); company1.put("type", "company"); company1.put("fullPathName", "/"); company1.put("COMPANYNAME", ""); company1.put("COMPANYID", "comppany1"); company1.put("COMPANYNO", "0101"); treeData.add(company1); } else { String[] sourceFields; if (pType.equals("company")) { JSONObject dept1 = new JSONObject(); dept1.put("iconCls", "dept"); dept1.put("iconFont", ""); dept1.put("pid", "comppany1"); dept1.put("type", "dept"); if (leafType.equals("dept")) dept1.put("leaf", Boolean.valueOf(true)); dept1.put("open", Boolean.valueOf(false)); dept1.put("layer", "1"); dept1.put("size", "2"); dept1.put("sourceId", "dept1"); dept1.put("id", "dept1"); dept1.put("name", "部门3"); dept1.put("type", "dept"); dept1.put("fullPathName", "/"); String str1; String field; if (!UtilString.isEmpty(sourceField)) { JSONObject temp = new JSONObject(); temp.put("COMPANYNAME", "公司1"); temp.put("COMPANYID", "company1"); temp.put("COMPANYNO", "0101"); temp.put("DEPTNAME", "部门3"); temp.put("DEPTID", "dept1"); temp.put("DEPTFULLPATHID", "dept1"); temp.put("DEPTFULLPATHNAME", "/"); temp.put("DEPTNO", ""); temp.put("DEPTZONE", ""); temp.put("DEPTTYPE", ""); temp.put("EXT1", ""); temp.put("EXT2", ""); temp.put("EXT3", ""); temp.put("EXT4", ""); temp.put("EXT5", ""); String[] sourceFields = sourceField.split(","); String[] arrayOfString1 = sourceFields; int i = arrayOfString1.length; for (str1 = 0; str1 < i; str1++) { field = arrayOfString1[str1]; dept1.put(field, temp.getString(field)); } } treeData.add(dept1); JSONObject dept2 = new JSONObject(); dept2.put("iconCls", "dept"); dept2.put("iconFont", ""); dept2.put("pid", "comppany1"); dept2.put("type", "dept"); if (leafType.equals("dept")) dept2.put("leaf", Boolean.valueOf(true)); dept2.put("open", Boolean.valueOf(false)); dept2.put("layer", "1"); dept2.put("size", "2"); dept2.put("sourceId", "dept2"); dept2.put("id", "dept2"); dept2.put("name", ""); dept2.put("type", "dept"); dept2.put("fullPathName", "/"); if (!UtilString.isEmpty(sourceField)) { JSONObject temp = new JSONObject(); temp.put("COMPANYNAME", ""); temp.put("COMPANYID", "company1"); temp.put("COMPANYNO", "0101"); temp.put("DEPTNAME", ""); temp.put("DEPTID", "dept2"); temp.put("DEPTFULLPATHID", "dept2"); temp.put("DEPTFULLPATHNAME", "/"); temp.put("DEPTNO", "222"); temp.put("DEPTZONE", ""); temp.put("DEPTTYPE", ""); temp.put("EXT1", ""); temp.put("EXT2", ""); temp.put("EXT3", ""); temp.put("EXT4", ""); temp.put("EXT5", ""); sourceFields = sourceField.split(","); String[] arrayOfString2 = sourceFields; str1 = arrayOfString2.length; for (field = 0; field < str1; field++) { String field = arrayOfString2[field]; dept2.put(field, temp.getString(field)); } } treeData.add(dept2); } else if ((pType.equals("dept")) && (pid .equals("dept1"))) { JSONObject dept3 = new JSONObject(); dept3.put("iconCls", "dept"); dept3.put("iconFont", ""); dept3.put("pid", "dept1"); dept3.put("type", "dept"); if (leafType.equals("dept")) dept3.put("leaf", Boolean.valueOf(true)); dept3.put("open", Boolean.valueOf(false)); dept3.put("layer", "1"); dept3.put("size", "2"); dept3.put("sourceId", "dept3"); dept3.put("id", "dept3"); dept3.put("name", "部门3"); dept3.put("type", "dept"); dept3.put("fullPathName", "/"); Object localObject1; String field; if (!UtilString.isEmpty(sourceField)) { JSONObject temp = new JSONObject(); temp.put("COMPANYNAME", ""); temp.put("COMPANYID", "company1"); temp.put("COMPANYNO", "0101"); temp.put("DEPTNAME", ""); temp.put("DEPTID", "dept3"); temp.put("DEPTFULLPATHID", "dept1/dept3"); temp.put("DEPTFULLPATHNAME", "/"); temp.put("DEPTNO", "222"); temp.put("DEPTZONE", ""); temp.put("DEPTTYPE", ""); temp.put("EXT1", ""); temp.put("EXT2", ""); temp.put("EXT3", ""); temp.put("EXT4", ""); temp.put("EXT5", ""); String[] sourceFields = sourceField.split(","); sourceFields = sourceFields; int j = sourceFields.length; for (localObject1 = 0; localObject1 < j; localObject1++) { field = sourceFields[localObject1]; dept3.put(field, temp.getString(field)); } } treeData.add(dept3); String[] sourceFields; if ("user".equals(leafType)) { JSONObject user1 = new JSONObject(); user1.put("pid", pid); user1.put("iconFont", UtilSerialize.parseObject("{'code':'','color':'#DA2912'}")); user1.put("iconFont", ""); user1.put("sourceName", ""); user1.put("type", "user"); user1.put("leaf", Boolean.valueOf(true)); user1.put("sourceId", "huahua"); user1.put("id", "huahua_" + pid); user1.put("name", "花花"); user1.put("type", "user"); user1.put("USERNAMEALIAS", ""); user1.put("deptId", "dept1"); user1.put("deptFullName", "/"); user1.put("deptName", ""); String field; if (!UtilString.isEmpty(sourceField)) { JSONObject temp = new JSONObject(); temp.put("COMPANYNAME", ""); temp.put("COMPANYID", "company1"); temp.put("COMPANYNO", "0101"); temp.put("EMAIL", ""); temp.put("USERNAME", ""); temp.put("DEPTID", "dept1"); temp.put("DEPTFULLPATHID", "dept1"); temp.put("DEPTFULLPATHNAME", ""); temp.put("DEPTFULLPATHNAMEWITHCOMPNAY", ""); temp.put("DEPTNAME", ""); temp.put("DEPTNO", "888"); temp.put("ROLEID", "role1"); temp.put("UID", "huahua"); temp.put("USERID", "huahua"); temp.put("USERNO", "999"); temp.put("USERNAME", "花花"); temp.put("USERNAMEALIAS", ""); temp.put("EMAIL", ""); temp.put("OFFICETEL", ""); temp.put("MOBILE", ""); temp.put("OFFICEFAX", ""); temp.put("POSITIONNAME", ""); temp.put("POSITIONNO", ""); temp.put("POSITIONLAYER", ""); temp.put("EXT1", ""); temp.put("EXT2", ""); temp.put("EXT3", ""); temp.put("EXT4", ""); temp.put("EXT5", ""); String[] sourceFields = sourceField.split(","); String[] arrayOfString3 = sourceFields; localObject1 = arrayOfString3.length; for (field = 0; field < localObject1; field++) { field = arrayOfString3[field]; user1.put(field, temp.getString(field)); } } treeData.add(user1); JSONObject user2 = new JSONObject(); user2.put("pid", pid); user2.put("iconFont", UtilSerialize.parseObject("{'code':'','color':'#DA2912'}")); user2.put("iconFont", ""); user2.put("sourceName", ""); user2.put("type", "user"); user2.put("leaf", Boolean.valueOf(true)); user2.put("sourceId", "niuniu"); user2.put("id", "niuniu_" + pid); user2.put("name", "牛牛"); user2.put("type", "user"); user2.put("USERNAMEALIAS", ""); if (!UtilString.isEmpty(sourceField)) { JSONObject temp = new JSONObject(); temp.put("COMPANYNAME", ""); temp.put("COMPANYID", "company1"); temp.put("COMPANYNO", "0101"); temp.put("EMAIL", ""); temp.put("USERNAME", "牛牛"); temp.put("DEPTID", "dept1"); temp.put("DEPTFULLPATHID", "dept1"); temp.put("DEPTFULLPATHNAME", ""); temp.put("DEPTFULLPATHNAMEWITHCOMPNAY", ""); temp.put("DEPTNAME", ""); temp.put("DEPTNO", "888"); temp.put("ROLEID", "role1"); temp.put("UID", "niuniu"); temp.put("USERID", "niuniu"); temp.put("USERNO", "999"); temp.put("USERNAME", ""); temp.put("USERNAMEALIAS", ""); temp.put("EMAIL", ""); temp.put("OFFICETEL", ""); temp.put("MOBILE", ""); temp.put("OFFICEFAX", ""); temp.put("POSITIONNAME", ""); temp.put("POSITIONNO", ""); temp.put("POSITIONLAYER", ""); temp.put("EXT1", ""); temp.put("EXT2", ""); temp.put("EXT3", ""); temp.put("EXT4", ""); temp.put("EXT5", ""); sourceFields = sourceField.split(","); localObject1 = sourceFields; field = localObject1.length; for (field = 0; field < field; field++) { String field = localObject1[field]; user2.put(field, temp.getString(field)); } } treeData.add(user2); } else if (pid.equals("dept2")) { JSONObject user1 = new JSONObject(); user1.put("pid", pid); user1.put("iconFont", UtilSerialize.parseObject("{'code':'','color':'#DA2912'}")); user1.put("iconFont", ""); user1.put("sourceName", ""); user1.put("type", "user"); user1.put("leaf", Boolean.valueOf(true)); user1.put("sourceId", "xiaoxiao"); user1.put("id", "xiaoxiao_" + pid); user1.put("name", ""); user1.put("type", "user"); user1.put("USERNAMEALIAS", ""); Object localObject2; String field; if (!UtilString.isEmpty(sourceField)) { JSONObject temp = new JSONObject(); temp.put("COMPANYNAME", ""); temp.put("COMPANYID", "company1"); temp.put("COMPANYNO", "0101"); temp.put("EMAIL", ""); temp.put("USERNAME", ""); temp.put("DEPTID", "dept2"); temp.put("DEPTFULLPATHID", "dept2"); temp.put("DEPTFULLPATHNAME", "/"); temp.put("DEPTFULLPATHNAMEWITHCOMPNAY", ""); temp.put("DEPTNAME", ""); temp.put("DEPTNO", "888"); temp.put("ROLEID", "role1"); temp.put("UID", "xiaoxiao"); temp.put("USERID", "xiaoxiao"); temp.put("USERNO", "222"); temp.put("USERNAME", ""); temp.put("USERNAMEALIAS", ""); temp.put("EMAIL", ""); temp.put("OFFICETEL", ""); temp.put("MOBILE", ""); temp.put("OFFICEFAX", ""); temp.put("POSITIONNAME", ""); temp.put("POSITIONNO", ""); temp.put("POSITIONLAYER", ""); temp.put("EXT1", ""); temp.put("EXT2", ""); temp.put("EXT3", ""); temp.put("EXT4", ""); temp.put("EXT5", ""); String[] sourceFields = sourceField.split(","); sourceFields = sourceFields; localObject2 = sourceFields.length; for (field = 0; field < localObject2; field++) { field = sourceFields[field]; user1.put(field, temp.getString(field)); } } treeData.add(user1); JSONObject user2 = new JSONObject(); user2.put("pid", pid); user2.put("iconFont", UtilSerialize.parseObject("{'code':'','color':'#DA2912'}")); user2.put("iconFont", ""); user2.put("sourceName", ""); user2.put("type", "user"); user2.put("leaf", Boolean.valueOf(true)); user2.put("sourceId", "youyou"); user2.put("id", "youyou_" + pid); user2.put("name", ""); user2.put("type", "user"); user2.put("USERNAMEALIAS", ""); if (!UtilString.isEmpty(sourceField)) { JSONObject temp = new JSONObject(); temp.put("COMPANYNAME", ""); temp.put("COMPANYID", "company1"); temp.put("COMPANYNO", "0101"); temp.put("EMAIL", ""); temp.put("USERNAME", ""); temp.put("DEPTID", "dept2"); temp.put("DEPTFULLPATHID", "dept2"); temp.put("DEPTFULLPATHNAME", ""); temp.put("DEPTFULLPATHNAMEWITHCOMPNAY", ""); temp.put("DEPTNAME", ""); temp.put("DEPTNO", "222"); temp.put("ROLEID", "role1"); temp.put("UID", "youyou"); temp.put("USERID", "youyou"); temp.put("USERNO", "222"); temp.put("USERNAME", ""); temp.put("USERNAMEALIAS", ""); temp.put("EMAIL", ""); temp.put("OFFICETEL", ""); temp.put("MOBILE", ""); temp.put("OFFICEFAX", ""); temp.put("POSITIONNAME", ""); temp.put("POSITIONNO", ""); temp.put("POSITIONLAYER", ""); temp.put("EXT1", ""); temp.put("EXT2", ""); temp.put("EXT3", ""); temp.put("EXT4", ""); temp.put("EXT5", ""); String[] sourceFields = sourceField.split(","); localObject2 = sourceFields; field = localObject2.length; for (field = 0; field < field; field++) { String field = localObject2[field]; user2.put(field, temp.getString(field)); } } treeData.add(user2); } } } return treeData; } /** * 查询地址簿 * * @param appId 应用id * @param filter 地址簿配置 * @param context 用户上下文 * @param sourceField 地址簿回填字段 * @param type 查询类型 同地址簿叶子节点 * @param keyWord 查询关键字 * @param limit 每页条数 * @param start 起始条数 * @return 包含 总数量 totalNum 总数量 ; 查询列表 list(JSONArray) */ public JSONObject search(String appId, JSONObject filter, UserContext context, String sourceField, String type, String keyWord, int limit, int start) { JSONObject result = new JSONObject(); return result; } /** * 地址簿显示值(主要是返回值中有uid 或deptid 或 teamID 显示值需要具体信息用来显示) * * @param appId 应用id * @param filter 地址簿配置 * @param context 用户上下文 * @param value 用户账号或部门id * @return 包含 id :用户账号或部门id ;name: 用户名称或部门名称 */ public JSONObject addressDisplayValue(String appId, JSONObject filter, UserContext context, String value) { return null; } /**获取父节点 移动端使用 * @param appId 应用id * @param filter 地址簿配置 * @param context 用户上下文 * @param nodeId 当前节点id * @param nodeType 当前节点类型 * @return */ public JSONObject getParentTreeNode(String appId, JSONObject filter, UserContext context, String nodeId, String nodeType) { JSONObject result = null; return result; } }
- 过滤事件
一个实现com.actionsoft.bpms.ui.dict.address.base.AddressUIFilterInterface接口的类,由自定义的Java程序控制树形节点的显示,例如【过滤掉包含对应字段符串的人员、部门、单位】
import com.actionsoft.bpms.org.model.CompanyModel;
import com.actionsoft.bpms.org.model.DepartmentModel;
import com.actionsoft.bpms.org.model.UserModel;
import com.actionsoft.bpms.server.UserContext;
import com.actionsoft.bpms.ui.dict.address.base.AddressUIFilterInterface;
import com.actionsoft.bpms.ui.dict.address.model.AdvancedAddressModel;
public class Test
implements AddressUIFilterInterface
{
public boolean addressUIFlexUserFilter(UserContext uc, UserModel model, AdvancedAddressModel addressUIFlexModel)
{
if (model.getUserName().contains("aws"))
return false;
return true;
}
public boolean addressUIFlexDepartmentFilter(UserContext uc, DepartmentModel model, AdvancedAddressModel addressUIFlexModel)
{
if (model.getName().contains("测试2")) {
return false;
}
return true;
}
public boolean addressUIFlexCompanyFilter(UserContext uc, CompanyModel model, AdvancedAddressModel addressUIFlexModel)
{
if ((model.getName().contains("同步微信单位12")) || (model.getName().contains("新单位"))) {
return false;
}
return true;
}
}
控制属性
参见单行控制属性
不允许重复录入
参见单行不允许重复录入
宽度
参见单行宽度
提示文字
参见单行提示文字
帮助说明
参见单行帮助说明
字段规则
参见单行字段规则