Bladeren bron

修改菜单

ltwork 1 jaar geleden
bovenliggende
commit
fa5a27de4c

+ 1 - 0
BlankApp1/BizService/IMenuService.cs

@@ -10,5 +10,6 @@ namespace BizService
 {
     public  interface IMenuService : IBaseService<Menu>
     {
+        public List<Menu> FindAllByParentId(int parentId);
     }
 }

+ 5 - 1
BlankApp1/BizService/MenuService.cs

@@ -10,10 +10,14 @@ namespace BizService
 {
     public  class MenuService : BaseService<Menu>, IMenuService
     {
-
+      
         public MenuService()
         {
 
         }
+        public List<Menu> FindAllByParentId(int parentId)
+        {
+            return base.GetList(x => x.ParentId == parentId);
+        }
     }
 }

+ 162 - 45
BlankApp1/BlankApp1/ViewModels/SystemManageViewModel/Dialogs/AddEditMenuViewModel.cs

@@ -2,6 +2,7 @@
 using BizService;
 using Model.Dto;
 using Model.Entities;
+using PLCTool.Models;
 using Prism.Commands;
 using Prism.Events;
 using Prism.Mvvm;
@@ -9,6 +10,7 @@ using Prism.Services.Dialogs;
 using System;
 using System.Collections.Generic;
 using System.Collections.ObjectModel;
+using System.Data;
 using System.IO;
 using System.Linq;
 using System.Text;
@@ -27,7 +29,7 @@ namespace PLCTool.ViewModels.SystemManageViewModel.Dialogs
         private readonly IMapper _mapper;
         private List<MenuDto> allMenuInfoList = new List<MenuDto>();
         private string basePath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Images");
-
+        private string initMenuHeader;
         private int id = 0;
         public AddEditMenuViewModel(IEventAggregator aggregator, IMenuService iMenuService, IMapper mapper)
         {
@@ -39,15 +41,72 @@ namespace PLCTool.ViewModels.SystemManageViewModel.Dialogs
             SureCommand = new DelegateCommand<string>(Sure);
             CancelCommand = new DelegateCommand(Close);
             ChangeImageCommand = new DelegateCommand(ChangeImage);
+         
+            UpCommand = new DelegateCommand<object>(DataUp);
+            DownCommand = new DelegateCommand<object>(DataDown);
             GetMenus();
           
 
         }
 
+        private void DataDown(object obj)
+        {
+            {
+                int id = Convert.ToInt32(obj);
+                var findScheExist = MenuList.FirstOrDefault(x => x.Index == id);
+                if (findScheExist != null)
+                {
+
+                    int index = MenuList.IndexOf(findScheExist);
+                    if (index != -1)
+                    {
+                        if (index == MenuList.Count - 1)
+                            return;
+                        MenuList.RemoveAt(index);
+                        index = index + 1;
+                        MenuList.Insert(index, findScheExist);
+                        //现在d的排序
+                        IndexOrder = MenuList.ToList().FindIndex(x => x.MenuHeader == initMenuHeader) + 1;
+                    }
+
+
+                }
+            }
+        }
+
+        private void DataUp(object obj)
+        {
+            int id = Convert.ToInt32(obj);
+            var findScheExist = MenuList.FirstOrDefault(x => x.Index == id);
+            if (findScheExist != null)
+            {
+
+                int index = MenuList.IndexOf(findScheExist);
+                if (index != -1)
+                {
+                    if (index == 0)
+                        return;
+                    MenuList.RemoveAt(index);
+                    index = index - 1;
+                    MenuList.Insert(index, findScheExist);
+                    //现在d的排序
+                    IndexOrder = MenuList.ToList().FindIndex(x => x.MenuHeader == initMenuHeader)+1;
+                }
+
+
+            }
+
+        }
+
+        private void ChangeOrder()
+        {
        
+        }
+
+
 
         #region idialog接口实现
-        public string Title { set; get; } = "新增用户";
+        public string Title { set; get; } = "新增菜单";
 
         public event Action<IDialogResult> RequestClose;
 
