📄 copysecurity.pas
字号:
unit copysecurity;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TFormcopysecurity = class(TForm)
Edit1: TEdit;
Edit2: TEdit;
Label1: TLabel;
Label2: TLabel;
Button1: TButton;
Button2: TButton;
Label3: TLabel;
Edit3: TEdit;
Label4: TLabel;
Edit4: TEdit;
procedure Edit1Exit(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Edit2Exit(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure Button2Click(Sender: TObject);
procedure FormKeyPress(Sender: TObject; var Key: Char);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Formcopysecurity: TFormcopysecurity;
implementation
uses datamol, security;
{$R *.DFM}
procedure TFormcopysecurity.Edit1Exit(Sender: TObject);
begin
if trim(edit1.text)<>'' then
begin
datamod.Query1.close;
datamod.query1.sql.text:='Select * from sys03011 where no='''+edit1.text+'''' ;
datamod.query1.open;
if datamod.query1.eof then
begin
application.MessageBox('你输入了一个不存在的用户代号,请重新输入!','用户代号不存在',mb_okcancel+mb_iconerror);
edit1.setfocus;
end;
end;
end;
procedure TFormcopysecurity.Button1Click(Sender: TObject);
begin
with formsecurity,datamod do
begin
adopassword.DisableControls;
adopassword.close;
Query1.Close;
Query1.sql.clear;
Query1.sql.add('Insert into sys03011 select '''+edit2.text+''','''+edit3.text+''','''+edit4.text+''' ');
Query1.sql.add('Insert into sys03012 select '''+edit2.text+''',b.menuname,b.R_add,R_edit,R_del from sys03012 b where b.no='''+edit1.text+''' ');
Query1.ExecSQL;
application.messagebox('权限复制成功!','恭喜',mb_ok+mb_iconinformation);
adopassword.open;
adopassword.enablecontrols;
end;
end;
procedure TFormcopysecurity.Edit2Exit(Sender: TObject);
begin
if trim(edit2.text)<>'' then
with datamod do
begin
Query1.Close;
Query1.Sql.TExt:='Select * from sys03011 where no='''+edit2.text+''' ';
Query1.Open;
if not Query1.Eof then
begin
application.MessageBox('此用户代号已存在,请重新输入或进入密码权限设定页面进行修改','用户代号重复',mb_okcancel+mb_iconerror);
edit2.setfocus;
end;
end;
end;
procedure TFormcopysecurity.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
action:=cafree;
formcopysecurity:=nil;
end;
procedure TFormcopysecurity.Button2Click(Sender: TObject);
begin
close;
end;
procedure TFormcopysecurity.FormKeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then
begin
key:=#0;
selectnext(activecontrol,true,true);
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -