终端一体化运控平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

407 lines
25 KiB

  1. <Window x:Class="BPASmartClient.CustomResource.Pages.View.UserConfigView"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  5. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  6. xmlns:local="clr-namespace:BPASmartClient.CustomResource.Pages.View"
  7. xmlns:vm="clr-namespace:BPASmartClient.CustomResource.Pages.ViewModel"
  8. Title="UserConfigView" Width="800"
  9. Height="1000"
  10. AllowsTransparency="True"
  11. Background="{x:Null}"
  12. Topmost="True"
  13. WindowStartupLocation="CenterScreen"
  14. WindowStyle="None"
  15. mc:Ignorable="d">
  16. <Window.DataContext>
  17. <vm:UserConfigViewModel/>
  18. </Window.DataContext>
  19. <Window.Resources>
  20. <ImageBrush x:Key="ImageBrushAddBlue" ImageSource="../../Image/按钮/AddGreen.png"></ImageBrush>
  21. <ImageBrush x:Key="ImageBrushAddGray" ImageSource="../../Image/按钮/Delete.png"></ImageBrush>
  22. <Style x:Key="ScrollBarPageButton" TargetType="{x:Type RepeatButton}">
  23. <Setter Property="SnapsToDevicePixels" Value="True" />
  24. <Setter Property="OverridesDefaultStyle" Value="true" />
  25. <Setter Property="IsTabStop" Value="false" />
  26. <Setter Property="Focusable" Value="false" />
  27. <Setter Property="Template">
  28. <Setter.Value>
  29. <ControlTemplate TargetType="{x:Type RepeatButton}">
  30. <Border Background="Transparent" />
  31. </ControlTemplate>
  32. </Setter.Value>
  33. </Setter>
  34. </Style>
  35. <Style x:Key="ScrollBarThumb" TargetType="{x:Type Thumb}">
  36. <Setter Property="SnapsToDevicePixels" Value="True" />
  37. <Setter Property="OverridesDefaultStyle" Value="true" />
  38. <Setter Property="IsTabStop" Value="false" />
  39. <Setter Property="Focusable" Value="false" />
  40. <Setter Property="Template">
  41. <Setter.Value>
  42. <ControlTemplate TargetType="{x:Type Thumb}">
  43. <Border CornerRadius="2" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1" />
  44. </ControlTemplate>
  45. </Setter.Value>
  46. </Setter>
  47. </Style>
  48. <ControlTemplate x:Key="VerticalScrollBar" TargetType="{x:Type ScrollBar}">
  49. <Grid>
  50. <Border CornerRadius="2" Width="0.5" Background="#FF046BFF" />
  51. <Track x:Name="PART_Track" IsDirectionReversed="true">
  52. <Track.DecreaseRepeatButton>
  53. <RepeatButton Style="{StaticResource ScrollBarPageButton}" Command="ScrollBar.PageUpCommand" />
  54. </Track.DecreaseRepeatButton>
  55. <Track.Thumb>
  56. <Thumb Style="{StaticResource ScrollBarThumb}" Margin="4,0,4,0" Background="DodgerBlue"></Thumb>
  57. </Track.Thumb>
  58. <Track.IncreaseRepeatButton>
  59. <RepeatButton Style="{StaticResource ScrollBarPageButton}" Command="ScrollBar.PageDownCommand" />
  60. </Track.IncreaseRepeatButton>
  61. </Track>
  62. </Grid>
  63. </ControlTemplate>
  64. <ControlTemplate x:Key="ScrollViewerControlTemplate1" TargetType="{x:Type ScrollViewer}">
  65. <Grid x:Name="Grid" Background="{TemplateBinding Background}">
  66. <Grid.ColumnDefinitions>
  67. <ColumnDefinition Width="*"/>
  68. <ColumnDefinition Width="Auto"/>
  69. </Grid.ColumnDefinitions>
  70. <Grid.RowDefinitions>
  71. <RowDefinition Height="*"/>
  72. <RowDefinition Height="Auto"/>
  73. </Grid.RowDefinitions>
  74. <Rectangle x:Name="Corner" Grid.Column="1" Fill="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" Grid.Row="1"/>
  75. <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"/>
  76. <ScrollBar x:Name="PART_VerticalScrollBar" AutomationProperties.AutomationId="VerticalScrollBar" Cursor="Arrow" Grid.Column="1"
  77. Maximum="{TemplateBinding ScrollableHeight}" Minimum="0" Grid.Row="0" Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}"
  78. Value="{Binding VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportHeight}"
  79. Template="{StaticResource VerticalScrollBar}"/>
  80. <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}"/>
  81. </Grid>
  82. </ControlTemplate>
  83. <!--对象树子模板-->
  84. <DataTemplate x:Key="TreeItemTemplate" DataType="TreeViewItem">
  85. <Grid Margin="50,0,0,0" Height="28">
  86. <Grid.ColumnDefinitions>
  87. <ColumnDefinition Width="*"></ColumnDefinition>
  88. <ColumnDefinition Width="30"></ColumnDefinition>
  89. </Grid.ColumnDefinitions>
  90. <TextBlock x:Name="tb_PageName" Text="{Binding Name}" Foreground="White" FontSize="15" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="10,0"/>
  91. <Button x:Name="BtnAdd" Grid.Column="1" Background="Transparent" VerticalAlignment="Center" HorizontalAlignment="Center"
  92. Command="{Binding DataContext.AddUserPageCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=TreeView}}"
  93. CommandParameter="{Binding Path=Text,ElementName=tb_PageName}">
  94. <Button.Template>
  95. <ControlTemplate TargetType="Button">
  96. <Grid>
  97. <Rectangle x:Name="BtnRetangle" Height="20" Width="20" Stroke="Transparent" StrokeThickness="1"
  98. Fill="{StaticResource ImageBrushAddBlue}"
  99. VerticalAlignment="Center" HorizontalAlignment="Center">
  100. </Rectangle>
  101. <ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center" Content="{TemplateBinding Content}"></ContentPresenter>
  102. </Grid>
  103. <ControlTemplate.Triggers>
  104. <Trigger Property="IsMouseOver" Value="True">
  105. <Setter TargetName="BtnRetangle" Property="Height" Value="22"></Setter>
  106. <Setter TargetName="BtnRetangle" Property="Width" Value="22"></Setter>
  107. </Trigger>
  108. <DataTrigger Binding="{Binding IsChecked}" Value="true">
  109. <Setter TargetName="BtnRetangle" Property="Fill" Value="{StaticResource ImageBrushAddGray}"></Setter>
  110. <Setter Property="ToolTip" Value="已添加"></Setter>
  111. </DataTrigger>
  112. <DataTrigger Binding="{Binding IsChecked}" Value="false">
  113. <Setter TargetName="BtnRetangle" Property="Fill" Value="{StaticResource ImageBrushAddBlue}"></Setter>
  114. <Setter Property="ToolTip" Value="添加"></Setter>
  115. </DataTrigger>
  116. </ControlTemplate.Triggers>
  117. </ControlTemplate>
  118. </Button.Template>
  119. </Button>
  120. </Grid>
  121. </DataTemplate>
  122. <Style TargetType="TreeViewItem">
  123. <Setter Property="Background" Value="Transparent" />
  124. <Setter Property="IsExpanded" Value="True"></Setter>
  125. <Setter Property="HeaderTemplate">
  126. <Setter.Value>
  127. <HierarchicalDataTemplate ItemsSource="{Binding TreeViewItems,Mode=TwoWay}" ItemTemplate="{StaticResource TreeItemTemplate}">
  128. <StackPanel Orientation="Horizontal" Height="28" VerticalAlignment="Center" HorizontalAlignment="Left">
  129. <!--Image Source="folder.png" VerticalAlignment="Center" Height="17" Margin="10,0"/>-->
  130. <TextBlock Text="{Binding Name}" Margin="5,0,0,0" FontSize="15" VerticalAlignment="Center" Foreground="White"/>
  131. </StackPanel>
  132. </HierarchicalDataTemplate>
  133. </Setter.Value>
  134. </Setter>
  135. <Setter Property="Template">
  136. <Setter.Value>
  137. <ControlTemplate TargetType="{x:Type TreeViewItem}">
  138. <Grid>
  139. <Grid.ColumnDefinitions>
  140. <ColumnDefinition Width="Auto" />
  141. <ColumnDefinition Width="*" />
  142. </Grid.ColumnDefinitions>
  143. <Grid.RowDefinitions>
  144. <RowDefinition Height="Auto" />
  145. <RowDefinition />
  146. </Grid.RowDefinitions>
  147. <VisualStateManager.VisualStateGroups>
  148. <VisualStateGroup x:Name="SelectionStates">
  149. <VisualState x:Name="Selected">
  150. <Storyboard>
  151. <ColorAnimationUsingKeyFrames Storyboard.TargetName="Bd" Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)" >
  152. <EasingColorKeyFrame KeyTime="0" Value="Transparent" />
  153. </ColorAnimationUsingKeyFrames>
  154. </Storyboard>
  155. </VisualState>
  156. <VisualState x:Name="Unselected" />
  157. <VisualState x:Name="SelectedInactive">
  158. <Storyboard>
  159. <ColorAnimationUsingKeyFrames Storyboard.TargetName="Bd" Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)">
  160. <EasingColorKeyFrame KeyTime="0" Value="Transparent" />
  161. </ColorAnimationUsingKeyFrames>
  162. </Storyboard>
  163. </VisualState>
  164. </VisualStateGroup>
  165. <VisualStateGroup x:Name="ExpansionStates">
  166. <VisualState x:Name="Expanded">
  167. <Storyboard>
  168. <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="ItemsHost">
  169. <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}" />
  170. </ObjectAnimationUsingKeyFrames>
  171. </Storyboard>
  172. </VisualState>
  173. <VisualState x:Name="Collapsed" />
  174. </VisualStateGroup>
  175. </VisualStateManager.VisualStateGroups>
  176. <Border x:Name="Bd" Grid.Column="0" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}">
  177. <ContentPresenter x:Name="PART_Header" ContentSource="Header" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"/>
  178. </Border>
  179. <ItemsPresenter x:Name="ItemsHost" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Visibility="Collapsed" />
  180. </Grid>
  181. <ControlTemplate.Triggers>
  182. <MultiTrigger>
  183. <MultiTrigger.Conditions>
  184. <Condition Property="HasHeader" Value="false" />
  185. <Condition Property="Width" Value="Auto" />
  186. </MultiTrigger.Conditions>
  187. <Setter TargetName="PART_Header" Property="MinWidth" Value="75" />
  188. </MultiTrigger>
  189. <MultiTrigger>
  190. <MultiTrigger.Conditions>
  191. <Condition Property="HasHeader" Value="false" />
  192. <Condition Property="Height" Value="Auto" />
  193. </MultiTrigger.Conditions>
  194. <Setter TargetName="PART_Header" Property="MinHeight" Value="19" />
  195. </MultiTrigger>
  196. </ControlTemplate.Triggers>
  197. </ControlTemplate>
  198. </Setter.Value>
  199. </Setter>
  200. </Style>
  201. <Style x:Key="ItemContainer" TargetType="{x:Type ListBoxItem}">
  202. <Setter Property="Template">
  203. <Setter.Value>
  204. <ControlTemplate TargetType="{x:Type ListBoxItem}">
  205. <Border x:Name="IconBorder" Background="Transparent" CornerRadius="4" BorderThickness="0">
  206. <ContentPresenter />
  207. </Border>
  208. <ControlTemplate.Triggers>
  209. <Trigger Property="IsSelected" Value="true">
  210. <Setter TargetName="IconBorder" Property="BitmapEffect">
  211. <Setter.Value>
  212. <OuterGlowBitmapEffect GlowColor="Transparent" GlowSize="5" />
  213. </Setter.Value>
  214. </Setter>
  215. </Trigger>
  216. </ControlTemplate.Triggers>
  217. </ControlTemplate>
  218. </Setter.Value>
  219. </Setter>
  220. </Style>
  221. </Window.Resources>
  222. <Border Background="Black"
  223. x:Name="br"
  224. BorderBrush="#009dff"
  225. BorderThickness="2">
  226. <Border.Effect>
  227. <DropShadowEffect
  228. BlurRadius="10"
  229. ShadowDepth="1"
  230. Color="#009DFF" />
  231. </Border.Effect>
  232. <Grid>
  233. <Image Source="../../Image/权限背景.png" Stretch="Fill"/>
  234. <Grid Background="Transparent">
  235. <Grid.RowDefinitions>
  236. <RowDefinition Height="80"/>
  237. <RowDefinition Height="50"/>
  238. <RowDefinition Height="*"/>
  239. <RowDefinition Height="50"/>
  240. <RowDefinition Height="*"/>
  241. <RowDefinition Height="50"/>
  242. <RowDefinition Height="10"/>
  243. </Grid.RowDefinitions>
  244. <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
  245. <TextBlock Text="{Binding UserName}" HorizontalAlignment="Center"
  246. FontSize="24"
  247. Foreground="#ddd"/>
  248. <TextBlock Text="权限分配" Margin="10,0,0,0"
  249. HorizontalAlignment="Center"
  250. FontSize="24"
  251. Foreground="#ddd"/>
  252. </StackPanel>
  253. <TextBlock Grid.Row="1"
  254. Text="页面权限分配" Margin="10,0,0,0"
  255. HorizontalAlignment="Center" VerticalAlignment="Center"
  256. FontSize="20"
  257. Foreground="#ddd"/>
  258. <TextBlock Grid.Row="3"
  259. Text="配料权限分配" Margin="10,0,0,0"
  260. HorizontalAlignment="Center" VerticalAlignment="Center"
  261. FontSize="20"
  262. Foreground="#ddd"/>
  263. <Grid Grid.Row="2">
  264. <Grid.ColumnDefinitions>
  265. <ColumnDefinition Width="50"/>
  266. <ColumnDefinition Width="*"/>
  267. <ColumnDefinition Width="100"/>
  268. <ColumnDefinition Width="*"/>
  269. <ColumnDefinition Width="50"/>
  270. </Grid.ColumnDefinitions>
  271. <TextBlock Text="权限列表" Width="20"
  272. TextWrapping="Wrap" Grid.Column="0"
  273. HorizontalAlignment="Right" VerticalAlignment="Center"
  274. FontSize="20"
  275. Foreground="#ddd"/>
  276. <TextBlock Text="当前用户权限" Width="20"
  277. Grid.Column="4"
  278. TextWrapping="Wrap"
  279. HorizontalAlignment="Left" VerticalAlignment="Center"
  280. FontSize="20"
  281. Foreground="#ddd"/>
  282. <!--#region 页面权限-->
  283. <ScrollViewer Grid.Column="1" Margin="20,0,0,0" Template="{StaticResource ScrollViewerControlTemplate1}" CanContentScroll="True">
  284. <TreeView x:Name="MyTreeView" ItemsSource="{Binding pageTreeViewModels}"
  285. ScrollViewer.VerticalScrollBarVisibility="Disabled" HorizontalAlignment="Stretch" Background="Transparent" BorderBrush="Transparent"></TreeView>
  286. </ScrollViewer>
  287. <ScrollViewer Grid.Column="3" Margin="10,0,20,0" Template="{StaticResource ScrollViewerControlTemplate1}" CanContentScroll="True">
  288. <ListBox x:Name="RightListBox" Grid.Column="3" Background="Transparent" ItemContainerStyle="{StaticResource ItemContainer}" FocusVisualStyle="{x:Null}"
  289. ItemsSource="{Binding SelectePage}" >
  290. <ListBox.Template>
  291. <ControlTemplate>
  292. <StackPanel Background="Transparent" IsItemsHost="True"></StackPanel>
  293. </ControlTemplate>
  294. </ListBox.Template>
  295. <ListBox.ItemTemplate>
  296. <DataTemplate>
  297. <Grid Height="28" Margin="10">
  298. <Grid.ColumnDefinitions>
  299. <ColumnDefinition Width="*"></ColumnDefinition>
  300. <ColumnDefinition Width="60"></ColumnDefinition>
  301. </Grid.ColumnDefinitions>
  302. <TextBlock x:Name="tb_Name" Text="{Binding Name}" Foreground="White" FontSize="15" VerticalAlignment="Center" HorizontalAlignment="Left" />
  303. <Button x:Name="BtnDelete" Grid.Column="1" Background="Transparent" ToolTip="移除" VerticalAlignment="Center" HorizontalAlignment="Left"
  304. Command="{Binding DataContext.DeleteUserPageCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListBox}}"
  305. CommandParameter="{Binding Path=Text,ElementName=tb_Name}">
  306. <Button.Template>
  307. <ControlTemplate TargetType="Button">
  308. <Grid>
  309. <Rectangle x:Name="BtnRetangle" Height="17" Width="17" Stroke="Transparent" StrokeThickness="1" VerticalAlignment="Center" HorizontalAlignment="Left">
  310. <Rectangle.Fill>
  311. <ImageBrush ImageSource="../../Image/按钮/Delete.png"></ImageBrush>
  312. </Rectangle.Fill>
  313. </Rectangle>
  314. <ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center" Content="{TemplateBinding Content}"></ContentPresenter>
  315. </Grid>
  316. <ControlTemplate.Triggers>
  317. <Trigger Property="IsMouseOver" Value="True">
  318. <Setter TargetName="BtnRetangle" Property="Height" Value="19"></Setter>
  319. <Setter TargetName="BtnRetangle" Property="Width" Value="19"></Setter>
  320. </Trigger>
  321. </ControlTemplate.Triggers>
  322. </ControlTemplate>
  323. </Button.Template>
  324. </Button>
  325. </Grid>
  326. </DataTemplate>
  327. </ListBox.ItemTemplate>
  328. </ListBox>
  329. </ScrollViewer>
  330. <StackPanel Grid.Column="2" HorizontalAlignment="Center" VerticalAlignment="Center">
  331. <Button Foreground="White" Background="#009DFF"
  332. FontSize="16" Height="50" Width="70" Margin="10,20"
  333. Command="{Binding AddAllPageCommand}">
  334. <TextBlock Text="全部
  335. 添加" TextWrapping="Wrap"/>
  336. </Button>
  337. <Button Foreground="White" Background="#009DFF"
  338. FontSize="16" Height="50" Width="70" Margin="10,20"
  339. Command="{Binding DeleteAllPageCommand}">
  340. <TextBlock Text="全部
  341. 移除" TextWrapping="Wrap"/>
  342. </Button>
  343. </StackPanel>
  344. <!--#endregion-->
  345. </Grid>
  346. <Grid Grid.Row="4">
  347. <Grid.ColumnDefinitions>
  348. <ColumnDefinition Width="50"/>
  349. <ColumnDefinition Width="*"/>
  350. <ColumnDefinition Width="100"/>
  351. <ColumnDefinition Width="*"/>
  352. <ColumnDefinition Width="50"/>
  353. </Grid.ColumnDefinitions>
  354. <TextBlock Text="当前用户权限" Width="20"
  355. TextWrapping="Wrap"
  356. HorizontalAlignment="Center" VerticalAlignment="Center"
  357. FontSize="20"
  358. Foreground="#ddd"/>
  359. <TextBlock Text="权限列表" Width="20"
  360. Grid.Column="4"
  361. TextWrapping="Wrap"
  362. HorizontalAlignment="Center" VerticalAlignment="Center"
  363. FontSize="20"
  364. Foreground="#ddd"/>
  365. </Grid>
  366. <Grid Grid.Row="5">
  367. <Grid.ColumnDefinitions>
  368. <ColumnDefinition Width="*"/>
  369. <ColumnDefinition Width="*"/>
  370. </Grid.ColumnDefinitions>
  371. <Button Content="保存"
  372. Background="#009DFF"
  373. Margin="200,5,20,5"
  374. BorderThickness="0"
  375. Command="{Binding SaveCommand}"
  376. FontSize="20"
  377. Foreground="White"
  378. TabIndex="3" />
  379. <Button Content="取消" Grid.Column="1" Background="#009DFF"
  380. Margin="20,5,200,5"
  381. BorderThickness="0"
  382. Command="{Binding CancelCommand}"
  383. FontSize="20"
  384. Foreground="White"
  385. TabIndex="3"/>
  386. </Grid>
  387. </Grid>
  388. </Grid>
  389. </Border>
  390. </Window>