升级更新

This commit is contained in:
sgwp 2025-02-07 13:34:37 +08:00
parent e55a048149
commit 4315c948ef
9 changed files with 351 additions and 81 deletions

View File

@ -59,7 +59,7 @@ inherited frmZDYHelp: TfrmZDYHelp
PropertiesClassName = 'TcxTextEditProperties' PropertiesClassName = 'TcxTextEditProperties'
Properties.OnEditValueChanged = V1NamePropertiesEditValueChanged Properties.OnEditValueChanged = V1NamePropertiesEditValueChanged
HeaderAlignmentHorz = taCenter HeaderAlignmentHorz = taCenter
Width = 463 Width = 325
end end
object V1Note: TcxGridDBColumn object V1Note: TcxGridDBColumn
Caption = #22791#27880 Caption = #22791#27880

View File

@ -654,8 +654,8 @@ end;
procedure TfrmZDYHelp.FormDestroy(Sender: TObject); procedure TfrmZDYHelp.FormDestroy(Sender: TObject);
begin begin
// inherited; inherited;
//WriteCxGrid('自定义' + Trim(flag), TV1, '自定义数据'); WriteCxGrid('自定义' + Trim(flag), TV1, '自定义数据');
frmZDYHelp := nil; frmZDYHelp := nil;
end; end;

View File

@ -7,6 +7,7 @@ uses
cxContainer, cxShellTreeView, cxShellListView, StdCtrls, BtnEdit, cxContainer, cxShellTreeView, cxShellListView, StdCtrls, BtnEdit,
OleCtnrs, DB, ADODB,ZLib; OleCtnrs, DB, ADODB,ZLib;
function InitDevCxGridCombobox(ADOQueryTmp: TADOQuery; ComboBoxProperties: TcxComboBoxProperties; mFlag: string): Boolean;
function InitDevCombobox(ADOQueryTmp: TADOQuery; combobox: TcxCombobox; mFlag: string; selFlag:Boolean=true): Boolean; function InitDevCombobox(ADOQueryTmp: TADOQuery; combobox: TcxCombobox; mFlag: string; selFlag:Boolean=true): Boolean;
implementation implementation
@ -35,6 +36,7 @@ begin
application.MessageBox(PWideChar('未定义等级对应的字段字典数据(' + mFlag + ')'),'',0); application.MessageBox(PWideChar('未定义等级对应的字段字典数据(' + mFlag + ')'),'',0);
Exit; Exit;
end; end;
combobox.Properties.BeginUpdate;
combobox.Properties.Items.Clear; combobox.Properties.Items.Clear;
first; first;
while not eof do while not eof do
@ -46,6 +48,45 @@ begin
begin begin
combobox.ItemIndex:=0; combobox.ItemIndex:=0;
end; end;
combobox.Properties.EndUpdate();
end;
except
raise Exception.Create(PWideChar('获取等级字段字典数据(' + mFlag + ')时,发生错误!'));
end;
end;
//////////////////////////////////////////////////////////////
///
function InitDevCxGridCombobox(ADOQueryTmp: TADOQuery; ComboBoxProperties: TcxComboBoxProperties; mFlag: string): Boolean;
begin
Result := false;
try
with ADOQueryTmp do
begin
close;
sql.Clear;
sql.Add('select a.itemText from SY_Dict_Item a');
sql.Add(' inner join SY_Dict b on b.dictId=a.dictId');
sql.Add(' where b.dictcode='+QuotedStr(mFlag));
sql.Add('and a.valid=1 and b.valid=1');
sql.Add('order by b.sortorder');
Open;
if IsEmpty then
begin
application.MessageBox(PWideChar('未定义等级对应的字段字典数据(' + mFlag + ')'),'',0);
Exit;
end;
ComboBoxProperties.Items.Clear;
first;
while not eof do
begin
ComboBoxProperties.Items.Add(trim(FieldByName('itemText').AsString));
next;
end;
end; end;
except except

View File

