146 lines
4.0 KiB
ObjectPascal
146 lines
4.0 KiB
ObjectPascal
![]() |
unit U_LeftHelptree;
|
|||
|
|
|||
|
interface
|
|||
|
|
|||
|
uses
|
|||
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|||
|
Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData,
|
|||
|
cxDataStorage, cxEdit, DB, cxDBData, cxGridLevel, cxGridCustomTableView,
|
|||
|
cxGridTableView, cxGridDBTableView, cxClasses, cxControls,
|
|||
|
cxGridCustomView, cxGrid, ADODB, ExtCtrls, StdCtrls;
|
|||
|
|
|||
|
type
|
|||
|
TframeLeftHelpTree = class(TFrame)
|
|||
|
cxGridt1: TcxGrid;
|
|||
|
tt1: TcxGridDBTableView;
|
|||
|
tt1codeName: TcxGridDBColumn;
|
|||
|
cleveltt1: TcxGridLevel;
|
|||
|
DS_LTree: TDataSource;
|
|||
|
ADOQueryLTree: TADOQuery;
|
|||
|
Panel1: TPanel;
|
|||
|
tt1ParentCodeName: TcxGridDBColumn;
|
|||
|
cxStyleRepository1: TcxStyleRepository;
|
|||
|
cxStyle1: TcxStyle;
|
|||
|
cxStyle2: TcxStyle;
|
|||
|
cxStyle_gridRow: TcxStyle;
|
|||
|
cxStyle_gridFoot: TcxStyle;
|
|||
|
cxStyle_gridHead: TcxStyle;
|
|||
|
cxStyle_gridGroupBox: TcxStyle;
|
|||
|
cxStyle_yellow: TcxStyle;
|
|||
|
cxStyle_Red: TcxStyle;
|
|||
|
cxStyle_fontred: TcxStyle;
|
|||
|
cxStyle_fontBlue: TcxStyle;
|
|||
|
ComboBox1: TComboBox;
|
|||
|
Edit1: TEdit;
|
|||
|
procedure tt1FocusedRecordChanged(Sender: TcxCustomGridTableView;
|
|||
|
APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord;
|
|||
|
ANewItemRecordFocusingChanged: Boolean);
|
|||
|
procedure Edit1Change(Sender: TObject);
|
|||
|
private
|
|||
|
{ Private declarations }
|
|||
|
public
|
|||
|
fLeftSelValue:string;
|
|||
|
fLeftSelCaption:string;
|
|||
|
procedure DoLeftFilter();
|
|||
|
procedure InitLTree(fromADOQ:TADOQuery;mTreeCaption:string;
|
|||
|
mTreeKind,mTreeFlag,mOtherWhere:string;autoExpand:boolean);
|
|||
|
end;
|
|||
|
|
|||
|
implementation
|
|||
|
|
|||
|
{$R *.dfm}
|
|||
|
/////////////////////////////////////////
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
//<2F><>ʾ<EFBFBD><CABE>ʽ<EFBFBD><CABD>
|
|||
|
//mTreeCaption:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
//mTreeKind <20>ͻ<EFBFBD><CDBB><EFBFBD>Ա<EFBFBD><D4B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̨<EFBFBD><CCA8><EFBFBD><EFBFBD>
|
|||
|
//mTreeFlag; <20><><EFBFBD>ֿͻ<D6BF><CDBB><EFBFBD><EFBFBD>ľ<EFBFBD><C4BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ű<EFBFBD>־
|
|||
|
//mOtherWhere:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
//autoExpand<6E><64><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7>Զ<EFBFBD>չ<EFBFBD><D5B9>
|
|||
|
/////////////////////////////////////////
|
|||
|
procedure TframeLeftHelpTree.InitLTree(fromADOQ:TADOQuery;mTreeCaption:string;
|
|||
|
mTreeKind,mTreeFlag,mOtherWhere:string;autoExpand:boolean);
|
|||
|
begin
|
|||
|
{
|
|||
|
if mTreeCaption<>'' then
|
|||
|
begin
|
|||
|
Panel1.caption:=trim(mTreeCaption);
|
|||
|
Panel1.Visible :=true;
|
|||
|
end;
|
|||
|
}
|
|||
|
//if autoExpand then
|
|||
|
TT1.DataController.Options:=[dcoGroupsAlwaysExpanded];
|
|||
|
//else
|
|||
|
// TT1.DataController.Options:=[];
|
|||
|
try
|
|||
|
ADOQueryLTree.Connection:=fromADOQ.Connection;
|
|||
|
ADOQueryLTree.DisableControls ;
|
|||
|
with ADOQueryLTree do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.clear;
|
|||
|
sql.Add('exec P_Get_WinLeftTree');
|
|||
|
sql.Add(quotedStr(mTreeKind));
|
|||
|
sql.Add(','+quotedStr(mTreeflag));
|
|||
|
sql.Add(','+quotedStr(mOtherWhere));
|
|||
|
Open;
|
|||
|
end;
|
|||
|
ADOQueryLTree.EnableControls;
|
|||
|
except
|
|||
|
application.MessageBox(pchar('<27><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>'+mTreeCaption+'<27><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!'),'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ',0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
procedure TframeLeftHelpTree.tt1FocusedRecordChanged(
|
|||
|
Sender: TcxCustomGridTableView; APrevFocusedRecord,
|
|||
|
AFocusedRecord: TcxCustomGridRecord;
|
|||
|
ANewItemRecordFocusingChanged: Boolean);
|
|||
|
begin
|
|||
|
if (tt1.Controller.FocusedRow is TcxGridGroupRow) then
|
|||
|
begin
|
|||
|
fLeftSelValue:='';
|
|||
|
fLeftSelCaption:='';
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
fLeftSelValue:=trim(ADOQueryLTree.fieldByName('code').AsString) ;
|
|||
|
fLeftSelCaption:=trim(ADOQueryLTree.fieldByName('codeName').AsString) ;
|
|||
|
end;
|
|||
|
end;
|
|||
|
///////////////////////////////////////////////////////////////
|
|||
|
procedure TframeLeftHelpTree.DoLeftFilter();
|
|||
|
var
|
|||
|
mfilterStr:string;
|
|||
|
begin
|
|||
|
//<2F><><EFBFBD><EFBFBD>
|
|||
|
if (ComboBox1.ItemIndex=0) and (trim(edit1.Text) <>'') then
|
|||
|
begin
|
|||
|
mfilterStr:='codeName like '+quotedStr('%'+trim(edit1.Text)+'%');
|
|||
|
end;
|
|||
|
//<2F><><EFBFBD><EFBFBD>
|
|||
|
if (ComboBox1.ItemIndex=1) and (trim(edit1.Text) <>'') then
|
|||
|
begin
|
|||
|
mfilterStr:='code like '+quotedStr('%'+trim(edit1.Text)+'%');
|
|||
|
end;
|
|||
|
try
|
|||
|
ADOQueryLTree.DisableControls ;
|
|||
|
with ADOQueryLTree do
|
|||
|
begin
|
|||
|
filtered:=false;
|
|||
|
if trim(mfilterStr)<>'' then
|
|||
|
begin
|
|||
|
filter:=mfilterStr;
|
|||
|
filtered:=true;
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
ADOQueryLTree.EnableControls;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TframeLeftHelpTree.Edit1Change(Sender: TObject);
|
|||
|
begin
|
|||
|
DoLeftFilter();
|
|||
|
end;
|
|||
|
|
|||
|
end.
|