查看: 189|回复: 0

人员控件 排除脚本 如何一次性剔除部门下属的人

升级   15.4%

67

主题

122

回帖

577

积分

高级会员

Rank: 4

积分
577
发表于 2024-4-20 13:51:43 | 显示全部楼层 |阅读模式
本帖最后由 szhtest 于 2024-4-22 10:37 编辑

[JavaScript] 纯文本查看 复制代码
this.define("getOrgUserList", function(departments) {
    let allResults = [];  // 用于存储所有处理后的结果

    for (let dept of departments) {
        var userList = this.org.listIdentityWithUnit(dept.orgName);
        var returnUserList = [];

        if (userList.length > 0 && dept.exceptUserList.length > 0) {
            returnUserList = userList.filter(user => !dept.exceptUserList.includes(user.distinguishedName));
        } else {
            returnUserList = userList;
        }

        // 将处理后的用户名添加到结果数组
        allResults.push(...returnUserList.map(user => user.distinguishedName));
    }

    return allResults;
}, true);

//设置数字化经办人
var szh_distinguishedNames = this.org.listIdentityWithPerson(['admin','S2726','S2004']).map(identity => identity.distinguishedName);
//设置品管经办人
var pg_distinguishedNames = this.org.listIdentityWithPerson(['S1888','S0244','S0932']).map(identity => identity.distinguishedName);




var departmentData = [
    { orgName: 'Z', exceptUserList: szh_distinguishedNames },
    { orgName: 'C', exceptUserList: pg_distinguishedNames }

];


var results = this.getOrgUserList(departmentData);
return results




目前是在人员控件的排除脚本中写出了如上代码,现在传入部门唯一编码、想保留的员工的唯一标识后,就能正常剔除departmentData外每个部门的其他人。
但现在发现一个问题,但凡人员A是属于整个部门下面的1组,该部门就没有剔除他,如何解决?我该如何修改我的代码使部门下级的人,也能当做是此部门的人员做正常剔除?有些部门下属有组,有些部门下属是没有的


已解决:

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

联系客服 关注微信 下载APP 返回顶部 返回列表
viewthread