cloud-web-corejs 1.0.54-dev.671 → 1.0.54-dev.672
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
|
@@ -33,6 +33,48 @@ export function getDetailRowKey(row, index = 0) {
|
|
|
33
33
|
return row.zdEn || row.taZdMc || `idx_${row.orders ?? index}`;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
export function sortDetailRows(rows = []) {
|
|
37
|
+
return [...rows].sort((a, b) => {
|
|
38
|
+
const nameA = (a?.zdEn ?? "").toString();
|
|
39
|
+
const nameB = (b?.zdEn ?? "").toString();
|
|
40
|
+
return nameA.localeCompare(nameB, "zh-CN");
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function buildDetailRowDiffSet(preRows = [], curRows = []) {
|
|
45
|
+
const preMap = new Map();
|
|
46
|
+
const curMap = new Map();
|
|
47
|
+
|
|
48
|
+
preRows.forEach((row, index) => {
|
|
49
|
+
preMap.set(getDetailRowKey(row, index), row);
|
|
50
|
+
});
|
|
51
|
+
curRows.forEach((row, index) => {
|
|
52
|
+
curMap.set(getDetailRowKey(row, index), row);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
const rowDiffSet = new Set();
|
|
56
|
+
const allKeys = new Set([...preMap.keys(), ...curMap.keys()]);
|
|
57
|
+
|
|
58
|
+
allKeys.forEach((key) => {
|
|
59
|
+
const preRow = preMap.get(key);
|
|
60
|
+
const curRow = curMap.get(key);
|
|
61
|
+
|
|
62
|
+
if (!preRow || !curRow) {
|
|
63
|
+
rowDiffSet.add(key);
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const hasDiff = DETAIL_COMPARE_FIELDS.some(
|
|
68
|
+
(field) => !isSameValue(preRow[field], curRow[field])
|
|
69
|
+
);
|
|
70
|
+
if (hasDiff) {
|
|
71
|
+
rowDiffSet.add(key);
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
return rowDiffSet;
|
|
76
|
+
}
|
|
77
|
+
|
|
36
78
|
export function buildDetailDiffMaps(preRows = [], curRows = []) {
|
|
37
79
|
const preMap = new Map();
|
|
38
80
|
const curMap = new Map();
|
|
@@ -62,7 +62,12 @@
|
|
|
62
62
|
<script>
|
|
63
63
|
import compareMixin from "./compareMixin";
|
|
64
64
|
import compareBasicSection from "./compareBasicSection.vue";
|
|
65
|
-
import {
|
|
65
|
+
import {
|
|
66
|
+
buildDetailDiffMaps,
|
|
67
|
+
buildDetailRowDiffSet,
|
|
68
|
+
getDetailRowKey,
|
|
69
|
+
sortDetailRows,
|
|
70
|
+
} from "./tableDetailDiff";
|
|
66
71
|
|
|
67
72
|
const zdTypeMap = {
|
|
68
73
|
Boolean: "布尔",
|
|
@@ -104,6 +109,7 @@ export default {
|
|
|
104
109
|
preCellDiff: {},
|
|
105
110
|
curCellDiff: {},
|
|
106
111
|
},
|
|
112
|
+
detailRowDiffSet: new Set(),
|
|
107
113
|
};
|
|
108
114
|
},
|
|
109
115
|
computed: {
|
|
@@ -170,6 +176,25 @@ export default {
|
|
|
170
176
|
field: "zdEn",
|
|
171
177
|
width: 150,
|
|
172
178
|
fixed: "left",
|
|
179
|
+
slots: {
|
|
180
|
+
default: ({ row, rowIndex }) => {
|
|
181
|
+
const hasDiff = this.hasDetailRowDiff(row, rowIndex);
|
|
182
|
+
return [
|
|
183
|
+
<span class="detail-zd-en-cell">
|
|
184
|
+
{hasDiff ? (
|
|
185
|
+
<el-tooltip
|
|
186
|
+
effect="dark"
|
|
187
|
+
content={this.$t1("存在不同项")}
|
|
188
|
+
placement="top"
|
|
189
|
+
>
|
|
190
|
+
<i class="el-icon-warning compare-row-diff-icon" />
|
|
191
|
+
</el-tooltip>
|
|
192
|
+
) : null}
|
|
193
|
+
<span>{row.zdEn}</span>
|
|
194
|
+
</span>,
|
|
195
|
+
];
|
|
196
|
+
},
|
|
197
|
+
},
|
|
173
198
|
},
|
|
174
199
|
{
|
|
175
200
|
title: this.$t1("数据库表字段名"),
|
|
@@ -279,9 +304,10 @@ export default {
|
|
|
279
304
|
};
|
|
280
305
|
},
|
|
281
306
|
initDetailGrids() {
|
|
282
|
-
this.preRows = this.compareHData1?.szTaZdMbDTOs || [];
|
|
283
|
-
this.curRows = this.compareHData2?.szTaZdMbDTOs || [];
|
|
307
|
+
this.preRows = sortDetailRows(this.compareHData1?.szTaZdMbDTOs || []);
|
|
308
|
+
this.curRows = sortDetailRows(this.compareHData2?.szTaZdMbDTOs || []);
|
|
284
309
|
this.detailDiff = buildDetailDiffMaps(this.preRows, this.curRows);
|
|
310
|
+
this.detailRowDiffSet = buildDetailRowDiffSet(this.preRows, this.curRows);
|
|
285
311
|
|
|
286
312
|
const columns = this.getDetailColumns();
|
|
287
313
|
const baseConfig = {
|
|
@@ -332,6 +358,9 @@ export default {
|
|
|
332
358
|
getCurCellClassName({ row, column, rowIndex }) {
|
|
333
359
|
return this.getDetailCellClassName("cur", row, column, rowIndex);
|
|
334
360
|
},
|
|
361
|
+
hasDetailRowDiff(row, rowIndex) {
|
|
362
|
+
return this.detailRowDiffSet.has(getDetailRowKey(row, rowIndex));
|
|
363
|
+
},
|
|
335
364
|
getDetailCellClassName(side, row, column, rowIndex) {
|
|
336
365
|
const field = column.field;
|
|
337
366
|
if (!field || !row) return "";
|
|
@@ -423,6 +452,20 @@ export default {
|
|
|
423
452
|
color: #67c23a;
|
|
424
453
|
}
|
|
425
454
|
|
|
455
|
+
::v-deep .detail-zd-en-cell {
|
|
456
|
+
display: inline-flex;
|
|
457
|
+
align-items: center;
|
|
458
|
+
max-width: 100%;
|
|
459
|
+
|
|
460
|
+
.compare-row-diff-icon {
|
|
461
|
+
flex-shrink: 0;
|
|
462
|
+
margin-right: 4px;
|
|
463
|
+
font-size: 14px;
|
|
464
|
+
color: #e6a23c;
|
|
465
|
+
cursor: default;
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
|
|
426
469
|
&.is-section-fullscreen {
|
|
427
470
|
position: fixed;
|
|
428
471
|
top: 0;
|