This commit is contained in:
wangxk 2025-04-07 17:09:56 +08:00
parent 5a9feedbec
commit 735156bbbd

View File

@ -70,7 +70,7 @@ function diffFile() {
comparearr.value = comparearr.value.filter(item => {
return seen.has(item.id) ? false : seen.add(item.id);
});
tabs.value = 1
tabs.value = 3
differential.value = true
// getchayi()
diffSure()
@ -132,7 +132,7 @@ const loading3 = ref(false)
// })
// }
//-
const sureSize = ref(10)
const sureSize = ref(100)
const sureTotal = ref()
const sureCurrent = ref(1)
function diffSure() {
@ -156,7 +156,7 @@ function diffSure() {
sureSize.value = res.data.size
sureTotal.value = res.data.total
sureCurrent.value = res.data.current
diffColor()
// diffColor()
})
}
//-
@ -184,11 +184,11 @@ function diffChange() {
ChangeSize.value = res.data.size
ChangeTotal.value = res.data.total
ChangeCurrent.value = res.data.current
diffColor()
// diffColor()
})
}
//-
const MisseSize = ref(10)
const MisseSize = ref(100)
const MissTotal = ref()
const MissCurrent = ref(1)
function diffMiss() {
@ -212,49 +212,62 @@ function diffMiss() {
MisseSize.value = res.data.size
MissTotal.value = res.data.total
MissCurrent.value = res.data.current
diffColor()
// diffColor()
})
}
//
// diffColor
function diffColor() {
if (workdata.value.length > 0 && localOnlyFiles.value.length > 0) {
workdata.value = changeColor(workdata.value, localOnlyFiles.value, '1')
}
if (workdata.value.length > 0 && md5MismatchedFiles.value.length > 0) {
workdata.value = changeColor(workdata.value, md5MismatchedFiles.value, '2')
backupsdata.value = changeColor(backupsdata.value, md5MismatchedFiles.value, '2')
}
if (backupsdata.value.length > 0 && minioOnlyFiles.value.length > 0) {
backupsdata.value = changeColor(backupsdata.value, minioOnlyFiles.value, '3')
}
workref.value!.setCheckedKeys([], false)
beifentree.value!.setCheckedKeys([], false)
}
//
function changeColor(data: any, data2: any, type: any) {
data.forEach((item: any) => {
data2.forEach((item2: any) => {
if (item.id == item2.id) {
item.station = type
}
if (item.children.length > 0) {
changeColor(item.children, data2, type)
}
})
})
return data
// 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);
}
function gettabletable(){
sureSize.value = 100
ChangeSize.value = 100
MisseSize.value = 100
diffSure()
diffChange()
diffMiss()
// 2.
const processTree = (tree: any[], location: 'local' | 'minio') => {
const stack = [...tree];
while (stack.length) {
const node = stack.pop();
if (!node) continue;
// 3. 使
let status = 0;
if (location === 'local') {
status |= localMap.has(node.id) ? 1 : 0;
status |= md5Map.has(node.id) ? 2 : 0;
} else {
status |= minioMap.has(node.id) ? 3 : 0;
status |= md5Map.has(node.id) ? 2 : 0;
}
// 4. 使
node.station = status.toString(10).split('').sort().reverse()[0];
// 5.
if (node.children?.length) {
stack.push(...node.children);
}
}
};
// 6.
if (workdata.value.length) {
processTree(workdata.value, 'local');
}
if (backupsdata.value.length) {
processTree(backupsdata.value, 'minio');
}
// 7. UI
nextTick(() => {
workref.value?.setCheckedKeys([], false);
beifentree.value?.setCheckedKeys([], false);
});
}
function diffClose() {
// gettabletable()
differential.value = false
getlocaltree()
getminiotree()