소스 검색

台账分解,计量汇总列,取消用户输入后,强制刷新界面当前选中行

MaiXinRong 7 년 전
부모
커밋
e208e502a3
2개의 변경된 파일17개의 추가작업 그리고 3개의 파일을 삭제
  1. 9 3
      DataModules/BillsCompileDm.pas
  2. 8 0
      Frames/BillsCompileFme.pas

+ 9 - 3
DataModules/BillsCompileDm.pas

@@ -6,7 +6,9 @@ uses
   BillsDm, StandardBillsFme,
   SysUtils, Classes, sdDB, BillsTree, sdIDTree, DB;
 
-type
+type   
+  TRefreshGridRowEvent = procedure (ARowIndex: Integer) of object;
+  
   TBillsCompileData = class(TDataModule)
     sdvBillsCompile: TsdDataView;
     procedure sdvBillsCompileGetText(var Text: String;
@@ -28,6 +30,7 @@ type
     FBillsCompileTree: TCompileBillsIDTree;
 
     FOnRecChange: TRecChangeEvent;
+    FRefreshRow: TRefreshGridRowEvent;
 
     function GatherChildrenOrg(ANode: TsdIDTreeNode): Double;
     procedure UpdateRecordOrg(ABillsID: Integer; ATotalPrice: Double);
@@ -96,6 +99,7 @@ type
     property Active: Boolean read GetActive;
 
     property OnRecChange: TRecChangeEvent read FOnRecChange write SetOnRecChange;
+    property RefreshRow: TRefreshGridRowEvent read FRefreshRow write FRefreshRow;
   end;
 
 implementation
@@ -372,9 +376,9 @@ begin
   else if SameText(AValue.FieldName, 'IsGatherZJJL') then
   begin
     Allow := (TProjectData(FProjectData).ProjProperties.PhaseCount = 0) or TProjectData(FProjectData).CanUnlockInfo;
+    vNode := TBillsIDTreeNode(BillsCompileTree.FindNode(AValue.Owner.ValueByName('ID').AsInteger));
     if Allow then
-    begin  
-      vNode := TBillsIDTreeNode(BillsCompileTree.FindNode(AValue.Owner.ValueByName('ID').AsInteger));
+    begin
       if CheckParentExist(vNode) then
       begin
         if QuestMessage('父项已勾选,继续将取消父项勾选。') then
@@ -392,6 +396,8 @@ begin
     end
     else
       WarningMessage('开始计量后,计量汇总列不可编辑,如需修改,请先解锁。');
+    if not Allow and Assigned(FRefreshRow) then
+      RefreshRow(vNode.MajorIndex);
   end;
 end;
 

+ 8 - 0
Frames/BillsCompileFme.pas

@@ -91,6 +91,8 @@ type
     procedure ResetBaseDataReadOnly(AReadOnly: Boolean);
     procedure ResetAllowInsert(AAllow: Boolean);
 
+    procedure RefreshTreeRow(ARowIndex: Integer);
+
     function CheckExprsColumn: Boolean;
     function CheckMemoStrColumn: Boolean;
 
@@ -235,6 +237,7 @@ begin
     stdBillsCompile.Column('LockedInfo').ReadOnly := ProjProperties.PhaseCount > 0;
   end;
   zgBillsCompile.OnExpandMouseDown := ExpandMouseDown;
+  FBillsCompileData.RefreshRow := RefreshTreeRow;
 end;
 
 destructor TBillsCompileFrame.Destroy;
@@ -724,4 +727,9 @@ begin
   stdBillsCompile.Column('ApprovalCode').Visible := FShowApprovalCode;
 end;
 
+procedure TBillsCompileFrame.RefreshTreeRow(ARowIndex: Integer);
+begin
+  zgBillsCompile.InvalidateRow(ARowIndex + zgBillsCompile.FixedRowCount);
+end;
+
 end.