📄 frmusu_person.frm
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
Begin VB.Form frmUSU_Person
BorderStyle = 3 'Fixed Dialog
Caption = "职工选择"
ClientHeight = 6015
ClientLeft = 45
ClientTop = 330
ClientWidth = 3885
ControlBox = 0 'False
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 6015
ScaleWidth = 3885
ShowInTaskbar = 0 'False
StartUpPosition = 1 '所有者中心
Begin VB.CommandButton cmdCancel
Cancel = -1 'True
Caption = "取消(&C)"
Height = 345
Left = 2775
TabIndex = 2
Top = 5625
Width = 1065
End
Begin VB.CommandButton cmdOk
Caption = "确定(&O)"
Default = -1 'True
Height = 345
Left = 1560
TabIndex = 1
Top = 5625
Width = 1065
End
Begin MSComctlLib.TreeView tvwPer
Height = 5505
Left = 45
TabIndex = 0
Top = 45
Width = 3795
_ExtentX = 6694
_ExtentY = 9710
_Version = 393217
HideSelection = 0 'False
LabelEdit = 1
Style = 7
ImageList = "ImageList2"
Appearance = 1
End
Begin MSComctlLib.ImageList ImageList2
Left = 0
Top = 0
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 16
ImageHeight = 16
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 5
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmUSU_Person.frx":0000
Key = "Root"
EndProperty
BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmUSU_Person.frx":0454
Key = "UnSelected"
EndProperty
BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmUSU_Person.frx":08A8
Key = "Selected"
EndProperty
BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmUSU_Person.frx":0CFC
Key = "Expand"
EndProperty
BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmUSU_Person.frx":1150
Key = "Collapse"
EndProperty
EndProperty
End
End
Attribute VB_Name = "frmUSU_Person"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public Valid As Boolean '确定或取消决定是否有效性
Private Sub cmdCancel_Click()
Valid = False
Me.Hide
End Sub
Private Sub cmdOk_Click()
MousePointer = vbHourglass
Valid = True
If Left(tvwPer.SelectedItem.Key, 1) = "K" Then Me.Hide
MousePointer = vbDefault
End Sub
Private Sub Form_Load()
Dim rstDep As ADODB.Recordset
Dim iNode As Node
Set rstDep = New ADODB.Recordset
rstDep.CursorLocation = adUseClient
If rstDep.State = adStateClosed Then
rstDep.Open "select * from tUSU_Department" & glo.sOperateYear & " order by cDepCode", _
glo.cnnMain, adOpenStatic, adLockOptimistic
End If
tvwPer.Nodes.Add , , "R", "职工目录", "Root"
tvwPer.Nodes("R").Expanded = True
LoadTvw rstDep, tvwPer, "R", "cDepCode", "cDepName", "Collapse", "Expand", "bDepend"
rstDep.Close
Set rstDep = Nothing
If tvwPer.Nodes("R").Children > 0 Then
Set iNode = tvwPer.Nodes("R").Child
While Not (iNode Is Nothing)
tvwPer_NodeClick iNode
Set iNode = iNode.Next
Wend
End If
End Sub
Private Sub tvwPer_DblClick()
Valid = True
If Left(tvwPer.SelectedItem.Key, 1) = "K" Then
Me.Hide
End If
End Sub
Public Property Get PersonName() As String
PersonName = Mid(tvwPer.SelectedItem, InStr(tvwPer.SelectedItem, "=") + 1)
End Property
Public Property Get PersonCode() As String
PersonCode = Right(tvwPer.SelectedItem.Key, Len(tvwPer.SelectedItem.Key) - 1)
End Property
Public Property Get DepName() As String
DepName = tvwPer.SelectedItem.Parent
End Property
Public Property Get DepCode() As String
DepCode = Right(tvwPer.SelectedItem.Parent.Key, Len(tvwPer.SelectedItem.Parent.Key) - 1)
End Property
Private Sub tvwPer_NodeClick(ByVal Node As MSComctlLib.Node)
Dim rstPer As ADODB.Recordset
MousePointer = vbHourglass
If Left(Node.Key, 1) = "A" And Node.Children = 0 Then
Set rstPer = New ADODB.Recordset
rstPer.CursorLocation = adUseClient
If rstPer.State = adStateClosed Then rstPer.Open "select * from " + GetPersTableName + " where BMBH='" & Right(Node.Key, Len(Node.Key) - 1) & "'", glo.cnnMain, adOpenStatic, adLockOptimistic
LoadtvwSeg rstPer, tvwPer, Node.Key, "ZGBH", "ZGXM", "UnSelected", "Selected"
End If
MousePointer = vbDefault
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -