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