easy3wui 1.5.55-beta9 → 1.5.55-rc.2

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.
@@ -32,6 +32,8 @@ var _antd = require('antd');
32
32
 
33
33
  var _easy3wui = require('easy3wui');
34
34
 
35
+ var _lib = require('antd/lib');
36
+
35
37
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
36
38
 
37
39
  var Easy3wEditBigTableForm = function (_PureComponent) {
@@ -186,7 +188,22 @@ var Easy3wEditBigTableForm = function (_PureComponent) {
186
188
  var columns = objOtherParameters.columns;
187
189
 
188
190
  var objColumn = columns[batchField];
189
- confirmCallback(valuesNew, objColumn);
191
+ var strName = objColumn.strName,
192
+ name = objColumn.name;
193
+ // key 字段
194
+ // required 必填
195
+ // strName 字串名称
196
+ // name 字段名称
197
+
198
+ _lib.Modal.confirm({
199
+ content: '\u8BF7\u786E\u8BA4\u6B64\u5217' + (strName || name) + '\u5168\u90E8\u8BBE\u7F6E\u6210\u5F55\u5165\u503C\uFF0C\u5C06\u8986\u76D6\u539F\u503C!',
200
+ onOk: function onOk() {
201
+ confirmCallback(valuesNew, objColumn);
202
+ },
203
+ onCancel: function onCancel() {},
204
+ okText: '确认',
205
+ cancelText: '取消'
206
+ });
190
207
  }
191
208
  _this.touchCancel();
192
209
  }
