From c228d181b03825ad63ae244270e976a4c3472047 Mon Sep 17 00:00:00 2001 From: wangxk Date: Fri, 23 May 2025 17:43:49 +0800 Subject: [PATCH] =?UTF-8?q?bug=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/src/views/component/Viewfile.vue | 3 -- .../views/testdata/datamanagement/index.vue | 41 +++++++++++++------ .../testdata/fileSynchronization/index.vue | 39 ++++++++---------- 3 files changed, 44 insertions(+), 39 deletions(-) diff --git a/web/src/views/component/Viewfile.vue b/web/src/views/component/Viewfile.vue index 425812a..a432760 100644 --- a/web/src/views/component/Viewfile.vue +++ b/web/src/views/component/Viewfile.vue @@ -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") { diff --git a/web/src/views/testdata/datamanagement/index.vue b/web/src/views/testdata/datamanagement/index.vue index 5b5e0a6..9c96f33 100644 --- a/web/src/views/testdata/datamanagement/index.vue +++ b/web/src/views/testdata/datamanagement/index.vue @@ -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, ""); +} - + + +