添加项目文件。

This commit is contained in:
2026-04-30 11:34:41 +08:00
parent a8539ccaac
commit 80635aa46e
181 changed files with 16378 additions and 0 deletions

View File

@@ -0,0 +1,119 @@
<UserControl
x:Class="SamplePre.UIWpf.ConfigManager.RoleView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:SamplePre.UIWpf.ConfigManager"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
d:DesignHeight="450"
d:DesignWidth="800"
Background="#e6e6e6"
mc:Ignorable="d">
<Border
Margin="5"
Background="White"
CornerRadius="5">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="40" />
<RowDefinition />
</Grid.RowDefinitions>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock
Margin="10,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="13"
Text="用户列表" />
<StackPanel
Grid.Column="1"
HorizontalAlignment="Right"
Orientation="Horizontal">
<Button
x:Name="btnAdd"
Width="100"
Height="30"
Margin="5,0"
Command="{Binding BtnAddClickCommand}"
Content="新增"
Style="{StaticResource IconTextButtonStyle}"
Tag="PackageVariantClosedPlus" />
<Button
x:Name="btnEdit"
Width="100"
Height="30"
Margin="5,0"
Command="{Binding BtnEditClickCommand}"
Content="编辑"
Style="{StaticResource IconTextButtonStyle}"
Tag="ContentSaveEditOutline" />
<Button
x:Name="btnDele"
Width="100"
Height="30"
Margin="5,0"
Command="{Binding BtnDeleClickCommand}"
Content="删除"
Style="{StaticResource IconTextButtonStyle}"
Tag="DeleteForeverOutline" />
<Button
x:Name="btnPermisson"
Width="100"
Height="30"
Margin="5,0"
Command="{Binding BtnPermissonClickCommand}"
Content="权限"
Style="{StaticResource IconTextButtonStyle}"
Tag="LayersEdit" />
</StackPanel>
</Grid>
<!-- 用户列表 -->
<DataGrid
x:Name="dg_roles"
Grid.Row="1"
Margin="5"
AutoGenerateColumns="False"
Background="White"
CanUserAddRows="False"
CanUserSortColumns="True"
FrozenColumnCount="1"
HorizontalScrollBarVisibility="Auto"
ItemsSource="{Binding RolesList}"
SelectedItem="{Binding ConfigRole}"
SelectionMode="Extended"
VerticalScrollBarVisibility="Auto">
<DataGrid.Columns>
<!--<DataGridTextColumn Header="动作" Binding="{Binding action_name}" Width="*"/>-->
<DataGridTextColumn
Width="*"
Binding="{Binding id}"
Header="ID"
IsReadOnly="True" />
<DataGridTextColumn
Width="*"
Binding="{Binding name}"
Header="角色名称"
IsReadOnly="True" />
<DataGridTextColumn
Width="*"
Binding="{Binding description}"
Header="描述"
IsReadOnly="True" />
</DataGrid.Columns>
</DataGrid>
</Grid>
</Border>
</UserControl>

View File

@@ -0,0 +1,71 @@
using SamplePre.Models.Tables;
using SamplePre.UIWpf.ConfigManager.chirld;
using SamplePreSystem.UI.ViewModel.ConfigManager;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace SamplePre.UIWpf.ConfigManager
{
/// <summary>
/// RoleView.xaml 的交互逻辑
/// </summary>
public partial class RoleView : UserControl
{
public RoleView()
{
InitializeComponent();
this.DataContext = new RoleViewModel();
}
//private void btnAdd_Click(object sender, RoutedEventArgs e)
//{
// var vm = this.DataContext as RoleViewModel;
// vm.ConfigRole = new config_role();
// NewRoleWindow frm = new NewRoleWindow(vm);
// if (frm.ShowDialog() == true)
// {
// vm.GetData();
// }
//}
//private void btnEdit_Click(object sender, RoutedEventArgs e)
//{
// var vm = this.DataContext as RoleViewModel;
// NewRoleWindow frm = new NewRoleWindow(vm);
// if (frm.ShowDialog() == true)
// {
// vm.GetData();
// }
//}
private void btnDele_Click(object sender, RoutedEventArgs e)
{
var vm = this.DataContext as RoleViewModel;
vm.DeleteRole();
}
private void btnPermisson_Click(object sender, RoutedEventArgs e)
{
var vm = this.DataContext as RoleViewModel;
if (string.IsNullOrEmpty(vm.ConfigRole.id)) return;
PermissionWindow frm = new PermissionWindow(vm);
frm.ShowDialog();
}
}
}

