Browse Source

云盘:修改文件名

space2
han2015 2 months ago
parent
commit
f5130b5dc9
  1. 16
      src/api/doc/space.ts
  2. 14
      src/views/doc/agent.vue
  3. 30
      src/views/doc/manage.vue
  4. 28
      src/views/doc/onlyoffice.vue
  5. 4
      src/views/doc/recentVisited.vue
  6. 54
      src/views/doc/space.vue

16
src/api/doc/space.ts

@ -74,6 +74,22 @@ export function doDelSpace(uid:string,data?: any){
});
}
/**
*
*/
export function spaceMatterRename(uid:string,data?: any){
return request({
url: '/hxpan/api/space/rename',
method: 'post',
headers: {
'Identifier':uid,
'Content-Type': 'application/x-www-form-urlencoded'
},
data: data
});
}
/**
*
*/

14
src/views/doc/agent.vue

@ -244,10 +244,12 @@ onMounted(() => {
<div v-else class="t_resp">
<el-text style="white-space: pre-line" v-html="msg.think"></el-text>
<VueMarkdown :markdown="msg.content" :rehype-plugins="[rehypeRaw]" :remark-plugins="[remarkGfm]" ></VueMarkdown>
<div v-if="msg.docinfo" class="doc_ref">
<div v-if="msg.docinfo?.length>0" class="doc_ref">
引用<hr>
<el-tooltip v-for="doc in msg.docinfo" placement="top" effect="dark"
:content="formatRefContent(doc.content)">
<el-tooltip v-for="doc in msg.docinfo" placement="top" effect="dark">
<template #content>
<div v-html="formatRefContent(doc.content)" />
</template>
<span>{{doc.document_name}}</span>
</el-tooltip>
</div>
@ -389,6 +391,12 @@ onMounted(() => {
}
ol{
margin-left: 14px;
ul{
margin-left: 30px;
li{
list-style: disc;
}
}
}
ol>li{
list-style-type: decimal;

30
src/views/doc/manage.vue

@ -254,10 +254,12 @@ function onMatterRename(row:matterInfo){
},
}),
}).then(() => {
postMatterRename(uid,{
uuid:row.uuid,
name:newname.value,
}).then(()=>onLoadMatterList())
if(newname.value&&newname.value!=""){
postMatterRename(uid,{
uuid:row.uuid,
name:newname.value,
}).then(()=>onLoadMatterList())
}
})
}
@ -841,7 +843,7 @@ const handleSelectionChange = (val:matterInfo[]) => {
</el-button-group>
</el-row>
<el-row :gutter="24" style="overflow-y: auto;">
<el-row :gutter="24" style="overflow-y: auto; height: 90%;">
<el-table v-if="modListOrGrild"
stripe
:data="matterList"
@ -865,7 +867,7 @@ const handleSelectionChange = (val:matterInfo[]) => {
</div>
</template>
</el-table-column>
<el-table-column width="250" align="center">
<el-table-column width="360" align="center">
<template #default="scope">
<div v-show="currentHoverRow === scope.row.name">
<!-- <el-button size="small" :icon="Promotion" circle ></el-button> -->
@ -874,6 +876,7 @@ const handleSelectionChange = (val:matterInfo[]) => {
<el-button size="small" :icon="Download" circle @click="onDownload(scope.row)"></el-button>
<el-button size="small" :icon="Edit" circle @click="onlyOfficeEdit(scope.row)"></el-button>
<el-button size="small" :icon="Delete" circle @click="onDelMatter(scope.row)"></el-button>
<el-button size="small" circle @click="onMatterRename(scope.row)"></el-button>
</div>
</template>
</el-table-column>
@ -902,10 +905,11 @@ const handleSelectionChange = (val:matterInfo[]) => {
</div>
<ul v-if="row.name!=''" class="grid-menus" v-show="currentHoverRow === row.name" @mouseleave="currentHoverRow=''">
<li v-if="getFileIcon(row.name)!='img'" @click="onPrivateView(row)">预览</li>
<li size="small" :icon="Share" @click="onShareMatter(row)">分享</li>
<li size="small" :icon="Download" @click="onDownload(row)">下载</li>
<li size="small" :icon="Edit" @click="onlyOfficeEdit(row)">编辑</li>
<li size="small" :icon="Delete" @click="onDelMatter(row)">删除</li>
<li @click="onShareMatter(row)">分享</li>
<li @click="onDownload(row)">下载</li>
<li @click="onlyOfficeEdit(row)">编辑</li>
<li @click="onDelMatter(row)">删除</li>
<li @click="onMatterRename(row)">重命名</li>
</ul>
</div>
</div>
@ -1002,12 +1006,13 @@ const handleSelectionChange = (val:matterInfo[]) => {
.table-grid{
display: flex;
flex-wrap: wrap; /* 关键属性,允许子元素自动换行 */
align-content: flex-start;
.grid-item{
position: relative;
width: 134px;
width: 134px;
height: 145px;
margin: 5px;
.grid-box{
height: 150px;
display: flex;
flex-direction: column;
overflow: hidden;
@ -1023,6 +1028,7 @@ const handleSelectionChange = (val:matterInfo[]) => {
line-height: 27px;
text-align: center;
color: #878989;
z-index: 90;
box-shadow:0px 0px 12px rgba(0,0,0,0.12);
li{
cursor: pointer;

28
src/views/doc/onlyoffice.vue

@ -53,22 +53,22 @@ onMounted(()=>{
const _url=decodeURIComponent(window.atob(query.fileurl))
const name=query.name?.toString()??""
const dtype=query.dtype?.toString()??"word"
//
if (_info.includes(name)){
config.value.document.url=_url
config.value.document.title=name
const _key=_url.match(/(\w+-\w+-\w+)/)![0]
if(_key) config.value.document.key=_key+(new Date().getTime().toString()) //unique key
config.value.documentType=dtype
config.value.editorConfig.callbackUrl+=`?info=${_info}`
//
if(!query.verify) return;
const _verify = atob(query.verify)
//1true 2uuid
if(_verify.endsWith("true") && _key.includes(_verify.replace("true",""))){
config.value.editorConfig.mode="edit"
}
config.value.document.url=_url
config.value.document.title=name
const _key=_url.match(/(\w+-\w+-\w+)/)![0]
if(_key) config.value.document.key=_key+(new Date().getTime().toString()) //unique key
config.value.documentType=dtype
config.value.editorConfig.callbackUrl+=`?info=${_info}`
//
if(!query.verify) return;
const _verify = atob(query.verify)
//1true 2uuid
if(_verify.endsWith("true") && _key.includes(_verify.replace("true",""))){
config.value.editorConfig.mode="edit"
}
}
})

4
src/views/doc/recentVisited.vue

@ -24,9 +24,9 @@ const props = withDefaults(defineProps<{
function onlyOfficeView(row:shareItem){
const _type=fileType(row.name!)
if(_type!==""){ //office file
const info =btoa(encodeURIComponent(`${row.userUuid}/root${row.matters[0].path}`))
const info =btoa(encodeURIComponent(`${row.name}`))
const _url=`${siteHost}${apiURL}/share/zip?shareUuid=${row.uuid}&code=${row.code}&uid=${props.uid}&dprt=${props.udprt}&puuid=root&rootUuid=root`
window.open(`/#/onlyoffice?name=${row.name}&dtype=${_type}&info=${info}&fileurl=`+encodeURIComponent(_url),"_blank")
window.open(`/#/onlyoffice?name=${row.name}&dtype=${_type}&info=${info}&fileurl=`+window.btoa(encodeURIComponent(_url)),"_blank")
}else{
//by kkFilePreview
let a = row.name ?? '';

54
src/views/doc/space.vue

@ -9,7 +9,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 ,doCreateAiagent} from "@/api/doc/space"
doAiTraining ,doCreateAiagent,spaceMatterRename} from "@/api/doc/space"
import { h } from 'vue'
import {
Delete,
@ -274,6 +274,31 @@ function onCreateDir(){
})
}
//
function onMatterRename(row:matterInfo){
const newname=ref(row.name)
ElMessageBox({
title:"请输入新的文件名",
confirmButtonText: "确定",
cancelButtonText: "取消",
message: () => h(ElInput, {
style: { width:'360px' },
modelValue: newname.value,
'onUpdate:modelValue': (val) => {
newname.value = val
},
}),
}).then(() => {
if(newname.value&&newname.value!=""){
spaceMatterRename(props.uid,{
space:props.spaceid,
uuid:row.uuid,
name:newname.value,
}).then(()=>onLoadMatterList())
}
})
}
//------------------------------------------
// @cell-dblclick="handleDoubleClick"
//
@ -468,7 +493,11 @@ function handleAiUpload(info:matterInfo){
//
if (info.path?.startsWith(currentAgent.value.path)){
doAiTraining(`/agents/${currentAgent.value.uuid}/updates`,{"matter":info.uuid}).then(resp=>{
console.log(resp)
ElMessage({
message: '已成功安排训练',
type: 'success',
plain: true,
})
})
}else{
alert("当前路径没有智能体")
@ -567,7 +596,6 @@ function isOwner(){
</script>
<template>
<div>
<el-row :gutter="24" style="margin: 12px 0px;">
<span class="el-breadcrumb" style="font-weight: bold; align-content: center;">[ {{ props.spacename }} ] : </span>
<el-breadcrumb separator="/" style="align-content: center;">
@ -613,7 +641,7 @@ function isOwner(){
</el-button-group>
</el-row>
<el-row :gutter="24" style="height: 84%;overflow-y: auto;">
<el-row :gutter="24" style="overflow-y: auto;height: 90%;">
<el-table v-if="modListOrGrild"
stripe
:data="matterList"
@ -641,12 +669,15 @@ function isOwner(){
<div v-show="currentHoverRow === scope.row.name" style="display:inline; margin-left:15px">
<el-button v-if="getFileIcon(scope.row.name)!='img'" size="small" :icon="View" circle @click="onPrivateView(scope.row)"></el-button>
<el-button v-if="scope.row.permitVal>=PERMITS.DOWNLOAD" size="small" :icon="Download" circle @click="onDownload(scope.row)"></el-button>
<el-button v-if="scope.row.permitVal>=PERMITS.EDIT" size="small" :icon="Edit" circle @click="onlyOfficeEdit(scope.row)"></el-button>
<span v-if="scope.row.permitVal>=PERMITS.MANAGER" class="manager_span" >
<el-button v-if="!scope.row.dir" size="small" circle @click="handleAiUpload(scope.row)">AI</el-button>
<el-button size="small" :icon="Delete" circle @click="onDelMatter(scope.row)"></el-button>
<el-button size="small" :icon="Setting" circle @click="onSpacePManage(scope.row)"></el-button>
</span>
<span v-if="scope.row.permitVal>=PERMITS.EDIT" class="manager_span">
<el-button size="small" :icon="Edit" circle @click="onlyOfficeEdit(scope.row)"></el-button>
<el-button size="small" circle @click="onMatterRename(scope.row)"></el-button>
</span>
</div>
</template>
</el-table-column>
@ -678,10 +709,13 @@ function isOwner(){
<ul v-if="row.name!=''" class="grid-menus" v-show="currentHoverRow === row.name" @mouseleave="currentHoverRow=''">
<li v-if="getFileIcon(row.name)!='img'" @click="onPrivateView(row)">预览</li>
<li v-if="row.permitVal! >= PERMITS.DOWNLOAD" @click="onDownload(row)">下载</li>
<li v-if="row.permitVal! >= PERMITS.EDIT" @click="onlyOfficeEdit(row)">编辑</li>
<span v-if="row.permitVal! >= PERMITS.EDIT" >
<li @click="onlyOfficeEdit(row)">编辑</li>
<li @click="onMatterRename(row)">重命名</li>
</span>
<span v-if="row.permitVal! >= PERMITS.MANAGER" >
<li @click="onDelMatter(row)">删除</li>
<li @click="onSpacePManage(row)">权限</li>
<li @click="onSpacePManage(row)">权限</li>
</span>
</ul>
</div>
@ -691,7 +725,6 @@ function isOwner(){
<el-row v-if="paginInfo.total>1" style="justify-content: center;">
<el-pagination size="small" background layout="prev, pager, next" :current-page="paginInfo.page+1" @current-change="(value:number)=>{paginInfo.page=value-1;onLoadMatterList();}" :page-count="paginInfo.total" class="mt-4"/>
</el-row>
</div>
<aiagent :agent="currentAgent" :userid="uid" :uuid="currentAgent" :closefunc="()=>{currentAgent.model=false}"></aiagent>
@ -718,12 +751,13 @@ function isOwner(){
.table-grid{
display: flex;
flex-wrap: wrap; /* 关键属性,允许子元素自动换行 */
align-content: flex-start;
.grid-item{
position: relative;
width: 134px;
height: 135px;
margin: 5px;
.grid-box{
height: 150px;
display: flex;
flex-direction: column;
overflow: hidden;
@ -739,7 +773,7 @@ function isOwner(){
line-height: 27px;
text-align: center;
color: #878989;
z-index: 999;
z-index: 90;
box-shadow:0px 0px 12px rgba(0,0,0,0.12);
li{
cursor: pointer;

Loading…
Cancel
Save