feat(签署方式): 扩展为手写板/短信/Pad/公众号四种并集中口径
This commit is contained in:
@@ -4,10 +4,12 @@ import { ref } from 'vue'
|
||||
import type {
|
||||
SigningAnswers,
|
||||
SigningArtifact,
|
||||
SigningMethod,
|
||||
SigningTaskEvent,
|
||||
SigningTaskRecord,
|
||||
} from '@/api/workbench/types'
|
||||
import type { SigningFieldProgress, SigningSignatureRequest } from '@/utils/signing-document'
|
||||
import { formatSigningMethodTitle, readSigningMethod } from '@/utils/signing-method'
|
||||
|
||||
import SigningDocumentInteractive from '@/components/signing/SigningDocumentInteractive.vue'
|
||||
import SigningDocumentPreview from '@/components/signing/SigningDocumentPreview.vue'
|
||||
@@ -38,7 +40,7 @@ defineProps<{
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
action: [action: SigningTaskAction]
|
||||
action: [action: SigningTaskAction, targetMethod?: SigningMethod]
|
||||
downloadArtifact: [artifact: SigningArtifact]
|
||||
selectionChange: [items: string[]]
|
||||
fieldChange: [answers: SigningAnswers, progress: SigningFieldProgress]
|
||||
@@ -47,6 +49,25 @@ const emit = defineEmits<{
|
||||
|
||||
const documentRef = ref<InstanceType<typeof SigningDocumentInteractive> | null>(null)
|
||||
|
||||
/**
|
||||
* 原型任务详情:主按钮 = 当前方式的签署入口,另外三种方式各给一个「转为 X」的次按钮。
|
||||
* 原型的四种方式都走这一套(`待签署` 下四个 if/else 分支,主按钮与其余三个各不相同),
|
||||
* 所以这里按**具体取值**分支,不做「现场 / 线上」归并。
|
||||
*/
|
||||
const ALTERNATE_METHODS: readonly SigningMethod[] = ['pad', 'sms', 'ipad', 'wx']
|
||||
|
||||
function alternateMethods(current: SigningMethod): SigningMethod[] {
|
||||
return ALTERNATE_METHODS.filter((item) => item !== current)
|
||||
}
|
||||
|
||||
/**
|
||||
* 现场设备签署(手写板 / Pad)走本地采集入口;线上(短信 / 公众号)走患者端页面。
|
||||
* 这只是**入口形态**的分组,不是取值归并 —— 按钮文案、状态标签仍按具体取值区分。
|
||||
*/
|
||||
function isOnsiteMethod(method: SigningMethod): boolean {
|
||||
return method === 'pad' || method === 'ipad'
|
||||
}
|
||||
|
||||
/** 供父级「导出 PDF」使用:转发到实际渲染文书的那一层 */
|
||||
function getDocumentElement() {
|
||||
return documentRef.value?.getDocumentElement() ?? null
|
||||
@@ -66,61 +87,63 @@ defineExpose({ getDocumentElement })
|
||||
<div class="task-actions">
|
||||
<span class="task-action-meta">任务 {{ task.id }} · {{ task.patientName }}</span>
|
||||
|
||||
<template v-if="task.status === 'pending' && task.method === 'pad'">
|
||||
<template v-if="allowLocalSigning">
|
||||
<button type="button" class="action-button" @click="emit('action', 'pad-sign')">
|
||||
✍ 手写板签署
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="action-button action-button--ghost"
|
||||
@click="emit('action', 'switch-method')"
|
||||
>
|
||||
转为短信发送
|
||||
</button>
|
||||
<template v-if="task.status === 'pending'">
|
||||
<!-- 主按钮 = 当前方式的签署入口(原型:手写板/Pad 走现场设备,短信/公众号走线上页面) -->
|
||||
<template v-if="isOnsiteMethod(task.method)">
|
||||
<template v-if="allowLocalSigning">
|
||||
<button type="button" class="action-button" @click="emit('action', 'pad-sign')">
|
||||
{{ formatSigningMethodTitle(task.method) }}
|
||||
</button>
|
||||
</template>
|
||||
<template v-else-if="canDeliveryWrite">
|
||||
<button
|
||||
type="button"
|
||||
class="action-button"
|
||||
:disabled="padSessionLoading"
|
||||
@click="emit('action', 'create-pad-session')"
|
||||
>
|
||||
{{
|
||||
padSessionLoading ? '创建会话中…' : `创建${readSigningMethod(task.method).short}会话`
|
||||
}}
|
||||
</button>
|
||||
<span v-if="padSessionStatus" class="action-hint">
|
||||
会话状态:{{ padSessionStatus }};等待设备适配器读取 challenge
|
||||
</span>
|
||||
<span v-else class="action-hint">创建会话后仍需接入厂商设备适配器完成签名采集</span>
|
||||
</template>
|
||||
</template>
|
||||
<template v-else-if="canDeliveryWrite">
|
||||
<template v-else>
|
||||
<button
|
||||
v-if="allowLocalSigning"
|
||||
type="button"
|
||||
class="action-button"
|
||||
:disabled="padSessionLoading"
|
||||
@click="emit('action', 'create-pad-session')"
|
||||
@click="emit('action', 'online-sign')"
|
||||
>
|
||||
{{ padSessionLoading ? '创建会话中…' : '创建手写板会话' }}
|
||||
查看{{ readSigningMethod(task.method).short }}签署
|
||||
</button>
|
||||
<span v-if="padSessionStatus" class="action-hint">
|
||||
会话状态:{{ padSessionStatus }};等待设备适配器读取 challenge
|
||||
</span>
|
||||
<span v-else class="action-hint">创建会话后仍需接入厂商设备适配器完成签名采集</span>
|
||||
<span v-else class="action-hint">线上签署页面接口待接入</span>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
<template v-else-if="task.status === 'pending' && task.method === 'sms'">
|
||||
<!-- 其余三种方式:一键转换(原型四种方式互为切换入口) -->
|
||||
<button
|
||||
v-if="allowLocalSigning"
|
||||
type="button"
|
||||
class="action-button"
|
||||
@click="emit('action', 'online-sign')"
|
||||
>
|
||||
📱 查看线上签署
|
||||
</button>
|
||||
<span v-else class="action-hint">线上签署页面接口待接入</span>
|
||||
<button
|
||||
v-if="allowLocalSigning"
|
||||
v-for="target in alternateMethods(task.method)"
|
||||
:key="target"
|
||||
type="button"
|
||||
class="action-button action-button--ghost"
|
||||
@click="emit('action', 'switch-method')"
|
||||
@click="emit('action', 'switch-method', target)"
|
||||
>
|
||||
转手写板签署
|
||||
{{ readSigningMethod(target).short }}签署
|
||||
</button>
|
||||
|
||||
<button
|
||||
v-if="canDeliveryWrite"
|
||||
v-if="canDeliveryWrite && task.method === 'sms'"
|
||||
type="button"
|
||||
class="action-button action-button--ghost"
|
||||
@click="emit('action', 'resend-sms')"
|
||||
>
|
||||
重发短信
|
||||
</button>
|
||||
<span v-else-if="task.method === 'wx'" class="action-hint">公众号推送接口待接入</span>
|
||||
</template>
|
||||
|
||||
<template v-else-if="task.status === 'expired' && canReopen">
|
||||
|
||||
Reference in New Issue
Block a user