Step UX-1:通用选择器

This commit is contained in:
Cheng Zhou
2025-12-17 14:37:57 +08:00
parent 580d64602f
commit dd51f56707
13 changed files with 334 additions and 52 deletions
+18 -6
View File
@@ -6,7 +6,13 @@
<el-option label="SDV" value="SDV" />
<el-option label="SDR" value="SDR" />
</el-select>
<el-input v-model="filters.site_id" placeholder="中心ID" style="width: 180px" @change="load" />
<SiteSelect
v-model="filters.site_id"
:study-id="study.currentStudy?.id || null"
placeholder="中心"
style="width: 220px"
@change="load"
/>
<div class="spacer" />
<el-button v-if="canEdit" type="primary" @click="openCreate">新增进度</el-button>
</div>
@@ -16,11 +22,15 @@
<el-dialog :title="editForm.id ? '更新进度' : '新增进度'" v-model="showEdit" width="520px">
<el-form :model="editForm" label-width="120px">
<el-form-item label="受试者ID">
<el-input v-model="editForm.subject_id" :disabled="!!editForm.id" />
<el-form-item label="受试者">
<SubjectSelect
v-model="editForm.subject_id"
:study-id="study.currentStudy?.id || null"
:disabled="!!editForm.id"
/>
</el-form-item>
<el-form-item label="中心ID">
<el-input v-model="editForm.site_id" />
<el-form-item label="中心">
<SiteSelect v-model="editForm.site_id" :study-id="study.currentStudy?.id || null" />
</el-form-item>
<el-form-item label="类型">
<el-select v-model="editForm.level" placeholder="请选择">
@@ -53,6 +63,8 @@ import { fetchVerifications, upsertVerification } from "../api/verifications";
import { useStudyStore } from "../store/study";
import { useAuthStore } from "../store/auth";
import VerificationTable from "../components/VerificationTable.vue";
import SiteSelect from "../components/selectors/SiteSelect.vue";
import SubjectSelect from "../components/selectors/SubjectSelect.vue";
const study = useStudyStore();
const auth = useAuthStore();
@@ -115,7 +127,7 @@ const submitEdit = async () => {
try {
await upsertVerification(study.currentStudy.id, {
subject_id: editForm.value.subject_id,
site_id: editForm.value.site_id,
site_id: editForm.value.site_id || null,
level: editForm.value.level,
percent: editForm.value.percent,
last_verified_at: editForm.value.last_verified_at,