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

📄 askinfoform.~pas

📁 一个电力企业的后台管理程序
💻 ~PAS
📖 第 1 页 / 共 3 页
字号:
   OPType := 1;
   Spd_save.Enabled := True;
   DisplayRec;
  end
 else
  Application.MessageBox('请选择要更新的记录!','信息提示',MB_OK+MB_ICONINFORMATION);

end;

procedure TFrm_AskInfo.Act_refreshExecute(Sender: TObject);
begin
 LoadInfo;
 ShowTreeNode;
 FillImage;
end;

procedure TFrm_AskInfo.Act_quitExecute(Sender: TObject);
begin
 Close;
end;

procedure TFrm_AskInfo.FormAssigned;
begin
  if Assigned(FHtmlForm) then
  begin
    FHtmlForm.Free;
    FHtmlForm:=nil;
  end;
  if Assigned(FRichForm) then
  begin
    FRichForm.free;
    FRichForm:=nil;
  end;
  if Assigned(FTxtForm) then
  begin
    FTxtForm.free;
    FTxtForm:=nil;
  end;
  if Assigned(FExcelForm) then
  begin
    //FExcelForm.OleContainer1.free;
    //FExcelForm.OleContainer1:=nil;
    FExcelForm.free;
    FExcelForm:=nil;
  end;
end;

procedure TFrm_AskInfo.ShowFile(InfoType: Integer;InfoFile: String);
begin
      case InfoType of
        1:
        begin
          FormAssigned;
          try
            if InfoFile<>'' then
            begin
              //image1.Visible:=false;
              FHtmlForm := TForm_html.Create(Application, Pal_bak);
              FHtmlForm.parent:=Pal_bak;
              FHtmlForm.Align:=alclient;
              FHtmlForm.Show;
              FHtmlForm.WebBrowser1.Navigate(InfoFile);
            end else
            begin
              if Assigned(FHtmlForm) then
              begin
                FHtmlForm.Free;
                FHtmlForm:=nil;
              end;
            end;
          except
            ShowMessage('文件名或路径有错误!请检查');
          end;
        end;
        0:
        begin
          FormAssigned;
          FRichForm :=TForm_RichEdit1.Create(Application, Pal_bak);
          FRichForm.parent:=Pal_bak;
          FRichForm.Align:=alclient;
          FRichForm.Show;
          try
            if InfoFile<>'' then
              FRichForm.Image1.Picture.LoadFromFile(InfoFile)
            else
            begin
              if Assigned(FRichForm) then
              begin
                FRichForm.free;
                FRichForm:=nil;
              end;
            end;
          except
            ShowMessage('文件名或路径有错误!请检查');
          end;
        end;
        2:  //Txt
        begin
          FormAssigned;
          FTxtForm :=TForm_RichEdit.Create(Application, Pal_bak);
          FTxtForm.parent:=Pal_bak;
          FTxtForm.Align:=alclient;
          FTxtForm.RichEdit1.Lines.Clear;
          FTxtForm.Show;
          try
            if InfoFile<>'' then
              FTxtForm.RichEdit1.Lines.LoadFromFile(InfoFile)
            else
            begin
              if Assigned(FTxtForm) then
              begin
                FTxtForm.free;
                FTxtForm:=nil;
              end;
            end;
          except
            ShowMessage('文件名或路径有错误!请检查');
          end;
        end;
        3:  //Excel
        begin
          FormAssigned;
          FExcelForm :=TForm_Excel.Create(Application, Pal_bak);
          FExcelForm.parent:=Pal_bak;
          FExcelForm.Align:=alclient;
          FExcelForm.Show;
          try
            if InfoFile<>'' then
              FExcelForm.OleContainer1.CreateObjectFromFile(InfoFile,false)
            else
            begin
              if Assigned(FExcelForm) then
              begin
                FExcelForm.OleContainer1.free;
                FExcelForm.OleContainer1:=nil;
                FExcelForm.free;
                FExcelForm:=nil;
              end;
            end;
          except
            ShowMessage('文件名或路径有错误!请检查');
          end;
        end;
        4:  //word
        begin
          FormAssigned;
          FExcelForm :=TForm_Excel.Create(Application, Pal_bak);
          FExcelForm.parent:=Pal_bak;
          FExcelForm.Align:=alclient;
          FExcelForm.Show;
          try
            if InfoFile<>'' then
              FExcelForm.OleContainer1.CreateObjectFromFile(InfoFile,false)
            else
            begin
              if Assigned(FExcelForm) then
              begin
                FExcelForm.OleContainer1.free;
                FExcelForm.OleContainer1:=nil;
                FExcelForm.free;
                FExcelForm:=nil;
              end;
            end;
          except
            ShowMessage('文件名或路径有错误!请检查');
          end;
         end;
        end;
   end;

function TFrm_AskInfo.GetFilePath(KeyStr: String): String;
var
 HostName,PathStr: String;
begin
 with TQuery.Create(nil)do
 try
  Close;
  DataBaseName := SysDM.DBMain.DatabaseName;
  Sql.Text := Format('SELECT HOST_NAME,PHYSICAL_PATH FROM LOGIC_DEVICE_LIST '+
                     'WHERE LOGIC_DEV_ID = ''%S''',[KeyStr]);
  Open;
  if RecordCount > 0 then
   begin
    HostName := FieldByName('HOST_NAME').AsString;
    PathStr := FieldByName('PHYSICAL_PATH').AsString;
    PathStr := StringReplace(PathStr,':','',[rfReplaceAll]);
    Result := '\\' + HostName + '\' + PathStr;
   end
  else
   Result := '';
 finally
  Free;
 end;
end;

