unit Assist_Dept;
interface
uses
Business.System, Business.Forms,OrgLib,Business.Model;
type
TAssist_Dept = class(TForm)
otvDept: TOrgTreeView;
btnSubmit: TBitBtn;
btnCancel: TBitBtn;
procedure BizFormShow(Sender: TObject);
procedure btnSubmitClick(Sender: TObject);
procedure otvDeptInserting(Sender: TObject; ANode: TBaseNode; var Allow: Boolean);
procedure btnCancelClick(Sender: TObject);
private
{private declarations}
FNodes: TStrings;
public
{public declarations}
end;
implementation
procedure TAssist_Dept.BizFormShow(Sender: TObject);
begin
FNodes := TStringList.Create;
otvDept.ShowOptions := [TBizObjectKind.boBizServer,TBizObjectKind.boDept,
TBizObjectKind.boFolder,TBizObjectKind.boOrgan, TBizObjectKind.boOrgServer,
TBizObjectKind.boWorkGroup, TBizObjectKind.boWorkGroupMember];
Tcommonfunc.InitTreeByRootFileName(otvDept,['Org:\ROOT\0BJ.ogn']);
otvDept.AddStartWith('Org:\ROOT\2SHFS.ogn');
otvDept.ReloadTree;
end;
procedure TAssist_Dept.btnSubmitClick(Sender: TObject);
var
i : integer;
tmparr : Array of char;
strarr : Array of string;
tmpNode : TBizNode;
begin
SetLength(tmparr,1);
tmparr[0] :=#10;
strarr := otvDept.SelectedNodes.Text.Split(tmparr);
for i := 0 to Length(strarr) -1 do
jsdialogs.ShowError(otvDept.SelectedNodes.Text ,strarr);
tmpNode :=otvDept.SelectedNode;
while (tmpNode.Parent.ID <> 'ROOT') do
begin
jsdialogs.ShowError(tmpNode.Parent.ID,tmpNode.Parent.DisplayName);
tmpNode := tmpNode.Parent;
end;
end;
procedure TAssist_Dept.otvDeptInserting(Sender: TObject; ANode: TBaseNode; var Allow: Boolean);
begin
Allow := FNodes.IndexOfObject(ANode) <> -1;
end;
procedure TAssist_Dept.btnCancelClick(Sender: TObject);
var
lNodes1, lNodes2: TStrings;
lNode: TBizNode;
i: Integer;
begin
lNodes1 := TStringList.Create;
lNodes2 := TStringList.Create;
lNode := BizTree.BizTreeStructure.FindNodeByBizURL(otvDept.SelectedNode.BizURL);
lNodes2.AddObject(lNode.GUID, lNode);
BizTree.BizTreeStructure.GetNodesTreeList(lNodes2, lNodes1, False,
False, True, True);
for i:=0 to lNodes1.Count-1 do
begin
if FNodes.IndexOf(TBizNode(lNodes1.Objects).BizURL.URL)<0 then
FNodes.AddObject(TBizNode(lNodes1.Objects).BizURL.URL, lNodes1.Objects);
end;
otvDept.AddStartWithOrgRoot;
otvDept.ReloadTree;
end;
end.
看看有什么问题吧, |