feat: allow receiving dept leaders to view available task attachments

This commit is contained in:
Your Name 2026-02-24 15:32:03 +08:00
parent 52062b0d83
commit 0e36d9fd36

View File

@ -299,10 +299,25 @@
<span class="icon">
<Icon name="paperclip" size="sm" color="#31f08b" />
</span>
<span>附件:
<span v-if="canViewAvailableTaskAttachmentInfo">
附件:
<a
v-for="(url, index) in parseAttachmentUrls(task.attachmentUrl)"
:key="`available-attachment-${task.id}-${index}`"
:href="url"
target="_blank"
rel="noopener noreferrer"
class="attachment-link"
@click.stop
>
附件{{ index + 1 }}
</a>
</span>
<span v-else>
附件:
<span class="attachment-locked">
<Icon name="lock" size="xs" style="margin-right: 4px;" />
{{ (task.attachmentUrl || '').split(',').filter(u => u.trim()).length }}个附件(接单后可下载)
{{ parseAttachmentUrls(task.attachmentUrl).length }}个附件(接单后可下载)
</span>
</span>
</div>
@ -3411,6 +3426,22 @@ const canDownloadAttachment = (task: TaskOrSubTask) => {
return false
}
// 解析附件链接
const parseAttachmentUrls = (attachmentUrl?: string) => {
if (!attachmentUrl) return []
return attachmentUrl.split(',').map(url => url.trim()).filter(Boolean)
}
// 可接任务卡片:接单部门负责人可提前查看附件信息
const canViewAvailableTaskAttachmentInfo = computed(() => {
const userInfo = JSON.parse(localStorage.getItem('userInfo') || '{}')
const isAdmin = userInfo.isAdmin === 1 || userInfo.isAdmin === true
if (isAdmin) {
return true
}
return isDepartmentLeader.value && effectiveDeptType.value === 'receiving'
})
// 加载配置数据(从全局store加载)
const loadConfigs = async () => {
try {
@ -8628,4 +8659,3 @@ onUnmounted(() => {
color: #888 !important;
}
</style>