起步软件技术论坛-X3

 找回密码
 立即注册
搜索
查看: 162|回复: 2

【结贴】如何程序实现给组织机构中的成员分配指定功能。**

[复制链接]
发表于 2008-7-9 11:17:47 | 显示全部楼层 |阅读模式
给某个人员成员,岗位成员,分配指定的功能.
比如已知10个人员成员,想把指定的功能分配给他们,用程序如何实现?
回复

使用道具 举报

发表于 2008-7-9 11:30:50 | 显示全部楼层
组织单元的功能权限存储在其Module.RunFuncAlloc属性中。
对组织单元分配权限,就是在操作这个属性。楼主可以参考一下组织机构管理器中的代码:
Static function TASSIGNMANAGEFUNC.AssignA(AContext: TContext; AParent: TBizURL; AOrgFuncKind: TOrgFuncKind; ADeptManager: TDeptManager): Boolean;
var
  I: Integer;
  lOrigin, lOrg: TOrgUnit;
  lItems: TOrgFuncAllocItems;
begin
  lOrg := TOrgUnit.Create(AParent);
  with TAssignManageFunc.Create(AContext) do
  try
    FDeptManager := ADeptManager;
    Caption := StrUtils.IfThen(AOrgFuncKind = TOrgFuncKind.ofkManage, '分配管理功能', '分配运行功能');
    FParentModule := lOrg.Module;
    if AOrgFuncKind = TOrgFuncKind.ofkManage then
      FItems := FParentModule.ManageFuncAlloc
    else
      FItems := FParentModule.RunFuncAlloc;

    FOrgFuncKind := AOrgFuncKind;
    InitUI;
    Result := ShowModal = Business.Forms.Controls.mrOK;
    if Result then
    begin
      Forms.Screen.Cursor := Business.Forms.Controls.crHourGlass;
      try
        lOrigin := OrgSys.OrgSystem.GetUnit(AParent);
        if FOrgFuncKind = TOrgFuncKind.ofkManage then
          lItems := lOrigin.Module.ManageFuncAlloc
        else
          lItems := lOrigin.Module.RunFuncAlloc;
        lItems.Clear;
        for I := 0 to FItems.Count - 1 do
          lItems.AddItem(FItems[I].FuncURL);
        OrgSys.OrgSystem.SaveUnit(lOrigin);
        TCommonFunc.OrgChanged;
      finally
        Forms.Screen.Cursor := Business.Forms.Controls.crDefault;
      end;
    end;
  finally
    Free;
    lOrg.Free;
  end;
end;
回复 支持 反对

使用道具 举报

发表于 2008-7-31 17:43:11 | 显示全部楼层
长时间未回馈,结贴了
回复 支持 反对

使用道具 举报

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

本版积分规则

小黑屋|手机版|Justep Inc.

GMT+8, 2025-7-19 22:35 , Processed in 0.047133 second(s), 15 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表