📄 frmuserman.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 FrmUserMan
BorderStyle = 1 'Fixed Single
Caption = "用户管理"
ClientHeight = 3510
ClientLeft = 45
ClientTop = 330
ClientWidth = 6495
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3510
ScaleWidth = 6495
StartUpPosition = 3 '窗口缺省
Begin VB.Frame Frame2
Caption = "用户信息"
Height = 2535
Left = 2760
TabIndex = 6
Top = 0
Width = 3495
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "员工姓名:"
Height = 180
Left = 240
TabIndex = 16
Top = 900
Width = 900
End
Begin VB.Label lblEmpName
AutoSize = -1 'True
Caption = "lblEmpName"
Height = 180
Left = 1320
TabIndex = 15
Top = 870
Width = 900
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "用户类型:"
Height = 180
Left = 240
TabIndex = 14
Top = 480
Width = 900
End
Begin VB.Label lblUserType
AutoSize = -1 'True
Caption = "lblUserType"
Height = 180
Left = 1320
TabIndex = 13
Top = 480
Width = 990
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "员工状态:"
Height = 180
Left = 240
TabIndex = 12
Top = 1320
Width = 900
End
Begin VB.Label lblEmpState
AutoSize = -1 'True
Caption = "lblEmpState"
Height = 180
Left = 1320
TabIndex = 11
Top = 1290
Width = 990
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "员工职务:"
Height = 180
Left = 240
TabIndex = 10
Top = 2220
Width = 900
End
Begin VB.Label lblTitle
AutoSize = -1 'True
Caption = "lblTitle"
Height = 180
Left = 1320
TabIndex = 9
Top = 2190
Width = 720
End
Begin VB.Label Label7
AutoSize = -1 'True
Caption = "所在部门:"
Height = 180
Left = 240
TabIndex = 8
Top = 1800
Width = 900
End
Begin VB.Label lblDep
AutoSize = -1 'True
Caption = "lblDep"
Height = 180
Left = 1320
TabIndex = 7
Top = 1800
Width = 540
End
End
Begin VB.CommandButton Cmd_Back
BackColor = &H80000004&
Cancel = -1 'True
Caption = "返 回"
Height = 400
Left = 4757
MouseIcon = "FrmUserMan.frx":0000
MousePointer = 99 'Custom
Style = 1 'Graphical
TabIndex = 5
Top = 2880
Width = 1300
End
Begin VB.CommandButton Cmd_Del
BackColor = &H80000004&
Caption = "删除用户"
Height = 400
Left = 3317
MouseIcon = "FrmUserMan.frx":030A
MousePointer = 99 'Custom
Style = 1 'Graphical
TabIndex = 4
Top = 2880
Width = 1300
End
Begin VB.CommandButton Cmd_Modi
BackColor = &H80000004&
Caption = "修改用户"
Height = 400
Left = 1877
MouseIcon = "FrmUserMan.frx":0614
MousePointer = 99 'Custom
Style = 1 'Graphical
TabIndex = 3
Top = 2880
Width = 1300
End
Begin VB.CommandButton Cmd_Add
BackColor = &H80000004&
Caption = "添加用户"
Default = -1 'True
Height = 400
Left = 437
MouseIcon = "FrmUserMan.frx":091E
MousePointer = 99 'Custom
Style = 1 'Graphical
TabIndex = 2
Top = 2880
Width = 1300
End
Begin VB.Frame Frame1
Caption = "用户列表"
Height = 2535
Left = 240
TabIndex = 0
Top = 0
Width = 2295
Begin MSDataListLib.DataList DataList1
Bindings = "FrmUserMan.frx":0C28
Height = 2160
Left = 120
TabIndex = 1
Top = 240
Width = 2055
_ExtentX = 3625
_ExtentY = 3810
_Version = 393216
ListField = "UserName"
End
End
Begin MSAdodcLib.Adodc AdoUserList
Height = 330
Left = 0
Top = 2520
Visible = 0 'False
Width = 3135
_ExtentX = 5530
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 1
LockType = 3
CommandType = 2
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 3
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "DSN=HrSys"
OLEDBString = ""
OLEDBFile = ""
DataSourceName = "HrSys"
OtherAttributes = ""
UserName = "sa"
Password = "sa"
RecordSource = "Users"
Caption = "AdoUserList"
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
End
Attribute VB_Name = "FrmUserMan"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Function Right() As Boolean
Select Case CurUser.User_type
Case 0 'HrManager用户
If MyUser.User_type = 0 Or MyUser.User_type = 2 Then
Right = True
Else
Right = False
End If
Case 1 'Admin用户
If MyUser.User_type = 1 Or MyUser.User_type = 3 Or MyUser.User_type = 4 Then
Right = True
Else
Right = False
End If
Case 3 '系统管理员用户
If (MyUser.User_type = 3 And MyUser.Emp_Id = CurUser.Emp_Id) Or MyUser.User_type = 4 Then
Right = True
Else
Right = False
End If
Case Else
Right = False
End Select
End Function
Private Sub Cmd_Add_Click()
UpperEmp.Init
With FrmUserEdit
.txtUserName = ""
.txtPass = ""
.txtPass2 = ""
.ComboName = ""
Select Case CurUser.User_type
Case 0
.ComboType.AddItem "人力资源主管普通用户"
Case 1
.ComboType.AddItem "系统管理员普通用户"
.ComboType.AddItem "普通用户"
Case 3
.ComboType.AddItem "普通用户"
End Select
.ComboType.ListIndex = 0
.Modify = False
.Show 1
End With
AdoUserList.Refresh
DataList1.ReFill
DataList1_Click
End Sub
Private Sub Cmd_Back_Click()
Unload Me
End Sub
Private Sub Cmd_Del_Click()
If DataList1.Text = "" Then
MsgBox "请选择要删除的用户"
Exit Sub
End If
If MyUser.User_type = 0 Or MyUser.User_type = 1 Then
MsgBox "此用户不能删除"
Exit Sub
End If
If Right = False Then
MsgBox "没有删除此用户的权限"
Exit Sub
End If
'确认删除
If MsgBox("是否删除当前用户", vbYesNo, "请确认") = vbYes Then
MyUser.Delete (DataList1.Text)
AdoUserList.Refresh
DataList1.ReFill
DataList1_Click
End If
End Sub
Private Sub Cmd_Modi_Click()
If DataList1.Text = "" Then
MsgBox "请选择要修改的用户"
Exit Sub
End If
If Right = False Then
MsgBox "没有修改此用户的权限"
Exit Sub
End If
With FrmUserEdit
UpperEmp.Emp_Id = MyUser.Emp_Id
UpperEmp.GetInfo (UpperEmp.Emp_Id)
.ComboName = UpperEmp.Emp_Name
.OriUser = MyUser.UserName
.txtUserName = MyUser.UserName
.txtPass = MyUser.Pwd
.txtPass2 = MyUser.Pwd
Select Case CurUser.User_type
Case 0
If MyUser.User_type = 0 Then
.ComboType.AddItem "人力资源主管超级用户"
Else
.ComboType.AddItem "人力资源主管普通用户"
End If
Case 1
If MyUser.User_type = 1 Then
.ComboType.AddItem "系统管理员超级用户"
Else
.ComboType.AddItem "系统管理员普通用户"
.ComboType.AddItem "普通用户"
End If
Case 3
If MyUser.User_type = 3 Then
.ComboType.AddItem "系统管理员普通用户"
Else
.ComboType.AddItem "普通用户"
End If
End Select
Select Case MyUser.User_type
Case 0
.ComboType = "人力资源主管超级用户"
Case 1
.ComboType = "系统管理员超级用户"
Case 2
.ComboType = "人力资源主管普通用户"
Case 3
.ComboType = "系统管理员普通用户"
Case 4
.ComboType = "普通用户"
End Select
.Modify = True
.Show 1
End With
AdoUserList.Refresh
DataList1.ReFill
DataList1_Click
End Sub
Private Sub DataList1_Click()
If DataList1.Text = "" Then
Exit Sub
End If
'读取用户数据
MyUser.GetInfo (DataList1.Text)
Select Case MyUser.User_type
Case 0
lblUserType = "人力资源主管超级用户"
Case 1
lblUserType = "系统管理员超级用户"
Case 2
lblUserType = "人力资源主管普通用户"
Case 3
lblUserType = "系统管理员普通用户"
Case 4
lblUserType = "普通用户"
End Select
'读取员工数据
CurEmp.GetInfo (MyUser.Emp_Id)
lblEmpName = CurEmp.Emp_Name
Select Case CurEmp.State
Case 1
lblEmpState = "在职人员"
Case 2
lblEmpState = "兼职人员"
Case 3
lblEmpState = "试用人员"
Case 4
lblEmpState = "离职人员"
Case 5
lblEmpState = "返聘人员"
Case 6
lblEmpState = "退休人员"
Case Else
lblEmpState = ""
End Select
lblTitle = CurEmp.Title
lblDep = MyDep.GetName(CurEmp.Dep_Id)
End Sub
Private Sub Form_Load()
lblUserType = ""
lblEmpName = ""
lblEmpState = ""
lblTitle = ""
lblDep = ""
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -