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.

115 lines
2.7 KiB

8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
  1. import apiClient from '../../utils/axios'
  2. import type { TubeActivationStatus, TubeSetting } from '../../types/Index'
  3. /*
  4. "data": [
  5. {
  6. "key": "WHOLE_BLOOD",
  7. "name": "全血"
  8. },
  9. {
  10. "key": "SERUM_OR_PLASMA",
  11. "name": "血清/血浆"
  12. }
  13. ]
  14. */
  15. export const getBloodTypes = async () => {
  16. try {
  17. const res = await apiClient.post(
  18. '/api/v1/app/appTubeSettingMgr/getBloodTypes',
  19. )
  20. return res.data
  21. } catch (error) {
  22. console.log('获取已配置试管时出错:', error)
  23. }
  24. }
  25. //获取已经配置的试管信息
  26. export const getTestTube = async () => {
  27. try {
  28. const res = await apiClient.post(
  29. '/api/v1/app/appTubeSettingMgr/getSettings',
  30. )
  31. return res.data
  32. } catch (error) {
  33. console.log('获取已配置试管时出错:', error)
  34. }
  35. }
  36. //添加试管
  37. export const addTestTube = async () => {
  38. try {
  39. const res = await apiClient.post(
  40. '/api/v1/app/appTubeSettingMgr/newTubeHolderSetting',
  41. )
  42. return res.data
  43. } catch (error) {
  44. console.log('添加试管时出错:', error)
  45. }
  46. }
  47. //删除试管
  48. export const deleteTube = async (data: string) => {
  49. try {
  50. const res = await apiClient.post(
  51. `/api/v1/app/appTubeSettingMgr/removeTubeHolderSetting?uuid=${data}`,
  52. )
  53. return res.data
  54. } catch (error) {
  55. console.log('删除试管时出错:', error)
  56. }
  57. }
  58. //读取设备锁支持的所有项目的信息
  59. export const getProjectInfo = async () => {
  60. try {
  61. const res = await apiClient.post('/api/v1/app/a8kProjectInfo/getAll')
  62. return res.data
  63. } catch (error) {
  64. console.log('读取设备锁支持的所有项目的信息时出错:', error)
  65. }
  66. }
  67. // 轮询获取实时的条形码和用户 ID 信息
  68. export const pollTubeInfo = async () => {
  69. try {
  70. const res = await apiClient.post(
  71. '/api/v1/app/appTubeSettingMgr/pollTubeInfo',
  72. )
  73. return res.data
  74. } catch (error) {
  75. console.log('轮询获取试管信息时出错:', error)
  76. }
  77. }
  78. // 更新试管架激活状态
  79. export const updateTubeActivationStatus = async (
  80. data: TubeActivationStatus,
  81. ) => {
  82. try {
  83. const res = await apiClient.post(
  84. '/api/v1/app/appTubeSettingMgr/updateActiveState',
  85. null,
  86. { params: data },
  87. )
  88. return res.data
  89. } catch (error) {
  90. console.log('更新试管激活状态时出错:', error)
  91. }
  92. }
  93. // 更新试管配置
  94. export const updateTubeConfig = async (config: {
  95. uuid: string
  96. setting: TubeSetting[]
  97. }) => {
  98. console.log('🚀 ~ updateTubeConfig ~ config:', config)
  99. try {
  100. const res = await apiClient.post(
  101. '/api/v1/app/appTubeSettingMgr/updateTubeSetting',
  102. config,
  103. )
  104. return res.data
  105. } catch (error) {
  106. console.error('更新试管配置失败:', error)
  107. return { success: false }
  108. }
  109. }