消毒机设备
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

90 lines
2.2 KiB

2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
  1. import { defineStore } from 'pinia'
  2. import { ref } from 'vue'
  3. /**
  4. *
  5. * @module useSettingStore
  6. */
  7. export const useSettingStore = defineStore('setting', () => {
  8. // 设置菜单配置
  9. const settingMenus = [{
  10. name: '消毒默认配置',
  11. code: 'defaultFormula',
  12. roleType: 'admin,maintainer',
  13. }, {
  14. name: '用户管理',
  15. code: 'user',
  16. roleType: 'admin,maintainer',
  17. }, {
  18. name: '日期设置',
  19. code: 'date',
  20. roleType: 'admin',
  21. }, {
  22. name: '设备信息',
  23. code: 'deviceInfo',
  24. roleType: 'admin,maintainer',
  25. }]
  26. // 历史记录数据
  27. const historyList: Record<string, string>[] = []
  28. /* ********************** 用户管理 **************************** */
  29. const userList = ref<User.UserItem[]>([])
  30. const addUserVisible = ref(false)
  31. const modifyPwdVisible = ref(false)
  32. const userModalState = ref('add')
  33. const currentEditUser = ref<User.UserItem>()
  34. /**
  35. * @function updateUserModalState
  36. * @param {string} state - ('add' | 'edit')
  37. * @desc
  38. */
  39. const updateUserModalState = (state: string) => {
  40. userModalState.value = state
  41. }
  42. /**
  43. * @function updateCurrentEditUser
  44. * @param {User.UserItem} userItem -
  45. * @desc
  46. */
  47. const updateCurrentEditUser = (userItem: User.UserItem) => {
  48. currentEditUser.value = userItem
  49. }
  50. /**
  51. * @function updateVisible
  52. * @param {boolean} visible -
  53. * @desc
  54. */
  55. const updateVisible = (visible: boolean) => {
  56. addUserVisible.value = visible
  57. }
  58. /**
  59. * @function updatePwdVisible
  60. * @param {boolean} visible -
  61. * @desc
  62. */
  63. const updatePwdVisible = (visible: boolean) => {
  64. modifyPwdVisible.value = visible
  65. }
  66. return {
  67. // 状态属性
  68. settingMenus,
  69. historyList,
  70. addUserVisible,
  71. modifyPwdVisible,
  72. userModalState,
  73. currentEditUser,
  74. userList,
  75. // 操作方法
  76. updateVisible,
  77. updateUserModalState,
  78. updateCurrentEditUser,
  79. updatePwdVisible,
  80. }
  81. })