procedure TFrm_AskInfo.SpeedButton1Click(Sender: TObject);
begin
 with TForm_InfoSeleFile.Create(Self)do
 try
  ShowModal;
 finally
  Free;
 end;
end;

function TFrm_AskInfo.GetFileType: String;
begin
 //showmessage(inttostr(TreeView1.Selected.Parent.Level));
 if TreeView1.Selected.Level = 0 then
  Result := 'ROOT'
 else
  Result := PNewCounselLevelThree(TreeView1.Selected.Data)^.OeName;
end;

procedure TFrm_AskInfo.FillMainType;
var
 I: Integer;
begin
 Edt_FileType.Clear;
 Edt_FileType.Items.Add('业务咨询信息');
 with TQuery.Create(nil) do
 try
  Close;
  DataBaseName := SysDM.DBMain.DatabaseName;
  Sql.Text := 'Select ClassName From KNOWLEDGE_BURSARY Where TWOLEVELNO = 0 And THREELEVELNO = 0';
  Open;
  for I := 0 to RecordCount - 1 do
   begin
    Edt_FileType.Items.Add(FieldByName('ClassName').AsString);
    Next;
   end;
 finally
  Free;
 end;
end;
procedure TFrm_AskInfo.Edt_FileTypeEnter(Sender: TObject);
begin
 FillMainType;
end;

procedure TFrm_AskInfo.FillSubType;
var
 I : Integer;
 TopStr: String;
begin
 Cb_SubFileType.Clear;
 with TQuery.Create(nil)do
 try
  Close;
  DataBaseName := SysDM.DBMain.DatabaseName;
  Sql.Text := Format('Select ONELEVELNO from KNOWLEDGE_BURSARY where classname = ''%s''',[Edt_FileType.Text]);
  Open;
  TopStr := FieldByName('ONELEVELNO').AsString;
  Close;
  if TopStr = '' then
   Exit;
  Sql.Text := Format('Select ClassName From KNOWLEDGE_BURSARY Where ONELEVELNO'+
                     ' = %s And TWOLEVELNO <> 0 And THREELEVELNO = 0',[TopStr]);
  Open;                   
  Cb_SubFileType.Items.Add('');
  Last;
  First;
  for I := 0 to RecordCount - 1 do
   begin
    Cb_SubFileType.Items.Add(FieldByName('ClassName').AsString);
    Next;
   end;
 finally
  Free;
 end;
end;

Procedure TFrm_AskInfo.GetFirstNodeNo;
var
 OneTopStr: String;
begin
 if Trim(Edt_FileType.Text) = '业务咨询信息' then    //1top
  begin
   NodeOneLevel := GetMaxNo('','');
   NodeTwoLevel := '0';
   NodeThreeLevel := '0';
  end
 else
  begin
   with TQuery.Create(nil)do
   try
    Close;
    DataBaseName := SysDM.DBMain.DatabaseName;
    if Cb_SubFileType.Text = '' then //tow top
     begin
      Sql.Text := Format('SELECT ONELEVELNO FROM KNOWLEDGE_BURSARY WHERE CLASSNAME = ''%S''',[Trim(Edt_FileType.Text)]);
      Open;
      NodeOneLevel := FieldByName('ONELEVELNO').AsString;
      NodeTwoLevel := GetMaxNo(FieldByName('ONELEVELNO').AsString,'');
      NodeThreeLevel := '0';
     end
    else
     begin   //three top
      Sql.Text := Format('Select ONELEVELNO From KNOWLEDGE_BURSARY Where ClassName '+
                         ' = ''%S''',[Edt_FileType.Text]);
      Open;
      OneTopStr:= FieldByName('ONELEVELNO').AsString;
      Close;
      Sql.Text := Format('select TWOLEVELNO from KNOWLEDGE_BURSARY where ONELEVELNO = ''%s'''+
                         ' and className = ''%s''',[OneTopStr,Cb_SubFileType.Text]);
      Open;
      NodeOneLevel := OneTopStr ;
      NodeTwoLevel := FieldByName('TWOLEVELNO').AsString;
      NodeThreeLevel := GetMaxNo(OneTopStr,FieldByName('TWOLEVELNO').AsString);
     end;

   finally
    Free;
   end;

  end;

end;


procedure TFrm_AskInfo.Cb_SubFileTypeEnter(Sender: TObject);
begin
 FillSubType;
end;

procedure TFrm_AskInfo.ShowFileType(KeyStr : String);
begin
 with Tquery.Create(nil)do
 try
  Close;
  DataBaseName := SysDM.DBMain.DatabaseName;
  Sql.Text := Format('Select * From KNOWLEDGE_BURSARY where classno = ''%s''',[KeyStr]);
  Open;
  Edt_FileType.Clear;
  Edt_FileType.Items.Add(FieldByName('infotypestr').asString);
  Edt_FileType.ItemIndex := 0;
  Edt_FileType.Enabled := False;
  Cb_SubFileType.Clear;
  Cb_SubFileType.Items.Add(FieldByName('infosubtypestr').asString);
  Cb_SubFileType.ItemIndex := 0;
  Cb_SubFileType.Enabled := False;

 finally
  Free;
 end;
end;

procedure TFrm_AskInfo.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin
    if screen.FormCount=2 then WebIsHide(0);
    Action:=CaFree;
    Frm_AskInfo :=nil;

end;

procedure TFrm_AskInfo.FillImage;
var
 I : Integer;
begin
 for I := 0 to TreeView1.Items.Count - 1 do
  begin
   if TreeView1.Items.Item[I].HasChildren then
    TreeView1.Items.Item[I].ImageIndex := 1
   else
    TreeView1.Items.Item[I].ImageIndex := 0;
  end;
end;



end.

⌨️ 快捷键说明

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