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

📄 frmemppermission.frm

📁 本公司开发得大请油田人事管理系统c/s结构
💻 FRM
📖 第 1 页 / 共 3 页
字号:
            OutlineBar      =   0
            OutlineCol      =   0
            Ellipsis        =   0
            ExplorerBar     =   0
            PicturesOver    =   0   'False
            FillStyle       =   0
            RightToLeft     =   0   'False
            PictureType     =   0
            TabBehavior     =   0
            OwnerDraw       =   0
            Editable        =   0
            ShowComboButton =   -1  'True
            WordWrap        =   0   'False
            TextStyle       =   0
            TextStyleFixed  =   0
            OleDragMode     =   0
            OleDropMode     =   0
            DataMode        =   0
            VirtualData     =   -1  'True
            DataMember      =   ""
            ComboSearch     =   3
            AutoSizeMouse   =   -1  'True
            FrozenRows      =   0
            FrozenCols      =   0
            AllowUserFreezing=   0
            BackColorFrozen =   0
            ForeColorFrozen =   0
            WallPaperAlignment=   9
         End
      End
   End
End
Attribute VB_Name = "frmEmpPermission"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim m_strSQL As String
Dim m_oRs4This As New ADODB.Recordset
Dim m_oRs4Emp As New ADODB.Recordset

Private Sub Command4Add_Click()
    
    If Me.VSFlexGrid4Emp.Row < 1 Then
        MsgBox "请选择一个用户!", vbOKOnly, "提示"
        Exit Sub
    End If
    
    If Me.VSFlexGrid4Role.Row < 1 Then
        MsgBox "请选择一个角色组!", vbOKOnly, "提示"
        Exit Sub
    End If
    
    With Me.VSFlexGrid4Role
        m_strSQL = "update t_emp_basic set oprrole_no=" & .TextMatrix(.Row, 5) & " from t_emp_basic where emp_no=" & VSFlexGrid4Emp.TextMatrix(VSFlexGrid4Emp.Row, 6) & " and organ_no='" & VSFlexGrid4Emp.TextMatrix(VSFlexGrid4Emp.Row, 7) & "'"
        If ExcuteSQL(m_strSQL) = 0 Then
            Me.VSFlexGrid4Emp.RemoveItem VSFlexGrid4Emp.Row
            m_oRs4This.Requery
        End If
    End With
End Sub

Private Sub Command4Close_Click()
    Unload Me
End Sub

Private Sub Command4Delete_Click()
    Dim ors4temp As New ADODB.Recordset
    With VSFlexGrid4Role
        If .TextMatrix(.Row, 6) <> "" Then
            m_strSQL = "update T_EMP_BASIC set oprrole_no=" & "NULL" & " from T_EMP_BASIC where EMP_NO=" & .TextMatrix(.Row, 6) & " and organ_no='" & .TextMatrix(.Row, 7) & "'"
            If ExcuteSQL(m_strSQL) <> 0 Then Exit Sub
            m_strSQL = "select EMP_NAME,organ_name,SEX,ID_CODE,WORKER_SORT_NAME,EMP_NO,t_organ.organ_no as organ_no from " _
            & " T_EMP_BASIC,T_WORKER_SORT,t_organ where t_organ.organ_no=t_emp_basic.organ_no and " _
            & " T_WORKER_SORT.WORKER_SORT_NO=T_EMP_BASIC.WORKER_SORT_NO and OPRROLE_NO IS NULL and T_EMP_BASIC.EMP_NO=" & .TextMatrix(.Row, 6) & " and T_EMP_BASIC.organ_no='" & .TextMatrix(.Row, 7) & "'"
            If ors4temp.State = adStateOpen Then ors4temp.Close
            ors4temp.CursorLocation = adUseClient
            ors4temp.Open m_strSQL, g_oConnection4This, adOpenKeyset, adLockOptimistic
            Me.VSFlexGrid4Emp.AddItem vbTab & ors4temp.Fields("EMP_NAME").Value _
                & vbTab & ors4temp.Fields("SEX").Value & vbTab & ors4temp.Fields("ID_CODE").Value _
                & vbTab & ors4temp.Fields("WORKER_SORT_NAME").Value & vbTab & ors4temp.Fields("EMP_NO").Value _
                & vbTab & ors4temp.Fields("organ_no").Value
            m_oRs4This.Requery
        Else
            MsgBox "此角色已无用户", vbOKOnly, "提示"
        End If
    End With
End Sub

