bri-components 1.3.98 → 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.
- package/package.json +1 -1
- package/src/components/controls/base/BriUpload/BriUpload.vue +15 -0
- package/src/components/controls/base/BriUpload/uploadList.vue +217 -56
- package/src/components/controls/mixins/controlMixin.js +29 -29
- package/src/components/controls/senior/cascaderTable.vue +4 -2
- package/src/components/controls/senior/flatTable.vue +2 -0
- package/src/components/controls/senior/selectUsers/departMenu.vue +2 -1
- package/src/components/list/DshBox/DshCrossTable.vue +0 -3
- package/src/components/list/mixins/DshCascaderTableMixin.js +305 -240
- package/src/components/list/mixins/DshFlatTableMixin.js +44 -8
- package/src/components/list/mixins/DshTreeTableMixin.js +10 -10
- package/src/components/list/mixins/tableBaseMixin.js +163 -154
- package/src/components/list/mixins/treeTableBaseMixin.js +54 -20
- package/src/components/small/DshDropdown.vue +2 -1
- package/src/styles/components/list/BriTable.less +2 -1
|
@@ -2,16 +2,6 @@ export default {
|
|
|
2
2
|
mixins: [],
|
|
3
3
|
components: {},
|
|
4
4
|
props: {
|
|
5
|
-
tableDataObj: {
|
|
6
|
-
type: Object,
|
|
7
|
-
default () {
|
|
8
|
-
return {
|
|
9
|
-
tree: [],
|
|
10
|
-
list: [],
|
|
11
|
-
_treeForm: []
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
},
|
|
15
5
|
treeColumns: {
|
|
16
6
|
type: Array,
|
|
17
7
|
default () {
|
|
@@ -37,38 +27,46 @@ export default {
|
|
|
37
27
|
color: "red",
|
|
38
28
|
event: "clickDeleteCol"
|
|
39
29
|
}
|
|
40
|
-
},
|
|
41
|
-
otherOperationMap: {
|
|
42
|
-
canChangeNode: {
|
|
43
|
-
name: "改变节点值",
|
|
44
|
-
type: "canChangeNode",
|
|
45
|
-
event: "changeNode"
|
|
46
|
-
},
|
|
47
|
-
canClickNode: {
|
|
48
|
-
name: "点击节点",
|
|
49
|
-
type: "canClickNode",
|
|
50
|
-
event: "clickNode"
|
|
51
|
-
},
|
|
52
|
-
canBlurNode: {
|
|
53
|
-
name: "节点失去焦点",
|
|
54
|
-
type: "canBlurNode",
|
|
55
|
-
event: "blurNode"
|
|
56
|
-
}
|
|
57
30
|
}
|
|
31
|
+
// otherOperationMap: {
|
|
32
|
+
// canChangeNode: {
|
|
33
|
+
// name: "改变节点值",
|
|
34
|
+
// type: "canChangeNode",
|
|
35
|
+
// event: "changeNode"
|
|
36
|
+
// },
|
|
37
|
+
// canClickNode: {
|
|
38
|
+
// name: "点击节点",
|
|
39
|
+
// type: "canClickNode",
|
|
40
|
+
// event: "clickNode"
|
|
41
|
+
// },
|
|
42
|
+
// canBlurNode: {
|
|
43
|
+
// name: "节点失去焦点",
|
|
44
|
+
// type: "canBlurNode",
|
|
45
|
+
// event: "blurNode"
|
|
46
|
+
// }
|
|
47
|
+
// }
|
|
58
48
|
};
|
|
59
49
|
},
|
|
60
50
|
computed: {
|
|
61
|
-
|
|
51
|
+
selfBasePropsObj () {
|
|
62
52
|
return {
|
|
53
|
+
...this.treeTableBasePropsObj,
|
|
63
54
|
_dftReadonlyTreeColKeys: [], // 默认的数据只读的表头列
|
|
64
55
|
_oldReadonlyTreeColKeys: [] // 保存的数据只读的表头列
|
|
65
56
|
};
|
|
66
57
|
},
|
|
67
58
|
dftReadonlyTreeColKeys () {
|
|
68
|
-
return this.isDftSet ? [] : this.selfPropsObj._dftReadonlyTreeColKeys || []; //
|
|
59
|
+
return this.isDftSet ? [] : this.selfPropsObj._dftReadonlyTreeColKeys || []; // 配置端有问题,高级依赖时值成undefined了
|
|
69
60
|
},
|
|
70
61
|
oldReadonlyTreeColKeys () {
|
|
71
|
-
return this.isDftSet ? [] : this.selfPropsObj._oldReadonlyTreeColKeys || []; //
|
|
62
|
+
return this.isDftSet ? [] : this.selfPropsObj._oldReadonlyTreeColKeys || []; // 配置端有问题,高级依赖时值成undefined了
|
|
63
|
+
},
|
|
64
|
+
// 替换tableBaseMixin里的
|
|
65
|
+
showCreateBtnColKeys () {
|
|
66
|
+
return [
|
|
67
|
+
...this.treeForm.map(treeFormItem => treeFormItem._key),
|
|
68
|
+
...(this.selfPropsObj._showCreateBtnColKeys || [])
|
|
69
|
+
];
|
|
72
70
|
},
|
|
73
71
|
|
|
74
72
|
allTreeData () {
|
|
@@ -112,64 +110,26 @@ export default {
|
|
|
112
110
|
/* ----------- 操作 ---------- */
|
|
113
111
|
// 表头操作 -树形表头-添加一列
|
|
114
112
|
clickCreateCol (operationItem, col, colIndex) {
|
|
115
|
-
|
|
116
|
-
this.
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
this.tableDataObj._treeForm = this.treeColumns;
|
|
113
|
+
this.treeColumns.push({
|
|
114
|
+
_id: this.$ObjectID().str,
|
|
115
|
+
_key: this.$randomB36("Field"),
|
|
116
|
+
_type: "textarea",
|
|
117
|
+
_name: `${this.$numToChinese(this.treeColumns.length + 1)}级表头`,
|
|
118
|
+
level: this.treeColumns.length + 1,
|
|
119
|
+
canDelete: true,
|
|
120
|
+
_treeSubForm: []
|
|
121
|
+
});
|
|
122
|
+
this.tableDataObj._treeForm = this.treeColumns;
|
|
126
123
|
|
|
127
|
-
|
|
128
|
-
}
|
|
124
|
+
this.change("createCol", null, null, col);
|
|
129
125
|
},
|
|
130
126
|
// 表头操作 -树形表头-删除一列
|
|
131
127
|
clickDeleteCol (operationItem, col, colIndex) {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
this.tableDataObj._treeForm = this.treeColumns;
|
|
136
|
-
|
|
137
|
-
this.change("deleteCol", col);
|
|
138
|
-
}
|
|
139
|
-
},
|
|
128
|
+
this.isDeleteColStatus = true; // isDeleteStatus不用在data中定义
|
|
129
|
+
this.treeColumns.pop();
|
|
130
|
+
this.tableDataObj._treeForm = this.treeColumns;
|
|
140
131
|
|
|
141
|
-
|
|
142
|
-
clickNode (operationItem, row, rowIndex, col) {
|
|
143
|
-
if (col.colType === "tree") {
|
|
144
|
-
if (
|
|
145
|
-
(this.getIsDftRow(row) ? !this.dftReadonlyTreeColKeys.includes(col._key) : true) && // 默认行的某列是否可编辑
|
|
146
|
-
(row.__old__ === true ? !this.oldReadonlyTreeColKeys.includes(col._key) : true) // 老数据行里某些列不可编辑
|
|
147
|
-
) {
|
|
148
|
-
row.isEdit = true;
|
|
149
|
-
this.$nextTick(() => {
|
|
150
|
-
this.$refs[`${col._id}${row._id}`] && this.$refs[`${col._id}${row._id}`].focus();
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
else if (col.colType === "summary") {
|
|
155
|
-
this.$Modal.warning({
|
|
156
|
-
title: "该汇总单元格自动计算,不准手动输入!",
|
|
157
|
-
closable: true,
|
|
158
|
-
onOk: () => { },
|
|
159
|
-
onCancel: () => { }
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
},
|
|
163
|
-
// 树形节点操作 -失去焦点
|
|
164
|
-
blurNode (operationItem, row, rowIndex, col) {
|
|
165
|
-
row.isEdit = false;
|
|
166
|
-
},
|
|
167
|
-
// 树形节点操作 -值改变
|
|
168
|
-
changeNode (operationItem, row, rowIndex, col) {
|
|
169
|
-
this.change("changeNode", row, rowIndex, col);
|
|
170
|
-
},
|
|
171
|
-
change (eventType, row, rowIndex, col, ...params) {
|
|
172
|
-
this.$emit("change", this.tableDataObj, eventType, col, row, rowIndex, ...params);
|
|
132
|
+
this.change("deleteCol", null, null, col);
|
|
173
133
|
},
|
|
174
134
|
|
|
175
135
|
/* ----------- 渲染函数(声明:为了代码更加规范清晰,return的是h相关的函数,则函数名get开头;return的是h的直接调用,函数名不要get开头)---------- */
|
|
@@ -196,19 +156,12 @@ export default {
|
|
|
196
156
|
"tr",
|
|
197
157
|
{},
|
|
198
158
|
this.showColumns.map((column, colIndex) => {
|
|
199
|
-
return h
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
this.thRender(h, { column, colIndex })
|
|
206
|
-
// h("dsh-render", {
|
|
207
|
-
// props: {
|
|
208
|
-
// render: this.thRender(h, { column, colIndex })
|
|
209
|
-
// }
|
|
210
|
-
// })
|
|
211
|
-
]);
|
|
159
|
+
return this.thRender(h, { column, colIndex });
|
|
160
|
+
// return h("dsh-render", {
|
|
161
|
+
// props: {
|
|
162
|
+
// render: this.thRender(h, { column, colIndex })
|
|
163
|
+
// }
|
|
164
|
+
// })
|
|
212
165
|
})
|
|
213
166
|
)
|
|
214
167
|
])
|
|
@@ -244,30 +197,23 @@ export default {
|
|
|
244
197
|
class: ""
|
|
245
198
|
},
|
|
246
199
|
this.rowColumnsArr[rowIndex].map(column => {
|
|
247
|
-
return
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
: this.contentTdRender(h, { row: mixedRow[column.nodeKey || column._key], rowIndex, column });
|
|
200
|
+
return this.tdRender(h, { row: mixedRow[column.nodeKey || column._key], rowIndex, column });
|
|
201
|
+
// return ["tree", "summary"].includes(column.colType)
|
|
202
|
+
// ? this.treeTdRender(h, { row: mixedRow[column.nodeKey || column._key], rowIndex, column })
|
|
203
|
+
// : this.contentTdRender(h, { row: mixedRow[column.nodeKey || column._key], rowIndex, column });
|
|
252
204
|
})
|
|
253
205
|
);
|
|
254
206
|
})
|
|
255
207
|
// 无数据
|
|
256
|
-
: h(
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
attrs: {
|
|
266
|
-
rowspan: 1,
|
|
267
|
-
colspan: this.showColumns.length
|
|
268
|
-
}
|
|
269
|
-
}, "暂无数据…")
|
|
270
|
-
])
|
|
208
|
+
: h(
|
|
209
|
+
"tr",
|
|
210
|
+
{
|
|
211
|
+
class: "bri-table-nodata"
|
|
212
|
+
},
|
|
213
|
+
[
|
|
214
|
+
this.emptyTdRender(h, {})
|
|
215
|
+
]
|
|
216
|
+
)
|
|
271
217
|
])
|
|
272
218
|
])
|
|
273
219
|
])
|
|
@@ -275,87 +221,44 @@ export default {
|
|
|
275
221
|
},
|
|
276
222
|
// 表头单元格渲染函数 (无法共用contentColumns的renderHeaderCell,因为级联老版表头的无renderHeaderCell)
|
|
277
223
|
thRender (h, { column, colIndex }) {
|
|
278
|
-
return h(
|
|
279
|
-
|
|
224
|
+
return h(
|
|
225
|
+
"th",
|
|
226
|
+
{
|
|
227
|
+
key: column._id,
|
|
228
|
+
class: "bri-table-th",
|
|
229
|
+
style: this.getThStyle(column)
|
|
230
|
+
},
|
|
231
|
+
[
|
|
232
|
+
this.contentThCellRender(h, { column, colIndex }),
|
|
280
233
|
|
|
281
|
-
|
|
282
|
-
this.treeDropOperationRender(h, { column, colIndex }, "th")
|
|
234
|
+
this.treeThDropOperationRender(h, { column, colIndex })
|
|
283
235
|
]);
|
|
284
236
|
},
|
|
285
|
-
|
|
286
|
-
treeTdRender (h, { row, rowIndex, column }) {
|
|
237
|
+
emptyTdRender (h, { row, rowIndex, column }) {
|
|
287
238
|
return h("td", {
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
239
|
+
style: {
|
|
240
|
+
width: `${this.boxWidth}px`,
|
|
241
|
+
minWidth: `${this.boxWidth}px`,
|
|
242
|
+
maxWidth: `${this.boxWidth}px`
|
|
292
243
|
},
|
|
293
|
-
style: this.getTdStyle(row, rowIndex, column),
|
|
294
244
|
attrs: {
|
|
295
|
-
rowspan:
|
|
296
|
-
colspan: this.
|
|
297
|
-
},
|
|
298
|
-
on: {
|
|
299
|
-
click: () => {
|
|
300
|
-
this.$dispatchEvent(this.operationMap.canClickNode, row, rowIndex, column);
|
|
301
|
-
}
|
|
245
|
+
rowspan: 1,
|
|
246
|
+
colspan: this.showColumns.length
|
|
302
247
|
}
|
|
303
|
-
},
|
|
304
|
-
column.colType === "tree"
|
|
305
|
-
// 树节点单元格
|
|
306
|
-
? row.isEdit
|
|
307
|
-
// 编辑状态
|
|
308
|
-
? h("Input", {
|
|
309
|
-
ref: `${column._id}${row._id}`,
|
|
310
|
-
props: {
|
|
311
|
-
value: row.name,
|
|
312
|
-
type: "textarea",
|
|
313
|
-
autosize: {
|
|
314
|
-
minRows: this.getTdRowSpan(row, rowIndex, column) * 3 - 1,
|
|
315
|
-
maxRows: 100
|
|
316
|
-
}
|
|
317
|
-
},
|
|
318
|
-
on: {
|
|
319
|
-
input: val => {
|
|
320
|
-
row.name = val;
|
|
321
|
-
},
|
|
322
|
-
"on-blur": () => {
|
|
323
|
-
this.$dispatchEvent(this.operationMap.canBlurNode, row, rowIndex, column);
|
|
324
|
-
},
|
|
325
|
-
"on-change": () => {
|
|
326
|
-
this.$dispatchEvent(this.operationMap.canChangeNode, row, rowIndex, column);
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
})
|
|
330
|
-
// 查看状态
|
|
331
|
-
: [
|
|
332
|
-
h("bri-tooltip", {
|
|
333
|
-
props: {
|
|
334
|
-
content: this.$transformEnterToBr(row.name),
|
|
335
|
-
transfer: true
|
|
336
|
-
}
|
|
337
|
-
}, [
|
|
338
|
-
h("span", {
|
|
339
|
-
domProps: {
|
|
340
|
-
innerHTML: this.$transformEnterToBr(row.name)
|
|
341
|
-
}
|
|
342
|
-
})
|
|
343
|
-
]),
|
|
344
|
-
|
|
345
|
-
// 操作下拉
|
|
346
|
-
this.treeDropOperationRender(h, { row, rowIndex, column }, "td")
|
|
347
|
-
]
|
|
348
|
-
// 汇总单元格
|
|
349
|
-
: h("span", this.getSummaryTdVal(row, rowIndex, column))
|
|
350
|
-
]);
|
|
248
|
+
}, "暂无数据…");
|
|
351
249
|
},
|
|
352
|
-
//
|
|
353
|
-
|
|
250
|
+
// 内容单元格渲染函数
|
|
251
|
+
tdRender (h, { row, rowIndex, column }) {
|
|
354
252
|
return h(
|
|
355
253
|
"td",
|
|
356
254
|
{
|
|
357
|
-
class: this.
|
|
255
|
+
class: this.bodyCellClass({ row, rowIndex, column }) +
|
|
256
|
+
`${["tree"].includes(column.colType) ? " bri-table-td-merge" : ""}`,
|
|
358
257
|
style: this.getTdStyle(row, rowIndex, column),
|
|
258
|
+
attrs: {
|
|
259
|
+
rowspan: this.getTdRowSpan(row, rowIndex, column),
|
|
260
|
+
colspan: this.getTdColSpan(row, rowIndex, column)
|
|
261
|
+
},
|
|
359
262
|
on: {
|
|
360
263
|
mouseenter: (event) => {
|
|
361
264
|
this.$set(this.hoverRecordMap, `${row._id}dsh${column._key}`, true);
|
|
@@ -365,36 +268,28 @@ export default {
|
|
|
365
268
|
}
|
|
366
269
|
}
|
|
367
270
|
},
|
|
368
|
-
|
|
271
|
+
column.colType === "summary"
|
|
272
|
+
? h("span", this.getSummaryTdVal(row, rowIndex, column))
|
|
273
|
+
: column.colType === "tree"
|
|
274
|
+
? this.contentTdCellRender(h, { row, rowIndex, column }, "tree")
|
|
275
|
+
: column.colType === "operation"
|
|
276
|
+
? this.operationTdCellRender(h, { row, rowIndex, column })
|
|
277
|
+
: this.contentTdCellRender(h, { row, rowIndex, column })
|
|
369
278
|
);
|
|
370
279
|
},
|
|
371
|
-
//
|
|
372
|
-
|
|
280
|
+
// 树形表头最末级列的下拉渲染函数
|
|
281
|
+
treeThDropOperationRender (h, { column, colIndex }) {
|
|
373
282
|
const list = this.$getOperationList(
|
|
374
|
-
|
|
283
|
+
column.colType === "tree" && column.level === this.treeColumns.length
|
|
375
284
|
? [
|
|
376
285
|
...(column.level < this.maxLevel ? ["canCreateCol"] : []), // 限制最大添加到几级
|
|
377
|
-
...(column.
|
|
286
|
+
...(column.canDelete === true ? ["canDeleteCol"] : []) // 只有一级和最后两级节点数不一致时,不能删
|
|
378
287
|
]
|
|
379
|
-
:
|
|
380
|
-
? [
|
|
381
|
-
"canCreate",
|
|
382
|
-
...(this.getRowBtnCanEdit(row, rowIndex) ? ["canDelete"] : [])
|
|
383
|
-
]
|
|
384
|
-
: [
|
|
385
|
-
"canCreate",
|
|
386
|
-
"canCreateChild",
|
|
387
|
-
...(this.getRowBtnCanEdit(row, rowIndex) ? ["canDelete", "canDeleteChilds"] : [])
|
|
388
|
-
]
|
|
288
|
+
: []
|
|
389
289
|
);
|
|
390
290
|
|
|
391
291
|
return !this.isSearching &&
|
|
392
|
-
list.length
|
|
393
|
-
(
|
|
394
|
-
position === "th"
|
|
395
|
-
? column.colType === "tree" && column.level === this.treeColumns.length
|
|
396
|
-
: true
|
|
397
|
-
)
|
|
292
|
+
list.length
|
|
398
293
|
? h("dsh-dropdown", {
|
|
399
294
|
class: "bri-table-dropdown",
|
|
400
295
|
props: {
|
|
@@ -404,9 +299,7 @@ export default {
|
|
|
404
299
|
},
|
|
405
300
|
on: {
|
|
406
301
|
click: (operationItem) => {
|
|
407
|
-
|
|
408
|
-
? this.$dispatchEvent(operationItem, column, colIndex)
|
|
409
|
-
: this.$dispatchEvent(operationItem, row, rowIndex, column);
|
|
302
|
+
this.$dispatchEvent(operationItem, column, colIndex);
|
|
410
303
|
}
|
|
411
304
|
},
|
|
412
305
|
nativeOn: {
|
|
@@ -437,42 +330,32 @@ export default {
|
|
|
437
330
|
|
|
438
331
|
/* ----------- 方法 ---------- */
|
|
439
332
|
// 表头 -获取样式
|
|
440
|
-
getThStyle (col
|
|
333
|
+
getThStyle (col) {
|
|
334
|
+
const typeData = this.$modFieldMap[col._type] || {};
|
|
441
335
|
const boxColWidth = this.boxWidth / this.showColumns.length;
|
|
442
336
|
const calcWidth = (col._name ? col._name.length * 12 : 48) + (col._type === "reference" ? 200 : 32);
|
|
443
337
|
const dftWidth = Math.max(boxColWidth, this.widthMap[col._type], calcWidth);
|
|
444
338
|
const width = col._width || dftWidth;
|
|
445
339
|
|
|
446
|
-
const selfStyle = col.colType === "tree"
|
|
447
|
-
? {
|
|
448
|
-
textAlign: col._align || "left",
|
|
449
|
-
fontSize: "14px"
|
|
450
|
-
}
|
|
451
|
-
: col.colType === "summary"
|
|
452
|
-
? {
|
|
453
|
-
textAlign: col._align || "right"
|
|
454
|
-
}
|
|
455
|
-
: {
|
|
456
|
-
textAlign: col._align || "left"
|
|
457
|
-
};
|
|
458
|
-
|
|
459
340
|
return {
|
|
460
341
|
width: `${width}px`,
|
|
461
342
|
minWidth: `${width}px`,
|
|
462
343
|
maxWidth: `${width}px`,
|
|
463
|
-
paddingTop:
|
|
464
|
-
paddingBottom:
|
|
344
|
+
paddingTop: !this.headHeightAuto ? "10px" : undefined,
|
|
345
|
+
paddingBottom: !this.headHeightAuto ? "10px" : undefined,
|
|
346
|
+
align: col._align || typeData.align,
|
|
465
347
|
"word-break": "break-all",
|
|
466
|
-
cursor: "pointer"
|
|
467
|
-
...selfStyle
|
|
348
|
+
cursor: "pointer"
|
|
468
349
|
};
|
|
469
350
|
},
|
|
470
351
|
|
|
471
352
|
// 单元格 -获取样式
|
|
472
353
|
getTdStyle (row, rowIndex, col) {
|
|
473
354
|
return {
|
|
474
|
-
...this.getThStyle(col
|
|
475
|
-
|
|
355
|
+
...this.getThStyle(col),
|
|
356
|
+
paddingTop: undefined,
|
|
357
|
+
paddingBottom: undefined,
|
|
358
|
+
backgroundColor: "#ffffff"
|
|
476
359
|
};
|
|
477
360
|
},
|
|
478
361
|
// 单元格 -获取行合并数
|
|
@@ -513,12 +396,17 @@ export default {
|
|
|
513
396
|
: "未选择算法";
|
|
514
397
|
}
|
|
515
398
|
},
|
|
399
|
+
// 列本身是否可编辑 -针对表头列
|
|
400
|
+
getTypeColCanEdit (row, rowIndex, col) {
|
|
401
|
+
return (this.getIsDftRow(row) ? !this.dftReadonlyTreeColKeys.includes(col._key) : true) && // 默认行的某列是否可编辑
|
|
402
|
+
(row.__old__ === true ? !this.oldReadonlyTreeColKeys.includes(col._key) : true); // 老数据行里某些列不可编辑
|
|
403
|
+
},
|
|
516
404
|
|
|
517
405
|
/* ----------- 工具方法 ---------- */
|
|
518
406
|
// 合并表头
|
|
519
407
|
mergeColumns (treeForm = [], subForm = this.showContentColumns) {
|
|
520
|
-
return
|
|
521
|
-
.reduce((arr, treeFormItem
|
|
408
|
+
return [
|
|
409
|
+
...treeForm.reduce((arr, treeFormItem) => {
|
|
522
410
|
return arr.concat(
|
|
523
411
|
{
|
|
524
412
|
...treeFormItem,
|
|
@@ -532,16 +420,22 @@ export default {
|
|
|
532
420
|
}
|
|
533
421
|
))
|
|
534
422
|
);
|
|
535
|
-
}, [])
|
|
536
|
-
.
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
423
|
+
}, []),
|
|
424
|
+
...subForm.map(subFormItem => ({
|
|
425
|
+
...subFormItem,
|
|
426
|
+
nodeKey: treeForm[treeForm.length - 1]._key,
|
|
427
|
+
colType: "data"
|
|
428
|
+
})),
|
|
429
|
+
...(
|
|
430
|
+
!this.isSearching && this.$getOperationList(["canDelete"]).length
|
|
431
|
+
? [{
|
|
432
|
+
...this.operationColumn,
|
|
540
433
|
nodeKey: treeForm[treeForm.length - 1]._key,
|
|
541
|
-
colType: "
|
|
542
|
-
}
|
|
543
|
-
|
|
544
|
-
|
|
434
|
+
colType: "operation"
|
|
435
|
+
}]
|
|
436
|
+
: []
|
|
437
|
+
)
|
|
438
|
+
];
|
|
545
439
|
},
|
|
546
440
|
// 转化树数据
|
|
547
441
|
getCalcuedTree (nodes = [], treeForm = [], subForm = []) {
|
|
@@ -677,5 +571,176 @@ export default {
|
|
|
677
571
|
|
|
678
572
|
return loop(nodes);
|
|
679
573
|
}
|
|
574
|
+
// // 树形、汇总节点操作 -点击
|
|
575
|
+
// clickNode (operationItem, row, rowIndex, col) {
|
|
576
|
+
// if (col.colType === "tree") {
|
|
577
|
+
// if (
|
|
578
|
+
// (this.getIsDftRow(row) ? !this.dftReadonlyTreeColKeys.includes(col._key) : true) && // 默认行的某列是否可编辑
|
|
579
|
+
// (row.__old__ === true ? !this.oldReadonlyTreeColKeys.includes(col._key) : true) // 老数据行里某些列不可编辑
|
|
580
|
+
// ) {
|
|
581
|
+
// row.isEdit = true;
|
|
582
|
+
// this.$nextTick(() => {
|
|
583
|
+
// this.$refs[`${col._id}${row._id}`] && this.$refs[`${col._id}${row._id}`].focus();
|
|
584
|
+
// });
|
|
585
|
+
// }
|
|
586
|
+
// }
|
|
587
|
+
// else if (col.colType === "summary") {
|
|
588
|
+
// this.$Modal.warning({
|
|
589
|
+
// title: "该汇总单元格自动计算,不准手动输入!",
|
|
590
|
+
// closable: true,
|
|
591
|
+
// onOk: () => { },
|
|
592
|
+
// onCancel: () => { }
|
|
593
|
+
// });
|
|
594
|
+
// }
|
|
595
|
+
// },
|
|
596
|
+
// // 树形节点操作 -失去焦点
|
|
597
|
+
// blurNode (operationItem, row, rowIndex, col) {
|
|
598
|
+
// row.isEdit = false;
|
|
599
|
+
// },
|
|
600
|
+
// // 树形节点操作 -值改变
|
|
601
|
+
// changeNode (operationItem, row, rowIndex, col) {
|
|
602
|
+
// this.change("changeNode", row, rowIndex, col);
|
|
603
|
+
// },
|
|
604
|
+
|
|
605
|
+
// // 树节点单元格、汇总单元格渲染函数
|
|
606
|
+
// treeTdRender (h, { row, rowIndex, column }) {
|
|
607
|
+
// return h("td", {
|
|
608
|
+
// class: {
|
|
609
|
+
// "bri-table-td": true, // 可以不要,为了position: relative,下面有
|
|
610
|
+
// "bri-table-td-edit": this.canEdit,
|
|
611
|
+
// "bri-table-td-merge": column.colType === "tree"
|
|
612
|
+
// },
|
|
613
|
+
// style: this.getTdStyle(row, rowIndex, column),
|
|
614
|
+
// attrs: {
|
|
615
|
+
// rowspan: this.getTdRowSpan(row, rowIndex, column),
|
|
616
|
+
// colspan: this.getTdColSpan(row, rowIndex, column)
|
|
617
|
+
// },
|
|
618
|
+
// on: {
|
|
619
|
+
// click: () => {
|
|
620
|
+
// this.$dispatchEvent(this.operationMap.canClickNode, row, rowIndex, column);
|
|
621
|
+
// }
|
|
622
|
+
// }
|
|
623
|
+
// }, [
|
|
624
|
+
// column.colType === "tree"
|
|
625
|
+
// // 树节点单元格
|
|
626
|
+
// ? row.isEdit
|
|
627
|
+
// // 编辑状态
|
|
628
|
+
// ? h("Input", {
|
|
629
|
+
// ref: `${column._id}${row._id}`,
|
|
630
|
+
// props: {
|
|
631
|
+
// value: row.name,
|
|
632
|
+
// type: "textarea",
|
|
633
|
+
// autosize: {
|
|
634
|
+
// minRows: this.getTdRowSpan(row, rowIndex, column) * 3 - 1,
|
|
635
|
+
// maxRows: 100
|
|
636
|
+
// }
|
|
637
|
+
// },
|
|
638
|
+
// on: {
|
|
639
|
+
// input: val => {
|
|
640
|
+
// row.name = val;
|
|
641
|
+
// },
|
|
642
|
+
// "on-blur": () => {
|
|
643
|
+
// this.$dispatchEvent(this.operationMap.canBlurNode, row, rowIndex, column);
|
|
644
|
+
// },
|
|
645
|
+
// "on-change": () => {
|
|
646
|
+
// this.$dispatchEvent(this.operationMap.canChangeNode, row, rowIndex, column);
|
|
647
|
+
// }
|
|
648
|
+
// }
|
|
649
|
+
// })
|
|
650
|
+
// // 查看状态
|
|
651
|
+
// : [
|
|
652
|
+
// h("bri-tooltip", {
|
|
653
|
+
// props: {
|
|
654
|
+
// content: this.$transformEnterToBr(row.name),
|
|
655
|
+
// transfer: true
|
|
656
|
+
// }
|
|
657
|
+
// }, [
|
|
658
|
+
// h("span", {
|
|
659
|
+
// domProps: {
|
|
660
|
+
// innerHTML: this.$transformEnterToBr(row.name)
|
|
661
|
+
// }
|
|
662
|
+
// })
|
|
663
|
+
// ]),
|
|
664
|
+
|
|
665
|
+
// // 操作下拉
|
|
666
|
+
// this.treeTdDropOperationRender(h, { row, rowIndex, column })
|
|
667
|
+
// ]
|
|
668
|
+
// // 汇总单元格
|
|
669
|
+
// : h("span", this.getSummaryTdVal(row, rowIndex, column))
|
|
670
|
+
// ]);
|
|
671
|
+
// },
|
|
672
|
+
// // 普通单元格渲染函数
|
|
673
|
+
// contentTdRender (h, { row, rowIndex, column }) {
|
|
674
|
+
// return h(
|
|
675
|
+
// "td",
|
|
676
|
+
// {
|
|
677
|
+
// class: this.bodyCellClass({ row, rowIndex, column }),
|
|
678
|
+
// style: this.getTdStyle(row, rowIndex, column),
|
|
679
|
+
// on: {
|
|
680
|
+
// mouseenter: (event) => {
|
|
681
|
+
// this.$set(this.hoverRecordMap, `${row._id}dsh${column._key}`, true);
|
|
682
|
+
// },
|
|
683
|
+
// mouseleave: (event) => {
|
|
684
|
+
// this.$set(this.hoverRecordMap, `${row._id}dsh${column._key}`, false);
|
|
685
|
+
// }
|
|
686
|
+
// }
|
|
687
|
+
// },
|
|
688
|
+
// this.contentTdCellRender(h, { row, rowIndex, column })
|
|
689
|
+
// );
|
|
690
|
+
// },
|
|
691
|
+
// // 树形单元格的下拉渲染函数
|
|
692
|
+
// treeTdDropOperationRender (h, { row, rowIndex, column }) {
|
|
693
|
+
// const list = this.$getOperationList([
|
|
694
|
+
// "canCreate",
|
|
695
|
+
// ...(this.getRowDelBtnCanEdit(row, rowIndex) ? ["canDelete"] : []),
|
|
696
|
+
// ...(
|
|
697
|
+
// row.isLeaf === true
|
|
698
|
+
// ? []
|
|
699
|
+
// : [
|
|
700
|
+
// "canCreateChild",
|
|
701
|
+
// ...(this.getRowDelBtnCanEdit(row, rowIndex) ? ["canDeleteChilds"] : [])
|
|
702
|
+
// ]
|
|
703
|
+
// )
|
|
704
|
+
// ]);
|
|
705
|
+
|
|
706
|
+
// return !this.isSearching &&
|
|
707
|
+
// list.length
|
|
708
|
+
// ? h("dsh-dropdown", {
|
|
709
|
+
// class: "bri-table-dropdown",
|
|
710
|
+
// props: {
|
|
711
|
+
// menuClass: "bri-table-dropdown-list",
|
|
712
|
+
// trigger: "hover",
|
|
713
|
+
// list: list
|
|
714
|
+
// },
|
|
715
|
+
// on: {
|
|
716
|
+
// click: (operationItem) => {
|
|
717
|
+
// this.$dispatchEvent(operationItem, row, rowIndex, column);
|
|
718
|
+
// }
|
|
719
|
+
// },
|
|
720
|
+
// nativeOn: {
|
|
721
|
+
// click: (e) => {
|
|
722
|
+
// e.stopPropagation();
|
|
723
|
+
// }
|
|
724
|
+
// }
|
|
725
|
+
// }, [
|
|
726
|
+
// h("a", {
|
|
727
|
+
// style: {
|
|
728
|
+
// fontWeight: "500",
|
|
729
|
+
// color: this.appColor
|
|
730
|
+
// },
|
|
731
|
+
// attrs: {
|
|
732
|
+
// href: "javascript:void(0)"
|
|
733
|
+
// }
|
|
734
|
+
// }, [
|
|
735
|
+
// h("Icon", {
|
|
736
|
+
// props: {
|
|
737
|
+
// type: "md-arrow-dropdown-circle",
|
|
738
|
+
// size: "16"
|
|
739
|
+
// }
|
|
740
|
+
// })
|
|
741
|
+
// ])
|
|
742
|
+
// ])
|
|
743
|
+
// : undefined;
|
|
744
|
+
// }
|
|
680
745
|
}
|
|
681
746
|
};
|