我添加不了附件,老是找不到服务器,这是代码
unit MAINFORM;
interface
uses
Business.System, Business.Forms, Business.Model, Business.Model.BizObjComUtils, OrgLib;
type
TOrgViewStyle = (ovsOrgChartHorzontal, ovsOrgChartVertical, ovsTreeView);
TMAINFORM = class(TForm)
ActionList: TActionList;
Panel1: TPanel;
otvOrgTreeView: TOrgTreeView;
Splitter1: TSplitter;
Panel3: TPanel;
olvOrgView: TOrgListView;
spltSearch: TSplitter;
actNewDept: TAction;
actNewOrgan: TAction;
actNewWorkGroup: TAction;
actNewPerson: TAction;
actNewPosition: TAction;
ActPositionMember: TAction;
actPersonMember: TAction;
actRunFunc: TAction;
actManageFunc: TAction;
actDataAuthority: TAction;
actManageAuthority: TAction;
actProperty: TAction;
actCopy: TAction;
actCut: TAction;
actPaste: TAction;
actMoveTo: TAction;
actCopyTo: TAction;
actToolBar: TAction;
actStatusBar: TAction;
actAddrBar: TAction;
OrgTreeView: TAction;
actListView: TAction;
actTree: TAction;
actVertial: TAction;
acthorizontal: TAction;
actUp: TAction;
actRefresh: TAction;
actOption: TAction;
actHelp: TAction;
actDelete: TAction;
ToolBar1: TToolBar;
ToolBar2: TToolBar;
Label1: TLabel;
OrgComboBox: TOrgComboBox;
actAssignOrgToFunc: TAction;
actDeputed: TAction;
actDeput: TAction;
ocOrgChart: TOrgChart;
StatusBar: TStatusBar;
actNewFolder: TAction;
btbSearch: TBizToolBar;
pmOrg: TPopupMenu;
N24: TMenuItem;
actAsRunFunc: TAction;
ActAsManageFunc: TAction;
actOperator: TAction;
actParamPolicy: TAction;
actDeputyHistory: TAction;
NO4: TMenuItem;
ND4: TMenuItem;
N33: TMenuItem;
NC4: TMenuItem;
N34: TMenuItem;
NM3: TMenuItem;
N35: TMenuItem;
N36: TMenuItem;
NA4: TMenuItem;
NM4: TMenuItem;
N37: TMenuItem;
ND5: TMenuItem;
N38: TMenuItem;
N39: TMenuItem;
NR3: TMenuItem;
NA5: TMenuItem;
N40: TMenuItem;
N41: TMenuItem;
NA6: TMenuItem;
N42: TMenuItem;
NH3: TMenuItem;
N43: TMenuItem;
N44: TMenuItem;
N45: TMenuItem;
NA7: TMenuItem;
NP5: TMenuItem;
N46: TMenuItem;
N47: TMenuItem;
N48: TMenuItem;
N49: TMenuItem;
actAssignPositionMemberToPerson: TAction;
actAssignDeptToPosition: TAction;
N50: TMenuItem;
N51: TMenuItem;
N52: TMenuItem;
NF3: TMenuItem;
N53: TMenuItem;
NA8: TMenuItem;
N54: TMenuItem;
NA9: TMenuItem;
NA10: TMenuItem;
NA11: TMenuItem;
NA12: TMenuItem;
N55: TMenuItem;
N56: TMenuItem;
N57: TMenuItem;
N58: TMenuItem;
NV3: TMenuItem;
NL4: TMenuItem;
NT5: TMenuItem;
pmViewStyle: TPopupMenu;
NT6: TMenuItem;
NA13: TMenuItem;
NA14: TMenuItem;
ToolButton1: TToolButton;
imlHot: TImageList;
imlNormal: TImageList;
SaveDialog: TSavePictureDialog;
actImportIntoImg: TAction;
N59: TMenuItem;
ToolButton2: TToolButton;
ToolButton3: TToolButton;
ToolButton4: TToolButton;
ToolButton5: TToolButton;
ToolButton6: TToolButton;
ToolButton7: TToolButton;
ToolButton8: TToolButton;
ToolButton9: TToolButton;
ToolButton10: TToolButton;
ToolButton11: TToolButton;
ToolButton12: TToolButton;
ToolButton13: TToolButton;
ToolButton14: TToolButton;
ToolButton15: TToolButton;
N1: TMenuItem;
N2: TMenuItem;
N3: TMenuItem;
N4: TMenuItem;
N5: TMenuItem;
pmTools: TPopupMenu;
actManager: TAction;
N6: TMenuItem;
actNoUsingBrowse: TAction;
NA1: TMenuItem;
NA2: TMenuItem;
actNoUsing: TAction;
NA3: TMenuItem;
N7: TMenuItem;
ToolButton16: TToolButton;
ToolButton17: TToolButton;
actWorkGroupMember: TAction;
actRefreshCache: TAction;
N8: TMenuItem;
N9: TMenuItem;
N10: TMenuItem;
NA15: TMenuItem;
actSetSubNodeSquence: TAction;
NA16: TMenuItem;
N11: TMenuItem;
actUpNode: TAction;
actDownNode: TAction;
N12: TMenuItem;
N13: TMenuItem;
N14: TMenuItem;
procedure BizFormCreate(Sender: TObject);
procedure olvOrgViewDblClick(Sender: TObject);
procedure actNewOrganExecute(Sender: TObject);
procedure actNewOrganUpdate(Sender: TObject);
procedure ActPositionMemberExecute(Sender: TObject);
procedure ActPositionMemberUpdate(Sender: TObject);
procedure actPersonMemberExecute(Sender: TObject);
procedure actPersonMemberUpdate(Sender: TObject);
procedure actManageAuthorityExecute(Sender: TObject);
procedure actManageAuthorityUpdate(Sender: TObject);
procedure actDataAuthorityExecute(Sender: TObject);
procedure actDataAuthorityUpdate(Sender: TObject);
procedure actManageFuncExecute(Sender: TObject);
procedure actManageFuncUpdate(Sender: TObject);
procedure actRunFuncExecute(Sender: TObject);
procedure actDeputExecute(Sender: TObject);
procedure actDeputUpdate(Sender: TObject);
procedure actDeputedExecute(Sender: TObject);
procedure actDeputedUpdate(Sender: TObject);
procedure actAsRunFuncExecute(Sender: TObject);
procedure ActAsManageFuncExecute(Sender: TObject);
procedure actOperatorExecute(Sender: TObject);
procedure actParamPolicyExecute(Sender: TObject);
procedure actDeputyHistoryExecute(Sender: TObject);
procedure actPropertyExecute(Sender: TObject);
procedure BizFormDestroy(Sender: TObject);
procedure actAssignPositionMemberToPersonUpdate(Sender: TObject);
procedure actAssignPositionMemberToPersonExecute(Sender: TObject);
procedure actAssignDeptToPositionUpdate(Sender: TObject);
procedure actAssignDeptToPositionExecute(Sender: TObject);
procedure actRefreshExecute(Sender: TObject);
procedure actCopyToExecute(Sender: TObject);
procedure actMoveToExecute(Sender: TObject);
procedure actPasteExecute(Sender: TObject);
procedure actCutExecute(Sender: TObject);
procedure actCopyExecute(Sender: TObject);
procedure SpeedButton8Click(Sender: TObject);
procedure actDeleteUpdate(Sender: TObject);
procedure actDeleteExecute(Sender: TObject);
procedure actTreeExecute(Sender: TObject);
procedure actCopyUpdate(Sender: TObject);
procedure actCutUpdate(Sender: TObject);
procedure actPasteUpdate(Sender: TObject);
procedure actImportIntoImgUpdate(Sender: TObject);
procedure actImportIntoImgExecute(Sender: TObject);
procedure actUpUpdate(Sender: TObject);
procedure actUpExecute(Sender: TObject);
procedure OrgComboBoxCloseUp(Sender: TObject; Accept: Boolean);
procedure actManagerUpdate(Sender: TObject);
procedure actManagerExecute(Sender: TObject);
procedure actNoUsingBrowseExecute(Sender: TObject);
procedure actNoUsingExecute(Sender: TObject);
procedure otvOrgTreeViewKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure actPropertyUpdate(Sender: TObject);
procedure actWorkGroupMemberExecute(Sender: TObject);
procedure actWorkGroupMemberUpdate(Sender: TObject);
procedure otvOrgTreeViewChange(Sender: TObject; Node: TTreeNode);
procedure ocOrgChartChange(Sender: TObject; Node: TOrgChartNode);
procedure actRefreshCacheExecute(Sender: TObject);
procedure actSetSubNodeSquenceUpdate(Sender: TObject);
procedure actSetSubNodeSquenceExecute(Sender: TObject);
procedure actRefreshUpdate(Sender: TObject);
procedure actUpNodeExecute(Sender: TObject);
procedure actDownNodeExecute(Sender: TObject);
private
{private declarations}
//justmove : boolean;
//canchange : boolean;
FOrgViewStyle: TOrgViewStyle;
FBatchOperate: TBatchOperate;
FCurrentBizNodes: TStrings;
FCutNode: TTreeNode;
procedure AfterSearchURLs(Sender: TObject; AURLs: TStrings; ASearched: Boolean);
function GetCurrentNode: TBizNode;
function GetCurrentBizNodes: TStrings;
function isPersonFolder(ANode: TBizNode): Boolean;
function GetCurrentBizURL: String;
function isSubNode(ARootFileName: String; ANode: TBizNode): Boolean;
procedure InitOrgTree;
procedure InitUI;
procedure SetOrgViewStyle(Value: TOrgViewStyle);
procedure OnOrgNodeInserting(Sender: TObject; ANode: TBaseNode; var Allow: Boolean);
protected
FDeptManager: TDeptManager;
procedure SetIsDept; virtual;
procedure doInitRoot; virtual;
public
{public declarations}
property CurrentBizNode: TBizNode read GetCurrentNode;
property CurrentBizNodes: TStrings read GetCurrentBizNodes;
property CurrentBizURL: String read GetCurrentBizURL;
property OrgViewStyle: TOrgViewStyle read FOrgViewStyle write SetOrgViewStyle;
end;
TOperateType = (optCopy, optMove);
TBatchOperate = class(TObject)
private
FOperateItems: TStrings;
FOperateType: TOperateType;
public
property OperateItems: TStrings read FOperateItems write FOperateItems;
property OperateType: TOperateType read FOperateType write FOperateType;
constructor Create;
destructor Destroy; override;
procedure Operate(ATarget: TBizURL);
function CanPaste(ATarget: TBizNode): Boolean;
static procedure OperateA(ATarget: TBizURL; AItems: TStrings; AOperateType: TOperateType);
end;
implementation
const
iMoveStep = 1;
procedure TMAINFORM.AfterSearchURLs(Sender: TObject; AURLs: TStrings; ASearched: Boolean);
begin
olvOrgView.Clear;
olvOrgView.Visible := AURLs.Count >= 1;
spltSearch.Visible := olvOrgView.Visible;
StatusBar.SimpleText := SysUtils.Format('找到符合条件的节点%d个', [AURLs.Count]);
olvOrgView.BizURLs := AURLs;
end;
function TMAINFORM.GetCurrentNode: TBizNode;
begin
if FOrgViewStyle = TOrgViewStyle.ovsTreeView then
Result := otvOrgTreeView.SelectedNode
else
Result := ocOrgChart.SelectedNode;
end;
function TMAINFORM.GetCurrentBizNodes: TStrings;
begin
if FOrgViewStyle = TOrgViewStyle.ovsTreeView then
FCurrentBizNodes.Assign(otvOrgTreeView.SelectedNodes)
else
FCurrentBizNodes.Assign(ocOrgChart.SelectedNodes);
Result := FCurrentBizNodes;
end;
function TMAINFORM.isSubNode(ARootFileName: String; ANode: TBizNode): Boolean;
begin
Result := StrUtils.AnsiStartsText(ARootFileName, ANode.FullFileName);
end;
function TMAINFORM.GetCurrentBizURL: String;
begin
Result := CurrentBizNode.BizURL.URL;
end;
procedure TMAINFORM.InitOrgTree;
var
lRootNodes: TStrings;
lBizNode: TBizNode;
begin
otvOrgTreeView.OnInserting := OnOrgNodeInserting;
ocOrgChart.OnInserting := OnOrgNodeInserting;
doInitRoot;
ocOrgChart.AutoLoad := True;
ocOrgChart.RootNodes := otvOrgTreeView.StartWithNodes;
end;
procedure TMAINFORM.InitUI;
begin
//初始化查询选项
FOrgViewStyle := TOrgViewStyle.ovsTreeView;
end;
procedure TMAINFORM.SetOrgViewStyle(Value: TOrgViewStyle);
begin
if Value = FOrgViewStyle then Exit;
FOrgViewStyle := Value;
case FOrgViewStyle of
TOrgViewStyle.ovsTreeView: begin
otvOrgTreeView.BringToFront;
otvOrgTreeView.FileName := ocOrgChart.FileName;
actTree.Checked := True;
end;
TOrgViewStyle.ovsOrgChartHorzontal: begin
ocOrgChart.BringToFront;
ocOrgChart.Rotated := True;
ocOrgChart.FileName := otvOrgTreeView.FileName;
actVertial.Checked := True;
end;
TOrgViewStyle.ovsOrgChartVertical: begin
ocOrgChart.BringToFront;
ocOrgChart.Rotated := False;
ocOrgChart.FileName := otvOrgTreeView.FileName;
acthorizontal.Checked := True;
end;
end;
end;
procedure TMAINFORM.BizFormCreate(Sender: TObject);
begin
FBatchOperate := TBatchOperate.Create;
FDeptManager := TDeptManager.Create(Context);
FCurrentBizNodes := TStringList.Create;
SetIsDept;
TCommonFunc.SetSearchToolBar(btbSearch, ['Org:\Root', 'Org:\Position', 'Org:\Person'], AfterSearchURLs);
InitOrgTree;
InitUI;
//justmove := false;
//canchange := true;
end;
procedure TMAINFORM.olvOrgViewDblClick(Sender: TObject);
begin
try
if FOrgViewStyle = TOrgViewStyle.ovsTreeView then
otvOrgTreeView.Find(olvOrgView.SelectedNode.GUID, True).Selected := True
else
ocOrgChart.Find(olvOrgView.SelectedNode.GUID, True).Selected := True;
Except
jsDialogs.ShowError('组织机构不存在,可能已经损坏禁用或被删除!', '错误');
end;
end;
procedure TMAINFORM.actNewOrganExecute(Sender: TObject);
var
lR: Boolean;
begin
case TAction(Sender).Tag of
1: lR := TOrgLib.NewOrgan(Context, CurrentBizNode.BizURL, nil, FDeptManager);
2: lR := TOrgLib.NewDept(Context, CurrentBizNode.BizURL, nil, FDeptManager);
3: lR := TOrgLib.NewPosition(Context, CurrentBizNode.BizURL, nil, FDeptManager);
4: lR := TOrgLib.NewPerson(Context, CurrentBizNode.BizURL, nil, FDeptManager);
5: lR := TOrgLib.NewWrokGroup(Context, CurrentBizNode.BizURL, nil, FDeptManager);
6: lR := TOrgLib.NewFolder(Context, CurrentBizNode.BizURL, nil, FDeptManager);
else
lR := False;
end;
if lR then
begin
BizTree.BizTreeStructure.RefreshChildren(CurrentBizNode.FullFileName);
if OrgViewStyle = TOrgViewStyle.ovsTreeView then
otvOrgTreeView.Find(CurrentBizNode.GUID, True).Expanded := True
else
ocOrgChart.Find(CurrentBizNode.GUID, True).Expanded := True;
end;
end;
//**************************************
//**************************************
procedure TMAINFORM.actNewOrganUpdate(Sender: TObject);
begin
with TAction(Sender) do
begin
//jsDialogs.showmsg('actNewOrganUpdate', 'aa');
//if (CurrentBizNode <> nil) and (CurrentBizNode.ID <> '') then
//if canchange then
//begin
Enabled := Assigned(CurrentBizNode) and ((CurrentBizNode.NodeKind in [TBizObjectKind.boOrgRoot, TBizObjectKind.boPositionRoot, TBizObjectKind.boPersonRoot]) or FDeptManager.IsCanOperateFile(CurrentBizNode.BizURL.FileName));
if Enabled then
case Tag of
1: Enabled := (CurrentBizNode.NodeKind in [TBizObjectKind.boOrgRoot, TBizObjectKind.boOrgan]) and isSubNode('Org:\Root', CurrentBizNode);
2: Enabled := (CurrentBizNode.NodeKind in [TBizObjectKind.boOrgan, TBizObjectKind.boDept]) and isSubNode('Org:\Root', CurrentBizNode);
3: Enabled := (CurrentBizNode.NodeKind in [TBizObjectKind.boPositionRoot, TBizObjectKind.boFolder]) and isSubNode('Org:\Position', CurrentBizNode);
4: Enabled := (CurrentBizNode.NodeKind in [TBizObjectKind.boOrgRoot, TBizObjectKind.boOrgan, TBizObjectKind.boDept, TBizObjectKind.boFolder, TBizObjectKind.boPersonRoot])and isSubNode('Org:\Person', CurrentBizNode) and (not (FDeptManager.Enabled and (CurrentBizNode.NodeKind = TbizObjectKind.boPersonRoot)));
5: Enabled := (CurrentBizNode.NodeKind in [TBizObjectKind.boOrgan]) and isSubNode('Org:\Root', CurrentBizNode);
6: Enabled := (CurrentBizNode.NodeKind in [TBizObjectKind.boPositionRoot, TBizObjectKind.boFolder]) and isSubNode('Org:\Position', CurrentBizNode);
end;
//end;
end;
end;
procedure TMAINFORM.ActPositionMemberExecute(Sender: TObject);
begin
if TOrgLib.AssignPositionMember(Context, CurrentBizNode.BizURL, FDeptManager) then
FDeptManager.ReloadOrgURLs;
end;
//*********************************************
//*********************************************
procedure TMAINFORM.ActPositionMemberUpdate(Sender: TObject);
begin
//jsDialogs.showmsg('ActPositionMemberUpdate', 'aa');
//if (CurrentBizNode <> nil) and (CurrentBizNode.ID <> '') then
//if canchange then
TAction(Sender).Enabled := Assigned(CurrentBizNode) and (CurrentBizNode.NodeKind = TBizObjectKind.boDept) and isSubNode('Org:\Root', CurrentBizNode) and FDeptManager.IsCanOperateFile(CurrentBizNode.BizURL.FileName);
end;
procedure TMAINFORM.actPersonMemberExecute(Sender: TObject);
begin
if TOrgLib.AssignPersonMember(Context, CurrentBizNode.BizURL, FDeptManager) then
FDeptManager.ReloadOrgURLs;
end;
//*********************************************
//*********************************************
procedure TMAINFORM.actPersonMemberUpdate(Sender: TObject);
begin
//if (CurrentBizNode <> nil) and (CurrentBizNode.ID <> '') then
//if canchange then
TAction(Sender).Enabled := Assigned(CurrentBizNode) and (CurrentBizNode.NodeKind = TBizObjectKind.boPositionMember) and FDeptManager.IsCanOperateFile(CurrentBizNode.BizURL.FileName);
end;
procedure TMAINFORM.actManageAuthorityExecute(Sender: TObject);
begin
if TOrgLib.AssignMangerAuthority(Context, CurrentBizNode.BizURL, FDeptManager) then
FDeptManager.ReloadOrgURLs;
end;
procedure TMAINFORM.actManageAuthorityUpdate(Sender: TObject);
begin
if (CurrentBizNode <> nil) and (CurrentBizNode.ID <> '') then
TAction(Sender).Enabled := Assigned(CurrentBizNode) and (CurrentBizNode.NodeKind in [TBizObjectKind.boPosition, TBizObjectKind.boPositionMember, TBizObjectKind.boPersonMember]) and FDeptManager.IsCanOperateFile(CurrentBizNode.BizURL.FileName);
end;
procedure TMAINFORM.actDataAuthorityExecute(Sender: TObject);
begin
BizObjComUtils.BizSysUtils.SetDataAuthority(CurrentBizNode.BizURL);
end;
procedure TMAINFORM.actDataAuthorityUpdate(Sender: TObject);
begin
if (CurrentBizNode <> nil) and (CurrentBizNode.ID <> '') then
TAction(Sender).Enabled := Assigned(CurrentBizNode) and (CurrentBizNode.NodeKind in [TBizObjectKind.boOrgan, TBizObjectKind.boDept, TBizObjectKind.boPositionMember, TBizObjectKind.boPersonMember]) and FDeptManager.IsCanOperateFile(CurrentBizNode.BizURL.FileName);
end;
procedure TMAINFORM.actManageFuncExecute(Sender: TObject);
begin
if TOrgLib.AssignManagerFunc(Context, CurrentBizNode.BizURL, FDeptManager) then
FDeptManager.ReloadFuncURLs;
end;
procedure TMAINFORM.actManageFuncUpdate(Sender: TObject);
begin
if (CurrentBizNode <> nil) and (CurrentBizNode.ID <> '') then
TAction(Sender).Enabled := Assigned(CurrentBizNode) and (CurrentBizNode.NodeKind in [TBizObjectKind.boOrgan, TBizObjectKind.boDept, TBizObjectKind.boPosition, TBizObjectKind.boPositionMember, TBizObjectKind.boPersonmember]) and FDeptManager.IsCanOperateFile(CurrentBizNode.BizURL.FileName);
end;
procedure TMAINFORM.actRunFuncExecute(Sender: TObject);
begin
TOrgLib.AssignRunFunc(Context, CurrentBizNode.BizURL, FDeptManager);
end;
procedure TMAINFORM.actDeputExecute(Sender: TObject);
begin
if CurrentBizNode.NodeKind = TBizObjectKind.boPerson then
TOrgLib.Deputy(Context, CurrentBizNode.BizURL, FDeptManager)
else
TOrgLib.Deputy(Context, Org.OrgSys.OrgSystem.FindUnit('', '', CurrentBizNode.BizURL.ID).BizURL, FDeptManager);
end;
procedure TMAINFORM.actDeputUpdate(Sender: TObject);
begin
if (CurrentBizNode <> nil) and (CurrentBizNode.ID <> '') then
TAction(Sender).Enabled := Assigned(CurrentBizNode) and (CurrentBizNode.NodeKind in [TBizObjectKind.boPerson, TBizObjectKind.boPersonMember]);
end;
procedure TMAINFORM.actDeputedExecute(Sender: TObject);
begin
TOrgLib.Deputied(Context, CurrentBizNode.BizURL, FDeptManager);
end;
procedure TMAINFORM.actDeputedUpdate(Sender: TObject);
begin
if (CurrentBizNode <> nil) and (CurrentBizNode.ID <> '') then
TAction(Sender).Enabled := Assigned(CurrentBizNode) and (CurrentBizNode.NodeKind in [TBizObjectKind.boPerson, TBizObjectKind.boPersonMember]);
end;
procedure TMAINFORM.actAsRunFuncExecute(Sender: TObject);
begin
TOrgLib.AssignOrgToRunFunc(Context, FDeptManager);
end;
procedure TMAINFORM.ActAsManageFuncExecute(Sender: TObject);
begin
if TOrgLib.AssignOrgToManagerFunc(Context, FDeptManager) then
FDeptManager.ReloadFuncURLs;
end;
procedure TMAINFORM.actOperatorExecute(Sender: TObject);
begin
TOrgLib.AssignOperationAuthority(Context, CurrentBizNode.BizURL);
end;
procedure TMAINFORM.actParamPolicyExecute(Sender: TObject);
begin
TOrgLib.AssignParamPlicy(Context, CurrentBizNode.BizURL);
end;
procedure TMAINFORM.actDeputyHistoryExecute(Sender: TObject);
begin
TOrgLib.BrowseDeputyHistory(Context, FDeptManager);
end;
procedure TMAINFORM.actPropertyExecute(Sender: TObject);
begin
TOrgLib.ShowProperty(Context, CurrentBizNode, FDeptManager);
end;
procedure TMAINFORM.BizFormDestroy(Sender: TObject);
begin
FDeptManager.Free;
FCurrentBizNodes.Free;
FBatchOperate.Free;
TCommonFunc.EnsureChanged;
end;
//******************************************
//*******************************************
procedure TMAINFORM.actAssignPositionMemberToPersonUpdate(Sender: TObject);
begin
//jsDialogs.showmsg('actAssignPositionMemberToPersonUpdate', 'aa');
//if (CurrentBizNode <> nil) and (CurrentBizNode.ID <> '') then
//if canchange then
TAction(Sender).Enabled := Assigned(CurrentBizNode) and (CurrentBizNode.NodeKind = TBizObjectKind.boPerson) and FDeptManager.isOnManagedPersonFiles(CurrentBizNode.BizURL.FileName);
end;
procedure TMAINFORM.actAssignPositionMemberToPersonExecute(Sender: TObject);
begin
if TOrgLib.AssignPositionMemToPerson(Context, CurrentBizNode.BizURL, FDeptManager) then
FDeptManager.ReloadOrgURLs;
end;
//********************************
//*******************************
procedure TMAINFORM.actAssignDeptToPositionUpdate(Sender: TObject);
begin
//jsDialogs.showmsg('actAssignDeptToPositionUpdate', 'aa');
//if (CurrentBizNode <> nil) and (CurrentBizNode.ID <> '') then
//if canchange then
TAction(Sender).Enabled := Assigned(CurrentBizNode) and (CurrentBizNode.NodeKind = TBizObjectkind.boPosition) and FDeptmanager.IsCanOperateFile(CurrentBizNode.BizURL.FileName);
end;
procedure TMAINFORM.actAssignDeptToPositionExecute(Sender: TObject);
begin
if TOrgLib.AssignDeptToPosition(Context, CurrentBizNode.BizURL, FDeptManager) then
FDeptManager.ReloadOrgURLs;
end;
procedure TMAINFORM.actRefreshExecute(Sender: TObject);
begin
FileSys.FileSystem.Refresh(CurrentBizNode.BizURL.FileName, False);
Org.OrgSys.OrgSystem.RefreshCache;
TCommonFunc.RefreshRecycle(CurrentBizNode.BizURL.URL);
FDeptManager.ReloadOrgURLs;
end;
procedure TMAINFORM.actCopyToExecute(Sender: TObject);
var
lURL: String;
lBizURL: TBizURL;
lCanNotSelURLs, lChildren, lNodes: TStrings;
lSelected: Boolean;
I: Integer;
lCurrURL: TBizURL;
lNode: TBizNode;
begin
lCanNotSelURLs := TStringList.Create;
lChildren := TStringList.Create;
lNodes := TStringList.Create;
lCurrURL := TBizURL.Create;
lBizURL := TBizURL.Create;
try
lCurrURL.Assign(CurrentBizNode.BizURL);
if Assigned(CurrentBizNode.Parent) then
lCanNotSelURLs.Add(CurrentBizNode.Parent.BizURL.URL);
lCanNotSelURLs.Add(CurrentBizNode.BizURL.URL);
case CurrentBizNode.NodeKind of
TBizObjectKind.boOrgan: begin
BizTree.BizTreeStructure.GetChildrenByKindsString(CurrentBizNode.GUID, lChildren, True, '.ogn');
for I := 0 to lChildren.Count - 1 do
lCanNotSelURLs.Add(TBizNode(lChildren.Objects[I]).BizURL.URL);
lSelected := TOrgLib.SelectOrgan(Context, lCanNotSelURLs, FDeptManager, lURL);
end;
TBizObjectKind.boDept: begin
BizTree.BizTreeStructure.GetChildrenByKindsString(CurrentBizNode.GUID, lChildren, True, '.dpt');
for I := 0 to lChildren.Count - 1 do
lCanNotSelURLs.Add(TBizNode(lChildren.Objects[I]).BizURL.URL);
lSelected := TOrgLib.SelectDeptOrOrgan(Context, lCanNotSelURLs, FDeptManager, lURL);
end;
TBizObjectKind.boFolder: begin
if TCommonFunc.isSubNode('Org:\Position', CurrentBizNode.BizURL.FileName) then
begin
BizTree.BizTreeStructure.GetChildrenByKindsString(CurrentBizNode.GUID, lChildren, True, '');
for I := 0 to lChildren.Count - 1 do
lCanNotSelURLs.Add(TBizNode(lChildren.Objects[I]).BizURL.URL);
lSelected := TOrgLib.SelectPositionFolder(Context, lCanNotSelURLs, FDeptManager, lURL)
end
else
lSelected := False;
end;
TBizObjectKind.boPositionMember: lSelected := TOrgLib.SelectDept(Context, lCanNotSelURLs, FDeptManager, lURL);
TBizObjectKind.boPersonMember: lSelected := TOrgLib.SelectPositionMember(Context, lCanNotSelURLs, FDeptManager, lURL);
TBizObjectKind.boPosition: lSelected := TOrgLib.SelectPositionFolder(Context, lCanNotSelURLs, FDeptManager, lURL);
TBizObjectKind.boPerson: lSelected := TOrgLib.SelectPersonFolder(Context, lCanNotSelURLs, FDeptManager, lURL);
else
lSelected := False;
end;
if lSelected then
begin
lBizURL.URL := lURL;
lNode := BizTree.BizTreeStructure.FindNodeByBizURL(lCurrURL);
lNodes.AddObject(lNode.GUID, lNode);
TBatchOperate.OperateA(lBizURL, lNodes, TOperateType.optCopy);
if OrgViewStyle = TOrgViewStyle.ovsTreeView then //这段BT的代码是因为OrgTree上的一个bug搞得(组织机构树上不能列岗位下的文件夹)
otvOrgTreeView.Find(lNode.GUID, True).Selected := True
else
ocOrgChart.Find(lNode.GUID, True).Selected := True;
TCommonFunc.OrgChanged;
end;
finally
lBizURL.Free;
lCurrURL.Free;
lNodes.Free;
lChildren.Free;
lCanNotSelURLs.Free;
end;
end;
{TBatchOperation}
constructor TBatchOperate.Create;
begin
FOperateItems := TStringList.Create;
end;
destructor TBatchOperate.Destroy;
begin
FOperateItems.Free;
end;
procedure TBatchOperate.Operate(ATarget: TBizURL);
var
lPath: String;
begin
if FOperateItems.Count = 0 then Exit;
lPath := FileSys.FileUtils.AddPathSeparator(ATarget.FileName);
if FOperateType = TOperateType.optCopy then
BizSysUtils.CopyBizObject(lPath, FOperateItems)
else
BizSysUtils.MoveBizObject(lPath, FOperateItems);
FOperateItems.Clear;
end;
function TBatchOperate.CanPaste(ATarget: TBizNode): Boolean;
begin
//有可能已经不存在了!
if (FOperateItems.Count > 0) and Assigned(TBizNode(FOperateItems.Objects[0])) and Assigned(TBizNode(FOperateItems.Objects[0]).Parent) then
Result := (FOperateItems.Count > 0) and not SysUtils.SameText(TBizNode(FOperateItems.Objects[0]).Parent.BizURL.URL, ATarget.BizURL.URL)
else
Result := False;
if Result then //首先判断不是移动到自己的当前位置也就是当前的节点不是源节点的父节点
with TBizNode(FOperateItems.Objects[0]) do
case NodeKind of
TBizObjectKind.boOrgan: //移动机构的时候接收点是机构或机构根节点,并且不能是自己的下属节点
Result := (ATarget.NodeKind in [TBizObjectKind.boOrgan, TBizObjectKind.boOrgServer]) and not TCommonFunc.isSubNode(BizURL.FileName, ATarget.BizURL.FileName);
TBizObjectKind.boDept: // 移动部门的时候接收节点可能是机构或是部门,但不能是自己的下属节点
Result := (ATarget.NodeKind in [TBizObjectKind.boOrgan, TBizObjectKind.boDept]) and not TCommonFunc.isSubNode(BizURL.FileName, ATarget.BizURL.FileName);
TBizObjectKind.boPositionMember: //岗位成员可以移动到任何部门节点上
Result := (ATarget.NodeKind in [TBizObjectKind.boDept]) and not Assigned(Org.OrgSys.OrgSystem.FindUnit(ATarget.BizURL.ID, BizURL.ID, ''));
TBizObjectKind.boPosition: //岗位可以移动到任何岗位文件夹或是岗位根节点上
Result := ATarget.NodeKind in [TBizObjectKind.boFolder, TBizObjectKind.boPositionRoot];
TBizObjectKind.boFolder: //只有岗位文件夹可以移动但也只能移动到岗位根节点或是岗位根节点的文件夹(或其子文件夹)下
if TCommonFunc.isSubNode('Org:\Position', BizURL.FileName) then
Result := (ATarget.NodeKind in [TBizObjectKind.boFolder, TBizObjectKind.boPositionRoot]) and TCommonFunc.isSubNode('Org:\Position', ATarget.BizURL.FileName)
else
Result := False;
TBizobjectKind.boPerson://人员节点可以自由的移动到任何人员根节点的文件夹或是人员根节点下
Result := (ATarget.NodeKind in [TBizObjectKind.boFolder, TBizObjectKind.boPersonRoot]) and TCommonFunc.isSubNode('Org:\Person', ATarget.BizURL.FileName);
TBizObjectKind.boPersonMember:
Result := (ATarget.NodeKind in [TBizObjectKind.boPositionMember]) and not Assigned(Org.OrgSys.OrgSystem.FindUnit(ATarget.Parent.BizURL.ID, ATarget.BizURL.ID, BizURL.ID));
TBizObjectKind.boWorkGroup:
Result := ATarget.NodeKind in [TBizObjectKind.boOrgan];
else
Result := False;
end;
end;
static procedure TBatchOperate.OperateA(ATarget: TBizURL; AItems: TStrings; AOperateType: TOperateType);
begin
with TBatchOperate.Create do
try
OperateItems.Assign(AItems);
OperateType := AOperateType;
Operate(ATarget);
finally
Free;
end;
end;
procedure TMAINFORM.actMoveToExecute(Sender: TObject);
var
lURL: String;
lBizURL: TBizURL;
lCanNotSelURLs, lChildren, lNodes: TStrings;
lSelected: Boolean;
I: Integer;
lCurrURL: TBizURL;
lNode: TBizNode;
begin
lCanNotSelURLs := TStringList.Create;
lChildren := TStringList.Create;
lNodes := TStringList.Create;
lCurrURL := TBizURL.Create;
lBizURL := TBizURL.Create;
try
lCurrURL.Assign(CurrentBizNode.BizURL);
if Assigned(CurrentBizNode.Parent) then
lCanNotSelURLs.Add(CurrentBizNode.Parent.BizURL.URL);
lCanNotSelURLs.Add(CurrentBizNode.BizURL.URL);
case CurrentBizNode.NodeKind of
TBizObjectKind.boOrgan, TBizObjectKind.boWorkGroup: begin
BizTree.BizTreeStructure.GetChildrenByKindsString(CurrentBizNode.GUID, lChildren, True, '.ogn');
for I := 0 to lChildren.Count - 1 do
lCanNotSelURLs.Add(TBizNode(lChildren.Objects[I]).BizURL.URL);
lSelected := TOrgLib.SelectOrgan(Context, lCanNotSelURLs, FDeptManager, lURL);
end;
TBizObjectKind.boDept: begin
BizTree.BizTreeStructure.GetChildrenByKindsString(CurrentBizNode.GUID, lChildren, True, '.dpt');
for I := 0 to lChildren.Count - 1 do
lCanNotSelURLs.Add(TBizNode(lChildren.Objects[I]).BizURL.URL);
lSelected := TOrgLib.SelectDeptOrOrgan(Context, lCanNotSelURLs, FDeptManager, lURL);
end;
TBizObjectKind.boFolder: begin
if TCommonFunc.isSubNode('Org:\Position', CurrentBizNode.BizURL.FileName) then
begin
BizTree.BizTreeStructure.GetChildrenByKindsString(CurrentBizNode.GUID, lChildren, True, '');
for I := 0 to lChildren.Count - 1 do
lCanNotSelURLs.Add(TBizNode(lChildren.Objects[I]).BizURL.URL);
lSelected := TOrgLib.SelectPositionFolder(Context, lCanNotSelURLs, FDeptManager, lURL)
end
else
lSelected := False;
end;
TBizObjectKind.boPositionMember: lSelected := TOrgLib.SelectDept(Context, lCanNotSelURLs, FDeptManager, lURL);
TBizObjectKind.boPersonMember: lSelected := TOrgLib.SelectPositionMember(Context, lCanNotSelURLs, FDeptManager, lURL);
TBizObjectKind.boPosition: lSelected := TOrgLib.SelectPositionFolder(Context, lCanNotSelURLs, FDeptManager, lURL);
TBizObjectKind.boPerson: lSelected := TOrgLib.SelectPersonFolder(Context, lCanNotSelURLs, FDeptManager, lURL);
else
lSelected := False;
end;
if lSelected then
begin
lBizURL.URL := lURL;
lNode := BizTree.BizTreeStructure.FindNodeByBizURL(lCurrURL);
lNodes.AddObject(lNode.GUID, lNode);
TBatchOperate.OperateA(lBizURL, lNodes, TOperateType.optMove);
lNode := BizTree.BizTreeStructure.FindNodeByBizURL(lBizURL);
if OrgViewStyle = TOrgViewStyle.ovsTreeView then
begin
otvOrgTreeView.Find(lNode.GUID, True).Selected := True;
otvOrgTreeView.Selected.Expanded := True;
end
else
begin
ocOrgChart.Find(lNode.GUID, True).Selected := True;
ocOrgChart.Selected.Expanded := True;
end;
TCommonFunc.OrgChanged;
end;
finally
lBizURL.Free;
lCurrURL.Free;
lNodes.Free;
lChildren.Free;
lCanNotSelURLs.Free;
end;
end;
procedure TMAINFORM.actPasteExecute(Sender: TObject);
begin
FBatchOperate.Operate(CurrentBizNode.BizURL);
TCommonFunc.OrgChanged;
if Assigned(FCutNode) then
begin
FCutNode.Cut := False;
FCutNode := nil;
end;
end;
procedure TMAINFORM.actCutExecute(Sender: TObject);
var
I: integer;
lNode: TTreeNode;
begin
for I := 0 to FBatchOperate.OperateItems.Count - 1 do
begin
if OrgViewStyle = TOrgViewStyle.ovsTreeView then //Chart上没有相应的处理
lNode := otvOrgTreeView.Find(TBizNode(FBatchOperate.OperateItems.Objects[I]).GUID, True);
if Assigned(lNode) then
lNode.Cut := False;
end;
FBatchOperate.OperateItems.Clear;
FBatchOperate.OperateItems.Assign(CurrentBizNodes);
FBatchOperate.OperateType := TOperateType.optMove;
FCutNode := otvOrgTreeView.Selected;
FCutNode.Cut := True;
end;
procedure TMAINFORM.actCopyExecute(Sender: TObject);
begin
FBatchOperate.OperateItems.Assign(CurrentBizNodes);
FBatchOperate.OperateType := TOperateType.optCopy;
end;
procedure TMAINFORM.SpeedButton8Click(Sender: TObject);
begin
jsDialogs.ShowMsg(CurrentBizNode.ObjectKind, '');
end;
//**********************************$$$$$$$$$$$$$$$$$$$$$$$$$
//**********************************$$$$$$$$$$$$$$$$$$$$$$$$$
procedure TMAINFORM.actDeleteUpdate(Sender: TObject);
begin
//jsDialogs.showmsg('actDeleteUpdate', 'aa');
//if (CurrentBizNode <> nil) and (CurrentBizNode.ID <> '') then
//if canchange then
TAction(Sender).Enabled := Assigned(CurrentBizNode) and not ((Sender = actNoUsing) and (CurrentBizNode.NodeKind = TBizObjectKind.boWorkGroupMember)) and
(not (CurrentBizNode.NodeKind in [TBizObjectKind.boServer, TBizObjectKind.boOrgRoot, TBizObjectKind.boOrgServer, TBizObjectKind.boPersonRoot, TBizObjectKind.boPositionRoot])) and FDeptManager.IsCanOperateFile(CurrentBizNode.BizURL.FileName) and not isPersonFolder(CurrentBizNode);
end;
procedure TMAINFORM.actDeleteExecute(Sender: TObject);
var
lRefresh: Boolean;
begin
lRefresh := CurrentBizNode.NodeKind in [TBizObjectKind.boPerson, TBizObjectKind.boPosition];
BizSysUtils.DeleteBizObject(CurrentBizNodes, True);
if lRefresh then //由于岗位和人员删除时同时删除的其成员,但没有通知到组织机构的缓存中所以要刷新一下。
Org.OrgSys.OrgSystem.RefreshCache;
FDeptManager.ReloadOrgURLs;
TCommonFunc.OrgChanged;
end;
procedure TMAINFORM.actTreeExecute(Sender: TObject);
begin
OrgViewStyle := TOrgViewStyle(TAction(Sender).Tag);
ToolButton1.Down := False;
end;
//**********************************$$$$$$$$$$$$$$$$$$$$$$$$$
//**********************************$$$$$$$$$$$$$$$$$$$$$$$$$
procedure TMAINFORM.actCopyUpdate(Sender: TObject);
begin
//jsDialogs.showmsg('actCopyUpdate', 'aa');
//if (CurrentBizNode <> nil) and (CurrentBizNode.ID <> '') then
//if canchange then
TAction(Sender).Enabled := Assigned(CurrentBizNode) and (not (CurrentBizNode.NodeKind in TCommonFunc.ForbidCopyKind)) and FDeptManager.IsCanOperateFile(CurrentBizNode.BizURL.FileName)and not isPersonFolder(CurrentBizNode);
end;
//**********************************$$$$$$$$$$$$$$$$$$$$$$$$$
//**********************************$$$$$$$$$$$$$$$$$$$$$$$$$
procedure TMAINFORM.actCutUpdate(Sender: TObject);
begin
//jsDialogs.showmsg('actCutUpdate', 'aa');
//if (CurrentBizNode <> nil) and (CurrentBizNode.ID <> '') then
//if canchange then
TAction(Sender).Enabled := Assigned(CurrentBizNode) and (not (CurrentBizNode.NodeKind in BizForbidCutKinds)) and FDeptManager.IsCanOperateFile(CurrentBizNode.BizURL.FileName) and not isPersonFolder(CurrentBizNode);
end;
//**********************************$$$$$$$$$$$$$$$$$$$$$$$$$
//**********************************$$$$$$$$$$$$$$$$$$$$$$$$$
procedure TMAINFORM.actPasteUpdate(Sender: TObject);
begin
//jsDialogs.showmsg('actPasteUpdate', 'aa');
//if (CurrentBizNode <> nil) and (CurrentBizNode.ID <> '') then
//if canchange then
TAction(Sender).Enabled := Assigned(CurrentBizNode) and FBatchOperate.CanPaste(CurrentBizNode) and FDeptManager.IsCanOperateFile(CurrentBizNode.BizURL.FileName);
end;
procedure TMAINFORM.actImportIntoImgUpdate(Sender: TObject);
begin
TAction(Sender).Enabled := OrgViewStyle <> TOrgViewStyle.ovsTreeView;
end;
procedure TMAINFORM.actImportIntoImgExecute(Sender: TObject);
begin
if SaveDialog.Execute then
begin
case SaveDialog.FilterIndex of
1: ocOrgChart.SaveToBitmap(SaveDialog.FileName);
2: ocOrgChart.SaveToMetaFile(SaveDialog.FileName);
end;
end;
end;
//************************************************************************$$$$$$$$$$$$$$$$$$$$$$$$$
//*****************************************************$$$$$$$$$$$$$$$$$$$$$$$$$
//*****************************************************$$$$$$$$$$$$$$$$$$$$$$$$$
procedure TMAINFORM.actUpUpdate(Sender: TObject);
begin
TAction(Sender).Enabled := Assigned(CurrentBizNode) and Assigned(CurrentBizNode.Parent) and not (CurrentBizNode.NodeKind in [TBizObjectKind.boOrgRoot, TBizObjectKind.boPositionRoot, TBizObjectKind.boPersonRoot]);
end;
procedure TMAINFORM.actUpExecute(Sender: TObject);
begin
if OrgViewStyle = TOrgViewStyle.ovsTreeView then
begin
if Assigned(otvOrgTreeview.Selected.Parent) then
otvOrgTreeView.Selected := otvOrgTreeview.Selected.Parent;
end else begin
if Assigned(ocOrgChart.Selected.Parent) then
ocOrgChart.Selected := ocOrgChart.Selected.Parent;
end;
end;
procedure TMAINFORM.OrgComboBoxCloseUp(Sender: TObject; Accept: Boolean);
begin
if Accept then
ocOrgChart.FileName := OrgComboBox.FileName;
end;
procedure TMAINFORM.SetIsDept;
begin
FDeptManager.Enabled := False;
end;
procedure TMAINFORM.doInitRoot;
begin
otvOrgTreeView.ShowOptions := [TBizObjectKind.boBizServer, TBizObjectKind.boDept,
TBizObjectKind.boFolder,
TBizObjectKind.boOrgan, TBizObjectKind.boOrgRoot, TBizObjectKind.boOrgServer,
TBizObjectKind.boPersonRoot, TBizObjectKind.boPerson, TBizObjectKind.boPersonMember,
TBizObjectKind.boPositionRoot, TBizObjectKind.boPosition, TBizObjectKind.boPositionMember,
TBizObjectKind.boWorkGroup, TBizObjectKind.boWorkGroupMember];
olvOrgView.ShowOptions := otvOrgTreeView.ShowOptions;
TCommonFunc.InitTreeByRootFileName(otvOrgTreeView, ['Org:\Root', 'Org:\Position', 'Org:\Person']);
end;
procedure TMAINFORM.OnOrgNodeInserting(Sender: TObject; ANode: TBaseNode; var Allow: Boolean);
begin
Allow := FDeptManager.isOnAllManagedOrgTree(TBizNode(ANode).BizURL.FileName) or FDeptManager.isOnManagedPersonFiles(TBizNode(ANode).BizURL.FileName);
end;
function TMAINFORM.isPersonFolder(ANode: TBizNode): Boolean;
begin
Result := (ANode.NodeKind = TBizObjectKind.boFolder) and isSubNode('Org:\Person', ANode);
end;
//*********************************************
//*********************************************
procedure TMAINFORM.actManagerUpdate(Sender: TObject);
begin
//jsDialogs.showmsg('actManagerUpdate', 'aa');
//if (CurrentBizNode <> nil) and (CurrentBizNode.ID <> '') then
//if canchange then
TAction(Sender).Enabled := Assigned(CurrentBizNode) and (CurrentBizNode.NodeKind in [TBizObjectKind.boOrgan, TBizObjectKind.boDept, TBizObjectKind.boPositionMember, TBizObjectkind.boPosition]) and FDeptManager.IsCanOperateFile(CurrentBizNode.BizURL.FileName);
end;
procedure TMAINFORM.actManagerExecute(Sender: TObject);
begin
TOrgLib.AssignManagerToOrg(Context, CurrentBizNode.BizURL, FDeptManager);
end;
procedure TMAINFORM.actNoUsingBrowseExecute(Sender: TObject);
begin
TOrgLib.BrowseNoUsingOrgs(Context, FDeptManager);
end;
procedure TMAINFORM.actNoUsingExecute(Sender: TObject);
begin
if jsDialogs.MsgBox(0, SysUtils.Format('禁用“%s[%s]”,禁用后可以在工具菜单下的浏览禁用中找到它。', [CurrentBizNode.DisplayName, CurrentBizNode.BizURL.ID]) + #13 + '确实要禁用么?', '提示', Borland.Delphi.Windows.MB_OKCancel + Borland.Delphi.Windows.MB_ICONQuestion) = Borland.Delphi.Windows.ID_Cancel then Exit;
if CurrentBizNode.NodeKind in [TBizObjectKind.boWorkGroupMember] then
BizSysUtils.DeleteMember(TBizNode(CurrentBizNodes.Objects[0]))
else
BizSys.BizSystem.DeleteObject(CurrentBizNode.BizURL.URL, []);
FDeptManager.ReloadOrgURLs;
TCommonFunc.OrgChanged;
end;
procedure TMAINFORM.otvOrgTreeViewKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
if actDelete.Enabled and (Key = Borland.Delphi.Windows.VK_DELETE) then
if (Borland.Delphi.Windows.GetKeyState(Borland.Delphi.Windows.VK_SHIFT) and 128 = 128) then
actDelete.Execute
else
actNoUsing.Execute;
end;
procedure TMAINFORM.actPropertyUpdate(Sender: TObject);
begin
TAction(Sender).Enabled := Assigned(CurrentBizNode) and (CurrentBizNode.NodeKind <> TBizObjectKind.boWorkGroupMember);
end;
procedure TMAINFORM.actWorkGroupMemberExecute(Sender: TObject);
var
lExpand: Boolean;
begin
if TOrgLib.AssignWorkGroupMember(Context, CurrentBizNode.BizURL, FDeptManager) then
begin
if OrgViewStyle = TOrgViewStyle.ovsTreeView then
lExpand := otvOrgTreeView.Selected.Expanded
else
lExpand := ocorgChart.Selected.Expanded;
actRefreshExecute(actRefresh);
if OrgViewStyle = TOrgViewStyle.ovsTreeView then
otvOrgTreeView.Selected.Expanded := lExpand
else
ocorgChart.Selected.Expanded := lExpand;
end;
end;
//*********************************************
//*********************************************
procedure TMAINFORM.actWorkGroupMemberUpdate(Sender: TObject);
begin
//jsDialogs.showmsg('actWorkGroupMemberUpdate', 'aa');
//if (CurrentBizNode <> nil) and (CurrentBizNode.ID <> '') then
//if canchange then
TAction(Sender).Enabled := Assigned(CurrentBizNode) and (CurrentBizNode.NodeKind in [TBizObjectKind.boWorkGroup]) and FDeptManager.IsCanOperate(CurrentBizNode.BizURL.URL);
end;
//*********************************************
//*********************************************
//*****************************************************
procedure TMAINFORM.otvOrgTreeViewChange(Sender: TObject; Node: TTreeNode);
begin
if Assigned(Node) then
begin
OrgComboBox.FileName := TBizNode(Node.Data).BizURL.FileName;
end;
end;
procedure TMAINFORM.ocOrgChartChange(Sender: TObject; Node: TOrgChartNode);
begin
try
if Assigned(Node) then
OrgComboBox.FileName := TBizNode(Node.Data).BizURL.FileName;
except
//do nothing
end;
end;
procedure TMAINFORM.actRefreshCacheExecute(Sender: TObject);
begin
TCommonFunc.EnsureChanged;
end;
procedure TMAINFORM.actSetSubNodeSquenceUpdate(Sender: TObject);
begin
TAction(Sender).Enabled := Assigned(CurrentBizNode) and not (CurrentBizNode.NodeKind in [TBizObjectKind.boPerson, TBizObjectKind.boPersonMember, TBizObjectKind.boPosition, TBizObjectKind.boWorkGroup]) and (FDeptManager.IsCanOperate(CurrentBizURL));
end;
procedure TMAINFORM.actSetSubNodeSquenceExecute(Sender: TObject);
begin
if TOrgLib.SetSubNodeSquence(Context, CurrentBizNode.BizURL) then
actRefreshExecute(actRefresh);
end;
procedure TMAINFORM.actRefreshUpdate(Sender: TObject);
begin
TAction(Sender).Enabled := Assigned(CurrentBizNode);
end;
procedure TMAINFORM.actUpNodeExecute(Sender: TObject);
begin
if OrgViewStyle = TOrgViewStyle.ovsTreeView then
otvOrgTreeView.MoveUpNode(otvOrgTreeView.Selected, iMoveStep)
else
ocOrgChart.MoveUpNode(ocOrgChart.Selected, iMoveStep);
end;
procedure TMAINFORM.actDownNodeExecute(Sender: TObject);
begin
if OrgViewStyle = TOrgViewStyle.ovsTreeView then
otvOrgTreeView.MoveDownNode(otvOrgTreeView.Selected, iMoveStep)
else
ocOrgChart.MoveDownNode(ocOrgChart.Selected, iMoveStep);
end;
end. |