194 lines
		
	
	
		
			10 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
		
		
			
		
	
	
			194 lines
		
	
	
		
			10 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
| 
								 | 
							
								<UserControl x:Class="DM_Weight.Views.RoleManagerWindow"
							 | 
						||
| 
								 | 
							
								            xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" 
							 | 
						||
| 
								 | 
							
								            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:DM_Weight.Views"
							 | 
						||
| 
								 | 
							
								            xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
							 | 
						||
| 
								 | 
							
								            xmlns:convert="clr-namespace:DM_Weight.Converter"
							 | 
						||
| 
								 | 
							
								            xmlns:prism="http://prismlibrary.com/"
							 | 
						||
| 
								 | 
							
								            mc:Ignorable="d">
							 | 
						||
| 
								 | 
							
								    <UserControl.Resources>
							 | 
						||
| 
								 | 
							
								        <Style x:Key="st" TargetType="GridViewColumnHeader">
							 | 
						||
| 
								 | 
							
								            <Style.Setters>
							 | 
						||
| 
								 | 
							
								                <Setter Property="Height">
							 | 
						||
| 
								 | 
							
								                    <Setter.Value>55</Setter.Value>
							 | 
						||
| 
								 | 
							
								                </Setter>
							 | 
						||
| 
								 | 
							
								                <Setter Property="Background">
							 | 
						||
| 
								 | 
							
								                    <Setter.Value>#31ccec</Setter.Value>
							 | 
						||
| 
								 | 
							
								                </Setter>
							 | 
						||
| 
								 | 
							
								                <Setter Property="Foreground">
							 | 
						||
| 
								 | 
							
								                    <Setter.Value>white</Setter.Value>
							 | 
						||
| 
								 | 
							
								                </Setter>
							 | 
						||
| 
								 | 
							
								            </Style.Setters>
							 | 
						||
| 
								 | 
							
								        </Style>
							 | 
						||
| 
								 | 
							
								    </UserControl.Resources>
							 | 
						||
| 
								 | 
							
								    <Grid>
							 | 
						||
| 
								 | 
							
								        <Grid.Resources>
							 | 
						||
| 
								 | 
							
								            <convert:NullableToEnabelConverter x:Key="NullableToEnabelConverter" />
							 | 
						||
| 
								 | 
							
								        </Grid.Resources>
							 | 
						||
| 
								 | 
							
								        <Grid.ColumnDefinitions>
							 | 
						||
| 
								 | 
							
								            <ColumnDefinition Width="*" />
							 | 
						||
| 
								 | 
							
								            <ColumnDefinition Width="*" />
							 | 
						||
| 
								 | 
							
								        </Grid.ColumnDefinitions>
							 | 
						||
| 
								 | 
							
								        <Grid Grid.Column="0">
							 | 
						||
| 
								 | 
							
								            <Grid.RowDefinitions>
							 | 
						||
| 
								 | 
							
								                <RowDefinition Height="Auto" />
							 | 
						||
| 
								 | 
							
								                <RowDefinition />
							 | 
						||
| 
								 | 
							
								            </Grid.RowDefinitions>
							 | 
						||
| 
								 | 
							
								            <Grid Margin="0 6 0 6" Grid.Row="0">
							 | 
						||
| 
								 | 
							
								                <Grid.ColumnDefinitions>
							 | 
						||
| 
								 | 
							
								                    <ColumnDefinition Width="180" />
							 | 
						||
| 
								 | 
							
								                    <ColumnDefinition />
							 | 
						||
| 
								 | 
							
								                </Grid.ColumnDefinitions>
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								                <TextBox
							 | 
						||
| 
								 | 
							
								                    Grid.Column="0"
							 | 
						||
| 
								 | 
							
								                    Text="{Binding SearchValue, UpdateSourceTrigger=PropertyChanged}"
							 | 
						||
| 
								 | 
							
								                    materialDesign:HintAssist.Hint="角色名"
							 | 
						||
| 
								 | 
							
								                    Margin="6 0 0 0"
							 | 
						||
| 
								 | 
							
								                    Style="{StaticResource MaterialDesignOutlinedTextBox}"/>
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								                <StackPanel Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Right">
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								                    <Button
							 | 
						||
| 
								 | 
							
								                Margin="0 0 6 0"
							 | 
						||
| 
								 | 
							
								                VerticalAlignment="Center"
							 | 
						||
