文档管理bug修改

This commit is contained in:
wangxk 2025-03-25 11:29:52 +08:00
parent 5dae66f63e
commit f6e4553a70
2 changed files with 47 additions and 25 deletions

View File

@ -101,11 +101,16 @@ function gettreedata() {
getTsNodesTree(treeForm.value).then((res: any) => { getTsNodesTree(treeForm.value).then((res: any) => {
treedata.value = res.data treedata.value = res.data
treeloading.value = false treeloading.value = false
if (treedata.value[0]) {
pathid.value = treedata.value[0].nodeId pathid.value = treedata.value[0].nodeId
nextTick(() => { nextTick(() => {
treeRef.value?.setCurrentKey(pathid.value); treeRef.value?.setCurrentKey(pathid.value);
}); });
getdata() getdata()
} else {
tableData.value.length = 0
}
}) })
} }
const pathid = ref() const pathid = ref()
@ -590,9 +595,7 @@ const title1 = ref('')
const isViewfile = ref(false) const isViewfile = ref(false)
const fileType = ref('') const fileType = ref('')
function openPreview(row: any) { function openPreview(row: any) {
// debugger?
if (getFileExtension(row.fileName) == 'pdf' || getFileExtension(row.fileName) == 'pptx' || getFileExtension(row.fileName) == 'xlsx' || getFileExtension(row.fileName) == 'xls' || getFileExtension(row.fileName) == 'docx' || getFileExtension(row.fileName) == 'doc' || getFileExtension(row.fileName) == 'bin') { if (getFileExtension(row.fileName) == 'pdf' || getFileExtension(row.fileName) == 'pptx' || getFileExtension(row.fileName) == 'xlsx' || getFileExtension(row.fileName) == 'xls' || getFileExtension(row.fileName) == 'docx' || getFileExtension(row.fileName) == 'doc' || getFileExtension(row.fileName) == 'bin') {
// debugger
title1.value = row.fileName title1.value = row.fileName
ViewfileUrl.value = row.url ViewfileUrl.value = row.url
isViewfile.value = true isViewfile.value = true
@ -794,7 +797,7 @@ function paste() {
// //
copyarr.value.forEach((items: any) => { copyarr.value.forEach((items: any) => {
repeatObj.oldpaths ='/' + pathid.value + items.workPath repeatObj.oldpaths = '/' + pathid.value + items.workPath
repeatObj.newFileName.push(items.fileName) repeatObj.newFileName.push(items.fileName)
}) })
repeatObj.newFileName = repeatObj.newFileName.join(',') repeatObj.newFileName = repeatObj.newFileName.join(',')
@ -1188,7 +1191,6 @@ async function submitzip(formEl: any) {
// gettreedata() // gettreedata()
getdata() getdata()
zipfiles.value = false zipfiles.value = false
// debugger
zipObj.value.compressedPath = '/' + pathid.value + zipObj.value.compressedPath zipObj.value.compressedPath = '/' + pathid.value + zipObj.value.compressedPath
compress(zipObj.value).then((res: any) => { compress(zipObj.value).then((res: any) => {
if (res.code == 0) { if (res.code == 0) {
@ -1234,7 +1236,7 @@ const jiepatharr: any = ref([])
function gettsfiles() { function gettsfiles() {
filetsobj.value.nodeId = pathid.value filetsobj.value.nodeId = pathid.value
filetsobj.value.taskId = projectId.value filetsobj.value.taskId = projectId.value
filetsobj.value.path ='/' + pathid.value+filetsobj.value.path filetsobj.value.path = '/' + pathid.value + filetsobj.value.path
listTsFiles(filetsobj.value).then((res: any) => { listTsFiles(filetsobj.value).then((res: any) => {
listFilesarr.value = res.data listFilesarr.value = res.data
if (res.data[0]) { if (res.data[0]) {
@ -1568,8 +1570,8 @@ function textClose() {
</div> </div>
<div> <div>
<!-- :disabled="pathid.value" --> <!-- :disabled="pathid.value" -->
<el-button type="primary" @click="creatFile">创建文件/文件夹</el-button> <el-button type="primary" :disabled="loading" @click="creatFile">创建文件/文件夹</el-button>
<el-button type="primary" :disabled="!pathid" @click="openFile">上传</el-button> <el-button type="primary" :disabled="loading" @click="openFile">上传</el-button>
<el-button type="primary" @click="delprojectArr()" :disabled="tableIdarr.length == 0">删除</el-button> <el-button type="primary" @click="delprojectArr()" :disabled="tableIdarr.length == 0">删除</el-button>
<el-button type="primary" @click="xiafilemony()" :disabled="tableIdarr.length == 0">下载</el-button> <el-button type="primary" @click="xiafilemony()" :disabled="tableIdarr.length == 0">下载</el-button>
</div> </div>

View File

@ -149,11 +149,17 @@ function gettreedata() {
getTsNodesTree(treeForm.value).then((res: any) => { getTsNodesTree(treeForm.value).then((res: any) => {
treedata.value = res.data treedata.value = res.data
treeloading.value = false treeloading.value = false
if(treedata.value[0].nodeId ){
pathid.value = treedata.value[0].nodeId pathid.value = treedata.value[0].nodeId
nextTick(() => { nextTick(() => {
treeRef.value?.setCurrentKey(pathid.value); treeRef.value?.setCurrentKey(pathid.value);
}); });
getWorkData() getWorkData()
}else{
workdata.value.length = 0
backupsdata.value.length = 0
}
}) })
} }
function handleNodeClick(data: any, node: any) { function handleNodeClick(data: any, node: any) {
@ -273,7 +279,7 @@ const handleMenuClick = (action: string, type: any) => {
) )
.then(() => { .then(() => {
const params = [{ const params = [{
path: currentNode.value.path, path: '/' + pathid.value + currentNode.value.path,
name: currentNode.value.fileName, name: currentNode.value.fileName,
size: currentNode.value.fileSize, size: currentNode.value.fileSize,
type: currentNode.value.isFile type: currentNode.value.isFile
@ -301,7 +307,7 @@ const handleMenuClick = (action: string, type: any) => {
) )
.then(() => { .then(() => {
const params = [{ const params = [{
path: currentNode.value.path, path: '/' + pathid.value + currentNode.value.path,
name: currentNode.value.fileName, name: currentNode.value.fileName,
size: currentNode.value.fileSize, size: currentNode.value.fileSize,
type: currentNode.value.isFile type: currentNode.value.isFile
@ -352,7 +358,7 @@ function tableBeifen(row: any) {
) )
.then(() => { .then(() => {
const params = [{ const params = [{
path: row.path, path: '/' + pathid.value + row.path,
name: row.name, name: row.name,
size: row.size, size: row.size,
type: row.type type: row.type
@ -382,7 +388,11 @@ function moretableBeifen() {
} }
) )
.then(() => { .then(() => {
uploadToBackup({ parameterLists: beifenArr.value }).then((res: any) => { let beifenArr2 = JSON.parse(JSON.stringify(beifenArr.value))
beifenArr2.forEach((items: any) => {
items.path = '/' + pathid.value + items.path
})
uploadToBackup({ parameterLists: beifenArr2 }).then((res: any) => {
if (res.code == '0') { if (res.code == '0') {
ElMessage.success("上传成功") ElMessage.success("上传成功")
beifenArr.value.forEach((items: any) => { beifenArr.value.forEach((items: any) => {
@ -408,7 +418,7 @@ function tablerestore(row: any) {
) )
.then(() => { .then(() => {
const params = [{ const params = [{
path: row.path, path: '/' + pathid.value + row.path,
name: row.name, name: row.name,
size: row.size, size: row.size,
type: row.type type: row.type
@ -437,7 +447,11 @@ function moretablerestore() {
} }
) )
.then(() => { .then(() => {
downloadToLocal({ parameterLists: restoreArr.value }).then((res: any) => { let restoreArr2 = JSON.parse(JSON.stringify(restoreArr.value))
restoreArr2.forEach((items: any) => {
items.path = '/' + pathid.value + items.path
})
downloadToLocal({ parameterLists: restoreArr2 }).then((res: any) => {
if (res.code == '0') { if (res.code == '0') {
ElMessage.success("恢复成功") ElMessage.success("恢复成功")
restoreArr.value.forEach((items: any) => { restoreArr.value.forEach((items: any) => {
@ -499,8 +513,11 @@ function bfclick(type: any) {
) )
.then(() => { .then(() => {
if (type == 'bf') { if (type == 'bf') {
let beifenArr2 = JSON.parse(JSON.stringify(changeclick.value))
uploadToBackup({ parameterLists: changeclick.value }).then((res: any) => { beifenArr2.forEach((items: any) => {
items.path = '/' + pathid.value + items.path
})
uploadToBackup({ parameterLists: beifenArr2 }).then((res: any) => {
if (res.code == '0') { if (res.code == '0') {
ElMessage.success("上传成功") ElMessage.success("上传成功")
changeclick.value.forEach((items: any) => { changeclick.value.forEach((items: any) => {
@ -509,8 +526,11 @@ function bfclick(type: any) {
} }
}) })
} else { } else {
let restoreArr2 = JSON.parse(JSON.stringify(changeclick.value))
downloadToLocal({ parameterLists: changeclick.value }).then((res: any) => { restoreArr2.forEach((items: any) => {
items.path = '/' + pathid.value + items.path
})
downloadToLocal({ parameterLists: restoreArr2 }).then((res: any) => {
if (res.code == '0') { if (res.code == '0') {
ElMessage.success("恢复成功") ElMessage.success("恢复成功")
changeclick.value.forEach((items: any) => { changeclick.value.forEach((items: any) => {
@ -681,8 +701,8 @@ function CloseView() {
</aside> </aside>
<section class="silderRight"> <section class="silderRight">
<div class="tree_button"> <div class="tree_button">
<el-button type="primary" @click="diffFile()">文件差异性对比</el-button> <el-button type="primary" :disabled="worktree" @click="diffFile()">文件差异性对比</el-button>
<el-button type="primary" @click="differential = true">查看本次差异性对比</el-button> <el-button type="primary" :disabled="worktree" @click="differential = true">查看本次差异性对比</el-button>
</div> </div>
<div class="tree_box"> <div class="tree_box">
<div class="tree_left"> <div class="tree_left">