cloud-web-corejs 1.0.54-dev.672 → 1.0.54-dev.673

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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cloud-web-corejs",
3
3
  "private": false,
4
- "version": "1.0.54-dev.672",
4
+ "version": "1.0.54-dev.673",
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
7
7
  "lint": "eslint --ext .js,.vue src",
@@ -33,46 +33,32 @@ 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 = []) {
36
+ export function sortDetailRowsByZdEn(rows = []) {
37
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");
38
+ const aVal = String(a?.zdEn ?? "");
39
+ const bVal = String(b?.zdEn ?? "");
40
+ return aVal.localeCompare(bVal, "zh-CN", {
41
+ numeric: true,
42
+ sensitivity: "base",
43
+ });
41
44
  });
42
45
  }
43
46
 
44
- export function buildDetailRowDiffSet(preRows = [], curRows = []) {
45
- const preMap = new Map();
46
- const curMap = new Map();
47
+ export function buildRowDiffMaps(preCellDiff = {}, curCellDiff = {}) {
48
+ const preRowDiff = {};
49
+ const curRowDiff = {};
47
50
 
48
- preRows.forEach((row, index) => {
49
- preMap.set(getDetailRowKey(row, index), row);
51
+ Object.keys(preCellDiff).forEach((key) => {
52
+ const rowKey = key.split("__")[0];
53
+ preRowDiff[rowKey] = true;
50
54
  });
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
55
 
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
- }
56
+ Object.keys(curCellDiff).forEach((key) => {
57
+ const rowKey = key.split("__")[0];
58
+ curRowDiff[rowKey] = true;
73
59
  });
74
60
 
75
- return rowDiffSet;
61
+ return { preRowDiff, curRowDiff };
76
62
  }
77
63
 
78
64
  export function buildDetailDiffMaps(preRows = [], curRows = []) {
@@ -64,9 +64,9 @@ import compareMixin from "./compareMixin";
64
64
  import compareBasicSection from "./compareBasicSection.vue";
65
65
  import {
66
66
  buildDetailDiffMaps,
67
- buildDetailRowDiffSet,
67
+ buildRowDiffMaps,
68
68
  getDetailRowKey,
69
- sortDetailRows,
69
+ sortDetailRowsByZdEn,
70
70
  } from "./tableDetailDiff";
71
71
 
72
72
  const zdTypeMap = {
@@ -109,7 +109,10 @@ export default {
109
109
  preCellDiff: {},
110
110
  curCellDiff: {},
111
111
  },
112
- detailRowDiffSet: new Set(),
112
+ detailRowDiff: {
113
+ pre: {},
114
+ cur: {},
115
+ },
113
116
  };
114
117
  },
115
118
  computed: {
@@ -169,33 +172,38 @@ export default {
169
172
  formatTreeFlag(cellValue) {
170
173
  return this.$t1(treeFlagMap[cellValue] || cellValue || "");
171
174
  },
172
- getDetailColumns() {
175
+ getDetailColumns(side) {
176
+ const rowDiffMap = this.detailRowDiff[side] || {};
173
177
  return [
174
178
  {
175
- title: this.$t1("实体字段名称"),
176
- field: "zdEn",
177
- width: 150,
179
+ title: "",
180
+ field: "_diffFlag",
181
+ width: 32,
178
182
  fixed: "left",
183
+ align: "center",
179
184
  slots: {
180
185
  default: ({ row, rowIndex }) => {
181
- const hasDiff = this.hasDetailRowDiff(row, rowIndex);
186
+ const rowKey = getDetailRowKey(row, rowIndex);
187
+ if (!rowDiffMap[rowKey]) return [null];
182
188
  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>,
189
+ <el-tooltip
190
+ enterable={false}
191
+ effect="dark"
192
+ content={this.$t1("存在差异项")}
193
+ placement="top"
194
+ >
195
+ <i class="el-icon-warning compare-row-diff-icon" />
196
+ </el-tooltip>,
195
197
  ];
196
198
  },
197
199
  },
198
200
  },
201
+ {
202
+ title: this.$t1("实体字段名称"),
203
+ field: "zdEn",
204
+ width: 150,
205
+ fixed: "left",
206
+ },
199
207
  {
200
208
  title: this.$t1("数据库表字段名"),
201
209
  field: "taZdMc",
@@ -304,27 +312,33 @@ export default {
304
312
  };
305
313
  },
306
314
  initDetailGrids() {
307
- this.preRows = sortDetailRows(this.compareHData1?.szTaZdMbDTOs || []);
308
- this.curRows = sortDetailRows(this.compareHData2?.szTaZdMbDTOs || []);
309
- this.detailDiff = buildDetailDiffMaps(this.preRows, this.curRows);
310
- this.detailRowDiffSet = buildDetailRowDiffSet(this.preRows, this.curRows);
315
+ const rawPreRows = this.compareHData1?.szTaZdMbDTOs || [];
316
+ const rawCurRows = this.compareHData2?.szTaZdMbDTOs || [];
317
+ this.detailDiff = buildDetailDiffMaps(rawPreRows, rawCurRows);
318
+ const { preRowDiff, curRowDiff } = buildRowDiffMaps(
319
+ this.detailDiff.preCellDiff,
320
+ this.detailDiff.curCellDiff
321
+ );
322
+ this.detailRowDiff = { pre: preRowDiff, cur: curRowDiff };
323
+ this.preRows = sortDetailRowsByZdEn(rawPreRows);
324
+ this.curRows = sortDetailRowsByZdEn(rawCurRows);
311
325
 
312
- const columns = this.getDetailColumns();
313
326
  const baseConfig = {
314
327
  border: true,
315
328
  resizable: true,
316
329
  showOverflow: true,
317
330
  scrollX: { enabled: true },
318
- columns,
319
331
  ...this.getGridSizeConfig(),
320
332
  };
321
333
  this.preGridOption = {
322
334
  ...baseConfig,
335
+ columns: this.getDetailColumns("pre"),
323
336
  data: this.preRows,
324
337
  cellClassName: (params) => this.getPreCellClassName(params),
325
338
  };
326
339
  this.curGridOption = {
327
340
  ...baseConfig,
341
+ columns: this.getDetailColumns("cur"),
328
342
  data: this.curRows,
329
343
  cellClassName: (params) => this.getCurCellClassName(params),
330
344
  };
@@ -358,9 +372,6 @@ export default {
358
372
  getCurCellClassName({ row, column, rowIndex }) {
359
373
  return this.getDetailCellClassName("cur", row, column, rowIndex);
360
374
  },
361
- hasDetailRowDiff(row, rowIndex) {
362
- return this.detailRowDiffSet.has(getDetailRowKey(row, rowIndex));
363
- },
364
375
  getDetailCellClassName(side, row, column, rowIndex) {
365
376
  const field = column.field;
366
377
  if (!field || !row) return "";
@@ -452,18 +463,10 @@ export default {
452
463
  color: #67c23a;
453
464
  }
454
465
 
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
- }
466
+ ::v-deep .compare-row-diff-icon {
467
+ color: #e6a23c;
468
+ font-size: 14px;
469
+ cursor: default;
467
470
  }
468
471
 
469
472
  &.is-section-fullscreen {