You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

205 lines
12 KiB
Plaintext

<UserControl x:Class="BaseModule.Views.RoleManagementView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BaseModule.Views"
xmlns:prism="http://prismlibrary.com/"
prism:ViewModelLocator.AutoWireViewModel="True"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Txgy.EWS.Client.Assets;component/Styles/BaseResources.xaml"/>
<ResourceDictionary Source="/Txgy.EWS.Client.Assets;component/Styles/ButtonStyles.xaml"/>
<ResourceDictionary Source="/Txgy.EWS.Client.Assets;component/Styles/TextBoxStyle.xaml"/>
<ResourceDictionary>
<Style TargetType="TabItem">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground" Value="#888"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="TabItem">
<Border Height="30" Background="{TemplateBinding Background}" CornerRadius="5,5,0,0">
<TextBlock Text="{TemplateBinding Header}" VerticalAlignment="Center" HorizontalAlignment="Center"
Margin="20,5"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="#FF0ABEFF"/>
<Setter Property="Foreground" Value="white"/>
</Trigger>
</Style.Triggers>
</Style>
<ControlTemplate TargetType="RadioButton" x:Key="RoleItemButtonTemplate">
<Grid Background="Transparent" Height="30" Name="root">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="50"/>
</Grid.ColumnDefinitions>
<TextBlock Text="{TemplateBinding Content}" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="5,0"/>
<TextBlock Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Center">
<Hyperlink Command="{Binding DeleteCommand}"
CommandParameter="{Binding}">删除</Hyperlink>
</TextBlock>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter Property="Background" Value="#FF0ABEFF" TargetName="root"/>
<Setter Property="Foreground" Value="white"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<ControlTemplate TargetType="CheckBox" x:Key="ListRowTemplate">
<Grid Background="Transparent" Name="back">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="30"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Border Width="14" Height="14" CornerRadius="3" BorderThickness="1" BorderBrush="#DDD" Name="checked">
<TextBlock Text="&#xe608;" FontFamily="{StaticResource Iconfont}" VerticalAlignment="Center" HorizontalAlignment="Center"
Name="gou" Visibility="Collapsed" Foreground="White"/>
</Border>
<TextBlock Text="{Binding MenuHeader}" VerticalAlignment="Center" Grid.Column="1"/>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#08000000" TargetName="back"/>
</Trigger>
<DataTrigger Binding="{Binding IsCurrent}" Value="True">
<Setter Property="Background" Value="#11000000" TargetName="back"/>
</DataTrigger>
<Trigger Property="IsChecked" Value="True">
<Setter Property="Visibility" Value="Visible" TargetName="gou"/>
<Setter Property="Background" Value="#FF0ABEFF" TargetName="checked"/>
<Setter Property="BorderBrush" Value="#FF0ABEFF" TargetName="checked"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<DataTemplate x:Key="MenuItemTemplate">
<Grid Name="root" Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="35"/>
<RowDefinition Height="auto"/>
</Grid.RowDefinitions>
<CheckBox IsChecked="{Binding IsSelected}" Height="35" Template="{StaticResource ListRowTemplate}"/>
<ItemsControl ItemsSource="{Binding Children}" Grid.Row="1" Margin="20,0,0,0"
ItemTemplate="{DynamicResource MenuItemTemplate}" Name="childlist"/>
</Grid>
</DataTemplate>
</ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<Grid Margin="20">
<Grid.RowDefinitions>
<RowDefinition Height="50"/>
<RowDefinition/>
</Grid.RowDefinitions>
<Border BorderBrush="#DDD" BorderThickness="0,0,0,1"/>
<TextBox Text="" VerticalAlignment="Center" Width="300" HorizontalAlignment="Left" Style="{DynamicResource SearchTextBoxStyle}"/>
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Right" Orientation="Horizontal">
<Button Content="刷新" Style="{StaticResource NormalButtonStyle}" Background="#FF0ABEFF"
Width="70" Margin="5,0"
Command="{Binding RefreshCommand}"/>
<Button Content="添加角色"
Style="{StaticResource IconWithContentButtonStyle}" Width="100"
Tag="&#xe603;" Background="#FFF05005"
Command="{Binding AddCommand}"/>
</StackPanel>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="220"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<ItemsControl ItemsSource="{Binding Roles}" Background="#F7F9FA" Margin="0,10" BorderBrush="#EEE" BorderThickness="1">
<ItemsControl.ItemTemplate>
<DataTemplate>
<RadioButton Content="{Binding RoleName}" IsChecked="{Binding IsSelected}" GroupName="role_btn"
Template="{StaticResource RoleItemButtonTemplate}"
Command="{Binding ItemSelectedCommand}"
CommandParameter="{Binding}"/>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<Grid Grid.Column="1" Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition/>
<RowDefinition Height="50"/>
</Grid.RowDefinitions>
<Grid Height="45" DataContext="{Binding CurrentRole}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="80"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<TextBlock Text="角色名称" VerticalAlignment="Center" Foreground="#888"/>
<TextBox Text="{Binding RoleName}" Grid.Column="1" Style="{StaticResource NormalTextBoxStyle}"/>
</Grid>
<TabControl Grid.Row="1" BorderThickness="0,1,0,0">
<TabItem Header="用户">
<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition Height="40"/>
</Grid.RowDefinitions>
<ItemsControl ItemsSource="{Binding Users}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Border Background="#F7F9FA" CornerRadius="3" Margin="5">
<Grid Margin="5,3">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding UserName}" Foreground="#444" Margin="10,5"/>
<Button Width="20" Grid.Column="1" Style="{StaticResource IconButtonStyle}" Background="Transparent"
Content="&#xe625;" FontSize="10" Foreground="#444"
Command="{Binding DeleteCommand}"
CommandParameter="{Binding}"/>
</Grid>
</Border>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<Border Grid.Row="1" Background="#F7F9FA"/>
<TextBlock Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Right" Width="100" TextAlignment="Center">
<Hyperlink Command="{Binding AddUserCommand}">添加用户</Hyperlink>
</TextBlock>
</Grid>
</TabItem>
<TabItem Header="菜单">
<ItemsControl ItemsSource="{Binding Menus}" ItemTemplate="{StaticResource MenuItemTemplate}">
</ItemsControl>
</TabItem>
</TabControl>
<Button Content="保存修改" Width="100" Height="30" Margin="5,0" Grid.Row="2" HorizontalAlignment="Right"
Style="{StaticResource NormalButtonStyle}"
Background="#FF0ABEFF"
Command="{Binding SaveCommand}"/>
</Grid>
</Grid>
</Grid>
</UserControl>