Просмотр исходного кода

1. 汇总,调整选择汇总项目界面,以适应不同系统版本
2. 报表,导入报表后,应刷新报表属性

MaiXinRong 8 лет назад
Родитель
Сommit
f52d4255a8

+ 6 - 1
Forms/ReportsFrm.pas

@@ -678,7 +678,12 @@ procedure TReportsForm.tbImportSrtClick(Sender: TObject);
     end
     else
       if QuestMessage('已存在报表模板' + ExtractFileName(AFileName) + ',是否覆盖原模板?', Handle) then
-        CopyFile(PChar(AFileName), PChar(sNewFileName), False)
+      begin
+        CopyFile(PChar(AFileName), PChar(sNewFileName), False);
+        vTemplateNode := ReportTemplateManager.FindTemplate(sNewFileName);
+        if Assigned(vTemplateNode) then
+          vTemplateNode.RefreshTemplateProperties;
+      end
       else
         Exit;
   end;

+ 3 - 7
ProjGather/ProjGatherSelectFrm.dfm

@@ -1,9 +1,10 @@
 object ProjGatherSelectForm: TProjGatherSelectForm
   Left = 454
   Top = 235
-  Width = 758
-  Height = 554
+  BorderStyle = bsSingle
   Caption = #36873#25321#27719#24635#39033#30446
+  ClientHeight = 523
+  ClientWidth = 750
   Color = clBtnFace
   Font.Charset = ANSI_CHARSET
   Font.Color = clWindowText
@@ -11,9 +12,6 @@ object ProjGatherSelectForm: TProjGatherSelectForm
   Font.Name = #23435#20307
   Font.Style = []
   OldCreateOrder = False
-  DesignSize = (
-    750
-    523)
   PixelsPerInch = 96
   TextHeight = 12
   object lblProjectList: TLabel
@@ -88,7 +86,6 @@ object ProjGatherSelectForm: TProjGatherSelectForm
     Top = 489
     Width = 74
     Height = 25
-    Anchors = [akTop, akRight]
     Caption = #30830' '#23450
     TabOrder = 2
     OnClick = btnOkClick
@@ -98,7 +95,6 @@ object ProjGatherSelectForm: TProjGatherSelectForm
     Top = 489
     Width = 74
     Height = 25
-    Anchors = [akTop, akRight]
     Caption = #21462' '#28040
     ModalResult = 2
     TabOrder = 3

+ 9 - 2
ProjGather/ProjGatherSelectFrm.pas

@@ -52,6 +52,8 @@ type
     procedure DoOnFilterRecord(ARecord: TsdDataRecord; var AAllow: Boolean);
 
     procedure LoadHistorySelects(AProjs: TList);
+
+    procedure RefreshDiffWindows;
   public
     constructor Create(AProjectID: Integer; AProjs: TList; ASpecialProjTypes: TStrings);
     destructor Destroy; override;
@@ -109,8 +111,7 @@ var
   i: Integer;
 begin
   inherited Create(nil);
-  ClientHeight := 523;
-  ClientWidth := 750;
+  RefreshDiffWindows;
   FProjectID := AProjectID;
   FSpecialProjTypes := ASpecialProjTypes;
   if FSpecialProjTypes <> nil then
@@ -416,4 +417,10 @@ begin
   end;
 end;
 
+procedure TProjGatherSelectForm.RefreshDiffWindows;
+begin
+  ClientHeight := 523;
+  ClientWidth := 750;
+end;
+
 end.

+ 4 - 1
Units/ReportInteractInfo.pas

@@ -24,11 +24,12 @@ Type
     procedure LoadSpecialProjGatherTypes(AXmlNode: IXMLNode);
 
     procedure LoadInteractInfo(AXmlNode: IXMLNode);
-    procedure LoadXmlFromStream;
   public
     constructor Create(const AFileName: string);
     destructor Destroy; override;
 
+    procedure LoadXmlFromStream;
+
     property Audits: TStringList read FAudits;
     property Sql: string read FSql;
     property SpecialProjGatherTypes: TStringList read FSpecialProjGatherTypes;
@@ -64,6 +65,7 @@ var
 begin
   if AXmlNode = nil then Exit;
 
+  FAudits.Clear;
   vAudits := AXmlNode.ChildNodes;
   for i := 0 to vAudits.Count - 1 do
   begin
@@ -100,6 +102,7 @@ var
 begin
   if AXmlNode = nil then Exit;
 
+  FSpecialProjGatherTypes.Clear;
   vSpecialProjs := AXmlNode.ChildNodes;
   for i := 0 to vSpecialProjs.Count - 1 do
   begin

+ 36 - 1
Units/ReportManager.pas

@@ -46,6 +46,8 @@ type
     constructor Create(AFileName: string);
     destructor Destroy; override;
 
+    procedure RefreshTemplateProperties;
+
     property FileName: string read FFileName write FFileName;
 
     property TemplateName: string read FTemplateName;
@@ -93,6 +95,8 @@ type
     function AddReportTemplate(const AFileName: string): TTemplateNode;
     procedure DeleteReportTemplate(ANode: TTemplateNode);
 
+    function FindTemplate(const AFileName: string): TTemplateNode;
+
     property Count: Integer read GetCount;
     property Template[AIndex: Integer]: TTemplateNode read GetTemplate;
 
@@ -330,7 +334,10 @@ end;
 
 procedure TTemplateNode.LoadReportInteract;
 begin
-  FInteractInfo := TInteractInfo.Create(FileName);
+  if Assigned(FInteractInfo) then
+    FInteractInfo.LoadXmlFromStream
+  else
+    FInteractInfo := TInteractInfo.Create(FileName);
 end;
 
 procedure TTemplateNode.LoadTemplateProperties;
@@ -365,6 +372,16 @@ begin
   end;
 end;
 
+procedure TTemplateNode.RefreshTemplateProperties;
+begin
+  FInteractFlag := 0;
+  FInteractSubFlag := 0;
+  FDataPrepareFlag := 0;
+  FDataBaseFlag := 0;
+  FSelfFormat := 0;
+  LoadTemplateProperties;
+end;
+
 { TTemplateManager }
 
 function TTemplateManager.AddReportTemplate(const AFileName: string): TTemplateNode;
@@ -397,6 +414,24 @@ begin
   inherited;
 end;
 
+function TTemplateManager.FindTemplate(
+  const AFileName: string): TTemplateNode;
+var
+  iTemplate: Integer;
+  vTemplate: TTemplateNode;
+begin
+  Result := nil;
+  for iTemplate := 0 to FTemplateList.Count - 1 do
+  begin
+    vTemplate := Template[iTemplate];
+    if vTemplate.FileName = AFileName then
+    begin
+      Result := vTemplate;
+      Break;
+    end;
+  end;
+end;
+
 function TTemplateManager.GetCount: Integer;
 begin
   Result := FTemplateList.Count;