bri-components 1.3.91 → 1.3.93
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 +2 -2
- package/src/components/list/DshCascaderTable.vue +0 -50
- package/src/components/list/DshFlatTable.vue +5 -5
- package/src/components/list/DshTreeTable.vue +2 -2
- package/src/components/list/mixins/DshCascaderTableMixin.js +377 -402
- package/src/components/list/mixins/DshFlatTableMixin.js +13 -53
- package/src/components/list/mixins/DshTreeTableMixin.js +40 -193
- package/src/components/list/mixins/tableBaseMixin.js +326 -137
- package/src/styles/components/list/BriTable.less +44 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import DshListUnit from "../../unit/DshListUnit.vue";
|
|
2
2
|
import importModal from "../common/importModal.vue";
|
|
3
3
|
import quoteListModal from "../common/quoteListModal.vue";
|
|
4
|
+
import { mapGetters } from "vuex";
|
|
4
5
|
|
|
5
6
|
export default {
|
|
6
7
|
mixins: [],
|
|
@@ -63,12 +64,14 @@ export default {
|
|
|
63
64
|
widthMap: this.$getModFieldPropertyMap("width"),
|
|
64
65
|
initDftValMap: this.$getModFieldPropertyMap("initDefaultVal"),
|
|
65
66
|
|
|
67
|
+
saveProperties: ["__readonly__", "__isDefault__", "__old__", "__isQuote__"],
|
|
68
|
+
resetProperties: ["__treeIndex__", "__isExpand__", "__isRendered__", "__isShow__", "__isTmpShow__", "__isSearchShow__"],
|
|
66
69
|
initFlag: true,
|
|
67
70
|
showRuleMessage: false, // 进行全体校验
|
|
68
71
|
ruleRecordMap: {}, // 单元格是否发生校验的记录映射
|
|
69
72
|
hoverRecordMap: {},
|
|
73
|
+
isExpandAction: false,
|
|
70
74
|
|
|
71
|
-
hideStatus: true,
|
|
72
75
|
dftAdvSearch: {
|
|
73
76
|
logic: "and",
|
|
74
77
|
conditions: []
|
|
@@ -85,6 +88,7 @@ export default {
|
|
|
85
88
|
},
|
|
86
89
|
|
|
87
90
|
dshRenderName: undefined,
|
|
91
|
+
hideStatus: true,
|
|
88
92
|
showQuoteModal: false,
|
|
89
93
|
showImportModal: false,
|
|
90
94
|
exportTimer: null,
|
|
@@ -138,7 +142,7 @@ export default {
|
|
|
138
142
|
name: "添加一行",
|
|
139
143
|
type: "canCreate",
|
|
140
144
|
btnType: "default",
|
|
141
|
-
icon: "md-add
|
|
145
|
+
icon: "md-add",
|
|
142
146
|
size: "default",
|
|
143
147
|
color: "#3DB8C5",
|
|
144
148
|
long: true,
|
|
@@ -149,6 +153,7 @@ export default {
|
|
|
149
153
|
name: "添加一行下级",
|
|
150
154
|
type: "canCreateChild",
|
|
151
155
|
btnType: "default",
|
|
156
|
+
icon: "md-add-circle",
|
|
152
157
|
size: "default",
|
|
153
158
|
color: "#3DB8C5",
|
|
154
159
|
disabled: false,
|
|
@@ -173,6 +178,12 @@ export default {
|
|
|
173
178
|
};
|
|
174
179
|
},
|
|
175
180
|
computed: {
|
|
181
|
+
...mapGetters(["appObj"]),
|
|
182
|
+
appColor () {
|
|
183
|
+
const themeColorMap = this.$appData.themeColors || {};
|
|
184
|
+
return (themeColorMap[this.appObj.colorType] || { color: "#3DB8C5" }).color;
|
|
185
|
+
},
|
|
186
|
+
|
|
176
187
|
dshRender () {
|
|
177
188
|
return this[this.dshRenderName];
|
|
178
189
|
},
|
|
@@ -201,7 +212,6 @@ export default {
|
|
|
201
212
|
return this.columns.filter(column => column._mergeRow === true);
|
|
202
213
|
},
|
|
203
214
|
filterColumns () {
|
|
204
|
-
// console.log("filterColumns");
|
|
205
215
|
return this.selfColumns.filter(col => this.$isAdvRelyShow(col, this.allListData, this.parentObj, true));
|
|
206
216
|
},
|
|
207
217
|
|
|
@@ -262,7 +272,7 @@ export default {
|
|
|
262
272
|
return this.selfPropsObj._showMode;
|
|
263
273
|
},
|
|
264
274
|
inTableType () {
|
|
265
|
-
return this.controlType
|
|
275
|
+
return ["cascaderTable"].includes(this.controlType) && !["old"].includes(this.subType)
|
|
266
276
|
? "treeTable"
|
|
267
277
|
: this.controlType;
|
|
268
278
|
},
|
|
@@ -366,29 +376,48 @@ export default {
|
|
|
366
376
|
return `当前${this.isSearching ? "筛选" : "全部"}数据, 共 ${this.rowsNum} ${this.showMode === "form" ? "条" : "行"}`;
|
|
367
377
|
},
|
|
368
378
|
|
|
379
|
+
/* 数据 */
|
|
380
|
+
defaultListData () {
|
|
381
|
+
const loop = (tree = [], list = []) => {
|
|
382
|
+
return tree.reduce((newList, rowItem) => {
|
|
383
|
+
newList = [...newList, rowItem];
|
|
384
|
+
|
|
385
|
+
return rowItem.children && rowItem.children.length
|
|
386
|
+
? loop(rowItem.children, newList)
|
|
387
|
+
: newList;
|
|
388
|
+
}, list);
|
|
389
|
+
};
|
|
390
|
+
|
|
391
|
+
return ["cascaderTable"].includes(this.controlType)
|
|
392
|
+
? loop(this.selfPropsObj._default.tree)
|
|
393
|
+
: this.selfPropsObj._default.list;
|
|
394
|
+
},
|
|
395
|
+
defaultListDataIds () {
|
|
396
|
+
return this.defaultListData
|
|
397
|
+
.map(rowItem => rowItem._id)
|
|
398
|
+
.filter(id => !!id);
|
|
399
|
+
},
|
|
369
400
|
renderedListData () {
|
|
370
|
-
|
|
371
|
-
return this.allListData.filter(row => {
|
|
401
|
+
return this.allListData.filter(rowItem => {
|
|
372
402
|
if (this.isSearching) {
|
|
373
|
-
const bool = this.$isAdvRelyAccord(this.finalTableAdvSearch,
|
|
403
|
+
const bool = this.$isAdvRelyAccord(this.finalTableAdvSearch, rowItem);
|
|
374
404
|
|
|
375
405
|
// 重置
|
|
376
|
-
|
|
406
|
+
rowItem.__isSearchShow__ = false;
|
|
377
407
|
if (bool) {
|
|
378
|
-
|
|
379
|
-
|
|
408
|
+
rowItem.__isRendered__ = true;
|
|
409
|
+
rowItem.__isSearchShow__ = true;
|
|
380
410
|
}
|
|
381
411
|
}
|
|
382
412
|
|
|
383
|
-
return
|
|
413
|
+
return rowItem.__isRendered__;
|
|
384
414
|
});
|
|
385
415
|
},
|
|
386
416
|
showListData () {
|
|
387
|
-
|
|
388
|
-
return this.renderedListData.filter(row =>
|
|
417
|
+
return this.renderedListData.filter(rowItem =>
|
|
389
418
|
this.isSearching
|
|
390
|
-
? !!
|
|
391
|
-
: !!
|
|
419
|
+
? !!rowItem.__isSearchShow__
|
|
420
|
+
: !!rowItem.__isShow__
|
|
392
421
|
);
|
|
393
422
|
},
|
|
394
423
|
parentDataId () {
|
|
@@ -401,7 +430,7 @@ export default {
|
|
|
401
430
|
const initDftVal = this.initDftValMap[column._type];
|
|
402
431
|
|
|
403
432
|
return Object.assign(obj, {
|
|
404
|
-
[column._key]:
|
|
433
|
+
[column._key]: dftInRowVal === undefined
|
|
405
434
|
? this.$isEmptyData(dftVal)
|
|
406
435
|
? initDftVal
|
|
407
436
|
: dftVal
|
|
@@ -431,23 +460,10 @@ export default {
|
|
|
431
460
|
columnHiddenOption: {
|
|
432
461
|
defaultHiddenColumnKeys: [...this.hideColKeys] // 必须这么写,不解构,切换一次隐藏/显示后,hideColKeys会变成空数组
|
|
433
462
|
},
|
|
434
|
-
cellStyleOption:
|
|
435
|
-
bodyCellClass: ({ column, row, rowIndex }) => {
|
|
436
|
-
return "bri-table-td" +
|
|
437
|
-
`${this.getRowCanEdit(row)
|
|
438
|
-
? " bri-table-td-edit"
|
|
439
|
-
: ""
|
|
440
|
-
}` +
|
|
441
|
-
`${this.isSearching
|
|
442
|
-
? row.__isSearchShow__ === false
|
|
443
|
-
? " bri-table-td-hide"
|
|
444
|
-
: ""
|
|
445
|
-
: ""
|
|
446
|
-
}`;
|
|
447
|
-
}
|
|
448
|
-
},
|
|
463
|
+
cellStyleOption: this.cellStyleOption,
|
|
449
464
|
cellSpanOption: {
|
|
450
465
|
bodyCellSpan: ({ row, rowIndex, column }) => {
|
|
466
|
+
// 合并单元格(单元格值为空时不合并)
|
|
451
467
|
if (column._mergeRow === true) {
|
|
452
468
|
if (this.$isEmptyData(row[column._key])) {
|
|
453
469
|
return {
|
|
@@ -498,8 +514,38 @@ export default {
|
|
|
498
514
|
}
|
|
499
515
|
};
|
|
500
516
|
},
|
|
517
|
+
cellStyleOption () {
|
|
518
|
+
return {
|
|
519
|
+
bodyCellClass: ({ row, rowIndex, column }) => {
|
|
520
|
+
return "bri-table-td" +
|
|
521
|
+
`${column._mergeRow
|
|
522
|
+
? " bri-table-td-merge"
|
|
523
|
+
: ""
|
|
524
|
+
}` +
|
|
525
|
+
`${this.getRowCanEdit(row, rowIndex)
|
|
526
|
+
? " bri-table-td-edit"
|
|
527
|
+
: ""
|
|
528
|
+
}` +
|
|
529
|
+
`${this.isSearching
|
|
530
|
+
? row.__isSearchShow__ === false
|
|
531
|
+
? " bri-table-td-hide"
|
|
532
|
+
: ""
|
|
533
|
+
: row.__isShow__ === true
|
|
534
|
+
? this.isExpandAction
|
|
535
|
+
? " bri-table-td-visible"
|
|
536
|
+
: ""
|
|
537
|
+
: " bri-table-td-hide"
|
|
538
|
+
}` +
|
|
539
|
+
`${["__isExpand__"].includes(column._key)
|
|
540
|
+
? " bri-table-td-expand"
|
|
541
|
+
: ["__index__"].includes(column._key)
|
|
542
|
+
? " bri-table-td-index"
|
|
543
|
+
: ""
|
|
544
|
+
}`;
|
|
545
|
+
}
|
|
546
|
+
};
|
|
547
|
+
},
|
|
501
548
|
contentColumns () {
|
|
502
|
-
// console.log("contentColumns");
|
|
503
549
|
return this.filterColumns.map(colItem => ({
|
|
504
550
|
filter: undefined,
|
|
505
551
|
sortBy: undefined,
|
|
@@ -512,14 +558,14 @@ export default {
|
|
|
512
558
|
headHeightAuto: this.headHeightAuto
|
|
513
559
|
});
|
|
514
560
|
},
|
|
515
|
-
renderBodyCell: ({
|
|
561
|
+
renderBodyCell: ({ row, rowIndex, column }, h) => {
|
|
516
562
|
column = this.$transformDynamicProperty(column, row, this.parentObj);
|
|
517
|
-
column = this.
|
|
518
|
-
const unitCanEdit = this.getUnitCanEdit(column, row);
|
|
563
|
+
column = this.getResetCol(column, row, rowIndex);
|
|
564
|
+
const unitCanEdit = this.getUnitCanEdit(column, row, rowIndex);
|
|
519
565
|
const ruleResultObj = this.getColRuleResult(column, row, rowIndex);
|
|
520
566
|
|
|
521
567
|
return [
|
|
522
|
-
this.isShowCompare(column, row,
|
|
568
|
+
this.isShowCompare(column, row, rowIndex)
|
|
523
569
|
? h("Tooltip", {
|
|
524
570
|
style: {
|
|
525
571
|
width: "100%"
|
|
@@ -577,45 +623,8 @@ export default {
|
|
|
577
623
|
}, ruleResultObj.message)
|
|
578
624
|
: undefined,
|
|
579
625
|
|
|
580
|
-
//
|
|
581
|
-
|
|
582
|
-
!this.isSearching &&
|
|
583
|
-
this.showCreateBtnColKeys.includes(column._key) &&
|
|
584
|
-
this.hoverRecordMap[`${row._id}dsh${column._key}`]
|
|
585
|
-
? h("div", {
|
|
586
|
-
style: {
|
|
587
|
-
position: "absolute",
|
|
588
|
-
bottom: "0px",
|
|
589
|
-
right: "0px",
|
|
590
|
-
display: "inline-block",
|
|
591
|
-
width: "16px",
|
|
592
|
-
height: " 16px",
|
|
593
|
-
// border: "1px solid #3DB8C5",
|
|
594
|
-
// backgroundColor: "#ffffff",
|
|
595
|
-
lineHeight: "12px",
|
|
596
|
-
cursor: "pointer",
|
|
597
|
-
verticalAlign: "middle",
|
|
598
|
-
transition: "color .2s ease-in-out,border-color .2s ease-in-out"
|
|
599
|
-
}
|
|
600
|
-
}, [
|
|
601
|
-
h("Icon", {
|
|
602
|
-
style: {
|
|
603
|
-
fontWeight: "500",
|
|
604
|
-
color: "#3DB8C5"
|
|
605
|
-
},
|
|
606
|
-
props: {
|
|
607
|
-
type: "md-add-circle", // "ios-add"
|
|
608
|
-
size: "16"
|
|
609
|
-
// size: "14"
|
|
610
|
-
},
|
|
611
|
-
on: {
|
|
612
|
-
click: () => {
|
|
613
|
-
this.$dispatchEvent(this.operationMap.canCreate, row, rowIndex, column);
|
|
614
|
-
}
|
|
615
|
-
}
|
|
616
|
-
})
|
|
617
|
-
])
|
|
618
|
-
: h("span", "")
|
|
626
|
+
// 添加符
|
|
627
|
+
...this.createIconRender(h, { row, rowIndex, column })
|
|
619
628
|
];
|
|
620
629
|
},
|
|
621
630
|
...colItem
|
|
@@ -641,15 +650,15 @@ export default {
|
|
|
641
650
|
align: "center",
|
|
642
651
|
fixed: "right",
|
|
643
652
|
width: 100,
|
|
644
|
-
renderBodyCell: ({
|
|
653
|
+
renderBodyCell: ({ row, rowIndex, column }, h) => {
|
|
645
654
|
const operationList = this.$getOperationList(["canDelete"]);
|
|
646
655
|
|
|
647
656
|
return h("dsh-buttons", {
|
|
648
657
|
props: {
|
|
649
658
|
list: operationList.map(btnItem => ({
|
|
650
659
|
...btnItem,
|
|
651
|
-
disabled: !this.getRowBtnCanEdit(row) ||
|
|
652
|
-
(this.disabledDeleteDftRow ? this.
|
|
660
|
+
disabled: !this.getRowBtnCanEdit(row, rowIndex) ||
|
|
661
|
+
(this.disabledDeleteDftRow ? this.getRowIsDftDisabled(row, rowIndex) : false)
|
|
653
662
|
}))
|
|
654
663
|
},
|
|
655
664
|
on: {
|
|
@@ -800,6 +809,7 @@ export default {
|
|
|
800
809
|
this.initFlag = true;
|
|
801
810
|
this.showRuleMessage = false;
|
|
802
811
|
this.ruleRecordMap = {};
|
|
812
|
+
this.isExpandAction = false;
|
|
803
813
|
this.selfReset && this.selfReset();
|
|
804
814
|
},
|
|
805
815
|
// 共外部使用
|
|
@@ -826,9 +836,6 @@ export default {
|
|
|
826
836
|
this.$set(this.ruleRecordMap, `${row._id}dsh${col._key}`, { showRuleMessage: true });
|
|
827
837
|
this.change("changeVal", col, row, rowIndex, ...params);
|
|
828
838
|
},
|
|
829
|
-
change (...params) {
|
|
830
|
-
this.$emit("change", { list: this.allListData, rowDefault: this.rowDefault }, ...params);
|
|
831
|
-
},
|
|
832
839
|
|
|
833
840
|
/* ----------- 隐藏/显示字段 ---------- */
|
|
834
841
|
toggleHideOrShow () {
|
|
@@ -843,12 +850,6 @@ export default {
|
|
|
843
850
|
}
|
|
844
851
|
},
|
|
845
852
|
|
|
846
|
-
/* ----------- 全屏 ---------- */
|
|
847
|
-
// 打开全屏模态框
|
|
848
|
-
clickEnlarge (operationItem) {
|
|
849
|
-
this.isEnlarge = true;
|
|
850
|
-
},
|
|
851
|
-
|
|
852
853
|
/* ----------- 引用 ---------- */
|
|
853
854
|
// 点击引用
|
|
854
855
|
clickQuote () {
|
|
@@ -891,7 +892,8 @@ export default {
|
|
|
891
892
|
content: "该数据下此内容为空,无法引用!",
|
|
892
893
|
onOk: () => { }
|
|
893
894
|
});
|
|
894
|
-
}
|
|
895
|
+
}
|
|
896
|
+
else {
|
|
895
897
|
if (["flatTable"].includes(this.controlType)) {
|
|
896
898
|
this.parentObj[this.controlKey] = {
|
|
897
899
|
...fieldVal,
|
|
@@ -901,7 +903,8 @@ export default {
|
|
|
901
903
|
__old__: false
|
|
902
904
|
}))
|
|
903
905
|
};
|
|
904
|
-
}
|
|
906
|
+
}
|
|
907
|
+
else if (["cascaderTable"].includes(this.controlType)) {
|
|
905
908
|
const transformData = (list = []) => {
|
|
906
909
|
const loop = (list = []) =>
|
|
907
910
|
list.map(item => ({
|
|
@@ -971,7 +974,7 @@ export default {
|
|
|
971
974
|
this.$https({
|
|
972
975
|
url: {
|
|
973
976
|
module: "sheet",
|
|
974
|
-
name: ["
|
|
977
|
+
name: ["cascaderTable"].includes(this.controlType) ? "exportCascaderTableExcel" : "exportFlatTableExcel"
|
|
975
978
|
},
|
|
976
979
|
params: this.exportParams,
|
|
977
980
|
callback: data => {
|
|
@@ -1011,6 +1014,12 @@ export default {
|
|
|
1011
1014
|
});
|
|
1012
1015
|
},
|
|
1013
1016
|
|
|
1017
|
+
/* ----------- 全屏 ---------- */
|
|
1018
|
+
// 打开全屏模态框
|
|
1019
|
+
clickEnlarge (operationItem) {
|
|
1020
|
+
this.isEnlarge = true;
|
|
1021
|
+
},
|
|
1022
|
+
|
|
1014
1023
|
/* ----------- 渲染函数 ---------- */
|
|
1015
1024
|
getTableTopRender (isEnlarge = false) {
|
|
1016
1025
|
return (h, params) => {
|
|
@@ -1103,7 +1112,7 @@ export default {
|
|
|
1103
1112
|
}
|
|
1104
1113
|
});
|
|
1105
1114
|
},
|
|
1106
|
-
|
|
1115
|
+
createBtnRender (h, params) {
|
|
1107
1116
|
return !this.isSearching && this.disabledFootCreateBtn !== true
|
|
1108
1117
|
? h("dsh-buttons", {
|
|
1109
1118
|
style: {
|
|
@@ -1121,37 +1130,136 @@ export default {
|
|
|
1121
1130
|
})
|
|
1122
1131
|
: undefined;
|
|
1123
1132
|
},
|
|
1133
|
+
createIconRender (h, { row, rowIndex, column }) {
|
|
1134
|
+
return [
|
|
1135
|
+
// 插入一行添加符
|
|
1136
|
+
(this.operationMap.canCreate && this.operationMap.canCreate.disabled !== true) &&
|
|
1137
|
+
!this.isSearching &&
|
|
1138
|
+
(column._key === "__index__" ? !this.showCreateBtnColKeys.length : this.showCreateBtnColKeys.includes(column._key)) &&
|
|
1139
|
+
this.hoverRecordMap[`${row._id}dsh${column._key}`]
|
|
1140
|
+
? h("div", {
|
|
1141
|
+
style: {
|
|
1142
|
+
position: "absolute",
|
|
1143
|
+
bottom: "0px",
|
|
1144
|
+
right: "0px",
|
|
1145
|
+
width: "16px",
|
|
1146
|
+
height: "16px",
|
|
1147
|
+
border: `1px solid ${this.appColor}`,
|
|
1148
|
+
backgroundColor: "#ffffff",
|
|
1149
|
+
lineHeight: "12px",
|
|
1150
|
+
cursor: "pointer",
|
|
1151
|
+
verticalAlign: "middle",
|
|
1152
|
+
transition: "color .2s ease-in-out,border-color .2s ease-in-out"
|
|
1153
|
+
}
|
|
1154
|
+
}, [
|
|
1155
|
+
h("Tooltip", {
|
|
1156
|
+
props: {
|
|
1157
|
+
content: "插入一行",
|
|
1158
|
+
maxWidth: "250",
|
|
1159
|
+
transfer: true
|
|
1160
|
+
}
|
|
1161
|
+
}, [
|
|
1162
|
+
h("Icon", {
|
|
1163
|
+
style: {
|
|
1164
|
+
fontWeight: "500",
|
|
1165
|
+
color: this.appColor
|
|
1166
|
+
},
|
|
1167
|
+
props: {
|
|
1168
|
+
type: this.operationMap.canCreate.icon,
|
|
1169
|
+
size: "14"
|
|
1170
|
+
},
|
|
1171
|
+
on: {
|
|
1172
|
+
click: () => {
|
|
1173
|
+
this.$dispatchEvent(this.operationMap.canCreate, row, rowIndex, column);
|
|
1174
|
+
}
|
|
1175
|
+
}
|
|
1176
|
+
})
|
|
1177
|
+
])
|
|
1178
|
+
])
|
|
1179
|
+
: h("span", ""),
|
|
1124
1180
|
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1181
|
+
// 添加一行下级添加符
|
|
1182
|
+
["cascaderTable"].includes(this.controlType) &&
|
|
1183
|
+
(this.operationMap.canCreateChild && this.operationMap.canCreateChild.disabled !== true) &&
|
|
1184
|
+
!this.isSearching &&
|
|
1185
|
+
(column._key === "__index__" ? !this.showCreateBtnColKeys.length : this.showCreateBtnColKeys.includes(column._key)) &&
|
|
1186
|
+
this.hoverRecordMap[`${row._id}dsh${column._key}`] &&
|
|
1187
|
+
row.level < this.maxLevel
|
|
1188
|
+
? h("div", {
|
|
1189
|
+
style: {
|
|
1190
|
+
position: "absolute",
|
|
1191
|
+
bottom: "0px",
|
|
1192
|
+
right: "17px",
|
|
1193
|
+
display: "inline-block",
|
|
1194
|
+
width: "16px",
|
|
1195
|
+
height: " 16px",
|
|
1196
|
+
border: `1px solid ${this.appColor}`,
|
|
1197
|
+
backgroundColor: "#ffffff",
|
|
1198
|
+
lineHeight: "12px",
|
|
1199
|
+
cursor: "pointer",
|
|
1200
|
+
verticalAlign: "middle",
|
|
1201
|
+
transition: "color .2s ease-in-out,border-color .2s ease-in-out"
|
|
1202
|
+
}
|
|
1203
|
+
}, [
|
|
1204
|
+
h("Tooltip", {
|
|
1205
|
+
props: {
|
|
1206
|
+
content: "添加下级",
|
|
1207
|
+
maxWidth: "250",
|
|
1208
|
+
transfer: true
|
|
1209
|
+
}
|
|
1210
|
+
}, [
|
|
1211
|
+
h("Icon", {
|
|
1212
|
+
style: {
|
|
1213
|
+
fontWeight: "600",
|
|
1214
|
+
color: this.appColor
|
|
1215
|
+
},
|
|
1216
|
+
props: {
|
|
1217
|
+
type: this.operationMap.canCreateChild.icon,
|
|
1218
|
+
size: "14"
|
|
1219
|
+
},
|
|
1220
|
+
on: {
|
|
1221
|
+
click: () => {
|
|
1222
|
+
this.$dispatchEvent(this.operationMap.canCreateChild, row, rowIndex);
|
|
1223
|
+
}
|
|
1224
|
+
}
|
|
1225
|
+
})
|
|
1226
|
+
])
|
|
1227
|
+
])
|
|
1228
|
+
: h("span", "")
|
|
1229
|
+
];
|
|
1141
1230
|
},
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1231
|
+
|
|
1232
|
+
/* ----------- 方法 ---------- */
|
|
1233
|
+
// 整行校验结果
|
|
1234
|
+
getRowRuleResult (row, rowIndex) {
|
|
1235
|
+
return this.filterColumns.every(column => this.getColRuleResult(column, row, rowIndex).bool);
|
|
1236
|
+
},
|
|
1237
|
+
getRowFormList (row, rowIndex) {
|
|
1238
|
+
return this.selfColumns.map(column => {
|
|
1239
|
+
column = this.$transformDynamicProperty(column, row, this.parentObj);
|
|
1240
|
+
const unitCanEdit = this.getColCanEdit(column, row, rowIndex);
|
|
1241
|
+
|
|
1242
|
+
return {
|
|
1243
|
+
...column,
|
|
1244
|
+
canEdit: unitCanEdit
|
|
1245
|
+
};
|
|
1246
|
+
});
|
|
1146
1247
|
},
|
|
1147
1248
|
// 是否禁止操作 在关于默认行方面
|
|
1148
|
-
|
|
1249
|
+
getRowIsDftDisabled (row, rowIndex) {
|
|
1149
1250
|
return this.controlKey === "_default" ? false : row.__isDefault__;
|
|
1150
1251
|
},
|
|
1151
|
-
//
|
|
1152
|
-
|
|
1153
|
-
return this.
|
|
1252
|
+
// 行按钮是否可编辑(删除按钮可编辑 不代表行内容是可编辑的)
|
|
1253
|
+
getRowBtnCanEdit (row, rowIndex) {
|
|
1254
|
+
return this.canEdit && // 是编辑状态
|
|
1255
|
+
(this.disabledOldDataRow ? row.__old__ !== true : true) && // 老数据行不置灰/置灰时是新增数据
|
|
1256
|
+
row.__readonly__ !== true; // 不能为只读数据
|
|
1257
|
+
},
|
|
1258
|
+
// 行内容是否可编辑
|
|
1259
|
+
getRowCanEdit (row, rowIndex) {
|
|
1260
|
+
return this.getRowBtnCanEdit(row, rowIndex);
|
|
1154
1261
|
},
|
|
1262
|
+
|
|
1155
1263
|
// 单元格校验结果
|
|
1156
1264
|
getColRuleResult (col, row, rowIndex) {
|
|
1157
1265
|
col = this.$transformDynamicProperty(col, row, this.parentObj);
|
|
@@ -1173,18 +1281,36 @@ export default {
|
|
|
1173
1281
|
};
|
|
1174
1282
|
}
|
|
1175
1283
|
},
|
|
1176
|
-
//
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1284
|
+
// 单元格是否显示对比
|
|
1285
|
+
isShowCompare (col, row, rowIndex) {
|
|
1286
|
+
const oldRow = this.compareListData[rowIndex] || {};
|
|
1287
|
+
const curVal = row[col._key];
|
|
1288
|
+
const oldVal = oldRow[col._key];
|
|
1289
|
+
|
|
1290
|
+
return this.useCampare &&
|
|
1291
|
+
["number"].includes(col._type) &&
|
|
1292
|
+
!(this.$isEmptyData(curVal) && this.$isEmptyData(oldVal)) &&
|
|
1293
|
+
curVal !== oldVal;
|
|
1181
1294
|
},
|
|
1182
|
-
//
|
|
1183
|
-
|
|
1184
|
-
|
|
1295
|
+
// 加工单元格对应的配置
|
|
1296
|
+
getResetCol (col, row, rowIndex) {
|
|
1297
|
+
let resetMap = {
|
|
1298
|
+
select: {
|
|
1299
|
+
_optionKind: "dropdown"
|
|
1300
|
+
},
|
|
1301
|
+
checkbox: {
|
|
1302
|
+
_optionKind: "dropdown"
|
|
1303
|
+
}
|
|
1304
|
+
};
|
|
1305
|
+
return {
|
|
1306
|
+
...col,
|
|
1307
|
+
...(resetMap[col._type] || {}),
|
|
1308
|
+
// isShare: this.isShare,
|
|
1309
|
+
_heightAuto: this.heightAuto
|
|
1310
|
+
};
|
|
1185
1311
|
},
|
|
1186
1312
|
// 列本身是否可编辑
|
|
1187
|
-
getColCanEdit (col, row) {
|
|
1313
|
+
getColCanEdit (col, row, rowIndex) {
|
|
1188
1314
|
return (
|
|
1189
1315
|
["treeTable"].includes(this.inTableType) && ["number", "date"].includes(col._type)
|
|
1190
1316
|
? col._summaryType
|
|
@@ -1194,7 +1320,7 @@ export default {
|
|
|
1194
1320
|
? true
|
|
1195
1321
|
: ["downToUp"].includes(col._writeSort)
|
|
1196
1322
|
? !(row.children && row.children.length) || row.children.every(sonRow => !this.$isEmptyData(sonRow[col._key]))
|
|
1197
|
-
: row.level === 1 || !this.$isEmptyData(this.
|
|
1323
|
+
: row.level === 1 || !this.$isEmptyData(this.getParentRow(row, this.data)[col._key])
|
|
1198
1324
|
: true
|
|
1199
1325
|
: true
|
|
1200
1326
|
) &&
|
|
@@ -1202,26 +1328,89 @@ export default {
|
|
|
1202
1328
|
(col._oldReadonly ? row.__old__ !== true : true) && // 老数据行里某些列不可编辑
|
|
1203
1329
|
(row.__isQuote__ ? !this.quoteDisabledColKeys.includes(col._key) : true) && // 引用过来的数据是否可编辑
|
|
1204
1330
|
!["calculate"].includes(col._enterType) && // 计算的不可编辑
|
|
1205
|
-
col._readonly !== true && //
|
|
1206
|
-
(!this.
|
|
1331
|
+
col._readonly !== true && // 只读
|
|
1332
|
+
(!this.getRowIsDftDisabled(row) || col._readonlyOnDftRow !== true) && // 默认行的某列是否可编辑
|
|
1207
1333
|
col.canEdit !== false; // 字段本身编辑权限 考虑为undefined时候
|
|
1208
1334
|
},
|
|
1209
1335
|
// 单元格最终编辑状态
|
|
1210
|
-
getUnitCanEdit (col, row) {
|
|
1211
|
-
return this.getRowCanEdit(row) &&
|
|
1212
|
-
this.getColCanEdit(col, row) &&
|
|
1336
|
+
getUnitCanEdit (col, row, rowIndex) {
|
|
1337
|
+
return this.getRowCanEdit(row, rowIndex) &&
|
|
1338
|
+
this.getColCanEdit(col, row, rowIndex) &&
|
|
1213
1339
|
this.$isAdvRelyShow(col, row, this.parentObj, true);
|
|
1214
1340
|
},
|
|
1215
|
-
getRowFormList (row) {
|
|
1216
|
-
return this.selfColumns.map(column => {
|
|
1217
|
-
column = this.$transformDynamicProperty(column, row, this.parentObj);
|
|
1218
|
-
const unitCanEdit = this.getColCanEdit(column, row);
|
|
1219
1341
|
|
|
1342
|
+
/* ----------- 工具方法 ---------- */
|
|
1343
|
+
// 获取父级行
|
|
1344
|
+
getParentRow (row, tree = []) {
|
|
1345
|
+
if (row.level === 1) {
|
|
1220
1346
|
return {
|
|
1221
|
-
|
|
1222
|
-
canEdit: unitCanEdit
|
|
1347
|
+
children: tree
|
|
1223
1348
|
};
|
|
1224
|
-
}
|
|
1349
|
+
} else {
|
|
1350
|
+
let parentRow;
|
|
1351
|
+
|
|
1352
|
+
const loop = (list = []) => {
|
|
1353
|
+
return list.some(rowItem => {
|
|
1354
|
+
if (rowItem.level === row.level - 1) {
|
|
1355
|
+
const isExist = rowItem.children.some(childRowItem => childRowItem._id === row._id);
|
|
1356
|
+
parentRow = rowItem;
|
|
1357
|
+
return isExist;
|
|
1358
|
+
} else {
|
|
1359
|
+
return loop(rowItem.children);
|
|
1360
|
+
}
|
|
1361
|
+
});
|
|
1362
|
+
};
|
|
1363
|
+
loop(tree);
|
|
1364
|
+
|
|
1365
|
+
return parentRow;
|
|
1366
|
+
}
|
|
1367
|
+
},
|
|
1368
|
+
// 初始化时 修复数据
|
|
1369
|
+
fixRowItem (row) {
|
|
1370
|
+
if (this.initFlag) {
|
|
1371
|
+
// TODO:修正数据level属性,后期可以删除
|
|
1372
|
+
if (["cascaderTable"].includes(this.controlType)) {
|
|
1373
|
+
row.level = row.level || levelNum;
|
|
1374
|
+
}
|
|
1375
|
+
|
|
1376
|
+
if (row._id) {
|
|
1377
|
+
if (this.defaultListDataIds.includes(row._id)) {
|
|
1378
|
+
row.__isDefault__ = true;
|
|
1379
|
+
|
|
1380
|
+
// 默认数据的id置换一遍,不然每条数据里该列表的id都是重复的
|
|
1381
|
+
row._id = this.$ObjectID().str;
|
|
1382
|
+
}
|
|
1383
|
+
} else {
|
|
1384
|
+
row._id = this.$ObjectID().str;
|
|
1385
|
+
}
|
|
1386
|
+
|
|
1387
|
+
row.__old__ = this.controlKey === "_default" ? false : !this.parentObj.__isCreate__; // 标记老数据
|
|
1388
|
+
row.__isDefault__ = this.controlKey === "_default" ? true : !!row.__isDefault__; // 标记默认数据(配置端默认值)
|
|
1389
|
+
|
|
1390
|
+
// 初次进来 把关于展示的状态值全部清除
|
|
1391
|
+
this.resetProperties.forEach(property => {
|
|
1392
|
+
delete row[property];
|
|
1393
|
+
});
|
|
1394
|
+
if (["treeTable"].includes(this.inTableType)) {
|
|
1395
|
+
// row.__isExpand__ = false;
|
|
1396
|
+
// row.__isSearchShow__ = false;
|
|
1397
|
+
// 第一级的需要显示出来
|
|
1398
|
+
if (row.level == 1) {
|
|
1399
|
+
row.__isRendered__ = true;
|
|
1400
|
+
row.__isShow__ = true;
|
|
1401
|
+
row.__isTmpShow__ = true;
|
|
1402
|
+
} else {
|
|
1403
|
+
// row.__isRendered__ = false;
|
|
1404
|
+
// row.__isShow__ = false;
|
|
1405
|
+
// row.__isTmpShow__ = false;
|
|
1406
|
+
}
|
|
1407
|
+
} else {
|
|
1408
|
+
row.__isRendered__ = true;
|
|
1409
|
+
row.__isShow__ = true;
|
|
1410
|
+
row.__isTmpShow__ = true;
|
|
1411
|
+
row.__isSearchShow__ = false;
|
|
1412
|
+
}
|
|
1413
|
+
}
|
|
1225
1414
|
}
|
|
1226
1415
|
}
|
|
1227
1416
|
};
|