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) => { .then((res) => {
if (res) { if (res) {
// let docx = require("docx-preview");
docx.renderAsync(res.data, proxy.$refs.file); docx.renderAsync(res.data, proxy.$refs.file);
loading.value = false; loading.value = false;
} else { } else {
// Message.error({ title: "", message: "" });
loading.value = false; loading.value = false;
} }
}) })
.catch(function (error) { .catch(function (error) {
// Message.error({ title: "", message: "" });
loading.value = false; loading.value = false;
}); });
} else if (type === "bin") { } else if (type === "bin") {

View File

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

View File

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