RoleView.xaml 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. <UserControl x:Class="VirgoUI.Client.Models.Utility.RolePage.RoleView"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  5. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  6. xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
  7. xmlns:ControlLib="http://OpenSEMI.Ctrlib.com/presentation"
  8. xmlns:ts="clr-namespace:OpenSEMI.ClientBase.Command"
  9. xmlns:cal="http://www.caliburn.org" IsEnabled="{Binding PageEnabled}"
  10. xmlns:command="clr-namespace:OpenSEMI.ClientBase.Command">
  11. <UserControl.Resources>
  12. <Style x:Key="ViewEnabledBtn" TargetType="{x:Type Button}" BasedOn="{StaticResource ResourceKey={x:Type Button}}">
  13. <Setter Property="Button.IsEnabled" Value="False" />
  14. <Style.Triggers>
  15. <MultiDataTrigger>
  16. <MultiDataTrigger.Conditions>
  17. <Condition Binding="{Binding Permission}" Value="3"></Condition>
  18. <Condition Binding="{Binding ControlMode}" Value="VIEW"></Condition>
  19. </MultiDataTrigger.Conditions>
  20. <Setter Property="Button.IsEnabled" Value="True"/>
  21. </MultiDataTrigger>
  22. </Style.Triggers>
  23. </Style>
  24. <Style x:Key="EditEnabledBtn" TargetType="{x:Type Button}" BasedOn="{StaticResource ResourceKey={x:Type Button}}">
  25. <Setter Property="Button.IsEnabled" Value="False" />
  26. <Style.Triggers>
  27. <MultiDataTrigger>
  28. <MultiDataTrigger.Conditions>
  29. <Condition Binding="{Binding Permission}" Value="3"></Condition>
  30. <Condition Binding="{Binding ControlMode}" Value="EDIT"></Condition>
  31. </MultiDataTrigger.Conditions>
  32. <Setter Property="Button.IsEnabled" Value="True"/>
  33. </MultiDataTrigger>
  34. </Style.Triggers>
  35. </Style>
  36. </UserControl.Resources>
  37. <Grid x:Name="MainTable" MinHeight="450" HorizontalAlignment="Left" MinWidth="1200">
  38. <Grid x:Name="MainField">
  39. <Grid.ColumnDefinitions>
  40. <ColumnDefinition Width="Auto" MinWidth="250"/>
  41. <ColumnDefinition />
  42. </Grid.ColumnDefinitions>
  43. <Grid.RowDefinitions>
  44. <RowDefinition />
  45. <RowDefinition Height="40"/>
  46. </Grid.RowDefinitions>
  47. <GridSplitter Width="5" Grid.Column="1" HorizontalAlignment="Left" BorderThickness="0,8">
  48. <GridSplitter.Background>
  49. <SolidColorBrush/>
  50. </GridSplitter.Background>
  51. </GridSplitter>
  52. <Border BorderBrush="{DynamicResource Tab_BD}" BorderThickness="1" SnapsToDevicePixels="True" Background="{DynamicResource Tab_BG}" Margin="0,20,0,0" Padding="12">
  53. <TreeView HorizontalAlignment="Left" Name="RolesTree" VerticalAlignment="Top">
  54. <TreeView.Style>
  55. <Style TargetType="{x:Type TreeView}" BasedOn="{StaticResource ResourceKey={x:Type TreeView}}">
  56. <Setter Property="TreeView.IsEnabled" Value="False" />
  57. <Style.Triggers>
  58. <DataTrigger Binding="{Binding ControlMode}" Value="VIEW">
  59. <Setter Property="TreeView.IsEnabled" Value="True"/>
  60. </DataTrigger>
  61. </Style.Triggers>
  62. </Style>
  63. </TreeView.Style>
  64. <TreeViewItem Header="Roles" ItemsSource="{Binding RoleList}" IsExpanded="True">
  65. <TreeViewItem.ItemContainerStyle>
  66. <Style x:Name="RoleTreeViewItem" TargetType="{x:Type TreeViewItem}" BasedOn="{StaticResource ResourceKey={x:Type TreeViewItem}}">
  67. <Setter Property="IsSelected" Value="{Binding Path=IsSelected,Mode=TwoWay}"></Setter>
  68. <Style.Triggers>
  69. <Trigger Property="VirtualizingStackPanel.IsVirtualizing" Value="true">
  70. <Setter Property="ItemsPanel">
  71. <Setter.Value>
  72. <ItemsPanelTemplate>
  73. <VirtualizingStackPanel/>
  74. </ItemsPanelTemplate>
  75. </Setter.Value>
  76. </Setter>
  77. </Trigger>
  78. </Style.Triggers>
  79. </Style>
  80. </TreeViewItem.ItemContainerStyle>
  81. <TreeViewItem.ItemTemplate>
  82. <DataTemplate>
  83. <TextBlock Text="{Binding DisplayRoleName}" />
  84. </DataTemplate>
  85. </TreeViewItem.ItemTemplate>
  86. </TreeViewItem>
  87. <command:CommandSource.Trigger>
  88. <ts:CommandTriggerGroup>
  89. <ts:EventCommandTrigger
  90. RoutedEvent="TreeView.SelectedItemChanged"
  91. CustomParameter="{Binding ElementName=RolesTree,Path=SelectedItem}"
  92. Command="{Binding DataContext.RoleTreeSelectChangedCommand,
  93. RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}" />
  94. </ts:CommandTriggerGroup>
  95. </command:CommandSource.Trigger>
  96. </TreeView>
  97. </Border>
  98. <Grid Grid.Column="1" Margin="10,0,0,0">
  99. <Grid.RowDefinitions>
  100. <RowDefinition Height="20"/>
  101. <RowDefinition Height="Auto"/>
  102. <RowDefinition/>
  103. </Grid.RowDefinitions>
  104. <TextBlock TextWrapping="Wrap" Text="Role Property" VerticalAlignment="Top" Foreground="{DynamicResource FG_Black}" FontWeight="Bold" FontSize="14" FontFamily="Arial" Margin="5,0,0,0"/>
  105. <Grid x:Name="Role_Property" Grid.Row="1" Margin="0,0,0,5">
  106. <Grid.RowDefinitions>
  107. <RowDefinition Height="24"/>
  108. <RowDefinition Height="24"/>
  109. <RowDefinition Height="24"/>
  110. </Grid.RowDefinitions>
  111. <Grid x:Name="Role_Name" Grid.Row="0">
  112. <Grid.ColumnDefinitions>
  113. <ColumnDefinition Width="100"/>
  114. <ColumnDefinition/>
  115. </Grid.ColumnDefinitions>
  116. <Border BorderBrush="{DynamicResource Table_BD}" BorderThickness="1" Background="{DynamicResource Table_BG_Title}" Padding="5,1">
  117. <TextBlock Text="Role Name" TextWrapping="Wrap" Foreground="{DynamicResource FG_Black}" FontSize="12" FontFamily="Arial" VerticalAlignment="Center"/>
  118. </Border>
  119. <Border BorderBrush="{DynamicResource Table_BD}" BorderThickness="0,1,1,1" Background="{DynamicResource Table_BG_Content}" Grid.Column="1" Padding="5,1">
  120. <ControlLib:TextBoxEx Text="{Binding TreeSelectedRole.DisplayRoleName,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" HorizontalContentAlignment="Left" TextSaved="{Binding Mode=TwoWay, Path=TreeSelectedRole.RoleNameTextSaved }" Name="textBox1"
  121. HorizontalAlignment="Left" VerticalAlignment="Center" Width="150">
  122. <i:Interaction.Triggers>
  123. <i:EventTrigger EventName="TextChanged">
  124. <cal:ActionMessage MethodName="OnRoleChanged">
  125. </cal:ActionMessage>
  126. </i:EventTrigger>
  127. </i:Interaction.Triggers>
  128. </ControlLib:TextBoxEx>
  129. </Border>
  130. </Grid>
  131. <Grid x:Name="Is_Auto_Logout" Grid.Row="1">
  132. <Grid.ColumnDefinitions>
  133. <ColumnDefinition Width="100"/>
  134. <ColumnDefinition/>
  135. </Grid.ColumnDefinitions>
  136. <Border BorderBrush="{DynamicResource Table_BD}" BorderThickness="1,0,1,1" Background="{DynamicResource Table_BG_Title}" Padding="5,1">
  137. <TextBlock Text="Is Auto lock" TextWrapping="Wrap" Foreground="{DynamicResource FG_Black}" FontSize="12" FontFamily="Arial" VerticalAlignment="Center"/>
  138. </Border>
  139. <Border BorderBrush="{DynamicResource Table_BD}" BorderThickness="0,0,1,1" Background="{DynamicResource Table_BG_Content}" Grid.Column="1" Padding="5,1">
  140. <CheckBox IsChecked="{Binding TreeSelectedRole.DisplayIsAutoLogout}" HorizontalAlignment="Left" VerticalAlignment="Center"
  141. Content=""
  142. Name="checkBox1">
  143. <i:Interaction.Triggers>
  144. <i:EventTrigger EventName="Click">
  145. <cal:ActionMessage MethodName="OnAutoLogoutTimeChecked">
  146. <cal:Parameter Value="$source" />
  147. </cal:ActionMessage>
  148. </i:EventTrigger>
  149. </i:Interaction.Triggers>
  150. </CheckBox>
  151. </Border>
  152. </Grid>
  153. <Grid x:Name="Time" Grid.Row="2">
  154. <Grid.ColumnDefinitions>
  155. <ColumnDefinition Width="100"/>
  156. <ColumnDefinition/>
  157. </Grid.ColumnDefinitions>
  158. <Border BorderBrush="{DynamicResource Table_BD}" BorderThickness="1,0,1,1" Background="{DynamicResource Table_BG_Title}" Padding="5,1">
  159. <TextBlock Text="Time(minutes)" TextWrapping="Wrap" Foreground="{DynamicResource FG_Black}" FontSize="12" FontFamily="Arial" VerticalAlignment="Center"/>
  160. </Border>
  161. <Border BorderBrush="{DynamicResource Table_BD}" BorderThickness="0,0,1,1" Background="{DynamicResource Table_BG_Content}" Grid.Column="1" Padding="5,1">
  162. <ControlLib:TextBoxEx EditBoxMode="UnSignInteger" Text="{Binding TreeSelectedRole.DisplayAutoLogoutTime,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" HorizontalContentAlignment="Left" TextSaved="{Binding Mode=TwoWay, Path=TreeSelectedRole.TimeTextSaved }" Name="textBox2"
  163. HorizontalAlignment="Left" VerticalAlignment="Center" Width="150">
  164. <i:Interaction.Triggers>
  165. <i:EventTrigger EventName="TextChanged">
  166. <cal:ActionMessage MethodName="OnRoleChanged">
  167. </cal:ActionMessage>
  168. </i:EventTrigger>
  169. </i:Interaction.Triggers>
  170. </ControlLib:TextBoxEx>
  171. </Border>
  172. </Grid>
  173. </Grid>
  174. <TabControl Grid.Row="2">
  175. <TabItem Header="Page Access Permission">
  176. <ListView AlternationCount="2"
  177. VerticalAlignment="Top"
  178. Name="RolesList"
  179. ScrollViewer.HorizontalScrollBarVisibility="Auto"
  180. ScrollViewer.VerticalScrollBarVisibility="Auto"
  181. ScrollViewer.CanContentScroll="True"
  182. ItemsSource="{Binding Path=TreeSelectedRole.MenuCollection}">
  183. <ListView.View>
  184. <GridView>
  185. <GridViewColumn Width="200" Header="Menu Name" DisplayMemberBinding="{Binding Name}"/>
  186. <GridViewColumn Width="200" Header="Permission Configuration">
  187. <GridViewColumn.CellTemplate>
  188. <DataTemplate >
  189. <ComboBox Width="140" x:Name="combPermission"
  190. DisplayMemberPath="StringPermission"
  191. SelectedIndex="{Binding DisplayIndexPermission}"
  192. ItemsSource="{Binding DataContext.PermissionDictionary,
  193. RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}">
  194. <i:Interaction.Triggers>
  195. <i:EventTrigger EventName="SelectionChanged">
  196. <cal:ActionMessage MethodName="OnRoleChanged">
  197. </cal:ActionMessage>
  198. </i:EventTrigger>
  199. </i:Interaction.Triggers>
  200. </ComboBox>
  201. </DataTemplate>
  202. </GridViewColumn.CellTemplate>
  203. </GridViewColumn>
  204. </GridView>
  205. </ListView.View>
  206. </ListView>
  207. </TabItem>
  208. </TabControl>
  209. </Grid>
  210. <StackPanel Grid.Row="1" Grid.ColumnSpan="2" Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
  211. <Button Content="Create" Style="{StaticResource ViewEnabledBtn}" Command="{Binding btnAddRoleCommand}" Height="25" Width="80"/>
  212. <Button Content="Delete" Style="{StaticResource ViewEnabledBtn}" Command="{Binding btnDeleteRoleCommand}" Height="25" Width="80" Margin="10,0,0,0"/>
  213. <Button Content="Clone" Style="{StaticResource ViewEnabledBtn}" Command="{Binding btnCloneRoleCommand}" Height="25" Width="80" Margin="10,0,0,0"/>
  214. <Button Content="Save" Style="{StaticResource EditEnabledBtn}" Command="{Binding btnSaveCommand}" Height="25" Width="80" Margin="10,0,0,0" />
  215. <Button Content="Cancel" Style="{StaticResource EditEnabledBtn}" Command="{Binding BtnCancelRoleCommand}" Height="25" Width="80" Margin="10,0,0,0"/>
  216. </StackPanel>
  217. </Grid>
  218. </Grid>
  219. </UserControl>