| 
								 | 
							
								                Style="{StaticResource MaterialDesignOutlinedLightButton}"
							 | 
						||
| 
								 | 
							
								                ToolTip="刷新" Command="{Binding Query}">
							 | 
						||
| 
								 | 
							
								                        <materialDesign:PackIcon
							 | 
						||
| 
								 | 
							
								                    Kind="Refresh" />
							 | 
						||
| 
								 | 
							
								                    </Button>
							 | 
						||
| 
								 | 
							
								                </StackPanel>
							 | 
						||
| 
								 | 
							
								            </Grid>
							 | 
						||
| 
								 | 
							
								            <ListView Grid.Row="1" Grid.Column="0" ItemsSource="{Binding RoleList}" 
							 | 
						||
| 
								 | 
							
								                SelectedItem="{Binding Role}"
							 | 
						||
| 
								 | 
							
								                materialDesign:ListViewAssist.HeaderRowBackground="#31ccec"
							 | 
						||
| 
								 | 
							
								                materialDesign:DataGridAssist.ColumnHeaderPadding="10"
							 | 
						||
| 
								 | 
							
								                materialDesign:ListViewAssist.ListViewItemPadding="13">
							 | 
						||
| 
								 | 
							
								                <!--<i:Interaction.Triggers>
							 | 
						||
| 
								 | 
							
								                    <i:EventTrigger EventName="SelectionChanged">
							 | 
						||
| 
								 | 
							
								                        <i:InvokeCommandAction Command="{Binding RowSelected}" />
							 | 
						||
| 
								 | 
							
								                    </i:EventTrigger>
							 | 
						||
| 
								 | 
							
								                </i:Interaction.Triggers>-->
							 | 
						||
| 
								 | 
							
								                <ListView.Resources>
							 | 
						||
| 
								 | 
							
								                    <Style TargetType="{x:Type GridViewColumnHeader}" BasedOn="{StaticResource {x:Type GridViewColumnHeader}}">
							 | 
						||
| 
								 | 
							
								                        <Setter Property="Foreground" Value="White" />
							 | 
						||
| 
								 | 
							
								                    </Style>
							 | 
						||
| 
								 | 
							
								                </ListView.Resources>
							 | 
						||
| 
								 | 
							
								                <ListView.View>
							 | 
						||
| 
								 | 
							
								                    <GridView ColumnHeaderContainerStyle="{StaticResource st}">
							 | 
						||
| 
								 | 
							
								                        <GridViewColumn Width="253"
							 | 
						||
| 
								 | 
							
								                        Header="角色编号"
							 | 
						||
| 
								 | 
							
								                        DisplayMemberBinding="{Binding Id}"/>
							 | 
						||
| 
								 | 
							
								                        <GridViewColumn Width="253"
							 | 
						||
| 
								 | 
							
								                        DisplayMemberBinding="{Binding RoleName}"
							 | 
						||
| 
								 | 
							
								                        Header="角色名"/>
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								                    </GridView>
							 | 
						||
| 
								 | 
							
								                </ListView.View>
							 | 
						||
| 
								 | 
							
								            </ListView>
							 | 
						||
| 
								 | 
							
								        </Grid>
							 | 
						||
| 
								 | 
							
								        <GroupBox Margin="6"  Grid.Column="1" Header="编辑/新增" materialDesign:ColorZoneAssist.Mode="PrimaryLight">
							 | 
						||
| 
								 | 
							
								            <Grid>
							 | 
						||
| 
								 | 
							
								                <Grid.RowDefinitions>
							 | 
						||
| 
								 | 
							
								                    <RowDefinition Height="Auto" />
							 | 
						||
| 
								 | 
							
								                    <RowDefinition />
							 | 
						||
| 
								 | 
							
								                </Grid.RowDefinitions>
							 | 
						||
| 
								 | 
							
								                <Grid Grid.Row="0">
							 | 
						||
| 
								 | 
							
								                    <Grid.ColumnDefinitions>
							 | 
						||
| 
								 | 
							
								                        <ColumnDefinition />
							 | 
						||
| 
								 | 
							
								                        <ColumnDefinition />
							 | 
						||
| 
								 | 
							
								                    </Grid.ColumnDefinitions>
							 | 
						||
| 
								 | 
							
								                    <TextBox
							 | 
						||
| 
								 | 
							
								                         Grid.Column="0" Margin="10"
							 | 
						||