@ -12,7 +12,7 @@ uses
cxGridExportLink, ExtCtrls, Buttons, DBClient, RTComboBox, cxDropDownEdit, cxGridExportLink, ExtCtrls, Buttons, DBClient, RTComboBox, cxDropDownEdit,
cxGridBandedTableView, cxGridDBBandedTableView, cxRichEdit, cxButtonEdit, cxGridBandedTableView, cxGridDBBandedTableView, cxRichEdit, cxButtonEdit,
IniFiles, WinSock, IdHTTP, dxcore, cxTextEdit, FireDAC.Comp.Client, cxCheckBox, IniFiles, WinSock, IdHTTP, dxcore, cxTextEdit, FireDAC.Comp.Client, cxCheckBox,
Vcl.Clipbrd, cxMemo, dxLayoutControl, uSZHN_JSON, System.JSON; Vcl.Clipbrd, cxMemo, dxLayoutControl,uSZHN_JSON, System.JSON;
type type
TA = class(TComponent) TA = class(TComponent)
@ -52,8 +52,6 @@ function RoundFloat(f: double; i: Integer): double;
{CDS赋值 }procedure SInitCDSData(fromADO: TADOQuery; toCDS: TclientDataSet); {CDS赋值 }procedure SInitCDSData(fromADO: TADOQuery; toCDS: TclientDataSet);
{终极刷新 }procedure InitCDSData(ADO1: TADOQuery; CDS1: TclientDataSet; Tv1: TcxGridDBTableView; SqlStr, FilterStr, MarkStr: string); {终极刷新 }procedure InitCDSData(ADO1: TADOQuery; CDS1: TclientDataSet; Tv1: TcxGridDBTableView; SqlStr, FilterStr, MarkStr: string);
{ÖÕ¼«¹ýÂË }procedure CDSDataFilter(ADO1: TADOQuery; CDS1: TclientDataSet; Tv1: TcxGridDBTableView; JsonArgs: string);
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
// **************** 刷新 ADO CDS TV *****************// // **************** 刷新 ADO CDS TV *****************//
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
@ -187,14 +185,17 @@ procedure SelOKNo(CDS_MainSel: TclientDataSet; FSel: Boolean); // ȫѡ/ȫ
procedure SelOKNoFiler(Tv1: TcxGridDBTableView; FSel: Boolean); // Tv1全选/全弃 procedure SelOKNoFiler(Tv1: TcxGridDBTableView; FSel: Boolean); // Tv1全选/全弃
//йýÂË·½·¨ function isCanDataDelete(mFillerId:string='';mfiller:string=''):boolean;
function isCanDataEdit(mFillerId:string='';mfiller:string=''):boolean;
//新过滤方法
function CommonFiltersByContainer(TMControl: TControl; JsonArgs: string): string; function CommonFiltersByContainer(TMControl: TControl; JsonArgs: string): string;
function CommonFiltersByTv(Tv1: TcxGridDBTableView; JsonArgs: string): string; function CommonFiltersByTv(Tv1: TcxGridDBTableView; JsonArgs: string): string;
function CommonGetSingleFilter(MyControl: TControl; EquTag, LikeTag, FieldTag: Integer; MFields: TStringList): string; function CommonGetSingleFilter(MyControl: TControl; EquTag, LikeTag, FieldTag: Integer; MFields: TStringList): string;
procedure SelTVToCDS(Tv1: TcxGridDBTableView; CDS1: TclientDataSet; KeyId: string); // 通过KeyId将Tv1选择映射到CDS1 procedure SelTVToCDS(Tv1: TcxGridDBTableView; CDS1: TclientDataSet; KeyId: string); // 通过KeyId将Tv1选择映射到CDS1
function SelCDSKey(CDS_1: TclientDataSet; Keys: TArray<string>): TArray<string>; // 返回选择列key function SelCDSKey(CDS_1: TclientDataSet; Keys: TArray<string>): TArray<string>; // 返回选择列key
@ -230,6 +231,9 @@ procedure LRTSetsavedata(ADOQueryCmd: TADOQuery; MyTable: string; Myparent: TdxL
function SLGetFilters(layoutControl: TdxLayoutControl; EquTag, LikeTag: Integer): string; function SLGetFilters(layoutControl: TdxLayoutControl; EquTag, LikeTag: Integer): string;
procedure InitAdoData(ADO1: TADOQuery; Tv1: TcxGridDBTableView; SqlStr, FilterStr, MarkStr: string); procedure InitAdoData(ADO1: TADOQuery; Tv1: TcxGridDBTableView; SqlStr, FilterStr, MarkStr: string);
{终极过滤 }procedure CDSDataFilter(ADO1: TADOQuery; CDS1: TclientDataSet; Tv1: TcxGridDBTableView; JsonArgs: string); overload;
{终极过滤 }procedure CDSDataFilter(ADO1: TADOQuery; CDS1: TclientDataSet; Tv1: TcxGridDBBandedTableView; JsonArgs: string); overload
// **************** 师爷写的 *****************// // **************** 师爷写的 *****************//
type type
@ -251,22 +255,6 @@ implementation
uses uses
U_DataLink, U_globalVar; U_DataLink, U_globalVar;
procedure CDSDataFilter(ADO1: TADOQuery; CDS1: TclientDataSet; Tv1: TcxGridDBTableView; JsonArgs: string);
var
JSONObject: TJSONObject;
begin
JSONObject := TJSONObject.ParseJSONValue(JsonArgs) as TJSONObject;
if ADO1.Active then
begin
Tv1.BeginUpdate();
SDofilter(ADO1, JSONObject.S['FilterStr']);
SCreateCDS(ADO1, CDS1);
SInitCDSData(ADO1, CDS1);
Tv1.EndUpdate;
end;
end;
/// ///////////////////////////////////////// /// /////////////////////////////////////////
/// /************获取过滤条件***********///// /// /************获取过滤条件***********/////
@ -1575,10 +1563,10 @@ begin
end end
else if Controls[i] is TcxDateEdit then else if Controls[i] is TcxDateEdit then
begin begin
if trim(TcxDateEdit(Controls[i]).Text) <> '' then if trim(TcxDateEdit(Controls[i]).Text)<>'' then
ADOQueryCmd.fieldByName(Controls[i].Name).Value := TcxDateEdit(Controls[i]).Text ADOQueryCmd.fieldByName(Controls[i].Name).Value := TcxDateEdit(Controls[i]).Text
else else
ADOQueryCmd.fieldByName(Controls[i].Name).Value := null; ADOQueryCmd.fieldByName(Controls[i].Name).Value :=null;
end end
else if Controls[i] is TcxMemo then else if Controls[i] is TcxMemo then
begin begin
@ -2374,7 +2362,7 @@ begin
end; end;
while not Eof do while not Eof do
begin begin
A := TA.create(nil); A := TA.create(Nil);
A.S := Trim(fieldByName('Code').AsString); A.S := Trim(fieldByName('Code').AsString);
if PState = 1 then if PState = 1 then
(c3.Properties as TcxComboBoxProperties).Items.AddObject(Trim(fieldByName('name').AsString), TObject(A)) (c3.Properties as TcxComboBoxProperties).Items.AddObject(Trim(fieldByName('name').AsString), TObject(A))
@ -2441,7 +2429,7 @@ begin
end; end;
while not Eof do while not Eof do
begin begin
A := TA.create(nil); A := TA.create(Nil);
A.S := Trim(fieldByName('Code').AsString); A.S := Trim(fieldByName('Code').AsString);
if PState = 1 then if PState = 1 then
(c3.Properties as TcxComboBoxProperties).Items.AddObject(Trim(fieldByName('name').AsString), TObject(A)) (c3.Properties as TcxComboBoxProperties).Items.AddObject(Trim(fieldByName('name').AsString), TObject(A))
@ -3842,5 +3830,63 @@ begin
Result := MResult; Result := MResult;
end; end;
///////////////////////////////
procedure CDSDataFilter(ADO1: TADOQuery; CDS1: TclientDataSet; Tv1: TcxGridDBTableView; JsonArgs: string);
var
JSONObject: TJSONObject;
begin
JSONObject := TJSONObject.ParseJSONValue(JsonArgs) as TJSONObject;
if ADO1.Active then
begin
Tv1.BeginUpdate();
SDofilter(ADO1, JSONObject.S['FilterStr']);
SCreateCDS(ADO1, CDS1);
SInitCDSData(ADO1, CDS1);
Tv1.EndUpdate;
end;
end;
procedure CDSDataFilter(ADO1: TADOQuery; CDS1: TclientDataSet; Tv1: TcxGridDBBandedTableView; JsonArgs: string);
var
JSONObject: TJSONObject;
begin
JSONObject := TJSONObject.ParseJSONValue(JsonArgs) as TJSONObject;
if ADO1.Active then
begin
Tv1.BeginUpdate();
SDofilter(ADO1, JSONObject.S['FilterStr']);
SCreateCDS(ADO1, CDS1);
SInitCDSData(ADO1, CDS1);
Tv1.EndUpdate;
end;
end;
//////////////////////////////
//是否能删除数据记录
function isCanDataDelete(mFillerId:string='';mfiller:string=''):boolean;
begin
result:=false;
if (mFillerId=dcode) or (mfiller=dname) or (pos(mfiller,gTeamWorker)>0) then
begin
result:=true;
end;
end;
////////////////////////////////
//是否能修改数据记录
function isCanDataEdit(mFillerId:string='';mfiller:string=''):boolean;
begin
result:=false;
if (mFillerId=dcode) or (mfiller=dname)or (pos(mfiller,gTeamWorker)>0) then
begin
result:=true;
end;
end;
end. end.

View File

@ -6,7 +6,9 @@ uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Data.DB, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Data.DB,
Data.Win.ADODB, cxGraphics, U_WindowFormdesign, cxEdit, Vcl.ExtCtrls, Data.Win.ADODB, cxGraphics, U_WindowFormdesign, cxEdit, Vcl.ExtCtrls,
cxControls, cxProgressBar, cxLookAndFeels, cxLookAndFeelPainters, cxContainer; cxControls, cxProgressBar, cxLookAndFeels, cxLookAndFeelPainters, cxContainer,
dxSkinsCore, dxSkinsDefaultPainters, dxSkinWXI, dxSkinSharpPlus,
dxSkinMySkin_WXI, System.JSON;
type type
TfrmBaseList = class(TForm) TfrmBaseList = class(TForm)
@ -30,6 +32,9 @@ type
public public
fFormId: integer; fFormId: integer;
fIsCanDesign:boolean; fIsCanDesign:boolean;
fFormCaption:string;
fFormRightButtons:string;
fModuleId,fModuleSubId:string;
constructor Create(AOwner: TComponent; ACaption: string=''; Parameters1: string=''; Parameters2: string=''; Parameters3: string=''; Parameters4: string=''; Parameters5: string=''; Parameters10: string='';FormID:Integer=0); constructor Create(AOwner: TComponent; ACaption: string=''; Parameters1: string=''; Parameters2: string=''; Parameters3: string=''; Parameters4: string=''; Parameters5: string=''; Parameters10: string='';FormID:Integer=0);
end; end;
@ -43,18 +48,36 @@ uses
{$R *.dfm} {$R *.dfm}
constructor TfrmBaseList.Create(AOwner: TComponent; ACaption: string=''; Parameters1: string=''; Parameters2: string=''; Parameters3: string=''; Parameters4: string=''; Parameters5: string=''; Parameters10: string='';FormID:Integer=0); constructor TfrmBaseList.Create(AOwner: TComponent; ACaption: string=''; Parameters1: string=''; Parameters2: string=''; Parameters3: string=''; Parameters4: string=''; Parameters5: string=''; Parameters10: string='';FormID:Integer=0);
var
jsonObject: TJSONObject;
jsonValue: TJSONValue;
begin begin
inherited Create(AOwner); inherited Create(AOwner);
if ACaption <> '' then if ACaption <> '' then
Caption := ACaption; Caption := ACaption;
fFormCaption:=caption;
fParameters1 := Parameters1; fParameters1 := Parameters1;
fParameters2 := Parameters2; fParameters2 := Parameters2;
fParameters3 := Parameters3; fParameters3 := Parameters3;
fParameters4 := Parameters4; fParameters4 := Parameters4;
fParameters5 := Parameters5; fParameters5 := Parameters5;
fParameters10 := Parameters10; fParameters10 := Parameters10;
if pos('{',fParameters10)>0 then
begin
try
jsonValue := TJSONObject.ParseJSONValue(fParameters10);
jsonObject := jsonValue as TJSONObject;
fModuleId:=StringReplace(Trim(jsonObject.GetValue('moduleId').ToString),'"','',[rfReplaceAll]);
fModuleSubId:=StringReplace(trim(jsonObject.GetValue('moduleSubId').ToString),'"','',[rfReplaceAll]);
gTeamWorker:=StringReplace(trim(jsonObject.GetValue('teamWorkerId').ToString),'"','',[rfReplaceAll]);
finally
jsonValue.Free;
end;
end;
fFormId:= FormID ; fFormId:= FormID ;
@ -101,6 +124,7 @@ end;
procedure TfrmBaseList.FormShow(Sender: TObject); procedure TfrmBaseList.FormShow(Sender: TObject);
begin begin
fFormRightButtons:= fWindowDesign.geUsertFormButtons(ADOQueryBaseTemp,fFormId,fFormCaption,fModuleId,fModuleSubId);
if DParameters8<>'1' then if DParameters8<>'1' then
begin begin
if trim(gStructVer)='' then if trim(gStructVer)='' then

View File

@ -7,7 +7,7 @@ uses
cxDBData, cxGridLevel, cxButtonEdit, cxCurrencyEdit, cxGridTableView, cxGrid, cxDBData, cxGridLevel, cxButtonEdit, cxCurrencyEdit, cxGridTableView, cxGrid,
cxGridCustomTableView, cxGraphics, cxCalendar, cxCheckBox, cxGridDBTableView,StrUtils, cxGridCustomTableView, cxGraphics, cxCalendar, cxCheckBox, cxGridDBTableView,StrUtils,
cxGridDBBandedTableView, cxStyles, cxPc, cxGroupBox, dxLayoutContainer, U_dataLink, cxGridDBBandedTableView, cxStyles, cxPc, cxGroupBox, dxLayoutContainer, U_dataLink,
cxCustomData, cxClasses, cxTimeEdit, cxEdit, cxLookAndFeels, dxLayoutControl, cxCustomData, cxClasses, cxTimeEdit, cxEdit, cxLookAndFeels, dxLayoutControl, TypInfo,
cxLookAndFeelPainters, cxGridCustomView, Buttons, cxDropDownEdit; cxLookAndFeelPainters, cxGridCustomView, Buttons, cxDropDownEdit;
@ -17,11 +17,12 @@ function readLayOut(dxLayoutControl1:TdxLayoutControl; ADOTmp: TADOQuery;mdesign
//procedure SetFormOperRight(app:Tapplication;mParent: TwinControl; mRightCaptions: PWideChar)stdcall;external 'rtCommon.dll' Name 'SetFormOperRight_A'; //procedure SetFormOperRight(app:Tapplication;mParent: TwinControl; mRightCaptions: PWideChar)stdcall;external 'rtCommon.dll' Name 'SetFormOperRight_A';
//function getSystemFontSize(ADOTmp: TADOQuery;mStyleCode:PWideChar): Integer;stdcall;external 'rtCommon.dll' Name 'getSystemFontSize_A'; //function getSystemFontSize(ADOTmp: TADOQuery;mStyleCode:PWideChar): Integer;stdcall;external 'rtCommon.dll' Name 'getSystemFontSize_A';
function mustInCheck(app:Tapplication;dxLayoutControl1:TdxLayoutControl;textFlag:string='*'):boolean; function mustInCheck(app:Tapplication;dxLayoutControl1:TdxLayoutControl;textFlag:string='*'):boolean;
function mustInCheck_R(app:Tapplication;dxLayoutGroup:TdxLayoutGroup ;textFlag:string='*'):Boolean;
//function isHasDesignRight(ADOTmp: TADOQuery;userId:PWideChar): boolean;stdcall;external 'rtCommon.dll' Name 'isHasDesignRight_A'; //function isHasDesignRight(ADOTmp: TADOQuery;userId:PWideChar): boolean;stdcall;external 'rtCommon.dll' Name 'isHasDesignRight_A';
//function isUseSkin(): boolean;stdcall;external 'rtCommon.dll' Name 'isUseSkin_A'; //function isUseSkin(): boolean;stdcall;external 'rtCommon.dll' Name 'isUseSkin_A';
//function isGridNativeSet(): boolean;stdcall;external 'rtCommon.dll' Name 'isGridNativeSet_A'; //function isGridNativeSet(): boolean;stdcall;external 'rtCommon.dll' Name 'isGridNativeSet_A';
//function readLayOut(app:Tapplication;dxLayoutControl1:TdxLayoutControl; ADOTmp: TADOQuery;mdesignCode:PWideChar):integer;stdcall;external 'rtCommon.dll' Name 'readLayOut_A'; //function readLayOut(app:Tapplication;dxLayoutControl1:TdxLayoutControl; ADOTmp: TADOQuery;mdesignCode:PWideChar):integer;stdcall;external 'rtCommon.dll' Name 'readLayOut_A';
function saveLayOut(app:Tapplication;dxLayoutControl1:TdxLayoutControl; ADOCmd: TADOQuery;mdesignCode:string):boolean; function saveLayOut(app:Tapplication;dxLayoutControl1:TdxLayoutControl; ADOCmd: TADOQuery;pdesignCode:PWideChar):boolean;
procedure layoutDesign(dxLayoutControl1:TdxLayoutControl;ADOTmp: TADOQuery;userId:string ); procedure layoutDesign(dxLayoutControl1:TdxLayoutControl;ADOTmp: TADOQuery;userId:string );
procedure SetShowModalHide(mHandle:Thandle;form:Tform); procedure SetShowModalHide(mHandle:Thandle;form:Tform);
procedure InitStyleData( StyleRepository:TcxStyleRepository;mFontSize:integer); procedure InitStyleData( StyleRepository:TcxStyleRepository;mFontSize:integer);
@ -32,6 +33,9 @@ procedure addQryContionByLay(AdoTmp:Tadoquery;formId:Integer;gridName:string;lay
procedure initWinData(AdoTmp:TadoQuery;obj:TwinControl;sqlStr:string); procedure initWinData(AdoTmp:TadoQuery;obj:TwinControl;sqlStr:string);
function GetProcedureParam(layoutControl: TdxLayoutControl; EquTag: Integer=0): string; function GetProcedureParam(layoutControl: TdxLayoutControl; EquTag: Integer=0): string;
procedure getSystemIni(); procedure getSystemIni();
function IsHasDesignRight(ADOTmp: TADOQuery;userId:String): boolean;
function TryGetTextProperty(AComponent: TComponent; out Value: string): Boolean;
procedure HideUnenabledButton(Toolbar: TToolbar);
implementation implementation
uses uses
U_globalVar; U_globalVar;
@ -527,6 +531,7 @@ end;
i:integer; i:integer;
j:Integer; j:Integer;
mcatpion:string; mcatpion:string;
mValue:string;
layGroup:TdxLayoutGroup; layGroup:TdxLayoutGroup;
begin begin
result:=false; result:=false;
@ -540,52 +545,70 @@ end;
// ShowMessage(dxLayoutControl1.Items[i].name); // ShowMessage(dxLayoutControl1.Items[i].name);
// end; // end;
//ShowMessage(mcatpion); //ShowMessage(mcatpion);
if dxLayoutControl1.Items[i] is TdxLayoutGroup then if (dxLayoutControl1.Items[i] is TdxLayoutGroup) or (dxLayoutControl1.Items[i] is TdxLayoutAutoCreatedGroup) then
begin begin
layGroup := TdxLayoutGroup( dxLayoutControl1.Items[i]) ; if not mustInCheck_R(app,TdxLayoutGroup(dxLayoutControl1.Items[i]),textFlag) then
for j := 0 to layGroup.Count -1 do Exit;
end
else if dxLayoutControl1.Items[i] is TdxLayoutItem then
begin begin
mcatpion:= TdxLayoutItem(layGroup.items[j]).Caption ; mcatpion:= TdxLayoutItem(dxLayoutControl1.Items[i]).Caption ;
// ShowMessage(mcatpion); // ShowMessage(mcatpion);
if pos(textFlag, mcatpion)>0 then if pos(textFlag, mcatpion)>0 then
begin begin
if TdxLayoutItem(layGroup.items[j]).Control is TcxTextEdit then if TryGetTextProperty(TComponent(TdxLayoutItem(dxLayoutControl1.Items[i]).Control),mValue) then
begin begin
if Trim(TcxTextEdit(TdxLayoutItem(layGroup.items[j]).Control).Text) ='' then if Trim(mValue)='' then
begin begin
// mcatpion:=StringReplace(mcatpion,'[COLOR=#FF0000]*[/COLOR]','',[rfIgnoreCase]);
mcatpion:=StringReplace(mcatpion,'[COLOR=#FF0000]*[/COLOR]','',[]);
TcxTextEdit(TdxLayoutItem(layGroup.items[j]).Control).TextHint:='请输入数据!';
TcxTextEdit(TdxLayoutItem(layGroup.items[j]).Control).SetFocus;
ShowMessage('【'+mcatpion+'】,数据不能为空!'); ShowMessage('【'+mcatpion+'】,数据不能为空!');
exit ; exit ;
end; end;
continue;
end;
//
if TdxLayoutItem(layGroup.items[j]).Control is TcxButtonEdit then
begin
if Trim(TcxButtonEdit(TdxLayoutItem(layGroup.items[j]).Control).Text) ='' then
begin
//
mcatpion:=StringReplace(mcatpion,'[COLOR=#FF0000]*[/COLOR]','',[]);
// TcxButtonEdit(TdxLayoutItem(layGroup.items[j]).Control).TextHint:='请输入数据!';
TcxButtonEdit(TdxLayoutItem(layGroup.items[j]).Control).SetFocus;
ShowMessage('【'+mcatpion+'】,数据不能为空!');
exit ;
end;
continue;
end;
end; end;
end; end;
end; end;
end; end;
result:=true; result:=true;
end; end;
///////////////////////////////////////////////////
function mustInCheck_R(app:Tapplication;dxLayoutGroup:TdxLayoutGroup ;textFlag:string='*'):Boolean;
var
i:integer;
j:Integer;
mcatpion:string;
mValue:string;
begin
result:=false;
if textFlag='' then textFlag:='*';
for I := 0 to dxLayoutGroup.Count - 1 do
begin
if (dxLayoutGroup.Items[i] is TdxLayoutGroup) or (dxLayoutGroup.Items[i] is TdxLayoutAutoCreatedGroup) then
begin
if not mustInCheck_R(app,TdxLayoutGroup(dxLayoutGroup.Items[i]),textFlag) then
Exit;
end
else if dxLayoutGroup.Items[i] is TdxLayoutItem then
begin
mcatpion:= TdxLayoutItem(dxLayoutGroup.Items[i]).Caption ;
// ShowMessage(mcatpion);
if pos(textFlag, mcatpion)>0 then
begin
if TryGetTextProperty(TComponent(TdxLayoutItem(dxLayoutGroup.Items[i]).Control),mValue) then
begin
if Trim(mValue)='' then
begin
mcatpion:=StringReplace(mcatpion,'[COLOR=#FF0000]*[/COLOR]','',[rfIgnoreCase]);
ShowMessage('【'+mcatpion+'】,数据不能为空!');
exit ;
end;
end;
end;
end;
end;
result:=true;
end;
/////////////////////////////////////////////////////// ///////////////////////////////////////////////////////
procedure SetShowModalHide(mHandle:Thandle;form:Tform); procedure SetShowModalHide(mHandle:Thandle;form:Tform);
@ -596,15 +619,17 @@ end;
///////////////////////////////// /////////////////////////////////
procedure layoutDesign(dxLayoutControl1:TdxLayoutControl;ADOTmp: TADOQuery;userId:string ); procedure layoutDesign(dxLayoutControl1:TdxLayoutControl;ADOTmp: TADOQuery;userId:string );
begin begin
// if not IsHasDesignRight(ADOTmp,PWideChar(userId)) then if not IsHasDesignRight(ADOTmp,PWideChar(userId)) then
// exit; exit;
dxLayoutControl1.Customization := True; dxLayoutControl1.Customization := True;
end; end;
///////////////////////////////////// /////////////////////////////////////
function saveLayOut(app:Tapplication;dxLayoutControl1:TdxLayoutControl; ADOCmd: TADOQuery;mdesignCode:string):Boolean; function saveLayOut(app:Tapplication;dxLayoutControl1:TdxLayoutControl; ADOCmd: TADOQuery;pdesignCode:PWideChar):Boolean;
var var
LayoutStream: TMemoryStream; LayoutStream: TMemoryStream;
mdesignCode:string;
begin begin
mdesignCode:= pdesignCode ;
LayoutStream := TMemoryStream.Create; LayoutStream := TMemoryStream.Create;
try try
dxLayoutControl1.SaveToStream(LayoutStream); dxLayoutControl1.SaveToStream(LayoutStream);
@ -636,5 +661,62 @@ begin
LayoutStream.Free; // 释放内存流 LayoutStream.Free; // 释放内存流
end; end;
end; end;
/// ///////////////////////////////////////////////////
//
/// ////////////////////////////////////////////////////
function IsHasDesignRight(ADOTmp: TADOQuery;userId:String): boolean;
begin
result := false;
try
/// ////////////////////////////////////
// 权限控制
with ADOTmp do
begin
close;
sql.Clear;
Filtered := false;
sql.Add('select count(userid) as cnt');
sql.Add('from sy_user A');
sql.Add('where userid=' + quotedStr(userId));
sql.Add('and canDesign=1');
sql.Add('and valid=''Y''');
open;
if fieldByName('cnt').AsInteger > 0 then
begin
result := true;
end;
close;
end;
except
application.MessageBox('获取操作权限时发生错误!', '警告信息', 0);
end;
end;
/////////////////////////////////////////////////////////////
//
function TryGetTextProperty(AComponent: TComponent; out Value: string): Boolean;
begin
try
Value := GetStrProp(AComponent, 'Text');
Result := True;
except
Result := False;
end;
end;
////////////////////////////////////////////////////////////
//
procedure HideUnenabledButton(Toolbar: TToolbar);
var
i:Integer;
begin
for i := 0 to Toolbar.ButtonCount - 1 do
begin
if not ToolBar.Buttons[i].Enabled and ToolBar.Buttons[i].Visible then
begin
ToolBar.Buttons[i].Visible := False;
end;
end;
end;
end. end.

View File

@ -42,11 +42,14 @@ type
procedure cxGridViewCustomDrawIndicatorCell(Sender: TcxGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxCustomGridIndicatorItemViewInfo; var ADone: Boolean); procedure cxGridViewCustomDrawIndicatorCell(Sender: TcxGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxCustomGridIndicatorItemViewInfo; var ADone: Boolean);
public public
fProcedureName:string; fProcedureName:string;
fFormRightButtons:string;
function FormStyleInit(mForm: Tform; mFormId: integer; ADOTmp: TADOQuery; ADOQCmd: TADOQuery; mStyleCode: string = '01'; mRightCaptions: string = ''): boolean; function FormStyleInit(mForm: Tform; mFormId: integer; ADOTmp: TADOQuery; ADOQCmd: TADOQuery; mStyleCode: string = '01'; mRightCaptions: string = ''): boolean;
function FormStyleInit1(mForm: Tform; mFormId: integer; ADOTmp: TADOQuery; ADOQCmd: TADOQuery; mStyleCode: string = '01'; mRightCaptions: string = ''): boolean; function FormStyleInit1(mForm: Tform; mFormId: integer; ADOTmp: TADOQuery; ADOQCmd: TADOQuery; mStyleCode: string = '01'; mRightCaptions: string = ''): boolean;
function FormStyleInit10(mForm: Tform; mFormId: integer; ADOTmp: TADOQuery; ADOQCmd: TADOQuery; mStyleCode: string = '01'; mRightCaptions: string = ''): boolean; function FormStyleInit10(mForm: Tform; mFormId: integer; ADOTmp: TADOQuery; ADOQCmd: TADOQuery; mStyleCode: string = '01'; mRightCaptions: string = ''): boolean;
procedure QueryDataPlus(ADOTmp: TADOQuery); procedure QueryDataPlus(ADOTmp: TADOQuery);
procedure OpenGridDesignWin10(mdesignCode:string;mGridName:string;mCxGridView: TcxGridDBTableView); procedure OpenGridDesignWin10(mdesignCode:string;mGridName:string;mCxGridView: TcxGridDBTableView);
procedure initUserFormButtons(toolBar1:TToolBar;toolBar2:TToolBar=nil);
function geUsertFormButtons(ADOQueryTmp:TADOQuery;mFormId:integer;mFormCaption:string;moduleId:string;moduleSubId:string):string;
end; end;
const const
@ -81,13 +84,12 @@ var
setGridButton: TToolButton; setGridButton: TToolButton;
begin begin
if gIsYsUse then exit; if gIsYsUse then exit;
ADOQueryCmd := ADOQCmd; ADOQueryCmd := ADOQCmd;
ADOQueryTmp := ADOTmp; ADOQueryTmp := ADOTmp;
fDllName := gDllFileName; fDllName := gDllFileName;
fFormName := mForm.name; fFormName := mForm.name;
fFormId := mFormId; fFormId := mFormId;
fFormRightButtons:='';
//gIsCanDesign :=IsHasDesignRight(ADOTmp,PWideChar(dCode)) ; //gIsCanDesign :=IsHasDesignRight(ADOTmp,PWideChar(dCode)) ;
// //
//if trim(mStyleCode) = '' then //if trim(mStyleCode) = '' then
@ -354,8 +356,8 @@ var
toolBar: TToolBar; toolBar: TToolBar;
layoutControl: TdxLayoutControl; layoutControl: TdxLayoutControl;
begin begin
if gIsYsUse then if gIsYsUse and (fFormRightButtons='') then exit;
exit;
ADOQueryCmd := ADOQCmd; ADOQueryCmd := ADOQCmd;
ADOQueryTmp := ADOTmp; ADOQueryTmp := ADOTmp;
fDllName := gDllFileName; fDllName := gDllFileName;
@ -424,8 +426,9 @@ begin
else else
toolBar.List := mToolBarList; toolBar.List := mToolBarList;
end; end;
if mRightCaptions<>'' then //
SetFormOperRight(toolBar, PWideChar(mRightCaptions)); if fFormRightButtons<>'' then
initUserFormButtons(toolBar);
//continue; //continue;
end end
else if mForm.Components[i] is TdxLayoutControl then else if mForm.Components[i] is TdxLayoutControl then
@ -706,15 +709,17 @@ begin
mCaption := trim(TToolBar(mParent).Buttons[i].Caption); mCaption := trim(TToolBar(mParent).Buttons[i].Caption);
if (mCaption = '关闭') or (mCaption = '退出') or (mCaption = '放弃') then if (mCaption = '关闭') or (mCaption = '退出') or (mCaption = '放弃') then
exit; exit;
/// ////////////////////////// /// ////////////////////////////////////////
if trim(mOperRight) = '查询' then if trim(mOperRight) = '查询' then
begin begin
if pos(mCaption, '查询,刷新,过滤,高级过滤,高级查询') > 0 then // ,查看,详细 if pos(mCaption, '查询,刷新,过滤,高级过滤,高级查询') > 0 then // ,查看,详细
begin begin
TToolBar(mParent).Buttons[i].Enabled:=true;
TToolBar(mParent).Buttons[i].Visible := true; TToolBar(mParent).Buttons[i].Visible := true;
end end
else else
begin begin
TToolBar(mParent).Buttons[i].Enabled:=false;
TToolBar(mParent).Buttons[i].Visible := false; TToolBar(mParent).Buttons[i].Visible := false;
end; end;
end end
@ -722,10 +727,12 @@ begin
begin begin
if (pos(mCaption, mOperRight) > 0) or (pos(mCaption, '查询,刷新,过滤,高级过滤,高级查询') > 0) then // 查看, if (pos(mCaption, mOperRight) > 0) or (pos(mCaption, '查询,刷新,过滤,高级过滤,高级查询') > 0) then // 查看,
begin begin
TToolBar(mParent).Buttons[i].Enabled:=true;
TToolBar(mParent).Buttons[i].Visible := true; TToolBar(mParent).Buttons[i].Visible := true;
end end
else else
begin begin
TToolBar(mParent).Buttons[i].Enabled:=false;
TToolBar(mParent).Buttons[i].Visible := false; TToolBar(mParent).Buttons[i].Visible := false;
end; end;
end; end;
@ -752,13 +759,17 @@ begin
begin begin
if (pos(mCaption, mOperRight) > 0) or (mCaption = '查询') or (mCaption = '过滤') or (mCaption = '高级过滤') then if (pos(mCaption, mOperRight) > 0) or (mCaption = '查询') or (mCaption = '过滤') or (mCaption = '高级过滤') then
begin begin
Controls[i].Enabled := true;
Controls[i].Visible := true; Controls[i].Visible := true;
end end
else else
begin
Controls[i].Enabled := false;
Controls[i].Visible := false; Controls[i].Visible := false;
end; end;
end; end;
end; end;
end;
except except
application.MessageBox('初始化窗口按钮权限发生错误', '警告信息', 0); application.MessageBox('初始化窗口按钮权限发生错误', '警告信息', 0);
@ -942,5 +953,68 @@ begin
showMessage('请先选择要设计的表格!'); showMessage('请先选择要设计的表格!');
end; end;
end; end;
//////////////////////////////////////////////////////////////////
/// 设置窗口按钮
procedure TWindowFormDeSign.initUserFormButtons(toolBar1:TToolBar;toolBar2:TToolBar=nil);
begin
SetFormOperRight(toolBar1, PWideChar(fFormRightButtons));
if toolBar2<>nil then
SetFormOperRight(toolBar2, PWideChar(fFormRightButtons));
end;
///////////////////////////////////////////////////////////////////
///
function TWindowFormDeSign.geUsertFormButtons(ADOQueryTmp:TADOQuery;mFormId:integer;mFormCaption:string;moduleId:string;moduleSubId:string):string;
begin
try
result:='';
fFormRightButtons :='';
with ADOQueryTmp do
begin
close;
sql.Clear;
sql.Add('select * from SY_ModuleSub');
if moduleId='' then
begin
sql.Add('where formFile='+quotedstr(fDllFileName));
sql.Add('and formName='+quotedstr(mFormCaption));
sql.Add('and formId='+intTostr(mFormId));
end
else
begin
sql.Add('where moduleId='+quotedstr(moduleId));
sql.Add('and moduleSubId='+quotedstr(moduleSubId));
end;
open;
if isEmpty then
begin
// application.MessageBox('未找到对应的模块!','警告信息',0);
exit;
end;
if ADOQueryTmp.FindField('formButtons')=nil then exit;
moduleId:=trim(fieldByName('moduleId').AsString) ;
moduleSubId:=trim(fieldByName('moduleSubId').AsString) ;
if trim(fieldByName('formButtons').AsString)='' then
begin
exit;
end;
end;
with ADOQueryTmp do
begin
close;
sql.Clear;
sql.Add('exec p_get_user_moduleButtons');
sql.Add('@moduleId='+quotedstr(moduleId));
sql.Add(',@moduleSubId='+quotedstr(moduleSubId));
sql.Add(',@UserId='+quotedstr(dCode));
open;
fFormRightButtons := trim(fieldByName('rightButtons').AsString) ;
result:= fFormRightButtons;
end;
finally
end;
end;
end. end.

View File

@ -290,6 +290,8 @@ begin mWidth := 12;
ADBColumn := tv1.GetColumnByFieldName ADBColumn := tv1.GetColumnByFieldName
(trim(ADOQueryTmp.fieldByName('fieldName').AsString)); (trim(ADOQueryTmp.fieldByName('fieldName').AsString));
if ADBColumn <> nil then begin if ADBColumn <> nil then begin
if (ADBColumn.Styles.Header<>nil) and (ADBColumn.Styles.Header.Font.Size<>gFontSize) then
ADBColumn.Styles.Header.Font.Size:= gFontSize ;
// 作废不显示 // 作废不显示
if not fieldByName('valid').AsBoolean then if not fieldByName('valid').AsBoolean then
begin begin

View File

@ -17,6 +17,7 @@ var
gStructVer:string; gStructVer:string;
gSystemId:string; gSystemId:string;
gIsYsUse:boolean; gIsYsUse:boolean;
gTeamWorker:string;
const const
WM_CloseForm = WM_USER + 100 ; WM_CloseForm = WM_USER + 100 ;