bri-components 1.3.97 → 1.4.0

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 () { },
@@ -115,7 +125,7 @@ export default {
115
125
  : list.length;
116
126
  list.splice(newRowIndex, 0, newRow);
117
127
 
118
- this.change("createRow", null, newRow, newRowIndex);
128
+ this.change("createRow", newRow, newRowIndex, null);
119
129
  },
120
130
  // 点击 -删除行
121
131
  clickDelete (operationItem, row, rowIndex) {
@@ -125,13 +135,39 @@ export default {
125
135
  onOk: () => {
126
136
  this.data.splice(rowIndex, 1);
127
137
 
128
- this.change("deleteRow", null, row, rowIndex);
138
+ this.change("deleteRow", row, rowIndex, null);
129
139
  }
130
140
  });
131
141
  },
132
142
 
133
- change (eventType, col, row, rowIndex, ...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
  },
@@ -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
  },
@@ -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, col, row, rowIndex, ...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 = []) {