@indfnd/common 1.0.14 → 1.0.16
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 +14 -0
- package/dist/ind-common.es.js +166 -212
- package/dist/ind-common.umd.cjs +50 -50
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
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.16](http://git.inspur.com/imp-ec/ind-front/ind-common-front/compare/v1.0.15...v1.0.16) (2024-07-10)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* 同步移动端表格修改内容表格 ([085ad56](http://git.inspur.com/imp-ec/ind-front/ind-common-front/commit/085ad56e9198574c540af7c205096eeeca7b1b08))
|
|
11
|
+
|
|
12
|
+
### [1.0.15](http://git.inspur.com/imp-ec/ind-front/ind-common-front/compare/v1.0.14...v1.0.15) (2024-07-08)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* 表格计算逻辑修改`` ([21a6a95](http://git.inspur.com/imp-ec/ind-front/ind-common-front/commit/21a6a958528a6cb3c678bfa1b898aa8b1b8d6485))
|
|
18
|
+
|
|
5
19
|
### [1.0.14](http://git.inspur.com/imp-ec/ind-front/ind-common-front/compare/v1.0.13...v1.0.14) (2024-06-29)
|
|
6
20
|
|
|
7
21
|
|
package/dist/ind-common.es.js
CHANGED
|
@@ -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.
|
|
5
|
+
const version = "1.0.15";
|
|
6
6
|
const author = "huxuetong";
|
|
7
7
|
const publishConfig = {
|
|
8
8
|
registry: "https://registry.npmjs.org/"
|
|
@@ -53551,70 +53551,57 @@ const __vue2_script$_ = {
|
|
|
53551
53551
|
},
|
|
53552
53552
|
renderSumRow: _.debounce(async function() {
|
|
53553
53553
|
var _a;
|
|
53554
|
-
let hasSumRow =
|
|
53554
|
+
let hasSumRow = this.flatColumns.some((item2) => item2.isSum);
|
|
53555
53555
|
if (hasSumRow) {
|
|
53556
53556
|
console.time("calcSum");
|
|
53557
|
-
let sumCols = _.filter(this.flatColumns, (item2) => item2.isSum);
|
|
53558
|
-
let sumCalcCols = _.remove(sumCols, (item2) => isString(item2.isSum));
|
|
53559
|
-
let sumFuncCols = _.remove(sumCols, (item2) => item2.isSum instanceof Function);
|
|
53560
|
-
const sumCalcRuleMap = {};
|
|
53561
|
-
_.forEach(sumCalcCols, (col) => {
|
|
53562
|
-
addCalcRuleMap(sumCalcRuleMap, col.isSum, col.field || col.key);
|
|
53563
|
-
});
|
|
53564
53557
|
let sumData = {};
|
|
53565
|
-
for (let
|
|
53566
|
-
if (!["checkbox", "radios", "index"].includes(
|
|
53567
|
-
|
|
53568
|
-
sumData[colTmp.field || colTmp.key] = "\u5408\u8BA1";
|
|
53558
|
+
for (let col of this.flatColumns) {
|
|
53559
|
+
if (!["checkbox", "radios", "index"].includes(col.type)) {
|
|
53560
|
+
sumData[col.field || col.key] = "\u5408\u8BA1";
|
|
53569
53561
|
break;
|
|
53570
53562
|
}
|
|
53571
53563
|
}
|
|
53572
|
-
sumCols.
|
|
53573
|
-
|
|
53574
|
-
|
|
53575
|
-
(
|
|
53576
|
-
|
|
53577
|
-
|
|
53578
|
-
|
|
53579
|
-
let field = dd.field || dd.key;
|
|
53580
|
-
let rowMergeInfo = this.tableRowSpanMergeIndexMap[field];
|
|
53581
|
-
let mergedRows = [];
|
|
53582
|
-
_.forEach(rowMergeInfo, (v, k) => {
|
|
53583
|
-
let rows2 = _.range(k, parseInt(k) + v);
|
|
53584
|
-
mergedRows.push(...rows2.slice(1));
|
|
53585
|
-
});
|
|
53586
|
-
if (!mergedRows.includes(idx)) {
|
|
53587
|
-
sumData[field] = _.round(
|
|
53588
|
-
sumData[field] + (!d[field] || isNaN(d[field]) ? 0 : parseFloat(d[field])),
|
|
53589
|
-
6
|
|
53590
|
-
);
|
|
53591
|
-
}
|
|
53592
|
-
});
|
|
53593
|
-
return s;
|
|
53594
|
-
},
|
|
53595
|
-
sumData
|
|
53596
|
-
);
|
|
53597
|
-
_.forEach(sumFuncCols, (d) => {
|
|
53598
|
-
sumData[d.field || d.key] = d.isSum(this.rowDataFiltered, d);
|
|
53564
|
+
let sumCols = this.flatColumns.filter((item2) => item2.isSum);
|
|
53565
|
+
let sumCalcCols = [], sumFuncCols = [];
|
|
53566
|
+
sumCols.forEach((col) => {
|
|
53567
|
+
if (typeof col.isSum === "string")
|
|
53568
|
+
sumCalcCols.push(col);
|
|
53569
|
+
else if (col.isSum instanceof Function)
|
|
53570
|
+
sumFuncCols.push(col);
|
|
53599
53571
|
});
|
|
53600
|
-
|
|
53601
|
-
|
|
53602
|
-
|
|
53603
|
-
_.merge(calcRules, v);
|
|
53572
|
+
const sumCalcRuleMap = {};
|
|
53573
|
+
sumCalcCols.forEach((col) => {
|
|
53574
|
+
addCalcRuleMap(sumCalcRuleMap, col.isSum, col.field || col.key);
|
|
53604
53575
|
});
|
|
53605
|
-
|
|
53606
|
-
|
|
53607
|
-
|
|
53608
|
-
|
|
53609
|
-
|
|
53576
|
+
sumCols.forEach((col) => {
|
|
53577
|
+
if (!(col.field || col.key) in sumData)
|
|
53578
|
+
sumData[col.field || col.key] = 0;
|
|
53579
|
+
});
|
|
53580
|
+
this.rowDataFiltered.forEach((d) => {
|
|
53581
|
+
sumCols.forEach((dd) => {
|
|
53582
|
+
if (typeof dd.isSum === "string")
|
|
53583
|
+
return;
|
|
53584
|
+
let field = dd.field || dd.key;
|
|
53585
|
+
let value = d[field];
|
|
53586
|
+
if (typeof value === "number" && !isNaN(value)) {
|
|
53587
|
+
sumData[field] = (sumData[field] || 0) + value;
|
|
53588
|
+
}
|
|
53610
53589
|
});
|
|
53590
|
+
});
|
|
53591
|
+
sumFuncCols.forEach((col) => {
|
|
53592
|
+
sumData[col.field || col.key] = col.isSum(this.rowDataFiltered, col);
|
|
53593
|
+
});
|
|
53594
|
+
let sumRows = [sumData];
|
|
53595
|
+
let rules = [];
|
|
53596
|
+
for (let key in sumCalcRuleMap) {
|
|
53597
|
+
let column = sumCalcCols.find((col) => col.field === key || col.key === key);
|
|
53611
53598
|
rules.push({
|
|
53612
|
-
rltKey:
|
|
53613
|
-
ast:
|
|
53614
|
-
precision: ((
|
|
53599
|
+
rltKey: key,
|
|
53600
|
+
ast: sumCalcRuleMap[key],
|
|
53601
|
+
precision: ((_a = column == null ? void 0 : column.cellRendererParams) == null ? void 0 : _a.scale) || 2,
|
|
53615
53602
|
errRtn: 0
|
|
53616
53603
|
});
|
|
53617
|
-
}
|
|
53604
|
+
}
|
|
53618
53605
|
let options = { calcRules: rules };
|
|
53619
53606
|
calcDatas(sumRows, options);
|
|
53620
53607
|
this.topRows = this.pinnedTopRowDataWithUnit ? _.concat(this.pinnedTopRowDataWithUnit, sumRows) : sumRows;
|
|
@@ -53871,7 +53858,7 @@ var render$Y = function() {
|
|
|
53871
53858
|
var _c = _vm._self._c || _h;
|
|
53872
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) {
|
|
53873
53860
|
_vm.unitType = $$v;
|
|
53874
|
-
}, 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.
|
|
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);
|
|
53875
53862
|
};
|
|
53876
53863
|
var staticRenderFns$Y = [];
|
|
53877
53864
|
function suppressNavigation(params) {
|
|
@@ -53962,6 +53949,7 @@ const __vue2_script$Z = {
|
|
|
53962
53949
|
AgImage
|
|
53963
53950
|
},
|
|
53964
53951
|
props: {
|
|
53952
|
+
rowSpanDefs: Array,
|
|
53965
53953
|
headerHeight: {
|
|
53966
53954
|
type: Number,
|
|
53967
53955
|
default: 28
|
|
@@ -54086,6 +54074,7 @@ const __vue2_script$Z = {
|
|
|
54086
54074
|
type: Boolean,
|
|
54087
54075
|
default: false
|
|
54088
54076
|
},
|
|
54077
|
+
rowAddHeight: { type: Number, default: 0 },
|
|
54089
54078
|
renderDataFn: Function,
|
|
54090
54079
|
revertBtn: Boolean,
|
|
54091
54080
|
isIndexManageTable: Boolean,
|
|
@@ -54102,11 +54091,11 @@ const __vue2_script$Z = {
|
|
|
54102
54091
|
},
|
|
54103
54092
|
xScale: {
|
|
54104
54093
|
type: Number,
|
|
54105
|
-
default:
|
|
54094
|
+
default: 2
|
|
54106
54095
|
},
|
|
54107
54096
|
wzScale: {
|
|
54108
54097
|
type: Number,
|
|
54109
|
-
default:
|
|
54098
|
+
default: 2
|
|
54110
54099
|
},
|
|
54111
54100
|
funId: String,
|
|
54112
54101
|
groupDefaultExpanded: {
|
|
@@ -54119,6 +54108,10 @@ const __vue2_script$Z = {
|
|
|
54119
54108
|
type: Boolean,
|
|
54120
54109
|
default: true
|
|
54121
54110
|
},
|
|
54111
|
+
showZeroDefault: {
|
|
54112
|
+
type: String,
|
|
54113
|
+
default: "Y"
|
|
54114
|
+
},
|
|
54122
54115
|
noRowsTemplate: String
|
|
54123
54116
|
},
|
|
54124
54117
|
data() {
|
|
@@ -54179,7 +54172,7 @@ const __vue2_script$Z = {
|
|
|
54179
54172
|
gridApi: null,
|
|
54180
54173
|
gridColumnApi: null,
|
|
54181
54174
|
overlayNoRowsTemplate: '<span style="padding: 10px;">\u8BF7\u9009\u62E9\u67E5\u8BE2\u6761\u4EF6</span>',
|
|
54182
|
-
showZero:
|
|
54175
|
+
showZero: this.showZeroDefault,
|
|
54183
54176
|
showZeroSwitch: false,
|
|
54184
54177
|
switchZeroCol: null,
|
|
54185
54178
|
switchZeroTitle: "",
|
|
@@ -54197,6 +54190,18 @@ const __vue2_script$Z = {
|
|
|
54197
54190
|
};
|
|
54198
54191
|
},
|
|
54199
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
|
+
},
|
|
54200
54205
|
paramRightUnit() {
|
|
54201
54206
|
return _.some(this.flatColumns, (d) => {
|
|
54202
54207
|
return d.isSwitchUnit;
|
|
@@ -54307,41 +54312,21 @@ const __vue2_script$Z = {
|
|
|
54307
54312
|
},
|
|
54308
54313
|
deep: true
|
|
54309
54314
|
},
|
|
54310
|
-
unitType(val) {
|
|
54315
|
+
unitType(val, oldValue) {
|
|
54311
54316
|
let datasTmp = _.cloneDeep(this.tableData);
|
|
54312
|
-
|
|
54313
|
-
|
|
54314
|
-
|
|
54315
|
-
let t2 = _.round(parseFloat(d[dd]), 6);
|
|
54316
|
-
d[dd] = isNaN(t2) ? null : _.round(t2 / 5, 6);
|
|
54317
|
-
});
|
|
54318
|
-
});
|
|
54319
|
-
} else if (val == "WZ") {
|
|
54320
|
-
datasTmp.forEach((d) => {
|
|
54321
|
-
this.switchCols.forEach((dd) => {
|
|
54322
|
-
let t2 = _.round(parseFloat(d[dd]), 6);
|
|
54323
|
-
d[dd] = isNaN(t2) ? null : _.round(t2 * 5, 6);
|
|
54324
|
-
});
|
|
54317
|
+
datasTmp.forEach((d) => {
|
|
54318
|
+
this.switchCols.forEach((dd) => {
|
|
54319
|
+
changeCellUnit(oldValue, val, d, dd);
|
|
54325
54320
|
});
|
|
54326
|
-
}
|
|
54321
|
+
});
|
|
54327
54322
|
this.tableData = datasTmp;
|
|
54328
54323
|
if (this.pinnedTopRowDataWithUnit && this.pinnedTopRowDataWithUnit.length) {
|
|
54329
54324
|
let pinnedTopRowDataWithUnitTmp = _.cloneDeep(this.pinnedTopRowDataWithUnit);
|
|
54330
|
-
|
|
54331
|
-
|
|
54332
|
-
|
|
54333
|
-
let t2 = _.round(parseFloat(d[dd]), 6);
|
|
54334
|
-
d[dd] = isNaN(t2) ? null : _.round(t2 / 5, 6);
|
|
54335
|
-
});
|
|
54336
|
-
});
|
|
54337
|
-
} else if (val == "WZ") {
|
|
54338
|
-
pinnedTopRowDataWithUnitTmp.forEach((d) => {
|
|
54339
|
-
this.switchCols.forEach((dd) => {
|
|
54340
|
-
let t2 = _.round(parseFloat(d[dd]), 6);
|
|
54341
|
-
d[dd] = isNaN(t2) ? null : _.round(t2 * 5, 6);
|
|
54342
|
-
});
|
|
54325
|
+
pinnedTopRowDataWithUnitTmp.forEach((d) => {
|
|
54326
|
+
this.switchCols.forEach((dd) => {
|
|
54327
|
+
changeCellUnit(oldValue, val, d, dd);
|
|
54343
54328
|
});
|
|
54344
|
-
}
|
|
54329
|
+
});
|
|
54345
54330
|
this.pinnedTopRowDataWithUnit = pinnedTopRowDataWithUnitTmp;
|
|
54346
54331
|
this.renderSumRow();
|
|
54347
54332
|
}
|
|
@@ -54432,6 +54417,9 @@ const __vue2_script$Z = {
|
|
|
54432
54417
|
handler() {
|
|
54433
54418
|
this.tableHeight = this.height;
|
|
54434
54419
|
}
|
|
54420
|
+
},
|
|
54421
|
+
showZero() {
|
|
54422
|
+
this.renderSumRow();
|
|
54435
54423
|
}
|
|
54436
54424
|
},
|
|
54437
54425
|
async created() {
|
|
@@ -54460,13 +54448,6 @@ const __vue2_script$Z = {
|
|
|
54460
54448
|
await this.$nextTick();
|
|
54461
54449
|
this.checkAllGroup = this.columns.map((d) => d.title);
|
|
54462
54450
|
},
|
|
54463
|
-
mounted() {
|
|
54464
|
-
window.agTable = this;
|
|
54465
|
-
if (this.autoRefresh) {
|
|
54466
|
-
this.tableRefresh();
|
|
54467
|
-
}
|
|
54468
|
-
this.columnsFilter();
|
|
54469
|
-
},
|
|
54470
54451
|
activated() {
|
|
54471
54452
|
if (this.autoRefresh) {
|
|
54472
54453
|
this.tableRefresh();
|
|
@@ -54512,6 +54493,15 @@ const __vue2_script$Z = {
|
|
|
54512
54493
|
}
|
|
54513
54494
|
}
|
|
54514
54495
|
];
|
|
54496
|
+
} else {
|
|
54497
|
+
return [
|
|
54498
|
+
{
|
|
54499
|
+
name: "\u5BFC\u51FA\u6570\u636E\u5230Excel",
|
|
54500
|
+
action: () => {
|
|
54501
|
+
this.$refs.exportData.exportCurrentPage();
|
|
54502
|
+
}
|
|
54503
|
+
}
|
|
54504
|
+
];
|
|
54515
54505
|
}
|
|
54516
54506
|
},
|
|
54517
54507
|
getRowClassCommon(params) {
|
|
@@ -54716,7 +54706,7 @@ const __vue2_script$Z = {
|
|
|
54716
54706
|
"ind-default-theme": 42,
|
|
54717
54707
|
"ind-small-theme": 28
|
|
54718
54708
|
};
|
|
54719
|
-
return heightEnum[this.getTheme];
|
|
54709
|
+
return (heightEnum[this.getTheme] || 0) + this.rowAddHeight;
|
|
54720
54710
|
},
|
|
54721
54711
|
onGridReady(params) {
|
|
54722
54712
|
window.gridApi = this.gridApi = params.api;
|
|
@@ -54745,13 +54735,17 @@ const __vue2_script$Z = {
|
|
|
54745
54735
|
idxArrEnum[i] = idxArr2;
|
|
54746
54736
|
}
|
|
54747
54737
|
});
|
|
54748
|
-
let
|
|
54738
|
+
let idxUuidEnum = {};
|
|
54739
|
+
_.forEach(this.rowDataFiltered, (row, idx) => {
|
|
54740
|
+
idxUuidEnum[idx + ""] = row.uuid;
|
|
54741
|
+
});
|
|
54742
|
+
let idxArr = idxArrEnum[params.node.rowIndex] || [];
|
|
54749
54743
|
if (!params.node.selected) {
|
|
54750
54744
|
let selRows = this.getSelection();
|
|
54751
54745
|
if (selRows.length > 0) {
|
|
54752
54746
|
_.forEach(idxArr, (index2) => {
|
|
54753
54747
|
_.remove(selRows, (row, idx) => {
|
|
54754
|
-
return
|
|
54748
|
+
return row.uuid == idxUuidEnum[index2 + ""];
|
|
54755
54749
|
});
|
|
54756
54750
|
});
|
|
54757
54751
|
}
|
|
@@ -54765,9 +54759,9 @@ const __vue2_script$Z = {
|
|
|
54765
54759
|
this.setSelection(selRows);
|
|
54766
54760
|
}
|
|
54767
54761
|
}
|
|
54768
|
-
|
|
54762
|
+
setTimeout(() => {
|
|
54769
54763
|
this.selecting = false;
|
|
54770
|
-
});
|
|
54764
|
+
}, 100);
|
|
54771
54765
|
var selectedRows = this.gridApi.getSelectedRows();
|
|
54772
54766
|
this.$emit("on-select-change", selectedRows);
|
|
54773
54767
|
},
|
|
@@ -54785,7 +54779,7 @@ const __vue2_script$Z = {
|
|
|
54785
54779
|
return column.cellRendererParams.scale;
|
|
54786
54780
|
if (column.isSwitchUnit) {
|
|
54787
54781
|
const unitType = this.unitType.toLowerCase();
|
|
54788
|
-
return this[`${unitType}Scale`] ||
|
|
54782
|
+
return this[`${unitType}Scale`] || 2;
|
|
54789
54783
|
}
|
|
54790
54784
|
return null;
|
|
54791
54785
|
},
|
|
@@ -54820,6 +54814,12 @@ const __vue2_script$Z = {
|
|
|
54820
54814
|
if (column.hide) {
|
|
54821
54815
|
agColumn.hide = column.hide;
|
|
54822
54816
|
}
|
|
54817
|
+
if (column.align) {
|
|
54818
|
+
agColumn.align = column.align;
|
|
54819
|
+
}
|
|
54820
|
+
if (column.dataType) {
|
|
54821
|
+
agColumn.dataType = column.dataType;
|
|
54822
|
+
}
|
|
54823
54823
|
if (column.headerTooltip) {
|
|
54824
54824
|
agColumn.headerTooltip = agColumn.headerTooltip || column.headerTooltip;
|
|
54825
54825
|
}
|
|
@@ -55007,7 +55007,7 @@ const __vue2_script$Z = {
|
|
|
55007
55007
|
if (!isValid) {
|
|
55008
55008
|
const { newValue, oldValue, data, colDef, column: column2 } = params;
|
|
55009
55009
|
this.isRevertingOldValue = true;
|
|
55010
|
-
data[colDef.key] = newValue;
|
|
55010
|
+
data[colDef.field || colDef.key] = newValue;
|
|
55011
55011
|
setTimeout(() => {
|
|
55012
55012
|
params.node.setDataValue(column2, oldValue);
|
|
55013
55013
|
this.isRevertingOldValue = false;
|
|
@@ -55218,78 +55218,67 @@ const __vue2_script$Z = {
|
|
|
55218
55218
|
this.hackReset = true;
|
|
55219
55219
|
});
|
|
55220
55220
|
},
|
|
55221
|
-
renderSumRow() {
|
|
55221
|
+
renderSumRow: _.debounce(async function() {
|
|
55222
55222
|
var _a;
|
|
55223
|
-
let hasSumRow =
|
|
55223
|
+
let hasSumRow = this.flatColumns.some((item2) => item2.isSum);
|
|
55224
55224
|
if (hasSumRow) {
|
|
55225
|
-
|
|
55226
|
-
let sumCalcCols = _.remove(sumCols, (item2) => isString(item2.isSum));
|
|
55227
|
-
let sumFuncCols = _.remove(sumCols, (item2) => item2.isSum instanceof Function);
|
|
55228
|
-
const sumCalcRuleMap = {};
|
|
55229
|
-
_.forEach(sumCalcCols, (col) => {
|
|
55230
|
-
addCalcRuleMap(sumCalcRuleMap, col.isSum, col.field || col.key);
|
|
55231
|
-
});
|
|
55225
|
+
console.time("calcSum");
|
|
55232
55226
|
let sumData = {};
|
|
55233
|
-
for (let
|
|
55234
|
-
if (!["checkbox", "radios", "index"].includes(
|
|
55235
|
-
|
|
55236
|
-
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";
|
|
55237
55230
|
break;
|
|
55238
55231
|
}
|
|
55239
55232
|
}
|
|
55240
|
-
sumCols.
|
|
55241
|
-
|
|
55242
|
-
|
|
55243
|
-
(
|
|
55244
|
-
|
|
55245
|
-
|
|
55246
|
-
|
|
55247
|
-
let field = dd.field || dd.key;
|
|
55248
|
-
let rowMergeInfo = this.tableRowSpanMergeIndexMap[field];
|
|
55249
|
-
let mergedRows = [];
|
|
55250
|
-
_.forEach(rowMergeInfo, (v, k) => {
|
|
55251
|
-
let rows2 = _.range(k, parseInt(k) + v);
|
|
55252
|
-
mergedRows.push(...rows2.slice(1));
|
|
55253
|
-
});
|
|
55254
|
-
if (!mergedRows.includes(idx)) {
|
|
55255
|
-
sumData[field] = _.round(
|
|
55256
|
-
sumData[field] + (!d[field] || isNaN(d[field]) ? 0 : parseFloat(d[field])),
|
|
55257
|
-
6
|
|
55258
|
-
);
|
|
55259
|
-
}
|
|
55260
|
-
});
|
|
55261
|
-
return s;
|
|
55262
|
-
},
|
|
55263
|
-
sumData
|
|
55264
|
-
);
|
|
55265
|
-
_.forEach(sumFuncCols, (d) => {
|
|
55266
|
-
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);
|
|
55267
55240
|
});
|
|
55268
|
-
|
|
55269
|
-
|
|
55270
|
-
|
|
55271
|
-
_.merge(calcRules, v);
|
|
55241
|
+
const sumCalcRuleMap = {};
|
|
55242
|
+
sumCalcCols.forEach((col) => {
|
|
55243
|
+
addCalcRuleMap(sumCalcRuleMap, col.isSum, col.field || col.key);
|
|
55272
55244
|
});
|
|
55273
|
-
|
|
55274
|
-
|
|
55275
|
-
|
|
55276
|
-
|
|
55277
|
-
|
|
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
|
+
}
|
|
55278
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);
|
|
55279
55267
|
rules.push({
|
|
55280
|
-
rltKey:
|
|
55281
|
-
ast:
|
|
55282
|
-
precision: ((
|
|
55268
|
+
rltKey: key,
|
|
55269
|
+
ast: sumCalcRuleMap[key],
|
|
55270
|
+
precision: ((_a = column == null ? void 0 : column.cellRendererParams) == null ? void 0 : _a.scale) || 2,
|
|
55283
55271
|
errRtn: 0
|
|
55284
55272
|
});
|
|
55285
|
-
}
|
|
55273
|
+
}
|
|
55286
55274
|
let options = { calcRules: rules };
|
|
55287
55275
|
calcDatas(sumRows, options);
|
|
55288
55276
|
this.topRows = this.pinnedTopRowDataWithUnit ? _.concat(this.pinnedTopRowDataWithUnit, sumRows) : sumRows;
|
|
55277
|
+
console.timeEnd("calcSum");
|
|
55289
55278
|
} else {
|
|
55290
55279
|
this.topRows = this.pinnedTopRowDataWithUnit;
|
|
55291
55280
|
}
|
|
55292
|
-
},
|
|
55281
|
+
}, 5),
|
|
55293
55282
|
async renderTreeData(val) {
|
|
55294
55283
|
this.treeData = _.some(val, (d) => {
|
|
55295
55284
|
var _a, _b;
|
|
@@ -55326,9 +55315,8 @@ const __vue2_script$Z = {
|
|
|
55326
55315
|
}
|
|
55327
55316
|
});
|
|
55328
55317
|
},
|
|
55329
|
-
tableRefresh:
|
|
55330
|
-
|
|
55331
|
-
if (this.dataApi && (!noQuery || !((_a = this.tableData) == null ? void 0 : _a.length))) {
|
|
55318
|
+
tableRefresh: function(noQuery) {
|
|
55319
|
+
if (this.dataApi && !noQuery) {
|
|
55332
55320
|
if (this.gridApi) {
|
|
55333
55321
|
this.gridApi.hideOverlay();
|
|
55334
55322
|
}
|
|
@@ -55355,21 +55343,11 @@ const __vue2_script$Z = {
|
|
|
55355
55343
|
d["_initialseq"] = idx;
|
|
55356
55344
|
});
|
|
55357
55345
|
if (this.unitType != this.defaultUnitType) {
|
|
55358
|
-
|
|
55359
|
-
|
|
55360
|
-
this.
|
|
55361
|
-
let t2 = _.round(parseFloat(d[dd]), 6);
|
|
55362
|
-
d[dd] = isNaN(t2) ? null : _.round(t2 * 5, 6);
|
|
55363
|
-
});
|
|
55364
|
-
});
|
|
55365
|
-
} else {
|
|
55366
|
-
data.forEach((d) => {
|
|
55367
|
-
this.switchCols.forEach((dd) => {
|
|
55368
|
-
let t2 = _.round(parseFloat(d[dd]), 6);
|
|
55369
|
-
d[dd] = isNaN(t2) ? null : _.round(t2 / 5, 6);
|
|
55370
|
-
});
|
|
55346
|
+
data.forEach((d) => {
|
|
55347
|
+
this.switchCols.forEach((dd) => {
|
|
55348
|
+
changeCellUnit(this.defaultUnitType, this.unitType, d, dd);
|
|
55371
55349
|
});
|
|
55372
|
-
}
|
|
55350
|
+
});
|
|
55373
55351
|
}
|
|
55374
55352
|
this.tableData = await this.renderTreeData(data);
|
|
55375
55353
|
this.totalNumber = result.data.total || 0;
|
|
@@ -55385,53 +55363,33 @@ const __vue2_script$Z = {
|
|
|
55385
55363
|
this.totalNumber = this.value.length;
|
|
55386
55364
|
}
|
|
55387
55365
|
this.optionDropdownVisible = false;
|
|
55388
|
-
},
|
|
55366
|
+
},
|
|
55389
55367
|
setUnitType(unitType) {
|
|
55390
55368
|
this.unitType = unitType;
|
|
55391
55369
|
},
|
|
55392
|
-
toggleUnitIfNeeded: _.debounce(async function
|
|
55370
|
+
toggleUnitIfNeeded: _.debounce(async function() {
|
|
55393
55371
|
setTimeout(() => {
|
|
55394
55372
|
if (this.pinnedTopRowDataWithUnit && this.pinnedTopRowDataWithUnit.length) {
|
|
55395
55373
|
let pinnedTopRowDataWithUnitTmp = _.cloneDeep(this.pinnedTopRowDataWithUnit);
|
|
55396
55374
|
if (this.unitType != this.defaultUnitType) {
|
|
55397
|
-
|
|
55398
|
-
|
|
55399
|
-
this.
|
|
55400
|
-
let t2 = _.round(parseFloat(d[dd]), 6);
|
|
55401
|
-
d[dd] = isNaN(t2) ? null : _.round(t2 / 5, 6);
|
|
55402
|
-
});
|
|
55403
|
-
});
|
|
55404
|
-
} else if (this.unitType == "WZ") {
|
|
55405
|
-
pinnedTopRowDataWithUnitTmp.forEach((d) => {
|
|
55406
|
-
this.switchCols.forEach((dd) => {
|
|
55407
|
-
let t2 = _.round(parseFloat(d[dd]), 6);
|
|
55408
|
-
d[dd] = isNaN(t2) ? null : _.round(t2 * 5, 6);
|
|
55409
|
-
});
|
|
55375
|
+
pinnedTopRowDataWithUnitTmp.forEach((d) => {
|
|
55376
|
+
this.switchCols.forEach((dd) => {
|
|
55377
|
+
changeCellUnit(this.defaultUnitType, this.unitType, d, dd);
|
|
55410
55378
|
});
|
|
55411
|
-
}
|
|
55379
|
+
});
|
|
55380
|
+
this.pinnedTopRowDataWithUnit = pinnedTopRowDataWithUnitTmp;
|
|
55381
|
+
this.renderSumRow();
|
|
55412
55382
|
}
|
|
55413
|
-
this.pinnedTopRowDataWithUnit = pinnedTopRowDataWithUnitTmp;
|
|
55414
|
-
this.renderSumRow();
|
|
55415
55383
|
}
|
|
55416
55384
|
let datasTmp = _.cloneDeep(this.tableData);
|
|
55417
55385
|
if (this.unitType != this.defaultUnitType) {
|
|
55418
|
-
|
|
55419
|
-
|
|
55420
|
-
this.
|
|
55421
|
-
let t2 = parseFloat(d[dd]);
|
|
55422
|
-
d[dd] = isNaN(t2) ? null : _.round(t2 * 5, 6);
|
|
55423
|
-
});
|
|
55424
|
-
});
|
|
55425
|
-
} else {
|
|
55426
|
-
datasTmp.forEach((d) => {
|
|
55427
|
-
this.switchCols.forEach((dd) => {
|
|
55428
|
-
let t2 = parseFloat(d[dd]);
|
|
55429
|
-
d[dd] = isNaN(t2) ? null : _.round(t2 / 5, 6);
|
|
55430
|
-
});
|
|
55386
|
+
datasTmp.forEach((d) => {
|
|
55387
|
+
this.switchCols.forEach((dd) => {
|
|
55388
|
+
changeCellUnit(this.defaultUnitType, this.unitType, d, dd);
|
|
55431
55389
|
});
|
|
55432
|
-
}
|
|
55390
|
+
});
|
|
55391
|
+
this.$emit("input", datasTmp);
|
|
55433
55392
|
}
|
|
55434
|
-
this.$emit("input", datasTmp);
|
|
55435
55393
|
}, 10);
|
|
55436
55394
|
}, 1),
|
|
55437
55395
|
getSelection() {
|
|
@@ -55468,8 +55426,7 @@ const __vue2_script$Z = {
|
|
|
55468
55426
|
let datasTmp = _.cloneDeep(this.tableData);
|
|
55469
55427
|
datasTmp.forEach((d) => {
|
|
55470
55428
|
this.switchCols.forEach((dd) => {
|
|
55471
|
-
|
|
55472
|
-
d[dd] = isNaN(t2) ? null : _.round(t2 / 5, 6);
|
|
55429
|
+
changeCellUnit(this.unitType, "X", d, dd);
|
|
55473
55430
|
});
|
|
55474
55431
|
});
|
|
55475
55432
|
return datasTmp;
|
|
@@ -55482,8 +55439,7 @@ const __vue2_script$Z = {
|
|
|
55482
55439
|
let datasTmp = _.cloneDeep(this.tableData);
|
|
55483
55440
|
datasTmp.forEach((d) => {
|
|
55484
55441
|
this.switchCols.forEach((dd) => {
|
|
55485
|
-
|
|
55486
|
-
d[dd] = isNaN(t2) ? null : _.round(t2 * 5, 6);
|
|
55442
|
+
changeCellUnit(this.unitType, "WZ", d, dd);
|
|
55487
55443
|
});
|
|
55488
55444
|
});
|
|
55489
55445
|
return datasTmp;
|
|
@@ -55496,8 +55452,7 @@ const __vue2_script$Z = {
|
|
|
55496
55452
|
let datasTmp = _.cloneDeep(this.topRows);
|
|
55497
55453
|
datasTmp.forEach((d) => {
|
|
55498
55454
|
this.switchCols.forEach((dd) => {
|
|
55499
|
-
|
|
55500
|
-
d[dd] = isNaN(t2) ? null : _.round(t2 / 5, 6);
|
|
55455
|
+
changeCellUnit(this.unitType, "X", d, dd);
|
|
55501
55456
|
});
|
|
55502
55457
|
});
|
|
55503
55458
|
return datasTmp;
|
|
@@ -55510,8 +55465,7 @@ const __vue2_script$Z = {
|
|
|
55510
55465
|
let datasTmp = _.cloneDeep(this.topRows);
|
|
55511
55466
|
datasTmp.forEach((d) => {
|
|
55512
55467
|
this.switchCols.forEach((dd) => {
|
|
55513
|
-
|
|
55514
|
-
d[dd] = isNaN(t2) ? null : _.round(t2 * 5, 6);
|
|
55468
|
+
changeCellUnit(this.unitType, "WZ", d, dd);
|
|
55515
55469
|
});
|
|
55516
55470
|
});
|
|
55517
55471
|
return datasTmp;
|