终端一体化运控平台
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 

88 rader
2.2 KiB

  1. using BPASmart.Model;
  2. using BPASmart.UserManagement.View;
  3. using BPASmartClient.Helper;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Collections.ObjectModel;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. namespace BPASmart.UserManagement.ViewModel
  11. {
  12. partial class UserListViewModel:ObservableObject
  13. {
  14. /// <summary>
  15. /// 用户列表
  16. /// </summary>
  17. public ObservableCollection<UserManager> userManagers { get; set; } = Json<LocalUser>.Data.UserManagers;
  18. /// <summary>
  19. /// 注册新用户
  20. /// </summary>
  21. [RelayCommand]
  22. private void RegisterNewUser()
  23. {
  24. ActionManage.GetInstance.Send("ChangeMianContent", "AddNewUser");
  25. }
  26. /// <summary>
  27. /// 修改密码
  28. /// </summary>
  29. [RelayCommand]
  30. private void ChangePassword(object o)
  31. {
  32. if (o == null) return;
  33. if (o is UserManager user)
  34. {
  35. if(userManagers.Contains(user))
  36. {
  37. Globle.GlobleData.ChangeUser = user;
  38. ActionManage.GetInstance.Send("ChangeMianContent", "ChangeUser");
  39. }
  40. }
  41. }
  42. /// <summary>
  43. /// 编辑权限
  44. /// </summary>
  45. [RelayCommand]
  46. private void EditUsetPower(object o)
  47. {
  48. if (o == null) return;
  49. if (o is UserManager user)
  50. {
  51. if (userManagers.Contains(user))
  52. {
  53. Globle.GlobleData.EditUser = null;
  54. Globle.GlobleData.EditUser = user;
  55. ActionManage.GetInstance.Send("ChangeMianContent", "EditPower");
  56. }
  57. }
  58. }
  59. /// <summary>
  60. /// 删除用户
  61. /// </summary>
  62. [RelayCommand]
  63. private void DeleteUser(object o)
  64. {
  65. if (o == null) return;
  66. if (o is UserManager user)
  67. {
  68. if (userManagers.Contains(user))
  69. {
  70. userManagers.Remove(user);
  71. }
  72. }
  73. Json<LocalUser>.Save();
  74. }
  75. public UserListViewModel()
  76. {
  77. }
  78. }
  79. }