| 
								 | 
							
								                        Text="{Binding Role.RoleName}"
							 | 
						||
| 
								 | 
							
								                        materialDesign:HintAssist.Hint="角色名"
							 | 
						||
| 
								 | 
							
								                        Style="{StaticResource MaterialDesignOutlinedTextBox}"/>
							 | 
						||
| 
								 | 
							
								                    <StackPanel  Grid.Column="1" Orientation="Horizontal" Margin="10" HorizontalAlignment="Right" VerticalAlignment="Center">
							 | 
						||
| 
								 | 
							
								                        <Button
							 | 
						||
| 
								 | 
							
								                            Margin="6" 
							 | 
						||
| 
								 | 
							
								                            Command="{Binding EditRole}"
							 | 
						||
| 
								 | 
							
								                            IsEnabled="{Binding Role.Id, Converter={StaticResource NullableToEnabelConverter}}"
							 | 
						||
| 
								 | 
							
								                            Content="修改" Cursor="Hand" />
							 | 
						||
| 
								 | 
							
								                        <Button
							 | 
						||
| 
								 | 
							
								                            Command="{Binding AddRole}"
							 | 
						||
| 
								 | 
							
								                            Content="新增" />
							 | 
						||
| 
								 | 
							
								                    </StackPanel>
							 | 
						||
| 
								 | 
							
								                </Grid>
							 | 
						||
| 
								 | 
							
								                <Grid Grid.Row="1">
							 | 
						||
| 
								 | 
							
								                    <Grid.ColumnDefinitions>
							 | 
						||
| 
								 | 
							
								                        <ColumnDefinition />
							 | 
						||
| 
								 | 
							
								                        <ColumnDefinition Width="Auto" />
							 | 
						||
| 
								 | 
							
								                        <ColumnDefinition />
							 | 
						||
| 
								 | 
							
								                    </Grid.ColumnDefinitions>
							 | 
						||
| 
								 | 
							
								                    <GroupBox Header="全部菜单"   Grid.Column="0" Margin="10">
							 | 
						||
| 
								 | 
							
								                        <ScrollViewer  Grid.Row="1"  Grid.Column="1">
							 | 
						||
| 
								 | 
							
								                            <TreeView x:Name="LeftTree" MinWidth="220" ItemsSource="{Binding AllPremissions}">
							 | 
						||
| 
								 | 
							
								                                <i:Interaction.Triggers>
							 | 
						||
| 
								 | 
							
								                                    <i:EventTrigger EventName="SelectedItemChanged">
							 | 
						||
| 
								 | 
							
								                                        <i:InvokeCommandAction Command="{Binding Path=LeftSelectedItemChangedCommand}" 
							 | 
						||
| 
								 | 
							
								                                           CommandParameter="{Binding ElementName=LeftTree, Path=SelectedItem}"/>
							 | 
						||
| 
								 | 
							
								                                    </i:EventTrigger>
							 | 
						||
| 
								 | 
							
								                                </i:Interaction.Triggers>
							 | 
						||
| 
								 | 
							
								                                <TreeView.ItemTemplate>
							 | 
						||
| 
								 | 
							
								                                    <HierarchicalDataTemplate ItemsSource="{Binding Children}">
							 | 
						||
| 
								 | 
							
								                                        <TextBlock Text="{Binding PremissionName}" />
							 | 
						||
| 
								 | 
							
								                                    </HierarchicalDataTemplate>
							 | 
						||
| 
								 | 
							
								                                </TreeView.ItemTemplate>
							 | 
						||
| 
								 | 
							
								                            </TreeView>
							 | 
						||
| 
								 | 
							
								                        </ScrollViewer>
							 | 
						||
| 
								 | 
							
								                    </GroupBox>
							 | 
						||
| 
								 | 
							
								                    <StackPanel Grid.Column="1" Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center">
							 | 
						||
| 
								 | 
							
								                        <Button
							 | 
						||
| 
								 | 
							
								                            Margin="0 4 0 4"
							 | 
						||
| 
								 | 
							
								                            Style="{StaticResource MaterialDesignPaperLightButton}"
							 | 
						||
| 
								 | 
							
								                            ToolTip="右移"
							 | 
						||
| 
								 | 
							
								                            IsEnabled="{Binding LeftPremission, Converter={StaticResource NullableToEnabelConverter}}"
							 | 
						||