Private Sub Command4DelOprrole_Click()
    Dim ors4temp As New ADODB.Recordset
    With Me.VSFlexGrid4Role
        If .Rows < 2 Then Exit Sub
        If .TextMatrix(.Row, 2) <> "" Then
            MsgBox "该角色组中还有用户,无法删除!请先将该表中的用户移除!", vbOKOnly, "警告"
        Else
            If vbOK = MsgBox("确定要删除该角色?", vbOKCancel, "提示") Then
'                m_strSQL = "select OPRROLE_NO from T_OPRROLE where OPRROLE_no = " & .TextMatrix(.Row, 5)
'                If ors4temp.State = adStateOpen Then ors4temp.Close
'                ors4temp.Open m_strSQL, g_oConnection4This, adOpenKeyset, adLockOptimistic
'                If ors4temp.EOF = False Then str4temp = ors4temp.Fields("OPRROLE_NO").Value
                m_strSQL = "delete from T_PERMISSION_CHAR_DETAIL where OPRROLE_NO = " & .TextMatrix(.Row, 5)
                ExcuteSQL (m_strSQL)
                m_strSQL = "delete from T_OPRROLE where OPRROLE_NO = " & .TextMatrix(.Row, 5)
                ExcuteSQL (m_strSQL)
                m_oRs4This.Requery
            End If
        End If
    End With
End Sub

Private Sub Form_KeyPress(KeyAscii As Integer)
    If KeyAscii = vbKeyReturn Then SendKeys "{tab}"
End Sub

Private Sub Form_Load()
    Me.Height = 5460
    Me.Width = 9540
    
    If Len(g_str4LoginUnit) = C_BUREAUE_LENGTH Then
        FillComboBox SSComboBoxEx4Organ, "T_ORGAN", "ORGAN_NO", "ORGAN_NAME", 0, " where (Len(ORGAN_NO)=" & C_BUREAUE_LENGTH & " or  Len(ORGAN_NO)=" & C_FACTORY_LENGTH & ") " & HaveOrganMark
    Else
        FillComboBox SSComboBoxEx4Organ, "T_ORGAN", "ORGAN_NO", "ORGAN_NAME", 0, " where ORGAN_NO like '" & g_str4LoginUnit & "%' " & HaveOrganMark
    End If
    With Me.VSFlexGrid4Role
        .Cols = 8
        .TextMatrix(0, 1) = "角色名称"
        .TextMatrix(0, 2) = "人员名称"
        .TextMatrix(0, 3) = "工作单位"
        .TextMatrix(0, 4) = "职工类别"
        .ColHidden(5) = True
        .ColHidden(6) = True
        .ColHidden(7) = True
        .AutoSize 0, .Cols - 1
        .Rows = 1
        .AllowBigSelection = True
        .AllowSelection = True
        .Editable = flexEDNone
        .SelectionMode = flexSelectionByRow
        .AllowUserResizing = flexResizeColumns
        .AutoSizeMode = flexAutoSizeColWidth
        .AutoResize = True
        .ExplorerBar = flexExSortShow
        .ExtendLastCol = True
        .DataMode = flexDMFree
    End With
    With Me.VSFlexGrid4Emp
        .Cols = 8
        .TextMatrix(0, 1) = "人员姓名"
        .TextMatrix(0, 2) = "性别"
        .TextMatrix(0, 3) = "性别"
        .TextMatrix(0, 4) = "身份证号"
        .TextMatrix(0, 5) = "职工类别"
        .ColComboList(3) = "#1;男|#2;女"
        .AutoSize 0, 5
        .ColHidden(6) = True
        .ColHidden(7) = True
        .Rows = 1
        .AllowBigSelection = True
        .AllowSelection = True
        .Editable = flexEDNone
        .SelectionMode = flexSelectionByRow
        .AllowUserResizing = flexResizeColumns
        .AutoSizeMode = flexAutoSizeColWidth
        .AutoResize = True
        .ExplorerBar = flexExSortShow
        .ExtendLastCol = True
        .DataMode = flexDMFree
    End With
    MousePointer = 1
    Call InitForm
    Unload frmSplash
End Sub

Private Sub Form_Unload(Cancel As Integer)
    MDIfrmMain.SSActiveToolBarsMain.Tools("ID_用户权限维护").Enabled = True
End Sub

Private Sub SSComboBoxEx4Organ_Change()
    DisplayRelateItems SSComboBoxEx4Organ
End Sub

Private Sub SSComboBoxEx4Organ_Click()
    CheckValidate SSComboBoxEx4Organ
    If Trim(SSComboBoxEx4Organ.text) <> "" Then
        Call Display
    Else
        VSFlexGrid4Emp.Rows = 1
        VSFlexGrid4Role.Rows = 1
    End If
End Sub

