升级更新

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'
Properties.OnEditValueChanged = V1NamePropertiesEditValueChanged
HeaderAlignmentHorz = taCenter
Width = 463
Width = 325
end
object V1Note: TcxGridDBColumn
Caption = #22791#27880

View File

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

View File

@ -7,6 +7,7 @@ uses
cxContainer, cxShellTreeView, cxShellListView, StdCtrls, BtnEdit,
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;
implementation
@ -35,6 +36,7 @@ begin
application.MessageBox(PWideChar('未定义等级对应的字段字典数据(' + mFlag + ')'),'',0);
Exit;
end;
combobox.Properties.BeginUpdate;
combobox.Properties.Items.Clear;
first;
while not eof do
@ -46,6 +48,45 @@ begin
begin
combobox.ItemIndex:=0;
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;
except

View File

@ -12,7 +12,7 @@ uses
cxGridExportLink, ExtCtrls, Buttons, DBClient, RTComboBox, cxDropDownEdit,
cxGridBandedTableView, cxGridDBBandedTableView, cxRichEdit, cxButtonEdit,
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
TA = class(TComponent)
@ -52,8 +52,6 @@ function RoundFloat(f: double; i: Integer): double;
{CDS赋值 }procedure SInitCDSData(fromADO: TADOQuery; toCDS: TclientDataSet);
{终极刷新 }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 *****************//
//////////////////////////////////////////////////////////////////////////////////////////
@ -187,14 +185,17 @@ procedure SelOKNo(CDS_MainSel: TclientDataSet; FSel: Boolean); // ȫѡ/ȫ
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 CommonFiltersByTv(Tv1: TcxGridDBTableView; JsonArgs: string): string;
function CommonGetSingleFilter(MyControl: TControl; EquTag, LikeTag, FieldTag: Integer; MFields: TStringList): string;
procedure SelTVToCDS(Tv1: TcxGridDBTableView; CDS1: TclientDataSet; KeyId: string); // 通过KeyId将Tv1选择映射到CDS1
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;
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
@ -251,22 +255,6 @@ implementation
uses
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
else if Controls[i] is TcxDateEdit then
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
else
ADOQueryCmd.fieldByName(Controls[i].Name).Value := null;
ADOQueryCmd.fieldByName(Controls[i].Name).Value :=null;
end
else if Controls[i] is TcxMemo then
begin
@ -2374,7 +2362,7 @@ begin
end;
while not Eof do
begin
A := TA.create(nil);
A := TA.create(Nil);
A.S := Trim(fieldByName('Code').AsString);
if PState = 1 then
(c3.Properties as TcxComboBoxProperties).Items.AddObject(Trim(fieldByName('name').AsString), TObject(A))
@ -2441,7 +2429,7 @@ begin
end;
while not Eof do
begin
A := TA.create(nil);
A := TA.create(Nil);
A.S := Trim(fieldByName('Code').AsString);
if PState = 1 then
(c3.Properties as TcxComboBoxProperties).Items.AddObject(Trim(fieldByName('name').AsString), TObject(A))
@ -3842,5 +3830,63 @@ begin
Result := MResult;
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.

View File

@ -6,7 +6,9 @@ uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Data.DB,
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
TfrmBaseList = class(TForm)
@ -30,6 +32,9 @@ type
public
fFormId: integer;
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);
end;
@ -43,18 +48,36 @@ uses
{$R *.dfm}
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
inherited Create(AOwner);
if ACaption <> '' then
Caption := ACaption;
fFormCaption:=caption;
fParameters1 := Parameters1;
fParameters2 := Parameters2;
fParameters3 := Parameters3;
fParameters4 := Parameters4;
fParameters5 := Parameters5;
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 ;
@ -101,6 +124,7 @@ end;
procedure TfrmBaseList.FormShow(Sender: TObject);
begin
fFormRightButtons:= fWindowDesign.geUsertFormButtons(ADOQueryBaseTemp,fFormId,fFormCaption,fModuleId,fModuleSubId);
if DParameters8<>'1' then
begin
if trim(gStructVer)='' then

View File

