easy3wui 1.5.55-rc.9 → 1.5.55
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.
|
@@ -111,22 +111,34 @@ var Easy3wEditBigTable = function (_Component) {
|
|
|
111
111
|
};
|
|
112
112
|
|
|
113
113
|
Easy3wEditBigTable.prototype.componentWillUnmount = function componentWillUnmount() {
|
|
114
|
+
var objToolbarProps = this.props.objToolbarProps;
|
|
115
|
+
|
|
116
|
+
var _ref = objToolbarProps || {},
|
|
117
|
+
_ref$unloadSaveFlag = _ref.unloadSaveFlag,
|
|
118
|
+
unloadSaveFlag = _ref$unloadSaveFlag === undefined ? true : _ref$unloadSaveFlag;
|
|
119
|
+
// unloadSaveFlag 是否在卸载后保存 true 需要保存 false 不需要保存
|
|
120
|
+
|
|
121
|
+
|
|
114
122
|
var saveFlag = this.state.saveFlag;
|
|
123
|
+
// saveFlag 是否已保存 true 已保存 false 未保存
|
|
124
|
+
|
|
115
125
|
var saveEditBigTableZJ = this.saveEditBigTableZJ;
|
|
116
126
|
|
|
117
|
-
if (
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
127
|
+
if (unloadSaveFlag) {
|
|
128
|
+
if (saveFlag) {
|
|
129
|
+
// 已保存
|
|
130
|
+
} else {
|
|
131
|
+
// 有变更-未保存
|
|
132
|
+
_modal2['default'].confirm({
|
|
133
|
+
title: '提示',
|
|
134
|
+
content: '表格数据未保存, 是否保存?',
|
|
135
|
+
okText: '保存',
|
|
136
|
+
cancelText: '取消',
|
|
137
|
+
onOk: function onOk() {
|
|
138
|
+
saveEditBigTableZJ();
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
}
|
|
130
142
|
}
|
|
131
143
|
};
|
|
132
144
|
// 绑定组件
|
|
@@ -424,9 +436,9 @@ var _initialiseProps = function _initialiseProps() {
|
|
|
424
436
|
};
|
|
425
437
|
|
|
426
438
|
this.touchCopyRow = function () {
|
|
427
|
-
var
|
|
428
|
-
rows =
|
|
429
|
-
rowsView =
|
|
439
|
+
var _state4 = _this3.state,
|
|
440
|
+
rows = _state4.rows,
|
|
441
|
+
rowsView = _state4.rowsView;
|
|
430
442
|
var arrValues = _this3.state.arrValues;
|
|
431
443
|
|
|
432
444
|
if (arrValues.length) {
|
|
@@ -449,12 +461,12 @@ var _initialiseProps = function _initialiseProps() {
|
|
|
449
461
|
|
|
450
462
|
this.deleteRow = function () {
|
|
451
463
|
var rows = _this3.state.rows;
|
|
452
|
-
var
|
|
453
|
-
arrValues =
|
|
454
|
-
arrValuesInfo =
|
|
455
|
-
var
|
|
456
|
-
objToolbarProps =
|
|
457
|
-
rowKey =
|
|
464
|
+
var _state5 = _this3.state,
|
|
465
|
+
arrValues = _state5.arrValues,
|
|
466
|
+
arrValuesInfo = _state5.arrValuesInfo;
|
|
467
|
+
var _props4 = _this3.props,
|
|
468
|
+
objToolbarProps = _props4.objToolbarProps,
|
|
469
|
+
rowKey = _props4.rowKey;
|
|
458
470
|
var deleteRowInterface = objToolbarProps.deleteRowInterface;
|
|
459
471
|
|
|
460
472
|
if (arrValues.length) {
|
|
@@ -559,17 +571,16 @@ var _initialiseProps = function _initialiseProps() {
|
|
|
559
571
|
};
|
|
560
572
|
|
|
561
573
|
this.confirmCallbackBatchEditBigTable = function (objFormData, objColumn) {
|
|
562
|
-
var
|
|
563
|
-
rows =
|
|
564
|
-
rowsView =
|
|
565
|
-
var
|
|
566
|
-
touchAutoCompute =
|
|
567
|
-
rowKey =
|
|
574
|
+
var _state6 = _this3.state,
|
|
575
|
+
rows = _state6.rows,
|
|
576
|
+
rowsView = _state6.rowsView;
|
|
577
|
+
var _props5 = _this3.props,
|
|
578
|
+
touchAutoCompute = _props5.touchAutoCompute,
|
|
579
|
+
rowKey = _props5.rowKey;
|
|
568
580
|
// const rows = this.getRows();
|
|
569
581
|
|
|
570
|
-
rowsView.map(function (row) {
|
|
571
|
-
var autoAddNumberIdxEdit = row.autoAddNumber_idx_edit
|
|
572
|
-
autoAddNumberIdxView = row.autoAddNumber_idx_view;
|
|
582
|
+
rowsView.map(function (row, index) {
|
|
583
|
+
var autoAddNumberIdxEdit = row.autoAddNumber_idx_edit;
|
|
573
584
|
|
|
574
585
|
var updated = (0, _extends3['default'])({}, objFormData);
|
|
575
586
|
if (touchAutoCompute && typeof touchAutoCompute === 'function') {
|
|
@@ -585,8 +596,8 @@ var _initialiseProps = function _initialiseProps() {
|
|
|
585
596
|
// updated 改变的单元格的新值
|
|
586
597
|
updated = touchAutoCompute({
|
|
587
598
|
cellKey: objColumn.key,
|
|
588
|
-
fromRow:
|
|
589
|
-
toRow:
|
|
599
|
+
fromRow: index,
|
|
600
|
+
toRow: index,
|
|
590
601
|
fromRowId: row[rowKey],
|
|
591
602
|
toRowId: row[rowKey],
|
|
592
603
|
rowIds: [row[rowKey]],
|
|
@@ -597,19 +608,27 @@ var _initialiseProps = function _initialiseProps() {
|
|
|
597
608
|
});
|
|
598
609
|
}
|
|
599
610
|
rows[autoAddNumberIdxEdit] = (0, _extends3['default'])({}, rows[autoAddNumberIdxEdit], updated);
|
|
600
|
-
rowsView[
|
|
611
|
+
rowsView[index] = (0, _extends3['default'])({}, rowsView[index], updated);
|
|
601
612
|
return row;
|
|
602
613
|
});
|
|
603
614
|
_this3.onGridRowsUpdatedZJ('confirmCallbackBatchEditBigTable', rows, rowsView);
|
|
604
615
|
};
|
|
605
616
|
|
|
606
617
|
this.getRows = function (rows) {
|
|
607
|
-
var
|
|
608
|
-
filters =
|
|
609
|
-
sortColumn =
|
|
610
|
-
sortDirection =
|
|
611
|
-
|
|
612
|
-
|
|
618
|
+
var _state7 = _this3.state,
|
|
619
|
+
filters = _state7.filters,
|
|
620
|
+
sortColumn = _state7.sortColumn,
|
|
621
|
+
sortDirection = _state7.sortDirection;
|
|
622
|
+
// 预处理数据,替换 null或undefined 值, 避免查询时报错
|
|
623
|
+
|
|
624
|
+
var cleanedRows = (rows || _this3.state.rows).map(function (row) {
|
|
625
|
+
var cleanedRow = {};
|
|
626
|
+
Object.keys(row).forEach(function (key) {
|
|
627
|
+
cleanedRow[key] = row[key] === null || row[key] === undefined ? '' : row[key]; // 将 null或undefined 替换为空字符串或其他默认值
|
|
628
|
+
});
|
|
629
|
+
return cleanedRow;
|
|
630
|
+
});
|
|
631
|
+
return Selectors.getRows({ rows: cleanedRows, filters: filters, sortColumn: sortColumn, sortDirection: sortDirection });
|
|
613
632
|
};
|
|
614
633
|
|
|
615
634
|
this.getSize = function () {
|
|
@@ -622,7 +641,10 @@ var _initialiseProps = function _initialiseProps() {
|
|
|
622
641
|
var rowsView = _this3.state.rowsView;
|
|
623
642
|
// autoAddNumber_idx_view 自动添加序号 显示数据的索引
|
|
624
643
|
|
|
625
|
-
|
|
644
|
+
if (rowsView[rowIdx]) {
|
|
645
|
+
rowsView[rowIdx].autoAddNumber_idx_view = rowIdx + 1;
|
|
646
|
+
}
|
|
647
|
+
return rowsView[rowIdx];
|
|
626
648
|
};
|
|
627
649
|
|
|
628
650
|
this.touchLoopDataNum = function (dataList) {
|
|
@@ -675,10 +697,10 @@ var _initialiseProps = function _initialiseProps() {
|
|
|
675
697
|
|
|
676
698
|
this.getHearder = function () {
|
|
677
699
|
var columns = _this3.props.columns;
|
|
678
|
-
var
|
|
679
|
-
arrColumnsKey =
|
|
680
|
-
objSheet =
|
|
681
|
-
arrColInfo =
|
|
700
|
+
var _props6 = _this3.props,
|
|
701
|
+
arrColumnsKey = _props6.arrColumnsKey,
|
|
702
|
+
objSheet = _props6.objSheet,
|
|
703
|
+
arrColInfo = _props6.arrColInfo;
|
|
682
704
|
|
|
683
705
|
|
|
684
706
|
var arrColumnsKeyNew = ['id'];
|
|
@@ -907,23 +929,48 @@ var _initialiseProps = function _initialiseProps() {
|
|
|
907
929
|
};
|
|
908
930
|
|
|
909
931
|
this.touchRowRenderer = function (obj) {
|
|
910
|
-
var
|
|
932
|
+
var _props7 = _this3.props,
|
|
933
|
+
onCheckCellIsEditable = _props7.onCheckCellIsEditable,
|
|
934
|
+
touchSetRowClass = _props7.touchSetRowClass,
|
|
935
|
+
touchSetRowStyle = _props7.touchSetRowStyle;
|
|
911
936
|
var renderBaseRow = obj.renderBaseRow,
|
|
912
937
|
columns = obj.columns,
|
|
913
938
|
row = obj.row,
|
|
914
939
|
idx = obj.idx;
|
|
915
940
|
|
|
916
941
|
var onCheckCellIsEditableNew = onCheckCellIsEditable || _this3.onCheckCellIsEditable;
|
|
917
|
-
var columnsNew = []
|
|
942
|
+
var columnsNew = [];
|
|
943
|
+
// 单元格样式
|
|
918
944
|
columns.map(function (column, index) {
|
|
945
|
+
var touchSetCellClass = column.touchSetCellClass;
|
|
946
|
+
|
|
947
|
+
var cellClass = column.cellClass || '';
|
|
948
|
+
|
|
949
|
+
// 单元格样式
|
|
950
|
+
if (touchSetCellClass && typeof touchSetCellClass === 'function') {
|
|
951
|
+
cellClass += touchSetCellClass({ column: column, idx: idx, row: row, columnIndex: index });
|
|
952
|
+
}
|
|
953
|
+
// 编辑单元格样式
|
|
919
954
|
if (onCheckCellIsEditableNew({ column: column, idx: idx, row: row })) {
|
|
920
|
-
|
|
955
|
+
cellClass += 'custom-edit-cell'; // 编辑单元格样式
|
|
921
956
|
}
|
|
957
|
+
columnsNew.push((0, _extends3['default'])({}, column, { cellClass: cellClass }));
|
|
922
958
|
return column;
|
|
923
959
|
});
|
|
960
|
+
// 行样式-行class
|
|
961
|
+
var rowClass = '';
|
|
962
|
+
if (touchSetRowClass && typeof touchSetRowClass === 'function') {
|
|
963
|
+
rowClass = touchSetRowClass({ row: row, idx: idx, obj: obj });
|
|
964
|
+
}
|
|
965
|
+
// 行样式-行style
|
|
966
|
+
var rowStyle = {};
|
|
967
|
+
if (touchSetRowStyle && typeof touchSetRowStyle === 'function') {
|
|
968
|
+
rowStyle = touchSetRowStyle({ row: row, idx: idx, obj: obj });
|
|
969
|
+
}
|
|
970
|
+
|
|
924
971
|
return _react2['default'].createElement(
|
|
925
972
|
'span',
|
|
926
|
-
|
|
973
|
+
{ className: rowClass, style: rowStyle },
|
|
927
974
|
renderBaseRow((0, _extends3['default'])({}, obj, {
|
|
928
975
|
columns: [].concat(columnsNew)
|
|
929
976
|
}))
|
|
@@ -970,7 +1017,7 @@ var _initialiseProps = function _initialiseProps() {
|
|
|
970
1017
|
onRowsDeselected: _this3.onRowsDeselected,
|
|
971
1018
|
selectBy: {
|
|
972
1019
|
keys: {
|
|
973
|
-
rowKey: rowKey
|
|
1020
|
+
rowKey: rowKey,
|
|
974
1021
|
values: arrValues
|
|
975
1022
|
}
|
|
976
1023
|
// indexes: this.state.arrValues,
|
|
@@ -1018,8 +1065,8 @@ var _initialiseProps = function _initialiseProps() {
|
|
|
1018
1065
|
this.saveEditBigTableZJ = function () {
|
|
1019
1066
|
var objToolbarProps = _this3.props.objToolbarProps;
|
|
1020
1067
|
|
|
1021
|
-
var
|
|
1022
|
-
saveEditBigTable =
|
|
1068
|
+
var _ref2 = objToolbarProps || {},
|
|
1069
|
+
saveEditBigTable = _ref2.saveEditBigTable;
|
|
1023
1070
|
|
|
1024
1071
|
if (saveEditBigTable && typeof saveEditBigTable === 'function') {
|
|
1025
1072
|
// 数据变更-回调函数
|
|
@@ -1045,9 +1092,8 @@ var _initialiseProps = function _initialiseProps() {
|
|
|
1045
1092
|
};
|
|
1046
1093
|
|
|
1047
1094
|
this.checkData = function () {
|
|
1048
|
-
var
|
|
1049
|
-
|
|
1050
|
-
rows = _props10.rows;
|
|
1095
|
+
var rows = _this3.state.rows;
|
|
1096
|
+
var columns = _this3.props.columns;
|
|
1051
1097
|
|
|
1052
1098
|
var strCheckFailRows = ''; // 校验失败的行号
|
|
1053
1099
|
var arrRequiredMessage = []; // 必填提示信息
|
|
@@ -1085,31 +1131,34 @@ var _initialiseProps = function _initialiseProps() {
|
|
|
1085
1131
|
}
|
|
1086
1132
|
}
|
|
1087
1133
|
});
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
'
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1134
|
+
if (strCheckFailRows) {
|
|
1135
|
+
// 校验失败
|
|
1136
|
+
_modal2['default'].error({
|
|
1137
|
+
title: '校验失败',
|
|
1138
|
+
content: _react2['default'].createElement(
|
|
1139
|
+
'div',
|
|
1140
|
+
null,
|
|
1141
|
+
arrRequiredMessage.map(function (item, index) {
|
|
1142
|
+
return index === 0 ? _react2['default'].createElement(
|
|
1143
|
+
'span',
|
|
1144
|
+
null,
|
|
1145
|
+
item
|
|
1146
|
+
) : _react2['default'].createElement(
|
|
1147
|
+
'span',
|
|
1148
|
+
null,
|
|
1149
|
+
_react2['default'].createElement('br', null),
|
|
1150
|
+
item
|
|
1151
|
+
);
|
|
1152
|
+
})
|
|
1153
|
+
)
|
|
1154
|
+
});
|
|
1155
|
+
console.error(arrRequiredMessage, strCheckFailRows);
|
|
1156
|
+
}
|
|
1108
1157
|
return { arrRequiredMessage: arrRequiredMessage, strCheckFailRows: strCheckFailRows };
|
|
1109
1158
|
};
|
|
1110
1159
|
|
|
1111
1160
|
this.touchFormatNum = function (num) {
|
|
1112
|
-
return !isNaN(num) && isFinite(num) ? (0, _numeral2['default'])(num).format('0,0.00') : num || '';
|
|
1161
|
+
return num !== '' && !isNaN(num) && isFinite(num) ? (0, _numeral2['default'])(num).format('0,0.00') : num || '';
|
|
1113
1162
|
};
|
|
1114
1163
|
};
|
|
1115
1164
|
|