📄 frm_zdwh.pas
字号:
if Self.Components[i] is Tedit then
Tedit(Self.Components[i]).Text:='';
end;
end;
end;
procedure tfrm_zd.addfield;
var
leixing,Engtype,sqlstr:string;
i,index,labcount:integer;
begin
sqlstr:='insert into field_info (table_name,lab_name,field,bx_info,is_browse,cx_field,x,y,ord,notnull,type,yn,page,compx,compy) '+
'values (:table_name,:lab_name,:field,:bx_info,:is_browse,:cx_field,:x,:y,:ord,:notnull,:type,:yn,:page,:compx,:compy)';
with dm.ADOQuery1 do
begin
close;
sql.Clear;
SQL.Add(SQLSTR);
parameters[0].Value:=edit4.Text; //表名 table_name
parameters[1].Value:=edit1.Text; //中文名 lab_mame
parameters[2].Value:=edit2.Text; //英文名 field
if combobox3.Text='是' then //是否有备选信息 bx_info
parameters[3].Value:=true
else if combobox3.Text='否' then
parameters[3].Value:=false;
if combobox5.Text='是' then //是否为从属信息 is_browse
parameters[4].Value:=true
else if combobox5.Text='否' then
parameters[4].Value:=false;
if combobox4.Text='是' then //是否为查询字段 cx_field
parameters[5].Value:=true
else if combobox4.Text='否' then
parameters[5].Value:=false;
if IsNumeric(edit12.Text)=false then
begin
showmessage('控件坐标应该为数字!');
exit;
end;
parameters[6].Value:=edit12.Text;
if IsNumeric(edit13.text)=false then
begin
showmessage('控件坐标应该为数字!');
exit;
end;
parameters[7].Value:=edit13.Text;
if (edit11.Text='') or (edit11.Text='0') then
begin
parameters[8].Value:=1;
index:=1;
end else
begin
parameters[8].Value:=strtoint(edit11.Text);
index:=strtoint(edit11.Text);
end;
if combobox1.Text='是' then //是否必填
parameters[9].Value:=true
else if combobox1.Text='否' then
parameters[9].Value:=false;
if combobox2.Text='是' then //是否必填
parameters[11].Value:='1'
else if combobox2.Text='否' then
parameters[11].Value:='0';
if (edit5.Text='') or (edit5.Text='0') then
begin
i:=1;
parameters[12].Value:=1; //2006-03
end else
begin
parameters[12].Value:=strtoint(edit5.Text);
i:=strtoint(edit5.Text); //2006-03
end;
if IsNumeric(edit14.Text)=false then
begin
showmessage('控件坐标应该为数字!');
exit;
end;
parameters[13].Value:=edit14.Text;
if IsNumeric(edit15.Text)=false then
begin
showmessage('控件坐标应该为数字!');
exit;
end;
parameters[14].Value:=edit15.Text;
//////////////2006-03//动态创建组建//////////////////////////
leixing:='text(50)';
////////////////////////////////////////////////////////////////////
if (combobox6.Text='数字') or (combobox6.Text='文本') then
begin
parameters[10].Value:='E';
leixing:='int';
/////////////////////////////////////////////////////////
end;
if combobox6.Text='文本' then
begin
parameters[10].Value:='E';
leixing:='text(50)';
end;
if combobox6.Text='日期' then
begin
parameters[10].Value:='D';
leixing:='date';
end;
if combobox6.Text='备注' then
begin
leixing:='text(200)';
parameters[10].Value:='M';
end;
if combobox6.Text='是/否' then
begin
leixing:='boolean';
parameters[10].Value:='B';
end;
try
execsql;
except
exit;
end;
end;
//////////////2006-03//////////////////////
with dm.ADOQuery2 do
begin
close;
sql.Clear;
sql.Add('ALTER TABLE '+trim(edit4.Text)+' ADD '+trim(edit2.Text)+' '+leixing);
execsql;
close;
sql.Clear;
sql.Add('select * from field_info where yn=''1'' and page='+inttostr(i));
open;
labcount:=recordcount;
end;
setlength(Form4.labelcaption1[i-1],labcount);
setlength(Form4.editbox1[i-1],labcount);//editboxcount);
setlength(Form4.combobox1[i-1],labcount);//comboboxcount);
setlength(Form4.maskedit1[i-1],labcount);
setlength(Form4.checkbox1[i-1],labcount);
setlength(Form4.memo1[i-1],labcount);
setlength(labelcaption[i-1],labcount);
setlength(editbox[i-1],labcount);//editboxcount);
setlength(combobox[i-1],labcount);//comboboxcount);
setlength(maskedit[i-1],labcount);
setlength(checkbox[i-1],labcount);
setlength(memo[i-1],labcount);
////////////////////////////////////////////////////////////////////
Form4.labelcaption1[i-1][index]:=tmovelabel.Create(self);
Form4.labelcaption1[i-1][index].Visible:=true;
Form4.tabsheet1[i-1].InsertControl(Form4.labelcaption1[i-1][index]);
Form4.labelcaption1[i-1][index].Font.Size:=8;
Form4.labelcaption1[i-1][index].Caption:=edit1.Text;
Form4.labelcaption1[i-1][index].Top:=strtoint(edit12.Text);//iTop+15;
Form4.labelcaption1[i-1][index].Left:=strtoint(edit13.Text);//ileft;
Form4.labelcaption1[i-1][index].Width:=100;
Form4.labelcaption1[i-1][index].Color:=clGradientInactiveCaption;
tabsheet[i-1].PageControl:=frm_main.PageControl1;
labelcaption[i-1][index]:=tlabel.Create(self);
labelcaption[i-1][index].Visible:=true;
tabsheet[i-1].InsertControl(labelcaption[i-1][index]);
labelcaption[i-1][index].Font.Size:=8;
labelcaption[i-1][index].Width:=100;
labelcaption[i-1][index].Top:=strtoint(edit12.Text);//iTop+15;
labelcaption[i-1][index].Left:=strtoint(edit13.Text);//ileft;
labelcaption[i-1][index].Caption:=(edit1.Text);
labelcaption[i-1][index].Color:=clGradientInactiveCaption;
////////////////////////////////////////////////////////////////////
if (combobox6.Text='数字') or (combobox6.Text='文本') then
begin
//////////////2006-03/////////////////////////////////
Form4.editbox1[i-1][index]:=tmovelabel.Create(self);
Form4.editbox1[i-1][index].Visible:=true;
Form4.TabSheet1[i-1].InsertControl(Form4.editbox1[i-1][index]);
Form4.editbox1[i-1][index].Top:=strtoint(edit14.Text);//labelcaption[i-1][index].Top;
Form4.editbox1[i-1][index].Left:=strtoint(edit15.Text);//labelcaption[i-1][index].Left+labelcaption[i-1][index].Width+10;
Form4.editbox1[i-1][index].Font.Name:= '宋体';
Form4.editbox1[i-1][index].Color:=clwindow;
//////////////////////////////////////////////////////////////
editbox[i-1][index]:=tedit.Create(self);
editbox[i-1][index].Visible:=true;
TabSheet[i-1].InsertControl(editbox[i-1][index]);
editbox[i-1][index].Top:=strtoint(edit14.Text);//labelcaption[i-1][index].Top;
editbox[i-1][index].Left:=strtoint(edit15.Text);//labelcaption[i-1][index].Left+labelcaption[i-1][index].Width+10;
editbox[i-1][index].Font.Name:= '宋体';
// editbox[i-1][index].Color:=clwindow;
/////////////////////////////////////////////////////////
end;
if combobox6.Text='日期' then
begin
Form4.labelcaption1[i-1][index]:=tmovelabel.Create(self);
Form4.labelcaption1[i-1][index].Visible:=true;
Form4.tabsheet1[i-1].InsertControl(Form4.labelcaption1[i-1][index]);
Form4.labelcaption1[i-1][index].Font.Size:=8;
Form4.labelcaption1[i-1][index].Caption:=edit1.Text;
Form4.labelcaption1[i-1][index].Top:=strtoint(edit12.Text);//iTop+15;
Form4.labelcaption1[i-1][index].Left:=strtoint(edit13.Text);//ileft;
Form4.labelcaption1[i-1][index].Width:=100;
Form4.labelcaption1[i-1][index].Color:=clGradientInactiveCaption;
Form4.maskedit1[i-1][index]:=tmovelabel.Create(self);
Form4.maskedit1[i-1][index].Visible:=true;
Form4.tabsheet1[i-1].InsertControl(Form4.maskedit1[i-1][index]);
Form4.maskedit1[i-1][index].Top:=strtoint(edit14.Text);//labelcaption[i-1][index].Top;
Form4.maskedit1[i-1][index].Left:=strtoint(edit15.Text);//labelcaption[i-1][index].Left+labelcaption[i-1][index].Width+10;
Form4.maskedit1[i-1][index].Font.Name:= '宋体';
Form4.maskedit1[i-1][index].Color:=clwindow;
//////////////////////////////////////////////////////////////
maskedit[i-1][index]:=tmaskedit.Create(self);
maskedit[i-1][index].Visible:=true;
TabSheet[i-1].InsertControl(maskedit[i-1][index]);
maskedit[i-1][index].Top:=strtoint(edit14.Text);//labelcaption[i-1][index].Top;
maskedit[i-1][index].Left:=strtoint(edit15.Text);//labelcaption[i-1][index].Left+labelcaption[i-1][index].Width+10;
maskedit[i-1][index].Font.Name:= '宋体';
end;
if combobox6.Text='备注' then
begin
Form4.memo1[i-1][index]:=tmovelabel.Create(self);
Form4.memo1[i-1][index].Visible:=true;
Form4.tabsheet1[i-1].InsertControl(Form4.memo1[i-1][index]);
Form4.memo1[i-1][index].Top:=strtoint(edit14.Text);//labelcaption[i-1][index].Top;
Form4.memo1[i-1][index].Left:=strtoint(edit15.Text);//labelcaption[i-1][index].Left+labelcaption[i-1][index].Width+10;
Form4.memo1[i-1][index].Font.Name:= '宋体';
Form4.memo1[i-1][index].Color:=clwindow;
//////////////////////////////////////////////////////////////
memo[i-1][index]:=tmemo.Create(self);
memo[i-1][index].Visible:=true;
memo[i-1][index].ScrollBars:=ssBoth;
TabSheet[i-1].InsertControl(memo[i-1][index]);
memo[i-1][index].Top:=strtoint(edit14.Text);//labelcaption[i-1][index].Top;
memo[i-1][index].Left:=strtoint(edit15.Text);//labelcaption[i-1][index].Left+labelcaption[i-1][index].Width+10;
memo[i-1][index].Font.Name:= '宋体';
end;
if combobox6.Text='是/否' then
begin
Form4.checkbox1[i-1][index]:=tmovelabel.Create(self);
Form4.checkbox1[i-1][index].Visible:=true;
Form4.tabsheet1[i-1].InsertControl(Form4.checkbox1[i-1][index]);
Form4.checkbox1[i-1][index].Top:=strtoint(edit14.Text);//labelcaption[i-1][index].Top;
Form4.checkbox1[i-1][index].Left:=strtoint(edit15.Text);//labelcaption[i-1][index].Left+labelcaption[i-1][index].Width+10;
Form4.checkbox1[i-1][index].Font.Name:= '宋体';
Form4.checkbox1[i-1][index].Color:=clwindow;
//////////////////////////////////////////////////////////////
checkbox[i-1][index]:=tcheckbox.Create(self);
checkbox[i-1][index].Visible:=true;
TabSheet[i-1].InsertControl(checkbox[i-1][index]);
checkbox[i-1][index].Top:=strtoint(edit14.Text);//labelcaption[i-1][index].Top;
checkbox[i-1][index].Left:=strtoint(edit15.Text);//labelcaption[i-1][index].Left+labelcaption[i-1][index].Width+10;
checkbox[i-1][index].Font.Name:= '宋体';
end;
end;
procedure tfrm_zd.delfield;
begin
end;
procedure tfrm_zd.modfield;
var
sqlstr:string;
i,tempage,temindex:integer;
begin
sqlstr:='update field_info set table_name=:table_name,lab_name=:lab_name,field=:field,bx_info=:bx_info,'+
'is_browse=:is_browse,cx_field=:cx_field,x=:x,y=:y,ord=:ord,notnull=:notnull,type=:type,yn=:yn,'+
'page=:page,compx=:compx,compy=:compy where id=:id';
with dm.ADOQuery1 do
begin
close;
sql.Clear;
sql.Add(sqlstr);
parameters[0].Value:=edit4.Text; //表名 table_name
parameters[1].Value:=edit1.Text; //中文名 lab_mame
parameters[2].Value:=edit2.Text; //英文名 field
if combobox3.Text='是' then //是否有备选信息 bx_info
parameters[3].Value:=true
else if combobox3.Text='否' then
parameters[3].Value:=false;
if combobox5.Text='是' then //是否为从属信息 is_browse
parameters[4].Value:=true
else if combobox5.Text='否' then
parameters[4].Value:=false;
if combobox4.Text='是' then //是否为查询字段 cx_field
parameters[5].Value:=true
else if combobox4.Text='否' then
parameters[5].Value:=false;
parameters[6].Value:=edit12.Text; //x
parameters[7].Value:=edit13.Text; //y
if edit11.Text='' then
parameters[8].Value:=0
else
begin
parameters[8].Value:=strtoint(edit11.Text);
end;
if combobox1.Text='是' then //是否必填
parameters[9].Value:=true
else if combobox1.Text='否' then
parameters[9].Value:=false;
if combobox6.Text='文本' then //类型
parameters[10].Value:='E';
if combobox6.Text='日期' then
parameters[10].Value:='D';
if combobox6.Text='备注' then
parameters[10].Value:='M';
if combobox6.Text='是/否' then
parameters[10].Value:='B';
//parameters[10].Value:=combobox6.Text;
if combobox2.Text='是' then //是否显示
parameters[11].Value:='1'
else if combobox2.Text='否' then
parameters[11].Value:='0';
if edit5.Text='' then //页面值
parameters[12].Value:=0
else
parameters[12].Value:=strtoint(edit5.Text);
parameters[13].Value:=edit14.Text;
parameters[14].Value:=edit15.Text;
parameters[15].Value:=id;
try
execsql;
except
exit;
end;
dm.ADOQuery7.Close;
dm.ADOQuery7.Open;
/////////////////2006-03////////////////////////////
if (edit5.Text='') or (edit5.Text='0') then
tempage:=1
else
tempage:=strtoint(edit5.Text);
if (edit11.Text='') or (edit11.Text='0') then
temindex:=1
else
temindex:=strtoint(edit11.Text);
///////////////更改标签名///////////////////////////////////
form4.labelcaption1[tempage-1][temindex-1].Caption:=edit1.Text;
labelcaption[tempage-1][temindex-1].Caption:=edit1.Text;
{
if (combobox6.Text='文本') or (combobox6.Text='数字') then
begin
Form4.editbox1[tempage-1][temindex-1].Destroy;
editbox[tempage-1][temindex-1].Destroy;
end;
if combobox6.Text='日期' then
begin
Form4.maskedit1[tempage-1][temindex-1].Destroy;
maskedit[tempage-1][temindex-1].Destroy;
end;
if combobox6.Text='备注' then
begin
Form4.memo1[tempage-1][temindex-1].Destroy;
memo[tempage-1][temindex-1].Destroy;
end;
if combobox6.Text='是/否' then
begin
Form4.checkbox1[tempage-1][temindex-1].Destroy;
end;
}
/////////////////////////////////////////////////////////
for i:=0 to 14 do
begin
dbgrid1.Columns[i].Width:=colwidth;
end;
end;
end;
procedure Tfrm_zd.B_SAVEClick(Sender: TObject);
var
tempsql:string;
begin
/////////////////2006-03//////////////////////////////////////
with dm.ADOQuery2 do
begin
close;
sql.Clear;
sql.Add('select * from field_info where table_name='''+trim(edit4.Text)+'''');
open;
first;
if eof then
begin
with dm.ADOQuery1 do
begin
close;
sql.Clear;
//sql.Add('CREATE TABLE '++' id int NOT NULL');
sql.Add('CREATE TABLE '+trim(edit4.Text));
execsql;
end;
//application.MessageBox('','信息提示',mb_ok);
//exit;
end;
end;
/////////////////////////////////////////////////////////////////////
if edit1.Text='' then
begin
showmessage('字段中文名不能为空!');
exit;
end;
if edit2.Text='' then
begin
showmessage('字段英文名不能为空!');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -