unit U_BaseList;

interface

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,
  dxSkinsCore, dxSkinsDefaultPainters, dxSkinWXI, dxSkinSharpPlus,
  System.JSON;

type
  TfrmBaseList = class(TForm)
    ADOQueryBaseCmd: TADOQuery;
    ADOQueryBaseTemp: TADOQuery;
    loadProcess: TPanel;
    cxProgressBar2: TcxProgressBar;
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure FormCreate(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
  private
    fWindowDesign: TWindowFormdesign;
  protected
    fParameters1: string;
    fParameters2: string;
    fParameters3: string;
    fParameters4: string;
    fParameters5: string;
    fParameters10: string;
  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;

var
  frmBaseList: TfrmBaseList;

implementation

uses
  U_RTFun, U_globalVar, U_dataLink,U_FormLayOutDesign;
{$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]);
       if Parameters1='²éÑ¯' then
         fParameters10:='²éÑ¯'
       else
        fParameters10:='';
     finally
       jsonValue.Free;
     end;
   end;

   fFormId:=   FormID ;



end;

procedure TfrmBaseList.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  if (fFormId>0) and (WriteCloseWin(ADOQueryBaseCmd, self.Caption, fFormId, gDllFileName)) then
  begin
    Sendmessage(application.MainForm.Handle, WM_CloseForm, 4, 0);
  end;

end;

procedure TfrmBaseList.FormCreate(Sender: TObject);
var
  mFontSize:integer;
begin
   self.Color:=clBtnFace;
   //getSystemIni();
   self.DoubleBuffered:=gIsUseSkin;
    if gFontSize<9 then
    begin
      mFontSize := 9;
    end
    else
    begin
      mFontSize:=gFontSize ;
    end;
  if self.Font.Size<>gFontSize then
    self.Font.Size := gFontSize;
  if trim(gFontName)<>'' then
    self.Font.Name:=gFontName;
  // ´°¿Ú±³¾°É«
  fWindowDesign := TWindowFormdesign.Create();

end;

procedure TfrmBaseList.FormDestroy(Sender: TObject);
begin
  fWindowDesign.free;
end;

procedure TfrmBaseList.FormShow(Sender: TObject);
begin
  fFormRightButtons:= fWindowDesign.geUsertFormButtons(ADOQueryBaseTemp,fFormId,fFormCaption,fModuleId,fModuleSubId);
  if DParameters8<>'1' then
  begin
    if trim(gStructVer)='' then
      fWindowDesign.FormStyleInit1(self, fFormId, ADOQueryBaseTemp, ADOQueryBaseCmd, '', fParameters10)
    else
      fWindowDesign.FormStyleInit(self, fFormId, ADOQueryBaseTemp, ADOQueryBaseCmd, '', fParameters10);
  end;

end;


end.

