|
|
@ -6,7 +6,7 @@ |
|
|
<script lang="ts" setup> |
|
|
<script lang="ts" setup> |
|
|
import { getFileIcon, readableSize,fileType} from "./tools" |
|
|
import { getFileIcon, readableSize,fileType} from "./tools" |
|
|
import sharePermission from './sharePermission.vue'; |
|
|
import sharePermission from './sharePermission.vue'; |
|
|
import { matterPage,matterInfo} from "@/api/doc/type" |
|
|
import { matterPage,matterInfo,matterTree} from "@/api/doc/type" |
|
|
import { doAccessManage,getSpaceMatterList,doCreateSpaceDir,doDelSpaceMatter,doDelSpace, |
|
|
import { doAccessManage,getSpaceMatterList,doCreateSpaceDir,doDelSpaceMatter,doDelSpace, |
|
|
doAiTraining ,doCreateAiagent,doFileUpload} from "@/api/doc/space" |
|
|
doAiTraining ,doCreateAiagent,doFileUpload} from "@/api/doc/space" |
|
|
import { h } from 'vue' |
|
|
import { h } from 'vue' |
|
|
@ -29,6 +29,7 @@ const breadcrumbList=ref<matterInfo[]>([{name:"根目录",uuid:"root", dir:true} |
|
|
|
|
|
|
|
|
const tabSelected=ref<matterInfo[]>([]) //table组件多选数据维护 |
|
|
const tabSelected=ref<matterInfo[]>([]) //table组件多选数据维护 |
|
|
const currentNode=ref<matterInfo>({}) //打开的路径层次 |
|
|
const currentNode=ref<matterInfo>({}) //打开的路径层次 |
|
|
|
|
|
let isNewNode=true //用来减少父组件树的重置 |
|
|
|
|
|
|
|
|
const dynamicVNode = ref<VNode | null>(null) //permission 组件的父组件 |
|
|
const dynamicVNode = ref<VNode | null>(null) //permission 组件的父组件 |
|
|
const paginInfo = ref({ page: 0, total: 0 }) |
|
|
const paginInfo = ref({ page: 0, total: 0 }) |
|
|
@ -43,18 +44,23 @@ const currentAgent=ref<{model:boolean,name:string,uuid:string}>({}) |
|
|
|
|
|
|
|
|
//--------------------------------- |
|
|
//--------------------------------- |
|
|
|
|
|
|
|
|
const props = withDefaults(defineProps<{ |
|
|
const props = withDefaults(defineProps<{ |
|
|
uid:string, //当前用户的uuid,注意已经且必须通过base64编码,因为后端获取Identifier后,会base64解码 |
|
|
uid:string, //当前用户的uuid,注意已经且必须通过base64编码,因为后端获取Identifier后,会base64解码 |
|
|
|
|
|
tree:object, |
|
|
spaceid:string, |
|
|
spaceid:string, |
|
|
spacename:string, |
|
|
spacename:string, |
|
|
officeHost:string, |
|
|
officeHost:string, |
|
|
siteHost:string, |
|
|
siteHost:string, |
|
|
owner:string, |
|
|
owner:string, |
|
|
apiURL:string, |
|
|
apiURL:string, |
|
|
roles:string |
|
|
roles:string, |
|
|
|
|
|
|
|
|
|
|
|
flushSpaceTree:(uuid:string,data:matterTree[])=>void |
|
|
}>(),{}) |
|
|
}>(),{}) |
|
|
|
|
|
|
|
|
|
|
|
//属性变更,特别是为了处理空间切换的状态更新 |
|
|
watch(props,()=>{ |
|
|
watch(props,()=>{ |
|
|
|
|
|
currentNode.value.uuid="root" |
|
|
onLoadMatterList() |
|
|
onLoadMatterList() |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
@ -159,6 +165,22 @@ function onLoadMatterList(){ |
|
|
//page+1 是由于分页的起始index是1,而后端api的分页index起始是0 |
|
|
//page+1 是由于分页的起始index是1,而后端api的分页index起始是0 |
|
|
paginInfo.value={total:resp.data.totalPages, page:resp.data.page} |
|
|
paginInfo.value={total:resp.data.totalPages, page:resp.data.page} |
|
|
matterList.value=resp.data.data |
|
|
matterList.value=resp.data.data |
|
|
|
|
|
|
|
|
|
|
|
//展开的时候暂时不做目录更新,看以后的使用情况 |
|
|
|
|
|
let node_data = resp.data.data.filter((item) => { |
|
|
|
|
|
return item.dir |
|
|
|
|
|
}).map(val => { |
|
|
|
|
|
const copy = structuredClone(val) |
|
|
|
|
|
copy.dir = !copy.dir |
|
|
|
|
|
return copy |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
if(isNewNode) { |
|
|
|
|
|
//由于支持目录树的原因,所有的空间根目录uuid都是root,这样树组件就有问题,所以用了spaceid作为其uuid |
|
|
|
|
|
//但是云盘的根目录是root,所以当uuid是spaceid时,自动替换为root |
|
|
|
|
|
if(currentNode.value.uuid=="root") props.flushSpaceTree(props.spaceid,node_data); |
|
|
|
|
|
else props.flushSpaceTree(currentNode.value.uuid,node_data); |
|
|
|
|
|
} |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
//----------for dir----------- |
|
|
//----------for dir----------- |
|
|
@ -190,10 +212,21 @@ function onCreateDir(){ |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
//------------------------------------------ |
|
|
//------------------------------------------ |
|
|
|
|
|
// @cell-dblclick="handleDoubleClick" 取消了目录双击打开功能 |
|
|
//打开一个目录 |
|
|
//打开一个目录 |
|
|
function handleDoubleClick(row:matterInfo,ind?:number){ |
|
|
function handleDoubleClick(row:matterInfo,ind?:number){ |
|
|
if(row.dir){ |
|
|
if(row.dir){ |
|
|
|
|
|
if(row.agent){ |
|
|
|
|
|
currentAgent.value={name:row.name,model:false,uuid:row.uuid} |
|
|
|
|
|
} |
|
|
|
|
|
isNewNode=true |
|
|
|
|
|
//1:如果是当前目录的父组件没必要更新目录树 |
|
|
|
|
|
//2: 如果当前目录是当前空间根目录,没必要更新木林森 |
|
|
|
|
|
if(currentNode.value.puuid==row.uuid || row.uuid=="root") isNewNode=false |
|
|
|
|
|
currentNode.value=row |
|
|
|
|
|
onLoadMatterList() |
|
|
|
|
|
|
|
|
|
|
|
/* 由于添加了父级树组件,breadcrumblis的功能废弃 |
|
|
//table的双击事件也在此方法处理 |
|
|
//table的双击事件也在此方法处理 |
|
|
if(typeof(ind)==="number"){ |
|
|
if(typeof(ind)==="number"){ |
|
|
//返回某一级,面包屑组件的点击处理 |
|
|
//返回某一级,面包屑组件的点击处理 |
|
|
@ -204,7 +237,7 @@ function handleDoubleClick(row:matterInfo,ind?:number){ |
|
|
} |
|
|
} |
|
|
}else{ |
|
|
}else{ |
|
|
//进入下一级 |
|
|
//进入下一级 |
|
|
//TODO:当前的目录暂时作为agentid,后期判断当前dir是不是智能体,来决定是否更新 |
|
|
//如果目录是一个智能体,把当前智能体设置为该目录 |
|
|
if(row.agent){ |
|
|
if(row.agent){ |
|
|
currentAgent.value={name:row.name,model:false,uuid:row.uuid} |
|
|
currentAgent.value={name:row.name,model:false,uuid:row.uuid} |
|
|
} |
|
|
} |
|
|
@ -212,7 +245,8 @@ function handleDoubleClick(row:matterInfo,ind?:number){ |
|
|
currentNode.value=row |
|
|
currentNode.value=row |
|
|
breadcrumbList.value.push(row) |
|
|
breadcrumbList.value.push(row) |
|
|
onLoadMatterList() |
|
|
onLoadMatterList() |
|
|
} |
|
|
} |
|
|
|
|
|
*/ |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -409,6 +443,8 @@ const handleSelectionChange = (val:matterInfo[]) => { |
|
|
tabSelected.value = val |
|
|
tabSelected.value = val |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
defineExpose({handleDoubleClick}) |
|
|
|
|
|
|
|
|
//判断是不是空间的所有者 |
|
|
//判断是不是空间的所有者 |
|
|
function isOwner(){ |
|
|
function isOwner(){ |
|
|
return props.uid===btoa(props.owner) |
|
|
return props.uid===btoa(props.owner) |
|
|
@ -416,12 +452,13 @@ function isOwner(){ |
|
|
</script> |
|
|
</script> |
|
|
|
|
|
|
|
|
<template> |
|
|
<template> |
|
|
|
|
|
|
|
|
<div> |
|
|
<div> |
|
|
<el-row :gutter="24" style="margin: 12px 0px;"> |
|
|
<el-row :gutter="24" style="margin: 12px 0px;"> |
|
|
<span class="el-breadcrumb" style="font-weight: bold;">[ {{ props.spacename }} ] : </span> |
|
|
<span class="el-breadcrumb" style="font-weight: bold;">[ {{ props.spacename }} ] : </span> |
|
|
<el-breadcrumb separator="/"> |
|
|
<el-breadcrumb separator="/"> |
|
|
<el-breadcrumb-item v-for="(item,index) in breadcrumbList" |
|
|
<el-breadcrumb-item v-for="(item,index) in breadcrumbList" |
|
|
:key="index" @click="index===breadcrumbList.length-1?'': handleDoubleClick(item,index)"> |
|
|
:key="index" @click="handleDoubleClick(item,index)"> |
|
|
<span style="font-weight: bold;">{{ item.name }}</span> |
|
|
<span style="font-weight: bold;">{{ item.name }}</span> |
|
|
</el-breadcrumb-item> |
|
|
</el-breadcrumb-item> |
|
|
</el-breadcrumb> |
|
|
</el-breadcrumb> |
|
|
@ -448,7 +485,7 @@ function isOwner(){ |
|
|
/> |
|
|
/> |
|
|
文件夹上传 |
|
|
文件夹上传 |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
<el-button @click="onLoadMatterList()">刷新</el-button> |
|
|
<el-button @click="createDir">新建目录</el-button> |
|
|
<el-button @click="createDir">新建目录</el-button> |
|
|
<el-button type="danger" plain @click="onDelMatter({uuid:currentNode.uuid,name:currentNode.name,dir:true, |
|
|
<el-button type="danger" plain @click="onDelMatter({uuid:currentNode.uuid,name:currentNode.name,dir:true, |
|
|
puuid:currentNode.puuid,path:currentNode.path})">删除目录</el-button> |
|
|
puuid:currentNode.puuid,path:currentNode.path})">删除目录</el-button> |
|
|
@ -470,7 +507,6 @@ function isOwner(){ |
|
|
row-key="uuid" |
|
|
row-key="uuid" |
|
|
:row-style ="() => ({ lineHeight: '36px' })" |
|
|
:row-style ="() => ({ lineHeight: '36px' })" |
|
|
@selection-change="handleSelectionChange" |
|
|
@selection-change="handleSelectionChange" |
|
|
@cell-dblclick="handleDoubleClick" |
|
|
|
|
|
@cell-mouse-enter="handleMouseEnter"> |
|
|
@cell-mouse-enter="handleMouseEnter"> |
|
|
<el-table-column type="selection" width="50" /> |
|
|
<el-table-column type="selection" width="50" /> |
|
|
<el-table-column width="450" property="name" label="文件名"> |
|
|
<el-table-column width="450" property="name" label="文件名"> |
|
|
|