bug修改

This commit is contained in:
wangxk 2025-05-23 17:43:49 +08:00
parent 7c7fd001dd
commit c228d181b0
3 changed files with 44 additions and 39 deletions

View File

@ -273,16 +273,13 @@ function init(type) {
.then((res) => {
if (res) {
// let docx = require("docx-preview");
docx.renderAsync(res.data, proxy.$refs.file);
loading.value = false;
} else {
// Message.error({ title: "", message: "" });
loading.value = false;
}
})
.catch(function (error) {
// Message.error({ title: "", message: "" });
loading.value = false;
});
} else if (type === "bin") {

View File

@ -553,7 +553,7 @@ function decompression(row: any) {
zipObj.value.compressedName = removeSuffix(row.fileName)
zipParentid.value = row.parentId
filetsobj.value.path = row.workPath
zipObj.value.compressedPath = row.workPath
zipObj.value.compressedPath ='/'+repstring(row.workPath)
zipType()
gettsfiles()
// ElMessageBox.confirm(
@ -1206,7 +1206,7 @@ function zipFile(row: any) {
}
zipParentid.value = tableIdarr.value[0].parentId
filetsobj.value.path = tableIdarr.value[0].workPath
zipObj.value.compressedPath = tableIdarr.value[0].workPath
zipObj.value.compressedPath ='/' + repstring(tableIdarr.value[0].workPath)
zipType()
gettsfiles()
}
@ -1233,24 +1233,29 @@ async function submitzip(formEl: any) {
zipObj.value.parentId = zipParentid.value
getdata()
zipfiles.value = false
zipObj.value.compressedPath = zipObj.value.compressedPath
if(zipObj.value.compressedPath.indexOf(filepath.value) == -1){
zipObj.value.compressedPath = zipObj.value.compressedPath
}
zipObj.value.path = filepath.value
compress(zipObj.value).then((res: any) => {
if (res.code == 0) {
zipfiles.value = false
getdata()
ElMessage.success('压缩成功')
tableIdarr.value.length = 0
filetableRef.value!.clearSelection()
}
})
} else {
Decompression({ id: jiezip.value.id, parentId: zipParentid.value, decompressionPath: zipObj.value.compressedPath }).then((res: any) => {
Decompression({ id: jiezip.value.id, parentId: zipParentid.value, decompressionPath: zipObj.value.compressedPath,path:filepath.value }).then((res: any) => {
if (res.code == 0) {
ElMessage.success('解压成功')
getdata()
zipfiles.value = false
tableIdarr.value.length = 0
filetableRef.value!.clearSelection()
}
jieFilearr.value.workPath = ''
@ -1260,9 +1265,11 @@ async function submitzip(formEl: any) {
}
})
}
const filetableRef= ref()
function zipClose() {
zipfiles.value = false
tableIdarr.value.length = 0
filetableRef.value!.clearSelection()
}
//
const listFilesarr = ref([])
@ -1281,7 +1288,8 @@ function gettsfiles() {
listFilesarr.value = res.data
if (res.data[0]) {
jieFilearr.value = res.data[0]
jiepatharr.value = convertPathToArray(JSON.parse(JSON.stringify(jieFilearr.value.workPath)))
let workpaht = repstring(jieFilearr.value.workPath)
jiepatharr.value = convertPathToArray(JSON.parse(JSON.stringify(workpaht)))
creatform.value.parentId = res.data[0].parentId
creatform.value.workPath = jieFilearr.value.workPath
}
@ -1289,10 +1297,10 @@ function gettsfiles() {
})
}
function openfiles(row: any) {
debugger
filetsobj.value.path = row.workPath + row.fileName + '/'
jieFilearr.value.workPath = filetsobj.value.path
jiepatharr.value = convertPathToArray(JSON.parse(JSON.stringify(jieFilearr.value.workPath)))
let workpaht = repstring(jieFilearr.value.workPath)
jiepatharr.value = convertPathToArray(JSON.parse(JSON.stringify(workpaht)))
creatform.value.workPath = jieFilearr.value.workPath
zipParentid.value = row.id
creatform.value.parentId = row.id
@ -1317,11 +1325,11 @@ function fileSelection(row: any) {
}
function pathFile(index: any) {
jiepatharr.value.splice(index + 1)
filetsobj.value.path = convertArrayToPath(jiepatharr.value)
filetsobj.value.path =convertArrayToPath(jiepatharr.value).indexOf(filepath.value) == -1 ? filepath.value + convertArrayToPath(jiepatharr.value):convertArrayToPath(jiepatharr.value)
gettsfiles()
}
function pathqveding() {
zipObj.value.compressedPath = jieFilearr.value.workPath
zipObj.value.compressedPath = '/' + repstring(jieFilearr.value.workPath)
creatform.value.parentId = ''
creatform.value.workPath = ''
visible.value = !visible.value
@ -1373,7 +1381,7 @@ function convertArrayToPath(segments: string[]): string {
//
if (segments.length === 0) return filepath.value
//
return '/' + segments.filter(Boolean).join('/') + '/'
return segments.filter(Boolean).join('/') + '/'
}
function convertArrayToPath1(segments: string[]): string {
@ -1566,6 +1574,9 @@ function testexcelClick(row: any) {
function texexceltClose() {
textedit1.value = false
}
function repstring(row:any){
return JSON.parse(JSON.stringify(row)).replace(filepath.value, "");
}
</script>
<template>
@ -1641,7 +1652,7 @@ function texexceltClose() {
<el-button type="primary" :disabled="tableIdarr.length == 0" @click="zipFile(true)">压缩</el-button>
</div>
<el-table v-loading="loading" :data="tableData" @selection-change="handleSelectionChange"
<el-table ref="filetableRef" v-loading="loading" :data="tableData" @selection-change="handleSelectionChange"
:header-cell-style="{ background: 'rgb(250 250 250)', height: '50px' }"
style="width: 100%; height: calc(66vh);margin-bottom: 20px;" border>
<el-table-column type="selection" width="40" />
@ -1653,7 +1664,11 @@ function texexceltClose() {
</template>
</el-table-column>
<el-table-column prop="keywords" label="关键字"></el-table-column>
<el-table-column prop="workPath" label="路径"></el-table-column>
<el-table-column prop="workPath" label="路径">
<template #default="scope">
<span>{{'/' + repstring(scope.row.workPath) }}</span>
</template>
</el-table-column>
<el-table-column prop="fileName" label="预览" width="60px" align="center">
<template #default="{ row }">
<div class="preview-icon">
@ -1852,7 +1867,7 @@ function texexceltClose() {
</el-table-column>
</el-table>
</div>
<div v-if="jieFilearr">当前选中{{ jieFilearr.workPath }}</div>
<div v-if="jieFilearr && jieFilearr.workPath">当前选中{{'/'+repstring(jieFilearr.workPath)}}</div>
<div style="width: 100%;display: flex;justify-content: end;">
<el-button type="primary" @click="pathqveding">确定</el-button>
<el-button @click="pathqvxiao">取消</el-button>

View File

@ -578,7 +578,7 @@ const handleMenuClick = (action: string, type: any) => {
)
.then(() => {
const params = [{
path: '/' + pathid.value + currentNode.value.path,
path: currentNode.value.path,
name: currentNode.value.fileName,
size: currentNode.value.fileSize,
type: currentNode.value.isFile
@ -607,7 +607,7 @@ const handleMenuClick = (action: string, type: any) => {
)
.then(() => {
const params = [{
path: '/' + pathid.value + currentNode.value.path,
path: currentNode.value.path,
name: currentNode.value.fileName,
size: currentNode.value.fileSize,
type: currentNode.value.isFile
@ -660,7 +660,7 @@ function tableBeifen(row: any) {
)
.then(() => {
const params = [{
path: '/' + pathid.value + row.workPath,
path: row.workPath,
name: row.fileName,
size: row.fileSize,
type: row.isFile
@ -695,8 +695,7 @@ function moretableBeifen() {
let beifenArr3 = []
let beifenArr2 = JSON.parse(JSON.stringify(beifenArr.value))
beifenArr2.forEach((items: any) => {
beifenArr3.push({ path: '/' + pathid.value + items.workPath, name: items.fileName, size: items.fileSize, type: items.isFile })
// items.path = '/' + pathid.value + items.path
beifenArr3.push({ path: items.workPath, name: items.fileName, size: items.fileSize, type: items.isFile })
})
loading1.value = true
loading2.value = true
@ -724,7 +723,7 @@ function tablerestore(row: any) {
)
.then(() => {
const params = [{
path: '/' + pathid.value + row.backupPath,
path: row.backupPath,
name: row.fileName,
size: row.fileSize,
type: row.isFile
@ -759,7 +758,7 @@ function moretablerestore() {
let restoreArr2 = JSON.parse(JSON.stringify(restoreArr.value))
restoreArr2.forEach((items: any) => {
restoreArr3.push({ path: '/' + pathid.value + items.backupPath, name: items.fileName, size: items.fileSize, type: items.isFile })
restoreArr3.push({ path: items.backupPath, name: items.fileName, size: items.fileSize, type: items.isFile })
})
loading2.value = true
loading3.value = true
@ -826,7 +825,7 @@ function bfclick(type: any) {
let beifenArr3 = []
let beifenArr2 = JSON.parse(JSON.stringify(changeclick.value))
beifenArr2.forEach((items: any) => {
beifenArr3.push({ path: '/' + pathid.value + items.workPath, name: items.fileName, size: items.fileSize, type: items.isFile })
beifenArr3.push({ path: items.workPath, name: items.fileName, size: items.fileSize, type: items.isFile })
})
uploadToBackup({ parameterLists: beifenArr3 }).then((res: any) => {
if (res.code == '0') {
@ -838,7 +837,7 @@ function bfclick(type: any) {
let restoreArr3 = []
let restoreArr2 = JSON.parse(JSON.stringify(changeclick.value))
restoreArr2.forEach((items: any) => {
restoreArr3.push({ path: '/' + pathid.value + items.backupPath, name: items.fileName, size: items.fileSize, type: items.isFile })
restoreArr3.push({ path: items.backupPath, name: items.fileName, size: items.fileSize, type: items.isFile })
})
downloadToLocal({ parameterLists: restoreArr3 }).then((res: any) => {
if (res.code == '0') {
@ -910,30 +909,24 @@ const title1 = ref('')
const isViewfile = ref(false)
const fileType = ref('')
function openPreview(row: any, type: 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') {
title1.value = row.fileName
geturl(row.id, type, true)
isViewfile.value = true
fileType.value = getFileExtension(row.fileName)
ViewfileUrl.value = geturl(row.id, type, true)
// isViewfile.value = true
// fileType.value = getFileExtension(row.fileName)
} else {
row.fileType = getFileType(row.fileName)
filePreview.value = row
geturl(row.id, type, false)
console.log(filePreview.value)
localStorage.setItem('videorow', JSON.stringify(row));
openRow(row)
filePreview.value.url = geturl(row.id, type, false)
// localStorage.setItem('videorow', JSON.stringify(row));
// openRow(row)
}
}
function geturl(row: any, type1: any, pan: any) {
obtainUrl({ id: row, type: type1 }).then((res: any) => {
if (pan) {
ViewfileUrl.value = res.data.url
} else {
filePreview.value.url = res.data.url
}
return res.data.url
})
}