WinPermission.xaml
10.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
<win:HideCloseWindow
x:Class="HHECS.WinClient.View.UserPermission.WinPermission"
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:HHECS.WinClient.View.UserPermission"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:model="clr-namespace:HHECS.Model.Entities;assembly=HHECS.Model"
xmlns:valuerules="clr-namespace:HHECS.WinCommon.ValueRules;assembly=HHECS.WinCommon"
xmlns:win="clr-namespace:HHECS.WinCommon.Win;assembly=HHECS.WinCommon"
Title="权限管理"
Width="800"
Height="450"
d:DataContext="{d:DesignInstance Type=local:PermissionVM}"
mc:Ignorable="d">
<Window.Resources>
<Style BasedOn="{StaticResource {x:Type TextBox}}" TargetType="TextBox">
<Setter Property="MinWidth" Value="80" />
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="TextWrapping" Value="Wrap" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Margin" Value="9.4,0,0,0" />
</Style>
<Style x:Key="sp" TargetType="StackPanel">
<Setter Property="Orientation" Value="Horizontal" />
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Margin" Value="20,10,20,10" />
</Style>
<Style x:Key="wp" TargetType="WrapPanel">
<Setter Property="Orientation" Value="Horizontal" />
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Margin" Value="20,10,20,10" />
</Style>
<Style
x:Key="txb"
BasedOn="{StaticResource BaseTextBlockStyle}"
TargetType="TextBlock">
<Setter Property="VerticalAlignment" Value="Center" />
</Style>
<Style
x:Key="btn"
BasedOn="{StaticResource BaseButtonStyle}"
TargetType="Button">
<Setter Property="Margin" Value="2" />
</Style>
</Window.Resources>
<DockPanel>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="3*" />
<ColumnDefinition Width="5*" />
</Grid.ColumnDefinitions>
<TreeView
x:Name="treeMain"
Grid.Column="0"
ItemsSource="{Binding Permissions}"
TreeViewItem.Selected="treeMain_Selected">
<TreeView.ItemTemplate>
<HierarchicalDataTemplate DataType="{x:Type model:Permission}" ItemsSource="{Binding Path=Childrens}">
<StackPanel Orientation="Horizontal">
<Image
Width="16"
Height="16"
Margin="0,0,2,2"
VerticalAlignment="Center"
Source="{Binding Icon}" />
<TextBlock Style="{StaticResource txb}" Text="{Binding PermissionName}" />
<!--<Image VerticalAlignment="Center" Source="{Binding EditIcon}" Margin="2,0,0,0"></Image>-->
<StackPanel.ToolTip>
<TextBlock
MaxWidth="200"
Style="{StaticResource txb}"
Text="{Binding Remark}"
TextWrapping="Wrap" />
</StackPanel.ToolTip>
</StackPanel>
</HierarchicalDataTemplate>
</TreeView.ItemTemplate>
</TreeView>
<GridSplitter Width="5" />
<Grid x:Name="GridDetail" Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<ToolBar Grid.Row="0">
<Button
x:Name="BtnNew"
Click="BtnNew_Click"
IsEnabled="{Binding Enable}"
Style="{StaticResource btn}"
Tag="permission:add">
新增
</Button>
<Button
x:Name="BtnSave"
Click="BtnSave_Click"
Content="保存"
IsEnabled="{Binding Enable}"
Style="{StaticResource btn}"
Tag="permission:save" />
<!--<Button x:Name="BtnEdit" Style="{StaticResource btn}" Click="BtnEdit_Click" Tag="permission:edit">编辑</Button>-->
<Button
x:Name="BtnDelete"
Click="BtnDelete_Click"
IsEnabled="{Binding Enable}"
Style="{StaticResource btn}"
Tag="permission:delete">
删除
</Button>
<Button
x:Name="BtnQuery"
Click="BtnQuery_Click"
Content="刷新"
Style="{StaticResource btn}"
Tag="permission:query" />
</ToolBar>
<StackPanel Grid.Row="1" Style="{StaticResource sp}">
<TextBlock Text="父菜单:" TextWrapping="Wrap" />
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
Text="{Binding Path=Permission.Parent.PermissionName}"
TextWrapping="Wrap" />
</StackPanel>
<WrapPanel Grid.Row="2" Style="{StaticResource wp}">
<TextBlock>编码:</TextBlock>
<TextBox>
<TextBox.Text>
<Binding Path="Permission.PermissionCode" UpdateSourceTrigger="PropertyChanged">
<Binding.ValidationRules>
<valuerules:StringNotNullSpaceRule />
</Binding.ValidationRules>
</Binding>
</TextBox.Text>
</TextBox>
<TextBlock Text="名称:" TextWrapping="Wrap" />
<TextBox x:Name="TxtName">
<TextBox.Text>
<Binding Path="Permission.PermissionName" UpdateSourceTrigger="PropertyChanged">
<Binding.ValidationRules>
<valuerules:StringNotNullSpaceRule />
</Binding.ValidationRules>
</Binding>
</TextBox.Text>
</TextBox>
<TextBlock
Margin="20,0,0,0"
Text="类型:"
TextWrapping="Wrap" />
<ComboBox
x:Name="CBType"
DisplayMemberPath="Name"
ItemsSource="{Binding PermissionDict.DictDetails}"
SelectedIndex="0"
SelectedValuePath="Code">
<ComboBox.SelectedValue>
<Binding Path="Permission.PermissionType" UpdateSourceTrigger="PropertyChanged">
<Binding.ValidationRules>
<valuerules:StringNotNullSpaceRule />
</Binding.ValidationRules>
</Binding>
</ComboBox.SelectedValue>
</ComboBox>
</WrapPanel>
<StackPanel Grid.Row="3" Style="{StaticResource sp}">
<TextBlock Text="地址:" TextWrapping="Wrap" />
<TextBox
x:Name="TxtUrl"
MinWidth="280"
Text="{Binding Path=Permission.Url, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
</StackPanel>
<StackPanel Grid.Row="4" Style="{StaticResource sp}">
<TextBlock Text="权限:" TextWrapping="Wrap" />
<TextBox x:Name="TxtPermission" Text="{Binding Path=Permission.Perms, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
</StackPanel>
<StackPanel Grid.Row="5" Style="{StaticResource sp}">
<TextBlock Text="备注:" TextWrapping="Wrap" />
<TextBox x:Name="TxtRemark" Text="{Binding Path=Permission.Remark, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
<TextBlock
Margin="20,0,0,0"
Text="排序:"
TextWrapping="Wrap" />
<TextBox x:Name="TxtOrderNum">
<TextBox.Text>
<Binding Path="Permission.OrderNum" UpdateSourceTrigger="PropertyChanged">
<Binding.ValidationRules>
<valuerules:IntegerOverZeroRule />
</Binding.ValidationRules>
</Binding>
</TextBox.Text>
</TextBox>
</StackPanel>
</Grid>
</Grid>
</DockPanel>
</win:HideCloseWindow>