Browse Source

双击打开和右键按钮

space2
han2015 3 months ago
parent
commit
795d14f6de
  1. 3
      src/api/doc/type.ts
  2. 47
      src/views/doc/manage.vue
  3. 53
      src/views/doc/space.vue

3
src/api/doc/type.ts

@ -63,9 +63,10 @@ export type matterTreeList = PageResult<matterTree[]>
export type matterResutList = PageResult<matterInfo[]> export type matterResutList = PageResult<matterInfo[]>
export interface createDir{ export interface createDir{
userUuid:string; userUuid?:string;
puuid:string; puuid:string;
name:string; name:string;
space?:string;
} }
export interface createShare{ export interface createShare{

47
src/views/doc/manage.vue

@ -337,6 +337,14 @@ function onCreateDir(){
}) })
} }
function onDBclickMatter(row:matterInfo){
if(row.dir){
onNodeClick(row as matterTree,null,null,null)
}else{
onPrivateView(row)
}
}
// //
function onNodeExpand(node: TreeNode, resolve: (data: matterTree[]) => void, reject: () => void) { function onNodeExpand(node: TreeNode, resolve: (data: matterTree[]) => void, reject: () => void) {
if ((node.data as matterTree).uuid) { if ((node.data as matterTree).uuid) {
@ -627,7 +635,7 @@ function onSpaceNodeClick(data:matterTree,node:TreeNode,self:any,env:any){
uuid: data.uuid ?? "", uuid: data.uuid ?? "",
userUuid: data.userUuid ?? "", userUuid: data.userUuid ?? "",
manager: data.manager ?? false, manager: data.manager ?? false,
permits:data.permits ??{} permits:data.permits ?? { id: 0, MatterUuid: '', data: '' }
}; };
PRIVATESPACE.value=false; PRIVATESPACE.value=false;
}else{ }else{
@ -768,7 +776,7 @@ const handleSelectionChange = (val:matterInfo[]) => {
<div v-if="PRIVATESPACE" class="app_container"> <div v-if="PRIVATESPACE" class="app_container">
<el-row :gutter="24" style="margin: 12px 0px;"> <el-row :gutter="24" style="margin: 12px 0px;">
<el-link v-if="currentNode.name!=='root'" @click="onNodeClick(treeData[0], null as unknown as TreeNode, null, null)"> <el-link v-if="currentNode.name!=='root'" @click="onNodeClick(treeData[0], null as unknown as TreeNode, null, null)">
<span style="font-weight: bold;margin-right: 5px;">根目录</span>/ <span style="font-weight: bold;margin-right: 5px;align-content: center;">根目录</span>/
</el-link> </el-link>
<span style="font-weight: bold;margin:0 5px;align-content:center;">{{ currentNode.name }}</span> <span style="font-weight: bold;margin:0 5px;align-content:center;">{{ currentNode.name }}</span>
@ -821,7 +829,7 @@ const handleSelectionChange = (val:matterInfo[]) => {
<el-table-column width="450" property="name" label="文件名"> <el-table-column width="450" property="name" label="文件名">
<template #default="scope"> <template #default="scope">
<input v-if="scope.row.name===''" v-model="newdirName" type="text" autofocus placeholder="文件夹名" style="border:groove;height:30px;" @change="onCreateDir" /> <input v-if="scope.row.name===''" v-model="newdirName" type="text" autofocus placeholder="文件夹名" style="border:groove;height:30px;" @change="onCreateDir" />
<div v-else style="display: flex; align-items: center;"> <div v-else style="display: flex; align-items: center;" @dblclick="onDBclickMatter(scope.row)">
<svg-icon v-if="scope.row.dir" icon-class="folder-icon" size="30px"/> <svg-icon v-if="scope.row.dir" icon-class="folder-icon" size="30px"/>
<el-image v-else-if="getFileIcon(scope.row.name)==='img'" style="width: 30px;" :preview-src-list="[getImageDownloadURL(scope.row.uuid,scope.row.name)]" :src="getImagePreivewURL(scope.row.uuid,scope.row.name)" /> <el-image v-else-if="getFileIcon(scope.row.name)==='img'" style="width: 30px;" :preview-src-list="[getImageDownloadURL(scope.row.uuid,scope.row.name)]" :src="getImagePreivewURL(scope.row.uuid,scope.row.name)" />
<svg-icon v-else :icon-class="getFileIcon(scope.row.name)+'-icon'" size="30px" /> <svg-icon v-else :icon-class="getFileIcon(scope.row.name)+'-icon'" size="30px" />
@ -858,20 +866,20 @@ const handleSelectionChange = (val:matterInfo[]) => {
<input v-model="newdirName" type="text" autofocus placeholder="文件夹名" style="border:groove;height:30px;" @change="onCreateDir" /> <input v-model="newdirName" type="text" autofocus placeholder="文件夹名" style="border:groove;height:30px;" @change="onCreateDir" />
</div> </div>
<div v-else class="grid-box" @click="handleMouseEnter(row)"> <div v-else class="grid-box" @dblclick="onDBclickMatter(row)" @contextmenu.prevent="handleMouseEnter(row)" >
<svg-icon v-if="row.dir" icon-class="folder-icon" size="80px"/> <svg-icon v-if="row.dir" icon-class="folder-icon" size="80px"/>
<el-image v-else-if="getFileIcon(row.name)==='img'" style="width: 80px;" :preview-src-list="[getImageDownloadURL(row.uuid,row.name)]" :src="getImagePreivewURL(row.uuid,row.name)" /> <el-image v-else-if="getFileIcon(row.name)==='img'" style="width: 80px;" :preview-src-list="[getImageDownloadURL(row.uuid,row.name)]" :src="getImagePreivewURL(row.uuid,row.name)" />
<svg-icon v-else :icon-class="getFileIcon(row.name)+'-icon'" size="80px"/> <svg-icon v-else :icon-class="getFileIcon(row.name)+'-icon'" size="80px"/>
<span style="margin: 5px 0;text-wrap-mode:nowrap;">{{ row.name }}</span> <span style="margin: 5px 0;text-wrap-mode:nowrap;">{{ row.name }}</span>
</div> </div>
</div> </div>
<div v-if="row.name!=''" class="grid-menus" v-show="currentHoverRow === row.name"> <ul v-if="row.name!=''" class="grid-menus" v-show="currentHoverRow === row.name" @mouseleave="currentHoverRow=''">
<el-button v-if="getFileIcon(row.name)!='img'" size="small" :icon="View" circle @click="onPrivateView(row)"></el-button> <li v-if="getFileIcon(row.name)!='img'" @click="onPrivateView(row)">预览</li>
<el-button size="small" :icon="Share" circle @click="onShareMatter(row)"></el-button> <li size="small" :icon="Share" @click="onShareMatter(row)">分享</li>
<el-button size="small" :icon="Download" circle @click="onDownload(row)"></el-button> <li size="small" :icon="Download" @click="onDownload(row)">下载</li>
<el-button size="small" :icon="Edit" circle @click="onlyOfficeEdit(row)"></el-button> <li size="small" :icon="Edit" @click="onlyOfficeEdit(row)">编辑</li>
<el-button size="small" :icon="Delete" circle @click="onDelMatter(row)"></el-button> <li size="small" :icon="Delete" @click="onDelMatter(row)">删除</li>
</div> </ul>
</div> </div>
</div> </div>
</el-row> </el-row>
@ -969,10 +977,10 @@ const handleSelectionChange = (val:matterInfo[]) => {
flex-wrap: wrap; /* 关键属性,允许子元素自动换行 */ flex-wrap: wrap; /* 关键属性,允许子元素自动换行 */
.grid-item{ .grid-item{
position: relative; position: relative;
height: 134px; width: 134px;
width: 134px;
margin: 5px; margin: 5px;
.grid-box{ .grid-box{
height: 150px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
overflow: hidden; overflow: hidden;
@ -982,9 +990,16 @@ const handleSelectionChange = (val:matterInfo[]) => {
.grid-menus{ .grid-menus{
position: absolute; position: absolute;
top: 10px; top: 10px;
button{ left: 72px;
color: #000000; background-color: #ffffff;
margin: 4px; width: 60px;
line-height: 27px;
text-align: center;
color: #878989;
box-shadow:0px 0px 12px rgba(0,0,0,0.12);
li{
cursor: pointer;
border-bottom: 1px solid #ccc;
} }
} }
.grid{ .grid{

53
src/views/doc/space.vue

@ -67,7 +67,6 @@ const props = withDefaults(defineProps<{
siteHost:string, siteHost:string,
owner:string, owner:string,
apiURL:string, apiURL:string,
roles:string,
listOrGrid:boolean, listOrGrid:boolean,
ismanager:boolean, ismanager:boolean,
spacePermit:matterPermit, spacePermit:matterPermit,
@ -138,7 +137,6 @@ function onDelMatter(row:matterInfo){
doDelSpaceMatter(props.uid,{ doDelSpaceMatter(props.uid,{
"uuid":row.uuid, "uuid":row.uuid,
"space":props.spaceid, "space":props.spaceid,
"roles":props.roles,
}).then(()=>{ }).then(()=>{
currentNode.value.uuid = row.puuid ?? "" currentNode.value.uuid = row.puuid ?? ""
currentNode.value.name = row.path ? row.path.replace(`/${row.name}`,'').match(/[^/]+$/g)?.pop() :"上级目录" currentNode.value.name = row.path ? row.path.replace(`/${row.name}`,'').match(/[^/]+$/g)?.pop() :"上级目录"
@ -172,7 +170,6 @@ function onLoadMatterList(){
puuid:currentNode.value.uuid, puuid:currentNode.value.uuid,
deleted:false, deleted:false,
space:props.spaceid, space:props.spaceid,
roles:props.roles,
}; };
getSpaceMatterList(props.uid,_page).then((resp)=>{ getSpaceMatterList(props.uid,_page).then((resp)=>{
@ -245,7 +242,6 @@ function onCreateDir(){
puuid:currentNode.value.uuid, puuid:currentNode.value.uuid,
name:newdirName.value, name:newdirName.value,
space:props.spaceid, space:props.spaceid,
roles:props.roles,
}).then((resp)=> { }).then((resp)=> {
newdirName.value="" newdirName.value=""
onLoadMatterList() onLoadMatterList()
@ -254,6 +250,7 @@ function onCreateDir(){
ElMessage.error(e.msg) ElMessage.error(e.msg)
}) })
} }
//------------------------------------------ //------------------------------------------
// @cell-dblclick="handleDoubleClick" // @cell-dblclick="handleDoubleClick"
// //
@ -308,13 +305,11 @@ function handleDoubleClick(row:matterInfo,ind?:number){
onLoadMatterList() onLoadMatterList()
} }
*/ */
}else{
onPrivateView(row)
} }
} }
function checkMatterPermit(){
}
function handleMouseEnter(row:any){ function handleMouseEnter(row:any){
currentHoverRow.value=row.name currentHoverRow.value=row.name
} }
@ -416,7 +411,6 @@ async function doCreateMultyDir(path:string,uuid:string){
puuid:uuid, puuid:uuid,
name:dirs[i], name:dirs[i],
space:props.spaceid, space:props.spaceid,
roles:props.roles,
}).then((resp)=> { }).then((resp)=> {
uuid=resp.data.uuid //uuid, puuid uuid=resp.data.uuid //uuid, puuid
list.push(resp.data) list.push(resp.data)
@ -549,12 +543,13 @@ function isOwner(){
<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="handleDoubleClick(item,index)"> :key="index" @click="handleDoubleClick(item,index)">
<span style="font-weight: bold;">{{ item.name }}</span> <span style="font-weight: bold;cursor: pointer;">{{ item.name }}</span>
</el-breadcrumb-item> </el-breadcrumb-item>
</el-breadcrumb> </el-breadcrumb> -->
<span style="font-weight: bold;margin:0 5px;align-content:center;">{{ currentNode.name }}</span>
</el-row> </el-row>
<el-row :gutter="24"> <el-row :gutter="24">
@ -597,7 +592,7 @@ function isOwner(){
<el-table-column width="450" property="name" label="文件名"> <el-table-column width="450" property="name" label="文件名">
<template #default="scope"> <template #default="scope">
<input v-if="scope.row.name===''" v-model="newdirName" type="text" autofocus placeholder="文件夹名" style="border:groove;height:30px;" @change="onCreateDir" /> <input v-if="scope.row.name===''" v-model="newdirName" type="text" autofocus placeholder="文件夹名" style="border:groove;height:30px;" @change="onCreateDir" />
<div v-else style="display: flex; align-items: center;"> <div v-else style="display: flex; align-items: center;" @dblclick="handleDoubleClick(scope.row)" >
<svg-icon v-if="scope.row.dir" icon-class="folder-icon" :size="30"/> <svg-icon v-if="scope.row.dir" icon-class="folder-icon" :size="30"/>
<el-image v-else-if="getFileIcon(scope.row.name)==='img'" style="width: 30px;" :preview-src-list="[getSpaceImageDURL(scope.row.uuid,scope.row.name)]" :src="getSpaceImageViewURL(scope.row.uuid,scope.row.name)" /> <el-image v-else-if="getFileIcon(scope.row.name)==='img'" style="width: 30px;" :preview-src-list="[getSpaceImageDURL(scope.row.uuid,scope.row.name)]" :src="getSpaceImageViewURL(scope.row.uuid,scope.row.name)" />
<svg-icon v-else :icon-class="getFileIcon(scope.row.name)+'-icon'" :size="30" /> <svg-icon v-else :icon-class="getFileIcon(scope.row.name)+'-icon'" :size="30" />
@ -636,7 +631,7 @@ function isOwner(){
<input v-model="newdirName" type="text" autofocus placeholder="文件夹名" style="border:groove;height:30px;" @change="onCreateDir" /> <input v-model="newdirName" type="text" autofocus placeholder="文件夹名" style="border:groove;height:30px;" @change="onCreateDir" />
</div> </div>
<div v-else class="grid-box" @mouseenter="handleMouseEnter(row)"> <div v-else class="grid-box" @dblclick="handleDoubleClick(row)" @contextmenu.prevent="handleMouseEnter(row)" >
<svg-icon v-if="row.dir" icon-class="folder-icon" size="80px"/> <svg-icon v-if="row.dir" icon-class="folder-icon" size="80px"/>
<el-image v-else-if="getFileIcon(row.name)==='img'" style="width: 80px;" :preview-src-list="[getSpaceImageDURL(row.uuid,row.name)]" :src="getSpaceImageViewURL(row.uuid,row.name)" /> <el-image v-else-if="getFileIcon(row.name)==='img'" style="width: 80px;" :preview-src-list="[getSpaceImageDURL(row.uuid,row.name)]" :src="getSpaceImageViewURL(row.uuid,row.name)" />
<svg-icon v-else :icon-class="getFileIcon(row.name)+'-icon'" size="80px"/> <svg-icon v-else :icon-class="getFileIcon(row.name)+'-icon'" size="80px"/>
@ -644,15 +639,15 @@ function isOwner(){
<el-tag v-if="row.agent" effect="dark" size="small" type="success" round >智能体</el-tag> <el-tag v-if="row.agent" effect="dark" size="small" type="success" round >智能体</el-tag>
</div> </div>
</div> </div>
<div v-if="row.name!=''" class="grid-menus" v-show="currentHoverRow === row.name"> <ul v-if="row.name!=''" class="grid-menus" v-show="currentHoverRow === row.name" @mouseleave="currentHoverRow=''">
<el-button v-if="getFileIcon(row.name)!='img'" size="small" :icon="View" circle @click="onPrivateView(row)"></el-button> <li v-if="getFileIcon(row.name)!='img'" @click="onPrivateView(row)">预览</li>
<el-button v-if="row.permitVal! >= PERMITS.DOWNLOAD" size="small" :icon="Download" circle @click="onDownload(row)"></el-button> <li v-if="row.permitVal! >= PERMITS.DOWNLOAD" @click="onDownload(row)">下载</li>
<el-button v-if="row.permitVal! >= PERMITS.EDIT" size="small" :icon="Edit" circle @click="onlyOfficeEdit(row)"></el-button> <li v-if="row.permitVal! >= PERMITS.EDIT" @click="onlyOfficeEdit(row)">编辑</li>
<span v-if="row.permitVal! >= PERMITS.MANAGER" > <span v-if="row.permitVal! >= PERMITS.MANAGER" >
<el-button size="small" :icon="Delete" circle @click="onDelMatter(row)"></el-button> <li @click="onDelMatter(row)">删除</li>
<el-button size="small" :icon="Setting" circle @click="onSpacePManage(row)"></el-button> <li @click="onSpacePManage(row)">权限</li>
</span> </span>
</div> </ul>
</div> </div>
</div> </div>
</el-row> </el-row>
@ -684,10 +679,10 @@ function isOwner(){
flex-wrap: wrap; /* 关键属性,允许子元素自动换行 */ flex-wrap: wrap; /* 关键属性,允许子元素自动换行 */
.grid-item{ .grid-item{
position: relative; position: relative;
height: 134px;
width: 134px; width: 134px;
margin: 5px; margin: 5px;
.grid-box{ .grid-box{
height: 150px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
overflow: hidden; overflow: hidden;
@ -697,9 +692,17 @@ function isOwner(){
.grid-menus{ .grid-menus{
position: absolute; position: absolute;
top: 10px; top: 10px;
button{ left: 72px;
color: black; background-color: #ffffff;
margin: 4px; width: 60px;
line-height: 27px;
text-align: center;
color: #878989;
z-index: 999;
box-shadow:0px 0px 12px rgba(0,0,0,0.12);
li{
cursor: pointer;
border-bottom: 1px solid #ccc;
} }
} }
.grid{ .grid{

Loading…
Cancel
Save