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