@@ -234,7 +251,7 @@ var Easy3wEditBigTableForm = function (_PureComponent) {
234
251
  form = _props.form;
235
252
  var batchButtonText = objOtherParameters.batchButtonText;
236
253
 
237
- var footBtnArr = [{ func: this.touchConfirm, cName: '保存' }, { func: this.touchCancel, cName: '取消' }];
254
+ var footBtnArr = [{ func: this.touchConfirm, cName: '保存' }, { func: this.touchCancel, cName: '关闭' }];
238
255
 
239
256
  var _getBatchField = this.getBatchField(),
240
257
  fieldRowItems = _getBatchField.fieldRowItems,
@@ -71,24 +71,39 @@ var Easy3wEditBigTable = function (_Component) {
71
71
  };
72
72
 
73
73
  _this.onGridRowsUpdated = function (objUpdated) {
74
- var fromRowData = objUpdated.fromRowData;
74
+ var fromRow = objUpdated.fromRow,
75
+ toRow = objUpdated.toRow,
76
+ fromRowData = objUpdated.fromRowData,
77
+ action = objUpdated.action,
78
+ cellKey = objUpdated.cellKey;
75
79
  var updated = objUpdated.updated;
80
+
81
+ if (action === 'COPY_PASTE') {
82
+ updated[cellKey] = fromRowData[cellKey];
83
+ }
76
84
  var _this$props = _this.props,
77
85
  touchAutoCompute = _this$props.touchAutoCompute,
78
- onGridRowsUpdated = _this$props.onGridRowsUpdated,
79
- dataList = _this$props.dataList;
86
+ dataList = _this$props.dataList; // dataList 表格数据
80
87
 
81
- if (touchAutoCompute && typeof touchAutoCompute === 'function') {
82
- // 数据变更-自动计算行数据
83
- updated = touchAutoCompute(objUpdated);
84
- }
85
- var autoAddNumberIdxEdit = fromRowData.autoAddNumber_idx_edit;
88
+ var rows = _this.getRows(); // 显示行数据
86
89
 
87
- dataList[autoAddNumberIdxEdit] = (0, _extends3['default'])({}, fromRowData, updated);
88
- if (onGridRowsUpdated && typeof onGridRowsUpdated === 'function') {
89
- // 数据变更-回调函数
90
- onGridRowsUpdated('onGridRowsUpdated', dataList);
90
+ for (var i = fromRow; i <= toRow;) {
91
+ var objRowToUpdate = rows[i] || {};
92
+ // let rowToUpdate = rows[i];
93
+ // let updatedRow = update(rowToUpdate, {$merge: updated});
94
+ // rows[i] = updatedRow;
95
+
96
+ if (touchAutoCompute && typeof touchAutoCompute === 'function') {
97
+ // 数据变更-自动计算行数据
98
+ updated = touchAutoCompute((0, _extends3['default'])({}, objUpdated, { toRowData: (0, _extends3['default'])({}, objRowToUpdate) }));
99
+ }
100
+ var autoAddNumberIdxEdit = objRowToUpdate.autoAddNumber_idx_edit;
101
+
102
+ dataList[autoAddNumberIdxEdit] = (0, _extends3['default'])({}, objRowToUpdate, updated);
103
+ i += 1;
91
104
  }
105
+
106
+ _this.onGridRowsUpdatedZJ('onGridRowsUpdated', dataList);
92
107
  };
93
108
 
94
109
  _this.onGridSort = function (sortColumn, sortDirection) {
@@ -99,7 +114,9 @@ var Easy3wEditBigTable = function (_Component) {
99
114
  var _this$state = _this.state,
100
115
  arrValues = _this$state.arrValues,
101
116
  arrValuesInfo = _this$state.arrValuesInfo;
102
- var rowKey = _this.props.rowKey;
117
+ var _this$props2 = _this.props,
118
+ rowKey = _this$props2.rowKey,
119
+ onRowsSelectedCb = _this$props2.onRowsSelectedCb;
103
120
 
104
121
  var arrValuesNew = []; // 表格选择行索引
105
122
  var arrValuesInfoNew = []; // 表格选择行数据
@@ -110,17 +127,23 @@ var Easy3wEditBigTable = function (_Component) {
110
127
  });
111
128
  arrValues = arrValues.concat(arrValuesNew); // 表格选择行索引
112
129
  arrValuesInfo = arrValuesInfo.concat(arrValuesInfoNew); // 表格选择行数据
130
+ if (onRowsSelectedCb && typeof onRowsSelectedCb === 'function') {
131
+ // 表格选择回调函数
132
+ onRowsSelectedCb('onRowsSelected', arrValues, arrValuesInfo, arrValuesNew, arrValuesInfoNew);
133
+ }
113
134
  _this.onSelectedRowsChange(arrValues, arrValuesInfo);
114
135
  };
115
136
 
116
137
  _this.onRowsDeselected = function (rows) {
117
- var _this$state2 = _this.state,
118
- arrValues = _this$state2.arrValues,
119
- arrValuesInfo = _this$state2.arrValuesInfo;
120
- var rowKey = _this.props.rowKey;
138
+ var arrValuesInfo = _this.state.arrValuesInfo;
139
+ var _this$props3 = _this.props,
140
+ rowKey = _this$props3.rowKey,
141
+ onRowsSelectedCb = _this$props3.onRowsSelectedCb;
121
142
 
122
143
  var arrValuesNew = []; // 表格选择行索引
123
144
  var arrValuesInfoNew = []; // 表格选择行数据
145
+ var arrSelected = []; // 已选择的行索引
146
+ var arrSelectedInfo = []; // 已选择的行数据
124
147
  arrValuesInfo.filter(function (item) {
125
148
  var flag = true;
126
149
  rows.map(function (r) {
@@ -129,6 +152,8 @@ var Easy3wEditBigTable = function (_Component) {
129
152
  if (item[rowKey] === row[rowKey]) {
130
153
  // 删除已取消选择的行
131
154
  flag = false;
155
+ arrSelected.push(item[rowKey]);
156
+ arrSelectedInfo.push(item);
132
157
  }
133
158
  return r;
134
159
  });
@@ -138,7 +163,11 @@ var Easy3wEditBigTable = function (_Component) {
138
163
  }
139
164
  return flag;
140
165
  });
141
- _this.onSelectedRowsChange(arrValues, arrValuesInfo);
166
+ if (onRowsSelectedCb && typeof onRowsSelectedCb === 'function') {
167
+ // 表格选择回调函数
168
+ onRowsSelectedCb('onRowsDeselected', arrValuesNew, arrValuesInfoNew, arrSelected, arrSelectedInfo);
169
+ }
170
+ _this.onSelectedRowsChange(arrValuesNew, arrValuesInfoNew);
142
171
  };
143
172
 
144
173
  _this.onSelectedRowsChange = function (arrValues, arrValuesInfo) {
@@ -146,21 +175,14 @@ var Easy3wEditBigTable = function (_Component) {
146
175
  };
147
176
 
148
177
  _this.touchAddRow = function () {
149
- var _this$props2 = _this.props,
150
- onGridRowsUpdated = _this$props2.onGridRowsUpdated,
151
- dataList = _this$props2.dataList;
178
+ var dataList = _this.props.dataList;
152
179
 
153
180
  var dataListNew = [].concat(dataList, [{}]);
154
- if (onGridRowsUpdated && typeof onGridRowsUpdated === 'function') {
155
- // 数据变更-回调函数
156
- onGridRowsUpdated('touchAddRow', dataListNew);
157
- }
181
+ _this.onGridRowsUpdatedZJ('touchAddRow', dataListNew);
158
182
  };
159
183
 
160
184
  _this.touchCopyRow = function () {
161
- var _this$props3 = _this.props,
162
- onGridRowsUpdated = _this$props3.onGridRowsUpdated,
163
- dataList = _this$props3.dataList;
185
+ var dataList = _this.props.dataList;
164
186
  var arrValues = _this.state.arrValues;
165
187
 
166
188
  if (arrValues.length) {
@@ -171,10 +193,7 @@ var Easy3wEditBigTable = function (_Component) {
171
193
  return key;
172
194
  });
173
195
  var dataListNew = [].concat(dataList, newArr);
174
- if (onGridRowsUpdated && typeof onGridRowsUpdated === 'function') {
175
- // 数据变更-回调函数
176
- onGridRowsUpdated('touchCopyRow', dataListNew);
177
- }
196
+ _this.onGridRowsUpdatedZJ('touchCopyRow', dataListNew);
178
197
  } else {
179
198
  _modal2['default'].error({
180
199
  title: '错误',
@@ -186,7 +205,6 @@ var Easy3wEditBigTable = function (_Component) {
186
205
  _this.deleteRow = function () {
187
206
  var _this$props4 = _this.props,
188
207
  dataList = _this$props4.dataList,
189
- onGridRowsUpdated = _this$props4.onGridRowsUpdated,
190
208
  objToolbarProps = _this$props4.objToolbarProps,
191
209
  rowKey = _this$props4.rowKey;
192
210
  var deleteRowInterface = objToolbarProps.deleteRowInterface;
@@ -211,10 +229,7 @@ var Easy3wEditBigTable = function (_Component) {
211
229
  // 删除行接口
212
230
  deleteRowInterface(dataListDel, arrValues);
213
231
  }
214
- if (onGridRowsUpdated && typeof onGridRowsUpdated === 'function') {
215
- // 数据变更-回调函数
216
- onGridRowsUpdated('deleteRow', dataListNew);
217
- }
232
+ _this.onGridRowsUpdatedZJ('deleteRow', dataListNew);
218
233
  _this.onSelectedRowsChange([], []); // 选择行清空
219
234
  } else {
220
235
  _modal2['default'].error({
@@ -231,8 +246,6 @@ var Easy3wEditBigTable = function (_Component) {
231
246
  var file = e.target.files[0];
232
247
  var reader = new FileReader();
233
248
  reader.onload = function (event) {
234
- var onGridRowsUpdated = _this.props.onGridRowsUpdated;
235
-
236
249
  var _this$getHearder = _this.getHearder(),
237
250
  arrColumnsKey = _this$getHearder.arrColumnsKey;
238
251
 
@@ -241,11 +254,8 @@ var Easy3wEditBigTable = function (_Component) {
241
254
  var firstSheetName = workbook.SheetNames[0];
242
255
  var worksheet = workbook.Sheets[firstSheetName];
243
256
  var rows = _xlsx2['default'].utils.sheet_to_json(worksheet, { header: arrColumnsKey });
244
- rows.shift();
245
- if (onGridRowsUpdated && typeof onGridRowsUpdated === 'function') {
246
- // 数据变更-回调函数
247
- onGridRowsUpdated('touchImport', rows);
248
- }
257
+ rows.shift(); // 去掉表头
258
+ _this.onGridRowsUpdatedZJ('touchImport', rows);
249
259
  };
250
260
  reader.readAsBinaryString(file);
251
261
  };
@@ -298,12 +308,8 @@ var Easy3wEditBigTable = function (_Component) {
298
308
  _this.confirmCallbackBatchEditBigTable = function (objFormData, objColumn) {
299
309
  var _this$props5 = _this.props,
300
310
  touchAutoCompute = _this$props5.touchAutoCompute,
301
- onGridRowsUpdated = _this$props5.onGridRowsUpdated,
302
311
  dataList = _this$props5.dataList,
303
312
  rowKey = _this$props5.rowKey;
304
- // if (touchAutoCompute && typeof touchAutoCompute === 'function') { // 数据变更-自动计算行数据
305
- // updated = touchAutoCompute(objUpdated);
306
- // }
307
313
 
308
314
  var rows = _this.getRows();
309
315
  rows.map(function (row) {
@@ -313,7 +319,7 @@ var Easy3wEditBigTable = function (_Component) {
313
319
  var updated = (0, _extends3['default'])({}, objFormData);
314
320
  if (touchAutoCompute && typeof touchAutoCompute === 'function') {
315
321
  // 数据变更-自动计算行数据
316
- // action 改变的动作类型,'CELL_UPDATE' 单元格更新,'CELL_BATCH_CHANGE' 单元格批量更新
322
+ // action 改变的动作类型,'CELL_UPDATE' 单元格更新,'CELL_BATCH_CHANGE' 单元格批量更新 CELL_UPDATE, COLUMN_FILL, COPY_PASTE, CELL_DRAG
317
323
  // cellKey 改变的单元格的key
318
324
  // fromRow 改变的单元格的原来行序号
319
325
  // fromRowData 改变的单元格的原来行数据
@@ -322,22 +328,30 @@ var Easy3wEditBigTable = function (_Component) {
322
328
  // toRow 改变的单元格的新行序号
323
329
  // toRowId 改变的单元格的新行id
324
330
  // updated 改变的单元格的新值
325
- updated = touchAutoCompute({ cellKey: objColumn.key, fromRow: autoAddNumberIdxView, toRow: autoAddNumberIdxView, fromRowId: row[rowKey], toRowId: row[rowKey], rowIds: [row[rowKey]], updated: updated, action: 'CELL_BATCH_CHANGE', fromRowData: row });
331
+ updated = touchAutoCompute({
332
+ cellKey: objColumn.key,
333
+ fromRow: autoAddNumberIdxView,
334
+ toRow: autoAddNumberIdxView,
335
+ fromRowId: row[rowKey],
336
+ toRowId: row[rowKey],
337
+ rowIds: [row[rowKey]],
338
+ updated: updated,
339
+ action: 'CELL_BATCH_CHANGE',
340
+ fromRowData: row,
341
+ toRowData: row
342
+ });
326
343
  }
327
344
  dataList[autoAddNumberIdxEdit] = (0, _extends3['default'])({}, row, updated);
328
345
  return row;
329
346
  });
330
- if (onGridRowsUpdated && typeof onGridRowsUpdated === 'function') {
331
- // 数据变更-回调函数
332
- onGridRowsUpdated('confirmCallbackBatchEditBigTable', dataList);
333
- }
347
+ _this.onGridRowsUpdatedZJ('confirmCallbackBatchEditBigTable', dataList);
334
348
  };
335
349
 
336
350
  _this.getRows = function () {
337
- var _this$state3 = _this.state,
338
- filters = _this$state3.filters,
339
- sortColumn = _this$state3.sortColumn,
340
- sortDirection = _this$state3.sortDirection;
351
+ var _this$state2 = _this.state,
352
+ filters = _this$state2.filters,
353
+ sortColumn = _this$state2.sortColumn,
354
+ sortDirection = _this$state2.sortDirection;
341
355
  var _this$props6 = _this.props,
342
356
  dataList = _this$props6.dataList,
343
357
  enableCellSelect = _this$props6.enableCellSelect,
@@ -507,7 +521,7 @@ var Easy3wEditBigTable = function (_Component) {
507
521
  ) : '',
508
522
  saveFlag ? _react2['default'].createElement(
509
523
  'button',
510
- { type: 'button', className: 'btn', onClick: saveEditBigTable },
524
+ { type: 'button', className: 'btn', onClick: _this.saveEditBigTableZJ },
511
525
  saveButtonText || '保存'
512
526
  ) : '',
513
527
  deleteFlag ? _react2['default'].createElement(
@@ -648,6 +662,36 @@ var Easy3wEditBigTable = function (_Component) {
648
662
  return columnsNew;
649
663
  };
650
664
 
665
+ _this.onGridRowsUpdatedZJ = function (operationType, dataList) {
666
+ var onGridRowsUpdated = _this.props.onGridRowsUpdated;
667
+
668
+ if (onGridRowsUpdated && typeof onGridRowsUpdated === 'function') {
669
+ // 数据变更-回调函数
670
+ onGridRowsUpdated(operationType, dataList);
671
+ _this.touchSetSaveFlag(false);
672
+ }
673
+ };
674
+
675
+ _this.saveEditBigTableZJ = function () {
676
+ var objToolbarProps = _this.props.objToolbarProps;
677
+
678
+ var _ref = objToolbarProps || {},
679
+ saveEditBigTable = _ref.saveEditBigTable;
680
+
681
+ if (saveEditBigTable && typeof saveEditBigTable === 'function') {
682
+ // 数据变更-回调函数
683
+ saveEditBigTable('saveEditBigTableZJ', function () {
684
+ return _this.touchSetSaveFlag(true);
685
+ });
686
+ }
687
+ };
688
+
689
+ _this.touchSetSaveFlag = function (saveFlag) {
690
+ _this.setState({
691
+ saveFlag: saveFlag // 保存标识 true 已保存 false 未保存
692
+ });
693
+ };
694
+
651
695
  _this.checkReactDataGridData = function () {
652
696
  var clearFiltersFlag = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
653
697
 
@@ -732,14 +776,34 @@ var Easy3wEditBigTable = function (_Component) {
732
776
  sortColumn: null, // 排序列
733
777
  sortDirection: null, // 排序方向
734
778
  // 批量录入
735
- visible: false // 隐藏批量录入Modal
779
+ visible: false, // 隐藏批量录入Modal
780
+ // 保存标识
781
+ saveFlag: true // 保存标识 true 已保存 false 未保存
736
782
  };
737
783
  return _this;
738
784
  }
739
785
 
740
786
  Easy3wEditBigTable.prototype.componentDidMount = function componentDidMount() {};
741
787
 
742
- Easy3wEditBigTable.prototype.componentWillUnmount = function componentWillUnmount() {};
788
+ Easy3wEditBigTable.prototype.componentWillUnmount = function componentWillUnmount() {
789
+ var saveFlag = this.state.saveFlag;
790
+ var saveEditBigTableZJ = this.saveEditBigTableZJ;
791
+
792
+ if (saveFlag) {
793
+ // 已保存
794
+ } else {
795
+ // 有变更-未保存
796
+ _modal2['default'].confirm({
797
+ title: '提示',
798
+ content: '表格数据未保存, 是否保存?',
799
+ okText: '保存',
800
+ cancelText: '取消',
801
+ onOk: function onOk() {
802
+ saveEditBigTableZJ();
803
+ }
804
+ });
805
+ }
806
+ };
743
807
  // 绑定组件
744
808
 
745
809
  // 获取列表
@@ -805,6 +869,14 @@ var Easy3wEditBigTable = function (_Component) {
805
869
  // 创建columns
806
870
 
807
871
  // #endregion 设置ReactDataGrid属性
872
+ // #region 保存
873
+ // 保存表格数据
874
+
875
+ // 保存表格数据
876
+
877
+ // 设置保存标识
878
+
879
+ // #endregion 保存
808
880
  // #region 校验数据
809
881
  // 校验处理
810
882
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "easy3wui",
3
- "version": "1.5.55-beta9",
3
+ "version": "1.5.55-rc.2",
4
4
  "description": "easy3wui components for react",
5
5
  "keywords": [
6
6
  "react",