easy3wui 1.5.49-beta6 → 1.5.49
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/lib/Easy3wGridPage/index.js +72 -28
- package/package.json +1 -1
|
@@ -72,10 +72,6 @@ var _numeral = require('numeral');
|
|
|
72
72
|
|
|
73
73
|
var _numeral2 = _interopRequireDefault(_numeral);
|
|
74
74
|
|
|
75
|
-
var _cloneDeep = require('lodash/cloneDeep');
|
|
76
|
-
|
|
77
|
-
var _cloneDeep2 = _interopRequireDefault(_cloneDeep);
|
|
78
|
-
|
|
79
75
|
var _comonConfig = require('comonConfigPath/comonConfig');
|
|
80
76
|
|
|
81
77
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
|
@@ -146,6 +142,8 @@ var Easy3wGridPage = function (_Component) {
|
|
|
146
142
|
// ---------------------------------- 数据脱敏 end ----------------------------------
|
|
147
143
|
// 生成表格
|
|
148
144
|
|
|
145
|
+
// 数组深度复制
|
|
146
|
+
|
|
149
147
|
|
|
150
148
|
Easy3wGridPage.prototype.render = function render() {
|
|
151
149
|
var _this2 = this;
|
|
@@ -169,7 +167,7 @@ var Easy3wGridPage = function (_Component) {
|
|
|
169
167
|
// const arrColumns = this.touchCreateColumns([].concat(columns));
|
|
170
168
|
// const arrColumns = this.touchCreateColumns(JSON.parse(JSON.stringify(columns)));
|
|
171
169
|
|
|
172
|
-
var arrColumns = this.touchCreateColumns(columns);
|
|
170
|
+
var arrColumns = this.touchCreateColumns(this.deepCopy(columns));
|
|
173
171
|
// const arrColumns = this.touchCreateColumns(columns);
|
|
174
172
|
var _state = this.state,
|
|
175
173
|
selectedRowKeysState = _state.selectedRowKeysState,
|
|
@@ -619,7 +617,8 @@ var _initialiseProps = function _initialiseProps() {
|
|
|
619
617
|
return strDesensitize;
|
|
620
618
|
};
|
|
621
619
|
|
|
622
|
-
this.getImplicit = function (dataIndex, index) {
|
|
620
|
+
this.getImplicit = function (event, dataIndex, index) {
|
|
621
|
+
event.stopPropagation(); // 禁止事件冒泡
|
|
623
622
|
var arrData = _this3.state.arrData;
|
|
624
623
|
|
|
625
624
|
if (_comonConfig.dataDesensitizationUrl) {
|
|
@@ -657,6 +656,7 @@ var _initialiseProps = function _initialiseProps() {
|
|
|
657
656
|
arrData: arrData // 更新数据
|
|
658
657
|
});
|
|
659
658
|
}
|
|
659
|
+
// return false;
|
|
660
660
|
};
|
|
661
661
|
|
|
662
662
|
this.touchCreateColumns = function (columns) {
|
|
@@ -672,8 +672,20 @@ var _initialiseProps = function _initialiseProps() {
|
|
|
672
672
|
var printValue = _this3.props.printValue || 'print';
|
|
673
673
|
var printFlag = printArr[1] === printValue;
|
|
674
674
|
var recursion = function recursion(arr) {
|
|
675
|
-
|
|
676
|
-
var
|
|
675
|
+
for (var _iterator = arr, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
|
|
676
|
+
var _ref2;
|
|
677
|
+
|
|
678
|
+
if (_isArray) {
|
|
679
|
+
if (_i >= _iterator.length) break;
|
|
680
|
+
_ref2 = _iterator[_i++];
|
|
681
|
+
} else {
|
|
682
|
+
_i = _iterator.next();
|
|
683
|
+
if (_i.done) break;
|
|
684
|
+
_ref2 = _i.value;
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
var item = _ref2;
|
|
688
|
+
|
|
677
689
|
var columnsType = item.type;
|
|
678
690
|
if (item.fixed && printFlag) {
|
|
679
691
|
item.fixed = null;
|
|
@@ -694,15 +706,12 @@ var _initialiseProps = function _initialiseProps() {
|
|
|
694
706
|
break;
|
|
695
707
|
}
|
|
696
708
|
if (item.children) {
|
|
697
|
-
|
|
709
|
+
item.children = recursion(item.children);
|
|
698
710
|
}
|
|
699
|
-
|
|
700
|
-
return itemNew;
|
|
701
|
-
});
|
|
711
|
+
}
|
|
702
712
|
};
|
|
703
713
|
var recursionT = function recursionT(arr) {
|
|
704
|
-
|
|
705
|
-
var itemNew = {};
|
|
714
|
+
var _loop = function _loop(item) {
|
|
706
715
|
if (item.fixed && printFlag) {
|
|
707
716
|
item.fixed = null;
|
|
708
717
|
}
|
|
@@ -725,8 +734,8 @@ var _initialiseProps = function _initialiseProps() {
|
|
|
725
734
|
' ',
|
|
726
735
|
_react2['default'].createElement(
|
|
727
736
|
'a',
|
|
728
|
-
{ onClick: function onClick() {
|
|
729
|
-
return _this3.getImplicit(dataIndex, index);
|
|
737
|
+
{ onClick: function onClick(e) {
|
|
738
|
+
return _this3.getImplicit(e, dataIndex, index);
|
|
730
739
|
} },
|
|
731
740
|
_react2['default'].createElement(_icon2['default'], { type: arrData.length && arrData[index][dataIndex + '-dataDesensitizationEyeFlag'] ? 'eye' : 'eye-invisible' })
|
|
732
741
|
)
|
|
@@ -738,8 +747,8 @@ var _initialiseProps = function _initialiseProps() {
|
|
|
738
747
|
' ',
|
|
739
748
|
_react2['default'].createElement(
|
|
740
749
|
'a',
|
|
741
|
-
{ onClick: function onClick() {
|
|
742
|
-
return _this3.getImplicit(dataIndex, index);
|
|
750
|
+
{ onClick: function onClick(e) {
|
|
751
|
+
return _this3.getImplicit(e, dataIndex, index);
|
|
743
752
|
} },
|
|
744
753
|
_react2['default'].createElement(_icon2['default'], { type: arrData.length && arrData[index][dataIndex + '-dataDesensitizationEyeFlag'] ? 'eye' : 'eye-invisible' })
|
|
745
754
|
)
|
|
@@ -753,8 +762,8 @@ var _initialiseProps = function _initialiseProps() {
|
|
|
753
762
|
' ',
|
|
754
763
|
_react2['default'].createElement(
|
|
755
764
|
'a',
|
|
756
|
-
{ onClick: function onClick() {
|
|
757
|
-
return _this3.getImplicit(dataIndex, index);
|
|
765
|
+
{ onClick: function onClick(e) {
|
|
766
|
+
return _this3.getImplicit(e, dataIndex, index);
|
|
758
767
|
} },
|
|
759
768
|
_react2['default'].createElement(_icon2['default'], { type: arrData.length && arrData[index][dataIndex + '-dataDesensitizationEyeFlag'] ? 'eye' : 'eye-invisible' })
|
|
760
769
|
)
|
|
@@ -784,19 +793,34 @@ var _initialiseProps = function _initialiseProps() {
|
|
|
784
793
|
item.minWidth = 5;
|
|
785
794
|
}
|
|
786
795
|
if (item.children) {
|
|
787
|
-
|
|
796
|
+
item.children = recursionT(item.children);
|
|
788
797
|
}
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
798
|
+
};
|
|
799
|
+
|
|
800
|
+
for (var _iterator2 = arr, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
|
|
801
|
+
var _ref3;
|
|
802
|
+
|
|
803
|
+
if (_isArray2) {
|
|
804
|
+
if (_i2 >= _iterator2.length) break;
|
|
805
|
+
_ref3 = _iterator2[_i2++];
|
|
806
|
+
} else {
|
|
807
|
+
_i2 = _iterator2.next();
|
|
808
|
+
if (_i2.done) break;
|
|
809
|
+
_ref3 = _i2.value;
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
var item = _ref3;
|
|
813
|
+
|
|
814
|
+
_loop(item);
|
|
815
|
+
}
|
|
792
816
|
};
|
|
793
|
-
|
|
817
|
+
recursion(columns);
|
|
794
818
|
if (dataList) {
|
|
795
819
|
if (dataList.length > 0) {
|
|
796
|
-
|
|
820
|
+
recursionT(columns);
|
|
797
821
|
}
|
|
798
822
|
}
|
|
799
|
-
|
|
823
|
+
var columnsNew = columns;
|
|
800
824
|
if (autoAddNumber) {
|
|
801
825
|
if (columnsNew.length > 0) {
|
|
802
826
|
columnsNew = [{
|
|
@@ -814,7 +838,27 @@ var _initialiseProps = function _initialiseProps() {
|
|
|
814
838
|
}].concat(columnsNew);
|
|
815
839
|
}
|
|
816
840
|
}
|
|
817
|
-
return columnsNew;
|
|
841
|
+
return [].concat(columnsNew);
|
|
842
|
+
};
|
|
843
|
+
|
|
844
|
+
this.deepCopy = function (obj) {
|
|
845
|
+
if (typeof obj !== 'object' || obj === null) {
|
|
846
|
+
return obj;
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
var copy = Array.isArray(obj) ? [] : {};
|
|
850
|
+
|
|
851
|
+
for (var key in obj) {
|
|
852
|
+
if (key === 'title' || key === 'filterDropdown') {
|
|
853
|
+
copy[key] = obj[key];
|
|
854
|
+
} else if (key === 'children' && Array.isArray(obj[key]) || typeof obj[key] === 'object') {
|
|
855
|
+
copy[key] = _this3.deepCopy(obj[key]);
|
|
856
|
+
} else {
|
|
857
|
+
copy[key] = obj[key];
|
|
858
|
+
}
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
return copy;
|
|
818
862
|
};
|
|
819
863
|
};
|
|
820
864
|
|