@indfnd/common 1.0.15 → 1.0.18

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/CHANGELOG.md CHANGED
@@ -2,6 +2,17 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [1.0.18](http://git.inspur.com/imp-ec/ind-front/ind-common-front/compare/v1.0.17...v1.0.18) (2024-07-10)
6
+
7
+ ### [1.0.17](http://git.inspur.com/imp-ec/ind-front/ind-common-front/compare/v1.0.16...v1.0.17) (2024-07-10)
8
+
9
+ ### [1.0.16](http://git.inspur.com/imp-ec/ind-front/ind-common-front/compare/v1.0.15...v1.0.16) (2024-07-10)
10
+
11
+
12
+ ### Features
13
+
14
+ * 同步移动端表格修改内容表格 ([085ad56](http://git.inspur.com/imp-ec/ind-front/ind-common-front/commit/085ad56e9198574c540af7c205096eeeca7b1b08))
15
+
5
16
  ### [1.0.15](http://git.inspur.com/imp-ec/ind-front/ind-common-front/compare/v1.0.14...v1.0.15) (2024-07-08)
6
17
 
7
18
 
@@ -2,7 +2,7 @@ import { Button as Button$1, ButtonGroup as ButtonGroup$1, Input, Drawer as Draw
2
2
  import { isNil, formatDate as formatDate$1, useConfig, getQuarterNum, formatQuarter, str2Date, isDate, isArray, checkIdCard, checkVehicleNo, checkPhone, getDictMapApi, axios, isFunction, isString, uuid, exportJsonToExcel as exportJsonToExcel$1, importJsonFromExcel, on, off, deleteMenuHistoryApi, deleteMenuCollectApi, getMenuHistoryApi, getMenuCollectApi, getPermissionCache, listItemTreeApi, getPriceInfo, MIME_TYPE, base64ToBlob, putOssFileApi, isEqual, getCaptchaURL, getLocalStorage, guid, setLocalStorage, removeLocalStorage, clearSessionStorage, cryptor, getToken, putOssFileUrl, getOssFileUrl, responseInterceptors, config as config$1, setToken, loginApi, clearUserInfoCache, clearPermissionCache, logoutApi, getUserInfoCache, getUserInfoApi, setUserInfoCache, getSessionStorage, setSessionStorage, getAppListApi, getPermissionApi, setPermissionCache, menuHistoryApi, addMenuCollectApi, removeMenuCollectApi, getIndexDescCache, listIndexDescApi, setIndexDescCache } from "@indfnd/utils";
3
3
  import Vue$1 from "vue";
4
4
  const name$1 = "@indfnd/common";
5
- const version = "1.0.14";
5
+ const version = "1.0.17";
6
6
  const author = "huxuetong";
7
7
  const publishConfig = {
8
8
  registry: "https://registry.npmjs.org/"
@@ -53858,7 +53858,7 @@ var render$Y = function() {
53858
53858
  var _c = _vm._self._c || _h;
53859
53859
  return _c("div", { staticClass: "lambo-grid-table", class: [_vm.fullSreen ? "fullscreen-fixed" : ""] }, [_c("div", { directives: [{ name: "show", rawName: "v-show", value: _vm.$slots.search, expression: "$slots.search" }], ref: "search", staticClass: "search" }, [_vm._t("search")], 2), _c("div", { directives: [{ name: "show", rawName: "v-show", value: _vm.$slots.tip, expression: "$slots.tip" }], ref: "tip", staticClass: "tip" }, [_vm._t("tip")], 2), _c("div", { directives: [{ name: "show", rawName: "v-show", value: _vm.$slots.important - _vm.tip, expression: "$slots.important - tip" }], ref: "important-tip", staticClass: "important-tip" }, [_c("Icon", { attrs: { "type": "md-information-circle" } }), _vm._t("important-tip")], 2), _c("div", { ref: "buttons", staticClass: "other-button" }, [_c("Row", [[_c("i-col", { staticStyle: { "text-align": "left" }, attrs: { "flex": "1 1 0%" } }, [_vm.showUnitSwitch && _vm.isShowUnitSwitch ? _c("IndUnitRadio", { staticStyle: { "margin-top": "var(--ind-unit-switch-bottom)", "line-height": "1", "margin-left": "10px" }, attrs: { "isShowWX": _vm.isShowWX, "isShowJ": _vm.isShowJ }, model: { value: _vm.unitType, callback: function($$v) {
53860
53860
  _vm.unitType = $$v;
53861
- }, expression: "unitType" } }) : _vm._e()], 1)], _c("i-col", { directives: [{ name: "show", rawName: "v-show", value: _vm.showUnitSwitch && _vm.isShowUnitSwitch || _vm.showTableOption || _vm.$slots.options, expression: "(showUnitSwitch && isShowUnitSwitch) || showTableOption || $slots.options" }], staticStyle: { "text-align": "right" }, attrs: { "flex": "0 0 auto" } }, [_c("div", { staticClass: "ind-flex end" }, [_c("div", { staticStyle: { "line-height": "var(--ivu-form-item-content-line-height)", "padding-bottom": "calc(var(--ind-table-button-padding) + 2px)", "margin-right": "10px" } }, [_vm._t("options")], 2)])])], 2)], 1), _c("IndLoadingPanel", { attrs: { "loading": _vm.tableLoading } }, [!_vm.refreshTable ? _c("ag-grid-vue", _vm._g(_vm._b({ ref: "tableRef", staticClass: "ag-theme-balham", style: { height: _vm.height && !_vm.fullSreen ? _vm.height + "px" : "100%" }, attrs: { "id": "agTable", "suppressCellFocus": true, "suppressMenu": true, "suppressContextMenu": _vm.rowSelection != "multiple", "defaultColDef": _vm.defaultColDef, "headerHeight": _vm.headerHeight, "getRowHeight": _vm.getRowHeight, "rowData": _vm.rowDataFiltered, "suppressRowClickSelection": _vm.isPc || _vm.isEditTable || _vm.suppressRowClickSelection, "rowSelection": _vm.rowSelection, "rowMultiSelectWithClick": !_vm.isPc && !_vm.isEditTable && (_vm.rowSelection == "multiple" || _vm.rowMultiSelectWithClick), "columnDefs": _vm.tableColumns, "localeText": _vm.localeText, "singleClickEdit": true, "pinnedTopRowData": _vm.topRows, "pinnedBottomRowData": _vm.pinnedBottomRowData, "suppressRowTransform": true, "stopEditingWhenCellsLoseFocus": true, "getRowClass": _vm.getRowClassCommon, "getRowId": _vm.getRowId, "tooltipShowDelay": 500, "overlayNoRowsTemplate": _vm.noRowsTemplate || _vm.overlayNoRowsTemplate, "treeData": _vm.treeData, "getDataPath": _vm.getDataPath, "autoGroupColumnDef": _vm.autoGroupColumnDef, "groupDisplayType": _vm.groupDisplayType, "groupSelectsChildren": _vm.groupSelectsChildren, "groupDefaultExpanded": _vm.groupDefaultExpanded, "getContextMenuItems": _vm.getContextMenuItems }, on: { "sortChanged": _vm.sortChanged, "selection-changed": _vm.selectionChanged, "rowSelected": _vm.rowSelected, "grid-ready": _vm.onGridReady, "cellClicked": _vm.cellClicked, "cellDoubleClicked": _vm.cellDoubleClicked } }, "ag-grid-vue", _vm.$attrs, false), _vm.$listeners)) : _vm._e()], 1), _vm.showBottom ? _c("div", { ref: "bottom" }, [_c("Row", { staticStyle: { "margin-top": "10px" } }, [_c("i-col", { staticStyle: { "text-align": "left" }, attrs: { "span": "18" } }, [_c("Page", { directives: [{ name: "show", rawName: "v-show", value: !_vm.disablePage, expression: "!disablePage" }], attrs: { "size": "small", "total": _vm.totalNumber, "current": _vm.currentPage, "page-size": _vm.limitNumber, "show-sizer": "", "show-total": "", "show-elevator": "" }, on: { "on-change": _vm.onPageChange, "on-page-size-change": _vm.onPageSizeChange } }), _c("span", { directives: [{ name: "show", rawName: "v-show", value: _vm.disablePage, expression: "disablePage" }] }, [_vm._v("\u5171 " + _vm._s(_vm.tableData.length) + " \u6761\u6570\u636E")])], 1)], 1)], 1) : _vm._e()], 1);
53861
+ }, expression: "unitType" } }) : _vm._e()], 1)], _c("i-col", { directives: [{ name: "show", rawName: "v-show", value: _vm.showUnitSwitch && _vm.isShowUnitSwitch || _vm.showTableOption || _vm.$slots.options, expression: "(showUnitSwitch && isShowUnitSwitch) || showTableOption || $slots.options" }], staticStyle: { "text-align": "right" }, attrs: { "flex": "0 0 auto" } }, [_c("div", { staticClass: "ind-flex end" }, [_c("div", { staticStyle: { "line-height": "var(--ivu-form-item-content-line-height)", "padding-bottom": "calc(var(--ind-table-button-padding) + 2px)", "margin-right": "10px" } }, [_vm._t("options")], 2)])])], 2)], 1), _c("IndLoadingPanel", { attrs: { "loading": _vm.tableLoading } }, [!_vm.refreshTable ? _c("ag-grid-vue", _vm._g(_vm._b({ ref: "tableRef", staticClass: "ag-theme-balham", style: { height: _vm.height && !_vm.fullSreen ? _vm.height + "px" : "100%" }, attrs: { "id": "agTable", "suppressCellFocus": true, "suppressMenu": true, "suppressContextMenu": !_vm.showTableOption, "defaultColDef": _vm.defaultColDef, "headerHeight": _vm.headerHeight, "rowHeight": _vm.getRowHeight(), "getRowHeight": _vm.getRowHeight, "rowData": _vm.rowDataFiltered, "suppressRowClickSelection": (_vm.isPc || _vm.isEditTable) && _vm.rowSelection == "multiple" || _vm.suppressRowClickSelection, "rowSelection": _vm.rowSelection, "rowMultiSelectWithClick": !_vm.isPc && !_vm.isEditTable && (_vm.rowSelection == "multiple" || _vm.rowMultiSelectWithClick), "columnDefs": _vm.tableColumns, "localeText": _vm.localeText, "singleClickEdit": true, "pinnedTopRowData": _vm.topRows, "pinnedBottomRowData": _vm.pinnedBottomRowData, "suppressRowTransform": true, "stopEditingWhenCellsLoseFocus": true, "getRowClass": _vm.getRowClassCommon, "getRowId": _vm.getRowId, "tooltipShowDelay": 500, "overlayNoRowsTemplate": _vm.noRowsTemplate || _vm.overlayNoRowsTemplate, "treeData": _vm.treeData, "getDataPath": _vm.getDataPath, "autoGroupColumnDef": _vm.autoGroupColumnDef, "groupDisplayType": _vm.groupDisplayType, "groupSelectsChildren": _vm.groupSelectsChildren, "groupDefaultExpanded": _vm.groupDefaultExpanded, "getContextMenuItems": _vm.getContextMenuItems }, on: { "sortChanged": _vm.sortChanged, "selection-changed": _vm.selectionChanged, "rowSelected": _vm.rowSelected, "grid-ready": _vm.onGridReady, "cellClicked": _vm.cellClicked, "cellDoubleClicked": _vm.cellDoubleClicked } }, "ag-grid-vue", _vm.$attrs, false), _vm.$listeners)) : _vm._e()], 1), _vm.showBottom ? _c("div", { ref: "bottom" }, [_c("Row", { staticStyle: { "margin-top": "10px" } }, [_c("i-col", { staticStyle: { "text-align": "left" }, attrs: { "span": "18" } }, [_c("Page", { directives: [{ name: "show", rawName: "v-show", value: !_vm.disablePage, expression: "!disablePage" }], attrs: { "size": "small", "total": _vm.totalNumber, "current": _vm.currentPage, "page-size": _vm.limitNumber, "show-sizer": "", "show-total": "", "show-elevator": "" }, on: { "on-change": _vm.onPageChange, "on-page-size-change": _vm.onPageSizeChange } }), _c("span", { directives: [{ name: "show", rawName: "v-show", value: _vm.disablePage, expression: "disablePage" }] }, [_vm._v("\u5171 " + _vm._s(_vm.tableData.length) + " \u6761\u6570\u636E")])], 1)], 1)], 1) : _vm._e()], 1);
53862
53862
  };
