+
@@ -1926,7 +1925,7 @@ function texexceltClose() {
-
+
diff --git a/web/src/views/testdata/fileSynchronization/index.vue b/web/src/views/testdata/fileSynchronization/index.vue
index ae9e4cf..effb539 100644
--- a/web/src/views/testdata/fileSynchronization/index.vue
+++ b/web/src/views/testdata/fileSynchronization/index.vue
@@ -9,7 +9,7 @@ import { ref, onMounted, nextTick, defineAsyncComponent, onBeforeUnmount } from
import { Search } from '@element-plus/icons-vue'
import { ElMessageBox, ElMessage } from "element-plus";
import { tstaskList, getTsNodesTree, tsFilesPage, deleteTsFilesByIds } from "@/api/datamanagement";
-import { listLocalAndBackup, compare, compareLocal, compareMd5, compareMinio, uploadToBackup, downloadToLocal, deleteTsFilesById, automaticFileBackup, obtainUrl, listBackupTree, listLocalTree } from "@/api/fileSynchronization";
+import { listLocalAndBackup, compare, compareLocalList,automaticFileBackupByIds, compareMd5List, compareMinioList, compareLocal, compareMd5, compareMinio, uploadToBackup, downloadToLocal, deleteTsFilesById, automaticFileBackup, obtainUrl, listBackupTree, listLocalTree } from "@/api/fileSynchronization";
import { debounce } from 'lodash-es';
import Page from '@/components/Pagination/page.vue';
//text文件编辑功能
@@ -68,10 +68,25 @@ function diffFile() {
});
tabs.value = 1
differential.value = true
- diffSure()
- diffChange()
- diffMiss()
+ diffSure(false)
+ diffChange(false)
+ diffMiss(false)
}
+
+function diffFile2() {
+ const seen = new Set();
+ comparearr.value = comparearr.value.filter(item => {
+ return seen.has(item.id) ? false : seen.add(item.id);
+ });
+ getchayi()
+}
+
+//两棵树
+function gettreeTwo() {
+ getlocaltree()
+ getminiotree()
+}
+
function backups() {
ElMessageBox.confirm(
'您确定要将文件/文件夹自动备份到备份空间吗?',
@@ -85,16 +100,73 @@ function backups() {
.then(() => {
worktree.value = true
worktree1.value = true
- automaticFileBackup({ nodeId: pathid.value, taskId: projectId.value }).then((res: any) => {
+ const seen = new Set();
+ comparearr.value = comparearr.value.filter(item => {
+ return seen.has(item.id) ? false : seen.add(item.id);
+ });
+ const ids = []
+ const params: any = {}
+ if (comparearr.value.length > 0) {
+ comparearr.value.forEach((item: any) => {
+ ids.push(item.id)
+ })
+ params.id = ids.join(',')
+ } else {
+ params.nodeId = pathid.value
+ params.taskId = projectId.value
+ }
+ if(ids.length > 0){
+ automaticFileBackupByIds(params).then((res: any) => {
if (res.code == 0) {
ElMessage.success(res.msg)
getlocaltree()
getminiotree()
}
})
+ }else{
+ automaticFileBackup(params).then((res: any) => {
+ if (res.code == 0) {
+ ElMessage.success(res.msg)
+ getlocaltree()
+ getminiotree()
+ }
+ })
+ }
+
+
+
})
}
+////////////
+function getchayi() {
+ const ids = []
+ const params: any = {}
+ if (comparearr.value.length > 0) {
+ comparearr.value.forEach((item: any) => {
+ ids.push(item.id)
+ })
+ params.id = ids.join(',')
+ } else {
+ params.nodeId = pathid.value
+ params.taskId = projectId.value
+ }
+ compareLocalList(params).then((res: any) => {
+ // debugger
+ localOnlyFiles.value = res.data
+ gettreeTwo()
+ })
+ compareMd5List(params).then((res: any) => {
+ md5MismatchedFiles.value = res.data
+ gettreeTwo()
+ })
+ compareMinioList(params).then((res: any) => {
+ minioOnlyFiles.value = res.data
+ gettreeTwo()
+ })
+
+}
+
//文件差异性对比结果
const comparearr: any = ref([])
const localOnlyFiles: any = ref([])
@@ -107,7 +179,7 @@ const loading3 = ref(false)
const sureSize = ref(10)
const sureTotal = ref()
const sureCurrent = ref(1)
-function diffSure() {
+function diffSure(row: any) {
loading1.value = true
const ids = []
const params: any = {}
@@ -134,7 +206,7 @@ function diffSure() {
const ChangeSize = ref(10)
const ChangeTotal = ref()
const ChangeCurrent = ref(1)
-function diffChange() {
+function diffChange(row: any) {
loading2.value = true
const ids = []
const params: any = {}
@@ -155,13 +227,14 @@ function diffChange() {
ChangeSize.value = res.data.size
ChangeTotal.value = res.data.total
ChangeCurrent.value = res.data.current
+
})
}
//文件对比-缺失内容
const MisseSize = ref(10)
const MissTotal = ref()
const MissCurrent = ref(1)
-function diffMiss() {
+function diffMiss(row: any) {
loading3.value = true
const ids = []
const params: any = {}
@@ -182,6 +255,7 @@ function diffMiss() {
MisseSize.value = res.data.size
MissTotal.value = res.data.total
MissCurrent.value = res.data.current
+
})
}
//差异染色
@@ -189,7 +263,6 @@ function diffMiss() {
function diffColor() {
// 1. 使用Map优化查找性能
const createMap = (arr: any[]) => new Map(arr.map(item => [item.id, item]));
-
const localMap = createMap(localOnlyFiles.value);
const md5Map = createMap(md5MismatchedFiles.value);
const minioMap = createMap(minioOnlyFiles.value);
@@ -303,8 +376,8 @@ const handleCheckChange = (
// 使用防抖优化批量操作
const updateCompare = debounce(() => {
//
- comparearr.value = getclickdata(workall.value);
- const comparearrval = getclickdata(workall.value);
+ comparearr.value = getclickdata(workall.value);
+ const comparearrval = getclickdata(workall.value);
// 转换节点格式
const checkedKeys = comparearrval
.map(node => node.id)
@@ -453,8 +526,8 @@ const backupsChange = (
const updateCompare = debounce(() => {
// comparearr.value.length = 0
- comparearr.value = getclickdata(workall.value);
- const comparearrval = getclickdata(workall.value);
+ comparearr.value = getclickdata(workall.value);
+ const comparearrval = getclickdata(workall.value);
// 转换节点格式
const checkedKeys = comparearrval
.map(node => node.id)
@@ -598,8 +671,8 @@ function tableBeifen(row: any) {
uploadToBackup({ parameterLists: params }).then((res: any) => {
if (res.code == '0') {
ElMessage.success("上传成功")
- diffSure()
- diffChange()
+ diffSure(false)
+ diffChange(false)
}
})
})
@@ -630,8 +703,8 @@ function moretableBeifen() {
loading2.value = true
uploadToBackup({ parameterLists: beifenArr3 }).then((res: any) => {
if (res.code == '0') {
- diffSure()
- diffChange()
+ diffSure(false)
+ diffChange(false)
ElMessage.success("上传成功")
}
})
@@ -662,8 +735,8 @@ function tablerestore(row: any) {
downloadToLocal({ parameterLists: params }).then((res: any) => {
if (res.code == '0') {
ElMessage.success("恢复成功")
- diffChange()
- diffMiss()
+ diffChange(false)
+ diffMiss(false)
}
})
})
@@ -694,8 +767,8 @@ function moretablerestore() {
downloadToLocal({ parameterLists: restoreArr3 }).then((res: any) => {
if (res.code == '0') {
ElMessage.success("恢复成功")
- diffChange()
- diffMiss()
+ diffChange(false)
+ diffMiss(false)
}
})
@@ -720,7 +793,7 @@ function delhuifu() {
deleteTsFilesByIds({ ids: ids.value.join(','), type: 'minio' }).then((res: any) => {
if (res.code == '0') {
ElMessage.success("删除成功")
- diffMiss()
+ diffMiss(false)
}
})
@@ -759,7 +832,7 @@ function bfclick(type: any) {
uploadToBackup({ parameterLists: beifenArr3 }).then((res: any) => {
if (res.code == '0') {
ElMessage.success("上传成功")
- diffChange()
+ diffChange(false)
}
})
} else {
@@ -771,7 +844,7 @@ function bfclick(type: any) {
downloadToLocal({ parameterLists: restoreArr3 }).then((res: any) => {
if (res.code == '0') {
ElMessage.success("恢复成功")
- diffChange()
+ diffChange(false)
}
})
}
@@ -966,12 +1039,28 @@ const tabs = ref(1)