visitor.store.ts 792 B

1234567891011121314151617181920212223242526
  1. import { defineStore } from 'pinia';
  2. import type { PulseAnalysisModel } from '@/request/model';
  3. export const useVisitor = defineStore('visitor', () => {
  4. const patientId = ref<string>();
  5. const resultId = ref<string>();
  6. const reportId = ref<string>();
  7. const pulseReport = shallowRef<PulseAnalysisModel>();
  8. const $reset = () => {
  9. patientId.value = '';
  10. resultId.value = '';
  11. reportId.value = '';
  12. pulseReport.value = void 0;
  13. };
  14. function updatePulseReport(report: PulseAnalysisModel, patient?: string) {
  15. if (patientId.value?.toString() !== patient || !pulseReport.value?.results) {
  16. if (patient) patientId.value = patient;
  17. pulseReport.value = report;
  18. }
  19. }
  20. return { patientId, resultId, reportId, pulseReport, $reset, updatePulseReport };
  21. });