bri-components 1.3.90 → 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/controls/base/BriUpload/BriUpload.vue +1 -1
- package/src/components/controls/base/BriUpload/uploadList.vue +0 -1
- package/src/components/controls/base/DshCascader/DshCascader.vue +2 -2
- package/src/components/controls/base/DshInput/DshInput.vue +1 -1
- package/src/components/controls/base/DshSelect/DshCheckbox.vue +1 -1
- package/src/components/controls/base/DshSelect/DshSelect.vue +1 -1
- package/src/components/controls/base/DshSwitch/DshSwitch.vue +1 -1
- package/src/components/controls/mixins/controlMixin.js +1 -1
- package/src/components/controls/senior/cascaderTable.vue +1 -1
- package/src/components/controls/senior/flatTable.vue +1 -1
- package/src/components/form/DshForm.vue +1 -1
- package/src/components/list/BriTable.vue +1 -1
- package/src/components/list/DshBox/DshTable.vue +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 +365 -386
- package/src/components/list/mixins/DshFlatTableMixin.js +28 -57
- package/src/components/list/mixins/DshTreeTableMixin.js +44 -181
- package/src/components/list/mixins/tableBaseMixin.js +318 -146
- package/src/components/unit/unitMixin.js +1 -1
- package/src/styles/components/list/BriTable.less +44 -0
- package/src/utils/table.js +3 -3
|
@@ -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
|
},
|
|
@@ -317,7 +325,7 @@ export default {
|
|
|
317
325
|
return this.selfPropsObj._searchLabelWidth;
|
|
318
326
|
},
|
|
319
327
|
searchList () {
|
|
320
|
-
return this.selfPropsObj._searchList
|
|
328
|
+
return this.selfPropsObj._searchList;
|
|
321
329
|
},
|
|
322
330
|
searchListMap () {
|
|
323
331
|
return this.$arrToMap(this.searchList, "_key");
|
|
@@ -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,54 +458,48 @@ 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
|
-
bodyCellSpan: ({ row,
|
|
463
|
+
bodyCellSpan: ({ row, rowIndex, column }) => {
|
|
464
|
+
// 合并单元格(单元格值为空时不合并)
|
|
451
465
|
if (column._mergeRow === true) {
|
|
452
|
-
if (
|
|
453
|
-
rowIndex !== 0 &&
|
|
454
|
-
row[column._key] === this.showListData[rowIndex - 1][column._key]
|
|
455
|
-
) {
|
|
466
|
+
if (this.$isEmptyData(row[column._key])) {
|
|
456
467
|
return {
|
|
457
|
-
rowspan:
|
|
458
|
-
colspan: 0
|
|
459
|
-
};
|
|
460
|
-
} else {
|
|
461
|
-
const newList = this.showListData.slice(rowIndex);
|
|
462
|
-
const newIndex = newList.findIndex(rowItem => row[column._key] !== rowItem[column._key]);
|
|
463
|
-
return {
|
|
464
|
-
rowspan: newIndex === -1 ? newList.length : newIndex,
|
|
468
|
+
rowspan: 1,
|
|
465
469
|
colspan: 1
|
|
466
470
|
};
|
|
471
|
+
} else {
|
|
472
|
+
if (
|
|
473
|
+
rowIndex !== 0 &&
|
|
474
|
+
row[column._key] === this.showListData[rowIndex - 1][column._key]
|
|
475
|
+
) {
|
|
476
|
+
return {
|
|
477
|
+
rowspan: 0,
|
|
478
|
+
colspan: 0
|
|
479
|
+
};
|
|
480
|
+
} else {
|
|
481
|
+
const newList = this.showListData.slice(rowIndex);
|
|
482
|
+
const newIndex = newList.findIndex(rowItem => row[column._key] !== rowItem[column._key]);
|
|
483
|
+
return {
|
|
484
|
+
rowspan: newIndex === -1 ? newList.length : newIndex,
|
|
485
|
+
colspan: 1
|
|
486
|
+
};
|
|
487
|
+
}
|
|
467
488
|
}
|
|
468
489
|
}
|
|
469
490
|
}
|
|
470
491
|
},
|
|
471
492
|
eventCustomOption: {
|
|
472
|
-
bodyCellEvents: ({ row,
|
|
493
|
+
bodyCellEvents: ({ row, rowIndex, column }) => {
|
|
473
494
|
return {
|
|
474
495
|
click: (event) => {
|
|
475
|
-
// console.log("click::", row,
|
|
496
|
+
// console.log("click::", row, rowIndex, column, event);
|
|
476
497
|
},
|
|
477
498
|
dblclick: (event) => {
|
|
478
|
-
// console.log("dblclick::", row,
|
|
499
|
+
// console.log("dblclick::", row, rowIndex, column, event);
|
|
479
500
|
},
|
|
480
501
|
contextmenu: (event) => {
|
|
481
|
-
// console.log("contextmenu::", row,
|
|
502
|
+
// console.log("contextmenu::", row, rowIndex, column, event);
|
|
482
503
|
},
|
|
483
504
|
mouseenter: (event) => {
|
|
484
505
|
this.$set(this.hoverRecordMap, `${row._id}dsh${column._key}`, true);
|
|
@@ -491,8 +512,38 @@ export default {
|
|
|
491
512
|
}
|
|
492
513
|
};
|
|
493
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
|
+
},
|
|
494
546
|
contentColumns () {
|
|
495
|
-
// console.log("contentColumns");
|
|
496
547
|
return this.filterColumns.map(colItem => ({
|
|
497
548
|
filter: undefined,
|
|
498
549
|
sortBy: undefined,
|
|
@@ -505,14 +556,14 @@ export default {
|
|
|
505
556
|
headHeightAuto: this.headHeightAuto
|
|
506
557
|
});
|
|
507
558
|
},
|
|
508
|
-
renderBodyCell: ({
|
|
559
|
+
renderBodyCell: ({ row, rowIndex, column }, h) => {
|
|
509
560
|
column = this.$transformDynamicProperty(column, row, this.parentObj);
|
|
510
|
-
column = this.
|
|
511
|
-
const unitCanEdit = this.getUnitCanEdit(column, row);
|
|
561
|
+
column = this.getResetCol(column, row, rowIndex);
|
|
562
|
+
const unitCanEdit = this.getUnitCanEdit(column, row, rowIndex);
|
|
512
563
|
const ruleResultObj = this.getColRuleResult(column, row, rowIndex);
|
|
513
564
|
|
|
514
565
|
return [
|
|
515
|
-
this.isShowCompare(column, row,
|
|
566
|
+
this.isShowCompare(column, row, rowIndex)
|
|
516
567
|
? h("Tooltip", {
|
|
517
568
|
style: {
|
|
518
569
|
width: "100%"
|
|
@@ -570,45 +621,8 @@ export default {
|
|
|
570
621
|
}, ruleResultObj.message)
|
|
571
622
|
: undefined,
|
|
572
623
|
|
|
573
|
-
//
|
|
574
|
-
|
|
575
|
-
!this.isSearching &&
|
|
576
|
-
this.showCreateBtnColKeys.includes(column._key) &&
|
|
577
|
-
this.hoverRecordMap[`${row._id}dsh${column._key}`]
|
|
578
|
-
? h("div", {
|
|
579
|
-
style: {
|
|
580
|
-
position: "absolute",
|
|
581
|
-
bottom: "0px",
|
|
582
|
-
right: "0px",
|
|
583
|
-
display: "inline-block",
|
|
584
|
-
width: "16px",
|
|
585
|
-
height: " 16px",
|
|
586
|
-
// border: "1px solid #3DB8C5",
|
|
587
|
-
// backgroundColor: "#ffffff",
|
|
588
|
-
lineHeight: "12px",
|
|
589
|
-
cursor: "pointer",
|
|
590
|
-
verticalAlign: "middle",
|
|
591
|
-
transition: "color .2s ease-in-out,border-color .2s ease-in-out"
|
|
592
|
-
}
|
|
593
|
-
}, [
|
|
594
|
-
h("Icon", {
|
|
595
|
-
style: {
|
|
596
|
-
fontWeight: "500",
|
|
597
|
-
color: "#3DB8C5"
|
|
598
|
-
},
|
|
599
|
-
props: {
|
|
600
|
-
type: "md-add-circle", // "ios-add"
|
|
601
|
-
size: "16"
|
|
602
|
-
// size: "14"
|
|
603
|
-
},
|
|
604
|
-
on: {
|
|
605
|
-
click: () => {
|
|
606
|
-
this.$dispatchEvent(this.operationMap.canCreate, row, rowIndex, column);
|
|
607
|
-
}
|
|
608
|
-
}
|
|
609
|
-
})
|
|
610
|
-
])
|
|
611
|
-
: h("span", "")
|
|
624
|
+
// 添加符
|
|
625
|
+
...this.createIconRender(h, { row, rowIndex, column })
|
|
612
626
|
];
|
|
613
627
|
},
|
|
614
628
|
...colItem
|
|
@@ -634,15 +648,15 @@ export default {
|
|
|
634
648
|
align: "center",
|
|
635
649
|
fixed: "right",
|
|
636
650
|
width: 100,
|
|
637
|
-
renderBodyCell: ({
|
|
651
|
+
renderBodyCell: ({ row, rowIndex, column }, h) => {
|
|
638
652
|
const operationList = this.$getOperationList(["canDelete"]);
|
|
639
653
|
|
|
640
654
|
return h("dsh-buttons", {
|
|
641
655
|
props: {
|
|
642
656
|
list: operationList.map(btnItem => ({
|
|
643
657
|
...btnItem,
|
|
644
|
-
disabled: !this.getRowBtnCanEdit(row) ||
|
|
645
|
-
(this.disabledDeleteDftRow ? row
|
|
658
|
+
disabled: !this.getRowBtnCanEdit(row, rowIndex) ||
|
|
659
|
+
(this.disabledDeleteDftRow ? this.getRowIsDftDisabled(row, rowIndex) : false)
|
|
646
660
|
}))
|
|
647
661
|
},
|
|
648
662
|
on: {
|
|
@@ -793,6 +807,7 @@ export default {
|
|
|
793
807
|
this.initFlag = true;
|
|
794
808
|
this.showRuleMessage = false;
|
|
795
809
|
this.ruleRecordMap = {};
|
|
810
|
+
this.isExpandAction = false;
|
|
796
811
|
this.selfReset && this.selfReset();
|
|
797
812
|
},
|
|
798
813
|
// 共外部使用
|
|
@@ -819,8 +834,8 @@ export default {
|
|
|
819
834
|
this.$set(this.ruleRecordMap, `${row._id}dsh${col._key}`, { showRuleMessage: true });
|
|
820
835
|
this.change("changeVal", col, row, rowIndex, ...params);
|
|
821
836
|
},
|
|
822
|
-
change (...params) {
|
|
823
|
-
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);
|
|
824
839
|
},
|
|
825
840
|
|
|
826
841
|
/* ----------- 隐藏/显示字段 ---------- */
|
|
@@ -836,12 +851,6 @@ export default {
|
|
|
836
851
|
}
|
|
837
852
|
},
|
|
838
853
|
|
|
839
|
-
/* ----------- 全屏 ---------- */
|
|
840
|
-
// 打开全屏模态框
|
|
841
|
-
clickEnlarge (operationItem) {
|
|
842
|
-
this.isEnlarge = true;
|
|
843
|
-
},
|
|
844
|
-
|
|
845
854
|
/* ----------- 引用 ---------- */
|
|
846
855
|
// 点击引用
|
|
847
856
|
clickQuote () {
|
|
@@ -884,7 +893,8 @@ export default {
|
|
|
884
893
|
content: "该数据下此内容为空,无法引用!",
|
|
885
894
|
onOk: () => { }
|
|
886
895
|
});
|
|
887
|
-
}
|
|
896
|
+
}
|
|
897
|
+
else {
|
|
888
898
|
if (["flatTable"].includes(this.controlType)) {
|
|
889
899
|
this.parentObj[this.controlKey] = {
|
|
890
900
|
...fieldVal,
|
|
@@ -894,7 +904,8 @@ export default {
|
|
|
894
904
|
__old__: false
|
|
895
905
|
}))
|
|
896
906
|
};
|
|
897
|
-
}
|
|
907
|
+
}
|
|
908
|
+
else if (["cascaderTable"].includes(this.controlType)) {
|
|
898
909
|
const transformData = (list = []) => {
|
|
899
910
|
const loop = (list = []) =>
|
|
900
911
|
list.map(item => ({
|
|
@@ -964,7 +975,7 @@ export default {
|
|
|
964
975
|
this.$https({
|
|
965
976
|
url: {
|
|
966
977
|
module: "sheet",
|
|
967
|
-
name: ["
|
|
978
|
+
name: ["cascaderTable"].includes(this.controlType) ? "exportCascaderTableExcel" : "exportFlatTableExcel"
|
|
968
979
|
},
|
|
969
980
|
params: this.exportParams,
|
|
970
981
|
callback: data => {
|
|
@@ -1004,6 +1015,12 @@ export default {
|
|
|
1004
1015
|
});
|
|
1005
1016
|
},
|
|
1006
1017
|
|
|
1018
|
+
/* ----------- 全屏 ---------- */
|
|
1019
|
+
// 打开全屏模态框
|
|
1020
|
+
clickEnlarge (operationItem) {
|
|
1021
|
+
this.isEnlarge = true;
|
|
1022
|
+
},
|
|
1023
|
+
|
|
1007
1024
|
/* ----------- 渲染函数 ---------- */
|
|
1008
1025
|
getTableTopRender (isEnlarge = false) {
|
|
1009
1026
|
return (h, params) => {
|
|
@@ -1096,7 +1113,7 @@ export default {
|
|
|
1096
1113
|
}
|
|
1097
1114
|
});
|
|
1098
1115
|
},
|
|
1099
|
-
|
|
1116
|
+
createBtnRender (h, params) {
|
|
1100
1117
|
return !this.isSearching && this.disabledFootCreateBtn !== true
|
|
1101
1118
|
? h("dsh-buttons", {
|
|
1102
1119
|
style: {
|
|
@@ -1114,33 +1131,136 @@ export default {
|
|
|
1114
1131
|
})
|
|
1115
1132
|
: undefined;
|
|
1116
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", ""),
|
|
1117
1181
|
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
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
|
+
];
|
|
1139
1231
|
},
|
|
1232
|
+
|
|
1233
|
+
/* ----------- 方法 ---------- */
|
|
1140
1234
|
// 整行校验结果
|
|
1141
1235
|
getRowRuleResult (row, rowIndex) {
|
|
1142
1236
|
return this.filterColumns.every(column => this.getColRuleResult(column, row, rowIndex).bool);
|
|
1143
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
|
+
});
|
|
1248
|
+
},
|
|
1249
|
+
// 是否禁止操作 在关于默认行方面
|
|
1250
|
+
getRowIsDftDisabled (row, rowIndex) {
|
|
1251
|
+
return this.controlKey === "_default" ? false : row.__isDefault__;
|
|
1252
|
+
},
|
|
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);
|
|
1262
|
+
},
|
|
1263
|
+
|
|
1144
1264
|
// 单元格校验结果
|
|
1145
1265
|
getColRuleResult (col, row, rowIndex) {
|
|
1146
1266
|
col = this.$transformDynamicProperty(col, row, this.parentObj);
|
|
@@ -1162,18 +1282,36 @@ export default {
|
|
|
1162
1282
|
};
|
|
1163
1283
|
}
|
|
1164
1284
|
},
|
|
1165
|
-
//
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
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;
|
|
1170
1295
|
},
|
|
1171
|
-
//
|
|
1172
|
-
|
|
1173
|
-
|
|
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
|
+
};
|
|
1174
1312
|
},
|
|
1175
1313
|
// 列本身是否可编辑
|
|
1176
|
-
getColCanEdit (col, row) {
|
|
1314
|
+
getColCanEdit (col, row, rowIndex) {
|
|
1177
1315
|
return (
|
|
1178
1316
|
["treeTable"].includes(this.inTableType) && ["number", "date"].includes(col._type)
|
|
1179
1317
|
? col._summaryType
|
|
@@ -1183,38 +1321,72 @@ export default {
|
|
|
1183
1321
|
? true
|
|
1184
1322
|
: ["downToUp"].includes(col._writeSort)
|
|
1185
1323
|
? !(row.children && row.children.length) || row.children.every(sonRow => !this.$isEmptyData(sonRow[col._key]))
|
|
1186
|
-
: row.level === 1 || !this.$isEmptyData(this.
|
|
1324
|
+
: row.level === 1 || !this.$isEmptyData(this.getParentRow(row, this.data)[col._key])
|
|
1187
1325
|
: true
|
|
1188
1326
|
: true
|
|
1189
1327
|
) &&
|
|
1190
|
-
!(["cascaderTable"].includes(this.controlType) && ["level", "children"].includes(col._key)) && //
|
|
1328
|
+
!(["cascaderTable"].includes(this.controlType) && ["level", "children"].includes(col._key)) && // 层级表格的固定字段不可编辑
|
|
1191
1329
|
(col._oldReadonly ? row.__old__ !== true : true) && // 老数据行里某些列不可编辑
|
|
1192
1330
|
(row.__isQuote__ ? !this.quoteDisabledColKeys.includes(col._key) : true) && // 引用过来的数据是否可编辑
|
|
1193
1331
|
!["calculate"].includes(col._enterType) && // 计算的不可编辑
|
|
1194
|
-
col._readonly !== true && //
|
|
1195
|
-
(
|
|
1196
|
-
col._mergeRow === true
|
|
1197
|
-
? this.controlKey === "_default" || (col._canEditOnMergeRow === true && row.__isDefault__ !== true)
|
|
1198
|
-
: true
|
|
1199
|
-
) && // 合并单元格的且不配置"新增数据的可编辑"的不可编辑
|
|
1332
|
+
col._readonly !== true && // 只读
|
|
1333
|
+
(!this.getRowIsDftDisabled(row) || col._readonlyOnDftRow !== true) && // 默认行的某列是否可编辑
|
|
1200
1334
|
col.canEdit !== false; // 字段本身编辑权限 考虑为undefined时候
|
|
1201
1335
|
},
|
|
1202
1336
|
// 单元格最终编辑状态
|
|
1203
|
-
getUnitCanEdit (col, row) {
|
|
1204
|
-
return this.getRowCanEdit(row) &&
|
|
1205
|
-
this.getColCanEdit(col, row) &&
|
|
1337
|
+
getUnitCanEdit (col, row, rowIndex) {
|
|
1338
|
+
return this.getRowCanEdit(row, rowIndex) &&
|
|
1339
|
+
this.getColCanEdit(col, row, rowIndex) &&
|
|
1206
1340
|
this.$isAdvRelyShow(col, row, this.parentObj, true);
|
|
1207
1341
|
},
|
|
1208
|
-
getRowFormList (row) {
|
|
1209
|
-
return this.selfColumns.map(column => {
|
|
1210
|
-
column = this.$transformDynamicProperty(column, row, this.parentObj);
|
|
1211
|
-
const unitCanEdit = this.getColCanEdit(column, row);
|
|
1212
1342
|
|
|
1343
|
+
/* ----------- 工具方法 ---------- */
|
|
1344
|
+
// 获取父级行
|
|
1345
|
+
getParentRow (row, tree = []) {
|
|
1346
|
+
if (row.level === 1) {
|
|
1213
1347
|
return {
|
|
1214
|
-
|
|
1215
|
-
canEdit: unitCanEdit
|
|
1348
|
+
children: tree
|
|
1216
1349
|
};
|
|
1217
|
-
}
|
|
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__; // 标记默认数据(配置端默认值)
|
|
1218
1390
|
}
|
|
1219
1391
|
}
|
|
1220
1392
|
};
|