⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmpjgdsbm.pas

📁 ProviceSystem-公积金监管系统中心端
💻 PAS
📖 第 1 页 / 共 2 页
字号:
      application.MessageBox('软件网关IP不正确!',PMsgCaption,64);
      Edit2.SetFocus;
      exit;
    end;

    if CheckBox2.Checked then
      if SpinEdit2.Value =0 then
      begin
        application.MessageBox('软件网关指定端口不能为零!',PMsgCaption,64);
        SpinEdit2.SetFocus;
        exit;
      end;
  end;
  if CheckBox4.Checked then
  begin
    if trim(Edit3.Text)='' then
    begin
      application.MessageBox('数据库名称不能为空!',PMsgCaption,64);
      Edit3.SetFocus;
      exit;
    end;
  end;
  if chkXs.Checked then
  begin
    if trim(sPicFile)='' then
    begin
      application.MessageBox('请选择地图!',PMsgCaption,64);
      exit;
    end
    else
    if not FileExists(sPicFile) then
    begin
      application.MessageBox('地图文件不存在,请重新选择!',PMsgCaption,64);
      exit;
    end;
  end;
  Node := TNodeLabel.Create(self);
  Node.Number := trim(edtBh.Text);
  Node.Caption := Trim(edtMc.Text);
  Node.IP := Trim(Edit1.Text);
  if CheckBox3.Checked then
    Node.VIP := Trim(Edit2.Text)
  else
    Node.VIP := '';
  if CheckBox1.Checked then
    Node.Port := SpinEdit1.Value
  else
    Node.Port := 0;
  if CheckBox2.Checked then
    Node.VPort := SpinEdit2.Value
  else
    Node.VPort := 0;
  Node.DataInUpDpt := CheckBox4.Checked ;
  if Node.DataInUpDpt then
    Node.CityDataBase := trim(Edit3.Text)
  else
    Node.CityDataBase := '';
  Node.CityLevel := iDsJb;
  Node.X := posX.Value;
  Node.Y := posY.Value;
  Node.Left := posX.Value;
  Node.Top := posY.Value;
  Node.AutoSize := False;
  Node.Width := Node.Width+5;
  Node.ParentWidth := imgMap.Width ;
  Node.ParentHeight := imgMap.Height;
  Node.Cursor := crHandPoint;
  Node.HaveChild := chkXs.Checked;
  if chkXs.Checked then
  begin
//    Node.Picture.LoadFromFile(sPicFile);
    Node.PictureFile := sPicFile;
  end
  else
  begin
//    Node.Picture := nil;
    Node.PictureFile := '';
  end;
  Node.OnClick := LabelClick;
  Node.OnMouseDown := LabelMouseDown;
  Node.PopupMenu := pmNode;
  Node.ParentNode := ParentNode;
  Node.Parent := self.Panel2;
  iRet := DsBhSave(Node.Number,Node.Caption,Node.IP,Node.Port,Node.VIP,
    Node.VPort,Node.X,Node.Y,Node.ParentWidth,Node.ParentHeight,
    Node.ParentNode,Node.HaveChild,Node.DataInUpDpt,Node.CityDataBase,
    Node.CityLevel);
  if iRet = 0 then
  begin
    AddNodeLabel(aNode,Node);
    iNode := High(aNode);
    Application.MessageBox('增加成功',PMsgCaption,64);
    Result := 0;
  end
  else
  begin
    Node.Free;
    Application.MessageBox('增加失败',PMsgCaption,16);
  end;
end;

function TJgDsbm.EditSave: Smallint;
var
  Node: TNodeLabel;
  iRet: Smallint;
