bri-components 1.4.84 → 1.4.86
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/DshDate/DshDaterange.vue +8 -1
- package/src/components/controls/senior/cascaderTable.vue +3 -0
- package/src/components/form/DshForm.vue +1 -1
- package/src/components/list/mixins/DshCascaderTableMixin.js +170 -196
- package/src/components/list/mixins/DshFlatTableMixin.js +111 -86
- package/src/components/list/mixins/DshTreeTableMixin.js +105 -38
- package/src/components/list/mixins/tableBaseMixin.js +147 -216
- package/src/components/list/mixins/treeTableBaseMixin.js +17 -49
- package/src/styles/components/BriTable.less +2 -2
|
@@ -68,13 +68,13 @@ export default {
|
|
|
68
68
|
data () {
|
|
69
69
|
return {
|
|
70
70
|
widthMap: this.$getModFieldPropertyMap("width"),
|
|
71
|
-
|
|
72
|
-
saveProperties: ["__readonly__", "__isDefault__", "__old__", "__isQuote__"],
|
|
73
|
-
resetProperties: ["
|
|
71
|
+
dftInitValMap: this.$getModFieldPropertyMap("initDefaultVal"),
|
|
72
|
+
// saveProperties: ["__readonly__", "__isDefault__", "__old__", "__isQuote__"],
|
|
73
|
+
resetProperties: ["__isShow__", "__isTmpShow__", "__isExpand__", "__treeIndex__"],
|
|
74
74
|
|
|
75
75
|
initFlag: true,
|
|
76
76
|
isExpandAction: false,
|
|
77
|
-
showRuleMessage: false, // 进行全体校验
|
|
77
|
+
// showRuleMessage: false, // 进行全体校验
|
|
78
78
|
|
|
79
79
|
idRecordMap: {}, // 默认id转换映射
|
|
80
80
|
// hoverRecordMap: {},
|
|
@@ -416,7 +416,8 @@ export default {
|
|
|
416
416
|
]
|
|
417
417
|
};
|
|
418
418
|
},
|
|
419
|
-
|
|
419
|
+
|
|
420
|
+
// 是否筛选状态
|
|
420
421
|
isSearching () {
|
|
421
422
|
return this.parentObj.__isCreate__ === true
|
|
422
423
|
? false
|
|
@@ -425,88 +426,15 @@ export default {
|
|
|
425
426
|
searchTitle () {
|
|
426
427
|
return `${this.isSearching ? "筛选" : "全部"}数据;`;
|
|
427
428
|
},
|
|
428
|
-
controlShowKey () {
|
|
429
|
-
return this.isSearching ? "__isSearchShow__" : "__isShow__";
|
|
430
|
-
},
|
|
431
|
-
|
|
432
|
-
/* --- 数据 --- */
|
|
433
|
-
// 默认数据
|
|
434
|
-
defaultListData () {
|
|
435
|
-
const loop = (tree = [], list = []) => {
|
|
436
|
-
return tree.reduce((newList, rowItem) => {
|
|
437
|
-
newList = [...newList, rowItem];
|
|
438
|
-
|
|
439
|
-
return rowItem.children && rowItem.children.length
|
|
440
|
-
? loop(rowItem.children, newList)
|
|
441
|
-
: newList;
|
|
442
|
-
}, list);
|
|
443
|
-
};
|
|
444
|
-
|
|
445
|
-
return ["cascaderTable"].includes(this.controlType)
|
|
446
|
-
? loop(this.selfPropsObj._default.tree)
|
|
447
|
-
: this.selfPropsObj._default.list;
|
|
448
|
-
},
|
|
449
|
-
defaultListDataIds () {
|
|
450
|
-
return this.defaultListData
|
|
451
|
-
.map(rowItem => rowItem._id)
|
|
452
|
-
.filter(id => !!id);
|
|
453
|
-
},
|
|
454
|
-
// 全部数据 或 筛选时符合条件的数据
|
|
455
|
-
showListData () {
|
|
456
|
-
return this.allListData
|
|
457
|
-
.filter(rowItem => {
|
|
458
|
-
this.dealSearchShow(rowItem);
|
|
459
|
-
return rowItem.__isRendered__ && !!rowItem[this.controlShowKey];
|
|
460
|
-
})
|
|
461
|
-
.map((rowItem, rowIndex) => {
|
|
462
|
-
rowItem.__index__ = rowIndex + 1;
|
|
463
|
-
return rowItem;
|
|
464
|
-
});
|
|
465
|
-
},
|
|
466
|
-
// 全部数据 或 筛选时符合条件的数据 -总数
|
|
467
|
-
selfTotal () {
|
|
468
|
-
return this.showListData.length;
|
|
469
|
-
},
|
|
470
|
-
|
|
471
|
-
parentDataId () {
|
|
472
|
-
return this.parentObj._id;
|
|
473
|
-
},
|
|
474
|
-
selfRowDft () {
|
|
475
|
-
return this.selfColumns.reduce((obj, column) => {
|
|
476
|
-
const dftInRowVal = this.rowDefault[column._key];
|
|
477
|
-
const dftVal = column._default;
|
|
478
|
-
const initDftVal = this.initDftValMap[column._type];
|
|
479
|
-
|
|
480
|
-
return Object.assign(obj, {
|
|
481
|
-
[column._key]: dftInRowVal === undefined
|
|
482
|
-
? dftVal === undefined
|
|
483
|
-
? initDftVal
|
|
484
|
-
: dftVal
|
|
485
|
-
: dftInRowVal
|
|
486
|
-
// [column._key]: this.$isEmptyData(dftInRowVal)
|
|
487
|
-
// ? this.$isEmptyData(dftVal)
|
|
488
|
-
// ? initDftVal
|
|
489
|
-
// : dftVal
|
|
490
|
-
// : dftInRowVal
|
|
491
|
-
});
|
|
492
|
-
}, {});
|
|
493
|
-
},
|
|
494
|
-
compareListData () {
|
|
495
|
-
this.compareData.forEach(item => {
|
|
496
|
-
!item._id && this.$set(item, "_id", this.$ObjectID().str);
|
|
497
|
-
});
|
|
498
|
-
return this.compareData;
|
|
499
|
-
},
|
|
500
|
-
useCampare () {
|
|
501
|
-
return !!this.compareListData.length;
|
|
502
|
-
},
|
|
503
429
|
|
|
504
430
|
/* --- 列字段 --- */
|
|
505
|
-
// columns => selfColumns =>
|
|
431
|
+
// columns => selfColumns => usedColumns => contentColumns => showContentColumns => showColumns
|
|
506
432
|
selfColumns () {
|
|
433
|
+
// console.log("selfColumns");
|
|
507
434
|
return this.columns;
|
|
508
435
|
},
|
|
509
|
-
|
|
436
|
+
usedColumns () {
|
|
437
|
+
// console.log("usedColumns");
|
|
510
438
|
const list = this.selfColumns.filter(colItem =>
|
|
511
439
|
this.showOrHideColKeys.includes(colItem._key)
|
|
512
440
|
? this.showColKeys.includes(colItem._key)
|
|
@@ -516,9 +444,7 @@ export default {
|
|
|
516
444
|
return list.filter(colItem => this.$isAdvRelyShow(colItem, this.allListData, this.parentObj, true));
|
|
517
445
|
},
|
|
518
446
|
contentColumns () {
|
|
519
|
-
return this.
|
|
520
|
-
filter: undefined,
|
|
521
|
-
sortBy: undefined,
|
|
447
|
+
return this.usedColumns.map(colItem => ({
|
|
522
448
|
renderHeaderCell: ({ column }, h) => {
|
|
523
449
|
return this.contentThCellRender(h, { column });
|
|
524
450
|
},
|
|
@@ -564,14 +490,9 @@ export default {
|
|
|
564
490
|
};
|
|
565
491
|
},
|
|
566
492
|
|
|
567
|
-
|
|
568
|
-
return {
|
|
569
|
-
selectedRowKeys: this.selectIds
|
|
570
|
-
};
|
|
571
|
-
},
|
|
493
|
+
/* --- 表格参数 --- */
|
|
572
494
|
tablePropsObj () {
|
|
573
495
|
return {
|
|
574
|
-
// isLoading: false,
|
|
575
496
|
// rowStyleOption: {
|
|
576
497
|
// hoverHighlight: true,
|
|
577
498
|
// clickHighlight: true,
|
|
@@ -599,8 +520,13 @@ export default {
|
|
|
599
520
|
maxHeight: undefined
|
|
600
521
|
};
|
|
601
522
|
},
|
|
523
|
+
checkboxOption () {
|
|
524
|
+
return {
|
|
525
|
+
selectedRowKeys: this.selectIds
|
|
526
|
+
};
|
|
527
|
+
},
|
|
602
528
|
|
|
603
|
-
|
|
529
|
+
/* --- 联动隐藏 --- */
|
|
604
530
|
showColKeys () {
|
|
605
531
|
return this.showByNumFieldVal != null && this.showByNumFieldVal >= 0
|
|
606
532
|
? this.showOrHideColKeys.slice(0, this.showByNumFieldVal)
|
|
@@ -609,21 +535,23 @@ export default {
|
|
|
609
535
|
showOrHideColKeys () {
|
|
610
536
|
return this.selfPropsObj._showOrHideColKeys || [];
|
|
611
537
|
},
|
|
538
|
+
// 控制联动隐藏的数字类型字段
|
|
612
539
|
showByNumFieldKey () {
|
|
613
|
-
// 控制联动隐藏的数字类型字段
|
|
614
540
|
return this.selfPropsObj._showByNumFieldKey;
|
|
615
541
|
},
|
|
542
|
+
// 控制联动隐藏的数字类型字段的值
|
|
616
543
|
showByNumFieldVal () {
|
|
617
|
-
// 控制联动隐藏的数字类型字段的值
|
|
618
544
|
return this.showByNumFieldKey
|
|
619
545
|
? this.parentObj[this.showByNumFieldKey]
|
|
620
546
|
: undefined;
|
|
621
547
|
},
|
|
622
|
-
|
|
548
|
+
|
|
549
|
+
/* --- 显示/隐藏 --- */
|
|
623
550
|
hideColKeys () {
|
|
624
551
|
return this.selfPropsObj._hideColKeys;
|
|
625
552
|
},
|
|
626
|
-
|
|
553
|
+
|
|
554
|
+
/* --- 引用 --- */
|
|
627
555
|
isQuote () {
|
|
628
556
|
return this.selfPropsObj._isQuote;
|
|
629
557
|
},
|
|
@@ -657,7 +585,8 @@ export default {
|
|
|
657
585
|
}
|
|
658
586
|
};
|
|
659
587
|
},
|
|
660
|
-
|
|
588
|
+
|
|
589
|
+
/* --- 导入 --- */
|
|
661
590
|
isImport () {
|
|
662
591
|
return this.selfPropsObj._isImport;
|
|
663
592
|
},
|
|
@@ -671,7 +600,8 @@ export default {
|
|
|
671
600
|
importType: this.inTableType
|
|
672
601
|
};
|
|
673
602
|
},
|
|
674
|
-
|
|
603
|
+
|
|
604
|
+
/* --- 导出 --- */
|
|
675
605
|
isExport () {
|
|
676
606
|
return this.selfPropsObj._isExport;
|
|
677
607
|
},
|
|
@@ -684,7 +614,8 @@ export default {
|
|
|
684
614
|
advSearch: this.finalTableAdvSearch
|
|
685
615
|
};
|
|
686
616
|
},
|
|
687
|
-
|
|
617
|
+
|
|
618
|
+
/* --- 全屏 --- */
|
|
688
619
|
useEnlarge () {
|
|
689
620
|
return this.selfPropsObj._useEnlarge;
|
|
690
621
|
},
|
|
@@ -695,6 +626,62 @@ export default {
|
|
|
695
626
|
};
|
|
696
627
|
},
|
|
697
628
|
|
|
629
|
+
/* --- 数据 --- */
|
|
630
|
+
// 默认值数据
|
|
631
|
+
defaultListData () {
|
|
632
|
+
const loop = (tree = [], list = []) => {
|
|
633
|
+
return tree.reduce((newList, rowItem) => {
|
|
634
|
+
newList = [...newList, rowItem];
|
|
635
|
+
|
|
636
|
+
return rowItem.children && rowItem.children.length
|
|
637
|
+
? loop(rowItem.children, newList)
|
|
638
|
+
: newList;
|
|
639
|
+
}, list);
|
|
640
|
+
};
|
|
641
|
+
|
|
642
|
+
return ["cascaderTable"].includes(this.controlType)
|
|
643
|
+
? loop(this.selfPropsObj._default.tree)
|
|
644
|
+
: this.selfPropsObj._default.list;
|
|
645
|
+
},
|
|
646
|
+
defaultListDataIds () {
|
|
647
|
+
return this.defaultListData
|
|
648
|
+
.map(rowItem => rowItem._id)
|
|
649
|
+
.filter(id => !!id);
|
|
650
|
+
},
|
|
651
|
+
// 全部数据(或筛选出的数据)-总数
|
|
652
|
+
selfTotal () {
|
|
653
|
+
return this.showListData.length;
|
|
654
|
+
},
|
|
655
|
+
|
|
656
|
+
// 新增行的默认值
|
|
657
|
+
selfRowDft () {
|
|
658
|
+
return this.selfColumns.reduce((obj, column) => {
|
|
659
|
+
const dftInRowVal = this.rowDefault[column._key];
|
|
660
|
+
const dftVal = column._default;
|
|
661
|
+
const dftInitVal = this.dftInitValMap[column._type];
|
|
662
|
+
|
|
663
|
+
return Object.assign(obj, {
|
|
664
|
+
[column._key]: dftInRowVal === undefined // 不用isEmptyData判断原因:为空值时可能是故意置空的
|
|
665
|
+
? this.$isEmptyData(dftVal)
|
|
666
|
+
? dftInitVal
|
|
667
|
+
: dftVal
|
|
668
|
+
: dftInRowVal
|
|
669
|
+
});
|
|
670
|
+
}, {});
|
|
671
|
+
},
|
|
672
|
+
compareListData () {
|
|
673
|
+
this.compareData.forEach(item => {
|
|
674
|
+
!item._id && this.$set(item, "_id", this.$ObjectID().str);
|
|
675
|
+
});
|
|
676
|
+
return this.compareData;
|
|
677
|
+
},
|
|
678
|
+
useCampare () {
|
|
679
|
+
return !!this.compareListData.length;
|
|
680
|
+
},
|
|
681
|
+
parentDataId () {
|
|
682
|
+
return this.parentObj._id;
|
|
683
|
+
},
|
|
684
|
+
|
|
698
685
|
/* --- 功能按钮 --- */
|
|
699
686
|
baseOperationBtns () {
|
|
700
687
|
return Object.keys(this.baseOperationMap);
|
|
@@ -729,9 +716,6 @@ export default {
|
|
|
729
716
|
? this.baseOperationMap.canInsert.tip.replace("行", "条")
|
|
730
717
|
: this.baseOperationMap.canInsert.tip,
|
|
731
718
|
color: this.appColor
|
|
732
|
-
// style: {
|
|
733
|
-
// color: this.appColor
|
|
734
|
-
// }
|
|
735
719
|
},
|
|
736
720
|
canHideOrShow: {
|
|
737
721
|
...this.topOperationMap.canHideOrShow,
|
|
@@ -796,15 +780,25 @@ export default {
|
|
|
796
780
|
|
|
797
781
|
// 共外部使用
|
|
798
782
|
validate () {
|
|
799
|
-
this.showRuleMessage = true;
|
|
783
|
+
// this.showRuleMessage = true;
|
|
784
|
+
// return this.allListData.every((row, rowIndex) => this.getRowRuleResult(row, rowIndex));
|
|
785
|
+
|
|
786
|
+
let bool = true;
|
|
787
|
+
this.allListData.forEach((row, rowIndex) => {
|
|
788
|
+
const resultBool = this.getRowRuleResult(row, rowIndex);
|
|
789
|
+
|
|
790
|
+
if (resultBool === false) {
|
|
791
|
+
bool = false;
|
|
792
|
+
}
|
|
793
|
+
});
|
|
800
794
|
|
|
801
|
-
return
|
|
795
|
+
return bool;
|
|
802
796
|
},
|
|
803
797
|
// 重置
|
|
804
798
|
reset () {
|
|
805
799
|
this.initFlag = true;
|
|
806
800
|
this.isExpandAction = false;
|
|
807
|
-
this.showRuleMessage = false;
|
|
801
|
+
// this.showRuleMessage = false;
|
|
808
802
|
|
|
809
803
|
this.idRecordMap = {};
|
|
810
804
|
// this.hoverRecordMap = {};
|
|
@@ -1211,6 +1205,7 @@ export default {
|
|
|
1211
1205
|
},
|
|
1212
1206
|
contentThCellRender (h, { column }) {
|
|
1213
1207
|
column = this.$transformDynamicProperty(column, undefined, this.parentObj);
|
|
1208
|
+
// console.log(column._name);
|
|
1214
1209
|
|
|
1215
1210
|
return this.$getHeadRender(h, column, {
|
|
1216
1211
|
showRequired: this.showRequired,
|
|
@@ -1219,6 +1214,7 @@ export default {
|
|
|
1219
1214
|
});
|
|
1220
1215
|
},
|
|
1221
1216
|
contentTdCellRender (h, { row, rowIndex, column }) {
|
|
1217
|
+
// console.log(rowIndex);
|
|
1222
1218
|
column = this.$transformDynamicProperty(column, row, this.parentObj);
|
|
1223
1219
|
column = this.getResetCol({ row, rowIndex, column });
|
|
1224
1220
|
const unitCanEdit = this.getUnitCanEdit({ row, rowIndex, column });
|
|
@@ -1263,6 +1259,7 @@ export default {
|
|
|
1263
1259
|
}
|
|
1264
1260
|
})
|
|
1265
1261
|
: h("dsh-list-unit", {
|
|
1262
|
+
key: `${row._id}--${column._key}`,
|
|
1266
1263
|
props: {
|
|
1267
1264
|
canEdit: unitCanEdit,
|
|
1268
1265
|
formData: row,
|
|
@@ -1390,23 +1387,15 @@ export default {
|
|
|
1390
1387
|
},
|
|
1391
1388
|
bodyCellClass ({ row, rowIndex, column }) {
|
|
1392
1389
|
return "bri-table-td" +
|
|
1393
|
-
`${["
|
|
1394
|
-
? " bri-table-td-
|
|
1395
|
-
:
|
|
1396
|
-
? " bri-table-td-
|
|
1397
|
-
: this.getRowCanEdit(row, rowIndex)
|
|
1398
|
-
? " bri-table-td-edit"
|
|
1399
|
-
: ""
|
|
1400
|
-
}` +
|
|
1401
|
-
`${this.isSearching
|
|
1402
|
-
? row.__isSearchShow__ === false
|
|
1403
|
-
? " bri-table-td-hide"
|
|
1390
|
+
`${["__treeIndex__"].includes(column._key)
|
|
1391
|
+
? " bri-table-td-treeIndex"
|
|
1392
|
+
: this.getRowCanEdit(row, rowIndex)
|
|
1393
|
+
? " bri-table-td-edit"
|
|
1404
1394
|
: ""
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
: " bri-table-td-hide"
|
|
1395
|
+
}` +
|
|
1396
|
+
`${this.isExpandAction
|
|
1397
|
+
? " bri-table-td-visible"
|
|
1398
|
+
: ""
|
|
1410
1399
|
}` +
|
|
1411
1400
|
`${this.noborderColKeys.includes(column._key)
|
|
1412
1401
|
? " bri-table-td-noborder"
|
|
@@ -1420,13 +1409,13 @@ export default {
|
|
|
1420
1409
|
eventCustomOption ({ row, rowIndex, column }) {
|
|
1421
1410
|
return {
|
|
1422
1411
|
click: (event) => {
|
|
1423
|
-
|
|
1412
|
+
|
|
1424
1413
|
},
|
|
1425
1414
|
dblclick: (event) => {
|
|
1426
|
-
|
|
1415
|
+
|
|
1427
1416
|
},
|
|
1428
1417
|
contextmenu: (event) => {
|
|
1429
|
-
|
|
1418
|
+
|
|
1430
1419
|
},
|
|
1431
1420
|
mouseenter: (event) => {
|
|
1432
1421
|
// this.$set(this.hoverRecordMap, `${row._id}`, true);
|
|
@@ -1440,7 +1429,20 @@ export default {
|
|
|
1440
1429
|
/* ----------- 方法 ---------- */
|
|
1441
1430
|
// 整行校验结果
|
|
1442
1431
|
getRowRuleResult (row, rowIndex) {
|
|
1443
|
-
return this.
|
|
1432
|
+
// return this.usedColumns.every(column => this.getColRuleResult({ row, rowIndex, column }).bool);
|
|
1433
|
+
|
|
1434
|
+
let bool = true;
|
|
1435
|
+
this.usedColumns.forEach(column => {
|
|
1436
|
+
column = this.$transformDynamicProperty(column, row, this.parentObj);
|
|
1437
|
+
|
|
1438
|
+
const resultObj = this.getColRuleResultObj({ row, rowIndex, column });
|
|
1439
|
+
if (!resultObj.bool) {
|
|
1440
|
+
bool = false;
|
|
1441
|
+
this.dealRuleRecord(row, column);
|
|
1442
|
+
}
|
|
1443
|
+
});
|
|
1444
|
+
|
|
1445
|
+
return bool;
|
|
1444
1446
|
},
|
|
1445
1447
|
getRowFormList (row, rowIndex) {
|
|
1446
1448
|
return this.selfColumns.map(column => {
|
|
@@ -1476,21 +1478,23 @@ export default {
|
|
|
1476
1478
|
column = this.$transformDynamicProperty(column, row, this.parentObj);
|
|
1477
1479
|
|
|
1478
1480
|
// 未触发校验时 不显示错误
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
this.$normalComparedFunc(column, row, this.selfColumns, this.parentObj, this.allFormList, this.inTableType, resultObj) &&
|
|
1484
|
-
this.$levelComparedFunc(column, row, this.allListData, this.inTableType, resultObj);
|
|
1485
|
-
|
|
1486
|
-
return resultObj;
|
|
1487
|
-
}
|
|
1488
|
-
else {
|
|
1489
|
-
return {
|
|
1481
|
+
// return this.ruleRecordMap[this.getMixKey(row, column)] || this.showRuleMessage
|
|
1482
|
+
return this.ruleRecordMap[this.getMixKey(row, column)]
|
|
1483
|
+
? this.getColRuleResultObj({ row, rowIndex, column })
|
|
1484
|
+
: {
|
|
1490
1485
|
bool: true,
|
|
1491
1486
|
message: "未触发校验,通过!"
|
|
1492
|
-
|
|
1493
|
-
|
|
1487
|
+
};
|
|
1488
|
+
},
|
|
1489
|
+
// 获取单元格校验对象
|
|
1490
|
+
getColRuleResultObj ({ row, rowIndex, column }) {
|
|
1491
|
+
// 校验必填不通过 => 校验对比
|
|
1492
|
+
const resultObj = {};
|
|
1493
|
+
this.$getFieldRuleResult(column, row, resultObj) &&
|
|
1494
|
+
this.$normalComparedFunc(column, row, this.selfColumns, this.parentObj, this.allFormList, this.inTableType, resultObj) &&
|
|
1495
|
+
this.$levelComparedFunc(column, row, this.allListData, this.inTableType, resultObj);
|
|
1496
|
+
|
|
1497
|
+
return resultObj;
|
|
1494
1498
|
},
|
|
1495
1499
|
// 加工单元格对应的配置
|
|
1496
1500
|
getResetCol ({ row, rowIndex, column }) {
|
|
@@ -1544,7 +1548,7 @@ export default {
|
|
|
1544
1548
|
|
|
1545
1549
|
/* ----------- 工具方法 ---------- */
|
|
1546
1550
|
// 初始化时 修复数据
|
|
1547
|
-
|
|
1551
|
+
fixRowData (row, levelNum) {
|
|
1548
1552
|
if (this.initFlag) {
|
|
1549
1553
|
// 配置端设置的地方,不会运行下面的,因为_default被过滤掉没值,defaultListDataIds就是空的
|
|
1550
1554
|
if (row._id) {
|
|
@@ -1564,58 +1568,13 @@ export default {
|
|
|
1564
1568
|
row.__old__ = this.isDftSet ? false : this.parentObj.__isCreate__ !== true; // 标记老数据
|
|
1565
1569
|
row.__isDefault__ = this.isDftSet ? true : !!row.__isDefault__; // 标记默认数据(配置端默认值)
|
|
1566
1570
|
|
|
1567
|
-
// 初次进来
|
|
1571
|
+
// 初次进来 把关于展示的状态值全部清除(只有层级表在用,按理说应放在DshTreeTableMixin.js,但为了清除三大表格的老数据,才放在这)
|
|
1568
1572
|
this.resetProperties.forEach(property => {
|
|
1569
1573
|
delete row[property];
|
|
1570
1574
|
});
|
|
1571
|
-
if (["treeTable"].includes(this.inTableType)) {
|
|
1572
|
-
// row.__isSearchShow__ = false;
|
|
1573
|
-
// row.__isExpand__ = false;
|
|
1574
|
-
|
|
1575
|
-
// 第一级的需要显示出来
|
|
1576
|
-
if (row.level == 1) {
|
|
1577
|
-
row.__isRendered__ = true;
|
|
1578
|
-
row.__isShow__ = true;
|
|
1579
|
-
row.__isTmpShow__ = true;
|
|
1580
|
-
} else {
|
|
1581
|
-
// row.__isRendered__ = false;
|
|
1582
|
-
// row.__isShow__ = false;
|
|
1583
|
-
// row.__isTmpShow__ = false;
|
|
1584
|
-
}
|
|
1585
|
-
} else {
|
|
1586
|
-
row.__isRendered__ = true;
|
|
1587
|
-
row.__isShow__ = true;
|
|
1588
|
-
row.__isTmpShow__ = true;
|
|
1589
|
-
row.__isSearchShow__ = false;
|
|
1590
|
-
row.__isExpand__ = false;
|
|
1591
|
-
}
|
|
1592
|
-
}
|
|
1593
|
-
// 计算或其它重新传进来值时
|
|
1594
|
-
else {
|
|
1595
|
-
if (["treeTable"].includes(this.inTableType)) {
|
|
1596
|
-
// row.__isSearchShow__ = Object.prototype.hasOwnProperty.call(row, "__isSearchShow__") ? row.__isSearchShow__ : false;
|
|
1597
|
-
// row.__isExpand__ = Object.prototype.hasOwnProperty.call(row, "__isExpand__") ? row.__isExpand__ : false;
|
|
1598
|
-
|
|
1599
|
-
// 第一级的需要显示出来
|
|
1600
|
-
if (row.level == 1) {
|
|
1601
|
-
row.__isRendered__ = Object.prototype.hasOwnProperty.call(row, "__isRendered__") ? row.__isRendered__ : true;
|
|
1602
|
-
row.__isShow__ = Object.prototype.hasOwnProperty.call(row, "__isShow__") ? row.__isShow__ : true;
|
|
1603
|
-
row.__isTmpShow__ = Object.prototype.hasOwnProperty.call(row, "__isTmpShow__") ? row.__isTmpShow__ : true;
|
|
1604
|
-
} else {
|
|
1605
|
-
// row.__isRendered__ = Object.prototype.hasOwnProperty.call(row, "__isRendered__") ? row.__isRendered__ : false;
|
|
1606
|
-
// row.__isShow__ = Object.prototype.hasOwnProperty.call(row, "__isShow__") ? row.__isShow__ : false;
|
|
1607
|
-
// row.__isTmpShow__ = Object.prototype.hasOwnProperty.call(row, "__isTmpShow__") ? row.__isTmpShow__ : false;
|
|
1608
|
-
}
|
|
1609
|
-
} else {
|
|
1610
|
-
row.__isRendered__ = Object.prototype.hasOwnProperty.call(row, "__isRendered__") ? row.__isRendered__ : true;
|
|
1611
|
-
row.__isShow__ = Object.prototype.hasOwnProperty.call(row, "__isShow__") ? row.__isShow__ : true;
|
|
1612
|
-
row.__isTmpShow__ = Object.prototype.hasOwnProperty.call(row, "__isTmpShow__") ? row.__isTmpShow__ : true;
|
|
1613
|
-
row.__isSearchShow__ = Object.prototype.hasOwnProperty.call(row, "__isSearchShow__") ? row.__isSearchShow__ : false;
|
|
1614
|
-
row.__isExpand__ = Object.prototype.hasOwnProperty.call(row, "__isExpand__") ? row.__isExpand__ : false;
|
|
1615
|
-
}
|
|
1616
1575
|
}
|
|
1617
1576
|
|
|
1618
|
-
this.
|
|
1577
|
+
this.fixSelfRowData && this.fixSelfRowData(row, levelNum);
|
|
1619
1578
|
},
|
|
1620
1579
|
// 生成新的一行数据
|
|
1621
1580
|
getNewRowData (level, list) {
|
|
@@ -1628,24 +1587,14 @@ export default {
|
|
|
1628
1587
|
isLeaf: true,
|
|
1629
1588
|
children: [],
|
|
1630
1589
|
// __old__: false,
|
|
1631
|
-
__isDefault__: this.isDftSet
|
|
1632
|
-
__isRendered__: true,
|
|
1633
|
-
__isShow__: true,
|
|
1634
|
-
__isTmpShow__: true,
|
|
1635
|
-
__isSearchShow__: false,
|
|
1636
|
-
__isExpand__: false
|
|
1590
|
+
__isDefault__: this.isDftSet
|
|
1637
1591
|
};
|
|
1638
1592
|
} else {
|
|
1639
1593
|
return {
|
|
1640
1594
|
...this.$deepCopy(this.selfRowDft),
|
|
1641
1595
|
_id: this.$ObjectID().str,
|
|
1642
1596
|
// __old__: false,
|
|
1643
|
-
__isDefault__: this.isDftSet
|
|
1644
|
-
__isRendered__: true,
|
|
1645
|
-
__isShow__: true,
|
|
1646
|
-
__isTmpShow__: true,
|
|
1647
|
-
__isSearchShow__: false,
|
|
1648
|
-
__isExpand__: false
|
|
1597
|
+
__isDefault__: this.isDftSet
|
|
1649
1598
|
};
|
|
1650
1599
|
}
|
|
1651
1600
|
},
|
|
@@ -1674,24 +1623,6 @@ export default {
|
|
|
1674
1623
|
return parentRow;
|
|
1675
1624
|
}
|
|
1676
1625
|
},
|
|
1677
|
-
// 判断是否符合搜索条件,且处理行状态值等
|
|
1678
|
-
dealSearchShow (rowItem) {
|
|
1679
|
-
if (this.isSearching) {
|
|
1680
|
-
const bool = this.$isAdvRelyAccord(this.finalTableAdvSearch, rowItem);
|
|
1681
|
-
|
|
1682
|
-
// 重置
|
|
1683
|
-
rowItem.__isSearchShow__ = false;
|
|
1684
|
-
if (bool) {
|
|
1685
|
-
rowItem.__isRendered__ = true;
|
|
1686
|
-
rowItem.__isSearchShow__ = true;
|
|
1687
|
-
}
|
|
1688
|
-
|
|
1689
|
-
return bool;
|
|
1690
|
-
}
|
|
1691
|
-
else {
|
|
1692
|
-
return true;
|
|
1693
|
-
}
|
|
1694
|
-
},
|
|
1695
1626
|
// 单元格是否显示对比
|
|
1696
1627
|
isShowCompare ({ row, rowIndex, column }) {
|
|
1697
1628
|
const oldRow = this.compareListData[rowIndex] || {};
|
|
@@ -3,7 +3,14 @@ import { resourceData } from "bri-datas";
|
|
|
3
3
|
export default {
|
|
4
4
|
mixins: [],
|
|
5
5
|
components: {},
|
|
6
|
-
props: {
|
|
6
|
+
props: {
|
|
7
|
+
treeColumns: {
|
|
8
|
+
type: Array,
|
|
9
|
+
default () {
|
|
10
|
+
return [];
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
},
|
|
7
14
|
data () {
|
|
8
15
|
return {
|
|
9
16
|
searchMode: "flat", // "flat", "tree"
|
|
@@ -34,27 +41,25 @@ export default {
|
|
|
34
41
|
computed: {
|
|
35
42
|
treeTableBasePropsObj () {
|
|
36
43
|
return {
|
|
37
|
-
_treeForm: [],
|
|
44
|
+
// _treeForm: [],
|
|
38
45
|
_maxLevel: 3 // 最大级数
|
|
39
46
|
};
|
|
40
47
|
},
|
|
41
|
-
treeForm () {
|
|
42
|
-
return this.selfPropsObj._treeForm;
|
|
43
|
-
},
|
|
44
|
-
treeFormKeys () {
|
|
45
|
-
return this.treeForm.map(treeFormItem => treeFormItem._key);
|
|
46
|
-
},
|
|
47
48
|
maxLevel () {
|
|
48
49
|
return this.selfPropsObj._maxLevel || 3;
|
|
49
50
|
},
|
|
51
|
+
treeColKeys () {
|
|
52
|
+
return this.treeColumns.map(colItem => colItem._key);
|
|
53
|
+
},
|
|
50
54
|
|
|
55
|
+
/* --- 列字段 --- */
|
|
51
56
|
selfColumns () {
|
|
52
57
|
return this.columns.map(column => {
|
|
53
58
|
// 层级表格类型,level字段的进行特殊处理(treeForm加工成_data)
|
|
54
59
|
return column._key === "level"
|
|
55
60
|
? {
|
|
56
61
|
...column,
|
|
57
|
-
_data: this.
|
|
62
|
+
_data: this.treeColumns.map((treeFormItem, treeFormIndex) => ({
|
|
58
63
|
name: treeFormItem._name,
|
|
59
64
|
_key: (treeFormIndex + 1),
|
|
60
65
|
color: Object.keys(resourceData.colorMap)[treeFormIndex + 1]
|
|
@@ -63,6 +68,7 @@ export default {
|
|
|
63
68
|
: column;
|
|
64
69
|
});
|
|
65
70
|
},
|
|
71
|
+
|
|
66
72
|
selfAllOperationMap () {
|
|
67
73
|
return {
|
|
68
74
|
canCreateChild: {
|
|
@@ -109,7 +115,7 @@ export default {
|
|
|
109
115
|
list.splice(newRowIndex, 0, newRow);
|
|
110
116
|
|
|
111
117
|
// 展开子级
|
|
112
|
-
this.toggleExpand(row, true);
|
|
118
|
+
this.toggleExpand && this.toggleExpand(row, true);
|
|
113
119
|
|
|
114
120
|
this.change("createChildRow", newRow, newRowIndex, null);
|
|
115
121
|
},
|
|
@@ -126,7 +132,7 @@ export default {
|
|
|
126
132
|
this.change("deleteRow", row, rowIndex, null);
|
|
127
133
|
}
|
|
128
134
|
});
|
|
129
|
-
}
|
|
135
|
+
}
|
|
130
136
|
// // 节点操作 -删除所有子行
|
|
131
137
|
// clickDeleteChilds (operationItem, row, rowIndex, col) {
|
|
132
138
|
// this.$Modal.confirm({
|
|
@@ -139,43 +145,5 @@ export default {
|
|
|
139
145
|
// }
|
|
140
146
|
// });
|
|
141
147
|
// },
|
|
142
|
-
|
|
143
|
-
selfFixRowItem (row, levelNum) {
|
|
144
|
-
if (this.initFlag) {
|
|
145
|
-
// TODO:修正数据level属性,后期可以删除
|
|
146
|
-
row.level = row.level || levelNum;
|
|
147
|
-
}
|
|
148
|
-
},
|
|
149
|
-
// 展开/隐藏节点
|
|
150
|
-
toggleExpand (row, bool = true) {
|
|
151
|
-
this.isExpandAction = true;
|
|
152
|
-
this.$set(row, "__isExpand__", bool);
|
|
153
|
-
|
|
154
|
-
this.toggleDescendantsShow(row, bool);
|
|
155
|
-
},
|
|
156
|
-
// 切换子孙后代的显示/隐藏
|
|
157
|
-
toggleDescendantsShow (row, bool) {
|
|
158
|
-
const loop = (row, isFirstSon) => {
|
|
159
|
-
if (row.children && row.children.length) {
|
|
160
|
-
row.children.forEach(subRow => {
|
|
161
|
-
if (isFirstSon) {
|
|
162
|
-
this.$set(subRow, "__isRendered__", true);
|
|
163
|
-
this.$set(subRow, "__isShow__", bool);
|
|
164
|
-
this.$set(subRow, "__isTmpShow__", bool);
|
|
165
|
-
} else {
|
|
166
|
-
if (bool) {
|
|
167
|
-
this.$set(subRow, "__isShow__", subRow.__isTmpShow__);
|
|
168
|
-
} else {
|
|
169
|
-
this.$set(subRow, "__isShow__", false);
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
loop(subRow);
|
|
174
|
-
});
|
|
175
|
-
}
|
|
176
|
-
};
|
|
177
|
-
|
|
178
|
-
loop(row, true);
|
|
179
|
-
}
|
|
180
148
|
}
|
|
181
149
|
};
|