cloud-web-corejs 1.0.54-dev.671 → 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.671",
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,6 +33,34 @@ export function getDetailRowKey(row, index = 0) {
33
33
  return row.zdEn || row.taZdMc || `idx_${row.orders ?? index}`;
34
34
  }
35
35
 
36
+ export function sortDetailRowsByZdEn(rows = []) {
37
+ return [...rows].sort((a, b) => {
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
+ });
44
+ });
45
+ }
46
+
47
+ export function buildRowDiffMaps(preCellDiff = {}, curCellDiff = {}) {
48
+ const preRowDiff = {};
49
+ const curRowDiff = {};
50
+
51
+ Object.keys(preCellDiff).forEach((key) => {
52
+ const rowKey = key.split("__")[0];
53
+ preRowDiff[rowKey] = true;
54
+ });
55
+
56
+ Object.keys(curCellDiff).forEach((key) => {
57
+ const rowKey = key.split("__")[0];
58
+ curRowDiff[rowKey] = true;
59
+ });
60
+
61
+ return { preRowDiff, curRowDiff };
62
+ }
63
+
36
64
  export function buildDetailDiffMaps(preRows = [], curRows = []) {
37
65
  const preMap = new Map();
38
66
  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 { buildDetailDiffMaps, getDetailRowKey } from "./tableDetailDiff";
65
+ import {
66
+ buildDetailDiffMaps,
67
+ buildRowDiffMaps,
68
+ getDetailRowKey,
69
+ sortDetailRowsByZdEn,
70
+ } from "./tableDetailDiff";
66
71
 
67
72
  const zdTypeMap = {
68
73
  Boolean: "布尔",
@@ -104,6 +109,10 @@ export default {
104
109
  preCellDiff: {},
105
110
  curCellDiff: {},
106
111
  },
112
+ detailRowDiff: {
113
+ pre: {},
114
+ cur: {},
115
+ },
107
116
  };
108
117
  },
109
118
  computed: {
@@ -163,8 +172,32 @@ export default {
163
172
  formatTreeFlag(cellValue) {
164
173
  return this.$t1(treeFlagMap[cellValue] || cellValue || "");
165
174
  },
166
- getDetailColumns() {
175
+ getDetailColumns(side) {
176
+ const rowDiffMap = this.detailRowDiff[side] || {};
167
177
  return [
178
+ {
179
+ title: "",
180
+ field: "_diffFlag",
181
+ width: 32,
182
+ fixed: "left",
183
+ align: "center",
184
+ slots: {
185
+ default: ({ row, rowIndex }) => {
186
+ const rowKey = getDetailRowKey(row, rowIndex);
187
+ if (!rowDiffMap[rowKey]) return [null];
188
+ return [
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>,
197
+ ];
198
+ },
199
+ },
200
+ },
168
201
  {
169
202
  title: this.$t1("实体字段名称"),
170
203
  field: "zdEn",
@@ -279,26 +312,33 @@ export default {
279
312
  };
280
313
  },
281
314
  initDetailGrids() {
282
- this.preRows = this.compareHData1?.szTaZdMbDTOs || [];
283
- this.curRows = this.compareHData2?.szTaZdMbDTOs || [];
284
- this.detailDiff = buildDetailDiffMaps(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);
285
325
 
286
- const columns = this.getDetailColumns();
287
326
  const baseConfig = {
288
327
  border: true,
289
328
  resizable: true,
290
329
  showOverflow: true,
291
330
  scrollX: { enabled: true },
292
- columns,
293
331
  ...this.getGridSizeConfig(),
294
332
  };
295
333
  this.preGridOption = {
296
334
  ...baseConfig,
335
+ columns: this.getDetailColumns("pre"),
297
336
  data: this.preRows,
298
337
  cellClassName: (params) => this.getPreCellClassName(params),
299
338
  };
300
339
  this.curGridOption = {
301
340
  ...baseConfig,
341
+ columns: this.getDetailColumns("cur"),
302
342
  data: this.curRows,
303
343
  cellClassName: (params) => this.getCurCellClassName(params),
304
344
  };
@@ -423,6 +463,12 @@ export default {
423
463
  color: #67c23a;
424
464
  }
425
465
 
466
+ ::v-deep .compare-row-diff-icon {
467
+ color: #e6a23c;
468
+ font-size: 14px;
469
+ cursor: default;
470
+ }
471
+
426
472
  &.is-section-fullscreen {
427
473
  position: fixed;
428
474
  top: 0;