@@ -76,13 +135,34 @@ namespace PLCTool.ViewModels.SystemManageViewModel.Dialogs
                         var findMenu = allMenuInfoList.FirstOrDefault(x => x.MenuId == id);
                         if (findMenu != null)
                         {
+                            //防止改名后找不到
+                            initMenuHeader = findMenu.MenuHeader;
                             MenuHeader = findMenu.MenuHeader;
                             TargetView = findMenu.TargetView;
                             ParentId = findMenu.ParentId;
-                            MenuIcon = Path.Combine(basePath, findMenu.MenuIcon); 
-                            Index = findMenu.Index;
+                            if (!string.IsNullOrEmpty(findMenu.MenuIcon))
+                            {
+                                IsChangeImg = true;
+                                MenuIcon = Path.Combine(basePath, findMenu.MenuIcon);
+                            }
+                            else
+                            {
+                                IsChangeImg = false;
+                            }
+                          
+                            IndexOrder = findMenu.Index;
+                            //查找这个ParentId下的所有菜单
+                            var findMenus=_iMenuService.FindAllByParentId(ParentId).OrderBy(x=>x.Index);
+                            foreach(var each in  findMenus)
+                            {
+                                MenuList.Add(new MenuDto
+                                {
+                                    MenuHeader= each.MenuHeader,
+                                    Index=each.Index,
+                                });
+                            }
                         }
-                        
+
                     }
 
                 }