Private Sub VSFlexGrid4Emp_AfterDataRefresh()
    With Me.VSFlexGrid4Emp
        .TextMatrix(0, 1) = "人员姓名"
        .TextMatrix(0, 2) = "工作单位"
        .TextMatrix(0, 3) = "性别"
        .TextMatrix(0, 4) = "身份证号"
        .TextMatrix(0, 5) = "职工类别"
        .ColComboList(3) = "#1;男|#2;女"
        
        .ColHidden(6) = True
        .ColHidden(7) = True
        .AutoSize 0, 5
        .ColAlignment(0) = flexAlignRightCenter
        .ColAlignment(1) = flexAlignLeftCenter
        .ColAlignment(2) = flexAlignLeftCenter
        .ColAlignment(3) = flexAlignLeftCenter
        .ColAlignment(4) = flexAlignLeftCenter
    End With
End Sub

Private Sub VSFlexGrid4Role_AfterDataRefresh()
    Dim i As Long
    With Me.VSFlexGrid4Role
        .TextMatrix(0, 1) = "角色名称"
        .TextMatrix(0, 2) = "人员名称"
        .TextMatrix(0, 3) = "工作单位"
        .TextMatrix(0, 4) = "职工类别"
        .ColHidden(5) = True
        .ColHidden(6) = True
        .ColHidden(7) = True
        .AutoSize 0, 3
        .ColAlignment(0) = flexAlignRightCenter
        .ColAlignment(1) = flexAlignLeftCenter
        .ColAlignment(2) = flexAlignLeftCenter
        .MergeCells = flexMergeFree
        .MergeCol(1) = True
    End With
End Sub

Private Sub Display()
    m_strSQL = "select EMP_NAME,organ_name,SEX,ID_CODE,WORKER_SORT_NAME,EMP_NO,t_organ.organ_no from " _
        & " T_EMP_BASIC,T_WORKER_SORT,t_organ where t_organ.organ_no=t_emp_basic.organ_no and " _
        & " T_WORKER_SORT.WORKER_SORT_NO=T_EMP_BASIC.WORKER_SORT_NO and OPRROLE_NO IS NULL and T_EMP_BASIC.ORGAN_NO like '" & SSComboBoxEx4Organ.ItemData(SSComboBoxEx4Organ.ListIndex) & "%'"
    If m_oRs4Emp.State = adStateOpen Then m_oRs4Emp.Close
    m_oRs4Emp.CursorLocation = adUseClient
    m_oRs4Emp.Open m_strSQL, g_oConnection4This, adOpenKeyset, adLockOptimistic
    Set VSFlexGrid4Emp.DataSource = m_oRs4Emp
    If Me.VSFlexGrid4Emp.Rows > 1 Then Me.VSFlexGrid4Emp.Row = 1
    m_strSQL = "(select OPRROLE_NAME,EMP_NAME,organ_name,WORKER_SORT_NAME,T_OPRROLE.OPRROLE_NO,EMP_NO,T_EMP_BASIC.organ_no" _
        & " from T_OPRROLE,T_EMP_BASIC,T_WORKER_SORT,t_organ where t_organ.organ_no=t_emp_basic.organ_no and " _
        & " T_OPRROLE.OPRROLE_NO=T_EMP_BASIC.OPRROLE_NO and T_WORKER_SORT.WORKER_SORT_NO=T_EMP_BASIC.WORKER_SORT_NO " _
        & " union select OPRROLE_NAME,NULL as EMP_NAME,null as organ_name ,NULL as WORKER_SORT_NAME,T_OPRROLE.OPRROLE_NO,NULL as EMP_NO ,null as organ_no  " _
        & " from T_OPRROLE where OPRROLE_NO not in (select distinct OPRROLE_NO from T_EMP_BASIC where OPRROLE_NO is not null)) order by T_OPRROLE.OPRROLE_NO"
    If m_oRs4This.State = adStateOpen Then m_oRs4This.Close
    m_oRs4This.CursorLocation = adUseClient
    m_oRs4This.Open m_strSQL, g_oConnection4This
    Set VSFlexGrid4Role.DataSource = m_oRs4This
    If Me.VSFlexGrid4Role.Rows > 1 Then Me.VSFlexGrid4Role.Row = 1
End Sub

Private Sub InitForm()
    Dim str4CheckPermission As String
    If g_lOprroleNo = 0 Then Exit Sub
    str4CheckPermission = CheckPermission("用户权限维护")
    If Mid(str4CheckPermission, 2, 1) = 0 Then Command4Add.Enabled = False
    If Mid(str4CheckPermission, 4, 1) = 0 Then
        Command4Delete.Enabled = False
        Command4DelOprrole.Enabled = False
    End If
End Sub

⌨️ 快捷键说明

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