Update 程序配置页增加权限明细
This commit is contained in:
parent
8b19d9c7f2
commit
85b4b39237
|
@ -5,13 +5,13 @@
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:local="clr-namespace:CeramicProjectTool"
|
xmlns:local="clr-namespace:CeramicProjectTool"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Title="MainWindow" Height="450" Width="800" Loaded="Window_Loaded">
|
Title="MainWindow" Height="500" Width="800" MinHeight="500" MinWidth="800" Loaded="Window_Loaded">
|
||||||
<Grid>
|
<Grid>
|
||||||
<DockPanel>
|
<DockPanel>
|
||||||
<ToolBar DockPanel.Dock="Top" Height="30">
|
<ToolBar DockPanel.Dock="Top" Height="30">
|
||||||
<Button x:Name="ModelConfigButton" Content="模块配置" Click="ModelConfigButton_Click"/>
|
<Button x:Name="ModelConfigButton" Content="模块配置" Click="ModelConfigButton_Click"/>
|
||||||
<Separator/>
|
<Separator/>
|
||||||
<Button x:Name="PermissionButton" Content="权限配置" Click="PermissionConfigButton_Click"/>
|
<Button x:Name="PermissionButton" Content="权限列表" Click="PermissionConfigButton_Click"/>
|
||||||
<Separator/>
|
<Separator/>
|
||||||
</ToolBar>
|
</ToolBar>
|
||||||
<Frame DockPanel.Dock="Bottom"
|
<Frame DockPanel.Dock="Bottom"
|
||||||
|
|
|
@ -8,7 +8,7 @@ using System.Threading.Tasks;
|
||||||
namespace CeramicProjectTool.Model
|
namespace CeramicProjectTool.Model
|
||||||
{
|
{
|
||||||
[SugarTable("nr_sys_mk")]
|
[SugarTable("nr_sys_mk")]
|
||||||
public sealed class MKModel
|
public sealed class ModuleModel
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
[id]
|
[id]
|
||||||
|
@ -20,7 +20,7 @@ namespace CeramicProjectTool.Model
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ID
|
/// ID
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SugarColumn(ColumnName = "id")]
|
[SugarColumn(ColumnName = "id", IsPrimaryKey = true)]
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
|
@ -32,7 +32,7 @@ namespace CeramicProjectTool.Model
|
||||||
/// 模块名称
|
/// 模块名称
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SugarColumn(ColumnName = "mc")]
|
[SugarColumn(ColumnName = "mc")]
|
||||||
public string MC { get; set; }
|
public string ModuleName { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 模块路径
|
/// 模块路径
|
||||||
/// </summary>
|
/// </summary>
|
|
@ -7,7 +7,7 @@ using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace CeramicProjectTool.Model
|
namespace CeramicProjectTool.Model
|
||||||
{
|
{
|
||||||
[SugarTable("view_quanxian")]
|
[SugarTable(tableName: "nr_sys_gn")]
|
||||||
public class PermissonModel
|
public class PermissonModel
|
||||||
{
|
{
|
||||||
/* dbo.nr_sys_gn.mokuan,
|
/* dbo.nr_sys_gn.mokuan,
|
||||||
|
@ -17,43 +17,19 @@ namespace CeramicProjectTool.Model
|
||||||
* dbo.nr_z_quanxian.jsid,
|
* dbo.nr_z_quanxian.jsid,
|
||||||
* dbo.nr_z_quanxian.gnid,
|
* dbo.nr_z_quanxian.gnid,
|
||||||
* dbo.nr_z_yhjs.mingcheng*/
|
* dbo.nr_z_yhjs.mingcheng*/
|
||||||
/// <summary>
|
//Id
|
||||||
/// 模块名称
|
[SugarColumn(ColumnName = "id", IsPrimaryKey = true)]
|
||||||
/// </summary>
|
public int Id { get; set; }
|
||||||
[SugarColumn(ColumnName = "mokuan")]
|
[SugarColumn(ColumnName = "mokuan")]
|
||||||
public string ModuleName { get; set; }
|
public string ModuleName { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 表名
|
|
||||||
/// </summary>
|
|
||||||
[SugarColumn(ColumnName = "biao")]
|
[SugarColumn(ColumnName = "biao")]
|
||||||
public string Table { get; set; }
|
public string Table { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 功能名称
|
|
||||||
/// </summary>
|
|
||||||
[SugarColumn(ColumnName = "gongneng")]
|
[SugarColumn(ColumnName = "gongneng")]
|
||||||
public string Gongneng { get; set; }
|
public string Feature { get; set; }
|
||||||
/// <summary>
|
|
||||||
/// 序号
|
|
||||||
/// </summary>
|
|
||||||
[SugarColumn(ColumnName = "xuhao")]
|
[SugarColumn(ColumnName = "xuhao")]
|
||||||
public int SeqNo { get; set; }
|
public int SeqNo { get; set; }
|
||||||
/// <summary>
|
[SugarColumn(ColumnName = "jieshi")]
|
||||||
/// 角色Id
|
public string Remark { get; set; }
|
||||||
/// </summary>
|
public int gen { get; set; }
|
||||||
[SugarColumn(ColumnName = "jsid")]
|
|
||||||
public int RuleId { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 功能编号
|
|
||||||
/// </summary>
|
|
||||||
[SugarColumn(ColumnName = "gnid")]
|
|
||||||
public int Gnid { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 角色名称
|
|
||||||
/// </summary>
|
|
||||||
[SugarColumn(ColumnName = "mingcheng")]
|
|
||||||
public string RuleName { get; set; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ namespace CeramicProjectTool.Model
|
||||||
id,
|
id,
|
||||||
mingcheng
|
mingcheng
|
||||||
*/
|
*/
|
||||||
[SugarColumn(ColumnName = "id")]
|
[SugarColumn(ColumnName = "id", IsPrimaryKey = true)]
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
[SugarColumn(ColumnName = "mingcheng")]
|
[SugarColumn(ColumnName = "mingcheng")]
|
||||||
public string RuleName { get; set; }
|
public string RuleName { get; set; }
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:local="clr-namespace:CeramicProjectTool.Pages"
|
xmlns:local="clr-namespace:CeramicProjectTool.Pages"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DesignHeight="450" d:DesignWidth="800"
|
d:DesignHeight="600" d:DesignWidth="800"
|
||||||
MinHeight="450"
|
MinHeight="450"
|
||||||
MinWidth="800"
|
MinWidth="800"
|
||||||
Title="模块配置"
|
Title="模块配置"
|
||||||
|
@ -19,7 +19,7 @@
|
||||||
<ListView x:Name="ModelListView" Grid.Column="0" SelectionChanged="ModelListView_SelectionChanged">
|
<ListView x:Name="ModelListView" Grid.Column="0" SelectionChanged="ModelListView_SelectionChanged">
|
||||||
<ListView.ItemTemplate>
|
<ListView.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<TextBlock Text="{Binding MC}" FontSize="18"/>
|
<TextBlock Text="{Binding ModuleName}" FontSize="18"/>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ListView.ItemTemplate>
|
</ListView.ItemTemplate>
|
||||||
<ListView.ItemContainerStyle>
|
<ListView.ItemContainerStyle>
|
||||||
|
@ -28,11 +28,12 @@
|
||||||
</Style>
|
</Style>
|
||||||
</ListView.ItemContainerStyle>
|
</ListView.ItemContainerStyle>
|
||||||
</ListView>
|
</ListView>
|
||||||
<StackPanel Grid.Column="1" x:Name="ModelConfigView" Background="White">
|
<Grid Grid.Column="1" x:Name="ModelConfigView" Background="White">
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="100"/>
|
<RowDefinition Height="100"/>
|
||||||
<RowDefinition Height="*"/>
|
<RowDefinition Height="*"/>
|
||||||
|
<RowDefinition Height="50"/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<Grid Grid.Row="0">
|
<Grid Grid.Row="0">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
|
@ -45,52 +46,53 @@
|
||||||
<RowDefinition Height="*"/>
|
<RowDefinition Height="*"/>
|
||||||
<RowDefinition Height="*"/>
|
<RowDefinition Height="*"/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<!-- /*
|
<StackPanel Grid.Row="0" VerticalAlignment="Center" HorizontalAlignment="Left" Orientation="Horizontal">
|
||||||
[id]
|
<TextBlock Margin="10" Text="模块Id: "/>
|
||||||
,[belongmkid]
|
<TextBox Margin="10" Text="{Binding Path=SelectedModule.Id}" Width="100" IsReadOnly="True" />
|
||||||
,[mc]
|
|
||||||
,[gnurl]
|
|
||||||
,[isview]
|
|
||||||
,[xh]*/-->
|
|
||||||
<StackPanel Grid.Row="0" VerticalAlignment="Center" HorizontalAlignment="Center" Orientation="Horizontal">
|
|
||||||
<TextBlock Text="模块Id: "/>
|
|
||||||
<TextBox Text="{Binding Path=SelectedMKModel.Id}" Width="100" IsReadOnly="True" />
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Center" Orientation="Horizontal">
|
<StackPanel Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Left" Orientation="Horizontal">
|
||||||
<TextBlock Text="模块名称: "/>
|
<TextBlock Margin="10" Text="模块名称: "/>
|
||||||
<TextBox Text="{Binding Path=SelectedMKModel.MC}" Width="100"/>
|
<TextBox Margin="10" Text="{Binding Path=SelectedModule.ModuleName}" Width="100"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid Grid.Column="1">
|
<Grid Grid.Column="1" Grid.ColumnSpan="2">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="*"/>
|
<RowDefinition Height="*"/>
|
||||||
<RowDefinition Height="*"/>
|
<RowDefinition Height="*"/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<StackPanel Grid.Row="0" VerticalAlignment="Center" HorizontalAlignment="Center" Orientation="Horizontal" Margin="10">
|
<StackPanel Grid.Row="0" VerticalAlignment="Center" HorizontalAlignment="Left" Orientation="Horizontal">
|
||||||
<TextBlock Text="菜单Id: "/>
|
<TextBlock Margin="10" Text="菜单Id: "/>
|
||||||
<TextBox Text="{Binding Path=SelectedMKModel.BelongMKId}" Width="100"/>
|
<TextBox Margin="10" Text="{Binding Path=SelectedModule.BelongMKId}" Width="100"/>
|
||||||
|
<TextBlock Margin="10" Text="模块序号: "/>
|
||||||
|
<TextBox Margin="10" Text="{Binding Path=SelectedModule.XH}" IsReadOnly="True" />
|
||||||
|
<TextBlock Margin="10" Text="是否可见: "/>
|
||||||
|
<CheckBox Margin="10" IsChecked="{Binding Path=SelectedModule.IsView}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Center" Orientation="Horizontal">
|
<StackPanel Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Left" Orientation="Horizontal">
|
||||||
<TextBlock Text="模块页面地址: "/>
|
<TextBlock Margin="10" Text="模块地址: "/>
|
||||||
<TextBox Text="{Binding Path=SelectedMKModel.GNURL}" Width="auto"/>
|
<TextBox Margin="10" Text="{Binding Path=SelectedModule.GNURL}" Width="auto"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid Grid.Column="2">
|
|
||||||
<Grid.RowDefinitions>
|
</Grid>
|
||||||
<RowDefinition Height="*"/>
|
<StackPanel Grid.Row="1" Orientation="Vertical" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
|
||||||
<RowDefinition Height="*"/>
|
<Button Margin="10,0,0,10" Content="增加权限项" Height="40" Width="100"/>
|
||||||
</Grid.RowDefinitions>
|
<DataGrid Margin="10,0,0,0" x:Name="permissonData" AutoGenerateColumns="False" IsReadOnly="False">
|
||||||
<StackPanel Grid.Row="0" VerticalAlignment="Center" HorizontalAlignment="Center" Orientation="Horizontal">
|
<DataGrid.Columns>
|
||||||
<TextBlock Text="是否可见: "/>
|
<DataGridTextColumn Header="功能Id" Binding="{Binding Id}" IsReadOnly="True"/>
|
||||||
<CheckBox IsChecked="{Binding Path=SelectedMKModel.IsView}" />
|
<DataGridTextColumn Header="功能" Binding="{Binding Feature}" />
|
||||||
|
<DataGridTextColumn Header="序号" Binding="{Binding SeqNo}"/>
|
||||||
|
<DataGridTextColumn Header="模块名称" Binding="{Binding ModuleName}" Width="100"/>
|
||||||
|
<DataGridTextColumn Header="表名" Binding="{Binding Table}" Width="100"/>
|
||||||
|
<DataGridTextColumn Header="备注" Binding="{Binding Remark}" Width="100"/>
|
||||||
|
</DataGrid.Columns>
|
||||||
|
</DataGrid>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Center" Orientation="Horizontal">
|
<StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Center">
|
||||||
<TextBlock Text="模块序号: "/>
|
<Button x:Name="SaveBtn" Content="保存" Width="40" Margin="10" Click="SaveBtn_Click" />
|
||||||
<TextBox Text="{Binding Path=SelectedMKModel.XH}" />
|
<Button x:Name="ResetBtn" Content="重置" Width="40" Margin="10" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
</StackPanel>
|
|
||||||
</Grid>
|
|
||||||
</Page>
|
</Page>
|
||||||
|
|
|
@ -4,6 +4,7 @@ using CeramicProjectTool.ViewModel;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Security;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
@ -32,6 +33,31 @@ namespace CeramicProjectTool.Pages
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Page_Loaded(object sender, RoutedEventArgs e)
|
private void Page_Loaded(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void ModelListView_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||||
|
{
|
||||||
|
var datas = ((ListView)sender).ItemsSource as List<ModuleModel>;
|
||||||
|
var selectedIndex = ((ListView)sender).SelectedIndex;
|
||||||
|
var mkModel = datas?[selectedIndex == -1 ? 0 : selectedIndex];
|
||||||
|
if (mkModel != null)
|
||||||
|
{
|
||||||
|
configViewModel.SetSelectMKModel(mkModel);
|
||||||
|
var permissonList = await configViewModel.GetPermissons(mkModel.ModuleName);
|
||||||
|
if (permissonList != null)
|
||||||
|
{
|
||||||
|
permissonData.Dispatcher.Invoke(() =>
|
||||||
|
{
|
||||||
|
permissonData.ItemsSource = permissonList;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadData()
|
||||||
{
|
{
|
||||||
var modelList = configViewModel.GetMkList();
|
var modelList = configViewModel.GetMkList();
|
||||||
modelList.ContinueWith((task) =>
|
modelList.ContinueWith((task) =>
|
||||||
|
@ -39,20 +65,28 @@ namespace CeramicProjectTool.Pages
|
||||||
ModelListView.Dispatcher.Invoke(() =>
|
ModelListView.Dispatcher.Invoke(() =>
|
||||||
{
|
{
|
||||||
ModelListView.ItemsSource = task.Result;
|
ModelListView.ItemsSource = task.Result;
|
||||||
ModelListView.SelectedIndex = 0;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
private async void SaveBtn_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
var module = configViewModel.SelectedModule;
|
||||||
|
if (module == null)
|
||||||
|
{
|
||||||
|
MessageBox.Show("请选择一个模块");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
await configViewModel.UpdateModule(module);
|
||||||
|
var permissonList = permissonData.ItemsSource as List<PermissonModel>;
|
||||||
|
if (permissonList != null)
|
||||||
|
{
|
||||||
|
await configViewModel.UpdatePermissons(permissonList);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ModelListView_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
}
|
||||||
{
|
|
||||||
var datas = ((ListView)sender).ItemsSource as List<MKModel>;
|
|
||||||
var selectedIndex = ((ListView)sender).SelectedIndex;
|
|
||||||
var mkModel = datas?[selectedIndex == -1 ? 0 : selectedIndex];
|
|
||||||
if (mkModel != null)
|
|
||||||
{
|
|
||||||
configViewModel.SetSelectMKModel(mkModel);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,17 +14,16 @@
|
||||||
<RowDefinition Height="*"/>
|
<RowDefinition Height="*"/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<StackPanel Grid.Row="0">
|
<StackPanel Grid.Row="0">
|
||||||
|
<TextBox x:Name="searchBox" Height="40" TextInput="searchBox_TextInput" KeyDown="searchBox_KeyDown" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<DataGrid Grid.Row="1" x:Name="permissonData" AutoGenerateColumns="False">
|
<DataGrid Grid.Row="1" x:Name="permissonData" AutoGenerateColumns="False" IsReadOnly="True">
|
||||||
<DataGrid.Columns>
|
<DataGrid.Columns>
|
||||||
<DataGridTextColumn Header="模块名称" Binding="{Binding ModuleName}"/>
|
<DataGridTextColumn Header="功能Id" Binding="{Binding Id}"/>
|
||||||
<DataGridTextColumn Header="表名" Binding="{Binding Table}"/>
|
<DataGridTextColumn Header="功能" Binding="{Binding Feature}"/>
|
||||||
<DataGridTextColumn Header="序号" Binding="{Binding SeqNo}"/>
|
<DataGridTextColumn Header="序号" Binding="{Binding SeqNo}"/>
|
||||||
<DataGridTextColumn Header="功能Id" Binding="{Binding Gnid}"/>
|
<DataGridTextColumn Header="模块名称" Binding="{Binding ModuleName}" Width="100"/>
|
||||||
<DataGridTextColumn Header="功能" Binding="{Binding Gongneng}"/>
|
<DataGridTextColumn Header="表名" Binding="{Binding Table}" Width="100"/>
|
||||||
<DataGridTextColumn Header="角色Id" Binding="{Binding RuleId}"/>
|
<DataGridTextColumn Header="备注" Binding="{Binding Remark}" Width="100"/>
|
||||||
<DataGridTextColumn Header="角色名称" Binding="{Binding RuleName}"/>
|
|
||||||
</DataGrid.Columns>
|
</DataGrid.Columns>
|
||||||
</DataGrid>
|
</DataGrid>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using CeramicProjectTool.ViewModel;
|
using CeramicProjectTool.Model;
|
||||||
|
using CeramicProjectTool.ViewModel;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
@ -31,7 +32,22 @@ namespace CeramicProjectTool.Pages
|
||||||
|
|
||||||
private void Page_Loaded(object sender, RoutedEventArgs e)
|
private void Page_Loaded(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
var task = viewModel.GetPermissons();
|
LoadData();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadData(string searchText = "")
|
||||||
|
{
|
||||||
|
Task<List<PermissonModel>> task;
|
||||||
|
if (string.IsNullOrWhiteSpace(searchText))
|
||||||
|
{
|
||||||
|
task = viewModel.GetPermissons();
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
task = viewModel.GetPermissons(searchText);
|
||||||
|
|
||||||
|
}
|
||||||
task.ContinueWith((t) =>
|
task.ContinueWith((t) =>
|
||||||
{
|
{
|
||||||
permissonData.Dispatcher.Invoke(() =>
|
permissonData.Dispatcher.Invoke(() =>
|
||||||
|
@ -40,5 +56,23 @@ namespace CeramicProjectTool.Pages
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void searchBox_TextInput(object sender, TextCompositionEventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void searchBox_KeyDown(object sender, KeyEventArgs e)
|
||||||
|
{
|
||||||
|
var enterKey = Key.Enter;
|
||||||
|
if (e.Key == enterKey)
|
||||||
|
{
|
||||||
|
var searchText = searchBox.Text;
|
||||||
|
if (!string.IsNullOrWhiteSpace(searchText))
|
||||||
|
{
|
||||||
|
LoadData(searchText);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,12 +23,23 @@ namespace CeramicProjectTool.Util
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async Task<List<MKModel>> GetModelList()
|
public static async Task<List<ModuleModel>> GetModuleList()
|
||||||
{
|
{
|
||||||
var result = await _db.Queryable<MKModel>().ToListAsync();
|
var result = await _db.Queryable<ModuleModel>().ToListAsync();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static async Task<ModuleModel> Getodule(int id)
|
||||||
|
{
|
||||||
|
var result = await _db.Queryable<ModuleModel>().Where(i => i.Id == id).FirstAsync();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static async Task UpdateModule(ModuleModel module)
|
||||||
|
{
|
||||||
|
await _db.Updateable<ModuleModel>(module).ExecuteCommandAsync();
|
||||||
|
}
|
||||||
|
|
||||||
public static async Task<List<PermissonModel>> GetPermissons()
|
public static async Task<List<PermissonModel>> GetPermissons()
|
||||||
{
|
{
|
||||||
var result = await _db.Queryable<PermissonModel>().ToListAsync();
|
var result = await _db.Queryable<PermissonModel>().ToListAsync();
|
||||||
|
@ -40,6 +51,25 @@ namespace CeramicProjectTool.Util
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static async Task UpdatePermissons(List<PermissonModel> permissons)
|
||||||
|
{
|
||||||
|
var ids = permissons.Select(x => x.Id).ToList();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_db.BeginTran();
|
||||||
|
//await _db.Deleteable<PermissonModel>().Where(x => !ids.Contains(x.Id)).ExecuteCommandAsync();
|
||||||
|
await _db.Updateable(permissons).ExecuteCommandAsync();
|
||||||
|
_db.CommitTran();
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
_db.RollbackTran();
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static async Task<List<RuleModel>> GetRules()
|
public static async Task<List<RuleModel>> GetRules()
|
||||||
{
|
{
|
||||||
var result = await _db.Queryable<RuleModel>().ToListAsync();
|
var result = await _db.Queryable<RuleModel>().ToListAsync();
|
||||||
|
|
|
@ -21,22 +21,22 @@ namespace CeramicProjectTool.ViewModel
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 选中的模块信息
|
/// 选中的模块信息
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private MKModel? selectedMKModel;
|
private ModuleModel? selectedModulel;
|
||||||
|
|
||||||
public MKModel? SelectedMKModel
|
public ModuleModel? SelectedModule
|
||||||
{
|
{
|
||||||
get { return selectedMKModel; }
|
get { return selectedModulel; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
selectedMKModel = value;
|
selectedModulel = value;
|
||||||
OnPropertyChanged(nameof(SelectedMKModel));
|
OnPropertyChanged(nameof(SelectedModule));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Task<List<MKModel>> GetMkList()
|
public Task<List<ModuleModel>> GetMkList()
|
||||||
{
|
{
|
||||||
Task<List<MKModel>> modelList = DBHelper.GetModelList();
|
Task<List<ModuleModel>> modelList = DBHelper.GetModuleList();
|
||||||
|
|
||||||
return modelList;
|
return modelList;
|
||||||
//modelList.ContinueWith((task) =>
|
//modelList.ContinueWith((task) =>
|
||||||
|
@ -48,9 +48,31 @@ namespace CeramicProjectTool.ViewModel
|
||||||
//});
|
//});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetSelectMKModel(MKModel model)
|
public void SetSelectMKModel(ModuleModel model)
|
||||||
{
|
{
|
||||||
SelectedMKModel = model;
|
SelectedModule = model;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Task<List<PermissonModel>> GetPermissons()
|
||||||
|
{
|
||||||
|
var result = DBHelper.GetPermissons();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
public Task<List<PermissonModel>> GetPermissons(string searchText)
|
||||||
|
{
|
||||||
|
var result = DBHelper.GetPermissonsByModule(searchText);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task UpdateModule(ModuleModel module)
|
||||||
|
{
|
||||||
|
await DBHelper.UpdateModule(module);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task UpdatePermissons(List<PermissonModel> permissons)
|
||||||
|
{
|
||||||
|
await DBHelper.UpdatePermissons(permissons);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,5 +24,10 @@ namespace CeramicProjectTool.ViewModel
|
||||||
var result = DBHelper.GetPermissons();
|
var result = DBHelper.GetPermissons();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
public Task<List<PermissonModel>> GetPermissons(string searchText)
|
||||||
|
{
|
||||||
|
var result = DBHelper.GetPermissonsByModule(searchText);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue