`;
@@ -2002,9 +2121,6 @@ function copyRawData() {
// 复制差异主键
function copyDifferenceKeys() {
- console.log('copyDifferenceKeys 被调用');
- console.log('filteredDifferenceResults:', filteredDifferenceResults);
-
if (!filteredDifferenceResults || filteredDifferenceResults.length === 0) {
showAlert('warning', '无差异数据可复制');
return;
@@ -2016,7 +2132,6 @@ function copyDifferenceKeys() {
const uniqueKeys = new Set();
filteredDifferenceResults.forEach(diff => {
- console.log('处理差异记录:', diff);
if (diff.key) {
let keyText = '';
@@ -2028,8 +2143,6 @@ function copyDifferenceKeys() {
keyText = String(diff.key);
}
- console.log('提取的主键:', keyText);
-
// 避免重复主键
if (!uniqueKeys.has(keyText)) {
uniqueKeys.add(keyText);
@@ -2038,8 +2151,6 @@ function copyDifferenceKeys() {
}
});
- console.log('收集到的主键列表:', differenceKeys);
-
if (differenceKeys.length === 0) {
showAlert('warning', '未找到有效的主键数据');
return;
@@ -2047,11 +2158,9 @@ function copyDifferenceKeys() {
// 将主键列表转换为文本格式(每行一个)
const keyText = differenceKeys.join('\n');
- console.log('准备复制的文本:', keyText);
// 复制到剪贴板
navigator.clipboard.writeText(keyText).then(() => {
- console.log('复制成功');
showAlert('success', `已复制 ${differenceKeys.length} 个差异主键到剪贴板`);
}).catch(err => {
console.error('复制失败:', err);
@@ -2064,6 +2173,47 @@ function copyDifferenceKeys() {
}
}
+// 切换所有差异详情的展开/收起状态
+function toggleAllDifferenceCollapse() {
+ // 获取当前页面的所有差异展开区域
+ const collapseElements = document.querySelectorAll('#differences [id^="keyGroup"]');
+ const toggleButton = document.getElementById('toggleAllText');
+
+ if (collapseElements.length === 0) {
+ showAlert('warning', '没有找到差异详情');
+ return;
+ }
+
+ // 检查当前状态 - 如果大部分是展开的,就全部收起;否则全部展开
+ let expandedCount = 0;
+ collapseElements.forEach(element => {
+ if (element.classList.contains('show')) {
+ expandedCount++;
+ }
+ });
+
+ const shouldExpand = expandedCount < collapseElements.length / 2;
+
+ collapseElements.forEach(element => {
+ if (shouldExpand) {
+ // 展开
+ element.classList.add('show');
+ } else {
+ // 收起
+ element.classList.remove('show');
+ }
+ });
+
+ // 更新按钮文本
+ if (shouldExpand) {
+ toggleButton.innerHTML = '全部收起';
+ showAlert('success', `已展开 ${collapseElements.length} 个差异详情`);
+ } else {
+ toggleButton.innerHTML = '全部展开';
+ showAlert('success', `已收起 ${collapseElements.length} 个差异详情`);
+ }
+}
+
// 显示差异数据的原生数据
function showDifferenceRawData(keyStr) {
showRawData(keyStr); // 复用相同的原生数据显示逻辑
@@ -4284,10 +4434,6 @@ function renderRawDataContent() {
${item.displayName}
-
@@ -4295,7 +4441,7 @@ function renderRawDataContent() {
主键: ${keyValue}