diff --git a/Delphi10/开发档案/Dp10RepoV1/public10/ThreeFun/Form/U_ZDYHelp.dfm b/Delphi10/开发档案/Dp10RepoV1/public10/ThreeFun/Form/U_ZDYHelp.dfm index 1e5c453..68b4b1f 100644 --- a/Delphi10/开发档案/Dp10RepoV1/public10/ThreeFun/Form/U_ZDYHelp.dfm +++ b/Delphi10/开发档案/Dp10RepoV1/public10/ThreeFun/Form/U_ZDYHelp.dfm @@ -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 diff --git a/Delphi10/开发档案/Dp10RepoV1/public10/ThreeFun/Form/U_ZDYHelp.pas b/Delphi10/开发档案/Dp10RepoV1/public10/ThreeFun/Form/U_ZDYHelp.pas index 7d97558..5f02dff 100644 --- a/Delphi10/开发档案/Dp10RepoV1/public10/ThreeFun/Form/U_ZDYHelp.pas +++ b/Delphi10/开发档案/Dp10RepoV1/public10/ThreeFun/Form/U_ZDYHelp.pas @@ -654,8 +654,8 @@ end; procedure TfrmZDYHelp.FormDestroy(Sender: TObject); begin -// inherited; - //WriteCxGrid('Զ' + Trim(flag), TV1, 'Զ'); + inherited; + WriteCxGrid('Զ' + Trim(flag), TV1, 'Զ'); frmZDYHelp := nil; end; diff --git a/Delphi10/开发档案/Dp10RepoV1/public10/ThreeFun/Fun/U_ControlData.pas b/Delphi10/开发档案/Dp10RepoV1/public10/ThreeFun/Fun/U_ControlData.pas index c93de78..382c197 100644 --- a/Delphi10/开发档案/Dp10RepoV1/public10/ThreeFun/Fun/U_ControlData.pas +++ b/Delphi10/开发档案/Dp10RepoV1/public10/ThreeFun/Fun/U_ControlData.pas @@ -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 diff --git a/Delphi10/开发档案/Dp10RepoV1/public10/ThreeFun/Fun/U_RTFun.pas b/Delphi10/开发档案/Dp10RepoV1/public10/ThreeFun/Fun/U_RTFun.pas index 13f93dc..d3f6193 100644 --- a/Delphi10/开发档案/Dp10RepoV1/public10/ThreeFun/Fun/U_RTFun.pas +++ b/Delphi10/开发档案/Dp10RepoV1/public10/ThreeFun/Fun/U_RTFun.pas @@ -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); // ͨKeyIdTv1ѡӳ䵽CDS1 function SelCDSKey(CDS_1: TclientDataSet; Keys: TArray): TArray; // ѡ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. diff --git a/Delphi10/开发档案/Dp10RepoV1/public10/design/U_BaseList.pas b/Delphi10/开发档案/Dp10RepoV1/public10/design/U_BaseList.pas index 79ca739..b601ac7 100644 --- a/Delphi10/开发档案/Dp10RepoV1/public10/design/U_BaseList.pas +++ b/Delphi10/开发档案/Dp10RepoV1/public10/design/U_BaseList.pas @@ -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 diff --git a/Delphi10/开发档案/Dp10RepoV1/public10/design/U_FormLayOutDesign.pas b/Delphi10/开发档案/Dp10RepoV1/public10/design/U_FormLayOutDesign.pas index caec4e6..c23c079 100644 --- a/Delphi10/开发档案/Dp10RepoV1/public10/design/U_FormLayOutDesign.pas +++ b/Delphi10/开发档案/Dp10RepoV1/public10/design/U_FormLayOutDesign.pas @@ -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. diff --git a/Delphi10/开发档案/Dp10RepoV1/public10/design/U_WindowFormdesign.pas b/Delphi10/开发档案/Dp10RepoV1/public10/design/U_WindowFormdesign.pas index 3bef298..63639e7 100644 --- a/Delphi10/开发档案/Dp10RepoV1/public10/design/U_WindowFormdesign.pas +++ b/Delphi10/开发档案/Dp10RepoV1/public10/design/U_WindowFormdesign.pas @@ -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. diff --git a/Delphi10/开发档案/Dp10RepoV1/public10/design/U_cxGridCustomSet.pas b/Delphi10/开发档案/Dp10RepoV1/public10/design/U_cxGridCustomSet.pas index fe6069d..260330e 100644 --- a/Delphi10/开发档案/Dp10RepoV1/public10/design/U_cxGridCustomSet.pas +++ b/Delphi10/开发档案/Dp10RepoV1/public10/design/U_cxGridCustomSet.pas @@ -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 diff --git a/Delphi10/开发档案/Dp10RepoV1/public10/design/U_globalVar.pas b/Delphi10/开发档案/Dp10RepoV1/public10/design/U_globalVar.pas index 51ca0a0..ec09cd7 100644 --- a/Delphi10/开发档案/Dp10RepoV1/public10/design/U_globalVar.pas +++ b/Delphi10/开发档案/Dp10RepoV1/public10/design/U_globalVar.pas @@ -17,6 +17,7 @@ var gStructVer:string; gSystemId:string; gIsYsUse:boolean; + gTeamWorker:string; const WM_CloseForm = WM_USER + 100 ;