@ -7,7 +7,7 @@ uses
cxDBData, cxGridLevel, cxButtonEdit, cxCurrencyEdit, cxGridTableView, cxGrid,
cxGridCustomTableView, cxGraphics, cxCalendar, cxCheckBox, cxGridDBTableView,StrUtils,
cxGridDBBandedTableView, cxStyles, cxPc, cxGroupBox, dxLayoutContainer, U_dataLink,
cxCustomData, cxClasses, cxTimeEdit, cxEdit, cxLookAndFeels, dxLayoutControl,
cxCustomData, cxClasses, cxTimeEdit, cxEdit, cxLookAndFeels, dxLayoutControl, TypInfo,
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';
//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_R(app:Tapplication;dxLayoutGroup:TdxLayoutGroup ;textFlag:string='*'):Boolean;
//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 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 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 SetShowModalHide(mHandle:Thandle;form:Tform);
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);
function GetProcedureParam(layoutControl: TdxLayoutControl; EquTag: Integer=0): string;
procedure getSystemIni();
function IsHasDesignRight(ADOTmp: TADOQuery;userId:String): boolean;
function TryGetTextProperty(AComponent: TComponent; out Value: string): Boolean;
procedure HideUnenabledButton(Toolbar: TToolbar);
implementation
uses
U_globalVar;
@ -527,65 +531,84 @@ end;
i:integer;
j:Integer;
mcatpion:string;
mValue:string;
layGroup:TdxLayoutGroup;
begin
result:=false;
if textFlag='' then textFlag:='*';
result:=false;
if textFlag='' then textFlag:='*';
for I := 0 to dxLayoutControl1.Items.Count-1 do
begin
for I := 0 to dxLayoutControl1.Items.Count-1 do
begin
// mcatpion:= TdxLayoutItem(dxLayoutControl1.Controls[i].Parent).caption ;
// if pos(textFlag, mcatpion)>=0 then
// begin
// ShowMessage(dxLayoutControl1.Items[i].name);
// end;
//ShowMessage(mcatpion);
if dxLayoutControl1.Items[i] is TdxLayoutGroup then
begin
layGroup := TdxLayoutGroup( dxLayoutControl1.Items[i]) ;
for j := 0 to layGroup.Count -1 do
begin
mcatpion:= TdxLayoutItem(layGroup.items[j]).Caption ;
if (dxLayoutControl1.Items[i] is TdxLayoutGroup) or (dxLayoutControl1.Items[i] is TdxLayoutAutoCreatedGroup) then
begin
if not mustInCheck_R(app,TdxLayoutGroup(dxLayoutControl1.Items[i]),textFlag) then
Exit;
end
else if dxLayoutControl1.Items[i] is TdxLayoutItem then
begin
mcatpion:= TdxLayoutItem(dxLayoutControl1.Items[i]).Caption ;
// ShowMessage(mcatpion);
if pos(textFlag, mcatpion)>0 then
begin
if TdxLayoutItem(layGroup.items[j]).Control is TcxTextEdit then
if pos(textFlag, mcatpion)>0 then
begin
if TryGetTextProperty(TComponent(TdxLayoutItem(dxLayoutControl1.Items[i]).Control),mValue) then
begin
if Trim(TcxTextEdit(TdxLayoutItem(layGroup.items[j]).Control).Text) ='' then
if Trim(mValue)='' then
begin
//
mcatpion:=StringReplace(mcatpion,'[COLOR=#FF0000]*[/COLOR]','',[]);
TcxTextEdit(TdxLayoutItem(layGroup.items[j]).Control).TextHint:='请输入数据!';
TcxTextEdit(TdxLayoutItem(layGroup.items[j]).Control).SetFocus;
mcatpion:=StringReplace(mcatpion,'[COLOR=#FF0000]*[/COLOR]','',[rfIgnoreCase]);
ShowMessage('【'+mcatpion+'】,数据不能为空!');
exit ;
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+'】,数据不能为空!');
end;
exit ;
end;
continue;
end;
end;
end;
end;
end;
result:=true;
end;
end;
result:=true;
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);
@ -596,15 +619,17 @@ end;
/////////////////////////////////
procedure layoutDesign(dxLayoutControl1:TdxLayoutControl;ADOTmp: TADOQuery;userId:string );
begin
// if not IsHasDesignRight(ADOTmp,PWideChar(userId)) then
// exit;
if not IsHasDesignRight(ADOTmp,PWideChar(userId)) then
exit;
dxLayoutControl1.Customization := True;
end;
/////////////////////////////////////
function saveLayOut(app:Tapplication;dxLayoutControl1:TdxLayoutControl; ADOCmd: TADOQuery;mdesignCode:string):Boolean;
function saveLayOut(app:Tapplication;dxLayoutControl1:TdxLayoutControl; ADOCmd: TADOQuery;pdesignCode:PWideChar):Boolean;
var
LayoutStream: TMemoryStream;
mdesignCode:string;
begin
mdesignCode:= pdesignCode ;
LayoutStream := TMemoryStream.Create;
try
dxLayoutControl1.SaveToStream(LayoutStream);
@ -636,5 +661,62 @@ begin
LayoutStream.Free; // 释放内存流
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.

