unit u_sys_data; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, Mask, wwdbedit, Wwdotdot, Wwdbcomb, CheckLst, bsSkinCtrls, DB, ADODB, dxExEdtr, dxCntner, dxTL, dxDBCtrl, dxDBGrid, dxDBTLCl, dxGrClms, Menus, bsSkinMenus, XPMenu, DBCtrls; type Tfra_sys_data = class(TFrame) t_op: TADOQuery; t_op1: TDataSource; bsSkinGroupBox9: TbsSkinGroupBox; bsSkinPanel1: TbsSkinPanel; bsSkinButton2: TbsSkinButton; bsSkinButton5: TbsSkinButton; dxDBGrid1: TdxDBGrid; dxDBGrid1Column1: TdxDBGridMaskColumn; dxDBGrid1Column2: TdxDBGridCheckColumn; dxDBGrid1Column3: TdxDBGridCheckColumn; PopupMenu1: TPopupMenu; N1: TMenuItem; N2: TMenuItem; N3: TMenuItem; N4: TMenuItem; N5: TMenuItem; N6: TMenuItem; N7: TMenuItem; N8: TMenuItem; N9: TMenuItem; N10: TMenuItem; N12: TMenuItem; N13: TMenuItem; N14: TMenuItem; N15: TMenuItem; N16: TMenuItem; N17: TMenuItem; N18: TMenuItem; XPMenu1: TXPMenu; XPMenu2: TXPMenu; N11: TMenuItem; N19: TMenuItem; N20: TMenuItem; N21: TMenuItem; t_sql: TADOQuery; t_sql1: TDataSource; bsSkinPanel2: TbsSkinPanel; Label1: TLabel; wwDBComboBox1: TwwDBComboBox; DBMemo1: TDBMemo; procedure N8Click(Sender: TObject); procedure bsSkinButton5Click(Sender: TObject); procedure bsSkinButton2Click(Sender: TObject); procedure N4Click(Sender: TObject); procedure N6Click(Sender: TObject); procedure N2Click(Sender: TObject); procedure N18Click(Sender: TObject); procedure N16Click(Sender: TObject); procedure N14Click(Sender: TObject); procedure N12Click(Sender: TObject); procedure N19Click(Sender: TObject); procedure N20Click(Sender: TObject); procedure t_sqlAfterInsert(DataSet: TDataSet); procedure wwDBComboBox1Change(Sender: TObject); private { Private declarations } public { Public declarations } end; implementation uses u_main, u_data_share; {$R *.dfm} procedure Tfra_sys_data.N8Click(Sender: TObject); begin t_op.first; while not t_op.eof do begin t_op.edit; t_op['是否可视']:=0; t_op.post; t_op.next; end; if t_op.Locate('职员',t_op.DataSource.DataSet['姓名'],[])then begin t_op.edit; t_op['是否可视']:=1; t_op.post; end; end; procedure Tfra_sys_data.bsSkinButton5Click(Sender: TObject); begin if (t_op.State=dsedit)or(t_op.State=dsinsert)then t_op.post; if (t_sql.State=dsedit)or(t_sql.State=dsinsert)then t_sql.post; end; procedure Tfra_sys_data.bsSkinButton2Click(Sender: TObject); var Pnt:Tpoint; begin Pnt:=bsSkinButton2.ClientToScreen(Point(0,bsSkinButton2.Height)); PopupMenu1.Popup(Pnt.x,Pnt.y); end; procedure Tfra_sys_data.N4Click(Sender: TObject); begin t_op.first; while not t_op.eof do begin t_op.edit; t_op['是否可视']:=1; t_op.post; t_op.next; end; end; procedure Tfra_sys_data.N6Click(Sender: TObject); begin t_op.first; while not t_op.eof do begin t_op.edit; t_op['是否可视']:=0; t_op.post; t_op.next; end; try frm_data_share.t_sys_employee.FIRST; while not frm_data_share.t_sys_employee.eof do begin if t_op.Locate('职员',frm_data_share.t_sys_employee.fieldbyname('姓名').asstring,[])then begin if (frm_data_share.t_sys_employee.fieldbyname('部门名称').asstring =t_op.DataSource.DataSet.fieldbyname('部门名称').asstring) and (frm_data_share.t_sys_employee.fieldbyname('分部名称').asstring =t_op.DataSource.DataSet.fieldbyname('分部名称').asstring) then begin t_op.edit; t_op['是否可视']:=1; t_op.post; end; end; frm_data_share.t_sys_employee.next; end; finally ; end; end; procedure Tfra_sys_data.N2Click(Sender: TObject); begin t_op.first; while not t_op.eof do begin t_op.edit; t_op['是否可视']:=0; t_op.post; t_op.next; end; end; procedure Tfra_sys_data.N18Click(Sender: TObject); begin t_op.first; while not t_op.eof do begin t_op.edit; t_op['是否操作']:=0; t_op.post; t_op.next; end; if t_op.Locate('职员',t_op.DataSource.DataSet['姓名'],[])then begin t_op.edit; t_op['是否操作']:=1; t_op.post; end; end; procedure Tfra_sys_data.N16Click(Sender: TObject); begin t_op.first; while not t_op.eof do begin t_op.edit; t_op['是否操作']:=0; t_op.post; t_op.next; end; try frm_data_share.t_sys_employee.FIRST; while not frm_data_share.t_sys_employee.eof do begin if t_op.Locate('职员',frm_data_share.t_sys_employee.fieldbyname('姓名').asstring,[])then begin if (frm_data_share.t_sys_employee.fieldbyname('部门名称').asstring =t_op.DataSource.DataSet.fieldbyname('部门名称').asstring) and (frm_data_share.t_sys_employee.fieldbyname('分部名称').asstring =t_op.DataSource.DataSet.fieldbyname('分部名称').asstring) then begin t_op.edit; t_op['是否操作']:=1; t_op.post; end; end; frm_data_share.t_sys_employee.next; end; finally ; end; end; procedure Tfra_sys_data.N14Click(Sender: TObject); begin t_op.first; while not t_op.eof do begin t_op.edit; t_op['是否操作']:=1; t_op.post; t_op.next; end; end; procedure Tfra_sys_data.N12Click(Sender: TObject); begin t_op.first; while not t_op.eof do begin t_op.edit; t_op['是否操作']:=0; t_op.post; t_op.next; end; end; procedure Tfra_sys_data.N19Click(Sender: TObject); begin // by lcx t_op.first; while not t_op.eof do begin t_op.edit; t_op['是否可视']:=0; t_op.post; t_op.next; end; try frm_data_share.t_sys_employee.FIRST; while not frm_data_share.t_sys_employee.eof do begin if t_op.Locate('职员',frm_data_share.t_sys_employee.fieldbyname('姓名').asstring,[])then begin if (frm_data_share.t_sys_employee.fieldbyname('分部名称').asstring =t_op.DataSource.DataSet.fieldbyname('分部名称').asstring) then begin t_op.edit; t_op['是否可视']:=1; t_op.post; end; end; frm_data_share.t_sys_employee.next; end; finally ; end; end; procedure Tfra_sys_data.N20Click(Sender: TObject); begin //by lcx t_op.first; while not t_op.eof do begin t_op.edit; t_op['是否操作']:=0; t_op.post; t_op.next; end; try frm_data_share.t_sys_employee.FIRST; while not frm_data_share.t_sys_employee.eof do begin if t_op.Locate('职员',frm_data_share.t_sys_employee.fieldbyname('姓名').asstring,[])then begin if (frm_data_share.t_sys_employee.fieldbyname('分部名称').asstring =t_op.DataSource.DataSet.fieldbyname('分部名称').asstring) then begin t_op.edit; t_op['是否操作']:=1; t_op.post; end; end; frm_data_share.t_sys_employee.next; end; finally ; end; end; procedure Tfra_sys_data.t_sqlAfterInsert(DataSet: TDataSet); begin t_sql['人员']:=t_op.DataSource.DataSet['姓名']; t_sql['属性']:=t_op['属性']; end; procedure Tfra_sys_data.wwDBComboBox1Change(Sender: TObject); begin if wwDBComboBox1.text='全部' then N4Click(sender) else if wwDBComboBox1.text='部门' then N6Click(sender) else if wwDBComboBox1.text='分公司' then N19Click(sender); end; end.