A8000
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.

60 lines
1.1 KiB

8 months ago
  1. import { defineStore } from 'pinia'
  2. import { ref } from 'vue'
  3. interface TubeSetting {
  4. tubeIndex: number
  5. userid: string
  6. sampleBarcode: string
  7. projId: number[]
  8. bloodType: string
  9. }
  10. interface TubeConfig {
  11. uuid: string
  12. setting: TubeSetting
  13. }
  14. export const useSettingTestTubeStore = defineStore('settingTestTube', () => {
  15. const currentConfig = ref<TubeConfig>({
  16. uuid: '',
  17. setting: {
  18. tubeIndex: 0,
  19. userid: '',
  20. sampleBarcode: '',
  21. projId: [],
  22. bloodType: ''
  23. }
  24. })
  25. // 更新试管设置
  26. const updateTubeSetting = (uuid: string, setting: Partial<TubeSetting> & { tubeIndex: number }) => {
  27. currentConfig.value = {
  28. uuid,
  29. setting: {
  30. ...currentConfig.value.setting,
  31. ...setting
  32. }
  33. }
  34. }
  35. // 清空配置
  36. const clearConfig = () => {
  37. currentConfig.value = {
  38. uuid: '',
  39. setting: {
  40. tubeIndex: 0,
  41. userid: '',
  42. sampleBarcode: '',
  43. projId: [],
  44. bloodType: ''
  45. }
  46. }
  47. }
  48. return {
  49. currentConfig,
  50. updateTubeSetting,
  51. clearConfig
  52. }
  53. })