bri-components 1.3.98 → 1.4.1

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.
@@ -6,6 +6,15 @@ export default {
6
6
  return {};
7
7
  },
8
8
  computed: {
9
+ selfBasePropsObj () {
10
+ return {
11
+ _mergeRowColKeys: [] // 合并行的列
12
+ };
13
+ },
14
+ mergeRowColKeys () {
15
+ return this.selfPropsObj._mergeRowColKeys || []; // 配置端有问题,高级依赖时值成undefined了
16
+ },
17
+
9
18
  allListData () {
10
19
  this.data.forEach(rowItem => {
11
20
  this.fixRowItem(rowItem);
@@ -45,11 +54,9 @@ export default {
45
54
  ...(this.useIndex === true ? [this.indexColumn] : []),
46
55
  ...this.$transformToColumns(this.contentColumns),
47
56
  ...(
48
- this.isSearching
49
- ? []
50
- : this.$getOperationList(["canDelete"]).length
51
- ? [this.operationColumn]
52
- : []
57
+ !this.isSearching && this.$getOperationList(["canDelete"]).length
58
+ ? [this.operationColumn]
59
+ : []
53
60
  )
54
61
  ];
55
62
  },
@@ -67,10 +74,13 @@ export default {
67
74
  h("div", rowIndex + 1),
68
75
 
69
76
  // 添加符
70
- ...this.createIconRender(h, { row, rowIndex, column })
77
+ ...this.operationIconRender(h, { row, rowIndex, column })
71
78
  ];
72
79
  }
73
80
  };
81
+ },
82
+ mergeRowColumns () {
83
+ return this.selfColumns.filter(colItem => this.mergeRowColKeys.includes(colItem._key));
74
84
  }
75
85
  },
76
86
  created () { },
@@ -130,8 +140,34 @@ export default {
130
140
  });
131
141
  },
132
142
 
133
- change (eventType, row, rowIndex, col, ...params) {
134
- this.$emit("change", { list: this.allListData, rowDefault: this.rowDefault }, eventType, col, row, rowIndex, ...params);
143
+ bodyCellSpan ({ row, rowIndex, column }) {
144
+ // 合并单元格(单元格值为空时不合并)
145
+ if (this.mergeRowColKeys.includes(column._key)) {
146
+ if (this.$isEmptyData(row[column._key])) {
147
+ return {
148
+ rowspan: 1,
149
+ colspan: 1
150
+ };
151
+ }
152
+ else {
153
+ if (
154
+ rowIndex !== 0 &&
155
+ row[column._key] === this.showListData[rowIndex - 1][column._key]
156
+ ) {
157
+ return {
158
+ rowspan: 0,
159
+ colspan: 0
160
+ };
161
+ } else {
162
+ const newList = this.showListData.slice(rowIndex);
163
+ const newIndex = newList.findIndex(rowItem => row[column._key] !== rowItem[column._key]);
164
+ return {
165
+ rowspan: newIndex === -1 ? newList.length : newIndex,
166
+ colspan: 1
167
+ };
168
+ }
169
+ }
170
+ }
135
171
  }
136
172
  }
137
173
  };
@@ -6,6 +6,12 @@ export default {
6
6
  return {};
7
7
  },
8
8
  computed: {
9
+ selfBasePropsObj () {
10
+ return {
11
+ ...this.treeTableBasePropsObj
12
+ };
13
+ },
14
+
9
15
  allTreeData () {
10
16
  return this.getCalcuedTree(this.data, this.selfColumns);
11
17
  },
@@ -32,7 +38,7 @@ export default {
32
38
  };
33
39
  }, {
34
40
  _id: this.$ObjectID().str,
35
- __index__: "汇总",
41
+ __treeIndex__: "汇总",
36
42
  __isExpand__: "-",
37
43
  __operation__: "——"
38
44
  })
@@ -47,11 +53,9 @@ export default {
47
53
  ...(this.useIndex === true ? [this.indexColumn] : []),
48
54
  ...this.$transformToColumns(this.contentColumns),
49
55
  ...(
50
- this.isSearching
51
- ? []
52
- : this.$getOperationList(["canDelete"]).length
53
- ? [this.operationColumn]
54
- : []
56
+ !this.isSearching && this.$getOperationList(["canDelete"]).length
57
+ ? [this.operationColumn]
58
+ : []
55
59
  )
56
60
  ];
57
61
  },
@@ -93,9 +97,9 @@ export default {
93
97
  indexColumn () {
94
98
  return {
95
99
  title: "序号",
96
- _key: "__index__",
97
- key: "__index__",
98
- field: "__index__",
100
+ _key: "__treeIndex__",
101
+ key: "__treeIndex__",
102
+ field: "__treeIndex__",
99
103
  width: 28 + 16 + (this.maxLevel - 1) * 38,
100
104
  align: "left",
101
105
  fixed: "left",
@@ -109,7 +113,7 @@ export default {
109
113
  }, row.__treeIndex__),
110
114
 
111
115
  // 添加符
112
- ...this.createIconRender(h, { row, rowIndex, column })
116
+ ...this.operationIconRender(h, { row, rowIndex, column })
113
117
  ];
114
118
  }
115
119
  };
@@ -117,10 +121,6 @@ export default {
117
121
  },
118
122
  created () { },
119
123
  methods: {
120
- change (eventType, row, rowIndex, col, ...params) {
121
- this.$emit("change", { tree: this.data, rowDefault: this.rowDefault }, eventType, col, row, rowIndex, ...params);
122
- },
123
-
124
124
  /* ------ 工具方法 ------- */
125
125
  // 加工树形数据
126
126
  getCalcuedTree (treeData = [], cols = []) {