fix(sign): 对齐签署操作权限校验
This commit is contained in:
@@ -35,7 +35,7 @@ const props = defineProps<{
|
||||
artifactsError: boolean
|
||||
padSessionStatus: string | null
|
||||
padSessionLoading: boolean
|
||||
canDeliveryWrite: boolean
|
||||
canSignTask: boolean
|
||||
canReopen: boolean
|
||||
canVoid: boolean
|
||||
/** 科室复核签章(sign:task:confirm):只有「待科室确认」的任务用得上 */
|
||||
@@ -193,7 +193,7 @@ defineExpose({ getDocumentElement, locateSignatureSlot })
|
||||
{{ formatSigningMethodTitle(task.method) }}
|
||||
</button>
|
||||
</template>
|
||||
<template v-else-if="canDeliveryWrite">
|
||||
<template v-else-if="canSignTask">
|
||||
<button
|
||||
type="button"
|
||||
class="action-button"
|
||||
@@ -201,7 +201,9 @@ defineExpose({ getDocumentElement, locateSignatureSlot })
|
||||
@click="emit('action', 'create-pad-session')"
|
||||
>
|
||||
{{
|
||||
padSessionLoading ? '创建会话中…' : `创建${readSigningMethod(task.method).short}会话`
|
||||
padSessionLoading
|
||||
? '创建会话中…'
|
||||
: `创建${readSigningMethod(task.method).short}会话`
|
||||
}}
|
||||
</button>
|
||||
<span v-if="padSessionStatus" class="action-hint">
|
||||
@@ -235,7 +237,7 @@ defineExpose({ getDocumentElement, locateSignatureSlot })
|
||||
✓ 模拟患者完成签署(演示)
|
||||
</button>
|
||||
<button
|
||||
v-if="canDeliveryWrite"
|
||||
v-if="canRemind"
|
||||
type="button"
|
||||
class="action-button action-button--ghost"
|
||||
@click="emit('action', task.method === 'wx' ? 'resend-wx-push' : 'resend-sms')"
|
||||
|
||||
@@ -146,7 +146,7 @@ function canRead(permission: string) {
|
||||
}
|
||||
|
||||
const canCreateTask = computed(() => canWrite('sign:task:create'))
|
||||
const canDeliveryWrite = computed(() => canWrite('sign:delivery:write'))
|
||||
const canSignTask = computed(() => canWrite('sign:task:sign'))
|
||||
const canReopenTask = computed(() => canWrite('sign:task:reopen'))
|
||||
const canVoidTask = computed(() => canWrite('sign:task:void'))
|
||||
/** 科室复核签章:把「待科室确认」推到「已签署」,是正式留痕动作,与作废同级 */
|
||||
@@ -157,22 +157,20 @@ const canViewEvents = computed(() => canRead('sign:task:event:query'))
|
||||
const canViewArtifacts = computed(() => canRead('sign:artifact:query'))
|
||||
const canDownloadArtifacts = computed(() => canRead('sign:artifact:download'))
|
||||
|
||||
/**
|
||||
* 「投递类」动作:签署本身、方式切换、签署消息的发送与重发。
|
||||
*
|
||||
* 它们动的是对外可见的东西(患者会收到短信 / 推送,或任务状态直接变),
|
||||
* 与「创建签署会话」同级 —— 都要 `sign:delivery:write`。
|
||||
* 归到一处是因为原来逐个 `action === 'x' && ...` 地列,加一个方式就漏一个
|
||||
* (漏掉的表现是「切到 Pad 就提示没有权限」)。
|
||||
*/
|
||||
const DELIVERY_ACTIONS: SigningTaskAction[] = [
|
||||
/** 需要执行签署权限的任务动作,对应后端 `sign:task:sign`。 */
|
||||
const SIGNING_ACTIONS: SigningTaskAction[] = [
|
||||
'pad-sign',
|
||||
'create-pad-session',
|
||||
'online-sign',
|
||||
'switch-method',
|
||||
'switch-to-ipad',
|
||||
'simulate-patient-sign',
|
||||
]
|
||||
|
||||
/** 短信/公众号发送与重发对应后端 `sign:task:remind`。 */
|
||||
const DELIVERY_ACTIONS: SigningTaskAction[] = [
|
||||
'send-sms',
|
||||
'send-wx-push',
|
||||
'simulate-patient-sign',
|
||||
'resend-sms',
|
||||
'resend-wx-push',
|
||||
]
|
||||
@@ -571,8 +569,8 @@ async function handleTaskAction(action: SigningTaskAction, targetMethod?: Signin
|
||||
|
||||
const allowed =
|
||||
isSigningMockEnabled ||
|
||||
(action === 'create-pad-session' && canDeliveryWrite.value) ||
|
||||
(DELIVERY_ACTIONS.includes(action) && canDeliveryWrite.value) ||
|
||||
(SIGNING_ACTIONS.includes(action) && canSignTask.value) ||
|
||||
(DELIVERY_ACTIONS.includes(action) && canRemindTask.value) ||
|
||||
(action === 'reopen' && canReopenTask.value) ||
|
||||
(action === 'void' && canVoidTask.value) ||
|
||||
(action === 'confirm-dept' && canConfirmTask.value) ||
|
||||
@@ -1143,7 +1141,7 @@ onMounted(() => {
|
||||
:artifacts-error="artifactsError"
|
||||
:pad-session-status="padSessionStatus"
|
||||
:pad-session-loading="padSessionLoading"
|
||||
:can-delivery-write="canDeliveryWrite"
|
||||
:can-sign-task="canSignTask"
|
||||
:can-reopen="canReopenTask"
|
||||
:can-void="canVoidTask"
|
||||
:can-confirm="canConfirmTask"
|
||||
|
||||
Reference in New Issue
Block a user