📄 frmauthority.frm
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
Object = "{0B81E4A9-BE4E-4AEF-9272-33AB5B51C6FC}#1.0#0"; "XPControls.ocx"
Begin VB.Form frmAuthority
BackColor = &H80000018&
BorderStyle = 3 'Fixed Dialog
Caption = "角色维护"
ClientHeight = 7185
ClientLeft = 2760
ClientTop = 3750
ClientWidth = 9735
Icon = "frmAuthority.frx":0000
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 7185
ScaleWidth = 9735
ShowInTaskbar = 0 'False
StartUpPosition = 2 'CenterScreen
Begin VB.Frame Frame1
BackColor = &H80000018&
Caption = "现有角色"
Height = 5055
Left = 120
TabIndex = 13
Top = 120
Width = 3195
Begin MSComctlLib.ListView lvwJS
Height = 4755
Left = 90
TabIndex = 14
Top = 210
Width = 3015
_ExtentX = 5318
_ExtentY = 8387
View = 3
LabelEdit = 1
LabelWrap = -1 'True
HideSelection = 0 'False
FullRowSelect = -1 'True
GridLines = -1 'True
_Version = 393217
ForeColor = -2147483640
BackColor = 16777152
BorderStyle = 1
Appearance = 1
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
NumItems = 1
BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628}
Text = "角色名称"
Object.Width = 4410
EndProperty
End
End
Begin VB.Frame Frame2
BackColor = &H80000018&
Caption = "基本信息"
Height = 1755
Left = 120
TabIndex = 8
Top = 5250
Width = 3195
Begin VB.TextBox txtJSMC
BackColor = &H00FFFFC0&
Height = 315
Left = 690
TabIndex = 10
Top = 240
Width = 2325
End
Begin VB.TextBox txtJSSM
BackColor = &H00FFFFC0&
Height = 975
Left = 690
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 9
Top = 630
Width = 2325
End
Begin VB.Label Label1
Alignment = 1 'Right Justify
BackStyle = 0 'Transparent
Caption = "名称:"
Height = 255
Left = 60
TabIndex = 12
Top = 270
Width = 645
End
Begin VB.Label Label2
Alignment = 1 'Right Justify
BackStyle = 0 'Transparent
Caption = "说明:"
Height = 255
Left = 90
TabIndex = 11
Top = 660
Width = 615
End
End
Begin VB.Frame Frame3
BackColor = &H80000018&
Caption = "权限"
Height = 5895
Left = 3420
TabIndex = 6
Top = 120
Width = 6165
Begin VB.Frame fraAccess
BackColor = &H80000018&
Caption = "访问权限"
Height = 2715
Left = 4590
TabIndex = 15
Top = 150
Visible = 0 'False
Width = 1455
Begin VB.CheckBox chkDelete
BackColor = &H80000018&
Caption = "删除"
Height = 405
Left = 300
TabIndex = 19
Top = 2130
Width = 945
End
Begin VB.CheckBox chkInsert
BackColor = &H80000018&
Caption = "添加"
Height = 405
Left = 300
TabIndex = 18
Top = 1540
Width = 945
End
Begin VB.CheckBox chkUpdate
BackColor = &H80000018&
Caption = "更新"
Height = 405
Left = 300
TabIndex = 17
Top = 950
Width = 945
End
Begin VB.CheckBox chkBrowser
BackColor = &H80000018&
Caption = "浏览"
Height = 405
Left = 300
TabIndex = 16
Top = 360
Width = 945
End
End
Begin MSComctlLib.TreeView tvwMenu
Height = 5535
Left = 120
TabIndex = 7
Top = 240
Width = 4305
_ExtentX = 7594
_ExtentY = 9763
_Version = 393217
HideSelection = 0 'False
LabelEdit = 1
Style = 7
Checkboxes = -1 'True
Appearance = 1
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
End
Begin VB.Frame Frame4
BackColor = &H80000018&
Caption = "操作"
Height = 915
Left = 3420
TabIndex = 0
Top = 6090
Width = 6165
Begin XPControls.XPCommandButton cmdAdd
Height = 345
Left = 210
TabIndex = 1
Top = 360
Width = 1005
_ExtentX = 1773
_ExtentY = 609
Caption = "添 加"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin XPControls.XPCommandButton cmdModify
Height = 345
Left = 1395
TabIndex = 2
Top = 360
Width = 1005
_ExtentX = 1773
_ExtentY = 609
Caption = "修 改"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin XPControls.XPCommandButton cmdDelete
Height = 345
Left = 3765
TabIndex = 3
Top = 360
Width = 1005
_ExtentX = 1773
_ExtentY = 609
Caption = "删 除"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin XPControls.XPCommandButton cmdSave
Height = 345
Left = 2580
TabIndex = 4
Top = 360
Width = 1005
_ExtentX = 1773
_ExtentY = 609
Caption = "保 存"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin XPControls.XPCommandButton cmdExit
Cancel = -1 'True
Height = 345
Left = 4950
TabIndex = 5
Top = 360
Width = 1005
_ExtentX = 1773
_ExtentY = 609
Caption = "退 出"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
End
End
Attribute VB_Name = "frmAuthority"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim m_enuOperation As OperationType
Dim m_blnEdit As Boolean '是否处于编辑状态
Dim m_strMenu As String
Public Sub ShowForm(ByVal strMenu As String)
m_strMenu = strMenu
Me.Show vbModal
End Sub
Private Sub chkBrowser_Click()
Call CheckBUID
Call WriteBUID
End Sub
Private Sub chkDelete_Click()
Call CheckBUID
Call WriteBUID
End Sub
Private Sub chkInsert_Click()
Call CheckBUID
Call WriteBUID
End Sub
Private Sub chkUpdate_Click()
Call CheckBUID
Call WriteBUID
End Sub
Private Sub cmdAdd_Click()
Dim i As Integer
'权限验证
If g_blnIsNew Then
If Not g_clsAuthority.CheckOperationAuthority(m_strMenu, INSERT_W) Then GoTo ExitLab
End If
'验证完毕
Call ClearInput
Call EnableInput(True)
Call EnableCommand(False, True)
With tvwMenu
For i = 1 To .Nodes.Count
.Nodes(i).Checked = False
Next i
End With
txtJSMC.SetFocus
m_blnEdit = True
m_enuOperation = Add
ExitLab:
End Sub
Private Sub cmdDelete_Click()
On Error GoTo ErrMsg
Dim strSQL As String
Dim rsTemp As ADODB.Recordset
Dim intJSID As Integer
Me.MousePointer = vbHourglass
'权限验证
If g_blnIsNew Then
If Not g_clsAuthority.CheckOperationAuthority(m_strMenu, DELETE_W) Then GoTo ExitLab
End If
'验证完毕
If MsgBox("该操作不可恢复,您确认要删除角色 " & lvwJS.SelectedItem.Text & " 吗?", _
vbExclamation + vbYesNo + vbDefaultButton2, "警告") = vbNo Then GoTo ExitLab
'是否系统角色
If CBool(lvwJS.SelectedItem.Tag) Then
MsgBox lvwJS.SelectedItem.Text & " 是系统定义角色,不能删除!", vbExclamation, "提示"
GoTo ExitLab
End If
intJSID = CInt(Val(Mid(lvwJS.SelectedItem.Key, 2)))
'该角色下是否有人员
strSQL = "select Count(*) from RY_Employee" _
& " where (JSID='" & CStr(intJSID) & "'" _
& " or JSID like '" & CStr(intJSID) & ",%'" _
& " or JSID like '%," & CStr(intJSID) & ",%'" _
& " or JSID like '%," & CStr(intJSID) & "'" _
& ")"
Set rsTemp = New ADODB.Recordset
rsTemp.Open strSQL, GCon, adOpenForwardOnly, adLockReadOnly
If rsTemp(0) > 0 Then
MsgBox "尚有 " & rsTemp(0) & " 位用户隶属于角色 " & lvwJS.SelectedItem.Text _
& " ,不能删除", vbExclamation, "提示"
GoTo ExitLab
End If
rsTemp.Close
'开始事务
GCon.BeginTrans
On Error GoTo RollBack
'执行删除
strSQL = "delete from SET_JS_INDEX" _
& " where JSID=" & intJSID
GCon.Execute strSQL
strSQL = "delete from SET_JS_MnuData" _
& " where JSID=" & intJSID
GCon.Execute strSQL
'提交事务
GCon.CommitTrans
On Error GoTo ErrMsg
Call DeleteItemFromListView(lvwJS, lvwJS.SelectedItem.Index)
Call lvwJS_Click
GoTo ExitLab
RollBack:
GCon.RollbackTrans
ErrMsg:
MsgBoxW Err
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -