feat(演示): 持久化 Mock 数据并打通文档库发起签署闭环

This commit is contained in:
yelan
2026-09-14 14:28:51 +08:00
parent f4e2671da6
commit d34ef0a0ce
8 changed files with 260 additions and 9 deletions
@@ -2,7 +2,7 @@
import { computed, nextTick, ref, watch } from 'vue'
import { ElMessage } from 'element-plus'
import { isSigningMockEnabled } from '@/api/workbench/signing'
import { getMockPatientHints, isSigningMockEnabled } from '@/api/workbench/signing'
import type { SigningTaskRecord, SigningTemplate } from '@/api/workbench/types'
import { useSigningTaskForm } from '@/composables/useSigningTaskForm'
import { useAppStore } from '@/stores/app'
@@ -20,6 +20,14 @@ const emit = defineEmits<{
const appStore = useAppStore()
const patientInput = ref<HTMLInputElement | null>(null)
const initialTemplate = computed(() => props.initialTemplate ?? null)
// 演示模式下列出可用的 Mock 患者,点一下直接定位,省得记患者 ID(真实模式为空数组)
const patientHints = getMockPatientHints()
function usePatientHint(id: string) {
patientId.value = id
errors.patient = ''
void locatePatient()
}
const {
documentSearch,
@@ -135,6 +143,18 @@ watch(
{{ locating ? '定位中…' : '定位患者' }}
</button>
</div>
<div v-if="patientHints.length" class="demo-patients">
<span class="demo-patients__label">演示患者</span>
<button
v-for="hint in patientHints"
:key="hint.id"
type="button"
class="demo-patients__chip"
@click="usePatientHint(hint.id)"
>
{{ hint.name }} · {{ hint.id }}
</button>
</div>
<div v-if="patient" class="patient-card">
<span class="patient-avatar" aria-hidden="true">人</span>
<strong>{{ patient.name }}</strong>
@@ -962,4 +982,29 @@ watch(
width: 100%;
}
}
.demo-patients {
display: flex;
flex-wrap: wrap;
gap: 6px;
align-items: center;
margin-top: 8px;
}
.demo-patients__label {
color: var(--mut);
font-size: 11.5px;
}
.demo-patients__chip {
padding: 3px 8px;
color: var(--brand);
font-size: 11.5px;
background: var(--brand-l);
border: none;
border-radius: 10px;
}
.demo-patients__chip:hover {
filter: brightness(0.95);
}
</style>