⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmdepartment.frm

📁 企业人事管理系统
💻 FRM
字号:
VERSION 5.00
Object = "{BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0"; "TABCTL32.OCX"
Begin VB.Form frmDepartment 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "部门"
   ClientHeight    =   3330
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   4830
   BeginProperty Font 
      Name            =   "宋体"
      Size            =   9
      Charset         =   134
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   Icon            =   "frmDepartment.frx":0000
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   3330
   ScaleWidth      =   4830
   StartUpPosition =   2  'CenterScreen
   Begin TabDlg.SSTab stbManage 
      Height          =   2775
      Left            =   60
      TabIndex        =   2
      Top             =   60
      Width           =   4695
      _ExtentX        =   8281
      _ExtentY        =   4895
      _Version        =   393216
      Style           =   1
      Tabs            =   1
      TabsPerRow      =   1
      TabHeight       =   520
      TabCaption(0)   =   "部门属性"
      TabPicture(0)   =   "frmDepartment.frx":000C
      Tab(0).ControlEnabled=   -1  'True
      Tab(0).Control(0)=   "lblUser(3)"
      Tab(0).Control(0).Enabled=   0   'False
      Tab(0).Control(1)=   "lblUser(0)"
      Tab(0).Control(1).Enabled=   0   'False
      Tab(0).Control(2)=   "lblUser(1)"
      Tab(0).Control(2).Enabled=   0   'False
      Tab(0).Control(3)=   "lblUser(2)"
      Tab(0).Control(3).Enabled=   0   'False
      Tab(0).Control(4)=   "txtUser(2)"
      Tab(0).Control(4).Enabled=   0   'False
      Tab(0).Control(5)=   "txtUser(1)"
      Tab(0).Control(5).Enabled=   0   'False
      Tab(0).Control(6)=   "txtUser(0)"
      Tab(0).Control(6).Enabled=   0   'False
      Tab(0).Control(7)=   "cboUser"
      Tab(0).Control(7).Enabled=   0   'False
      Tab(0).ControlCount=   8
      Begin VB.ComboBox cboUser 
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   9
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   300
         ItemData        =   "frmDepartment.frx":0028
         Left            =   1200
         List            =   "frmDepartment.frx":002A
         Style           =   2  'Dropdown List
         TabIndex        =   6
         Top             =   840
         Width           =   3015
      End
      Begin VB.TextBox txtUser 
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   9
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   300
         Index           =   0
         Left            =   1200
         MaxLength       =   16
         TabIndex        =   5
         Top             =   480
         Width           =   3015
      End
      Begin VB.TextBox txtUser 
         Enabled         =   0   'False
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   9
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   300
         Index           =   1
         Left            =   1200
         MaxLength       =   16
         TabIndex        =   4
         Top             =   1200
         Width           =   3015
      End
      Begin VB.TextBox txtUser 
         Height          =   975
         Index           =   2
         Left            =   1200
         MaxLength       =   60
         MultiLine       =   -1  'True
         ScrollBars      =   2  'Vertical
         TabIndex        =   3
         Top             =   1560
         Width           =   3015
      End
      Begin VB.Label lblUser 
         Alignment       =   1  'Right Justify
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "层次:"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   9
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   180
         Index           =   2
         Left            =   630
         TabIndex        =   10
         Top             =   1200
         Width           =   450
      End
      Begin VB.Label lblUser 
         Alignment       =   1  'Right Justify
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "上层部门:"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   9
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   180
         Index           =   1
         Left            =   270
         TabIndex        =   9
         Top             =   840
         Width           =   810
      End
      Begin VB.Label lblUser 
         Alignment       =   1  'Right Justify
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "部门名称:"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   9
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   180
         Index           =   0
         Left            =   270
         TabIndex        =   8
         Top             =   480
         Width           =   810
      End
      Begin VB.Label lblUser 
         Alignment       =   1  'Right Justify
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "部门职责:"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   9
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   180
         Index           =   3
         Left            =   270
         TabIndex        =   7
         Top             =   1560
         Width           =   810
      End
   End
   Begin VB.CommandButton cmdUser 
      Caption         =   "关闭(&C)"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   9
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   350
      Index           =   1
      Left            =   3660
      TabIndex        =   1
      Top             =   2940
      Width           =   1095
   End
   Begin VB.CommandButton cmdUser 
      Caption         =   "确定(&O)"
      Default         =   -1  'True
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   9
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   350
      Index           =   0
      Left            =   2460
      TabIndex        =   0
      Top             =   2940
      Width           =   1095
   End
