📄 main_xtgl_qxgl.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{F0D2F211-CCB0-11D0-A316-00AA00688B10}#1.0#0"; "MSDATLST.OCX"
Begin VB.Form main_xtgl_qxgl
Caption = "系统管理-【权限管理】"
ClientHeight = 3300
ClientLeft = 60
ClientTop = 345
ClientWidth = 5250
LinkTopic = "Form1"
ScaleHeight = 3300
ScaleWidth = 5250
StartUpPosition = 1 '所有者中心
Begin VB.Frame Frame2
Caption = "权限设置"
Height = 2115
Left = 1425
TabIndex = 6
Top = 705
Width = 3765
Begin VB.CheckBox Check1
Caption = "系统管理"
Height = 240
Index = 4
Left = 2325
TabIndex = 15
Top = 390
Width = 1095
End
Begin VB.CheckBox Check1
Caption = "基础信息管理"
Height = 240
Index = 0
Left = 300
TabIndex = 11
Top = 390
Width = 1410
End
Begin VB.CheckBox Check1
Caption = "图书管理"
Height = 240
Index = 1
Left = 300
TabIndex = 10
Top = 795
Width = 1065
End
Begin VB.CheckBox Check1
Caption = "借阅管理"
Height = 240
Index = 2
Left = 300
TabIndex = 9
Top = 1200
Width = 1155
End
Begin VB.CheckBox Check1
Caption = "决策分析"
Height = 240
Index = 3
Left = 300
TabIndex = 8
Top = 1605
Width = 1095
End
Begin VB.CheckBox Check1
Caption = "系统维护"
Height = 240
Index = 5
Left = 2325
TabIndex = 7
Top = 795
Width = 1095
End
End
Begin VB.CommandButton Command1
Caption = "全选"
Height = 360
Left = 1515
TabIndex = 5
Top = 2880
Width = 870
End
Begin VB.CommandButton Command2
Caption = "全不选"
Height = 360
Left = 2415
TabIndex = 4
Top = 2880
Width = 870
End
Begin VB.CommandButton Command3
Caption = "确定"
Height = 360
Left = 3315
TabIndex = 3
Top = 2880
Width = 870
End
Begin VB.CommandButton Command4
Caption = "退出"
Height = 360
Left = 4215
TabIndex = 2
Top = 2880
Width = 870
End
Begin MSDataListLib.DataList DataList1
Bindings = "main_xtgl_qxgl.frx":0000
Height = 2160
Left = 60
TabIndex = 0
Top = 960
Width = 1275
_ExtentX = 2249
_ExtentY = 3810
_Version = 393216
ListField = "操作员"
End
Begin MSAdodcLib.Adodc Adodc1
Height = 330
Left = -1020
Top = 1980
Visible = 0 'False
Width = 1305
_ExtentX = 2302
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 1
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 3
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "DSN=NBooks"
OLEDBString = ""
OLEDBFile = ""
DataSourceName = "NBooks"
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "select * from qxb"
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin VB.Frame Frame1
Height = 555
Left = 60
TabIndex = 12
Top = 0
Width = 5145
Begin VB.ComboBox Combo1
Height = 300
Left = 1395
TabIndex = 13
Text = "Combo1"
Top = 165
Width = 3510
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "操作员级别:"
Height = 210
Left = 225
TabIndex = 14
Top = 240
Width = 1155
End
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "操作员列表"
Height = 180
Left = 75
TabIndex = 1
Top = 690
Width = 1140
End
End
Attribute VB_Name = "main_xtgl_qxgl"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim i, a As Integer '声明整型变量
Dim rs1 As New ADODB.Recordset '声明数据集对象
Private Sub Find() '声明过程
'查询操作员级别
Adodc1.RecordSource = "select * from qxb where 操作员级别='" + Combo1.text + "'"
Adodc1.Refresh
'根据操作员级别给定权限范围
If Combo1.text = "系统管理员" Then
a = 5
Check1(4).Enabled = True
Check1(5).Enabled = True
End If
If Combo1.text = "高级操作员" Then
a = 4
Check1(4).Enabled = True
Check1(5).Enabled = False
End If
If Combo1.text = "普通操作员" Then
a = 3
Check1(4).Enabled = False
Check1(5).Enabled = False
End If
End Sub
Private Sub Form_Load()
'添加操作员级别列表
Combo1.AddItem ("系统管理员")
Combo1.AddItem ("高级操作员")
Combo1.AddItem ("普通操作员")
Combo1.ListIndex = 0
Call Find '调用过程
End Sub
Private Sub Form_Unload(Cancel As Integer)
frm_main.Enabled = True
End Sub
Private Sub Combo1_Click()
Call Find '调用过程
For i = 0 To 5
Check1(i).Value = 0
Next i
End Sub
Private Sub DataList1_Click()
'按操作员查询记录
rs1.Open "select * from qxb where 操作员='" + DataList1.text + "'", Cnn, adOpenKeyset, adLockOptimistic
If rs1.RecordCount > 0 Then '假如记录大于零
'浏览操作员权限
For i = 0 To 5
If rs1.Fields(i) = True Then Check1(i).Value = 1 Else Check1(i).Value = 0
Next i
End If
rs1.Close
End Sub
Private Sub Command1_Click() '全选
For i = 0 To a
Check1(i).Value = 1
Next i
End Sub
Private Sub Command2_Click() '全不选
For i = 0 To a
Check1(i).Value = 0
Next i
End Sub
Private Sub Command3_Click()
If DataList1.SelectedItem Then '假如选定操作员
'给选定的操作员赋予权限
rs1.Open "select * from qxb where 操作员='" + DataList1.text + "'", Cnn, adOpenKeyset, adLockOptimistic
If rs1.RecordCount > 0 Then
For i = 0 To 5
If Check1(i).Value = 1 Then rs1.Fields(i) = True Else rs1.Fields(i) = False
Next i
rs1.Update
End If
rs1.Close
MsgBox "操作员权限设置成功!"
Else
MsgBox "请选择操作员!"
End If
End Sub
Private Sub Command4_Click()
frm_main.Enabled = True
Unload Me
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -