forked from gzt/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
115 lines
2.7 KiB
import apiClient from '../../utils/axios'
|
|
import type { TubeActivationStatus, TubeSetting } from '../../types/Index'
|
|
/*
|
|
"data": [
|
|
{
|
|
"key": "WHOLE_BLOOD",
|
|
"name": "全血"
|
|
},
|
|
{
|
|
"key": "SERUM_OR_PLASMA",
|
|
"name": "血清/血浆"
|
|
}
|
|
]
|
|
*/
|
|
export const getBloodTypes = async () => {
|
|
try {
|
|
const res = await apiClient.post(
|
|
'/api/v1/app/appTubeSettingMgr/getBloodTypes',
|
|
)
|
|
return res.data
|
|
} catch (error) {
|
|
console.log('获取已配置试管时出错:', error)
|
|
}
|
|
}
|
|
//获取已经配置的试管信息
|
|
export const getTestTube = async () => {
|
|
try {
|
|
const res = await apiClient.post(
|
|
'/api/v1/app/appTubeSettingMgr/getSettings',
|
|
)
|
|
return res.data
|
|
} catch (error) {
|
|
console.log('获取已配置试管时出错:', error)
|
|
}
|
|
}
|
|
|
|
//添加试管
|
|
export const addTestTube = async () => {
|
|
try {
|
|
const res = await apiClient.post(
|
|
'/api/v1/app/appTubeSettingMgr/newTubeHolderSetting',
|
|
)
|
|
return res.data
|
|
} catch (error) {
|
|
console.log('添加试管时出错:', error)
|
|
}
|
|
}
|
|
|
|
//删除试管
|
|
|
|
export const deleteTube = async (data: string) => {
|
|
try {
|
|
const res = await apiClient.post(
|
|
`/api/v1/app/appTubeSettingMgr/removeTubeHolderSetting?uuid=${data}`,
|
|
)
|
|
return res.data
|
|
} catch (error) {
|
|
console.log('删除试管时出错:', error)
|
|
}
|
|
}
|
|
|
|
//读取设备锁支持的所有项目的信息
|
|
export const getProjectInfo = async () => {
|
|
try {
|
|
const res = await apiClient.post('/api/v1/app/a8kProjectInfo/getAll')
|
|
return res.data
|
|
} catch (error) {
|
|
console.log('读取设备锁支持的所有项目的信息时出错:', error)
|
|
}
|
|
}
|
|
|
|
// 轮询获取实时的条形码和用户 ID 信息
|
|
export const pollTubeInfo = async () => {
|
|
try {
|
|
const res = await apiClient.post(
|
|
'/api/v1/app/appTubeSettingMgr/pollTubeInfo',
|
|
)
|
|
return res.data
|
|
} catch (error) {
|
|
console.log('轮询获取试管信息时出错:', error)
|
|
}
|
|
}
|
|
|
|
// 更新试管架激活状态
|
|
export const updateTubeActivationStatus = async (
|
|
data: TubeActivationStatus,
|
|
) => {
|
|
try {
|
|
const res = await apiClient.post(
|
|
'/api/v1/app/appTubeSettingMgr/updateActiveState',
|
|
null,
|
|
{ params: data },
|
|
)
|
|
return res.data
|
|
} catch (error) {
|
|
console.log('更新试管激活状态时出错:', error)
|
|
}
|
|
}
|
|
// 更新试管配置
|
|
export const updateTubeConfig = async (config: {
|
|
uuid: string
|
|
setting: TubeSetting[]
|
|
}) => {
|
|
console.log('🚀 ~ updateTubeConfig ~ config:', config)
|
|
try {
|
|
const res = await apiClient.post(
|
|
'/api/v1/app/appTubeSettingMgr/updateTubeSetting',
|
|
config,
|
|
)
|
|
return res.data
|
|
} catch (error) {
|
|
console.error('更新试管配置失败:', error)
|
|
return { success: false }
|
|
}
|
|
}
|