@@ -105,33 +185,42 @@ namespace PLCTool.ViewModels.SystemManageViewModel.Dialogs
 
                 if (openFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                 {
-                    // 用户选择了文件
-                    string filePath = openFileDialog.FileName;
-                    string fileName = Path.GetFileName(filePath);
-                    string directoryPath = Path.GetDirectoryName(filePath);
-                    string destinationPath = Path.Combine(basePath, fileName);
-                    //就是选择当前文件下的图片,就不复制图片了
-                    if(directoryPath == basePath)
-                    {
-                        MenuIcon = destinationPath;
-                    }
-                    else
-                    {
-                        // 检查目标文件夹中是否已存在同名文件
-                        if (File.Exists(destinationPath))
+                    try {
+                        // 用户选择了文件
+                        string filePath = openFileDialog.FileName;
+                        string fileName = Path.GetFileName(filePath);
+                        string directoryPath = Path.GetDirectoryName(filePath);
+                        string destinationPath = Path.Combine(basePath, fileName);
+                        //就是选择当前文件下的图片,就不复制图片了
+                        if (directoryPath == basePath)
                         {
-                            // 如果存在,可以选择覆盖或抛出异常
-                            System.Windows.MessageBox.Show("已存在此图片名!", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
-                            return;
+                            MenuIcon = destinationPath;
                         }
                         else
                         {
-                            // 如果不存在,则复制文件
-                            File.Copy(filePath, destinationPath);
-                            MenuIcon = destinationPath;
-
+                            // 检查目标文件夹中是否已存在同名文件
+                            if (File.Exists(destinationPath))
+                            {
+                                // 如果存在,可以选择覆盖或抛出异常
+                                System.Windows.MessageBox.Show("已存在此图片名!", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
+                                return;
+                            }
+                            else
+                            {
+                                // 如果不存在,则复制文件
+                                File.Copy(filePath, destinationPath);
+                                MenuIcon = destinationPath;
+
+                            }
                         }
                     }
+                    catch(Exception ex) 
+                    { 
+
+                    }
+                 
+
+                        
                
                 }
             }
@@ -161,18 +250,18 @@ namespace PLCTool.ViewModels.SystemManageViewModel.Dialogs
                 System.Windows.MessageBox.Show("请填写菜单界面!", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
                 return;
             }
-            if (string.IsNullOrEmpty(MenuIcon))
-            {
-                System.Windows.MessageBox.Show("请选择图标!", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
-                return;
-            }
+            //if (string.IsNullOrEmpty(MenuIcon))
+            //{
+            //    System.Windows.MessageBox.Show("请选择图标!", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
+            //    return;
+            //}
           
             //判断是否存在用户名
 
             var findResult = allMenuInfoList.FirstOrDefault(x => x.MenuHeader == MenuHeader);
             if (findResult != null)
             {
-                if (Title == "新增用户")
+                if (Title == "新增菜单")
                 {
                     System.Windows.MessageBox.Show("已存在此菜单名!", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
                     return;
@@ -189,20 +278,20 @@ namespace PLCTool.ViewModels.SystemManageViewModel.Dialogs
             }
 
 
-            if (Title == "新增用户")
+            if (Title == "新增菜单")
             {
-                AddUser();
+                AddMenu();
             }
             else
             {
-                EditUser();
+                EditMenu();
 
             }
 
             RequestClose?.Invoke(new Prism.Services.Dialogs.DialogResult(ButtonResult.OK));
         }
 
-        private void AddUser()
+        private void AddMenu()
         {
 
             ////添加到数据库user表中
@@ -232,7 +321,7 @@ namespace PLCTool.ViewModels.SystemManageViewModel.Dialogs
             //}
 
         }
-        private void EditUser()
+        private void EditMenu()
         {
             Menu menu = new Menu()
             {
@@ -241,14 +330,28 @@ namespace PLCTool.ViewModels.SystemManageViewModel.Dialogs
                 TargetView = TargetView,
                 ParentId = ParentId,
                 MenuIcon= Path.GetFileName(MenuIcon),
-                Index =Index
+                Index =IndexOrder
 
             };
             //修改到数据库user表中
             bool isedit = _iMenuService.Edit(menu);
+            //修改其他的排序编号
+            var otherMenus = _iMenuService.FindAllByParentId(ParentId);
+            foreach(var otherMenu in otherMenus )
+            {
+                if(otherMenu.MenuId == id )
+                {
+                    continue;
+                }
+                //更新排序
+                otherMenu.Index = MenuList.ToList().FindIndex(x => x.MenuHeader == otherMenu.MenuHeader) + 1; ;
+              
+                _iMenuService.Edit(otherMenu);
+              
+            }
             if (isedit)
             {
-                System.Windows.MessageBox.Show("修改用户成功", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
+                System.Windows.MessageBox.Show("修改菜单成功", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
 
             }
            
@@ -272,9 +375,10 @@ namespace PLCTool.ViewModels.SystemManageViewModel.Dialogs
         public DelegateCommand CancelCommand { set; get; }
 
         public DelegateCommand ChangeImageCommand { set; get; }
-        
-
+        public DelegateCommand ChangeOrderCommand { set; get; }
 
+        public DelegateCommand<object> DownCommand { set; get; }
+        public DelegateCommand<object> UpCommand { set; get; }
         #endregion
         #region 变量绑定
         private string menuHeader;
@@ -303,11 +407,11 @@ namespace PLCTool.ViewModels.SystemManageViewModel.Dialogs
             get { return menuIcon; }
             set { menuIcon = value; RaisePropertyChanged(); }
         }
-        private int index;
-        public int Index
+        private int indexOrder;
+        public int IndexOrder
         {
-            get { return index; }
-            set { index = value; RaisePropertyChanged(); }
+            get { return indexOrder; }
+            set { indexOrder = value; RaisePropertyChanged(); }
         }
         
      
@@ -318,6 +422,19 @@ namespace PLCTool.ViewModels.SystemManageViewModel.Dialogs
             get { return describe; }
             set { describe = value; RaisePropertyChanged(); }
         }
+        private bool isChangeImg=true;
+        public bool IsChangeImg
+        {
+            get { return isChangeImg; }
+            set { isChangeImg = value; RaisePropertyChanged(); }
+        }
+
+        private ObservableCollection<MenuDto> menuList = new ObservableCollection<MenuDto>();
+        public ObservableCollection<MenuDto> MenuList
+        {
+            get { return menuList; }
+            set { SetProperty(ref menuList, value); }
+        }
 
         #endregion
     }

+ 25 - 14
BlankApp1/BlankApp1/ViewModels/SystemManageViewModel/Dialogs/AddEditUserViewModel.cs

@@ -1,5 +1,6 @@
 using AutoMapper;
 using BizService;
+using Microsoft.Extensions.Logging;
 using Model.Dto;
 using Model.Entities;
 using Prism.Commands;
@@ -27,17 +28,19 @@ namespace PLCTool.ViewModels.SystemManageViewModel.Dialogs
         private readonly IRoleService _iRoleService;
         private readonly IUserRoleService _iUserRoleService;
         private readonly IMapper _mapper;
+        private readonly ILogger _logger;
         private List<UserDto> allUserInfoList = new List<UserDto>();
         private List<Role> allRoles = new List<Role>();
        
         private int id = 0;
-        public AddEditUserViewModel(IEventAggregator aggregator, IUserService iUserService, IRoleService iRoleService, IUserRoleService iUserRoleService,IMapper mapper)
+        public AddEditUserViewModel(IEventAggregator aggregator, IUserService iUserService, IRoleService iRoleService, IUserRoleService iUserRoleService,IMapper mapper, ILogger logger)
         {
             _aggregator = aggregator;
             _iUserService = iUserService;
             _iRoleService = iRoleService;
             _iUserRoleService= iUserRoleService;
             _mapper = mapper;
+            _logger = logger;
             CloseCommand = new DelegateCommand(Close);
             SureCommand = new DelegateCommand<string>(Sure);
             CancelCommand = new DelegateCommand(Close);
@@ -75,23 +78,31 @@ namespace PLCTool.ViewModels.SystemManageViewModel.Dialogs
                 {
                     if (item != null)
                     {
-                        Title = "修改用户";
-                        id = item;
-                        var findUser = allUserInfoList.FirstOrDefault(x => x.Id == id);
-                        if(findUser!=null)
+                        try
                         {
-                            UserName = findUser.UserName;
-                            PassWord = findUser.Password;
-                            PassWordAgain= findUser.Password;
-                            Describe = findUser.Description;
+                            Title = "修改用户";
+                            id = item;
+                            var findUser = allUserInfoList.FirstOrDefault(x => x.Id == id);
+                            if (findUser != null)
+                            {
+                                UserName = findUser.UserName;
+                                PassWord = findUser.Password;
+                                PassWordAgain = findUser.Password;
+                                Describe = findUser.Description;
+                            }
+                            //查找角色
+                            var findUserRole = _iUserRoleService.QueryList().FirstOrDefault(x => x.UserId == id);
+                            if (findUserRole != null)
+                            {
+                                int roleId = (int)findUserRole.RoleId;
+                                SelectRole = allRoles.FirstOrDefault(x => x.Id == roleId)?.Name;
+                            }
                         }
-                        //查找角色
-                        var findUserRole = _iUserRoleService.QueryList().FirstOrDefault(x => x.UserId == id);
-                        if(findUserRole!=null)
+                        catch(Exception ex)
                         {
-                            int roleId = (int)findUserRole.RoleId;
-                            SelectRole = allRoles.FirstOrDefault(x => x.Id == roleId).Name;
+                            _logger.LogError(ex.ToString());
                         }
+                       
                     }
 
                 }

+ 1 - 1
BlankApp1/BlankApp1/ViewModels/SystemManageViewModel/MenuManageViewModel.cs

@@ -120,7 +120,7 @@ namespace PLCTool.ViewModels.SystemManageViewModel
                 }
             }
           
-            MenuInfoList = new ObservableCollection<MenuDto>(allMenuInfoList);
+            MenuInfoList = new ObservableCollection<MenuDto>(allMenuInfoList.OrderBy(x=>x.ParentId).ThenBy(x=>x.Index));
         }
 
         /// <summary>

+ 11 - 0
BlankApp1/BlankApp1/ViewModels/SystemManageViewModel/RoleManageViewModel.cs

@@ -3,6 +3,7 @@ using BizService;
 using Microsoft.Extensions.Logging;
 using Model.Dto;
 using Model.Entities;
+using PLCTool.Common;
 using PLCTool.Controls;
 using PLCTool.Events;
 using PLCTool.Models;
@@ -101,6 +102,16 @@ namespace PLCTool.ViewModels.SystemManageViewModel
         private void Delete(object obj)
         {
             int id = Convert.ToInt32(obj);
+            if (_iRoleService.Find(id)?.Name == "系统管理员")
+            {
+                MessageBox.Show("系统管理员角色无法删除!", "确认", MessageBoxButton.OK, MessageBoxImage.Information);
+                return;
+            }
+            if (id==Appsession.RoleId)
+            {
+                MessageBox.Show("此角色与当前登录角色相同,无法删除!", "确认", MessageBoxButton.OK, MessageBoxImage.Information);
+                return;
+            }
             MessageBoxResult boxResult = MessageBox.Show("确认删除此条数据?", "确认", MessageBoxButton.OKCancel, MessageBoxImage.Question);
             if (boxResult == MessageBoxResult.OK)
             {

+ 15 - 4
BlankApp1/BlankApp1/ViewModels/SystemManageViewModel/UserManageViewModel.cs

@@ -1,6 +1,7 @@
 using AutoMapper;
 using BizService;
 using Microsoft.Extensions.Logging;
+using Microsoft.VisualBasic.ApplicationServices;
 using Model.Dto;
 using Model.Entities;
 using PLCTool.Common;
@@ -98,7 +99,12 @@ namespace PLCTool.ViewModels.SystemManageViewModel
         private void EditUser(object obj)
         {
             int id = Convert.ToInt32(obj);
-     
+            var user = _iUserService.Find(id);
+            if ((user != null) && (user.UserName == "admin"))
+            {
+                MessageBox.Show("管理员用户无法编辑!", "确认", MessageBoxButton.OK, MessageBoxImage.Information);
+                return;
+            }
             DialogParameters parm = new DialogParameters();
             parm.Add("Key", id);
             //蒙层显示
@@ -118,9 +124,15 @@ namespace PLCTool.ViewModels.SystemManageViewModel
         {
             int id = Convert.ToInt32(obj);
             var user = _iUserService.Find(id);
-            if (user != null)
+            if ((user != null)&&(user.UserName=="admin"))
+            {
+                MessageBox.Show("管理员用户无法删除!", "确认", MessageBoxButton.OK, MessageBoxImage.Information);
+                return;
+            }
+            if (id == Appsession.UserId)
             {
-                 MessageBox.Show("管理员用户无法删除!", "确认", MessageBoxButton.OK, MessageBoxImage.Information);
+                MessageBox.Show("此用户与当前登录用户相同,无法删除!", "确认", MessageBoxButton.OK, MessageBoxImage.Information);
+                return;
             }
             MessageBoxResult boxResult = MessageBox.Show("确认删除此条数据?", "确认", MessageBoxButton.OKCancel, MessageBoxImage.Question);
             if (boxResult == MessageBoxResult.OK)
@@ -180,7 +192,6 @@ namespace PLCTool.ViewModels.SystemManageViewModel
         {
             var conUsers = (from a in allUserInfoList
                             where (string.IsNullOrEmpty(UserName) ? true : (a.UserName.Contains(UserName)))
-                             
                                select a).ToList();
             //默认显示的第一页
 

+ 1 - 1
BlankApp1/BlankApp1/Views/BasicConfigView/CopySchView.xaml

@@ -30,7 +30,7 @@
                     <DataGridTemplateColumn CanUserResize="False" Width="50">
                         <DataGridTemplateColumn.HeaderTemplate>
                             <DataTemplate>
-                                <CheckBox Content="全选" IsChecked="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=UserControl}, Path=AllSelected}" Foreground="White" >
+                                <CheckBox Content="全选" IsChecked="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=UserControl}, Path=AllSelected}" >
                                     <i:Interaction.Triggers>
                                         <i:EventTrigger EventName="Checked">
                                             <i:InvokeCommandAction  Command="{Binding DataContext.SelectAllCommand, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}" CommandParameter="{Binding IsSelectAll, ElementName=qx}"/>

+ 1 - 1
BlankApp1/BlankApp1/Views/MainWindow.xaml

@@ -114,7 +114,7 @@
                 <Image Source="../Assets/Images/register.png" Height="21" Width="21"></Image>
                
                 <Menu VerticalAlignment="Center" Width="auto">
-                    <MenuItem Header="{Binding UserName}" Width="auto" Command="{Binding LoginOutCommand}">
+                    <MenuItem Header="{Binding UserName}" Width="auto">
                         <!--<MenuItem Header="注销" Width="60" Command="{Binding LoginOutCommand}"/>-->
                     </MenuItem>
                 </Menu>

+ 52 - 20
BlankApp1/BlankApp1/Views/SystemManageView/Dialogs/AddEditMenuView.xaml

@@ -7,17 +7,17 @@
              xmlns:prism="http://prismlibrary.com/"
              xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
              xmlns:pass="clr-namespace:PLCTool.Common.Extension"
-             Height="300" Width="400" BorderBrush="#CBCBCB" BorderThickness="1">
+             Height="400" Width="400" BorderBrush="#CBCBCB" BorderThickness="1">
 
     <Grid>
         <Grid.RowDefinitions>
             <RowDefinition Height="20"/>
-            <RowDefinition />
-            <RowDefinition />
-            <RowDefinition />
-            <RowDefinition />
-            <RowDefinition />
-            <RowDefinition />
+            <RowDefinition Height="40" />
+            <RowDefinition Height="40"/>
+            <RowDefinition  />
+            <RowDefinition Height="60" />
+      
+        
         </Grid.RowDefinitions>
 
         <StackPanel Orientation="Horizontal" Grid.Row="1" HorizontalAlignment="Center">
@@ -25,26 +25,58 @@
             <TextBox  Height="28" Width="120" Text="{Binding MenuHeader}" />
         </StackPanel>
       
-        <StackPanel Orientation="Horizontal" Grid.Row="2" HorizontalAlignment="Center">
+        <!--<StackPanel Orientation="Horizontal" Grid.Row="2" HorizontalAlignment="Center">
             <TextBlock Text="父Id:"  Style="{StaticResource NormalTextBlockStyle}" Margin="10,0,5,0" TextAlignment="Right" Width="80"/>
             <TextBox  Height="28" Width="120" Text="{Binding ParentId}"  />
-        </StackPanel>
-        <StackPanel Orientation="Horizontal" Grid.Row="3" HorizontalAlignment="Center">
+        </StackPanel>-->
+        <StackPanel Orientation="Horizontal" Grid.Row="2" HorizontalAlignment="Center">
             <TextBlock Text="图标:"  Style="{StaticResource NormalTextBlockStyle}" Margin="10,0,5,0" TextAlignment="Right" Width="80"/>
-            <Image Source="{Binding MenuIcon}" Width="20" Height="20" HorizontalAlignment="Left"></Image>
-            <Button  Content="更换图标" Width="80"  Margin="5,0"  Command="{Binding ChangeImageCommand}"  Style="{StaticResource NormalButtonStyle}" />
+            <Image Source="{Binding MenuIcon}" Width="20" Height="20" Margin="0,0,10,0" HorizontalAlignment="Left"></Image>
+            <Button  Content="更换图标" Width="80"  Margin="10,0,0,0"  Command="{Binding ChangeImageCommand}" IsEnabled="{Binding IsChangeImg}" Style="{StaticResource NormalButtonStyle}" />
         </StackPanel>
 
 
-        <StackPanel Orientation="Horizontal"  Grid.Row="4" HorizontalAlignment="Center">
-            <TextBlock Text="排序:"  Style="{StaticResource NormalTextBlockStyle}" Margin="10,0,5,0" TextAlignment="Right" Width="80"/>
-            <TextBox  Height="28" Width="120" Text="{Binding Index}" />
-        </StackPanel>
-        <StackPanel Orientation="Horizontal" Grid.Row="5" HorizontalAlignment="Center">
-            <TextBlock Text="描述:"  Style="{StaticResource NormalTextBlockStyle}" Margin="10,0,5,0" TextAlignment="Right" Width="80" />
-            <TextBox  Height="28" Width="220" Text="{Binding Describe}" />
+        <StackPanel Orientation="Vertical"  Grid.Row="3" HorizontalAlignment="Center">
+            <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,5">
+                <TextBlock Text="排序:"  Style="{StaticResource NormalTextBlockStyle}" Margin="10,0,5,0" TextAlignment="Right" Width="80"/>
+                <TextBlock Text="{Binding IndexOrder}"  Style="{StaticResource NormalTextBlockStyle}"  TextAlignment="Left" Width="120"/>
+            </StackPanel>
+            <DataGrid  Grid.Row="2"  Style="{StaticResource MyDataGridSyle}" VerticalScrollBarVisibility="Visible"
+  ColumnHeaderStyle="{StaticResource ColumnHeaderStyle}"  RowHeaderStyle="{StaticResource RowHeaderStyle}" RowStyle="{StaticResource DataGridRowtyle}"  AlternationCount="2"
+ ItemsSource="{Binding MenuList}" Width="260"  >
+
+                <DataGrid.Columns >
+                    <DataGridTextColumn Header="菜单" Binding="{Binding MenuHeader}" CellStyle="{StaticResource MyDataGridCellStyle}"/>
+                    <DataGridTemplateColumn Header="操作" Width="120" CellStyle="{StaticResource MyDataGridCellStyle}">
+                        <DataGridTemplateColumn.CellTemplate>
+                            <DataTemplate>
+                                <StackPanel Orientation="Horizontal">
+                                    <Button  Width="auto" Background="Transparent" HorizontalContentAlignment ="Left" Foreground="Black" Height="25" BorderThickness="0"
+       Command="{Binding DataContext.UpCommand, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=DataGrid}}" CommandParameter="{Binding Index}" Cursor="Hand" Margin="0,0,10,0" >
+
+                                        <StackPanel Orientation="Horizontal">
+                                            <TextBlock  Text="上移↑" VerticalAlignment="Center" Foreground="Blue"/>
+                                        </StackPanel>
+                                    </Button>
+                                    <Button  Width="auto" Background="Transparent" HorizontalContentAlignment ="Left" Foreground="Black" Height="25" BorderThickness="0"
+       Command="{Binding DataContext.DownCommand, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=DataGrid}}" CommandParameter="{Binding Index}" Cursor="Hand" Margin="0,0,10,0">
+
+                                        <StackPanel Orientation="Horizontal">
+                                            <TextBlock  Text="下移↓" VerticalAlignment="Center" Foreground="Blue"/>
+                                        </StackPanel>
+                                    </Button>
+
+                                </StackPanel>
+                            </DataTemplate>
+                        </DataGridTemplateColumn.CellTemplate>
+                    </DataGridTemplateColumn>
+                </DataGrid.Columns>
+
+            </DataGrid>
+
         </StackPanel>
-        <StackPanel Orientation="Horizontal" Grid.Row="6" HorizontalAlignment="Center">
+        
+        <StackPanel Orientation="Horizontal" Grid.Row="4" HorizontalAlignment="Center">
 
             <Button  Content="取消" Width="80"  Margin="5,0"  Command="{Binding CancelCommand}" Opacity="0.7" Style="{StaticResource NormalButtonStyle}" />
             <Button  Content="确认" Width="80"  Margin="5,0"  Command="{Binding SureCommand}" Style="{StaticResource NormalButtonStyle}" />

+ 3 - 3
BlankApp1/BlankApp1/Views/SystemManageView/Dialogs/AddEditUserView.xaml

@@ -7,7 +7,7 @@
              xmlns:prism="http://prismlibrary.com/"
              xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
              xmlns:pass="clr-namespace:PLCTool.Common.Extension"
-             Height="300" Width="400" BorderBrush="#CBCBCB" BorderThickness="1">
+             Height="320" Width="400" BorderBrush="#CBCBCB" BorderThickness="1">
   
     <Grid>
         <Grid.RowDefinitions>
@@ -28,7 +28,7 @@
         <StackPanel Orientation="Horizontal" Grid.Row="2" HorizontalAlignment="Center">
             <TextBlock Text="密码:"  Style="{StaticResource NormalTextBlockStyle}" Margin="10,0,5,0" TextAlignment="Right" Width="80"/>
             <!--<ComboBox  Height="28" Width="120" ItemsSource="{Binding PLCVars}" SelectedItem="{Binding SelectPLCVar}" />-->
-            <PasswordBox Margin="0,10" Width="120" Height="25" pass:PassWordExtensions.PassWord="{Binding PassWord, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
+            <PasswordBox Margin="0,10" Width="120" Height="28" pass:PassWordExtensions.PassWord="{Binding PassWord, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
 DockPanel.Dock="Top" Cursor="IBeam">
                 <i:Interaction.Behaviors>
                     <pass:PasswordBehavior/>
@@ -42,7 +42,7 @@ DockPanel.Dock="Top" Cursor="IBeam">
         <StackPanel Orientation="Horizontal" Grid.Row="3" HorizontalAlignment="Center">
             <TextBlock Text="密码:"  Style="{StaticResource NormalTextBlockStyle}" Margin="10,0,5,0" TextAlignment="Right" Width="80"/>
             <!--<ComboBox  Height="28" Width="120" ItemsSource="{Binding PLCVars}" SelectedItem="{Binding SelectPLCVar}" />-->
-            <PasswordBox Margin="0,10" Width="120" Height="25" pass:PassWordExtensions.PassWord="{Binding PassWordAgain, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
+            <PasswordBox Margin="0,10" Width="120" Height="28" pass:PassWordExtensions.PassWord="{Binding PassWordAgain, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                 DockPanel.Dock="Top" Cursor="IBeam">
                 <i:Interaction.Behaviors>
                     <pass:PasswordBehavior/>

+ 3 - 3
BlankApp1/BlankApp1/Views/SystemManageView/MenuManageView.xaml

@@ -39,7 +39,7 @@
         ColumnHeaderStyle="{StaticResource ColumnHeaderStyle}"  RowHeaderStyle="{StaticResource RowHeaderStyle}" RowStyle="{StaticResource DataGridRowtyle}"  AlternationCount="2"
         ItemsSource="{Binding MenuInfoList}" >
             <DataGrid.Columns >
-                <DataGridTextColumn Header="菜单Id" Binding="{Binding MenuId}" CellStyle="{StaticResource MyDataGridCellStyle}" />
+                <!--<DataGridTextColumn Header="菜单Id" Binding="{Binding MenuId}" CellStyle="{StaticResource MyDataGridCellStyle}" />-->
                 <DataGridTextColumn Header="菜单名" Binding="{Binding MenuHeader}" CellStyle="{StaticResource MyDataGridCellStyle}"/>
                 <DataGridTextColumn Header="菜单界面" Binding="{Binding TargetView}" CellStyle="{StaticResource MyDataGridCellStyle}"/>
                 <DataGridTextColumn Header="父Id" Binding="{Binding ParentId}" CellStyle="{StaticResource MyDataGridCellStyle}"/>
@@ -63,13 +63,13 @@
                                         <TextBlock  Text="编辑" VerticalAlignment="Center" Foreground="Blue"/>
                                     </StackPanel>
                                 </Button>
-                                <Button  Width="auto" Background="Transparent" HorizontalContentAlignment ="Left" Foreground="Black" Height="25" BorderThickness="0"
+                                <!--<Button  Width="auto" Background="Transparent" HorizontalContentAlignment ="Left" Foreground="Black" Height="25" BorderThickness="0"
                                  Command="{Binding DataContext.DeleteCommand, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=DataGrid}}" CommandParameter="{Binding MenuId}" Cursor="Hand" Margin="0,0,10,0">
 
                                     <StackPanel Orientation="Horizontal">
                                         <TextBlock  Text="删除" VerticalAlignment="Center" Foreground="Blue"/>
                                     </StackPanel>
-                                </Button>
+                                </Button>-->
 
                             </StackPanel>
                         </DataTemplate>