View File

@@ -0,0 +1,211 @@
<UserControl
x:Class="SamplePreSystem.UI.ConfigManager.SysConfigMangerView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
xmlns:local="clr-namespace:SamplePreSystem.UI.ConfigManager"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
d:DesignHeight="450"
d:DesignWidth="800"
Background="#E6E6E6"
mc:Ignorable="d">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="250" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<!-- 配置列表 -->
<Border
Grid.Column="0"
Margin="5"
Background="White"
CornerRadius="5">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="35" />
<RowDefinition />
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="80" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock
Margin="5,0,0,0"
VerticalAlignment="Center"
FontSize="14"
Text="配置列表:" />
<StackPanel
Grid.Column="1"
Margin="5,0"
HorizontalAlignment="Right"
Orientation="Horizontal">
<Button
x:Name="btnAdd"
Width="50"
Height="25"
Margin="5,0"
Command="{Binding AddClassClickCommand}"
Content="{materialDesign:PackIcon PlusCircleOutline}"
Style="{StaticResource MaterialDesignRaisedSecondaryButton}"
ToolTip="新增" />
<Button
x:Name="btnDel"
Width="50"
Height="25"
Margin="5,0"
Command="{Binding DelClassClickCommand}"
Content="{materialDesign:PackIcon DeleteCircleOutline}"
Style="{StaticResource MaterialDesignRaisedSecondaryButton}"
ToolTip="删除" />
</StackPanel>
</Grid>
<!-- 配置列表 -->
<TreeView
x:Name="tvData"
Grid.Row="1"
FontSize="13"
ItemsSource="{Binding DictClassList}">
<i:Interaction.Triggers>
<i:EventTrigger EventName="SelectedItemChanged">
<i:InvokeCommandAction Command="{Binding TvDataSelectedItemChangedCommand}" PassEventArgsToCommand="True" />
</i:EventTrigger>
</i:Interaction.Triggers>
<!-- 全局样式:所有节点默认展开 -->
<TreeView.ItemContainerStyle>
<Style BasedOn="{StaticResource MaterialDesignTreeViewItem}" TargetType="TreeViewItem">
<Setter Property="IsExpanded" Value="True" />
</Style>
</TreeView.ItemContainerStyle>
<TreeView.ItemTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding Children}">
<StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Margin="5,0" Kind="{Binding IconKind}" />
<!-- 复选框 + 文字 -->
<TextBlock Text="{Binding Name}" />
</StackPanel>
</HierarchicalDataTemplate>
</TreeView.ItemTemplate>
</TreeView>
</Grid>
</Border>
<Border
Grid.Column="1"
Margin="0,5,5,5"
Background="White"
CornerRadius="5">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="35" />
<RowDefinition />
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="80" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock
Margin="5,0,0,0"
VerticalAlignment="Center"
FontSize="14"
Text="配置内容:" />
<StackPanel
Grid.Column="1"
Margin="5,0"
HorizontalAlignment="Right"
Orientation="Horizontal">
<Button
x:Name="btnAddItem"
Width="50"
Height="25"
Margin="5,0"
Command="{Binding AddItemClickCommand}"
Content="{materialDesign:PackIcon PlusCircleOutline}"
Style="{StaticResource MaterialDesignRaisedSecondaryButton}"
ToolTip="新增" />
<Button
x:Name="btnDelItem"
Width="50"
Height="25"
Margin="5,0"
Command="{Binding DelItemClickCommand}"
Content="{materialDesign:PackIcon DeleteCircleOutline}"
Style="{StaticResource MaterialDesignRaisedSecondaryButton}"
ToolTip="删除" />
</StackPanel>
</Grid>
<DataGrid
x:Name="dg_list"
Grid.Row="1"
Margin="5"
AutoGenerateColumns="False"
Background="White"
CanUserAddRows="False"
CanUserSortColumns="True"
FrozenColumnCount="1"
HorizontalScrollBarVisibility="Auto"
ItemsSource="{Binding SysDicts}"
SelectedItem="{Binding SysDict}"
SelectionMode="Extended"
VerticalScrollBarVisibility="Auto">
<DataGrid.Columns>
<!--<DataGridTextColumn Header="动作" Binding="{Binding action_name}" Width="*"/>-->
<DataGridTextColumn
Width="*"
Binding="{Binding id}"
Header="ID"
IsReadOnly="True" />
<DataGridTextColumn
Width="*"
Binding="{Binding data_type}"
Header="项目名称"
IsReadOnly="True" />
<DataGridTextColumn
Width="*"
Binding="{Binding data_value}"
Header="值"
IsReadOnly="True" />
</DataGrid.Columns>
</DataGrid>
</Grid>
</Border>
</Grid>
</UserControl>

View File

@@ -0,0 +1,37 @@
using SamplePreSystem.UI.ConfigManager.chirld;
using SamplePreSystem.UI.ViewModel.ConfigManager;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using static MaterialDesignThemes.Wpf.Theme.ToolBar;
namespace SamplePreSystem.UI.ConfigManager
{
/// <summary>
/// SysConfigMangerView.xaml 的交互逻辑
/// </summary>
public partial class SysConfigMangerView : UserControl
{
public SysConfigMangerView()
{
InitializeComponent();
this.DataContext = new SysConfigMangerViewModel();
}
}
}

View File

@@ -0,0 +1,114 @@
<UserControl
x:Class="SamplePre.UIWpf.ConfigManager.UsersView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:SamplePre.UIWpf.ConfigManager"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
d:DesignHeight="450"
d:DesignWidth="800"
Background="#e6e6e6"
mc:Ignorable="d">
<Border
Margin="5"
Background="White"
CornerRadius="5">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="40" />
<RowDefinition />
</Grid.RowDefinitions>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock
Margin="10,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="13"
Text="用户列表" />
<StackPanel
Grid.Column="1"
HorizontalAlignment="Right"
Orientation="Horizontal">
<Button
x:Name="btnAdd"
Width="100"
Height="30"
Margin="5,0"
Command="{Binding BtnAddClickCommand}"
Content="新增"
Style="{StaticResource IconTextButtonStyle}"
Tag="PackageVariantClosedPlus" />
<Button
x:Name="btnEdit"
Width="100"
Height="30"
Margin="5,0"
Command="{Binding BtnEditClickCommand}"
Content="编辑"
Style="{StaticResource IconTextButtonStyle}"
Tag="ContentSaveEditOutline" />
<Button
x:Name="btnDele"
Width="100"
Height="30"
Margin="5,0"
Command="{Binding BtnDeleClickCommand}"
Content="删除"
Style="{StaticResource IconTextButtonStyle}"
Tag="DeleteForeverOutline" />
</StackPanel>
</Grid>
<!-- 用户列表 -->
<DataGrid
x:Name="dg_users"
Grid.Row="1"
Margin="5"
AutoGenerateColumns="False"
Background="White"
CanUserAddRows="False"
CanUserSortColumns="True"
FrozenColumnCount="1"
HorizontalScrollBarVisibility="Auto"
ItemsSource="{Binding UserList}"
SelectedItem="{Binding SelectUser}"
SelectionMode="Extended"
VerticalScrollBarVisibility="Auto">
<DataGrid.Columns>
<!--<DataGridTextColumn Header="动作" Binding="{Binding action_name}" Width="*"/>-->
<DataGridTextColumn
Width="*"
Binding="{Binding id}"
Header="ID"
IsReadOnly="True" />
<DataGridTextColumn
Width="*"
Binding="{Binding username}"
Header="用户名称"
IsReadOnly="True" />
<DataGridTextColumn
Width="*"
Binding="{Binding all_role_names}"
Header="角色"
IsReadOnly="True" />
<DataGridTextColumn
Width="*"
Binding="{Binding is_enabled}"
Header="是否启用"
IsReadOnly="True" />
</DataGrid.Columns>
</DataGrid>
</Grid>
</Border>
</UserControl>

View File

@@ -0,0 +1,37 @@
using SamplePre.UIWpf.ConfigManager.chirld;
using SamplePreSystem.UI.ViewModel.ConfigManager;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace SamplePre.UIWpf.ConfigManager
{
/// <summary>
/// UsersView.xaml 的交互逻辑
/// </summary>
public partial class UsersView : UserControl
{
public UsersView()
{
InitializeComponent();
var vm = new UsersViewModel();
this.DataContext = vm ;
}
}
}

View File

@@ -0,0 +1,82 @@
<basewindows:BaseWindow
x:Class="SamplePreSystem.UI.ConfigManager.chirld.NewDictClassWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:basewindows="clr-namespace:SamplePre.UIWpf.BaseWindows"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Title="新增分类"
Width="400"
Height="200"
ResizeMode="NoResize"
WindowStartupLocation="CenterScreen"
mc:Ignorable="d">
<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="50" />
</Grid.RowDefinitions>
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock
Grid.Row="0"
VerticalAlignment="Center"
Text="名称:" />
<TextBox
Grid.Row="0"
Grid.Column="1"
Width="250"
Height="30"
HorizontalAlignment="Left"
Text="{Binding DictClass.dict_type}" />
<TextBlock
Grid.Row="1"
VerticalAlignment="Center"
Text="描述:" />
<TextBox
Grid.Row="1"
Grid.Column="1"
Width="250"
Height="30"
HorizontalAlignment="Left"
Text="{Binding DictClass.remark}" />
</Grid>
<StackPanel
Grid.Row="1"
Margin="0,10,0,0"
HorizontalAlignment="Center"
Orientation="Horizontal">
<Button
x:Name="btnOK"
Width="80"
Margin="5"
Click="btnOK_Click"
Content="确定" />
<Button
x:Name="btnCancel"
Width="80"
Margin="5"
Click="btnCancel_Click"
Content="取消" />
</StackPanel>
</Grid>
</basewindows:BaseWindow>

View File

@@ -0,0 +1,46 @@
using SamplePre.UIWpf.BaseWindows;
using SamplePreSystem.UI.BaseControls;
using SamplePreSystem.UI.ViewModel.ConfigManager;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace SamplePreSystem.UI.ConfigManager.chirld
{
/// <summary>
/// NewDictClassWindow.xaml 的交互逻辑
/// </summary>
public partial class NewDictClassWindow : BaseWindow
{
public NewDictClassWindow(SysConfigMangerViewModel vm)
{
InitializeComponent();
this.DataContext = vm;
}
private void btnOK_Click(object sender, RoutedEventArgs e)
{
var vm = this.DataContext as SysConfigMangerViewModel;
if(vm.NewAddDict())
{
this.DialogResult = true;
}
}
private void btnCancel_Click(object sender, RoutedEventArgs e)
{
this.DialogResult = false;
}
}
}

View File

@@ -0,0 +1,102 @@
<basewindows:BaseWindow
x:Class="SamplePreSystem.UI.ConfigManager.chirld.NewDictDetailWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:basewindows="clr-namespace:SamplePre.UIWpf.BaseWindows"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Title="新增配置项"
Width="400"
Height="250"
FontSize="13"
ResizeMode="NoResize"
WindowStartupLocation="CenterScreen"
mc:Ignorable="d">
<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="50" />
</Grid.RowDefinitions>
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="80" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock
Grid.Row="0"
VerticalAlignment="Center"
Text="名称:" />
<TextBox
Grid.Row="0"
Grid.Column="1"
Width="250"
Height="30"
HorizontalAlignment="Left"
Text="{Binding SysDict.data_type}" />
<TextBlock
Grid.Row="1"
VerticalAlignment="Center"
Text="数值:" />
<TextBox
Grid.Row="1"
Grid.Column="1"
Width="250"
Height="30"
HorizontalAlignment="Left"
Text="{Binding SysDict.data_value}" />
<TextBlock
Grid.Row="2"
VerticalAlignment="Center"
Text="说明:" />
<TextBox
Grid.Row="2"
Grid.Column="1"
Width="250"
Height="30"
HorizontalAlignment="Left"
Text="{Binding SysDict.remark}" />
</Grid>
<StackPanel
Grid.Row="1"
Margin="0,10,0,0"
HorizontalAlignment="Center"
Orientation="Horizontal">
<Button
x:Name="btnOK"
Width="80"
Margin="5"
Click="btnOK_Click"
Content="确定" />
<Button
x:Name="btnCancel"
Width="80"
Margin="5"
Click="btnCancel_Click"
Content="取消" />
</StackPanel>
</Grid>
</basewindows:BaseWindow>

View File

@@ -0,0 +1,46 @@
using SamplePre.UIWpf.BaseWindows;
using SamplePreSystem.UI.BaseControls;
using SamplePreSystem.UI.ViewModel.ConfigManager;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace SamplePreSystem.UI.ConfigManager.chirld
{
/// <summary>
/// NewDictDetailWindow.xaml 的交互逻辑
/// </summary>
public partial class NewDictDetailWindow : BaseWindow
{
public NewDictDetailWindow(SysConfigMangerViewModel vm)
{
InitializeComponent();
this.DataContext = vm;
}
private void btnOK_Click(object sender, RoutedEventArgs e)
{
var vm = this.DataContext as SysConfigMangerViewModel;
if(vm.NewAddDictDetail())
{
this.DialogResult = true;
}
}
private void btnCancel_Click(object sender, RoutedEventArgs e)
{
this.DialogResult = false;
}
}
}

View File

@@ -0,0 +1,84 @@
<basewindows:BaseWindow
x:Class="SamplePre.UIWpf.ConfigManager.chirld.NewRoleWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:basewindows="clr-namespace:SamplePre.UIWpf.BaseWindows"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Title="角色编辑"
Width="400"
Height="200"
ResizeMode="NoResize"
WindowStartupLocation="CenterScreen"
mc:Ignorable="d">
<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="50" />
</Grid.RowDefinitions>
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock
Grid.Row="0"
VerticalAlignment="Center"
Text="角色名称:" />
<TextBox
Grid.Row="0"
Grid.Column="1"
Width="250"
Height="30"
HorizontalAlignment="Left"
Text="{Binding ConfigRole.name}" />
<TextBlock
Grid.Row="1"
VerticalAlignment="Center"
Text="描述:" />
<TextBox
Grid.Row="1"
Grid.Column="1"
Width="250"
Height="30"
HorizontalAlignment="Left"
Text="{Binding ConfigRole.description}" />
</Grid>
<StackPanel
Grid.Row="1"
Margin="0,10,0,0"
HorizontalAlignment="Center"
Orientation="Horizontal">
<Button
x:Name="btnOK"
Width="80"
Margin="5"
Click="btnOK_Click"
Content="确定" />
<Button
x:Name="btnCancel"
Width="80"
Margin="5"
Click="btnCancel_Click"
Content="取消" />
</StackPanel>
</Grid>
</basewindows:BaseWindow>

View File

@@ -0,0 +1,46 @@
using SamplePre.UIWpf.BaseWindows;
using SamplePreSystem.UI.BaseControls;
using SamplePreSystem.UI.ViewModel.ConfigManager;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace SamplePre.UIWpf.ConfigManager.chirld
{
/// <summary>
/// NewRoleWindow.xaml 的交互逻辑
/// </summary>
public partial class NewRoleWindow : BaseWindow
{
public NewRoleWindow(RoleViewModel vm)
{
InitializeComponent();
this.DataContext = vm;
}
private void btnCancel_Click(object sender, RoutedEventArgs e)
{
this.DialogResult = false;
}
private void btnOK_Click(object sender, RoutedEventArgs e)
{
var vm = this.DataContext as RoleViewModel;
if(vm.SaveRole())
{
this.DialogResult = true;
}
}
}
}

View File

@@ -0,0 +1,146 @@
<basewindows:BaseWindow
x:Class="SamplePre.UIWpf.ConfigManager.chirld.NewUserWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:basewindows="clr-namespace:SamplePre.UIWpf.BaseWindows"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Title="用户编辑"
Width="400"
Height="300"
ResizeMode="NoResize"
WindowStartupLocation="CenterScreen"
mc:Ignorable="d">
<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="50" />
</Grid.RowDefinitions>
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock
Grid.Row="0"
VerticalAlignment="Center"
Text="用户名称:" />
<TextBox
Grid.Row="0"
Grid.Column="1"
Width="250"
Height="30"
HorizontalAlignment="Left"
Text="{Binding ConfigUser.username}" />
<TextBlock
Grid.Row="1"
VerticalAlignment="Center"
Text="密码:" />
<TextBox
Grid.Row="1"
Grid.Column="1"
Width="250"
Height="30"
HorizontalAlignment="Left"
Text="{Binding ConfigUser.password}" />
<TextBlock
Grid.Row="2"
VerticalAlignment="Center"
Text="角色:" />
<!-- 多选下拉框,选择后在上方显示选中内容 -->
<StackPanel
Grid.Row="2"
Grid.Column="1"
Width="250"
Height="30"
HorizontalAlignment="Left"
Orientation="Vertical">
<!-- 显示已选中的内容 -->
<TextBox
x:Name="txtSelectedRoles"
Width="250"
Height="30"
materialDesign:HintAssist.Hint="已选角色"
FontSize="13"
IsReadOnly="True" />
<!-- 多选下拉框 -->
<ComboBox
x:Name="cmbRole"
Width="250"
Height="30"
Margin="0,-30,0,0"
ItemsSource="{Binding Roles}">
<!-- 覆盖上去,视觉一体 -->
<ComboBox.ItemTemplate>
<DataTemplate>
<CheckBox
x:Name="ckbRole"
Margin="4,2"
Click="ckbRole_Click"
Content="{Binding name}"
IsChecked="{Binding IsSelected, Mode=TwoWay}" />
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
</StackPanel>
<TextBlock
Grid.Row="3"
VerticalAlignment="Center"
Text="是否启用:" />
<ComboBox
x:Name="cmbParamType"
Grid.Row="3"
Grid.Column="1"
Width="250"
Height="30"
HorizontalAlignment="Left"
Text="{Binding IsEnable}">
<ComboBoxItem Content="启用" />
<ComboBoxItem Content="禁用" />
</ComboBox>
</Grid>
<StackPanel
Grid.Row="1"
Margin="0,10,0,0"
HorizontalAlignment="Center"
Orientation="Horizontal">
<Button
x:Name="btnOK"
Width="80"
Margin="5"
Command="{Binding BtnSaveUserClickCommand}"
Content="确定" />
<Button
x:Name="btnCancel"
Width="80"
Margin="5"
Click="btnCancel_Click"
Content="取消" />
</StackPanel>
</Grid>
</basewindows:BaseWindow>

View File

@@ -0,0 +1,56 @@
using SamplePre.UIWpf.BaseWindows;
using SamplePreSystem.UI.BaseControls;
using SamplePreSystem.UI.ViewModel.ConfigManager;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace SamplePre.UIWpf.ConfigManager.chirld
{
/// <summary>
/// NewUserWindow.xaml 的交互逻辑
/// </summary>
public partial class NewUserWindow : BaseWindow
{
public NewUserWindow(UsersViewModel vm)
{
InitializeComponent();
vm.CloseAction = (val) => DialogResult = val;
this.DataContext = vm;
}
private void ckbRole_Click(object sender, RoutedEventArgs e)
{
e.Handled = true;
UpdateSelectedText();
}
// 把选中的项显示在文本框中
private void UpdateSelectedText()
{
var selected = cmbRole.ItemsSource.Cast<dynamic>()
.Where(x => x.IsSelected == true)
.Select(x => x.name);
txtSelectedRoles.Text = string.Join("", selected);
}
private void btnCancel_Click(object sender, RoutedEventArgs e)
{
UpdateSelectedText();
}
}
}

View File

@@ -0,0 +1,76 @@
<basewindows:BaseWindow
x:Class="SamplePre.UIWpf.ConfigManager.chirld.PermissionWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:basewindows="clr-namespace:SamplePre.UIWpf.BaseWindows"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Title="分配权限"
Width="600"
Height="650"
Background="#F6F6F6"
ResizeMode="NoResize"
WindowStartupLocation="CenterScreen"
mc:Ignorable="d">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="60" />
<RowDefinition />
</Grid.RowDefinitions>
<Border
Margin="5"
Background="White"
BorderBrush="LightGray"
CornerRadius="4">
<StackPanel Orientation="Horizontal">
<TextBlock
Margin="5,0,0,0"
VerticalAlignment="Center"
Text="角色:" />
<TextBlock VerticalAlignment="Center" Text="{Binding RoleName}" />
<Button
x:Name="btnSave"
Width="100"
Height="30"
Margin="20,0"
Click="btnSave_Click"
Content="保存权限" />
</StackPanel>
</Border>
<!-- 用户列表 -->
<Border
Grid.Row="1"
Margin="5,0,5,5"
Background="White"
BorderBrush="LightGray"
CornerRadius="4">
<TreeView
x:Name="tvData"
Grid.Row="2"
Grid.Column="1"
ItemsSource="{Binding FunList}">
<TreeView.ItemTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding Children}">
<!-- 复选框 + 文字 -->
<CheckBox Content="{Binding Name}" IsChecked="{Binding IsChecked}" />
</HierarchicalDataTemplate>
</TreeView.ItemTemplate>
</TreeView>
</Border>
</Grid>
</basewindows:BaseWindow>

View File

@@ -0,0 +1,61 @@
using SamplePre.UIWpf.BaseWindows;
using SamplePreSystem.UI.BaseControls;
using SamplePreSystem.UI.ViewModel.ConfigManager;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace SamplePre.UIWpf.ConfigManager.chirld
{
/// <summary>
/// PermissionWindow.xaml 的交互逻辑
/// </summary>
public partial class PermissionWindow : BaseWindow
{
public PermissionWindow(RoleViewModel vm)
{
InitializeComponent();
this.DataContext = new PermissionViewModel(vm);
}
// 递归设置子节点
private void SetChildrenChecked(TreeItemModel item, bool isChecked)
{
foreach (var child in item.Children)
{
child.IsChecked = isChecked;
SetChildrenChecked(child, isChecked);
}
}
/// <summary>
/// 保存权限
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnSave_Click(object sender, RoutedEventArgs e)
{
var vm = this.DataContext as PermissionViewModel;
if(vm.SavePermission())
{
this.DialogResult = true;
}
}
}
}