haiwei-ui 1.1.3 → 1.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -616,54 +616,66 @@ export default {
|
|
|
616
616
|
return allAddModels
|
|
617
617
|
},
|
|
618
618
|
|
|
619
|
-
// 通用的去重方法,可用于数据和模型
|
|
619
|
+
// 通用的去重方法,可用于数据和模型 - 按所有已配置映射的字段组合去重
|
|
620
620
|
deduplicateModels(models) {
|
|
621
621
|
if (!models || models.length === 0) {
|
|
622
622
|
return []
|
|
623
623
|
}
|
|
624
|
-
|
|
624
|
+
|
|
625
625
|
// 获取所有已配置的目标字段
|
|
626
626
|
const targetFields = this.columnMapping
|
|
627
627
|
.filter(mapping => mapping.targetColumn)
|
|
628
628
|
.map(mapping => mapping.targetColumn)
|
|
629
|
-
|
|
629
|
+
|
|
630
630
|
// 如果没有目标字段,无法去重
|
|
631
631
|
if (targetFields.length === 0) {
|
|
632
632
|
return models
|
|
633
633
|
}
|
|
634
|
-
|
|
635
|
-
// 使用第一个目标字段作为去重依据
|
|
636
|
-
const deduplicateField = targetFields[0]
|
|
637
|
-
|
|
634
|
+
|
|
638
635
|
// 使用Map进行去重,保留第一次出现的数据
|
|
639
636
|
const uniqueMap = new Map()
|
|
640
637
|
const deduplicatedItems = []
|
|
641
|
-
|
|
638
|
+
|
|
642
639
|
for (const item of models) {
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
640
|
+
// 生成组合键:将所有目标字段的值拼接成一个字符串
|
|
641
|
+
const keyParts = []
|
|
642
|
+
let hasEmptyKey = false
|
|
643
|
+
|
|
644
|
+
for (const field of targetFields) {
|
|
645
|
+
const value = item[field]
|
|
646
|
+
// 如果任何一个关键字段为空,跳过该行的去重检查
|
|
647
|
+
if (value === null || value === undefined || value === '') {
|
|
648
|
+
hasEmptyKey = true
|
|
649
|
+
break
|
|
650
|
+
}
|
|
651
|
+
keyParts.push(`${field}:${value}`)
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
// 如果有空的关键字段,直接添加到结果中(不参与去重)
|
|
655
|
+
if (hasEmptyKey) {
|
|
647
656
|
deduplicatedItems.push(item)
|
|
648
657
|
continue
|
|
649
658
|
}
|
|
650
|
-
|
|
651
|
-
//
|
|
652
|
-
|
|
653
|
-
|
|
659
|
+
|
|
660
|
+
// 生成完整的组合键
|
|
661
|
+
const combinedKey = keyParts.join('|')
|
|
662
|
+
|
|
663
|
+
// 如果还没有这个组合键,添加到Map和结果列表
|
|
664
|
+
if (!uniqueMap.has(combinedKey)) {
|
|
665
|
+
uniqueMap.set(combinedKey, true)
|
|
654
666
|
deduplicatedItems.push(item)
|
|
655
667
|
}
|
|
656
668
|
}
|
|
657
|
-
|
|
669
|
+
|
|
658
670
|
// 记录去重统计
|
|
659
671
|
const originalCount = models.length
|
|
660
672
|
const deduplicatedCount = deduplicatedItems.length
|
|
661
673
|
const removedCount = originalCount - deduplicatedCount
|
|
662
|
-
|
|
674
|
+
|
|
663
675
|
if (removedCount > 0) {
|
|
664
|
-
this._success(`数据去重:原始 ${originalCount} 条,去重后 ${deduplicatedCount} 条,移除 ${removedCount}
|
|
676
|
+
this._success(`数据去重:原始 ${originalCount} 条,去重后 ${deduplicatedCount} 条,移除 ${removedCount} 条重复数据(按所有已配置字段组合去重)`)
|
|
665
677
|
}
|
|
666
|
-
|
|
678
|
+
|
|
667
679
|
return deduplicatedItems
|
|
668
680
|
},
|
|
669
681
|
|
|
@@ -710,36 +722,40 @@ export default {
|
|
|
710
722
|
.step-card {
|
|
711
723
|
border: 1px solid var(--el-border-color-light);
|
|
712
724
|
border-radius: var(--el-border-radius-base);
|
|
713
|
-
|
|
714
|
-
.
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
padding: 12px 16px;
|
|
719
|
-
border-bottom: 1px solid var(--el-border-color-light);
|
|
720
|
-
background-color: var(--el-fill-color-light);
|
|
721
|
-
|
|
722
|
-
.header-left {
|
|
725
|
+
|
|
726
|
+
::v-deep .el-card__header {
|
|
727
|
+
padding: 0;
|
|
728
|
+
|
|
729
|
+
.step-header {
|
|
723
730
|
display: flex;
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
+
justify-content: space-between;
|
|
732
|
+
align-items: center;
|
|
733
|
+
padding: 12px 16px;
|
|
734
|
+
border-bottom: 1px solid var(--el-border-color-light);
|
|
735
|
+
background-color: var(--el-fill-color-light);
|
|
736
|
+
|
|
737
|
+
.header-left {
|
|
738
|
+
display: flex;
|
|
739
|
+
flex-direction: column;
|
|
740
|
+
|
|
741
|
+
.step-title {
|
|
742
|
+
font-size: var(--el-font-size-medium);
|
|
743
|
+
font-weight: var(--el-font-weight-primary);
|
|
744
|
+
color: var(--el-text-color-primary);
|
|
745
|
+
margin-bottom: 4px;
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
.step-subtitle {
|
|
749
|
+
font-size: var(--el-font-size-extra-small);
|
|
750
|
+
color: var(--el-text-color-placeholder);
|
|
751
|
+
}
|
|
731
752
|
}
|
|
732
|
-
|
|
733
|
-
.
|
|
734
|
-
|
|
735
|
-
|
|
753
|
+
|
|
754
|
+
.header-right {
|
|
755
|
+
display: flex;
|
|
756
|
+
align-items: center;
|
|
736
757
|
}
|
|
737
758
|
}
|
|
738
|
-
|
|
739
|
-
.header-right {
|
|
740
|
-
display: flex;
|
|
741
|
-
align-items: center;
|
|
742
|
-
}
|
|
743
759
|
}
|
|
744
760
|
}
|
|
745
761
|
}
|