feat: 增加工作流和知识库三级权限

- 抽取统一资源访问骨架与部门可见范围判断

- 接入工作流和知识库的 READ/MANAGE 权限校验

- 增加可见范围配置与只读态前端交互
This commit is contained in:
2026-03-29 17:25:55 +08:00
parent f49d94e2fe
commit 22ceabff96
58 changed files with 3053 additions and 85 deletions

View File

@@ -2,6 +2,7 @@
import { ref } from 'vue';
import { $t } from '@easyflow/locales';
import { downloadFileFromBlob } from '@easyflow/utils';
import { Delete, Download, MoreFilled } from '@element-plus/icons-vue';
import {
@@ -25,6 +26,10 @@ const props = defineProps({
required: true,
type: String,
},
manageable: {
type: Boolean,
default: true,
},
});
const emits = defineEmits(['viewDoc']);
defineExpose({
@@ -38,10 +43,20 @@ const pageDataRef = ref();
const handleView = (row: any) => {
emits('viewDoc', row.id);
};
const handleDownload = (row: any) => {
window.open(row.documentPath, '_blank');
const handleDownload = async (row: any) => {
const blob = await api.download(
`/api/v1/document/download?documentId=${row.id}`,
);
downloadFileFromBlob({
fileName: row.title || 'document',
source: blob,
});
};
const handleDelete = (row: any) => {
if (!props.manageable) {
ElMessage.warning($t('documentCollection.managePermissionHint'));
return;
}
ElMessageBox.confirm($t('message.deleteAlert'), $t('message.noticeTitle'), {
confirmButtonText: $t('button.confirm'),
cancelButtonText: $t('button.cancel'),
@@ -122,7 +137,10 @@ const handleDelete = (row: any) => {
{{ $t('button.download') }}
</ElButton>
</ElDropdownItem>
<ElDropdownItem @click="handleDelete(row)">
<ElDropdownItem
v-if="props.manageable"
@click="handleDelete(row)"
>
<ElButton link :icon="Delete" type="danger">
{{ $t('button.delete') }}
</ElButton>