End
Attribute VB_Name = "frmDepartment"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim intCount As Integer
Dim intSum() As Integer
Dim adoEditLink As New ADODB.Recordset

Private Sub cboUser_Click()
    If cboUser.ListIndex > 0 Then
        txtUser(1).Text = intSum(cboUser.ListIndex) + 1
    End If
End Sub

Private Sub cmdUser_Click(Index As Integer)
    On Error Resume Next
    Select Case Index
    Case 0: '确认按钮,先进行层次扫描,判断各属性的正确位置,再进行保存工作.
        With adoMainLink
            For intCount = 0 To cboUser.ListCount - 1
                If Trim(txtUser(0).Text) = Trim(cboUser.List(intCount)) Then
                    MsgBox Trim(txtUser(0).Text) & "已在隶属部门中存在,请重新输入!"
                    txtUser(0).Text = ""
                    txtUser(0).SetFocus
                    Exit Sub
                End If
            Next
            If blnAddNew = True Then
                .AddNew
            Else
                If MsgBox("如果修改部门名称,则所有属于此部门的员工的隶属" & vbCrLf & "部门都将同时被更改,确认要修改吗(Y/N)?", vbInformation + vbOKCancel, App.Title) = vbCancel Then Exit Sub
            End If
            .Fields("隶属部门") = Trim(txtUser(0).Text)
            If Trim(cboUser.Text) <> "无上层" Then
                .Fields("上层部门") = Trim(cboUser.Text)
                .Fields("层次") = Trim(txtUser(1).Text)
            Else
                .Fields("上层部门") = ""
                .Fields("层次") = "1"
            End If
            .Fields("部门职责") = Trim(txtUser(2).Text)
            .Update
            .Requery
            frmMain.dgdFind.Columns(0).Visible = False
            Unload Me
            MsgBox "保存成功!", vbOKOnly + vbInformation, App.Title
            Call frmInfo.AddTreeView
        End With
    Case 1:
        Unload Me
    End Select
End Sub

Private Sub Form_Load()
    On Error Resume Next
    Dim intTemp As Integer
    frmManage.Enabled = False
    Set Me.Icon = frmTool.Icon
    intTemp = 1
    With adoEditLink
        .Open "select * from 隶属部门", adoConn, adOpenDynamic, adLockPessimistic, adCmdText
        cboUser.AddItem "无上层", 0
        intCount = 1
        If .EOF = False Then
            .MoveLast
            ReDim intSum(.RecordCount) As Integer
            .MoveFirst
            If blnAddNew = True Then
                Do Until .EOF
                    If .Fields("层次") = 1 Then
                        cboUser.AddItem .Fields("隶属部门"), intCount
                        intSum(intCount) = CInt(.Fields("层次"))
                        intCount = intCount + 1
                    End If
                    .MoveNext
                Loop
                cboUser.ListIndex = 0
            Else
                Do Until .EOF
                    If strTemp(0) <> Trim(.Fields("隶属部门")) And strTemp(0) <> Trim(.Fields("上层部门")) Then
                        If .Fields("层次") = 1 Then
                            cboUser.AddItem .Fields("隶属部门"), intCount
                            If Trim(.Fields("隶属部门")) = strTemp(1) Then cboUser.ListIndex = intCount
                            intSum(intCount) = CInt(.Fields("层次"))
                            intCount = intCount + 1
                        End If
                    Else
                        intTemp = .Fields("层次")
                        txtUser(2).Text = .Fields("部门职责")
                    End If
                    .MoveNext
                Loop
                txtUser(0).Text = strTemp(0)
                If intTemp = 1 Then cboUser.ListIndex = 0
            End If
        End If
        .MoveFirst
    End With
    txtUser(1).Text = intTemp
End Sub

Private Sub Form_Unload(Cancel As Integer)
    frmManage.Enabled = True
    Set adoEditLink = Nothing
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -