@@ -84,6 +84,7 @@ namespace BPASmartClient.Business | |||
IConfigurationBuilder configurationBuilder = new ConfigurationBuilder().SetBasePath(Directory.GetCurrentDirectory()); | |||
configurationBuilder.AddApolloConfiguration(p => | |||
{ | |||
p.AppId = apoid; | |||
p.MetaServer = apolloUri; | |||
p.Namespaces = new List<string>() { "application", namespa }; | |||
@@ -112,6 +112,10 @@ | |||
<None Remove="Image\工艺流程.jpg" /> | |||
<None Remove="Image\工艺流程.png" /> | |||
<None Remove="Image\底部背景.png" /> | |||
<None Remove="Image\按钮\AddGreen.png" /> | |||
<None Remove="Image\按钮\Delete.png" /> | |||
<None Remove="Image\按钮\停用.png" /> | |||
<None Remove="Image\按钮\添加.png" /> | |||
<None Remove="Image\搜索按钮.png" /> | |||
<None Remove="Image\搜索框.png" /> | |||
<None Remove="Image\文字.png" /> | |||
@@ -120,6 +124,7 @@ | |||
<None Remove="Image\智慧城市科技风登录页面.png" /> | |||
<None Remove="Image\智慧城市科技风登录页面边框.png" /> | |||
<None Remove="Image\有告警.png" /> | |||
<None Remove="Image\权限背景.png" /> | |||
<None Remove="Image\标题背景.png" /> | |||
<None Remove="Image\浅色背景.jpeg" /> | |||
<None Remove="Image\环形切图\内圈\未选中.png" /> | |||
@@ -266,8 +271,13 @@ | |||
<Resource Include="Image\告警\轻微告警.png" /> | |||
<Resource Include="Image\工艺流程.jpg" /> | |||
<Resource Include="Image\工艺流程.png" /> | |||
<Resource Include="Image\按钮\AddGreen.png" /> | |||
<Resource Include="Image\按钮\Delete.png" /> | |||
<Resource Include="Image\按钮\停用.png" /> | |||
<Resource Include="Image\按钮\添加.png" /> | |||
<Resource Include="Image\智慧城市科技风登录页面.png" /> | |||
<Resource Include="Image\智慧城市科技风登录页面边框.png" /> | |||
<Resource Include="Image\权限背景.png" /> | |||
<Resource Include="Image\浅色背景.jpeg" /> | |||
<Resource Include="Image\界面2.png"> | |||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | |||
@@ -39,9 +39,6 @@ namespace BPASmartClient.CustomResource.Pages.Model | |||
private void AddData() | |||
{ | |||
Global.userManager.userInfos.Add(new UserInfo() { permission = Permission.管理员, UserName = "admin", Password = "admin" }); | |||
Global.userManager.userInfos.Add(new UserInfo() { permission = Permission.操作员, UserName = "czy", Password = "123456" }); | |||
Global.userManager.userInfos.Add(new UserInfo() { permission = Permission.观察员, UserName = "gcy", Password = "654321" }); | |||
Global.userManager.userInfos.Add(new UserInfo() { permission = Permission.技术员, UserName = "jsy", Password = "88888888" }); | |||
SaveUser(); | |||
} | |||
@@ -12,6 +12,10 @@ namespace BPASmartClient.CustomResource.Pages.Model | |||
public static UserManager userManager { get; set; } = new UserManager(); | |||
public static UserInfo userInfo { get; set; } = new UserInfo(); | |||
/// <summary> | |||
/// 重置密码页面传值 | |||
/// </summary> | |||
public static UserInfo changeUserInfo { get; set; } = null; | |||
} | |||
} |
@@ -91,7 +91,7 @@ namespace BPASmartClient.CustomResource.Pages.Model | |||
/// 子菜单的显示隐藏设置 | |||
/// </summary> | |||
public Visibility SubMenuVisibility { get { return _mSubMenuVisibility; } set { _mSubMenuVisibility = value; OnPropertyChanged(); } } | |||
private Visibility _mSubMenuVisibility; | |||
private Visibility _mSubMenuVisibility = Visibility.Collapsed; | |||
} | |||
@@ -12,6 +12,8 @@ namespace BPASmartClient.CustomResource.Pages.Model | |||
public Permission permission { get; set; } | |||
public string UserName { get; set; } | |||
public string Password { get; set; } | |||
public String LastLogInTime { get; set; } = "无"; | |||
public List<UserTreeViewModel> userTreeViewModels { get; set; } | |||
} | |||
} |
@@ -10,5 +10,6 @@ namespace BPASmartClient.CustomResource.Pages.Model | |||
public class UserManager | |||
{ | |||
public ObservableCollection<UserInfo> userInfos { get; set; } = new ObservableCollection<UserInfo>(); | |||
} | |||
} |
@@ -0,0 +1,16 @@ | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.CustomResource.Pages.Model | |||
{ | |||
public class UserTreeViewModel: ObservableObject | |||
{ | |||
public string Name { get; set; } | |||
public List<UserTreeViewModel> TreeViewItems { get; set; } | |||
} | |||
} |
@@ -0,0 +1,330 @@ | |||
<Window x:Class="BPASmartClient.CustomResource.Pages.View.AddNewUser" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:common="clr-namespace:BPASmartClient.CustomResource.Pages.Model" | |||
xmlns:vm="clr-namespace:BPASmartClient.CustomResource.Pages.ViewModel" | |||
Title="AddNewUser" | |||
Width="400" | |||
Height="350" | |||
AllowsTransparency="True" | |||
Background="{x:Null}" | |||
Topmost="True" | |||
WindowStartupLocation="CenterScreen" | |||
WindowStyle="None" | |||
mc:Ignorable="d"> | |||
<Window.DataContext> | |||
<vm:AddNewUserViewModel/> | |||
</Window.DataContext> | |||
<Window.Resources> | |||
<Style x:Key="TxLogin" TargetType="TextBlock"> | |||
<Setter Property="FontSize" Value="20" /> | |||
<Setter Property="Foreground" Value="#ddd" /> | |||
<Setter Property="HorizontalAlignment" Value="Center" /> | |||
<Setter Property="VerticalAlignment" Value="Center" /> | |||
</Style> | |||
<!--#region 密码输入框样式--> | |||
<Style x:Key="PasswordBoxStyle" TargetType="{x:Type PasswordBox}"> | |||
<Setter Property="Background" Value="Transparent" /> | |||
<Setter Property="FontFamily" Value="Times New Roman" /> | |||
<Setter Property="PasswordChar" Value="●" /> | |||
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" /> | |||
<Setter Property="KeyboardNavigation.TabNavigation" Value="None" /> | |||
<Setter Property="HorizontalContentAlignment" Value="Left" /> | |||
<Setter Property="Padding" Value="1" /> | |||
<Setter Property="FocusVisualStyle" Value="{x:Null}" /> | |||
<Setter Property="AllowDrop" Value="true" /> | |||
<Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst" /> | |||
<Setter Property="Stylus.IsFlicksEnabled" Value="False" /> | |||
<Setter Property="CaretBrush" Value="#009DFF" /> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type PasswordBox}"> | |||
<Border | |||
x:Name="Bd" | |||
Background="{TemplateBinding Background}" | |||
BorderBrush="{TemplateBinding BorderBrush}" | |||
BorderThickness="{TemplateBinding BorderThickness}" | |||
CornerRadius="5" | |||
SnapsToDevicePixels="true"> | |||
<Grid> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="40" /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
x:Name="UserTextBlock" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontFamily="../../Fonts/#iconfont" | |||
FontSize="20" | |||
Foreground="{TemplateBinding BorderBrush}" | |||
Text="" /> | |||
<!--<TextBlock | |||
Name="markText" | |||
Grid.Column="1" | |||
Margin="10,0" | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Center" | |||
FontSize="20" | |||
Foreground="#88009dff" | |||
Text="请输入账号密码" | |||
Visibility="Collapsed" />--> | |||
<ScrollViewer | |||
x:Name="PART_ContentHost" | |||
Grid.Column="1" | |||
MinHeight="20" | |||
VerticalAlignment="Center" | |||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" /> | |||
</Grid> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsEnabled" Value="false"> | |||
<Setter TargetName="Bd" Property="Opacity" Value="0.56" /> | |||
<Setter TargetName="UserTextBlock" Property="Opacity" Value="0.56" /> | |||
</Trigger> | |||
<Trigger Property="IsMouseOver" Value="true"> | |||
<Setter TargetName="Bd" Property="BorderBrush" Value="#FF7EB4EA" /> | |||
<Setter TargetName="UserTextBlock" Property="Foreground" Value="#FF7EB4EA" /> | |||
</Trigger> | |||
<Trigger Property="IsKeyboardFocused" Value="true"> | |||
<Setter TargetName="Bd" Property="BorderBrush" Value="#FF569DE5" /> | |||
<Setter TargetName="UserTextBlock" Property="Foreground" Value="#FF569DE5" /> | |||
</Trigger> | |||
<!--<DataTrigger Binding="{Binding Path=Password, RelativeSource={RelativeSource Mode=self}}" Value=""> | |||
<Setter TargetName="markText" Property="Visibility" Value="Visible" /> | |||
</DataTrigger>--> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
<Style.Triggers> | |||
<MultiTrigger> | |||
<MultiTrigger.Conditions> | |||
<Condition Property="IsInactiveSelectionHighlightEnabled" Value="true" /> | |||
<Condition Property="IsSelectionActive" Value="false" /> | |||
</MultiTrigger.Conditions> | |||
<Setter Property="SelectionBrush" Value="{DynamicResource {x:Static SystemColors.InactiveSelectionHighlightBrushKey}}" /> | |||
</MultiTrigger> | |||
</Style.Triggers> | |||
</Style> | |||
<!--#endregion--> | |||
<!--#region 用户输入框样式--> | |||
<Style x:Key="UserTextBoxStyle" TargetType="TextBox"> | |||
<Setter Property="Background" Value="Transparent" /> | |||
<Setter Property="CaretBrush" Value="#009DFF" /> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="TextBox"> | |||
<Border | |||
x:Name="border" | |||
Background="{TemplateBinding Background}" | |||
BorderBrush="{TemplateBinding BorderBrush}" | |||
BorderThickness="{TemplateBinding BorderThickness}" | |||
CornerRadius="5" | |||
SnapsToDevicePixels="true"> | |||
<Grid> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="40" /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
x:Name="PasswordTextBlock" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontFamily="../../Fonts/#iconfont" | |||
FontSize="20" | |||
Foreground="{TemplateBinding BorderBrush}" | |||
Text="" /> | |||
<TextBlock | |||
Name="markText" | |||
Grid.Column="1" | |||
Margin="10,0" | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Center" | |||
FontSize="20" | |||
Foreground="#88009dff" | |||
Text="请输入账号名称" | |||
Visibility="Collapsed" /> | |||
<ScrollViewer | |||
x:Name="PART_ContentHost" | |||
Grid.Column="1" | |||
MinHeight="20" | |||
VerticalAlignment="Center" | |||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" /> | |||
</Grid> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsEnabled" Value="false"> | |||
<Setter TargetName="border" Property="Opacity" Value="0.56" /> | |||
</Trigger> | |||
<Trigger Property="IsMouseOver" Value="true"> | |||
<Setter TargetName="border" Property="BorderBrush" Value="#FF7EB4EA" /> | |||
</Trigger> | |||
<Trigger Property="IsKeyboardFocused" Value="true"> | |||
<Setter TargetName="border" Property="BorderBrush" Value="#FF569DE5" /> | |||
</Trigger> | |||
<DataTrigger Binding="{Binding Path=Text, RelativeSource={RelativeSource Mode=self}}" Value=""> | |||
<Setter TargetName="markText" Property="Visibility" Value="Visible" /> | |||
</DataTrigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<!--#endregion--> | |||
</Window.Resources> | |||
<Border | |||
x:Name="br" | |||
BorderBrush="#009dff" | |||
BorderThickness="2"> | |||
<Border.Effect> | |||
<DropShadowEffect | |||
BlurRadius="10" | |||
ShadowDepth="1" | |||
Color="#009DFF" /> | |||
</Border.Effect> | |||
<Grid> | |||
<Image Source="../../Image/登录界面背景.jpg" Stretch="Fill" /> | |||
<Image Source="../../Image/阴影边框.png" Stretch="Fill" /> | |||
<Grid Background="Transparent"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<TextBlock | |||
Margin="0,10,0,0" | |||
HorizontalAlignment="Center" | |||
FontSize="20" | |||
Foreground="#ddd" | |||
Text="注册新用户" /> | |||
<TextBlock | |||
Margin="20,10,0,0" | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Bottom" | |||
FontSize="16" | |||
Foreground="#FFEF2020" | |||
Text="{Binding ErrorInfo}" /> | |||
<Grid Grid.Row="1"> | |||
<TextBox | |||
Text="{Binding UserName, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" | |||
Name="oldpb" | |||
Height="40" | |||
Margin="20,0" | |||
BorderBrush="#009DFF" | |||
FontSize="16" | |||
Foreground="#aadddddd" | |||
Style="{DynamicResource UserTextBoxStyle}" | |||
TabIndex="2" /> | |||
</Grid> | |||
<Grid Grid.Row="2"> | |||
<PasswordBox | |||
Name="newpb1" | |||
Height="40" | |||
Margin="20,0" | |||
common:PasswordHelper.Attach="True" | |||
common:PasswordHelper.Password="{Binding NewPassword1, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" | |||
BorderBrush="#009DFF" | |||
FontSize="16" | |||
Foreground="#aadddddd" | |||
PasswordChanged="newpb1_PasswordChanged" | |||
Style="{DynamicResource PasswordBoxStyle}" | |||
TabIndex="2" /> | |||
<TextBlock | |||
Name="newmarkText1" | |||
Margin="70,0" | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Center" | |||
FontSize="20" | |||
Foreground="#88009dff" | |||
IsHitTestVisible="False" | |||
Text="请输入新密码" | |||
Visibility="Visible" /> | |||
</Grid> | |||
<Grid Grid.Row="3"> | |||
<PasswordBox | |||
Name="newpb2" | |||
Height="40" | |||
Margin="20,0" | |||
common:PasswordHelper.Attach="True" | |||
common:PasswordHelper.Password="{Binding NewPassword2, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" | |||
BorderBrush="#009DFF" | |||
FontSize="16" | |||
Foreground="#aadddddd" | |||
PasswordChanged="newpb2_PasswordChanged" | |||
Style="{DynamicResource PasswordBoxStyle}" | |||
TabIndex="2" /> | |||
<TextBlock | |||
Name="newmarkText2" | |||
Margin="70,0" | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Center" | |||
FontSize="20" | |||
Foreground="#88009dff" | |||
IsHitTestVisible="False" | |||
Text="请再次输入新密码" | |||
Visibility="Visible" /> | |||
</Grid> | |||
<Grid Grid.Row="4"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<Button | |||
Margin="20,10" | |||
Background="#009DFF" | |||
BorderThickness="0" | |||
Command="{Binding ExitCommand}" | |||
Content="取 消" | |||
FontSize="20" | |||
Foreground="White" /> | |||
<Button | |||
Grid.Column="1" | |||
Margin="20,10" | |||
Background="#009DFF" | |||
BorderThickness="0" | |||
Command="{Binding ConfirmCommand}" | |||
Content="确 认" | |||
FontSize="20" | |||
Foreground="White" | |||
TabIndex="3" /> | |||
</Grid> | |||
</Grid> | |||
</Grid> | |||
</Border> | |||
</Window> |
@@ -0,0 +1,60 @@ | |||
using BPASmartClient.Helper; | |||
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 BPASmartClient.CustomResource.Pages.View | |||
{ | |||
/// <summary> | |||
/// AddNewUser.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class AddNewUser : Window | |||
{ | |||
public AddNewUser() | |||
{ | |||
InitializeComponent(); | |||
this.br.MouseLeftButtonDown += (o, e) => | |||
{ | |||
if (e.LeftButton == MouseButtonState.Pressed) this.DragMove(); | |||
}; | |||
ActionManage.GetInstance.CancelRegister("AddNewUserViewConfirm"); | |||
ActionManage.GetInstance.CancelRegister("AddNewUserViewCancel"); | |||
ActionManage.GetInstance.Register(new Action(() => { this.DialogResult = true; this.Close(); }), "AddNewUserViewConfirm"); | |||
ActionManage.GetInstance.Register(new Action(() => { this.DialogResult = false; this.Close(); }), "AddNewUserViewCancel"); | |||
} | |||
private void newpb2_PasswordChanged(object sender, RoutedEventArgs e) | |||
{ | |||
if (this.newpb2.Password.Length > 0) | |||
{ | |||
this.newmarkText2.Visibility = Visibility.Collapsed; | |||
} | |||
else | |||
{ | |||
this.newmarkText2.Visibility = Visibility.Visible; | |||
} | |||
} | |||
private void newpb1_PasswordChanged(object sender, RoutedEventArgs e) | |||
{ | |||
if (this.newpb1.Password.Length > 0) | |||
{ | |||
this.newmarkText1.Visibility = Visibility.Collapsed; | |||
} | |||
else | |||
{ | |||
this.newmarkText1.Visibility = Visibility.Visible; | |||
} | |||
} | |||
} | |||
} |
@@ -0,0 +1,14 @@ | |||
<UserControl x:Class="BPASmartClient.CustomResource.Pages.View.PermissionConfigurationView" | |||
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:BPASmartClient.CustomResource.Pages.View" | |||
Width="800" | |||
Height="450" | |||
mc:Ignorable="d"> | |||
<Grid> | |||
</Grid> | |||
</UserControl> |
@@ -0,0 +1,28 @@ | |||
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 BPASmartClient.CustomResource.Pages.View | |||
{ | |||
/// <summary> | |||
/// PermissionConfigurationView.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class PermissionConfigurationView : UserControl | |||
{ | |||
public PermissionConfigurationView() | |||
{ | |||
InitializeComponent(); | |||
} | |||
} | |||
} |
@@ -0,0 +1,406 @@ | |||
<Window x:Class="BPASmartClient.CustomResource.Pages.View.UserConfigView" | |||
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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:local="clr-namespace:BPASmartClient.CustomResource.Pages.View" | |||
xmlns:vm="clr-namespace:BPASmartClient.CustomResource.Pages.ViewModel" | |||
Title="UserConfigView" Width="800" | |||
Height="1000" | |||
AllowsTransparency="True" | |||
Background="{x:Null}" | |||
Topmost="True" | |||
WindowStartupLocation="CenterScreen" | |||
WindowStyle="None" | |||
mc:Ignorable="d"> | |||
<Window.DataContext> | |||
<vm:UserConfigViewModel/> | |||
</Window.DataContext> | |||
<Window.Resources> | |||
<ImageBrush x:Key="ImageBrushAddBlue" ImageSource="../../Image/按钮/AddGreen.png"></ImageBrush> | |||
<ImageBrush x:Key="ImageBrushAddGray" ImageSource="../../Image/按钮/Delete.png"></ImageBrush> | |||
<Style x:Key="ScrollBarPageButton" TargetType="{x:Type RepeatButton}"> | |||
<Setter Property="SnapsToDevicePixels" Value="True" /> | |||
<Setter Property="OverridesDefaultStyle" Value="true" /> | |||
<Setter Property="IsTabStop" Value="false" /> | |||
<Setter Property="Focusable" Value="false" /> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type RepeatButton}"> | |||
<Border Background="Transparent" /> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<Style x:Key="ScrollBarThumb" TargetType="{x:Type Thumb}"> | |||
<Setter Property="SnapsToDevicePixels" Value="True" /> | |||
<Setter Property="OverridesDefaultStyle" Value="true" /> | |||
<Setter Property="IsTabStop" Value="false" /> | |||
<Setter Property="Focusable" Value="false" /> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type Thumb}"> | |||
<Border CornerRadius="2" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1" /> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<ControlTemplate x:Key="VerticalScrollBar" TargetType="{x:Type ScrollBar}"> | |||
<Grid> | |||
<Border CornerRadius="2" Width="0.5" Background="#FF046BFF" /> | |||
<Track x:Name="PART_Track" IsDirectionReversed="true"> | |||
<Track.DecreaseRepeatButton> | |||
<RepeatButton Style="{StaticResource ScrollBarPageButton}" Command="ScrollBar.PageUpCommand" /> | |||
</Track.DecreaseRepeatButton> | |||
<Track.Thumb> | |||
<Thumb Style="{StaticResource ScrollBarThumb}" Margin="4,0,4,0" Background="DodgerBlue"></Thumb> | |||
</Track.Thumb> | |||
<Track.IncreaseRepeatButton> | |||
<RepeatButton Style="{StaticResource ScrollBarPageButton}" Command="ScrollBar.PageDownCommand" /> | |||
</Track.IncreaseRepeatButton> | |||
</Track> | |||
</Grid> | |||
</ControlTemplate> | |||
<ControlTemplate x:Key="ScrollViewerControlTemplate1" TargetType="{x:Type ScrollViewer}"> | |||
<Grid x:Name="Grid" Background="{TemplateBinding Background}"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="*"/> | |||
<ColumnDefinition Width="Auto"/> | |||
</Grid.ColumnDefinitions> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="*"/> | |||
<RowDefinition Height="Auto"/> | |||
</Grid.RowDefinitions> | |||
<Rectangle x:Name="Corner" Grid.Column="1" Fill="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" Grid.Row="1"/> | |||
<ScrollContentPresenter x:Name="PART_ScrollContentPresenter" CanContentScroll="{TemplateBinding CanContentScroll}" CanHorizontallyScroll="False" CanVerticallyScroll="False" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Grid.Column="0" Margin="{TemplateBinding Padding}" Grid.Row="0"/> | |||
<ScrollBar x:Name="PART_VerticalScrollBar" AutomationProperties.AutomationId="VerticalScrollBar" Cursor="Arrow" Grid.Column="1" | |||
Maximum="{TemplateBinding ScrollableHeight}" Minimum="0" Grid.Row="0" Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}" | |||
Value="{Binding VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportHeight}" | |||
Template="{StaticResource VerticalScrollBar}"/> | |||
<ScrollBar x:Name="PART_HorizontalScrollBar" AutomationProperties.AutomationId="HorizontalScrollBar" Cursor="Arrow" Grid.Column="0" Maximum="{TemplateBinding ScrollableWidth}" Minimum="0" Orientation="Horizontal" Grid.Row="1" Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}" Value="{Binding HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportWidth}"/> | |||
</Grid> | |||
</ControlTemplate> | |||
<!--对象树子模板--> | |||
<DataTemplate x:Key="TreeItemTemplate" DataType="TreeViewItem"> | |||
<Grid Margin="50,0,0,0" Height="28"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="*"></ColumnDefinition> | |||
<ColumnDefinition Width="30"></ColumnDefinition> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock x:Name="tb_PageName" Text="{Binding Name}" Foreground="White" FontSize="15" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="10,0"/> | |||
<Button x:Name="BtnAdd" Grid.Column="1" Background="Transparent" VerticalAlignment="Center" HorizontalAlignment="Center" | |||
Command="{Binding DataContext.AddUserPageCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=TreeView}}" | |||
CommandParameter="{Binding Path=Text,ElementName=tb_PageName}"> | |||
<Button.Template> | |||
<ControlTemplate TargetType="Button"> | |||
<Grid> | |||
<Rectangle x:Name="BtnRetangle" Height="20" Width="20" Stroke="Transparent" StrokeThickness="1" | |||
Fill="{StaticResource ImageBrushAddBlue}" | |||
VerticalAlignment="Center" HorizontalAlignment="Center"> | |||
</Rectangle> | |||
<ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center" Content="{TemplateBinding Content}"></ContentPresenter> | |||
</Grid> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="True"> | |||
<Setter TargetName="BtnRetangle" Property="Height" Value="22"></Setter> | |||
<Setter TargetName="BtnRetangle" Property="Width" Value="22"></Setter> | |||
</Trigger> | |||
<DataTrigger Binding="{Binding IsChecked}" Value="true"> | |||
<Setter TargetName="BtnRetangle" Property="Fill" Value="{StaticResource ImageBrushAddGray}"></Setter> | |||
<Setter Property="ToolTip" Value="已添加"></Setter> | |||
</DataTrigger> | |||
<DataTrigger Binding="{Binding IsChecked}" Value="false"> | |||
<Setter TargetName="BtnRetangle" Property="Fill" Value="{StaticResource ImageBrushAddBlue}"></Setter> | |||
<Setter Property="ToolTip" Value="添加"></Setter> | |||
</DataTrigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Button.Template> | |||
</Button> | |||
</Grid> | |||
</DataTemplate> | |||
<Style TargetType="TreeViewItem"> | |||
<Setter Property="Background" Value="Transparent" /> | |||
<Setter Property="IsExpanded" Value="True"></Setter> | |||
<Setter Property="HeaderTemplate"> | |||
<Setter.Value> | |||
<HierarchicalDataTemplate ItemsSource="{Binding TreeViewItems,Mode=TwoWay}" ItemTemplate="{StaticResource TreeItemTemplate}"> | |||
<StackPanel Orientation="Horizontal" Height="28" VerticalAlignment="Center" HorizontalAlignment="Left"> | |||
<!--Image Source="folder.png" VerticalAlignment="Center" Height="17" Margin="10,0"/>--> | |||
<TextBlock Text="{Binding Name}" Margin="5,0,0,0" FontSize="15" VerticalAlignment="Center" Foreground="White"/> | |||
</StackPanel> | |||
</HierarchicalDataTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type TreeViewItem}"> | |||
<Grid> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="Auto" /> | |||
<ColumnDefinition Width="*" /> | |||
</Grid.ColumnDefinitions> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="Auto" /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<VisualStateManager.VisualStateGroups> | |||
<VisualStateGroup x:Name="SelectionStates"> | |||
<VisualState x:Name="Selected"> | |||
<Storyboard> | |||
<ColorAnimationUsingKeyFrames Storyboard.TargetName="Bd" Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)" > | |||
<EasingColorKeyFrame KeyTime="0" Value="Transparent" /> | |||
</ColorAnimationUsingKeyFrames> | |||
</Storyboard> | |||
</VisualState> | |||
<VisualState x:Name="Unselected" /> | |||
<VisualState x:Name="SelectedInactive"> | |||
<Storyboard> | |||
<ColorAnimationUsingKeyFrames Storyboard.TargetName="Bd" Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)"> | |||
<EasingColorKeyFrame KeyTime="0" Value="Transparent" /> | |||
</ColorAnimationUsingKeyFrames> | |||
</Storyboard> | |||
</VisualState> | |||
</VisualStateGroup> | |||
<VisualStateGroup x:Name="ExpansionStates"> | |||
<VisualState x:Name="Expanded"> | |||
<Storyboard> | |||
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="ItemsHost"> | |||
<DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}" /> | |||
</ObjectAnimationUsingKeyFrames> | |||
</Storyboard> | |||
</VisualState> | |||
<VisualState x:Name="Collapsed" /> | |||
</VisualStateGroup> | |||
</VisualStateManager.VisualStateGroups> | |||
<Border x:Name="Bd" Grid.Column="0" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}"> | |||
<ContentPresenter x:Name="PART_Header" ContentSource="Header" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"/> | |||
</Border> | |||
<ItemsPresenter x:Name="ItemsHost" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Visibility="Collapsed" /> | |||
</Grid> | |||
<ControlTemplate.Triggers> | |||
<MultiTrigger> | |||
<MultiTrigger.Conditions> | |||
<Condition Property="HasHeader" Value="false" /> | |||
<Condition Property="Width" Value="Auto" /> | |||
</MultiTrigger.Conditions> | |||
<Setter TargetName="PART_Header" Property="MinWidth" Value="75" /> | |||
</MultiTrigger> | |||
<MultiTrigger> | |||
<MultiTrigger.Conditions> | |||
<Condition Property="HasHeader" Value="false" /> | |||
<Condition Property="Height" Value="Auto" /> | |||
</MultiTrigger.Conditions> | |||
<Setter TargetName="PART_Header" Property="MinHeight" Value="19" /> | |||
</MultiTrigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<Style x:Key="ItemContainer" TargetType="{x:Type ListBoxItem}"> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type ListBoxItem}"> | |||
<Border x:Name="IconBorder" Background="Transparent" CornerRadius="4" BorderThickness="0"> | |||
<ContentPresenter /> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsSelected" Value="true"> | |||
<Setter TargetName="IconBorder" Property="BitmapEffect"> | |||
<Setter.Value> | |||
<OuterGlowBitmapEffect GlowColor="Transparent" GlowSize="5" /> | |||
</Setter.Value> | |||
</Setter> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
</Window.Resources> | |||
<Border Background="Black" | |||
x:Name="br" | |||
BorderBrush="#009dff" | |||
BorderThickness="2"> | |||
<Border.Effect> | |||
<DropShadowEffect | |||
BlurRadius="10" | |||
ShadowDepth="1" | |||
Color="#009DFF" /> | |||
</Border.Effect> | |||
<Grid> | |||
<Image Source="../../Image/权限背景.png" Stretch="Fill"/> | |||
<Grid Background="Transparent"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="80"/> | |||
<RowDefinition Height="50"/> | |||
<RowDefinition Height="*"/> | |||
<RowDefinition Height="50"/> | |||
<RowDefinition Height="*"/> | |||
<RowDefinition Height="50"/> | |||
<RowDefinition Height="10"/> | |||
</Grid.RowDefinitions> | |||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center"> | |||
<TextBlock Text="{Binding UserName}" HorizontalAlignment="Center" | |||
FontSize="24" | |||
Foreground="#ddd"/> | |||
<TextBlock Text="权限分配" Margin="10,0,0,0" | |||
HorizontalAlignment="Center" | |||
FontSize="24" | |||
Foreground="#ddd"/> | |||
</StackPanel> | |||
<TextBlock Grid.Row="1" | |||
Text="页面权限分配" Margin="10,0,0,0" | |||
HorizontalAlignment="Center" VerticalAlignment="Center" | |||
FontSize="20" | |||
Foreground="#ddd"/> | |||
<TextBlock Grid.Row="3" | |||
Text="配料权限分配" Margin="10,0,0,0" | |||
HorizontalAlignment="Center" VerticalAlignment="Center" | |||
FontSize="20" | |||
Foreground="#ddd"/> | |||
<Grid Grid.Row="2"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="50"/> | |||
<ColumnDefinition Width="*"/> | |||
<ColumnDefinition Width="100"/> | |||
<ColumnDefinition Width="*"/> | |||
<ColumnDefinition Width="50"/> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock Text="权限列表" Width="20" | |||
TextWrapping="Wrap" Grid.Column="0" | |||
HorizontalAlignment="Right" VerticalAlignment="Center" | |||
FontSize="20" | |||
Foreground="#ddd"/> | |||
<TextBlock Text="当前用户权限" Width="20" | |||
Grid.Column="4" | |||
TextWrapping="Wrap" | |||
HorizontalAlignment="Left" VerticalAlignment="Center" | |||
FontSize="20" | |||
Foreground="#ddd"/> | |||
<!--#region 页面权限--> | |||
<ScrollViewer Grid.Column="1" Margin="20,0,0,0" Template="{StaticResource ScrollViewerControlTemplate1}" CanContentScroll="True"> | |||
<TreeView x:Name="MyTreeView" ItemsSource="{Binding pageTreeViewModels}" | |||
ScrollViewer.VerticalScrollBarVisibility="Disabled" HorizontalAlignment="Stretch" Background="Transparent" BorderBrush="Transparent"></TreeView> | |||
</ScrollViewer> | |||
<ScrollViewer Grid.Column="3" Margin="10,0,20,0" Template="{StaticResource ScrollViewerControlTemplate1}" CanContentScroll="True"> | |||
<ListBox x:Name="RightListBox" Grid.Column="3" Background="Transparent" ItemContainerStyle="{StaticResource ItemContainer}" FocusVisualStyle="{x:Null}" | |||
ItemsSource="{Binding SelectePage}" > | |||
<ListBox.Template> | |||
<ControlTemplate> | |||
<StackPanel Background="Transparent" IsItemsHost="True"></StackPanel> | |||
</ControlTemplate> | |||
</ListBox.Template> | |||
<ListBox.ItemTemplate> | |||
<DataTemplate> | |||
<Grid Height="28" Margin="10"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="*"></ColumnDefinition> | |||
<ColumnDefinition Width="60"></ColumnDefinition> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock x:Name="tb_Name" Text="{Binding Name}" Foreground="White" FontSize="15" VerticalAlignment="Center" HorizontalAlignment="Left" /> | |||
<Button x:Name="BtnDelete" Grid.Column="1" Background="Transparent" ToolTip="移除" VerticalAlignment="Center" HorizontalAlignment="Left" | |||
Command="{Binding DataContext.DeleteUserPageCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListBox}}" | |||
CommandParameter="{Binding Path=Text,ElementName=tb_Name}"> | |||
<Button.Template> | |||
<ControlTemplate TargetType="Button"> | |||
<Grid> | |||
<Rectangle x:Name="BtnRetangle" Height="17" Width="17" Stroke="Transparent" StrokeThickness="1" VerticalAlignment="Center" HorizontalAlignment="Left"> | |||
<Rectangle.Fill> | |||
<ImageBrush ImageSource="../../Image/按钮/Delete.png"></ImageBrush> | |||
</Rectangle.Fill> | |||
</Rectangle> | |||
<ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center" Content="{TemplateBinding Content}"></ContentPresenter> | |||
</Grid> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="True"> | |||
<Setter TargetName="BtnRetangle" Property="Height" Value="19"></Setter> | |||
<Setter TargetName="BtnRetangle" Property="Width" Value="19"></Setter> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Button.Template> | |||
</Button> | |||
</Grid> | |||
</DataTemplate> | |||
</ListBox.ItemTemplate> | |||
</ListBox> | |||
</ScrollViewer> | |||
<StackPanel Grid.Column="2" HorizontalAlignment="Center" VerticalAlignment="Center"> | |||
<Button Foreground="White" Background="#009DFF" | |||
FontSize="16" Height="50" Width="70" Margin="10,20" | |||
Command="{Binding AddAllPageCommand}"> | |||
<TextBlock Text="全部 | |||
添加" TextWrapping="Wrap"/> | |||
</Button> | |||
<Button Foreground="White" Background="#009DFF" | |||
FontSize="16" Height="50" Width="70" Margin="10,20" | |||
Command="{Binding DeleteAllPageCommand}"> | |||
<TextBlock Text="全部 | |||
移除" TextWrapping="Wrap"/> | |||
</Button> | |||
</StackPanel> | |||
<!--#endregion--> | |||
</Grid> | |||
<Grid Grid.Row="4"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="50"/> | |||
<ColumnDefinition Width="*"/> | |||
<ColumnDefinition Width="100"/> | |||
<ColumnDefinition Width="*"/> | |||
<ColumnDefinition Width="50"/> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock Text="当前用户权限" Width="20" | |||
TextWrapping="Wrap" | |||
HorizontalAlignment="Center" VerticalAlignment="Center" | |||
FontSize="20" | |||
Foreground="#ddd"/> | |||
<TextBlock Text="权限列表" Width="20" | |||
Grid.Column="4" | |||
TextWrapping="Wrap" | |||
HorizontalAlignment="Center" VerticalAlignment="Center" | |||
FontSize="20" | |||
Foreground="#ddd"/> | |||
</Grid> | |||
<Grid Grid.Row="5"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="*"/> | |||
<ColumnDefinition Width="*"/> | |||
</Grid.ColumnDefinitions> | |||
<Button Content="保存" | |||
Background="#009DFF" | |||
Margin="200,5,20,5" | |||
BorderThickness="0" | |||
Command="{Binding SaveCommand}" | |||
FontSize="20" | |||
Foreground="White" | |||
TabIndex="3" /> | |||
<Button Content="取消" Grid.Column="1" Background="#009DFF" | |||
Margin="20,5,200,5" | |||
BorderThickness="0" | |||
Command="{Binding CancelCommand}" | |||
FontSize="20" | |||
Foreground="White" | |||
TabIndex="3"/> | |||
</Grid> | |||
</Grid> | |||
</Grid> | |||
</Border> | |||
</Window> |
@@ -0,0 +1,44 @@ | |||
using BPASmartClient.Helper; | |||
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 BPASmartClient.CustomResource.Pages.View | |||
{ | |||
/// <summary> | |||
/// UserConfigView.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class UserConfigView : Window | |||
{ | |||
public UserConfigView() | |||
{ | |||
InitializeComponent(); | |||
this.br.MouseLeftButtonDown += (o, e) => | |||
{ | |||
if (e.LeftButton == MouseButtonState.Pressed) this.DragMove(); | |||
}; | |||
ActionManage.GetInstance.CancelRegister("UserConfigViewConfirm"); | |||
ActionManage.GetInstance.CancelRegister("UserConfigViewCancel"); | |||
ActionManage.GetInstance.Register(new Action(() => { this.DialogResult = true; this.Close(); }), "UserConfigViewConfirm"); | |||
ActionManage.GetInstance.Register(new Action(() => { this.DialogResult = false; this.Close(); }), "UserConfigViewCancel"); | |||
} | |||
} | |||
} |
@@ -0,0 +1,170 @@ | |||
<UserControl x:Class="BPASmartClient.CustomResource.Pages.View.UserManagerView" | |||
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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:local="clr-namespace:BPASmartClient.CustomResource.Pages.View" | |||
xmlns:vm="clr-namespace:BPASmartClient.CustomResource.Pages.ViewModel" | |||
Width="1400" | |||
Height="900" | |||
Background="{x:Null}" | |||
mc:Ignorable="d"> | |||
<UserControl.DataContext> | |||
<vm:UserManagerViewModel/> | |||
</UserControl.DataContext> | |||
<UserControl.Resources> | |||
<Style x:Key="CommonTextBlockStyle" TargetType="TextBlock"> | |||
<Setter Property="Background" Value="Transparent"/> | |||
<Setter Property="Foreground" Value="#B1E8FF"/> | |||
<Setter Property="HorizontalAlignment" Value="Center"/> | |||
<Setter Property="VerticalAlignment" Value="Center"/> | |||
</Style> | |||
<Style TargetType="{x:Type DataGridCell}"> | |||
<Setter Property="FocusVisualStyle" Value="{x:Null}"/> | |||
<Setter Property="TextBlock.FontSize" Value="13" /> | |||
<Setter Property="Background" Value="Transparent"/> | |||
<Setter Property="BorderBrush" Value="#87CEFA"/> | |||
<Setter Property="BorderThickness" Value="1"/> | |||
<Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Mode=Self},Path=Content.Text}" /> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type DataGridCell}"> | |||
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1" Background="{TemplateBinding Background}" SnapsToDevicePixels="True"> | |||
<!--HorizontalAlignment 可以设置内容展示位置--> | |||
<ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="Center" HorizontalAlignment="Center" | |||
Margin="{TemplateBinding Padding}"/> | |||
</Border> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
<Style.Triggers> | |||
<Trigger Property="IsEnabled" Value="False"> | |||
<Setter Property="Opacity" Value=".56"/> | |||
</Trigger> | |||
</Style.Triggers> | |||
</Style> | |||
<Style TargetType="DataGridRow"> | |||
<Setter Property="FontSize" Value="16"/> | |||
<Setter Property="VerticalAlignment" Value="Center"/> | |||
<Setter Property="Margin" Value="0,5"/> | |||
<Style.Triggers> | |||
<!-- 隔行换色 --> | |||
<Trigger Property="AlternationIndex" Value="0"> | |||
<Setter Property="Background" Value="Transparent" /> | |||
</Trigger> | |||
<Trigger Property="AlternationIndex" Value="1"> | |||
<Setter Property="Background" Value="Transparent" /> | |||
</Trigger> | |||
<Trigger Property="IsMouseOver" Value="True"> | |||
<Setter Property="Background" Value="#87CEFA" /> | |||
</Trigger> | |||
</Style.Triggers> | |||
</Style> | |||
<Style TargetType="DataGridColumnHeader"> | |||
<Setter Property="SnapsToDevicePixels" Value="True" /> | |||
<Setter Property="MinWidth" Value="0" /> | |||
<Setter Property="MinHeight" Value="40" /> | |||
<Setter Property="Foreground" Value="#ddd" /> | |||
<Setter Property="FontSize" Value="26" /> | |||
<Setter Property="Cursor" Value="Hand" /> | |||
<Setter Property="Background" Value="Transparent"/> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="DataGridColumnHeader"> | |||
<Grid> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="*" /> | |||
</Grid.ColumnDefinitions> | |||
<ContentPresenter Margin="0,0,0,0" VerticalAlignment="Center" | |||
HorizontalAlignment="Center" /> | |||
<Path x:Name="SortArrow" Visibility="Collapsed" Data="M0,0 L1,0 0.5,1 z" Stretch="Fill" | |||
Grid.Column="0" Width="8" Height="6" Fill="Transparent" Margin="0,0,50,0" | |||
VerticalAlignment="Center" RenderTransformOrigin="1,1" /> | |||
<Rectangle Width="1" Fill="#87CEFA" HorizontalAlignment="Right" Grid.ColumnSpan="1" /> | |||
</Grid> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
<Setter Property="Height" Value="25" /> | |||
</Style> | |||
<Style x:Key="datagridButton" TargetType="Button"> | |||
<Setter Property="Background" Value="Transparent"/> | |||
<Setter Property="BorderBrush" Value="Transparent"/> | |||
<Setter Property="Foreground" Value="#1874CD"/> | |||
<Setter Property="FontSize" Value="18"/> | |||
</Style> | |||
</UserControl.Resources> | |||
<Grid> | |||
<Grid.ColumnDefinitions> | |||
</Grid.ColumnDefinitions> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="50"/> | |||
<RowDefinition Height="*"/> | |||
<RowDefinition Height="100"/> | |||
</Grid.RowDefinitions> | |||
<TextBlock Text="用户管理" FontSize="28" Style="{DynamicResource CommonTextBlockStyle}"/> | |||
<DataGrid Grid.Row="1" Margin="30" AutoGenerateColumns="False" RowHeight="35" ItemsSource="{Binding userManager}" | |||
Background="Transparent" | |||
FrozenColumnCount="1" | |||
VerticalAlignment="Top" | |||
IsReadOnly="True" | |||
CanUserResizeColumns="False" CanUserResizeRows="False" SelectionMode="Single" | |||
CanUserReorderColumns="False" AlternationCount="2" RowHeaderWidth="0" CanUserAddRows="False"> | |||
<DataGrid.Columns> | |||
<DataGridTemplateColumn Header="用户名" Width="200"> | |||
<DataGridTemplateColumn.CellTemplate> | |||
<DataTemplate> | |||
<TextBlock Text="{Binding UserName}" FontSize="20" Foreground="White"/> | |||
</DataTemplate> | |||
</DataGridTemplateColumn.CellTemplate> | |||
</DataGridTemplateColumn> | |||
<DataGridTemplateColumn Header="最后登录时间" Width="300" > | |||
<DataGridTemplateColumn.CellTemplate> | |||
<DataTemplate> | |||
<TextBlock Text="{Binding LastLogInTime}" FontSize="20" Foreground="White"/> | |||
</DataTemplate> | |||
</DataGridTemplateColumn.CellTemplate> | |||
</DataGridTemplateColumn> | |||
<DataGridTemplateColumn Header="权限" Width="250"> | |||
<DataGridTemplateColumn.CellTemplate> | |||
<DataTemplate> | |||
<Button Content="权限" Style="{DynamicResource datagridButton}" | |||
Command="{Binding DataContext.EditUserConfigCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}}" | |||
CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=DataGrid},Path=SelectedItem}"/> | |||
</DataTemplate> | |||
</DataGridTemplateColumn.CellTemplate> | |||
</DataGridTemplateColumn> | |||
<DataGridTemplateColumn Header="重置密码" Width="250"> | |||
<DataGridTemplateColumn.CellTemplate> | |||
<DataTemplate> | |||
<Button Content="重置密码" Style="{DynamicResource datagridButton}" Command="{Binding DataContext.ChangePasswardCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}}" | |||
CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=DataGrid},Path=SelectedItem}"/> | |||
</DataTemplate> | |||
</DataGridTemplateColumn.CellTemplate> | |||
</DataGridTemplateColumn> | |||
<DataGridTemplateColumn Header="删除" Width="*"> | |||
<DataGridTemplateColumn.CellTemplate> | |||
<DataTemplate> | |||
<Button Content="删除" Style="{DynamicResource datagridButton}" | |||
Command="{Binding DataContext.DeleteUserCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}}" | |||
CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=DataGrid},Path=SelectedItem}"/> | |||
</DataTemplate> | |||
</DataGridTemplateColumn.CellTemplate> | |||
</DataGridTemplateColumn> | |||
</DataGrid.Columns> | |||
</DataGrid> | |||
<Button Grid.Row="2" | |||
Height="50" Width="200" | |||
Background="#009DFF" | |||
BorderThickness="0" | |||
Command="{Binding AddNewUserCommand}" | |||
Content="添加新用户" | |||
FontSize="24" | |||
Foreground="White" /> | |||
</Grid> | |||
</UserControl> |
@@ -0,0 +1,27 @@ | |||
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 BPASmartClient.CustomResource.Pages.View | |||
{ | |||
/// <summary> | |||
/// UserManager.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class UserManagerView : UserControl | |||
{ | |||
public UserManagerView() | |||
{ | |||
InitializeComponent(); | |||
} | |||
} | |||
} |
@@ -0,0 +1,61 @@ | |||
using BPASmartClient.CustomResource.Pages.Model; | |||
using BPASmartClient.Helper; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.CustomResource.Pages.ViewModel | |||
{ | |||
public class AddNewUserViewModel:ObservableObject | |||
{ | |||
public string ErrorInfo { get { return _mErrorInfo; } set { _mErrorInfo = value; OnPropertyChanged(); } } | |||
private string _mErrorInfo; | |||
public string UserName { get { return _userName; } set { _userName = value; OnPropertyChanged(); } } | |||
private string _userName; | |||
public string NewPassword1 { get { return _mNewPassword1; } set { _mNewPassword1 = value; OnPropertyChanged(); } } | |||
private string _mNewPassword1; | |||
public string NewPassword2 { get { return _mNewPassword2; } set { _mNewPassword2 = value; OnPropertyChanged(); } } | |||
private string _mNewPassword2; | |||
public RelayCommand ExitCommand { get; set; } | |||
public RelayCommand ConfirmCommand { get; set; } | |||
private void Confirm() | |||
{ | |||
if (UserName == null) { ErrorInfo = "用户名不能为空"; return; } | |||
if (NewPassword1 == null) { ErrorInfo = "请输入密码"; return; } | |||
if (NewPassword2 != NewPassword1) { ErrorInfo = "两次密码不一致"; return; } | |||
var res = Global.userManager.userInfos.FirstOrDefault(p => p.UserName == UserName); | |||
if (res != null) { ErrorInfo = "用户名已存在";return; } | |||
Global.userManager.userInfos.Add(new UserInfo | |||
{ | |||
UserName = UserName, | |||
Password = NewPassword1, | |||
userTreeViewModels = new List<UserTreeViewModel>() | |||
}); | |||
Config.GetInstance.SaveUser(); | |||
ActionManage.GetInstance.Send("AddNewUserViewConfirm"); | |||
} | |||
public AddNewUserViewModel() | |||
{ | |||
ConfirmCommand = new RelayCommand(Confirm); | |||
ExitCommand = new RelayCommand(() => | |||
{ | |||
ActionManage.GetInstance.Send("AddNewUserViewCancel"); | |||
}); | |||
} | |||
} | |||
} |
@@ -32,26 +32,60 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel | |||
Global.userInfo.permission = res.permission; | |||
Global.userInfo.UserName = res.UserName; | |||
Global.userInfo.Password = res.Password; | |||
for (int i = 0; i < MenuManage.GetInstance.menuModels.Count; i++) | |||
Global.userInfo.LastLogInTime = DateTime.Now.ToString(); | |||
res.LastLogInTime = DateTime.Now.ToString(); | |||
Config.GetInstance.SaveUser(); | |||
if(res.permission == Enums.Permission.管理员) | |||
{ | |||
if (MenuManage.GetInstance.menuModels.ElementAt(i).MainMenuPermission.Contains(res.permission)) | |||
MenuManage.GetInstance.menuModels.ElementAt(i).MainMenuVisibility = Visibility.Visible; | |||
else | |||
MenuManage.GetInstance.menuModels.ElementAt(i).MainMenuVisibility = Visibility.Collapsed; | |||
if (MenuManage.GetInstance.menuModels.ElementAt(i).subMenumodels.FirstOrDefault(p => p.SubMenuPermission.Contains(res.permission)) == null) | |||
MenuManage.GetInstance.menuModels.ElementAt(i).MainMenuVisibility = Visibility.Collapsed; | |||
for (int m = 0; m < MenuManage.GetInstance.menuModels.ElementAt(i).subMenumodels.Count; m++) | |||
foreach( var items in MenuManage.GetInstance.menuModels) | |||
{ | |||
if (MenuManage.GetInstance.menuModels.ElementAt(i).subMenumodels.ElementAt(m).SubMenuPermission.Contains(res.permission)) | |||
MenuManage.GetInstance.menuModels.ElementAt(i).subMenumodels.ElementAt(m).SubMenuVisibility = Visibility.Visible; | |||
else | |||
MenuManage.GetInstance.menuModels.ElementAt(i).subMenumodels.ElementAt(m).SubMenuVisibility = Visibility.Collapsed; | |||
foreach(var item in items.subMenumodels) | |||
{ | |||
item.SubMenuVisibility = Visibility.Visible; | |||
} | |||
} | |||
} | |||
else | |||
{ | |||
if (res.userTreeViewModels != null) | |||
{ | |||
if (res.userTreeViewModels.Count > 0) | |||
{ | |||
foreach (var items in MenuManage.GetInstance.menuModels) | |||
{ | |||
foreach (var item in items.subMenumodels) | |||
{ | |||
if (res.userTreeViewModels.FirstOrDefault(p => p.Name == item.SubMenuName) != null) | |||
{ | |||
item.SubMenuVisibility = Visibility.Visible; | |||
} | |||
} | |||
} | |||
} | |||
} | |||
} | |||
//for (int i = 0; i < MenuManage.GetInstance.menuModels.Count; i++) | |||
//{ | |||
// if (MenuManage.GetInstance.menuModels.ElementAt(i).MainMenuPermission.Contains(res.permission)) | |||
// MenuManage.GetInstance.menuModels.ElementAt(i).MainMenuVisibility = Visibility.Visible; | |||
// else | |||
// MenuManage.GetInstance.menuModels.ElementAt(i).MainMenuVisibility = Visibility.Collapsed; | |||
// if (MenuManage.GetInstance.menuModels.ElementAt(i).subMenumodels.FirstOrDefault(p => p.SubMenuPermission.Contains(res.permission)) == null) | |||
// MenuManage.GetInstance.menuModels.ElementAt(i).MainMenuVisibility = Visibility.Collapsed; | |||
// for (int m = 0; m < MenuManage.GetInstance.menuModels.ElementAt(i).subMenumodels.Count; m++) | |||
// { | |||
// if (MenuManage.GetInstance.menuModels.ElementAt(i).subMenumodels.ElementAt(m).SubMenuPermission.Contains(res.permission)) | |||
// MenuManage.GetInstance.menuModels.ElementAt(i).subMenumodels.ElementAt(m).SubMenuVisibility = Visibility.Visible; | |||
// else | |||
// MenuManage.GetInstance.menuModels.ElementAt(i).subMenumodels.ElementAt(m).SubMenuVisibility = Visibility.Collapsed; | |||
// } | |||
//} | |||
ActionManage.GetInstance.Send("PermissionChange"); | |||
ActionManage.GetInstance.Send("LoginOk"); | |||
} | |||
else | |||
{ | |||
@@ -10,37 +10,48 @@ using Microsoft.Toolkit.Mvvm.Input; | |||
namespace BPASmartClient.CustomResource.Pages.ViewModel | |||
{ | |||
public class PasswordChangeViewModel : ObservableObject | |||
{ | |||
public PasswordChangeViewModel() | |||
private void CheckPassword(UserInfo userInfo) | |||
{ | |||
LoginCommand = new RelayCommand(() => | |||
if (userInfo.Password == OldPassword) | |||
{ | |||
if (Global.userInfo.Password == OldPassword) | |||
if (NewPassword1 == NewPassword2) | |||
{ | |||
if (NewPassword1 == NewPassword2) | |||
{ | |||
Global.userInfo.Password = NewPassword2; | |||
int index = Array.FindIndex(Global.userManager.userInfos.ToArray(), p => p.UserName == Global.userInfo.UserName); | |||
if (index >= 0 && index < Global.userManager.userInfos.Count) | |||
Global.userManager.userInfos.ElementAt(index).Password = NewPassword1; | |||
Config.GetInstance.SaveUser(); | |||
ActionManage.GetInstance.Send("PasswordChangeViewconfirm"); | |||
} | |||
else | |||
{ | |||
ErrorInfo = "新密码不匹配"; | |||
} | |||
userInfo.Password = NewPassword2; | |||
int index = Array.FindIndex(Global.userManager.userInfos.ToArray(), p => p.UserName == userInfo.UserName); | |||
if (index >= 0 && index < Global.userManager.userInfos.Count) | |||
Global.userManager.userInfos.ElementAt(index).Password = NewPassword1; | |||
Config.GetInstance.SaveUser(); | |||
ActionManage.GetInstance.Send("PasswordChangeViewconfirm"); | |||
Global.changeUserInfo = null; | |||
} | |||
else | |||
{ | |||
ErrorInfo = "原密码错误"; | |||
ErrorInfo = "新密码不匹配"; | |||
} | |||
} | |||
else | |||
{ | |||
ErrorInfo = "原密码错误"; | |||
} | |||
} | |||
public PasswordChangeViewModel( ) | |||
{ | |||
LoginCommand = new RelayCommand(() => | |||
{ | |||
if (Global.changeUserInfo == null) CheckPassword(Global.userInfo); | |||
else { CheckPassword(Global.changeUserInfo); } | |||
}); | |||
ExitCommand = new RelayCommand(() => | |||
{ | |||
ActionManage.GetInstance.Send("PasswordChangeViewCancel"); | |||
Global.changeUserInfo = null; | |||
}); | |||
} | |||
@@ -0,0 +1,14 @@ | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.CustomResource.Pages.ViewModel | |||
{ | |||
public class PermissionConfigurationViewModel:ObservableObject | |||
{ | |||
} | |||
} |
@@ -0,0 +1,158 @@ | |||
using BPASmartClient.CustomResource.Pages.Model; | |||
using BPASmartClient.CustomResource.Pages.View; | |||
using BPASmartClient.Helper; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Collections.ObjectModel; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.CustomResource.Pages.ViewModel | |||
{ | |||
public class UserConfigViewModel:ObservableObject | |||
{ | |||
/// <summary> | |||
/// 页面列表集合 | |||
/// </summary> | |||
public ObservableCollection<UserTreeViewModel> pageTreeViewModels { get; set; } = new ObservableCollection<UserTreeViewModel>(); | |||
/// <summary> | |||
/// 已选择页面 | |||
/// </summary> | |||
public ObservableCollection<UserTreeViewModel> SelectePage { get; set; } = new ObservableCollection<UserTreeViewModel>(); | |||
/// <summary> | |||
/// 用户名 | |||
/// </summary> | |||
public string UserName { get { return _username; } set { _username = value; OnPropertyChanged(); } } | |||
private string _username; | |||
public RelayCommand<object> AddUserPageCommand { get; set; } | |||
public RelayCommand<object> DeleteUserPageCommand { get; set; } | |||
public RelayCommand DeleteAllPageCommand { get; set; } | |||
public RelayCommand AddAllPageCommand { get; set; } | |||
public RelayCommand SaveCommand { get; set; } | |||
public RelayCommand CancelCommand { get; set; } | |||
private void AddUserPage(object o) | |||
{ | |||
if (o == null) return; | |||
if(o is string name) | |||
{ | |||
var s = SelectePage.FirstOrDefault(x => x.Name == name); | |||
if (!SelectePage.Contains(s)) | |||
{ | |||
foreach (UserTreeViewModel item in pageTreeViewModels) | |||
{ | |||
var res = item.TreeViewItems.FirstOrDefault(P => P.Name == name); | |||
if(res != null) | |||
{ | |||
SelectePage.Add(res); | |||
return; | |||
} | |||
} | |||
} | |||
} | |||
} | |||
private void DeleteUserPage(object o) | |||
{ | |||
if (o == null) return; | |||
if (o is string name) | |||
{ | |||
var res = SelectePage.FirstOrDefault(p=>p.Name == name); | |||
SelectePage.Remove(res); | |||
} | |||
} | |||
public UserConfigViewModel() | |||
{ | |||
AddUserPageCommand = new RelayCommand<object>(AddUserPage); | |||
DeleteUserPageCommand = new RelayCommand<object>(DeleteUserPage); | |||
DeleteAllPageCommand = new RelayCommand(() => | |||
{ | |||
SelectePage.Clear(); | |||
}); | |||
AddAllPageCommand = new RelayCommand(() => | |||
{ | |||
foreach(UserTreeViewModel item in pageTreeViewModels) | |||
{ | |||
foreach(var res in item.TreeViewItems) | |||
{ | |||
if (!SelectePage.Contains(res)) SelectePage.Add(res); | |||
} | |||
} | |||
}); | |||
SaveCommand = new RelayCommand(() => | |||
{ | |||
var res = Global.userManager.userInfos.FirstOrDefault(p => p.UserName == Global.changeUserInfo.UserName && p.Password == Global.changeUserInfo.Password); | |||
if(res != null) | |||
{ | |||
res.userTreeViewModels = new List<UserTreeViewModel>(); | |||
res.userTreeViewModels.AddRange(SelectePage); | |||
Config.GetInstance.SaveUser(); | |||
} | |||
Global.changeUserInfo = null; | |||
ActionManage.GetInstance.Send("UserConfigViewConfirm"); | |||
}); | |||
CancelCommand = new RelayCommand(() => | |||
{ | |||
Global.changeUserInfo = null; | |||
ActionManage.GetInstance.Send("UserConfigViewCancel"); | |||
}); | |||
foreach (var item in MenuManage.GetInstance.menuModels) | |||
{ | |||
List<UserTreeViewModel> list = new List<UserTreeViewModel>(); | |||
foreach(var res in item.subMenumodels) | |||
{ | |||
list.Add(new UserTreeViewModel { Name = res.SubMenuName}); | |||
} | |||
pageTreeViewModels.Add(new UserTreeViewModel | |||
{ | |||
Name = item.MainMenuName, | |||
TreeViewItems = list | |||
}); | |||
} | |||
if(Global.changeUserInfo != null) | |||
{ | |||
UserName = Global.changeUserInfo.UserName; | |||
if (Global.changeUserInfo.userTreeViewModels != null) | |||
{ | |||
if(Global.changeUserInfo.userTreeViewModels.Count > 0) | |||
{ | |||
foreach(UserTreeViewModel item in Global.changeUserInfo.userTreeViewModels) | |||
{ | |||
SelectePage.Add(item); | |||
} | |||
} | |||
} | |||
} | |||
} | |||
} | |||
} |
@@ -0,0 +1,77 @@ | |||
using BPASmartClient.CustomResource.Pages.Model; | |||
using BPASmartClient.CustomResource.Pages.View; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Collections.ObjectModel; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.CustomResource.Pages.ViewModel | |||
{ | |||
public class UserManagerViewModel | |||
{ | |||
/// <summary> | |||
/// datagrid绑定 | |||
/// </summary> | |||
public ObservableCollection<UserInfo> userManager { get; set; } = Global.userManager.userInfos; | |||
public RelayCommand<object> ChangePasswardCommand { get; set; } | |||
public RelayCommand AddNewUserCommand { get; set; } | |||
public RelayCommand<object> DeleteUserCommand { get; set; } | |||
public RelayCommand<object> EditUserConfigCommand { get; set; } | |||
private void ChangePassward(object o) | |||
{ | |||
if (o != null && o is UserInfo infos) | |||
{ | |||
Global.changeUserInfo = infos; | |||
PasswordChangeView passwordChangeView = new PasswordChangeView(); | |||
passwordChangeView.ShowDialog(); | |||
} | |||
} | |||
private void DeleteUser(object o) | |||
{ | |||
if (o != null && o is UserInfo infos) | |||
{ | |||
var res = Global.userManager.userInfos.FirstOrDefault(p => p.UserName == infos.UserName); | |||
if (res != null) Global.userManager.userInfos.Remove(res); | |||
Config.GetInstance.SaveUser(); | |||
} | |||
} | |||
private void EditUserConfig(object o) | |||
{ | |||
if (o != null && o is UserInfo infos) | |||
{ | |||
Global.changeUserInfo = null; | |||
Global.changeUserInfo = infos; | |||
UserConfigView userConfigView = new UserConfigView(); | |||
userConfigView.ShowDialog(); | |||
} | |||
} | |||
public UserManagerViewModel() | |||
{ | |||
ChangePasswardCommand = new RelayCommand<object>(ChangePassward); | |||
AddNewUserCommand = new RelayCommand(() => | |||
{ | |||
AddNewUser addNewUser = new AddNewUser(); | |||
addNewUser.ShowDialog(); | |||
}); | |||
DeleteUserCommand = new RelayCommand<object>(DeleteUser); | |||
EditUserConfigCommand = new RelayCommand<object>(EditUserConfig); | |||
} | |||
} | |||
} |
@@ -34,7 +34,8 @@ namespace BPASmartClient.MorkS | |||
public override void DoMain() | |||
{ | |||
MonitorViewModel.DeviceId = DeviceId; | |||
ServerInit(); | |||
DataParse(); | |||
@@ -18,7 +18,10 @@ namespace BPASmartClient.MorkS.ViewModel | |||
{ | |||
public DebugViewModel() | |||
{ | |||
InitCommand = new RelayCommand(() => { ActionManage.GetInstance.Send("InitDevice"); }); | |||
InitCommand = new RelayCommand(() => { | |||
ActionManage.GetInstance.Send("InitDevice"); | |||
ActionManage.GetInstance.Send("初始化设定煮面时间"); | |||
}); | |||
SimOrderCommand = new RelayCommand(() => | |||
{ | |||
new MorksSimorderModel() { Bowloc = this.BowlLoc, NoodleLoc = this.NoodleLoc }.Publish(); | |||
@@ -8,6 +8,7 @@ using BPASmartClient.Helper; | |||
using BPASmartClient.Model; | |||
using BPASmartClient.MorkS.Model; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
namespace BPASmartClient.MorkS.ViewModel | |||
{ | |||
@@ -15,29 +16,34 @@ namespace BPASmartClient.MorkS.ViewModel | |||
{ | |||
public ParSetViewModel() | |||
{ | |||
SaveInfoCommand = new Action(() => | |||
{ | |||
List<ushort> values = new List<ushort>(); | |||
values.Clear(); | |||
List<bool> bools = new List<bool>(); | |||
bools.Clear(); | |||
SaveInfoCommand = new RelayCommand(SaveSettingData); | |||
for (int i = 0; i < Json<MorksPar>.Data.parSets.Count; i++) | |||
{ | |||
values.Clear(); | |||
values.Add(Json<MorksPar>.Data.parSets[i].Minute); | |||
values.Add(Json<MorksPar>.Data.parSets[i].Second); | |||
bools.Add(Json<MorksPar>.Data.parSets[i].IsShield); | |||
ActionManage.GetInstance.Send("WriteVW", new WritePar() { Address = $"VW{116 + (i * 6)}", Value = values.ToArray() }); | |||
} | |||
ActionManage.GetInstance.Send("WriteBools", new WritePar() { Address = "M260.0", Value = bools.ToArray() }); | |||
Json<MorksPar>.Save(); | |||
}); | |||
ActionManage.GetInstance.Register(SaveSettingData, "初始化设定煮面时间"); | |||
} | |||
public Action SaveInfoCommand { get; set; } | |||
public RelayCommand SaveInfoCommand { get; set; } | |||
public ObservableCollection<ParSet> parSets { get; set; } = Json<MorksPar>.Data.parSets; | |||
private void SaveSettingData() | |||
{ | |||
List<ushort> values = new List<ushort>(); | |||
values.Clear(); | |||
List<bool> bools = new List<bool>(); | |||
bools.Clear(); | |||
for (int i = 0; i < Json<MorksPar>.Data.parSets.Count; i++) | |||
{ | |||
values.Clear(); | |||
values.Add(Json<MorksPar>.Data.parSets[i].Minute); | |||
values.Add(Json<MorksPar>.Data.parSets[i].Second); | |||
bools.Add(Json<MorksPar>.Data.parSets[i].IsShield); | |||
ActionManage.GetInstance.Send("WriteVW", new WritePar() { Address = $"VW{116 + (i * 6)}", Value = values.ToArray() }); | |||
} | |||
ActionManage.GetInstance.Send("WriteBools", new WritePar() { Address = "M260.0", Value = bools.ToArray() }); | |||
Json<MorksPar>.Save(); | |||
} | |||
} | |||
} |
@@ -6,20 +6,20 @@ | |||
<!--<add key="ClientId" value="43"/>--> | |||
<add key="IsEnableTest" value="false"/> | |||
<!--测试环境--><!-- | |||
<!--测试环境--> | |||
<add key="apollouri" value="http://10.2.1.21:28080/"/> | |||
<add key="AppId" value="test1_HostComputer"/> | |||
<add key ="Namespaces" value="DEV.test1.Config"/>--> | |||
<add key ="Namespaces" value="DEV.test1.Config"/> | |||
<!--开发环境--><!-- | |||
<add key="apollouri" value="http://10.2.1.21:28080/"/> | |||
<!--开发环境--> | |||
<!--<add key="apollouri" value="http://10.2.1.21:28080/"/> | |||
<add key="AppId" value="HostComputer"/> | |||
<add key ="Namespaces" value="DEV.Config"/>--> | |||
<!--正式环境--> | |||
<add key="apollouri" value="http://47.108.65.220:28080/"/> | |||
<!--<add key="apollouri" value="http://47.108.65.220:28080/"/> | |||
<add key="AppId" value="HostComputer"/> | |||
<add key ="Namespaces" value="TEST1.Config"/> | |||
<add key ="Namespaces" value="TEST1.Config"/>--> | |||
<!--阿里云上报启动方式:API 或者 LOCAL--> | |||
<!--API :通过客户端ID,调用接口查询“设备连接信息”--> | |||
@@ -160,6 +160,13 @@ namespace BPASmartClient.DosingSystem | |||
AssemblyName = "BPASmartClient.CustomResource", | |||
ToggleWindowPath = "Pages.View.PasswordChangeView" | |||
}); | |||
UserManager.Add(new SubMenumodel() | |||
{ | |||
SubMenuName = "用户管理", | |||
SubMenuPermission = new Permission[] { Permission.管理员 }, | |||
AssemblyName = "BPASmartClient.CustomResource", | |||
ToggleWindowPath = "Pages.View.UserManagerView" | |||
}); | |||
MenuManage.GetInstance.menuModels.Add(new MenuModel() | |||