begin
  Result := -1;
  if trim(edtMc.Text)='' then
  begin
    application.MessageBox('名称不能为空!',PMsgCaption,64);
    edtMc.SetFocus;
    exit;
  end;
  if not IsRightIP(trim(Edit1.Text)) then
  begin
    application.MessageBox('服务器IP不正确!',PMsgCaption,64);
    Edit1.SetFocus;
    exit;
  end;
  if CheckBox1.Checked then
    if SpinEdit1.Value =0 then
    begin
      application.MessageBox('服务器指定端口不能为零!',PMsgCaption,64);
      SpinEdit1.SetFocus;
      exit;
    end;
  if CheckBox3.Checked then
  begin
    if not IsRightIP(Trim(Edit2.Text)) then
    begin
      application.MessageBox('软件网关IP不正确!',PMsgCaption,64);
      Edit2.SetFocus;
      exit;
    end;
    if CheckBox2.Checked then
      if SpinEdit2.Value =0 then
      begin
        application.MessageBox('软件网关指定端口不能为零!',PMsgCaption,64);
        SpinEdit2.SetFocus;
        exit;
      end;
  end;
  if CheckBox4.Checked then
  begin
    if trim(Edit3.Text)='' then
    begin
      application.MessageBox('数据库名称不能为空!',PMsgCaption,64);
      Edit3.SetFocus;
      exit;
    end;
  end;
  if chkXs.Checked then
  begin
    if trim(sPicFile)='' then
    begin
      application.MessageBox('请选择地图!',PMsgCaption,64);
      exit;
    end
    else
    if not FileExists(sPicFile) then
    begin
      application.MessageBox('地图文件不存在,请重新选择!',PMsgCaption,64);
      exit;
    end;
  end;
  Node := TNodeLabel.Create(self);
  Node.Number := trim(edtBh.Text);
  Node.Caption := Trim(edtMc.Text);
  Node.IP := Trim(Edit1.Text);
  if CheckBox3.Checked then
    Node.VIP := Trim(Edit2.Text)
  else
    Node.VIP := '';
  if CheckBox1.Checked then
    Node.Port := SpinEdit1.Value
  else
    Node.Port := 0;
  if CheckBox2.Checked then
    Node.VPort := SpinEdit2.Value
  else
    Node.VPort := 0;
  Node.DataInUpDpt := CheckBox4.Checked ;
  if Node.DataInUpDpt then
    Node.CityDataBase := trim(Edit3.Text)
  else
    Node.CityDataBase := '';
  Node.CityLevel := iDsJb;
//  Node.VIP := Trim(Edit2.Text);
//  Node.Port := SpinEdit1.Value;
//  Node.VPort := SpinEdit2.Value;
  Node.X := posX.Value;
  Node.Y := posY.Value;
  Node.Left := posX.Value;
  Node.Top := posY.Value;
  Node.AutoSize := False;
  Node.Width := Node.Width+5;
  Node.ParentWidth := imgMap.Width ;
  Node.ParentHeight := imgMap.Height;
  Node.Cursor := crHandPoint;
  Node.HaveChild := chkXs.Checked;
  if chkXs.Checked then
  begin
//    Node.Picture.LoadFromFile(sPicFile);
    Node.PictureFile := sPicFile;
  end
  else
  begin
//    Node.Picture := nil;
    Node.PictureFile := '';
  end;
  Node.OnClick := LabelClick;
  Node.OnMouseDown := LabelMouseDown;
  Node.PopupMenu := pmNode;
  Node.ParentNode := ParentNode;
  Node.Parent := self.Panel2;
  iRet := DsBhSave(Node.Number,Node.Caption,Node.IP,Node.Port,Node.VIP,
    Node.VPort,Node.X,Node.Y,Node.ParentWidth,Node.ParentHeight,
    Node.ParentNode,Node.HaveChild,Node.DataInUpDpt,Node.CityDataBase,
    Node.CityLevel);
  if iRet = 0 then
  begin
    ModifyNodeLabel(aNode,iNode,Node);
    Application.MessageBox('修改成功',PMsgCaption,64);
    Result := 0;
  end
  else
  begin
    Node.Free;
    Application.MessageBox('修改失败',PMsgCaption,16);
  end;
{
  aNode[iNode].AutoSize := True;
  aNode[iNode].Caption := Trim(edtMc.Text);
  aNode[iNode].URL := Trim(edtURL.Text);
  aNode[iNode].X := posX.Value;
  aNode[iNode].Y := posY.Value;
  aNode[iNode].Left := posX.Value;
  aNode[iNode].Top := posY.Value;
  aNode[iNode].AutoSize := False;
  aNode[iNode].Width := aNode[iNode].Width+5;
  aNode[iNode].ParentWidth := imgMap.Width ;
  aNode[iNode].ParentHeight := imgMap.Height;
  aNode[iNode].HaveChild := chkXs.Checked;
  if chkXs.Checked then
  begin
    aNode[iNode].Picture.LoadFromFile(sPicFile);
    aNode[iNode].PictureFile := sPicFile;
  end
  else
  begin
    aNode[iNode].Picture := nil;
    aNode[iNode].PictureFile := '';
  end;
}
end;

