📄 frmorganedit.frm
字号:
TmpRst.CursorLocation = adUseClient
TmpRst.Open m_strSQL, g_oConnection4This
If TmpRst.BOF = True Then
TmpRst.Close
Set TmpRst = Nothing
Exit Function
Else
TmpRst.MoveFirst
While TmpRst.EOF = False
If Not IsNull(TmpRst.Fields("organ_level").Value) Then
Set tmpNode = paraNode.AddNode(6, TmpRst.Fields("organ_Name").Value & m_str4OptionName(TmpRst.Fields("organ_level").Value))
VSFlexGrid4Organ.Cell(flexcpData, VSFlexGrid4Organ.Rows - 1) = TmpRst.Fields("organ_level").Value
Else
Set tmpNode = paraNode.AddNode(6, TmpRst.Fields("organ_Name").Value)
VSFlexGrid4Organ.Cell(flexcpData, VSFlexGrid4Organ.Rows - 1) = TmpRst.Fields("organ_level").Value
End If
Me.VSFlexGrid4Organ.IsSubtotal(Me.VSFlexGrid4Organ.Rows - 1) = True
If Len(TmpRst.Fields("organ_no").Value) = 15 Then
Me.VSFlexGrid4Organ.RowOutlineLevel(Me.VSFlexGrid4Organ.Rows - 1) = iLevel + 1
Else
Me.VSFlexGrid4Organ.RowOutlineLevel(Me.VSFlexGrid4Organ.Rows - 1) = iLevel
End If
tmpNode.Key = TmpRst.Fields("organ_no").Value
TmpBoolean = FillTree(tmpNode, TmpRst.Fields("organ_no").Value, iLevel + 1)
tmpNode.Expanded = False
TmpRst.MoveNext
Wend
End If
TmpRst.Close
Set TmpRst = Nothing
End Function
Private Sub Form_Unload(Cancel As Integer)
MDIfrmMain.SSActiveToolBarsMain.Tools("ID_单位信息").Enabled = True
End Sub
Private Sub Option4BigBand_Click()
Dim nd As VSFlexNode
With Me.VSFlexGrid4Organ
If .Row >= 0 Then
Set nd = .GetNode(.Row)
If Trim(nd) <> "" Then
m_str4Option = Split(nd, "(")
nd.text = m_str4Option(0) & "(大队级)"
End If
End If
End With
End Sub
Private Sub Option4Bureau_Click()
Dim nd As VSFlexNode
With Me.VSFlexGrid4Organ
If .Row >= 0 Then
Set nd = .GetNode(.Row)
If Trim(nd) <> "" Then
m_str4Option = Split(nd, "(")
nd.text = m_str4Option(0) & "(局级)"
End If
End If
End With
End Sub
Private Sub Option4Factory_Click()
Dim nd As VSFlexNode
With Me.VSFlexGrid4Organ
If .Row >= 0 Then
Set nd = .GetNode(.Row)
If Trim(nd) <> "" Then
m_str4Option = Split(nd, "(")
nd.text = m_str4Option(0) & "(厂处级)"
End If
End If
End With
End Sub
Private Sub Option4Inc_Click()
Dim nd As VSFlexNode
With Me.VSFlexGrid4Organ
If .Row >= 0 Then
Set nd = .GetNode(.Row)
If Trim(nd) <> "" Then
m_str4Option = Split(nd, "(")
nd.text = m_str4Option(0) & "(公司级)"
End If
End If
End With
End Sub
Private Sub Option4SmallBand_Click()
Dim nd As VSFlexNode
With Me.VSFlexGrid4Organ
If .Row >= 0 Then
Set nd = .GetNode(.Row)
If Trim(nd) <> "" Then
m_str4Option = Split(nd, "(")
nd.text = m_str4Option(0) & "(小队级)"
End If
End If
End With
End Sub
Private Sub Text4organName_Change()
Dim nd As VSFlexNode
If Me.Command4Close.Enabled = False Then Exit Sub
With Me.VSFlexGrid4Organ
If .Row >= 0 Then
Set nd = .GetNode(.Row)
nd.text = Trim(Text4OrganName.text)
If Me.Option4SmallBand.Value = True Then
.TextMatrix(.Row, 0) = Me.Text4OrganName.text & m_str4OptionName(0)
ElseIf Me.Option4BigBand.Value = True Then
.TextMatrix(.Row, 0) = Me.Text4OrganName.text & m_str4OptionName(1)
ElseIf Me.Option4Inc.Value = True Then
.TextMatrix(.Row, 0) = Me.Text4OrganName.text & m_str4OptionName(2)
ElseIf Me.Option4Factory.Value = True Then
.TextMatrix(.Row, 0) = Me.Text4OrganName.text & m_str4OptionName(3)
ElseIf Me.Option4Bureau.Value = True Then
.TextMatrix(.Row, 0) = Me.Text4OrganName.text & m_str4OptionName(4)
Else
.TextMatrix(.Row, 0) = Me.Text4OrganName.text
End If
End If
End With
End Sub
Private Sub VSFlexGrid4organ_AfterRowColChange(ByVal OldRow As Long, ByVal OldCol As Long, ByVal NewRow As Long, ByVal NewCol As Long)
Dim nd As VSFlexNode
With Me.VSFlexGrid4Organ
If Me.Command4Close.Enabled = False Then Exit Sub
If OldRow > -1 And OldRow <= .Rows - 1 Then
If Me.Text4OrganCode.Tag = C_Insert Then .TextMatrix(OldRow, 0) = ""
End If
If OldRow <> NewRow And NewRow > -1 Then
ClearOption
Set nd = .GetNode(NewRow)
InitOption NewRow, .Cell(flexcpData, NewRow)
m_strSQL = "select * from t_organ where organ_no='" & nd.Key & "' " & HaveOrganMark
If m_oRs4This.State = adStateOpen Then m_oRs4This.Close
m_oRs4This.CursorLocation = adUseClient
m_oRs4This.Open m_strSQL, g_oConnection4This, adOpenKeyset, adLockPessimistic
If m_oRs4This.EOF = True Then
Text4OrganCode.text = nd.Key
Text4OrganCode.Tag = C_Insert
Me.Command4AddSame.Enabled = False
Me.Command4AddUnder.Enabled = False
Me.Command4Delete.Enabled = True
Me.Command4Save.Enabled = True
InitText
Else
Text4OrganCode.text = m_oRs4This.Fields("organ_no").Value
Text4OrganCode.Tag = C_Update
Text4OrganTelephone.text = CheckVariant(m_oRs4This.Fields("organ_telephone").Value)
Text4OrganNote.text = CheckVariant(m_oRs4This.Fields("organ_description").Value)
If Not IsNull(m_oRs4This.Fields("ORGAN_LEVEL").Value) Then
If m_oRs4This.Fields("ORGAN_LEVEL").Value = C_SMALL_LEVEL Then
Me.Option4SmallBand.Value = True
ElseIf m_oRs4This.Fields("ORGAN_LEVEL").Value = C_LARGE_LEVEL Then
Me.Option4BigBand.Value = True
ElseIf m_oRs4This.Fields("ORGAN_LEVEL").Value = C_COMPANY_LEVEL Then
Me.Option4Inc.Value = True
ElseIf m_oRs4This.Fields("ORGAN_LEVEL").Value = C_FACTORY_LEVEL Then
Me.Option4Factory.Value = True
ElseIf m_oRs4This.Fields("ORGAN_LEVEL").Value = C_BUREAUE_LEVEL Then
Me.Option4Bureau.Value = True
End If
End If
Text4OrganName.text = m_oRs4This.Fields("organ_name").Value
If Not IsNull(m_oRs4This.Fields("ENTERPRISE_PROPERTY_NO").Value) Then
Combo4OrganProperty.ListIndex = FindIndex(m_oRs4This.Fields("ENTERPRISE_PROPERTY_NO").Value, Combo4OrganProperty)
Else
Combo4OrganProperty.ListIndex = -1
End If
Me.vsElastic4This.Enabled = True
If g_str4LoginUnitLevel = 4 Then
If m_oRs4This.Fields("ORGAN_LEVEL").Value = C_BUREAUE_LEVEL Then
Command4AddUnder.Enabled = True
Command4Delete.Enabled = True
Command4AddSame.Enabled = False
Me.Command4Save.Enabled = True
ElseIf m_oRs4This.Fields("ORGAN_LEVEL").Value = C_FACTORY_LEVEL Then
Command4AddUnder.Enabled = False
Command4Delete.Enabled = True
Command4AddSame.Enabled = True
Me.Command4Save.Enabled = True
Else
Command4AddUnder.Enabled = False
Command4Delete.Enabled = False
Command4AddSame.Enabled = False
Me.Command4Save.Enabled = False
End If
Else
If m_oRs4This.Fields("ORGAN_LEVEL").Value > g_str4LoginUnitLevel Then
Command4AddUnder.Enabled = False
Command4Delete.Enabled = False
Command4AddSame.Enabled = False
Me.Command4Save.Enabled = False
ElseIf m_oRs4This.Fields("ORGAN_LEVEL").Value = g_str4LoginUnitLevel Then
Command4AddUnder.Enabled = True
Command4Delete.Enabled = False
Command4AddSame.Enabled = False
Me.Command4Save.Enabled = False
Else
Command4AddUnder.Enabled = True
Command4Delete.Enabled = True
Command4AddSame.Enabled = True
Me.Command4Save.Enabled = True
End If
End If
If m_oRs4This.Fields("ORGAN_LEVEL").Value = C_SMALL_LEVEL Then Me.Command4AddUnder.Enabled = False
End If
End If
End With
InitForm
End Sub
Private Sub InitText()
Text4OrganName.text = ""
Text4OrganTelephone.text = ""
Text4OrganNote.text = ""
Me.Combo4OrganProperty.ListIndex = -1
End Sub
Private Sub ClearOption()
Option4Bureau.Value = False
Option4Factory.Value = False
Option4BigBand.Value = False
Option4SmallBand.Value = False
Option4Inc.Value = False
End Sub
Private Sub InitOption(ByVal NewRow As Long, Optional ByVal OrganLevel As Long = 0)
Dim nd As VSFlexNode
With Me.VSFlexGrid4Organ
Set nd = .GetNode(NewRow)
If NewRow = 0 Then
Option4Bureau.Enabled = True
Option4Factory.Enabled = False
Option4Inc.Enabled = False
Option4BigBand.Enabled = False
Option4SmallBand.Enabled = False
Else
If .Cell(flexcpData, .GetNodeRow(NewRow, flexNTParent)) = C_BUREAUE_LEVEL Then
Option4Bureau.Enabled = False
Option4Factory.Enabled = True
Option4Inc.Enabled = False
Option4BigBand.Enabled = False
Option4SmallBand.Enabled = False
Option4Factory.Value = True
ElseIf .Cell(flexcpData, .GetNodeRow(NewRow, flexNTParent)) = C_FACTORY_LEVEL Then
Option4Bureau.Enabled = False
Option4Factory.Enabled = False
If nd.Children <> 0 Then
If OrganLevel = C_COMPANY_LEVEL Then
Option4Inc.Enabled = True
Option4BigBand.Enabled = False
Option4SmallBand.Enabled = False
ElseIf OrganLevel = C_LARGE_LEVEL Then
Option4Inc.Enabled = False
Option4BigBand.Enabled = True
Option4SmallBand.Enabled = False
Else
Option4Inc.Enabled = True
Option4BigBand.Enabled = True
Option4SmallBand.Enabled = True
End If
Else
Option4Inc.Enabled = True
Option4BigBand.Enabled = True
Option4SmallBand.Enabled = True
End If
ElseIf .Cell(flexcpData, .GetNodeRow(NewRow, flexNTParent)) = C_COMPANY_LEVEL Then
Option4Bureau.Enabled = False
Option4Factory.Enabled = False
Option4Inc.Enabled = False
If nd.Children <> 0 Then
Option4BigBand.Enabled = True
Option4SmallBand.Enabled = False
Else
Option4BigBand.Enabled = True
Option4SmallBand.Enabled = True
End If
ElseIf .Cell(flexcpData, .GetNodeRow(NewRow, flexNTParent)) = C_LARGE_LEVEL Then
Option4Bureau.Enabled = False
Option4Factory.Enabled = False
Option4Inc.Enabled = False
Option4BigBand.Enabled = False
Option4SmallBand.Enabled = True
End If
End If
End With
End Sub
Private Sub InitForm()
Dim str4CheckPermission As String
str4CheckPermission = CheckPermission("单位信息")
If Mid(str4CheckPermission, 2, 1) = 0 Then
Command4AddUnder.Enabled = False
Command4Save.Enabled = False
'Command4Unite.Enabled = False
End If
If Mid(str4CheckPermission, 3, 1) = 0 Then
Command4Save.Enabled = False
End If
If Mid(str4CheckPermission, 4, 1) = 0 Then
Command4Delete.Enabled = False
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -