feat: enable patient form interactions and revision-aware signing
This commit is contained in:
@@ -12,20 +12,30 @@ import { ref } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
|
||||
import DocumentPaper from '@/components/DocumentPaper.vue'
|
||||
import { signingState } from '@/composables/useSignFlow'
|
||||
import { signingState, updatePatientAnswer, flushPatientAnswers } from '@/composables/useSignFlow'
|
||||
|
||||
const router = useRouter()
|
||||
const hasRead = ref(false)
|
||||
const errorMessage = ref('')
|
||||
|
||||
function continueToSigner() {
|
||||
const continuing = ref(false)
|
||||
|
||||
async function continueToSigner() {
|
||||
if (!hasRead.value) {
|
||||
errorMessage.value = '请先确认已阅读文书内容。'
|
||||
return
|
||||
}
|
||||
|
||||
signingState.consentAccepted = true
|
||||
void router.push('/signer')
|
||||
continuing.value = true
|
||||
try {
|
||||
await flushPatientAnswers()
|
||||
signingState.consentAccepted = true
|
||||
await router.push('/signer')
|
||||
} catch (error) {
|
||||
errorMessage.value = error instanceof Error ? error.message : '填写内容尚未保存'
|
||||
} finally {
|
||||
continuing.value = false
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -48,15 +58,28 @@ function continueToSigner() {
|
||||
<DocumentPaper
|
||||
:content-html="signingState.documentContentHtml"
|
||||
:answers="signingState.staffAnswers"
|
||||
:fields="signingState.form?.fields"
|
||||
:patient-answers="signingState.form?.answers"
|
||||
:interactive="Boolean(signingState.form?.editable) && !continuing && !signingState.formError"
|
||||
@answer-change="updatePatientAnswer"
|
||||
/>
|
||||
|
||||
<p v-if="signingState.formError" class="form-error">{{ signingState.formError }}</p>
|
||||
<p v-else-if="signingState.formSaving">正在保存填写内容…</p>
|
||||
<label class="check-row">
|
||||
<input v-model="hasRead" type="checkbox" />
|
||||
<span>我已阅读并理解上述内容,愿意继续确认签署人信息。</span>
|
||||
</label>
|
||||
<p v-if="errorMessage" class="form-error">{{ errorMessage }}</p>
|
||||
|
||||
<button class="mobile-primary-button" type="button" @click="continueToSigner">下一步</button>
|
||||
<button
|
||||
class="mobile-primary-button"
|
||||
type="button"
|
||||
:disabled="continuing || Boolean(signingState.formError)"
|
||||
@click="continueToSigner"
|
||||
>
|
||||
下一步
|
||||
</button>
|
||||
<button class="mobile-text-button" type="button" @click="router.back()">返回</button>
|
||||
</main>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user