diff --git a/frontend/src/api/sites.ts b/frontend/src/api/sites.ts index 5682b81f..cf99c9e6 100644 --- a/frontend/src/api/sites.ts +++ b/frontend/src/api/sites.ts @@ -1,5 +1,5 @@ import { apiGet } from "./axios"; import type { ApiListResponse } from "../types/api"; -export const fetchSites = (studyId: string) => - apiGet>(`/api/v1/studies/${studyId}/sites/`); +export const fetchSites = (studyId: string, params?: Record) => + apiGet>(`/api/v1/studies/${studyId}/sites/`, { params }); diff --git a/frontend/src/api/users.ts b/frontend/src/api/users.ts new file mode 100644 index 00000000..ffbd1aba --- /dev/null +++ b/frontend/src/api/users.ts @@ -0,0 +1,5 @@ +import { apiGet } from "./axios"; +import type { ApiListResponse } from "../types/api"; + +export const fetchUsers = (params?: Record) => + apiGet>("/api/v1/users", { params }); diff --git a/frontend/src/components/AeForm.vue b/frontend/src/components/AeForm.vue index 37106730..dbb71d1b 100644 --- a/frontend/src/components/AeForm.vue +++ b/frontend/src/components/AeForm.vue @@ -2,14 +2,7 @@ - - - + @@ -45,14 +38,13 @@ import type { FormInstance, FormRules } from "element-plus"; import { ElMessage } from "element-plus"; import { createAe, updateAe } from "../api/aes"; import { useStudyStore } from "../store/study"; +import SubjectSelect from "./selectors/SubjectSelect.vue"; -interface Props { +const props = defineProps<{ modelValue: boolean; ae?: Record; subjects?: any[]; -} - -const props = defineProps(); +}>(); const emit = defineEmits(["update:modelValue", "success"]); const visible = computed({ @@ -125,16 +117,11 @@ const onSubmit = async () => { submitting.value = true; try { const payload: Record = {}; - const uuidLike = /^[0-9a-fA-F-]{36}$/; Object.entries(form).forEach(([k, v]) => { if (v !== "" && v !== null && v !== undefined) { payload[k] = v; } }); - if (payload.subject_id && !uuidLike.test(String(payload.subject_id))) { - ElMessage.warning("受试者ID格式不正确,已忽略"); - delete payload.subject_id; - } if (isEdit.value && props.ae) { await updateAe(study.currentStudy.id, props.ae.id, payload); } else { diff --git a/frontend/src/components/DataQueryForm.vue b/frontend/src/components/DataQueryForm.vue index 9e011b5d..a4e31ea8 100644 --- a/frontend/src/components/DataQueryForm.vue +++ b/frontend/src/components/DataQueryForm.vue @@ -5,9 +5,7 @@ - - - + @@ -25,7 +23,7 @@ - + @@ -47,14 +45,13 @@ import type { FormInstance, FormRules } from "element-plus"; import { ElMessage } from "element-plus"; import { createDataQuery, updateDataQuery } from "../api/dataQueries"; import { useStudyStore } from "../store/study"; +import SubjectSelect from "./selectors/SubjectSelect.vue"; +import UserSelect from "./selectors/UserSelect.vue"; -interface Props { +const props = defineProps<{ modelValue: boolean; query?: Record; - subjects?: any[]; -} - -const props = defineProps(); +}>(); const emit = defineEmits(["update:modelValue", "success"]); const visible = computed({ diff --git a/frontend/src/components/FinanceForm.vue b/frontend/src/components/FinanceForm.vue index ff14a1e0..4c196353 100644 --- a/frontend/src/components/FinanceForm.vue +++ b/frontend/src/components/FinanceForm.vue @@ -21,11 +21,11 @@ - - + + - - + +