View File

@ -42,11 +42,14 @@ type
procedure cxGridViewCustomDrawIndicatorCell(Sender: TcxGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxCustomGridIndicatorItemViewInfo; var ADone: Boolean);
public
fProcedureName:string;
fFormRightButtons:string;
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 FormStyleInit10(mForm: Tform; mFormId: integer; ADOTmp: TADOQuery; ADOQCmd: TADOQuery; mStyleCode: string = '01'; mRightCaptions: string = ''): boolean;
procedure QueryDataPlus(ADOTmp: TADOQuery);
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;
const
@ -81,13 +84,12 @@ var
setGridButton: TToolButton;
begin
if gIsYsUse then exit;
ADOQueryCmd := ADOQCmd;
ADOQueryTmp := ADOTmp;
fDllName := gDllFileName;
fFormName := mForm.name;
fFormId := mFormId;
fFormRightButtons:='';
//gIsCanDesign :=IsHasDesignRight(ADOTmp,PWideChar(dCode)) ;
//
//if trim(mStyleCode) = '' then
@ -354,8 +356,8 @@ var
toolBar: TToolBar;
layoutControl: TdxLayoutControl;
begin
if gIsYsUse then
exit;
if gIsYsUse and (fFormRightButtons='') then exit;
ADOQueryCmd := ADOQCmd;
ADOQueryTmp := ADOTmp;
fDllName := gDllFileName;
@ -424,8 +426,9 @@ begin
else
toolBar.List := mToolBarList;
end;
if mRightCaptions<>'' then
SetFormOperRight(toolBar, PWideChar(mRightCaptions));
//
if fFormRightButtons<>'' then
initUserFormButtons(toolBar);
//continue;
end
else if mForm.Components[i] is TdxLayoutControl then
@ -706,15 +709,17 @@ begin
mCaption := trim(TToolBar(mParent).Buttons[i].Caption);
if (mCaption = '关闭') or (mCaption = '退出') or (mCaption = '放弃') then
exit;
/// //////////////////////////
/// ////////////////////////////////////////
if trim(mOperRight) = '查询' then
begin
if pos(mCaption, '查询,刷新,过滤,高级过滤,高级查询') > 0 then // ,查看,详细
begin
TToolBar(mParent).Buttons[i].Enabled:=true;
TToolBar(mParent).Buttons[i].Visible := true;
end
else
begin
TToolBar(mParent).Buttons[i].Enabled:=false;
TToolBar(mParent).Buttons[i].Visible := false;
end;
end
@ -722,10 +727,12 @@ begin
begin
if (pos(mCaption, mOperRight) > 0) or (pos(mCaption, '查询,刷新,过滤,高级过滤,高级查询') > 0) then // 查看,
begin
TToolBar(mParent).Buttons[i].Enabled:=true;
TToolBar(mParent).Buttons[i].Visible := true;
end
else
begin
TToolBar(mParent).Buttons[i].Enabled:=false;
TToolBar(mParent).Buttons[i].Visible := false;
end;
end;
@ -752,10 +759,14 @@ begin
begin
if (pos(mCaption, mOperRight) > 0) or (mCaption = '查询') or (mCaption = '过滤') or (mCaption = '高级过滤') then
begin
Controls[i].Enabled := true;
Controls[i].Visible := true;
end
else
begin
Controls[i].Enabled := false;
Controls[i].Visible := false;
end;
end;
end;
end;
@ -942,5 +953,68 @@ begin
showMessage('请先选择要设计的表格!');
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.

View File

@ -290,6 +290,8 @@ begin mWidth := 12;
ADBColumn := tv1.GetColumnByFieldName
(trim(ADOQueryTmp.fieldByName('fieldName').AsString));
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
begin

View File

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