fix(auth): 完善权限控制与强制改密流程
This commit is contained in:
@@ -5,8 +5,10 @@ withDefaults(
|
||||
total: number
|
||||
/** 只在演示模式下展示「重置演示数据」:真实环境不该出现这个自测入口 */
|
||||
showReset?: boolean
|
||||
canCreate?: boolean
|
||||
canExport?: boolean
|
||||
}>(),
|
||||
{ showReset: false },
|
||||
{ showReset: false, canCreate: false, canExport: false },
|
||||
)
|
||||
|
||||
const emit = defineEmits<{
|
||||
@@ -40,11 +42,11 @@ function handleInput(event: Event) {
|
||||
aria-label="搜索模板名称、编号或科室"
|
||||
@input="handleInput"
|
||||
/>
|
||||
<button type="button" class="tool-button primary" @click="emit('add')">
|
||||
<button v-if="canCreate" type="button" class="tool-button primary" @click="emit('add')">
|
||||
<span aria-hidden="true">+</span>
|
||||
新增文档
|
||||
</button>
|
||||
<button type="button" class="tool-button secondary" @click="emit('export')">
|
||||
<button v-if="canExport" type="button" class="tool-button secondary" @click="emit('export')">
|
||||
导出模板包
|
||||
</button>
|
||||
<button
|
||||
|
||||
@@ -6,6 +6,9 @@ import { documentStatusLabels } from '../mock'
|
||||
|
||||
const props = defineProps<{
|
||||
template: DocumentTemplate
|
||||
canEdit: boolean
|
||||
canInitiate: boolean
|
||||
canRemove: boolean
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
@@ -18,12 +21,18 @@ const emit = defineEmits<{
|
||||
const statusLabel = computed(() => documentStatusLabels[props.template.status])
|
||||
|
||||
/** 只有已发布 / 待复审的模板可以发起签署;草稿与已归档不可用 */
|
||||
const canInitiate = computed(
|
||||
() => props.template.status === 'published' || props.template.status === 'review',
|
||||
const canInitiateTemplate = computed(
|
||||
() =>
|
||||
props.canInitiate &&
|
||||
(props.template.status === 'published' || props.template.status === 'review'),
|
||||
)
|
||||
|
||||
const initiateTitle = computed(() =>
|
||||
canInitiate.value ? '用此模板发起签署' : '仅已发布或待复审的模板可发起签署',
|
||||
canInitiateTemplate.value
|
||||
? '用此模板发起签署'
|
||||
: props.canInitiate
|
||||
? '仅已发布或待复审的模板可发起签署'
|
||||
: '当前账号没有发起签署任务的权限',
|
||||
)
|
||||
</script>
|
||||
|
||||
@@ -49,17 +58,21 @@ const initiateTitle = computed(() =>
|
||||
</span>
|
||||
<div class="template-actions">
|
||||
<button type="button" class="card-button" @click="emit('preview', template)">预览</button>
|
||||
<button type="button" class="card-button" @click="emit('edit', template)">编辑</button>
|
||||
<button v-if="canEdit" type="button" class="card-button" @click="emit('edit', template)">
|
||||
编辑
|
||||
</button>
|
||||
<button
|
||||
v-if="canInitiate"
|
||||
type="button"
|
||||
class="card-button primary"
|
||||
:disabled="!canInitiate"
|
||||
:disabled="!canInitiateTemplate"
|
||||
:title="initiateTitle"
|
||||
@click="emit('initiate', template)"
|
||||
>
|
||||
发起
|
||||
</button>
|
||||
<button
|
||||
v-if="canRemove"
|
||||
type="button"
|
||||
class="card-button danger"
|
||||
title="删除此文书"
|
||||
|
||||
Reference in New Issue
Block a user