procedure TJgDsbm.LoadNodeList;
var
  i, iC: Integer;
begin
  iC := High(aNode);
  tvInfo.Items.Clear;
  for i:=0 to iC do
  begin
    tvInfo.Items.Add(nil, aNode[i].Number +' :  '+aNode[i].Caption);
    tvInfo.Items[i].ImageIndex :=2;
    tvInfo.Items[i].SelectedIndex :=3;
  end;
end;

procedure TJgDsbm.tvInfoChange(Sender: TObject; Node: TTreeNode);
begin
  tvInfo.Select(Node);
  iNode := tvInfo.Selected.Index;
  RefreshNode;
end;

procedure TJgDsbm.RefreshNode;
begin
  if iNode <> -1 then
  begin
    iDsJb := aNode[iNode].CityLevel;
    edtBh.Text := aNode[iNode].Number;
    edtMc.Text := aNode[iNode].Caption;
    Edit1.Text := aNode[iNode].IP;
    Edit2.Text := aNode[iNode].VIP;
    SpinEdit1.Value := aNode[iNode].Port;
    SpinEdit2.Value := aNode[iNode].VPort;
    CheckBox3.Checked := IIF(aNode[iNode].VIP='',False,True);
    CheckBox1.Checked := IIF(aNode[iNode].Port=0, False,True);
    CheckBox2.Checked := IIF(aNode[iNode].vPort=0, False,True);
    CheckBox4.Checked := aNode[iNode].DataInUpDpt;
    Edit3.Text := aNode[iNode].CityDataBase;
//    edtURL.Text := aNode[iNode].URL;
    posX.Value := round(aNode[iNode].Parent.Width*aNode[iNode].X /aNode[iNode].ParentWidth);
    posY.Value := round(aNode[iNode].Parent.Height*aNode[iNode].Y /aNode[iNode].ParentHeight);
    chkXs.Checked := aNode[iNode].HaveChild;
    sPicFile := aNode[iNode].PictureFile;
  end;
end;

procedure TJgDsbm.InitInfo;
begin
  //...待加入装载程序
  LoadDsInfo;
  if High(aNode) >-1 then
    iNode := 0;
end;

procedure TJgDsbm.CheckBox3Click(Sender: TObject);
begin
  if CheckBox3.Enabled then
  begin
    CheckBox2.Enabled := CheckBox3.Checked;
    Edit2.Enabled := CheckBox3.Checked;
    SpinEdit2.Enabled := CheckBox2.Checked;
  end;
  if not CheckBox3.Checked then
    SpinEdit2.Enabled := False;
end;

procedure TJgDsbm.CheckBox2Click(Sender: TObject);
begin
  if CheckBox2.Enabled then
    SpinEdit2.Enabled := CheckBox2.Checked;
end;

procedure TJgDsbm.CheckBox1Click(Sender: TObject);
begin
  if CheckBox1.Enabled then
    SpinEdit1.Enabled := CheckBox1.Checked;
end;

procedure TJgDsbm.LoadDsInfo;
var
  i,l: smallint;
begin
  DsInfo(aNode,ExtractFilePath(Application.ExeName),Panel2,Self);
  l:= High(aNode);
  for i:=0 to l do
  begin
    aNode[i].OnClick := LabelClick;
    aNode[i].OnMouseDown := LabelMouseDown;
    aNode[i].PopupMenu := pmNode;
  end;
  LoadNodeList;
end;

procedure TJgDsbm.FormDestroy(Sender: TObject);
var
  i, l: smallint;
begin
  l:= high(aNode);
  for i:=0 to l do
    aNode[i].Free;
end;

procedure TJgDsbm.CheckBox4Click(Sender: TObject);
begin
  if CheckBox4.Enabled then
  begin
    Edit3.Enabled := CheckBox4.Checked;
    Label8.Enabled := CheckBox4.Checked;
  end;
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -