Browse Source

Merge branch 'master' of http://192.168.1.12:3000/maixinrong/measure

MaiXinRong 9 năm trước cách đây
mục cha
commit
5ffed0e935
4 tập tin đã thay đổi với 49 bổ sung82 xóa
  1. 3 3
      DataModules/PHPWebDm.pas
  2. 30 66
      Forms/LoginFrm.pas
  3. 7 4
      Frames/ProjectFme.pas
  4. 9 9
      Units/UtilMethods.pas

+ 3 - 3
DataModules/PHPWebDm.pas

@@ -288,13 +288,13 @@ begin
         IdDataStream.AddFormField('userid', IntToStr(AUserID));
         IdDataStream.AddFormField('tenderid', IntToStr(ATenderID));
         IdDataStream.AddFormField('phaseno', IntToStr(APhaseNo));
-        IdDataStream.AddFormField('CheckerMemo', ACheckerMemo);
+        IdDataStream.AddFormField('CheckerMemo', ReplaceCharsForJson(ACheckerMemo));
       end;
     end
     else  // ÉóºË²»Í¨¹ý
     begin
       sURL := Format('%suser/set/%d/%d/%d/checkno', [FMeasureURL, AUserID, ATenderID, APhaseNo]);
-      IdDataStream.AddFormField('CheckerMemo', ACheckerMemo);
+      IdDataStream.AddFormField('CheckerMemo', ReplaceCharsForJson(ACheckerMemo));
     end;
 
     IdDataStream.AddFormField('upfile', AFile);
@@ -603,7 +603,7 @@ begin
     sURL := Format('%stender/attachment/%d/%d/upload', [FMeasureURL, AWebID, AUperID]);
     vMPFDS.AddFormField('itemid', IntToStr(ABillID));
     vMPFDS.AddFormField('Category', ACategory);
-    vMPFDS.AddFormField('Memo', AMemo);
+    vMPFDS.AddFormField('Memo', ReplaceCharsForJson(AMemo));
     vMPFDS.AddFormField('PhaseName', APhaseName);
     vMPFDS.AddFile('upitem', AFile, 'text/plain');
     vMPFDS.Position := 0;

+ 30 - 66
Forms/LoginFrm.pas

@@ -246,79 +246,43 @@ begin
 end;
 
 procedure TLoginFrm.edtUserClick(Sender: TObject);
+// For Test Quickly. chenshilong, 2015-09-30
 const
-  Users: array [0..10] of string =('565398228@qq.com', '1083575299@qq.com', '920520265@qq.com',
-           '862490633@qq.com', '1487044893@qq.com', '2693845524@qq.com',
-           '562203003@qq.com', '2980275662@qq.com', '405049706@qq.com',
-           '841509474@qq.com', '583747449@qq.com');
-  PWs: array [0..10] of string = ('E72G7Zlg', 'cAplXxBg', '97IC0QG5',
-         'uRi4o8N0', 'DaYWmaAD', 'Hfker87c',
-         'jjj9h8Ox', 'cuT3gNpT', 'dfFS03uD',
-         '5aTW8u1s', '123456');
+  AccArr: array[1..11, 1..3] of string = (
+    ('1', '2636698008@qq.com', 'smartcost3850887'), // 纵横销售演示服务器
+    ('2', '1971614655@qq.com', '357134933..'),
+    ('3', '1835082984@qq.com', '123456'),
+    ('4', '2417587264@qq.com', 'koukou0708'),
+    ('5', '2609827960@qq.com', 'missling'),
+    ('6', '1240621850@qq.com', '87654321'),
+    ('7', '1014149875@qq.com', 'zhbwoai'),
+    ('8', '1525739553@qq.com', '123456'),
+    ('9', '1391010261@qq.com', 'missling'),
+    ('10', '916960227@qq.com', '123456'),
+    ('11', '916960227@qq.com', '12345678') // 测试服务器
+  );
+
 var
-  iIndex: Integer;
+  i: Integer;
+  bEx: Boolean;
 begin
   if G_IsTest then
   begin
-    if edtUser.Text = '1' then
-    begin
-      edtUser.Text := '2636698008@qq.com';
-      edtPW.Text := 'smartcost3850887';
-    end
-    else if edtUser.Text = '2' then
-    begin
-      edtUser.Text := '1971614655@qq.com';
-      edtPW.Text := '357134933..';
-    end
-    else if edtUser.Text = '3' then
-    begin
-      edtUser.Text := '1835082984@qq.com';
-      edtPW.Text := '123456';
-    end
-    else if edtUser.Text = '4' then
-    begin
-      edtUser.Text := '2417587264@qq.com';
-      edtPW.Text := 'koukou0708';
-    end
-    else if edtUser.Text = '5' then
-    begin
-      edtUser.Text := '2609827960@qq.com';
-      edtPW.Text := 'missling';
-    end
-    else if edtUser.Text = '6' then
-    begin
-      edtUser.Text := '1240621850@qq.com';
-      edtPW.Text := '147369';
-    end
-    else if edtUser.Text = '7' then
+    bEx := False;
+    for i := Low(AccArr) to High(AccArr) do
     begin
-      edtUser.Text := '1014149875@qq.com';
-      edtPW.Text := 'zhbwoai';
-    end
-    else if edtUser.Text = '8' then
-    begin
-      edtUser.Text := '1525739553@qq.com';
-      edtPW.Text := '';
-    end
-    else if edtUser.Text = '9' then
-    begin
-      edtUser.Text := '1391010261@qq.com';
-      edtPW.Text := 'missling';
-    end
-    else if edtUser.Text = '10' then
-    begin
-      edtUser.Text := '916960227@qq.com';
-      edtPW.Text := '123456';
-    end
-    else if edtUser.Text = '11' then
-    begin
-      edtUser.Text := '916960227@qq.com';
-      edtPW.Text := '12345678';
-    end
-    else if edtUser.Text = '12' then
+      if AccArr[i, 1] = edtUser.Text then
+      begin
+        edtUser.Text := AccArr[i, 2];
+        edtPW.Text := AccArr[i, 3];
+        bEx := True;
+        Break;
+      end;
+    end;
+    if not bEx then
     begin
-      edtUser.Text := '';
-      edtPW.Text := '';
+      edtUser.Clear;
+      edtPW.Clear;
     end;
   end;
 end;

+ 7 - 4
Frames/ProjectFme.pas

@@ -747,8 +747,13 @@ begin
     btnSubmit.Visible := False;
     btnPass.Visible := True;
     btnNotPass.Visible := btnPass.Visible;
-    // 当前计量期轮到自已审核(自已正在审核时一定未提交过)
-    btnPass.Enabled := CheckerFrame.Me.IsChecking;
+    // 在本期我是审核人,切换到历史期有可能我没参与。 所以当CheckerFrame.Me为空时,有可能我是编制人,有可能历史期我没参与。
+    // 历史期,管你那么多,直接按钮不见。
+    if ProjectData.PhaseIndex < ProjectData.ProjProperties.PhaseCount then
+      btnPass.Enabled := False
+    else
+      btnPass.Enabled := CheckerFrame.Me.IsChecking;    
+
     btnNotPass.Enabled := btnPass.Enabled;
     btnPass.Left := jcbAudit.Left + jcbAudit.Width + 5;
     btnNotPass.Left := btnPass.Left + btnPass.Width + 1;
@@ -877,8 +882,6 @@ begin
     vCF.Free;
   end;
 
-  sCheckerMemo := ReplaceJsonChar(sCheckerMemo);
-
   try
     RefreshProgress('创建文件包');
     sJsonFile_Bills := ExtractFilePath(sAppFile) + 'JsonFile_Bills.json';

+ 9 - 9
Units/UtilMethods.pas

@@ -96,7 +96,7 @@ type
   function ExtractFileNameWithoutExt(const AFileName: string): string;
   function ShortText(AText: string; AWidth: Integer): string;                     // 文本缩略显示
   function CustomWidthText(AText: string; AWidth: Integer): string;
-  function ReplaceJsonChar(AText: string): string;                                  // 替换Json文本中的特殊字符
+  function ReplaceCharsForJson(AText: string): string;                                  // 替换Json文本中的特殊字符
   function RecoverCharsFromJson(AText: string): string;                             // 下载得到的Json文本恢复成用户需要的文本
   procedure FindFiles(APath, AExtName: string; AFileList: TStrings);
   function DeleteFolder(const FolderStr: string): Boolean;
@@ -909,10 +909,10 @@ begin
   end;
 end;
 
-function ReplaceJsonChar(AText: string): string;
+function ReplaceCharsForJson(AText: string): string;
 const
-  BefChar: array [0..6] of Char = ('{', '}', ',', ':', '"', '[', ']');
-  AftChar: array [0..6] of string = ('{', '}', ',', ':', '"', '【', '】');
+  BefChar: array [0..7] of Char = ('{', '}', ',', ':', '"', '[', ']', '%');
+  AftChar: array [0..7] of string = ('{', '}', ',', ':', '"', '【', '】', '♂');
 var I: Integer;
 begin
   AText := Trim(AText);
@@ -930,8 +930,8 @@ end;
 
 function RecoverCharsFromJson(AText: string): string;
 const
-  BefChar: array [0..0] of string = ('♂');
-  AftChar: array [0..0] of Char = ('%');
+  BefStr: array [0..1] of string = ('♂', '\r\n');
+  AftStr: array [0..1] of string = ('%', '');
 var I: Integer;
 begin
   AText := Trim(AText);
@@ -939,10 +939,10 @@ begin
 
   if AText = '' then Exit;
 
-  for I := low(BefChar) to High(BefChar) do
+  for I := low(BefStr) to High(BefStr) do
   begin
-    if Pos(BefChar[I], AText) > 0 then
-      AText := StringReplace(AText, BefChar[I], AftChar[I], [rfReplaceAll]);
+    if Pos(BefStr[I], AText) > 0 then
+      AText := StringReplace(AText, BefStr[I], AftStr[I], [rfReplaceAll]);
   end;
   Result := AText;
 end;