diff --git a/src/api/doc/index.ts b/src/api/doc/index.ts index 52932c3..1316459 100644 --- a/src/api/doc/index.ts +++ b/src/api/doc/index.ts @@ -188,4 +188,19 @@ export function postMatterRename(uid:string,data?: {uuid:string;name:string}){ }, data: data }); +} + +/** + * 移动文件 + */ +export function postMatterMove(uid:string,data?: {srcUuids:string;destUuid:string}){ + return request({ + url: '/hxpan/api/matter/move', + method: 'post', + headers: { + 'Identifier':uid, + 'Content-Type': 'application/x-www-form-urlencoded' + }, + data: data + }); } \ No newline at end of file diff --git a/src/api/doc/space.ts b/src/api/doc/space.ts index 45a52ef..3c8297f 100644 --- a/src/api/doc/space.ts +++ b/src/api/doc/space.ts @@ -119,6 +119,17 @@ export function doAiTraining(_url:string,data?: any){ data: data }); } +//文档删除 +export function doAiDocDels(_url:string,data?: any){ + return request({ + url: '/aibot'+_url, + method: 'post', + headers: { + 'Content-Type': 'application/x-www-form-urlencoded' + }, + data: data + }); +} export interface aiChatData{ inputs:object; diff --git a/src/api/doc/type.ts b/src/api/doc/type.ts index aa1f1ba..f37ee28 100644 --- a/src/api/doc/type.ts +++ b/src/api/doc/type.ts @@ -15,6 +15,7 @@ export interface matterPage{ deleted?:boolean; orderDir?:string; name?:string; + dir?:string;// ‘true’ or ‘false’ 字符串,表示是否只查询文件夹或文件 space?:string; orderCreateTime?:string; } @@ -89,12 +90,13 @@ export interface respCreateShare{ /** * 文件上传 */ -export function doFileUpload(params:FormData,_url:string): AxiosPromise { +export function doFileUpload(uid:string,params:FormData,_url:string): AxiosPromise { return request({ url: _url, method: 'post', data: params, headers: { + 'Identifier':uid, 'Content-Type': 'multipart/form-data' } }); diff --git a/src/views/doc/manage.vue b/src/views/doc/manage.vue index e50129b..33ab1ec 100644 --- a/src/views/doc/manage.vue +++ b/src/views/doc/manage.vue @@ -7,7 +7,7 @@ import { getExpirTime, getFileIcon, readableSize,fileType} from "./tools" import sharePermission from './sharePermission.vue'; import { useUserStore } from "@/store/modules/user"; -import { getMatterList,postCreateDir,postDelMatter,postCreateShare,postMatterRename, +import { getMatterList,postCreateDir,postDelMatter,postCreateShare,postMatterRename,postMatterMove, postDelMatBatch,getMySpaces,doCreateSpace,getRecyclingList} from "@/api/doc/index" import { matterPage,matterInfo,respCreateShare,matterTree, doFileUpload,matterPermit} from "@/api/doc/type" import { h } from 'vue' @@ -28,6 +28,7 @@ import SvgIcon from "@/components/SvgIcon/index.vue"; import {doDelSpace,doAccessManage,doCreateAiagent,setAgentQueryURL,getAgentQueryURL} from "@/api/doc/space" import Space from "./space.vue"; import Logpanel from "./logpanel.vue"; +import Movepanel from "./movepanel.vue"; //TODO: add file icons done! //TODO: click on table-item, 1)preview on file ..................... @@ -279,6 +280,30 @@ function onMatterRename(row:matterInfo){ }) } +//文件移动 +function onMoveFile(row:matterInfo){ + const dstuuid=ref(row.puuid) + ElMessageBox({ + customStyle: { '--el-messagebox-width':'800px',padding:'40px'}, + message:() => h(Movepanel,{ + style: { width:'100%' }, + modelValue: dstuuid.value, + 'onUpdate:modelValue': (val) => { + dstuuid.value = val + }, + }), + }).then(() => { + if(dstuuid.value!=row.puuid){ + postMatterMove(uid,{ + srcUuids:row.uuid, + destUuid:dstuuid.value as string, + }).then(()=>onLoadMatterList()) + }else{ + alert("目录相同不需要移动") + } + }) +} + //加载文件列表 function onSearchFile(name?:string){ let _page: matterPage = { @@ -596,7 +621,7 @@ async function handleSingleFile(ff:File){ fields.append("puuid",uploadFormData.value.puuid) fields.append("file",ff) - const res = await doFileUpload(fields,'/hxpan/api/matter/upload') + const res = await doFileUpload(uid,fields,'/hxpan/api/matter/upload') if(res.code!=200){ console.log(ff.name+"上传失败! ") throw new Error(ff.name+"上传失败!
") @@ -661,7 +686,7 @@ async function handleFolderFile(option:File){ fields.append('file', option) fields.append("space",uploadFormData.value.space) fields.append("puuid",puuid) - const res = await doFileUpload(fields,'/hxpan/api/matter/upload') + const res = await doFileUpload(uid,fields,'/hxpan/api/matter/upload') if(res.code!=200){ console.log(_path+"上传失败! ") throw new Error(_path +" 上传失败!
") @@ -1095,7 +1120,8 @@ const handleSelectionChange = (val:matterInfo[]) => { - + + @@ -1133,6 +1159,7 @@ const handleSelectionChange = (val:matterInfo[]) => {
  • 分享
  • 下载
  • 编辑
  • +
  • 移动
  • 删除
  • 重命名
  • @@ -1251,6 +1278,7 @@ const handleSelectionChange = (val:matterInfo[]) => { display: flex; flex-wrap: wrap; /* 关键属性,允许子元素自动换行 */ align-content: flex-start; + min-height: 500px; .grid-item{ position: relative; width: 134px; diff --git a/src/views/doc/movepanel.vue b/src/views/doc/movepanel.vue new file mode 100644 index 0000000..98cbf54 --- /dev/null +++ b/src/views/doc/movepanel.vue @@ -0,0 +1,344 @@ + + + + + + + + \ No newline at end of file diff --git a/src/views/doc/space.vue b/src/views/doc/space.vue index f7e3e6f..8db7516 100644 --- a/src/views/doc/space.vue +++ b/src/views/doc/space.vue @@ -10,7 +10,7 @@ import sharePermission from './sharePermission.vue'; import spacePermission from './spacePermission.vue'; import { matterPage,matterInfo,matterTree,doFileUpload,matterPermit} from "@/api/doc/type" import { doAccessManage,getSpaceMatterList,doCreateSpaceDir,doDelSpaceMatter, - doAiTraining ,spaceMatterRename} from "@/api/doc/space" + doAiTraining,doAiDocDels,spaceMatterRename} from "@/api/doc/space" import { h } from 'vue' import { Delete, @@ -159,6 +159,7 @@ function onDelMatter(row:matterInfo){ currentNode.value.uuid = row.puuid ?? "" onLoadMatterList() }) + handleAiDelete(row) }) } } @@ -412,7 +413,7 @@ async function handleSingleFile(ff:File){ fields.append("puuid",uploadFormData.value.puuid) fields.append("file",ff) - const res = await doFileUpload(fields,'/hxpan/api/space/upload') + const res = await doFileUpload(props.uid,fields,'/hxpan/api/space/upload') if(res.code!=200){ console.log(ff.name+"上传失败! ") throw new Error(ff.name+"上传失败!
    ") @@ -478,7 +479,7 @@ async function handleFolderFile(option:File){ fields.append('file', option) fields.append("space",uploadFormData.value.space) fields.append("puuid",puuid) - const res = await doFileUpload(fields,'/hxpan/api/space/upload') + const res = await doFileUpload(props.uid,fields,'/hxpan/api/space/upload') if(res.code!=200){ console.log(_path+"上传失败! ") throw new Error(_path+"上传失败!
    ") @@ -530,6 +531,22 @@ function handleAiUpload(info:matterInfo){ } } +function handleAiDelete(info:matterInfo){ + //只有当前路径是智能体,删除才会同步大模型 + if (info.path?.startsWith(currentAgent.value.path)){ + doAiDocDels(`/agents/${currentAgent.value.uuid}/deldoc`,{ + "name":info.name, + "path":info.path, + }).then(resp=>{ + ElMessage({ + message: '已成功删除', + type: 'error', + plain: true, + }) + }) + } +} + //------------------------------------------------- //-------------------edit & preive file for space---------------------