53863
53863
  var staticRenderFns$Y = [];
53864
53864
  function suppressNavigation(params) {
@@ -53949,6 +53949,7 @@ const __vue2_script$Z = {
53949
53949
  AgImage
53950
53950
  },
53951
53951
  props: {
53952
+ rowSpanDefs: Array,
53952
53953
  headerHeight: {
53953
53954
  type: Number,
53954
53955
  default: 28
@@ -54073,6 +54074,7 @@ const __vue2_script$Z = {
54073
54074
  type: Boolean,
54074
54075
  default: false
54075
54076
  },
54077
+ rowAddHeight: { type: Number, default: 0 },
54076
54078
  renderDataFn: Function,
54077
54079
  revertBtn: Boolean,
54078
54080
  isIndexManageTable: Boolean,
@@ -54089,11 +54091,11 @@ const __vue2_script$Z = {
54089
54091
  },
54090
54092
  xScale: {
54091
54093
  type: Number,
54092
- default: 4
54094
+ default: 2
54093
54095
  },
54094
54096
  wzScale: {
54095
54097
  type: Number,
54096
- default: 4
54098
+ default: 2
54097
54099
  },
54098
54100
  funId: String,
54099
54101
  groupDefaultExpanded: {
@@ -54106,6 +54108,10 @@ const __vue2_script$Z = {
54106
54108
  type: Boolean,
54107
54109
  default: true
54108
54110
  },
54111
+ showZeroDefault: {
54112
+ type: String,
54113
+ default: "Y"
54114
+ },
54109
54115
  noRowsTemplate: String
54110
54116
  },
54111
54117
  data() {
@@ -54166,7 +54172,7 @@ const __vue2_script$Z = {
54166
54172
  gridApi: null,
54167
54173
  gridColumnApi: null,
54168
54174
  overlayNoRowsTemplate: '<span style="padding: 10px;">\u8BF7\u9009\u62E9\u67E5\u8BE2\u6761\u4EF6</span>',
54169
- showZero: "Y",
54175
+ showZero: this.showZeroDefault,
54170
54176
  showZeroSwitch: false,
54171
54177
  switchZeroCol: null,
54172
54178
  switchZeroTitle: "",
@@ -54184,6 +54190,18 @@ const __vue2_script$Z = {
54184
54190
  };
54185
54191
  },
54186
54192
  computed: {
54193
+ mergeIndexCol() {
54194
+ let mergeIndex = _.find(this.columns, (d) => {
54195
+ return d.autoMergeRow === true;
54196
+ });
54197
+ return (mergeIndex == null ? void 0 : mergeIndex.key) || (mergeIndex == null ? void 0 : mergeIndex.field);
54198
+ },
54199
+ mergeColumns() {
54200
+ let rlt = _.filter(this.columns, (d) => {
54201
+ return !!d.autoMergeRow;
54202
+ }).map((d) => d.key || d.field);
54203
+ return (rlt == null ? void 0 : rlt.length) ? rlt : void 0;
54204
+ },
54187
54205
  paramRightUnit() {
54188
54206
  return _.some(this.flatColumns, (d) => {
54189
54207
  return d.isSwitchUnit;
@@ -54294,41 +54312,21 @@ const __vue2_script$Z = {
54294
54312
  },
54295
54313
  deep: true
54296
54314
  },
54297
- unitType(val) {
54315
+ unitType(val, oldValue) {
54298
54316
  let datasTmp = _.cloneDeep(this.tableData);
54299
- if (val == "X") {
54300
- datasTmp.forEach((d) => {
54301
- this.switchCols.forEach((dd) => {
54302
- let t2 = _.round(parseFloat(d[dd]), 6);
54303
- d[dd] = isNaN(t2) ? null : _.round(t2 / 5, 6);
54304
- });
54305
- });
54306
- } else if (val == "WZ") {
54307
- datasTmp.forEach((d) => {
54308
- this.switchCols.forEach((dd) => {
54309
- let t2 = _.round(parseFloat(d[dd]), 6);
54310
- d[dd] = isNaN(t2) ? null : _.round(t2 * 5, 6);
54311
- });
54317
+ datasTmp.forEach((d) => {
54318
+ this.switchCols.forEach((dd) => {
54319
+ changeCellUnit(oldValue, val, d, dd);
54312
54320
  });
54313
- }
54321
+ });
54314
54322
  this.tableData = datasTmp;
54315
54323
  if (this.pinnedTopRowDataWithUnit && this.pinnedTopRowDataWithUnit.length) {
54316
54324
  let pinnedTopRowDataWithUnitTmp = _.cloneDeep(this.pinnedTopRowDataWithUnit);
54317
- if (val == "X") {
54318
- pinnedTopRowDataWithUnitTmp.forEach((d) => {
54319
- this.switchCols.forEach((dd) => {
54320
- let t2 = _.round(parseFloat(d[dd]), 6);
54321
- d[dd] = isNaN(t2) ? null : _.round(t2 / 5, 6);
54322
- });
54323
- });
54324
- } else if (val == "WZ") {
54325
- pinnedTopRowDataWithUnitTmp.forEach((d) => {
54326
- this.switchCols.forEach((dd) => {
54327
- let t2 = _.round(parseFloat(d[dd]), 6);
54328
- d[dd] = isNaN(t2) ? null : _.round(t2 * 5, 6);
54329
- });
54325
+ pinnedTopRowDataWithUnitTmp.forEach((d) => {
54326
+ this.switchCols.forEach((dd) => {
54327
+ changeCellUnit(oldValue, val, d, dd);
54330
54328
  });
54331
- }
54329
+ });
54332
54330
  this.pinnedTopRowDataWithUnit = pinnedTopRowDataWithUnitTmp;
54333
54331
  this.renderSumRow();
54334
54332
  }
@@ -54419,6 +54417,9 @@ const __vue2_script$Z = {
54419
54417
  handler() {
54420
54418
  this.tableHeight = this.height;
54421
54419
  }
54420
+ },
54421
+ showZero() {
54422
+ this.renderSumRow();
54422
54423
  }
54423
54424
  },
54424
54425
  async created() {
@@ -54447,13 +54448,6 @@ const __vue2_script$Z = {
54447
54448
  await this.$nextTick();
54448
54449
  this.checkAllGroup = this.columns.map((d) => d.title);
54449
54450
  },
54450
- mounted() {
54451
- window.agTable = this;
54452
- if (this.autoRefresh) {
54453
- this.tableRefresh();
54454
- }
54455
- this.columnsFilter();
54456
- },
54457
54451
  activated() {
54458
54452
  if (this.autoRefresh) {
54459
54453
  this.tableRefresh();
@@ -54499,6 +54493,15 @@ const __vue2_script$Z = {
54499
54493
  }
54500
54494
  }
54501
54495
  ];
54496
+ } else {
54497
+ return [
54498
+ {
54499
+ name: "\u5BFC\u51FA\u6570\u636E\u5230Excel",
54500
+ action: () => {
54501
+ this.$refs.exportData.exportCurrentPage();
54502
+ }
54503
+ }
54504
+ ];
54502
54505
  }
54503
54506
  },
54504
54507
  getRowClassCommon(params) {
@@ -54703,7 +54706,7 @@ const __vue2_script$Z = {
54703
54706
  "ind-default-theme": 42,
54704
54707
  "ind-small-theme": 28
54705
54708
  };
54706
- return heightEnum[this.getTheme];
54709
+ return (heightEnum[this.getTheme] || 0) + this.rowAddHeight;
54707
54710
  },
54708
54711
  onGridReady(params) {
54709
54712
  window.gridApi = this.gridApi = params.api;
@@ -54732,13 +54735,17 @@ const __vue2_script$Z = {
54732
54735
  idxArrEnum[i] = idxArr2;
54733
54736
  }
54734
54737
  });
54735
- let idxArr = idxArrEnum[params.node.rowIndex];
54738
+ let idxUuidEnum = {};
54739
+ _.forEach(this.rowDataFiltered, (row, idx) => {
54740
+ idxUuidEnum[idx + ""] = row.uuid;
54741
+ });
54742
+ let idxArr = idxArrEnum[params.node.rowIndex] || [];
54736
54743
  if (!params.node.selected) {
54737
54744
  let selRows = this.getSelection();
54738
54745
  if (selRows.length > 0) {
54739
54746
  _.forEach(idxArr, (index2) => {
54740
54747
  _.remove(selRows, (row, idx) => {
54741
- return idx == index2;
54748
+ return row.uuid == idxUuidEnum[index2 + ""];
54742
54749
  });
54743
54750
  });
54744
54751
  }
@@ -54752,9 +54759,9 @@ const __vue2_script$Z = {
54752
54759
  this.setSelection(selRows);
54753
54760
  }
54754
54761
  }
54755
- this.$nextTick(() => {
54762
+ setTimeout(() => {
54756
54763
  this.selecting = false;
54757
- });
54764
+ }, 100);
54758
54765
  var selectedRows = this.gridApi.getSelectedRows();
54759
54766
  this.$emit("on-select-change", selectedRows);
54760
54767
  },
@@ -54772,7 +54779,7 @@ const __vue2_script$Z = {
54772
54779
  return column.cellRendererParams.scale;
54773
54780
  if (column.isSwitchUnit) {
54774
54781
  const unitType = this.unitType.toLowerCase();
54775
- return this[`${unitType}Scale`] || 4;
54782
+ return this[`${unitType}Scale`] || 2;
54776
54783
  }
54777
54784
  return null;
54778
54785
  },
@@ -54807,6 +54814,12 @@ const __vue2_script$Z = {
54807
54814
  if (column.hide) {
54808
54815
  agColumn.hide = column.hide;
54809
54816
  }
54817
+ if (column.align) {
54818
+ agColumn.align = column.align;
54819
+ }
54820
+ if (column.dataType) {
54821
+ agColumn.dataType = column.dataType;
54822
+ }
54810
54823
  if (column.headerTooltip) {
54811
54824
  agColumn.headerTooltip = agColumn.headerTooltip || column.headerTooltip;
54812
54825
  }
@@ -54994,7 +55007,7 @@ const __vue2_script$Z = {
54994
55007
  if (!isValid) {
54995
55008
  const { newValue, oldValue, data, colDef, column: column2 } = params;
54996
55009
  this.isRevertingOldValue = true;
54997
- data[colDef.key] = newValue;
55010
+ data[colDef.field || colDef.key] = newValue;
54998
55011
  setTimeout(() => {
54999
55012
  params.node.setDataValue(column2, oldValue);
55000
55013
  this.isRevertingOldValue = false;
@@ -55205,78 +55218,67 @@ const __vue2_script$Z = {
55205
55218
  this.hackReset = true;
55206
55219
  });
55207
55220
  },
55208
- renderSumRow() {
55221
+ renderSumRow: _.debounce(async function() {
55209
55222
  var _a;
55210
- let hasSumRow = _.some(this.flatColumns, (item2) => item2.isSum);
55223
+ let hasSumRow = this.flatColumns.some((item2) => item2.isSum);
55211
55224
  if (hasSumRow) {
55212
- let sumCols = _.filter(this.flatColumns, (item2) => item2.isSum);
55213
- let sumCalcCols = _.remove(sumCols, (item2) => isString(item2.isSum));
55214
- let sumFuncCols = _.remove(sumCols, (item2) => item2.isSum instanceof Function);
55215
- const sumCalcRuleMap = {};
55216
- _.forEach(sumCalcCols, (col) => {
55217
- addCalcRuleMap(sumCalcRuleMap, col.isSum, col.field || col.key);
55218
- });
55225
+ console.time("calcSum");
55219
55226
  let sumData = {};
55220
- for (let i = 0; i < this.flatColumns.length; i++) {
55221
- if (!["checkbox", "radios", "index"].includes((_a = this.flatColumns[i]) == null ? void 0 : _a.type)) {
55222
- let colTmp = this.flatColumns[i];
55223
- sumData[colTmp.field || colTmp.key] = "\u5408\u8BA1";
55227
+ for (let col of this.flatColumns) {
55228
+ if (!["checkbox", "radios", "index"].includes(col.type)) {
55229
+ sumData[col.field || col.key] = "\u5408\u8BA1";
55224
55230
  break;
55225
55231
  }
55226
55232
  }
55227
- sumCols.forEach((d) => sumData[d.field || d.key] = 0);
55228
- sumData = _.reduce(
55229
- this.tableData,
55230
- (s, d, idx) => {
55231
- sumCols.forEach((dd) => {
55232
- if (isString(dd.isSum))
55233
- return;
55234
- let field = dd.field || dd.key;
55235
- let rowMergeInfo = this.tableRowSpanMergeIndexMap[field];
55236
- let mergedRows = [];
55237
- _.forEach(rowMergeInfo, (v, k) => {
55238
- let rows2 = _.range(k, parseInt(k) + v);
55239
- mergedRows.push(...rows2.slice(1));
55240
- });
55241
- if (!mergedRows.includes(idx)) {
55242
- sumData[field] = _.round(
55243
- sumData[field] + (!d[field] || isNaN(d[field]) ? 0 : parseFloat(d[field])),
55244
- 6
55245
- );
55246
- }
55247
- });
55248
- return s;
55249
- },
55250
- sumData
55251
- );
55252
- _.forEach(sumFuncCols, (d) => {
55253
- sumData[d.field || d.key] = d.isSum(this.tableData, d);
55233
+ let sumCols = this.flatColumns.filter((item2) => item2.isSum);
55234
+ let sumCalcCols = [], sumFuncCols = [];
55235
+ sumCols.forEach((col) => {
55236
+ if (typeof col.isSum === "string")
55237
+ sumCalcCols.push(col);
55238
+ else if (col.isSum instanceof Function)
55239
+ sumFuncCols.push(col);
55254
55240
  });
55255
- let sumRows = [sumData];
55256
- let calcRules = {};
55257
- _.forEach(sumCalcRuleMap, (v, k) => {
55258
- _.merge(calcRules, v);
55241
+ const sumCalcRuleMap = {};
55242
+ sumCalcCols.forEach((col) => {
55243
+ addCalcRuleMap(sumCalcRuleMap, col.isSum, col.field || col.key);
55259
55244
  });
55260
- let rules = [];
55261
- _.forEach(calcRules, (v, k) => {
55262
- var _a2;
55263
- let column = _.find(sumCalcCols, (d) => {
55264
- return d.field == k || d.key == k;
55245
+ sumCols.forEach((col) => {
55246
+ if (!(col.field || col.key) in sumData)
55247
+ sumData[col.field || col.key] = 0;
55248
+ });
55249
+ this.rowDataFiltered.forEach((d) => {
55250
+ sumCols.forEach((dd) => {
55251
+ if (typeof dd.isSum === "string")
55252
+ return;
55253
+ let field = dd.field || dd.key;
55254
+ let value = d[field];
55255
+ if (typeof value === "number" && !isNaN(value)) {
55256
+ sumData[field] = (sumData[field] || 0) + value;
55257
+ }
55265
55258
  });
55259
+ });
55260
+ sumFuncCols.forEach((col) => {
55261
+ sumData[col.field || col.key] = col.isSum(this.rowDataFiltered, col);
55262
+ });
55263
+ let sumRows = [sumData];
55264
+ let rules = [];
55265
+ for (let key in sumCalcRuleMap) {
55266
+ let column = sumCalcCols.find((col) => col.field === key || col.key === key);
55266
55267
  rules.push({
55267
- rltKey: k,
55268
- ast: v,
55269
- precision: ((_a2 = column == null ? void 0 : column.cellRendererParams) == null ? void 0 : _a2.scale) || 2,
55268
+ rltKey: key,
55269
+ ast: sumCalcRuleMap[key],
55270
+ precision: ((_a = column == null ? void 0 : column.cellRendererParams) == null ? void 0 : _a.scale) || 2,
55270
55271
  errRtn: 0
55271
55272
  });
55272
- });
55273
+ }
55273
55274
  let options = { calcRules: rules };
55274
55275
  calcDatas(sumRows, options);
55275
55276
  this.topRows = this.pinnedTopRowDataWithUnit ? _.concat(this.pinnedTopRowDataWithUnit, sumRows) : sumRows;
55277
+ console.timeEnd("calcSum");
55276
55278
  } else {
55277
55279
  this.topRows = this.pinnedTopRowDataWithUnit;
55278
55280
  }
55279
- },
55281
+ }, 5),
55280
55282
  async renderTreeData(val) {
55281
55283
  this.treeData = _.some(val, (d) => {
55282
55284
  var _a, _b;
@@ -55313,9 +55315,8 @@ const __vue2_script$Z = {
55313
55315
  }
55314
55316
  });
55315
55317
  },
55316
- tableRefresh: _.debounce(function(noQuery) {
55317
- var _a;
55318
- if (this.dataApi && (!noQuery || !((_a = this.tableData) == null ? void 0 : _a.length))) {
55318
+ tableRefresh: function(noQuery) {
55319
+ if (this.dataApi && !noQuery) {
55319
55320
  if (this.gridApi) {
55320
55321
  this.gridApi.hideOverlay();
55321
55322
  }
@@ -55342,21 +55343,11 @@ const __vue2_script$Z = {
55342
55343
  d["_initialseq"] = idx;
55343
55344
  });
55344
55345
  if (this.unitType != this.defaultUnitType) {
55345
- if (this.unitType == "WZ") {
55346
- data.forEach((d) => {
55347
- this.switchCols.forEach((dd) => {
55348
- let t2 = _.round(parseFloat(d[dd]), 6);
55349
- d[dd] = isNaN(t2) ? null : _.round(t2 * 5, 6);
55350
- });
55351
- });
55352
- } else {
55353
- data.forEach((d) => {
55354
- this.switchCols.forEach((dd) => {
55355
- let t2 = _.round(parseFloat(d[dd]), 6);
55356
- d[dd] = isNaN(t2) ? null : _.round(t2 / 5, 6);
55357
- });
55346
+ data.forEach((d) => {
55347
+ this.switchCols.forEach((dd) => {
55348
+ changeCellUnit(this.defaultUnitType, this.unitType, d, dd);
55358
55349
  });
55359
- }
55350
+ });
55360
55351
  }
55361
55352
  this.tableData = await this.renderTreeData(data);
55362
55353
  this.totalNumber = result.data.total || 0;
@@ -55372,53 +55363,33 @@ const __vue2_script$Z = {
55372
55363
  this.totalNumber = this.value.length;
55373
55364
  }
55374
55365
  this.optionDropdownVisible = false;
55375
- }, 1),
55366
+ },
55376
55367
  setUnitType(unitType) {
55377
55368
  this.unitType = unitType;
55378
55369
  },
55379
- toggleUnitIfNeeded: _.debounce(async function toggleUnitIfNeeded() {
55370
+ toggleUnitIfNeeded: _.debounce(async function() {
55380
55371
  setTimeout(() => {
55381
55372
  if (this.pinnedTopRowDataWithUnit && this.pinnedTopRowDataWithUnit.length) {
55382
55373
  let pinnedTopRowDataWithUnitTmp = _.cloneDeep(this.pinnedTopRowDataWithUnit);
55383
55374
  if (this.unitType != this.defaultUnitType) {
55384
- if (this.unitType == "X") {
55385
- pinnedTopRowDataWithUnitTmp.forEach((d) => {
55386
- this.switchCols.forEach((dd) => {
55387
- let t2 = _.round(parseFloat(d[dd]), 6);
55388
- d[dd] = isNaN(t2) ? null : _.round(t2 / 5, 6);
55389
- });
55390
- });
55391
- } else if (this.unitType == "WZ") {
55392
- pinnedTopRowDataWithUnitTmp.forEach((d) => {
55393
- this.switchCols.forEach((dd) => {
55394
- let t2 = _.round(parseFloat(d[dd]), 6);
55395
- d[dd] = isNaN(t2) ? null : _.round(t2 * 5, 6);
55396
- });
55375
+ pinnedTopRowDataWithUnitTmp.forEach((d) => {
55376
+ this.switchCols.forEach((dd) => {
55377
+ changeCellUnit(this.defaultUnitType, this.unitType, d, dd);
55397
55378
  });
55398
- }
55379
+ });
55380
+ this.pinnedTopRowDataWithUnit = pinnedTopRowDataWithUnitTmp;
55381
+ this.renderSumRow();
55399
55382
  }
55400
- this.pinnedTopRowDataWithUnit = pinnedTopRowDataWithUnitTmp;
55401
- this.renderSumRow();
55402
55383
  }
55403
55384
  let datasTmp = _.cloneDeep(this.tableData);
55404
55385
  if (this.unitType != this.defaultUnitType) {
55405
- if (this.unitType == "WZ") {
55406
- datasTmp.forEach((d) => {
55407
- this.switchCols.forEach((dd) => {
55408
- let t2 = parseFloat(d[dd]);
55409
- d[dd] = isNaN(t2) ? null : _.round(t2 * 5, 6);
55410
- });
55411
- });
55412
- } else {
55413
- datasTmp.forEach((d) => {
55414
- this.switchCols.forEach((dd) => {
55415
- let t2 = parseFloat(d[dd]);
55416
- d[dd] = isNaN(t2) ? null : _.round(t2 / 5, 6);
55417
- });
55386
+ datasTmp.forEach((d) => {
55387
+ this.switchCols.forEach((dd) => {
55388
+ changeCellUnit(this.defaultUnitType, this.unitType, d, dd);
55418
55389
  });
55419
- }
55390
+ });
55391
+ this.$emit("input", datasTmp);
55420
55392
  }
55421
- this.$emit("input", datasTmp);
55422
55393
  }, 10);
55423
55394
  }, 1),
55424
55395
  getSelection() {
@@ -55455,8 +55426,7 @@ const __vue2_script$Z = {
55455
55426
  let datasTmp = _.cloneDeep(this.tableData);
55456
55427
  datasTmp.forEach((d) => {
55457
55428
  this.switchCols.forEach((dd) => {
55458
- let t2 = _.round(parseFloat(d[dd]), 6);
55459
- d[dd] = isNaN(t2) ? null : _.round(t2 / 5, 6);
55429
+ changeCellUnit(this.unitType, "X", d, dd);
55460
55430
  });
55461
55431
  });
55462
55432
  return datasTmp;
@@ -55469,8 +55439,7 @@ const __vue2_script$Z = {
55469
55439
  let datasTmp = _.cloneDeep(this.tableData);
55470
55440
  datasTmp.forEach((d) => {
55471
55441
  this.switchCols.forEach((dd) => {
55472
- let t2 = _.round(parseFloat(d[dd]), 6);
55473
- d[dd] = isNaN(t2) ? null : _.round(t2 * 5, 6);
55442
+ changeCellUnit(this.unitType, "WZ", d, dd);
55474
55443
  });
55475
55444
  });
55476
55445
  return datasTmp;
@@ -55483,8 +55452,7 @@ const __vue2_script$Z = {
55483
55452
  let datasTmp = _.cloneDeep(this.topRows);
55484
55453
  datasTmp.forEach((d) => {
55485
55454
  this.switchCols.forEach((dd) => {
55486
- let t2 = _.round(parseFloat(d[dd]), 6);
55487
- d[dd] = isNaN(t2) ? null : _.round(t2 / 5, 6);
55455
+ changeCellUnit(this.unitType, "X", d, dd);
55488
55456
  });
55489
55457
  });
55490
55458
  return datasTmp;
@@ -55497,8 +55465,7 @@ const __vue2_script$Z = {
55497
55465
  let datasTmp = _.cloneDeep(this.topRows);
55498
55466
  datasTmp.forEach((d) => {
55499
55467
  this.switchCols.forEach((dd) => {
55500
- let t2 = _.round(parseFloat(d[dd]), 6);
55501
- d[dd] = isNaN(t2) ? null : _.round(t2 * 5, 6);
55468
+ changeCellUnit(this.unitType, "WZ", d, dd);
55502
55469
  });
55503
55470
  });
55504
55471
  return datasTmp;