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.
- 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/form/DshForm.vue +5 -1
- package/src/components/list/DshBox/DshCrossTable.vue +0 -3
- package/src/components/list/DshCascaderTable.vue +4 -4
- package/src/components/list/mixins/DshCascaderTableMixin.js +378 -355
- package/src/components/list/mixins/DshFlatTableMixin.js +46 -10
- package/src/components/list/mixins/DshTreeTableMixin.js +10 -10
- package/src/components/list/mixins/tableBaseMixin.js +256 -230
- package/src/components/list/mixins/treeTableBaseMixin.js +57 -23
- package/src/components/small/DshDropdown.vue +2 -1
- package/src/styles/components/list/BriTable.less +2 -1
- package/src/utils/table.js +1 -1
|
@@ -45,6 +45,12 @@ export default {
|
|
|
45
45
|
return {};
|
|
46
46
|
}
|
|
47
47
|
},
|
|
48
|
+
tableDataObj: {
|
|
49
|
+
type: Object,
|
|
50
|
+
default () {
|
|
51
|
+
return {};
|
|
52
|
+
}
|
|
53
|
+
},
|
|
48
54
|
|
|
49
55
|
allFormList: {
|
|
50
56
|
type: Array,
|
|
@@ -108,35 +114,15 @@ export default {
|
|
|
108
114
|
disabled: false,
|
|
109
115
|
event: "clickCreate"
|
|
110
116
|
},
|
|
111
|
-
canCreateChild: {
|
|
112
|
-
name: "添加一行下级",
|
|
113
|
-
type: "canCreateChild",
|
|
114
|
-
btnType: "default",
|
|
115
|
-
icon: "md-add-circle",
|
|
116
|
-
size: "default",
|
|
117
|
-
color: "#3DB8C5",
|
|
118
|
-
disabled: false,
|
|
119
|
-
event: "clickCreateChild"
|
|
120
|
-
},
|
|
121
117
|
canDelete: {
|
|
122
118
|
name: "删除",
|
|
123
119
|
type: "canDelete",
|
|
124
120
|
btnType: "errorText",
|
|
125
|
-
icon: "
|
|
121
|
+
icon: "md-trash",
|
|
126
122
|
size: "small",
|
|
127
123
|
color: "#E83636",
|
|
128
124
|
disabled: false,
|
|
129
125
|
event: "clickDelete"
|
|
130
|
-
},
|
|
131
|
-
canDeleteChilds: {
|
|
132
|
-
name: "删除所有子级",
|
|
133
|
-
type: "canDeleteChilds",
|
|
134
|
-
btnType: "errorText",
|
|
135
|
-
icon: "ios-trash-outline",
|
|
136
|
-
size: "small",
|
|
137
|
-
color: "#E83636",
|
|
138
|
-
disabled: false,
|
|
139
|
-
event: "clickDeleteChilds"
|
|
140
126
|
}
|
|
141
127
|
},
|
|
142
128
|
otherOperationMap: {
|
|
@@ -231,15 +217,15 @@ export default {
|
|
|
231
217
|
|
|
232
218
|
_showRequired: true, // 表头显示校验符号*
|
|
233
219
|
_showDescription: true, // 表头显示提示
|
|
220
|
+
_contentHeight: 500, // 表格最大高度
|
|
234
221
|
_headHeightAuto: false, // 表头高度自适应
|
|
235
222
|
_heightAuto: false, // 单元格高度自适应
|
|
236
223
|
_useSelection: false, // 使用选择列 -配置端暂时用不到
|
|
237
224
|
_useIndex: true, // 使用序号列
|
|
238
225
|
_useSummary: false, // 使用汇总行
|
|
239
|
-
_mergeRowColKeys: [], // 合并行的列
|
|
240
226
|
|
|
241
227
|
_disabledBtns: false, // 禁用增删按钮
|
|
242
|
-
_showCreateBtnColKeys: [], //
|
|
228
|
+
_showCreateBtnColKeys: [], // 显示增删图标的列
|
|
243
229
|
_disabledFootCreateBtn: false, // 禁用底部新增按钮
|
|
244
230
|
_disabledDeleteDftRow: false, // 默认的数据行禁止删除
|
|
245
231
|
_disabledDeleteOldRow: false, // 保存的数据行禁止删除
|
|
@@ -266,8 +252,14 @@ export default {
|
|
|
266
252
|
_isImport: false, // 导入
|
|
267
253
|
_isExport: false, // 导出
|
|
268
254
|
|
|
269
|
-
|
|
270
|
-
|
|
255
|
+
_default: {
|
|
256
|
+
rowDefault: {},
|
|
257
|
+
list: [],
|
|
258
|
+
tree: []
|
|
259
|
+
},
|
|
260
|
+
...(this.selfBasePropsObj || {}),
|
|
261
|
+
|
|
262
|
+
...this.propsObj
|
|
271
263
|
};
|
|
272
264
|
},
|
|
273
265
|
selfPropsObj () {
|
|
@@ -291,7 +283,7 @@ export default {
|
|
|
291
283
|
},
|
|
292
284
|
|
|
293
285
|
contentHeight () {
|
|
294
|
-
return this.selfPropsObj._contentHeight;
|
|
286
|
+
return this.selfPropsObj._contentHeight || 500;
|
|
295
287
|
},
|
|
296
288
|
showRequired () {
|
|
297
289
|
return this.selfPropsObj._showRequired;
|
|
@@ -314,15 +306,12 @@ export default {
|
|
|
314
306
|
useSummary () {
|
|
315
307
|
return this.selfPropsObj._useSummary;
|
|
316
308
|
},
|
|
317
|
-
mergeRowColKeys () {
|
|
318
|
-
return this.selfPropsObj._mergeRowColKeys || []; // 配置端有问题,高级以依赖时候值成undefined了
|
|
319
|
-
},
|
|
320
309
|
|
|
321
310
|
disabledBtns () {
|
|
322
311
|
return this.isDftSet ? false : this.selfPropsObj._disabledBtns;
|
|
323
312
|
},
|
|
324
313
|
showCreateBtnColKeys () {
|
|
325
|
-
return this.selfPropsObj._showCreateBtnColKeys || []; //
|
|
314
|
+
return this.selfPropsObj._showCreateBtnColKeys || []; // 配置端有问题,高级依赖时值成undefined了
|
|
326
315
|
},
|
|
327
316
|
disabledFootCreateBtn () {
|
|
328
317
|
return this.isDftSet ? false : this.selfPropsObj._disabledFootCreateBtn;
|
|
@@ -338,13 +327,13 @@ export default {
|
|
|
338
327
|
return this.isDftSet ? false : this.selfPropsObj._dftReadonly;
|
|
339
328
|
},
|
|
340
329
|
dftReadonlyColKeys () {
|
|
341
|
-
return this.isDftSet ? [] : this.selfPropsObj._dftReadonlyColKeys || []; //
|
|
330
|
+
return this.isDftSet ? [] : this.selfPropsObj._dftReadonlyColKeys || []; // 配置端有问题,高级依赖时值成undefined了
|
|
342
331
|
},
|
|
343
332
|
oldReadonly () {
|
|
344
333
|
return this.isDftSet ? false : this.selfPropsObj._oldReadonly;
|
|
345
334
|
},
|
|
346
335
|
oldReadonlyColKeys () {
|
|
347
|
-
return this.isDftSet ? [] : this.selfPropsObj._oldReadonlyColKeys || []; //
|
|
336
|
+
return this.isDftSet ? [] : this.selfPropsObj._oldReadonlyColKeys || []; // 配置端有问题,高级依赖时值成undefined了
|
|
348
337
|
},
|
|
349
338
|
|
|
350
339
|
searchLabelWidth () {
|
|
@@ -467,9 +456,6 @@ export default {
|
|
|
467
456
|
selfColumns () {
|
|
468
457
|
return this.columns;
|
|
469
458
|
},
|
|
470
|
-
mergeRowColumns () {
|
|
471
|
-
return this.selfColumns.filter(colItem => this.mergeRowColKeys.includes(colItem._key));
|
|
472
|
-
},
|
|
473
459
|
filterColumns () {
|
|
474
460
|
return this.selfColumns.filter(colItem => this.$isAdvRelyShow(colItem, this.allListData, this.parentObj, true));
|
|
475
461
|
},
|
|
@@ -478,82 +464,10 @@ export default {
|
|
|
478
464
|
filter: undefined,
|
|
479
465
|
sortBy: undefined,
|
|
480
466
|
renderHeaderCell: ({ column }, h) => {
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
return this.$getHeadRender(h, column, {
|
|
484
|
-
showRequired: this.showRequired,
|
|
485
|
-
showDescription: this.showDescription,
|
|
486
|
-
headHeightAuto: this.headHeightAuto
|
|
487
|
-
});
|
|
467
|
+
return this.contentThCellRender(h, { column });
|
|
488
468
|
},
|
|
489
469
|
renderBodyCell: ({ row, rowIndex, column }, h) => {
|
|
490
|
-
|
|
491
|
-
column = this.getResetCol(column, row, rowIndex);
|
|
492
|
-
const unitCanEdit = this.getUnitCanEdit(column, row, rowIndex);
|
|
493
|
-
const ruleResultObj = this.getColRuleResult(column, row, rowIndex);
|
|
494
|
-
|
|
495
|
-
return [
|
|
496
|
-
this.isShowCompare(column, row, rowIndex)
|
|
497
|
-
? h("Tooltip", {
|
|
498
|
-
style: {
|
|
499
|
-
width: "100%"
|
|
500
|
-
},
|
|
501
|
-
props: {
|
|
502
|
-
content: this.$isEmptyData(this.compareListData[rowIndex][column._key])
|
|
503
|
-
? ""
|
|
504
|
-
: this.compareListData[rowIndex][column._key],
|
|
505
|
-
transfer: true,
|
|
506
|
-
maxWidth: 200,
|
|
507
|
-
placement: "top"
|
|
508
|
-
},
|
|
509
|
-
scopedSlots: {
|
|
510
|
-
default: props => h("dsh-list-unit", {
|
|
511
|
-
props: {
|
|
512
|
-
canEdit: unitCanEdit,
|
|
513
|
-
formData: row,
|
|
514
|
-
formItem: column,
|
|
515
|
-
allFormList: this.selfColumns,
|
|
516
|
-
inTableType: this.inTableType,
|
|
517
|
-
allListRows: this.allListData,
|
|
518
|
-
rowIndex: rowIndex,
|
|
519
|
-
parentFormList: this.allFormList,
|
|
520
|
-
parentObj: this.parentObj
|
|
521
|
-
},
|
|
522
|
-
on: {
|
|
523
|
-
blur: () => this.controlBlur(null, column, row, rowIndex, arguments),
|
|
524
|
-
change: () => this.$dispatchEvent(this.operationMap.changeVal, column, row, rowIndex, arguments)
|
|
525
|
-
}
|
|
526
|
-
})
|
|
527
|
-
}
|
|
528
|
-
})
|
|
529
|
-
: h("dsh-list-unit", {
|
|
530
|
-
props: {
|
|
531
|
-
canEdit: unitCanEdit,
|
|
532
|
-
formData: row,
|
|
533
|
-
formItem: column,
|
|
534
|
-
allFormList: this.selfColumns,
|
|
535
|
-
inTableType: this.inTableType,
|
|
536
|
-
allListRows: this.allListData,
|
|
537
|
-
rowIndex: rowIndex,
|
|
538
|
-
parentFormList: this.allFormList,
|
|
539
|
-
parentObj: this.parentObj
|
|
540
|
-
},
|
|
541
|
-
on: {
|
|
542
|
-
blur: () => this.controlBlur(null, column, row, rowIndex, arguments),
|
|
543
|
-
change: () => this.$dispatchEvent(this.operationMap.changeVal, column, row, rowIndex, arguments)
|
|
544
|
-
}
|
|
545
|
-
}),
|
|
546
|
-
|
|
547
|
-
// 校验文字
|
|
548
|
-
!ruleResultObj.bool
|
|
549
|
-
? h("span", {
|
|
550
|
-
class: "bri-table-td-tip"
|
|
551
|
-
}, ruleResultObj.message)
|
|
552
|
-
: undefined,
|
|
553
|
-
|
|
554
|
-
// 添加符
|
|
555
|
-
...this.createIconRender(h, { row, rowIndex, column }, 12)
|
|
556
|
-
];
|
|
470
|
+
return this.contentTdCellRender(h, { row, rowIndex, column });
|
|
557
471
|
},
|
|
558
472
|
...colItem
|
|
559
473
|
}));
|
|
@@ -582,25 +496,14 @@ export default {
|
|
|
582
496
|
_key: "__operation__",
|
|
583
497
|
key: "__operation__",
|
|
584
498
|
field: "__operation__",
|
|
499
|
+
_align: "center",
|
|
585
500
|
align: "center",
|
|
501
|
+
_fixed: "right",
|
|
586
502
|
fixed: "right",
|
|
503
|
+
_width: 100,
|
|
587
504
|
width: 100,
|
|
588
505
|
renderBodyCell: ({ row, rowIndex, column }, h) => {
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
return h("dsh-buttons", {
|
|
592
|
-
props: {
|
|
593
|
-
list: operationList.map(btnItem => ({
|
|
594
|
-
...btnItem,
|
|
595
|
-
disabled: !this.getRowBtnCanEdit(row, rowIndex)
|
|
596
|
-
}))
|
|
597
|
-
},
|
|
598
|
-
on: {
|
|
599
|
-
click: (operationItem) => {
|
|
600
|
-
this.$dispatchEvent(operationItem, row, rowIndex);
|
|
601
|
-
}
|
|
602
|
-
}
|
|
603
|
-
});
|
|
506
|
+
return this.operationTdCellRender(h, { row, rowIndex, column });
|
|
604
507
|
}
|
|
605
508
|
};
|
|
606
509
|
},
|
|
@@ -617,37 +520,11 @@ export default {
|
|
|
617
520
|
columnHiddenOption: {
|
|
618
521
|
defaultHiddenColumnKeys: [...this.hideColKeys] // 必须这么写,不解构,切换一次隐藏/显示后,hideColKeys会变成空数组
|
|
619
522
|
},
|
|
620
|
-
cellStyleOption:
|
|
523
|
+
cellStyleOption: {
|
|
524
|
+
bodyCellClass: this.bodyCellClass
|
|
525
|
+
},
|
|
621
526
|
cellSpanOption: {
|
|
622
|
-
bodyCellSpan:
|
|
623
|
-
// 合并单元格(单元格值为空时不合并)
|
|
624
|
-
if (this.mergeRowColKeys.includes(column._key)) {
|
|
625
|
-
if (this.$isEmptyData(row[column._key])) {
|
|
626
|
-
return {
|
|
627
|
-
rowspan: 1,
|
|
628
|
-
colspan: 1
|
|
629
|
-
};
|
|
630
|
-
}
|
|
631
|
-
else {
|
|
632
|
-
if (
|
|
633
|
-
rowIndex !== 0 &&
|
|
634
|
-
row[column._key] === this.showListData[rowIndex - 1][column._key]
|
|
635
|
-
) {
|
|
636
|
-
return {
|
|
637
|
-
rowspan: 0,
|
|
638
|
-
colspan: 0
|
|
639
|
-
};
|
|
640
|
-
} else {
|
|
641
|
-
const newList = this.showListData.slice(rowIndex);
|
|
642
|
-
const newIndex = newList.findIndex(rowItem => row[column._key] !== rowItem[column._key]);
|
|
643
|
-
return {
|
|
644
|
-
rowspan: newIndex === -1 ? newList.length : newIndex,
|
|
645
|
-
colspan: 1
|
|
646
|
-
};
|
|
647
|
-
}
|
|
648
|
-
}
|
|
649
|
-
}
|
|
650
|
-
}
|
|
527
|
+
bodyCellSpan: this.bodyCellSpan
|
|
651
528
|
},
|
|
652
529
|
eventCustomOption: {
|
|
653
530
|
bodyCellEvents: ({ row, rowIndex, column }) => {
|
|
@@ -672,37 +549,6 @@ export default {
|
|
|
672
549
|
}
|
|
673
550
|
};
|
|
674
551
|
},
|
|
675
|
-
cellStyleOption () {
|
|
676
|
-
return {
|
|
677
|
-
bodyCellClass: ({ row, rowIndex, column }) => {
|
|
678
|
-
return "bri-table-td" +
|
|
679
|
-
`${this.mergeRowColKeys.includes(column._key)
|
|
680
|
-
? " bri-table-td-merge"
|
|
681
|
-
: ""
|
|
682
|
-
}` +
|
|
683
|
-
`${this.getRowCanEdit(row, rowIndex)
|
|
684
|
-
? " bri-table-td-edit"
|
|
685
|
-
: ""
|
|
686
|
-
}` +
|
|
687
|
-
`${this.isSearching
|
|
688
|
-
? row.__isSearchShow__ === false
|
|
689
|
-
? " bri-table-td-hide"
|
|
690
|
-
: ""
|
|
691
|
-
: row.__isShow__ === true
|
|
692
|
-
? this.isExpandAction
|
|
693
|
-
? " bri-table-td-visible"
|
|
694
|
-
: ""
|
|
695
|
-
: " bri-table-td-hide"
|
|
696
|
-
}` +
|
|
697
|
-
`${["__isExpand__"].includes(column._key)
|
|
698
|
-
? " bri-table-td-expand"
|
|
699
|
-
: ["__index__"].includes(column._key)
|
|
700
|
-
? " bri-table-td-index"
|
|
701
|
-
: ""
|
|
702
|
-
}`;
|
|
703
|
-
}
|
|
704
|
-
};
|
|
705
|
-
},
|
|
706
552
|
|
|
707
553
|
hideColKeys () {
|
|
708
554
|
return this.selfPropsObj._hideColKeys;
|
|
@@ -790,17 +636,12 @@ export default {
|
|
|
790
636
|
: this.baseOperationMap.canCreate.name
|
|
791
637
|
// disabled: !!this.disabledCreateBtn
|
|
792
638
|
},
|
|
793
|
-
canCreateChild: {
|
|
794
|
-
...this.baseOperationMap.canCreateChild,
|
|
795
|
-
name: this.showMode === "form"
|
|
796
|
-
? this.baseOperationMap.canCreateChild.name.replace("行", "条")
|
|
797
|
-
: this.baseOperationMap.canCreateChild.name
|
|
798
|
-
// disabled: !!this.disabledCreateBtn
|
|
799
|
-
},
|
|
800
639
|
canHideOrShow: {
|
|
801
640
|
...this.topOperationMap.canHideOrShow,
|
|
802
641
|
name: this.hideStatus ? "显示字段" : "隐藏字段"
|
|
803
|
-
}
|
|
642
|
+
},
|
|
643
|
+
|
|
644
|
+
...(this.selfAllOperationMap || {})
|
|
804
645
|
};
|
|
805
646
|
},
|
|
806
647
|
operationMap () {
|
|
@@ -875,14 +716,17 @@ export default {
|
|
|
875
716
|
changeSelect (list) {
|
|
876
717
|
this.$emit("changeSelect", list);
|
|
877
718
|
},
|
|
878
|
-
//
|
|
879
|
-
controlBlur (operationItem,
|
|
719
|
+
// 输入框失去焦点
|
|
720
|
+
controlBlur (operationItem, row, rowIndex, col, params) {
|
|
880
721
|
this.$set(this.ruleRecordMap, `${row._id}dsh${col._key}`, { showRuleMessage: true });
|
|
881
722
|
},
|
|
882
723
|
// 输入框值改变
|
|
883
|
-
changeVal (operationItem,
|
|
724
|
+
changeVal (operationItem, row, rowIndex, col, params) {
|
|
884
725
|
this.$set(this.ruleRecordMap, `${row._id}dsh${col._key}`, { showRuleMessage: true });
|
|
885
|
-
this.change("changeVal",
|
|
726
|
+
this.change("changeVal", row, rowIndex, col, ...params);
|
|
727
|
+
},
|
|
728
|
+
change (eventType, row, rowIndex, col, ...params) {
|
|
729
|
+
this.$emit("change", this.tableDataObj, eventType, col, row, rowIndex, ...params);
|
|
886
730
|
},
|
|
887
731
|
|
|
888
732
|
/* ----------- 隐藏/显示字段 ---------- */
|
|
@@ -1056,7 +900,7 @@ export default {
|
|
|
1056
900
|
window.location.href = data.url;
|
|
1057
901
|
} else if (data.status === "failed") {
|
|
1058
902
|
this.$Message.info({
|
|
1059
|
-
content: "
|
|
903
|
+
content: "操作失败,请稍后再试!"
|
|
1060
904
|
});
|
|
1061
905
|
}
|
|
1062
906
|
},
|
|
@@ -1073,7 +917,7 @@ export default {
|
|
|
1073
917
|
this.isEnlarge = true;
|
|
1074
918
|
},
|
|
1075
919
|
|
|
1076
|
-
/* -----------
|
|
920
|
+
/* ----------- 渲染函数(声明:为了代码更加规范清晰,return的是h相关的函数,则函数名get开头;return的是h的直接调用,函数名不要get开头)---------- */
|
|
1077
921
|
getTableTopRender (isEnlarge = false) {
|
|
1078
922
|
return (h, params) => {
|
|
1079
923
|
return h("div", {
|
|
@@ -1093,7 +937,7 @@ export default {
|
|
|
1093
937
|
]);
|
|
1094
938
|
};
|
|
1095
939
|
},
|
|
1096
|
-
topSearchRender (h
|
|
940
|
+
topSearchRender (h) {
|
|
1097
941
|
return this.searchFormList.length
|
|
1098
942
|
? h("dsh-default-search", {
|
|
1099
943
|
props: {
|
|
@@ -1107,7 +951,7 @@ export default {
|
|
|
1107
951
|
})
|
|
1108
952
|
: undefined;
|
|
1109
953
|
},
|
|
1110
|
-
topSummaryRender (h
|
|
954
|
+
topSummaryRender (h) {
|
|
1111
955
|
return h("div", {
|
|
1112
956
|
style: {
|
|
1113
957
|
"display": "flex",
|
|
@@ -1135,6 +979,7 @@ export default {
|
|
|
1135
979
|
"font-weight": "500"
|
|
1136
980
|
}
|
|
1137
981
|
}, this.selfLogicPropsObj._name + ":"),
|
|
982
|
+
|
|
1138
983
|
h("dsh-select", {
|
|
1139
984
|
style: {
|
|
1140
985
|
"margin-left": "8px",
|
|
@@ -1149,7 +994,7 @@ export default {
|
|
|
1149
994
|
: undefined
|
|
1150
995
|
]);
|
|
1151
996
|
},
|
|
1152
|
-
topOperationRender (h
|
|
997
|
+
topOperationRender (h) {
|
|
1153
998
|
return h("dsh-buttons", {
|
|
1154
999
|
style: {
|
|
1155
1000
|
"text-align": "right"
|
|
@@ -1162,10 +1007,15 @@ export default {
|
|
|
1162
1007
|
click: (event) => {
|
|
1163
1008
|
this.$dispatchEvent(event);
|
|
1164
1009
|
}
|
|
1010
|
+
},
|
|
1011
|
+
nativeOn: {
|
|
1012
|
+
click: (e) => {
|
|
1013
|
+
e.stopPropagation();
|
|
1014
|
+
}
|
|
1165
1015
|
}
|
|
1166
1016
|
});
|
|
1167
1017
|
},
|
|
1168
|
-
createBtnRender (h
|
|
1018
|
+
createBtnRender (h) {
|
|
1169
1019
|
return !this.isSearching && this.disabledFootCreateBtn !== true
|
|
1170
1020
|
? h("dsh-buttons", {
|
|
1171
1021
|
style: {
|
|
@@ -1183,9 +1033,114 @@ export default {
|
|
|
1183
1033
|
})
|
|
1184
1034
|
: undefined;
|
|
1185
1035
|
},
|
|
1186
|
-
|
|
1036
|
+
contentThCellRender (h, { column }) {
|
|
1037
|
+
column = this.$transformDynamicProperty(column, undefined, this.parentObj);
|
|
1038
|
+
|
|
1039
|
+
return this.$getHeadRender(h, column, {
|
|
1040
|
+
showRequired: this.showRequired,
|
|
1041
|
+
showDescription: this.showDescription,
|
|
1042
|
+
headHeightAuto: this.headHeightAuto
|
|
1043
|
+
});
|
|
1044
|
+
},
|
|
1045
|
+
contentTdCellRender (h, { row, rowIndex, column }, position) {
|
|
1046
|
+
column = this.$transformDynamicProperty(column, row, this.parentObj);
|
|
1047
|
+
column = this.getResetCol(row, rowIndex, column);
|
|
1048
|
+
const unitCanEdit = this.getUnitCanEdit(row, rowIndex, column);
|
|
1049
|
+
const ruleResultObj = this.getColRuleResult(row, rowIndex, column);
|
|
1050
|
+
|
|
1187
1051
|
return [
|
|
1188
|
-
|
|
1052
|
+
this.isShowCompare(row, rowIndex, column)
|
|
1053
|
+
? h("Tooltip", {
|
|
1054
|
+
style: {
|
|
1055
|
+
width: "100%"
|
|
1056
|
+
},
|
|
1057
|
+
props: {
|
|
1058
|
+
content: this.$isEmptyData(this.compareListData[rowIndex][column._key])
|
|
1059
|
+
? ""
|
|
1060
|
+
: this.compareListData[rowIndex][column._key],
|
|
1061
|
+
transfer: true,
|
|
1062
|
+
maxWidth: 200,
|
|
1063
|
+
placement: "top"
|
|
1064
|
+
},
|
|
1065
|
+
scopedSlots: {
|
|
1066
|
+
default: props => h("dsh-list-unit", {
|
|
1067
|
+
props: {
|
|
1068
|
+
canEdit: unitCanEdit,
|
|
1069
|
+
formData: row,
|
|
1070
|
+
formItem: {
|
|
1071
|
+
...column,
|
|
1072
|
+
_key: position === "tree" ? "name" : column._key,
|
|
1073
|
+
_heightAuto: column._heightAuto || position === "tree"
|
|
1074
|
+
},
|
|
1075
|
+
allFormList: this.selfColumns,
|
|
1076
|
+
inTableType: this.inTableType,
|
|
1077
|
+
allListRows: this.allListData,
|
|
1078
|
+
rowIndex: rowIndex,
|
|
1079
|
+
parentFormList: this.allFormList,
|
|
1080
|
+
parentObj: this.parentObj
|
|
1081
|
+
},
|
|
1082
|
+
on: {
|
|
1083
|
+
blur: () => this.controlBlur(null, row, rowIndex, column, arguments),
|
|
1084
|
+
change: () => this.$dispatchEvent(this.operationMap.changeVal, row, rowIndex, column, arguments)
|
|
1085
|
+
}
|
|
1086
|
+
})
|
|
1087
|
+
}
|
|
1088
|
+
})
|
|
1089
|
+
: h("dsh-list-unit", {
|
|
1090
|
+
props: {
|
|
1091
|
+
canEdit: unitCanEdit,
|
|
1092
|
+
formData: row,
|
|
1093
|
+
formItem: {
|
|
1094
|
+
...column,
|
|
1095
|
+
_key: position === "tree" ? "name" : column._key,
|
|
1096
|
+
_heightAuto: column._heightAuto || position === "tree"
|
|
1097
|
+
},
|
|
1098
|
+
allFormList: this.selfColumns,
|
|
1099
|
+
inTableType: this.inTableType,
|
|
1100
|
+
allListRows: this.allListData,
|
|
1101
|
+
rowIndex: rowIndex,
|
|
1102
|
+
parentFormList: this.allFormList,
|
|
1103
|
+
parentObj: this.parentObj
|
|
1104
|
+
},
|
|
1105
|
+
on: {
|
|
1106
|
+
blur: () => this.controlBlur(null, row, rowIndex, column, arguments),
|
|
1107
|
+
change: () => this.$dispatchEvent(this.operationMap.changeVal, row, rowIndex, column, arguments)
|
|
1108
|
+
}
|
|
1109
|
+
}),
|
|
1110
|
+
|
|
1111
|
+
// 校验文字
|
|
1112
|
+
!ruleResultObj.bool
|
|
1113
|
+
? h("span", {
|
|
1114
|
+
class: "bri-table-td-tip"
|
|
1115
|
+
}, ruleResultObj.message)
|
|
1116
|
+
: undefined,
|
|
1117
|
+
|
|
1118
|
+
// 添加符
|
|
1119
|
+
...this.operationIconRender(h, { row, rowIndex, column }, 12)
|
|
1120
|
+
];
|
|
1121
|
+
},
|
|
1122
|
+
operationTdCellRender (h, { row, rowIndex, column }) {
|
|
1123
|
+
const operationList = this.$getOperationList(["canDelete"]).map(btnItem => ({
|
|
1124
|
+
...btnItem,
|
|
1125
|
+
disabled: !this.getRowDelBtnCanEdit(row, rowIndex)
|
|
1126
|
+
}));
|
|
1127
|
+
|
|
1128
|
+
return [
|
|
1129
|
+
h("dsh-buttons", {
|
|
1130
|
+
props: {
|
|
1131
|
+
list: operationList
|
|
1132
|
+
},
|
|
1133
|
+
on: {
|
|
1134
|
+
click: (operationItem) => {
|
|
1135
|
+
this.$dispatchEvent(operationItem, row, rowIndex);
|
|
1136
|
+
}
|
|
1137
|
+
}
|
|
1138
|
+
})
|
|
1139
|
+
];
|
|
1140
|
+
},
|
|
1141
|
+
operationIconRender (h, { row, rowIndex, column }, iconSize = 14) {
|
|
1142
|
+
return [
|
|
1143
|
+
// 插入一行图标
|
|
1189
1144
|
(this.operationMap.canCreate && this.operationMap.canCreate.disabled !== true) &&
|
|
1190
1145
|
!this.isSearching &&
|
|
1191
1146
|
(column._key === "__index__" ? !this.showCreateBtnColKeys.length : this.showCreateBtnColKeys.includes(column._key)) &&
|
|
@@ -1198,6 +1153,7 @@ export default {
|
|
|
1198
1153
|
width: `${iconSize + 2}px`,
|
|
1199
1154
|
height: `${iconSize + 2}px`,
|
|
1200
1155
|
border: `1px solid ${this.appColor}`,
|
|
1156
|
+
borderRadius: "2px",
|
|
1201
1157
|
backgroundColor: "#ffffff",
|
|
1202
1158
|
lineHeight: `${iconSize - 2}px`,
|
|
1203
1159
|
cursor: "pointer",
|
|
@@ -1231,13 +1187,13 @@ export default {
|
|
|
1231
1187
|
])
|
|
1232
1188
|
: h("span", ""),
|
|
1233
1189
|
|
|
1234
|
-
//
|
|
1235
|
-
|
|
1236
|
-
(this.operationMap.canCreateChild && this.operationMap.canCreateChild.disabled !== true) &&
|
|
1190
|
+
// 添加一行下级图标
|
|
1191
|
+
(this.operationMap.canCreateChild && this.operationMap.canCreateChild.disabled !== true) &&
|
|
1237
1192
|
!this.isSearching &&
|
|
1238
1193
|
(column._key === "__index__" ? !this.showCreateBtnColKeys.length : this.showCreateBtnColKeys.includes(column._key)) &&
|
|
1239
1194
|
this.hoverRecordMap[`${row._id}dsh${column._key}`] &&
|
|
1240
|
-
row.level < this.maxLevel
|
|
1195
|
+
row.level < this.maxLevel &&
|
|
1196
|
+
!["cascaderTable"].includes(this.inTableType) // 老版级联表格类型不要“添加下级”图标
|
|
1241
1197
|
? h("div", {
|
|
1242
1198
|
style: {
|
|
1243
1199
|
position: "absolute",
|
|
@@ -1247,6 +1203,7 @@ export default {
|
|
|
1247
1203
|
width: `${iconSize + 2}px`,
|
|
1248
1204
|
height: `${iconSize + 2}px`,
|
|
1249
1205
|
border: `1px solid ${this.appColor}`,
|
|
1206
|
+
borderRadius: "2px",
|
|
1250
1207
|
backgroundColor: "#ffffff",
|
|
1251
1208
|
lineHeight: `${iconSize - 2}px`,
|
|
1252
1209
|
cursor: "pointer",
|
|
@@ -1263,7 +1220,7 @@ export default {
|
|
|
1263
1220
|
}, [
|
|
1264
1221
|
h("Icon", {
|
|
1265
1222
|
style: {
|
|
1266
|
-
fontWeight: "
|
|
1223
|
+
fontWeight: "500",
|
|
1267
1224
|
color: this.appColor
|
|
1268
1225
|
},
|
|
1269
1226
|
props: {
|
|
@@ -1278,9 +1235,85 @@ export default {
|
|
|
1278
1235
|
})
|
|
1279
1236
|
])
|
|
1280
1237
|
])
|
|
1238
|
+
: h("span", ""),
|
|
1239
|
+
|
|
1240
|
+
// 删除该行图标
|
|
1241
|
+
(this.operationMap.canDelete && this.operationMap.canDelete.disabled !== true) &&
|
|
1242
|
+
!this.isSearching &&
|
|
1243
|
+
(column._key === "__index__" ? !this.showCreateBtnColKeys.length : this.showCreateBtnColKeys.includes(column._key)) &&
|
|
1244
|
+
this.hoverRecordMap[`${row._id}dsh${column._key}`] &&
|
|
1245
|
+
this.getRowDelBtnCanEdit(row, rowIndex) &&
|
|
1246
|
+
["cascaderTable"].includes(this.inTableType)
|
|
1247
|
+
? h("div", {
|
|
1248
|
+
style: {
|
|
1249
|
+
position: "absolute",
|
|
1250
|
+
bottom: "0px",
|
|
1251
|
+
right: `${iconSize + 3}px`,
|
|
1252
|
+
width: `${iconSize + 2}px`,
|
|
1253
|
+
height: `${iconSize + 2}px`,
|
|
1254
|
+
border: `1px solid ${this.operationMap.canDelete.color}`,
|
|
1255
|
+
borderRadius: "2px",
|
|
1256
|
+
backgroundColor: "#ffffff",
|
|
1257
|
+
lineHeight: `${iconSize - 2}px`,
|
|
1258
|
+
cursor: "pointer",
|
|
1259
|
+
verticalAlign: "middle",
|
|
1260
|
+
transition: "color .2s ease-in-out,border-color .2s ease-in-out"
|
|
1261
|
+
}
|
|
1262
|
+
}, [
|
|
1263
|
+
h("Tooltip", {
|
|
1264
|
+
props: {
|
|
1265
|
+
content: "删除该行",
|
|
1266
|
+
maxWidth: "250",
|
|
1267
|
+
transfer: true
|
|
1268
|
+
}
|
|
1269
|
+
}, [
|
|
1270
|
+
h("Icon", {
|
|
1271
|
+
style: {
|
|
1272
|
+
fontWeight: "500",
|
|
1273
|
+
color: this.operationMap.canDelete.color
|
|
1274
|
+
},
|
|
1275
|
+
props: {
|
|
1276
|
+
type: this.operationMap.canDelete.icon,
|
|
1277
|
+
size: iconSize
|
|
1278
|
+
},
|
|
1279
|
+
on: {
|
|
1280
|
+
click: () => {
|
|
1281
|
+
this.$dispatchEvent(this.operationMap.canDelete, row, rowIndex, column);
|
|
1282
|
+
}
|
|
1283
|
+
}
|
|
1284
|
+
})
|
|
1285
|
+
])
|
|
1286
|
+
])
|
|
1281
1287
|
: h("span", "")
|
|
1282
1288
|
];
|
|
1283
1289
|
},
|
|
1290
|
+
bodyCellClass ({ row, rowIndex, column }) {
|
|
1291
|
+
return "bri-table-td" +
|
|
1292
|
+
`${this.mergeRowColKeys && this.mergeRowColKeys.includes(column._key)
|
|
1293
|
+
? " bri-table-td-merge"
|
|
1294
|
+
: ""
|
|
1295
|
+
}` +
|
|
1296
|
+
`${this.getRowCanEdit(row, rowIndex)
|
|
1297
|
+
? " bri-table-td-edit"
|
|
1298
|
+
: ""
|
|
1299
|
+
}` +
|
|
1300
|
+
`${this.isSearching
|
|
1301
|
+
? row.__isSearchShow__ === false
|
|
1302
|
+
? " bri-table-td-hide"
|
|
1303
|
+
: ""
|
|
1304
|
+
: row.__isShow__ === true
|
|
1305
|
+
? this.isExpandAction
|
|
1306
|
+
? " bri-table-td-visible"
|
|
1307
|
+
: ""
|
|
1308
|
+
: " bri-table-td-hide"
|
|
1309
|
+
}` +
|
|
1310
|
+
`${["__isExpand__"].includes(column._key)
|
|
1311
|
+
? " bri-table-td-expand"
|
|
1312
|
+
: ["__index__"].includes(column._key)
|
|
1313
|
+
? " bri-table-td-index"
|
|
1314
|
+
: ""
|
|
1315
|
+
}`;
|
|
1316
|
+
},
|
|
1284
1317
|
|
|
1285
1318
|
/* ----------- 方法 ---------- */
|
|
1286
1319
|
// 生成新的一行数据
|
|
@@ -1323,12 +1356,12 @@ export default {
|
|
|
1323
1356
|
},
|
|
1324
1357
|
// 整行校验结果
|
|
1325
1358
|
getRowRuleResult (row, rowIndex) {
|
|
1326
|
-
return this.filterColumns.every(colItem => this.getColRuleResult(
|
|
1359
|
+
return this.filterColumns.every(colItem => this.getColRuleResult(row, rowIndex, colItem).bool);
|
|
1327
1360
|
},
|
|
1328
1361
|
getRowFormList (row, rowIndex) {
|
|
1329
1362
|
return this.selfColumns.map(colItem => {
|
|
1330
1363
|
colItem = this.$transformDynamicProperty(colItem, row, this.parentObj);
|
|
1331
|
-
const unitCanEdit = this.getColCanEdit(
|
|
1364
|
+
const unitCanEdit = this.getColCanEdit(row, rowIndex, colItem);
|
|
1332
1365
|
|
|
1333
1366
|
return {
|
|
1334
1367
|
...colItem,
|
|
@@ -1341,7 +1374,7 @@ export default {
|
|
|
1341
1374
|
return this.isDftSet ? false : row.__isDefault__;
|
|
1342
1375
|
},
|
|
1343
1376
|
// 行按钮是否可操作(删除按钮可编辑 不代表行内容是可编辑的)
|
|
1344
|
-
|
|
1377
|
+
getRowDelBtnCanEdit (row, rowIndex) {
|
|
1345
1378
|
return this.canEdit && // 是编辑状态
|
|
1346
1379
|
(this.disabledDeleteDftRow ? row.__isDefault__ !== true : true) && // 默认数据可删除
|
|
1347
1380
|
(this.disabledDeleteOldRow ? row.__old__ !== true : true) && // 老数据可删除
|
|
@@ -1356,7 +1389,7 @@ export default {
|
|
|
1356
1389
|
},
|
|
1357
1390
|
|
|
1358
1391
|
// 单元格校验结果
|
|
1359
|
-
getColRuleResult (
|
|
1392
|
+
getColRuleResult (row, rowIndex, col) {
|
|
1360
1393
|
col = this.$transformDynamicProperty(col, row, this.parentObj);
|
|
1361
1394
|
|
|
1362
1395
|
// 未触发校验时 不显示错误
|
|
@@ -1377,7 +1410,7 @@ export default {
|
|
|
1377
1410
|
}
|
|
1378
1411
|
},
|
|
1379
1412
|
// 单元格是否显示对比
|
|
1380
|
-
isShowCompare (
|
|
1413
|
+
isShowCompare (row, rowIndex, col) {
|
|
1381
1414
|
const oldRow = this.compareListData[rowIndex] || {};
|
|
1382
1415
|
const curVal = row[col._key];
|
|
1383
1416
|
const oldVal = oldRow[col._key];
|
|
@@ -1388,24 +1421,16 @@ export default {
|
|
|
1388
1421
|
curVal !== oldVal;
|
|
1389
1422
|
},
|
|
1390
1423
|
// 加工单元格对应的配置
|
|
1391
|
-
getResetCol (
|
|
1392
|
-
let resetMap = {
|
|
1393
|
-
select: {
|
|
1394
|
-
_optionKind: "dropdown"
|
|
1395
|
-
},
|
|
1396
|
-
checkbox: {
|
|
1397
|
-
_optionKind: "dropdown"
|
|
1398
|
-
}
|
|
1399
|
-
};
|
|
1424
|
+
getResetCol (row, rowIndex, col) {
|
|
1400
1425
|
return {
|
|
1401
|
-
...col,
|
|
1402
|
-
...(resetMap[col._type] || {}),
|
|
1403
1426
|
// isShare: this.isShare,
|
|
1427
|
+
...col,
|
|
1428
|
+
_optionKind: "dropdown",
|
|
1404
1429
|
_heightAuto: this.heightAuto
|
|
1405
1430
|
};
|
|
1406
1431
|
},
|
|
1407
1432
|
// 列本身是否可编辑
|
|
1408
|
-
getColCanEdit (
|
|
1433
|
+
getColCanEdit (row, rowIndex, col) {
|
|
1409
1434
|
return (
|
|
1410
1435
|
["treeTable"].includes(this.inTableType) && ["number", "date"].includes(col._type)
|
|
1411
1436
|
? col._summaryType
|
|
@@ -1426,12 +1451,13 @@ export default {
|
|
|
1426
1451
|
(row.__isQuote__ ? !this.quoteReadonlyColKeys.includes(col._key) : true) && // 引用过来的数据是否可编辑
|
|
1427
1452
|
!["calculate"].includes(col._enterType) && // 计算的不可编辑
|
|
1428
1453
|
col._readonly !== true && // 只读
|
|
1429
|
-
col.canEdit !== false
|
|
1454
|
+
col.canEdit !== false && // 字段本身编辑权限 考虑为undefined时候
|
|
1455
|
+
(!this.getTypeColCanEdit || this.getTypeColCanEdit(row, rowIndex, col));
|
|
1430
1456
|
},
|
|
1431
1457
|
// 单元格最终编辑状态
|
|
1432
|
-
getUnitCanEdit (
|
|
1458
|
+
getUnitCanEdit (row, rowIndex, col) {
|
|
1433
1459
|
return this.getRowCanEdit(row, rowIndex) &&
|
|
1434
|
-
this.getColCanEdit(
|
|
1460
|
+
this.getColCanEdit(row, rowIndex, col) &&
|
|
1435
1461
|
this.$isAdvRelyShow(col, row, this.parentObj, true);
|
|
1436
1462
|
},
|
|
1437
1463
|
|