parent
7557154847
commit
8b19d9c7f2
|
|
@ -63,6 +63,8 @@ namespace CeramicProjectTool
|
||||||
if (loginResult)
|
if (loginResult)
|
||||||
{
|
{
|
||||||
MessageBox.Show("登录成功!");
|
MessageBox.Show("登录成功!");
|
||||||
|
new MainWindow().Show();
|
||||||
|
this.Close();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
<Window x:Class="CeramicProjectTool.MainWindow"
|
||||||
|
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:CeramicProjectTool"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
Title="MainWindow" Height="450" Width="800" Loaded="Window_Loaded">
|
||||||
|
<Grid>
|
||||||
|
<DockPanel>
|
||||||
|
<ToolBar DockPanel.Dock="Top" Height="30">
|
||||||
|
<Button x:Name="ModelConfigButton" Content="模块配置" Click="ModelConfigButton_Click"/>
|
||||||
|
<Separator/>
|
||||||
|
<Button x:Name="PermissionButton" Content="权限配置" Click="PermissionConfigButton_Click"/>
|
||||||
|
<Separator/>
|
||||||
|
</ToolBar>
|
||||||
|
<Frame DockPanel.Dock="Bottom"
|
||||||
|
x:Name="MainFrame"
|
||||||
|
NavigationUIVisibility="Hidden"
|
||||||
|
/>
|
||||||
|
</DockPanel>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
||||||
|
|
@ -0,0 +1,63 @@
|
||||||
|
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 CeramicProjectTool
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// MainWindow.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class MainWindow : Window
|
||||||
|
{
|
||||||
|
public MainWindow()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
private readonly Dictionary<string, Page> pageList = new Dictionary<string, Page>
|
||||||
|
{
|
||||||
|
{"configPage", new Pages.ModelConfigPage() },
|
||||||
|
{"permissionPage", new Pages.PermissionConfigPage() }
|
||||||
|
};
|
||||||
|
|
||||||
|
private string currentPage = "configPage";
|
||||||
|
private void menuOpen_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ModelConfigButton_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (currentPage == "configPage")
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
MainFrame.Navigate(pageList["configPage"]);
|
||||||
|
currentPage = "configPage";
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PermissionConfigButton_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (currentPage == "permissionPage")
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
MainFrame.Navigate(pageList["permissionPage"]);
|
||||||
|
currentPage = "permissionPage";
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
MainFrame.Navigate(pageList["configPage"]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,53 @@
|
||||||
|
using SqlSugar;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace CeramicProjectTool.Model
|
||||||
|
{
|
||||||
|
[SugarTable("nr_sys_mk")]
|
||||||
|
public sealed class MKModel
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
[id]
|
||||||
|
,[belongmkid]
|
||||||
|
,[mc]
|
||||||
|
,[gnurl]
|
||||||
|
,[isview]
|
||||||
|
,[xh]*/
|
||||||
|
/// <summary>
|
||||||
|
/// ID
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "id")]
|
||||||
|
public int Id { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "belongmkid")]
|
||||||
|
|
||||||
|
public int BelongMKId { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 模块名称
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "mc")]
|
||||||
|
public string MC { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 模块路径
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "gnurl")]
|
||||||
|
public string GNURL { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 是否可见
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "isview")]
|
||||||
|
|
||||||
|
public bool IsView { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 序号
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "xh")]
|
||||||
|
public int XH { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,59 @@
|
||||||
|
using SqlSugar;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace CeramicProjectTool.Model
|
||||||
|
{
|
||||||
|
[SugarTable("view_quanxian")]
|
||||||
|
public class PermissonModel
|
||||||
|
{
|
||||||
|
/* dbo.nr_sys_gn.mokuan,
|
||||||
|
* dbo.nr_sys_gn.biao,
|
||||||
|
* dbo.nr_sys_gn.gongneng,
|
||||||
|
* dbo.nr_sys_gn.xuhao,
|
||||||
|
* dbo.nr_z_quanxian.jsid,
|
||||||
|
* dbo.nr_z_quanxian.gnid,
|
||||||
|
* dbo.nr_z_yhjs.mingcheng*/
|
||||||
|
/// <summary>
|
||||||
|
/// 模块名称
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "mokuan")]
|
||||||
|
public string ModuleName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 表名
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "biao")]
|
||||||
|
public string Table { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 功能名称
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "gongneng")]
|
||||||
|
public string Gongneng { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 序号
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "xuhao")]
|
||||||
|
public int SeqNo { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 角色Id
|
||||||
|
/// </summary>
|
||||||
|
[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; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
using SqlSugar;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace CeramicProjectTool.Model
|
||||||
|
{
|
||||||
|
[SugarTable("nr_z_yhjs")]
|
||||||
|
public class RuleModel
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
id,
|
||||||
|
mingcheng
|
||||||
|
*/
|
||||||
|
[SugarColumn(ColumnName = "id")]
|
||||||
|
public int Id { get; set; }
|
||||||
|
[SugarColumn(ColumnName = "mingcheng")]
|
||||||
|
public string RuleName { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,96 @@
|
||||||
|
<Page x:Class="CeramicProjectTool.Pages.ModelConfigPage"
|
||||||
|
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:CeramicProjectTool.Pages"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="450" d:DesignWidth="800"
|
||||||
|
MinHeight="450"
|
||||||
|
MinWidth="800"
|
||||||
|
Title="模块配置"
|
||||||
|
Loaded="Page_Loaded"
|
||||||
|
>
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="200"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<ListView x:Name="ModelListView" Grid.Column="0" SelectionChanged="ModelListView_SelectionChanged">
|
||||||
|
<ListView.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBlock Text="{Binding MC}" FontSize="18"/>
|
||||||
|
</DataTemplate>
|
||||||
|
</ListView.ItemTemplate>
|
||||||
|
<ListView.ItemContainerStyle>
|
||||||
|
<Style>
|
||||||
|
<Setter Property="Control.HorizontalContentAlignment" Value="Stretch"/>
|
||||||
|
</Style>
|
||||||
|
</ListView.ItemContainerStyle>
|
||||||
|
</ListView>
|
||||||
|
<StackPanel Grid.Column="1" x:Name="ModelConfigView" Background="White">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="100"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid Grid.Row="0">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Grid Grid.Column="0">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<!-- /*
|
||||||
|
[id]
|
||||||
|
,[belongmkid]
|
||||||
|
,[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 Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Center" Orientation="Horizontal">
|
||||||
|
<TextBlock Text="模块名称: "/>
|
||||||
|
<TextBox Text="{Binding Path=SelectedMKModel.MC}" Width="100"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
<Grid Grid.Column="1">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<StackPanel Grid.Row="0" VerticalAlignment="Center" HorizontalAlignment="Center" Orientation="Horizontal" Margin="10">
|
||||||
|
<TextBlock Text="菜单Id: "/>
|
||||||
|
<TextBox Text="{Binding Path=SelectedMKModel.BelongMKId}" Width="100"/>
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Center" Orientation="Horizontal">
|
||||||
|
<TextBlock Text="模块页面地址: "/>
|
||||||
|
<TextBox Text="{Binding Path=SelectedMKModel.GNURL}" Width="auto"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
<Grid Grid.Column="2">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<StackPanel Grid.Row="0" VerticalAlignment="Center" HorizontalAlignment="Center" Orientation="Horizontal">
|
||||||
|
<TextBlock Text="是否可见: "/>
|
||||||
|
<CheckBox IsChecked="{Binding Path=SelectedMKModel.IsView}" />
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Center" Orientation="Horizontal">
|
||||||
|
<TextBlock Text="模块序号: "/>
|
||||||
|
<TextBox Text="{Binding Path=SelectedMKModel.XH}" />
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</Page>
|
||||||
|
|
@ -0,0 +1,58 @@
|
||||||
|
using CeramicProjectTool.Model;
|
||||||
|
using CeramicProjectTool.Util;
|
||||||
|
using CeramicProjectTool.ViewModel;
|
||||||
|
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 CeramicProjectTool.Pages
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// ModelConfigPage.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class ModelConfigPage : System.Windows.Controls.Page
|
||||||
|
{
|
||||||
|
private MKConfigViewModel configViewModel;
|
||||||
|
public ModelConfigPage()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
configViewModel = new MKConfigViewModel();
|
||||||
|
this.DataContext = configViewModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Page_Loaded(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
var modelList = configViewModel.GetMkList();
|
||||||
|
modelList.ContinueWith((task) =>
|
||||||
|
{
|
||||||
|
ModelListView.Dispatcher.Invoke(() =>
|
||||||
|
{
|
||||||
|
ModelListView.ItemsSource = task.Result;
|
||||||
|
ModelListView.SelectedIndex = 0;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,31 @@
|
||||||
|
<Page x:Class="CeramicProjectTool.Pages.PermissionConfigPage"
|
||||||
|
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:CeramicProjectTool.Pages"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="450" d:DesignWidth="800"
|
||||||
|
Title="权限配置" Loaded="Page_Loaded">
|
||||||
|
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="50"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<StackPanel Grid.Row="0">
|
||||||
|
|
||||||
|
</StackPanel>
|
||||||
|
<DataGrid Grid.Row="1" x:Name="permissonData" AutoGenerateColumns="False">
|
||||||
|
<DataGrid.Columns>
|
||||||
|
<DataGridTextColumn Header="模块名称" Binding="{Binding ModuleName}"/>
|
||||||
|
<DataGridTextColumn Header="表名" Binding="{Binding Table}"/>
|
||||||
|
<DataGridTextColumn Header="序号" Binding="{Binding SeqNo}"/>
|
||||||
|
<DataGridTextColumn Header="功能Id" Binding="{Binding Gnid}"/>
|
||||||
|
<DataGridTextColumn Header="功能" Binding="{Binding Gongneng}"/>
|
||||||
|
<DataGridTextColumn Header="角色Id" Binding="{Binding RuleId}"/>
|
||||||
|
<DataGridTextColumn Header="角色名称" Binding="{Binding RuleName}"/>
|
||||||
|
</DataGrid.Columns>
|
||||||
|
</DataGrid>
|
||||||
|
</Grid>
|
||||||
|
</Page>
|
||||||
|
|
@ -0,0 +1,44 @@
|
||||||
|
using CeramicProjectTool.ViewModel;
|
||||||
|
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 CeramicProjectTool.Pages
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// PermissionConfigPage.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class PermissionConfigPage : Page
|
||||||
|
{
|
||||||
|
private PermissonConfigViewModel viewModel;
|
||||||
|
public PermissionConfigPage()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
viewModel = new PermissonConfigViewModel();
|
||||||
|
this.DataContext = viewModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Page_Loaded(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
var task = viewModel.GetPermissons();
|
||||||
|
task.ContinueWith((t) =>
|
||||||
|
{
|
||||||
|
permissonData.Dispatcher.Invoke(() =>
|
||||||
|
{
|
||||||
|
permissonData.ItemsSource = t.Result;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,49 @@
|
||||||
|
using CeramicProjectTool.Model;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace CeramicProjectTool.Util
|
||||||
|
{
|
||||||
|
public static partial class DBHelper
|
||||||
|
{
|
||||||
|
public static bool Login(string userName, string pwd)
|
||||||
|
{
|
||||||
|
var sql = $"select top 1 1 from nr_z_yhzh where zhanghao=@userName and mima=@pwd";
|
||||||
|
var result = _db.Ado.GetInt(sql, new { userName, pwd });
|
||||||
|
if (result >= 1)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static async Task<List<MKModel>> GetModelList()
|
||||||
|
{
|
||||||
|
var result = await _db.Queryable<MKModel>().ToListAsync();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static async Task<List<PermissonModel>> GetPermissons()
|
||||||
|
{
|
||||||
|
var result = await _db.Queryable<PermissonModel>().ToListAsync();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
public static async Task<List<PermissonModel>> GetPermissonsByModule(string moduleName)
|
||||||
|
{
|
||||||
|
var result = await _db.Queryable<PermissonModel>().Where(x => x.ModuleName == moduleName).ToListAsync();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static async Task<List<RuleModel>> GetRules()
|
||||||
|
{
|
||||||
|
var result = await _db.Queryable<RuleModel>().ToListAsync();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -6,7 +6,7 @@ using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace CeramicProjectTool.Util
|
namespace CeramicProjectTool.Util
|
||||||
{
|
{
|
||||||
public static class DBHelper
|
public static partial class DBHelper
|
||||||
{
|
{
|
||||||
private static SqlSugar.SqlSugarClient _db;
|
private static SqlSugar.SqlSugarClient _db;
|
||||||
public static bool isInit = false;
|
public static bool isInit = false;
|
||||||
|
|
@ -31,18 +31,6 @@ namespace CeramicProjectTool.Util
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string connStr = "";
|
public static string connStr = "";
|
||||||
public static bool Login(string userName, string pwd)
|
|
||||||
{
|
|
||||||
var sql = $"select top 1 1 from nr_z_yhzh where zhanghao=@userName and mima=@pwd";
|
|
||||||
var result = _db.Ado.GetInt(sql, new { userName, pwd });
|
|
||||||
if (result >= 1)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,56 @@
|
||||||
|
using CeramicProjectTool.Model;
|
||||||
|
using CeramicProjectTool.Util;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace CeramicProjectTool.ViewModel
|
||||||
|
{
|
||||||
|
public class MKConfigViewModel : INotifyPropertyChanged
|
||||||
|
{
|
||||||
|
public event PropertyChangedEventHandler? PropertyChanged;
|
||||||
|
|
||||||
|
public void OnPropertyChanged(string propertyName)
|
||||||
|
{
|
||||||
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 选中的模块信息
|
||||||
|
/// </summary>
|
||||||
|
private MKModel? selectedMKModel;
|
||||||
|
|
||||||
|
public MKModel? SelectedMKModel
|
||||||
|
{
|
||||||
|
get { return selectedMKModel; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
selectedMKModel = value;
|
||||||
|
OnPropertyChanged(nameof(SelectedMKModel));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Task<List<MKModel>> GetMkList()
|
||||||
|
{
|
||||||
|
Task<List<MKModel>> modelList = DBHelper.GetModelList();
|
||||||
|
|
||||||
|
return modelList;
|
||||||
|
//modelList.ContinueWith((task) =>
|
||||||
|
//{
|
||||||
|
// ModelListView.Dispatcher.Invoke(() =>
|
||||||
|
// {
|
||||||
|
// ModelListView.ItemsSource = task.Result;
|
||||||
|
// });
|
||||||
|
//});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetSelectMKModel(MKModel model)
|
||||||
|
{
|
||||||
|
SelectedMKModel = model;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
using CeramicProjectTool.Model;
|
||||||
|
using CeramicProjectTool.Util;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace CeramicProjectTool.ViewModel
|
||||||
|
{
|
||||||
|
public class PermissonConfigViewModel : INotifyPropertyChanged
|
||||||
|
{
|
||||||
|
public event PropertyChangedEventHandler? PropertyChanged;
|
||||||
|
|
||||||
|
public void OnPropertyChanged(string propertyName)
|
||||||
|
{
|
||||||
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Task<List<PermissonModel>> GetPermissons()
|
||||||
|
{
|
||||||
|
var result = DBHelper.GetPermissons();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue