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

@@ -1,7 +1,7 @@
<script setup lang="ts">
import type { FormInstance } from 'element-plus';
import { onMounted, ref } from 'vue';
import { computed, onMounted, ref } from 'vue';
import { EasyFlowFormModal } from '@easyflow/common-ui';
@@ -29,7 +29,7 @@ const rerankerLlmList = ref<any>([]);
const getEmbeddingLlmListData = async () => {
try {
const url = `/api/v1/model/list?modelType=embeddingModel`;
const url = `/api/v1/documentCollection/modelList?modelType=embeddingModel`;
const res = await api.get(url, {});
if (res.errorCode === 0) {
embeddingLlmList.value = res.data;
@@ -42,7 +42,9 @@ const getEmbeddingLlmListData = async () => {
const getRerankerLlmListData = async () => {
try {
const res = await api.get('/api/v1/model/list?modelType=rerankModel');
const res = await api.get(
'/api/v1/documentCollection/modelList?modelType=rerankModel',
);
rerankerLlmList.value = res.data;
} catch (error) {
ElMessage.error($t('message.apiError'));
@@ -87,8 +89,9 @@ const defaultEntity = {
rerankEnable: false,
},
rerankModelId: '',
searchEngineEnable: '',
searchEngineEnable: false,
englishName: '',
visibilityScope: 'PRIVATE',
};
const normalizeEntity = (raw: any = {}) => {
const options = {
@@ -135,6 +138,20 @@ const rules = ref({
{ required: true, message: $t('message.required'), trigger: 'blur' },
],
});
const visibilityScopeOptions = computed(() => [
{
label: $t('documentCollection.visibilityScopePrivate'),
value: 'PRIVATE',
},
{
label: $t('documentCollection.visibilityScopeDept'),
value: 'DEPT',
},
{
label: $t('documentCollection.visibilityScopePublic'),
value: 'PUBLIC',
},
]);
const collectionTypeList = [
{
label: $t('documentCollection.collectionTypeDocument'),
@@ -257,6 +274,19 @@ defineExpose({
dict-code="aiDocumentCollectionCategory"
/>
</ElFormItem>
<ElFormItem
prop="visibilityScope"
:label="$t('documentCollection.visibilityScope')"
>
<ElSelect v-model="entity.visibilityScope" class="w-full">
<ElOption
v-for="item in visibilityScopeOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</ElSelect>
</ElFormItem>
<ElFormItem prop="alias" :label="$t('documentCollection.alias')">
<ElInput v-model.trim="entity.alias" />
</ElFormItem>