| 
								 | 
							
								                            Command="{Binding ToRight}"
							 | 
						||
| 
								 | 
							
								                            Content="{materialDesign:PackIcon ChevronRight}"/>
							 | 
						||
| 
								 | 
							
								                        <Button
							 | 
						||
| 
								 | 
							
								                            Margin="0 4 0 4"
							 | 
						||
| 
								 | 
							
								                            Style="{StaticResource MaterialDesignPaperLightButton}"
							 | 
						||
| 
								 | 
							
								                            ToolTip="左移"
							 | 
						||
| 
								 | 
							
								                            IsEnabled="{Binding RightPremission, Converter={StaticResource NullableToEnabelConverter}}"
							 | 
						||
| 
								 | 
							
								                            Command="{Binding ToLeft}"
							 | 
						||
| 
								 | 
							
								                            Content="{materialDesign:PackIcon ChevronLeft}"/>
							 | 
						||
| 
								 | 
							
								                        <Button
							 | 
						||
| 
								 | 
							
								                            Margin="0 4 0 4"
							 | 
						||
| 
								 | 
							
								                            Style="{StaticResource MaterialDesignPaperLightButton}"
							 | 
						||
| 
								 | 
							
								                            ToolTip="全部右移"
							 | 
						||
| 
								 | 
							
								                            Command="{Binding AllToRight}"
							 | 
						||
| 
								 | 
							
								                            Content="{materialDesign:PackIcon ChevronDoubleRight}"/>
							 | 
						||
| 
								 | 
							
								                        <Button
							 | 
						||
| 
								 | 
							
								                            Margin="0 4 0 4"
							 | 
						||
| 
								 | 
							
								                            Style="{StaticResource MaterialDesignPaperLightButton}"
							 | 
						||
| 
								 | 
							
								                            ToolTip="全部左移"
							 | 
						||
| 
								 | 
							
								                            Command="{Binding AllToLeft}"
							 | 
						||
| 
								 | 
							
								                            Content="{materialDesign:PackIcon ChevronDoubleLeft}" />
							 | 
						||
| 
								 | 
							
								                    </StackPanel>
							 | 
						||
| 
								 | 
							
								                    <GroupBox Header="已选菜单"  Grid.Column="2" Margin="10">
							 | 
						||
| 
								 | 
							
								                        <ScrollViewer  Grid.Row="1"  Grid.Column="1">
							 | 
						||
| 
								 | 
							
								                            <TreeView x:Name="RightTree" MinWidth="220" ItemsSource="{Binding RightPremissions}">
							 | 
						||
| 
								 | 
							
								                                <i:Interaction.Triggers>
							 | 
						||
| 
								 | 
							
								                                    <i:EventTrigger EventName="SelectedItemChanged">
							 | 
						||
| 
								 | 
							
								                                        <i:InvokeCommandAction Command="{Binding Path=RightSelectedItemChangedCommand}" 
							 | 
						||
| 
								 | 
							
								                                           CommandParameter="{Binding ElementName=RightTree, Path=SelectedItem}"/>
							 | 
						||
| 
								 | 
							
								                                    </i:EventTrigger>
							 | 
						||
| 
								 | 
							
								                                </i:Interaction.Triggers>
							 | 
						||
| 
								 | 
							
								                                <TreeView.ItemTemplate>
							 | 
						||
| 
								 | 
							
								                                    <HierarchicalDataTemplate ItemsSource="{Binding Children}">
							 | 
						||
| 
								 | 
							
								                                        <TextBlock Text="{Binding PremissionName}" />
							 | 
						||
| 
								 | 
							
								                                    </HierarchicalDataTemplate>
							 | 
						||
| 
								 | 
							
								                                </TreeView.ItemTemplate>
							 | 
						||
| 
								 | 
							
								                            </TreeView>
							 | 
						||
| 
								 | 
							
								                        </ScrollViewer>
							 | 
						||
| 
								 | 
							
								                    </GroupBox>
							 | 
						||
| 
								 | 
							
								                </Grid>
							 | 
						||
| 
								 | 
							
								                
							 | 
						||
| 
								 | 
							
								            </Grid>
							 | 
						||
| 
								 | 
							
								        </GroupBox>
							 | 
						||
| 
								 | 
							
								    </Grid>
							 | 
						||
| 
								 | 
							
								</UserControl>
							 |