dtable-statistic 5.0.42-alpha.25 → 5.0.42-alpha.27

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.
@@ -210,12 +210,15 @@ const exportOneDimensionToTable = _ref => {
210
210
  const totalColumn = {
211
211
  type: _dtableUtils.CellType.NUMBER,
212
212
  name: _reactIntlUniversal.default.get('Total'),
213
- // data: columnData,
214
213
  data: {
215
- format: 'number'
214
+ decimal: "dot",
215
+ enable_precision: false,
216
+ format: "yuan",
217
+ precision: 2,
218
+ thousands: "no"
216
219
  }
217
220
  };
218
- columnMap['key'] = totalColumn;
221
+ columnMap['total'] = totalColumn;
219
222
  columns.push(totalColumn);
220
223
 
221
224
  // generator rows
@@ -225,6 +228,7 @@ const exportOneDimensionToTable = _ref => {
225
228
  original_name,
226
229
  total
227
230
  } = item;
231
+ let rowTotal = 0;
228
232
  const groupName = isEmptyName(original_name) ? _reactIntlUniversal.default.get(_constants.EMPTY_NAME) : name;
229
233
  let newRow = {
230
234
  [groupbyColumn.name]: groupName
@@ -246,7 +250,10 @@ const exportOneDimensionToTable = _ref => {
246
250
  cellValue = (0, _dayjs.default)(cellValue).format(dateFormat);
247
251
  }
248
252
  newRow[name] = cellValue;
253
+ rowTotal = rowTotal + Number(cellValue);
249
254
  });
255
+ // total row
256
+ newRow[_reactIntlUniversal.default.get('Total')] = rowTotal;
250
257
  rows.push(newRow);
251
258
  });
252
259
  console.log(11, {
@@ -603,18 +610,22 @@ const updatedOneDimensionToTable = _ref5 => {
603
610
  let oldRow = {};
604
611
  Array.isArray(pivot_columns) && pivot_columns.forEach(item => {
605
612
  const {
606
- key,
607
- method
613
+ key
608
614
  } = item;
609
615
  const column = columnMap[key];
610
616
  const cellValueKey = key;
611
617
  const totalCellValue = getValidValueForColumn(column, total[cellValueKey]);
618
+ console.log('column', column);
619
+ console.log('cellValueKey', cellValueKey);
620
+ console.log('totalCellValue', totalCellValue);
612
621
  if (column && (0, _cellValue.isCellValueChanged)(row[column.key], totalCellValue, column.type)) {
622
+ console.log(111);
613
623
  updateRow[column.key] = totalCellValue;
614
624
  oldRow[column.key] = row[column.key];
615
625
  }
616
626
  });
617
627
  if (Object.keys(updateRow).length > 0) {
628
+ console.log(222);
618
629
  const rowId = row._id;
619
630
  rowIds.push(rowId);
620
631
  updatedRows[rowId] = updateRow;
@@ -639,6 +650,12 @@ const updatedOneDimensionToTable = _ref5 => {
639
650
  newRows.push(newRow);
640
651
  }
641
652
  });
653
+ console.log('update', {
654
+ newRows,
655
+ updatedRows,
656
+ rowIds,
657
+ oldRows
658
+ });
642
659
  return {
643
660
  newRows,
644
661
  updatedRows,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dtable-statistic",
3
- "version": "5.0.42-alpha.25",
3
+ "version": "5.0.42-alpha.27",
4
4
  "description": "statistics",
5
5
  "main": "dist/dtable-statistic.js",
6
6
  "author": "seafile",