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
60 lines
1.1 KiB
import { defineStore } from 'pinia'
|
|
import { ref } from 'vue'
|
|
|
|
interface TubeSetting {
|
|
tubeIndex: number
|
|
userid: string
|
|
sampleBarcode: string
|
|
projId: number[]
|
|
bloodType: string
|
|
}
|
|
|
|
interface TubeConfig {
|
|
uuid: string
|
|
setting: TubeSetting
|
|
}
|
|
|
|
export const useSettingTestTubeStore = defineStore('settingTestTube', () => {
|
|
const currentConfig = ref<TubeConfig>({
|
|
uuid: '',
|
|
setting: {
|
|
tubeIndex: 0,
|
|
userid: '',
|
|
sampleBarcode: '',
|
|
projId: [],
|
|
bloodType: ''
|
|
}
|
|
})
|
|
|
|
// 更新试管设置
|
|
const updateTubeSetting = (uuid: string, setting: Partial<TubeSetting> & { tubeIndex: number }) => {
|
|
currentConfig.value = {
|
|
uuid,
|
|
setting: {
|
|
...currentConfig.value.setting,
|
|
...setting
|
|
}
|
|
}
|
|
}
|
|
|
|
// 清空配置
|
|
const clearConfig = () => {
|
|
currentConfig.value = {
|
|
uuid: '',
|
|
setting: {
|
|
tubeIndex: 0,
|
|
userid: '',
|
|
sampleBarcode: '',
|
|
projId: [],
|
|
bloodType: ''
|
|
}
|
|
}
|
|
}
|
|
|
|
return {
|
|
currentConfig,
|
|
updateTubeSetting,
|
|
clearConfig
|
|
}
|
|
})
|
|
|