@weitutech/by-components 1.1.184 → 1.1.185
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/README.md +0 -439
- package/lib/by-components.common.js +747 -48
- package/lib/by-components.umd.js +747 -48
- package/lib/by-components.umd.min.js +1 -1
- package/package.json +1 -1
package/lib/by-components.umd.js
CHANGED
|
@@ -74534,8 +74534,8 @@ var component = normalizeComponent(
|
|
|
74534
74534
|
)
|
|
74535
74535
|
|
|
74536
74536
|
/* harmony default export */ var pager = (component.exports);
|
|
74537
|
-
;// ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"5daa4f39-vue-loader-template"}!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.use[1]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/cache-loader/dist/cjs.js??ruleSet[0].use[0]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/table/index.vue?vue&type=template&id=
|
|
74538
|
-
var
|
|
74537
|
+
;// ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"5daa4f39-vue-loader-template"}!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.use[1]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/cache-loader/dist/cjs.js??ruleSet[0].use[0]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/table/index.vue?vue&type=template&id=22e15733
|
|
74538
|
+
var tablevue_type_template_id_22e15733_render = function render() {
|
|
74539
74539
|
var _vm = this,
|
|
74540
74540
|
_c = _vm._self._c;
|
|
74541
74541
|
return _c('div', [_c('vxe-grid', _vm._g(_vm._b({
|
|
@@ -74607,6 +74607,7 @@ var tablevue_type_template_id_35ba1298_render = function render() {
|
|
|
74607
74607
|
"submit-method": _vm.gridOptions.customColumnConfig.submitMethod,
|
|
74608
74608
|
"fixed-max-count": _vm.gridOptions.customColumnConfig.fixedMaxCount,
|
|
74609
74609
|
"use-multi-level-header": _vm.gridOptions.customColumnConfig.useMultiLevelHeader,
|
|
74610
|
+
"aggregation-group": _vm.gridOptions.customColumnConfig.aggregationGroup,
|
|
74610
74611
|
"dialog-visible": _vm.customTableVisible
|
|
74611
74612
|
},
|
|
74612
74613
|
on: {
|
|
@@ -74619,7 +74620,7 @@ var tablevue_type_template_id_35ba1298_render = function render() {
|
|
|
74619
74620
|
}
|
|
74620
74621
|
}) : _vm._e()], 1);
|
|
74621
74622
|
};
|
|
74622
|
-
var
|
|
74623
|
+
var tablevue_type_template_id_22e15733_staticRenderFns = [];
|
|
74623
74624
|
|
|
74624
74625
|
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.push.js
|
|
74625
74626
|
var es_array_push = __webpack_require__(4114);
|
|
@@ -74641,8 +74642,8 @@ var es_set_is_superset_of_v2 = __webpack_require__(2475);
|
|
|
74641
74642
|
var es_set_symmetric_difference_v2 = __webpack_require__(5024);
|
|
74642
74643
|
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.set.union.v2.js
|
|
74643
74644
|
var es_set_union_v2 = __webpack_require__(1698);
|
|
74644
|
-
;// ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"5daa4f39-vue-loader-template"}!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.use[1]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/cache-loader/dist/cjs.js??ruleSet[0].use[0]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/custom-column/index.vue?vue&type=template&id=
|
|
74645
|
-
var
|
|
74645
|
+
;// ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"5daa4f39-vue-loader-template"}!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.use[1]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/cache-loader/dist/cjs.js??ruleSet[0].use[0]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/custom-column/index.vue?vue&type=template&id=d822d96a
|
|
74646
|
+
var custom_columnvue_type_template_id_d822d96a_render = function render() {
|
|
74646
74647
|
var _vm = this,
|
|
74647
74648
|
_c = _vm._self._c;
|
|
74648
74649
|
return _c('div', {
|
|
@@ -75033,7 +75034,7 @@ var custom_columnvue_type_template_id_2a1d0253_render = function render() {
|
|
|
75033
75034
|
}), 0)], 1)], 1)]);
|
|
75034
75035
|
}), 0)], 1)], 1)])])])])], 1);
|
|
75035
75036
|
};
|
|
75036
|
-
var
|
|
75037
|
+
var custom_columnvue_type_template_id_d822d96a_staticRenderFns = [];
|
|
75037
75038
|
|
|
75038
75039
|
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.filter.js
|
|
75039
75040
|
var es_iterator_filter = __webpack_require__(2489);
|
|
@@ -75041,6 +75042,8 @@ var es_iterator_filter = __webpack_require__(2489);
|
|
|
75041
75042
|
var es_iterator_find = __webpack_require__(116);
|
|
75042
75043
|
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.flat-map.js
|
|
75043
75044
|
var es_iterator_flat_map = __webpack_require__(531);
|
|
75045
|
+
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.some.js
|
|
75046
|
+
var es_iterator_some = __webpack_require__(3579);
|
|
75044
75047
|
// EXTERNAL MODULE: ./node_modules/vuedraggable/dist/vuedraggable.umd.js
|
|
75045
75048
|
var vuedraggable_umd = __webpack_require__(3741);
|
|
75046
75049
|
var vuedraggable_umd_default = /*#__PURE__*/__webpack_require__.n(vuedraggable_umd);
|
|
@@ -75864,6 +75867,261 @@ const isNullValue = value => {
|
|
|
75864
75867
|
|
|
75865
75868
|
;// ./src/assets/icons/pin.png
|
|
75866
75869
|
var pin_namespaceObject = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAEQUlEQVR4AbSWZ2hTURTHk3Q4UlwoKoggKKhg2qZ9baNFrYJI3CsgihOrgoj4RVBRxIH6RURwgnsLRXEhjkSF2pVWoQgaJS4QR2mslLbQ4e+EvNI2rzevbQznzz333jP+99x3743NEudfaWnpfvCopKRktZnQcSVQWFjYh6TbwQyr1XoWEsfRlRJXAh0zQWIj1TjVcbxt/38RqCX5bBI1gnxIXGhpabGiR0lcCSQmJmqRDF8zMzPvoy8GIivKysrOiNIRcSNAglms+oEkoL0praZpd1j5XNHBWmwu07aTuBDgY1tHontEttP6Wf1u9LBkZWXdtdlsc6TD3DJI3BBdR48JsL8HWfHpSMA7tbW1uRG9tcnIyBByMxhogIQHEgVerzeRvqXbBAiSRHIp9TYJBPZT8vl5eXn16FHC3GMGZwIhsSAlJeW2kOgWAZL3ZyVegi0BFvTlJNgpugrY+NgONzZCcpbdbj/RZQIkH0nCVwSZBH4T0MU+X0FXCtVyg6vNzc27MAwBC1u30DQBbrlBfGyrCPAa53GgEiJO9rcIXSkk3oKBHMultFPAMCDiMyTAKlfiVA1adCQlJVXB+BwYiOf1hoaGiaz8K7pSIC0n4IgYQXg9bV4ETrZkURSB8vLyIRiex2gAaCtVdG5R8uk4Ls3Nzf1LXyl+v98B4WtiRLsZwqfx9UVQIeNRBJxO5y8m3gHZowBkhuNgBYOBh5I/k7lYKCoqGsp2Sdnt2J7kbjhGGyVRBMQCtnJmgyQfg/5SqiLjZhEIBHolJCTcxX4E8AaDwU20hmJIALZfkpOTc0gewGt0U1PTi66QCIVCl/CTd+E9vvM9Hk8TfUMxJCCWqampP3F2QeIt/bHoL+QkoCuFj06OmdwPNWzBzJycnBqVQ6cExCk7O7uKUk5iK/z0x3ISfCoSnBg3hPdgKzIP/6AoKigJiGN6enqIoAdFBxMg4VWQOIGNyAZN03yixEJMAnzNI6iA/thIPIeQqKioaHdM5e5gciR4QHLlvyBsWkVJQB4LtqCACsjl0+qE4mhsbHxK0v7oYYHkNFGwjXkti50OJQFerEMYaqCtHCCJfJhOkj5uQ2JMxOhjpDXVdEqAD2oeEbYCXf6guCnvDm7DqegfgAaJZ5WVlSnoepXEjq45MSRQXFw8CveLQJfXlDyN5A9lQG5LqjAZXb5yZ11d3RP0wcCCXbW0ZhFFgH3vzQoLCNAPyHV8hsTpLpfrk/R1cFl9524QEp8ZywZhApz7H+imJYoA+34U7zQgfzTWkChfdCOQ7BuXjbxu32We7bggbVfQjgC32HKc8ynvJwKn8Xqdo68UuWywd5Ac86xVSmODyVYCnPfxBJLz+7C+vt5B4DcG9oZDVOk32UsNJ2MMhglwlPpGzvte9ttt5q2PEdf0dJgA5TsM1rMS/co1HaCnhjb+tWSQfB8lfN7TYEb+scb+AQAA//+s7i/8AAAABklEQVQDAIG7vmAdeEmvAAAAAElFTkSuQmCC";
|
|
75870
|
+
;// ./src/utils/aggregationUtils.js
|
|
75871
|
+
|
|
75872
|
+
|
|
75873
|
+
|
|
75874
|
+
|
|
75875
|
+
|
|
75876
|
+
|
|
75877
|
+
|
|
75878
|
+
/**
|
|
75879
|
+
* 聚合工具函数
|
|
75880
|
+
* 用于处理多级表头的聚合分组逻辑
|
|
75881
|
+
*/
|
|
75882
|
+
|
|
75883
|
+
/**
|
|
75884
|
+
* 判断是否需要聚合处理
|
|
75885
|
+
* @param {Array} columns - 列数据
|
|
75886
|
+
* @returns {boolean} 是否需要聚合
|
|
75887
|
+
*/
|
|
75888
|
+
function shouldAggregate(columns) {
|
|
75889
|
+
if (!Array.isArray(columns) || columns.length === 0) {
|
|
75890
|
+
return false;
|
|
75891
|
+
}
|
|
75892
|
+
|
|
75893
|
+
// 统计 groupkey 的出现次数
|
|
75894
|
+
const groupkeyCount = new Map();
|
|
75895
|
+
columns.forEach(group => {
|
|
75896
|
+
const groupkey = group.groupkey || group.groupKey || group.aggrKey;
|
|
75897
|
+
if (groupkey) {
|
|
75898
|
+
groupkeyCount.set(groupkey, (groupkeyCount.get(groupkey) || 0) + 1);
|
|
75899
|
+
}
|
|
75900
|
+
});
|
|
75901
|
+
|
|
75902
|
+
// 如果有重复的 groupkey,则需要聚合
|
|
75903
|
+
return Array.from(groupkeyCount.values()).some(count => count > 1);
|
|
75904
|
+
}
|
|
75905
|
+
|
|
75906
|
+
/**
|
|
75907
|
+
* 聚合列数据
|
|
75908
|
+
* 将具有相同 groupkey 的组聚合为一个组
|
|
75909
|
+
* @param {Array} columns - 原始列数据
|
|
75910
|
+
* @returns {Object} { aggregated: 聚合后的数据, originalMap: 原始数据映射 }
|
|
75911
|
+
*/
|
|
75912
|
+
function aggregateColumns(columns) {
|
|
75913
|
+
if (!Array.isArray(columns) || columns.length === 0) {
|
|
75914
|
+
return {
|
|
75915
|
+
aggregated: [],
|
|
75916
|
+
originalMap: new Map()
|
|
75917
|
+
};
|
|
75918
|
+
}
|
|
75919
|
+
|
|
75920
|
+
// 检查是否需要聚合
|
|
75921
|
+
if (!shouldAggregate(columns)) {
|
|
75922
|
+
return {
|
|
75923
|
+
aggregated: deepClone(columns),
|
|
75924
|
+
originalMap: new Map()
|
|
75925
|
+
};
|
|
75926
|
+
}
|
|
75927
|
+
|
|
75928
|
+
// 按 groupkey 分组
|
|
75929
|
+
const groupkeyGroups = new Map();
|
|
75930
|
+
const originalMap = new Map(); // 聚合组 -> 原始组数组的映射
|
|
75931
|
+
|
|
75932
|
+
columns.forEach(group => {
|
|
75933
|
+
const groupkey = group.groupkey || group.groupKey || group.aggrKey;
|
|
75934
|
+
if (groupkey) {
|
|
75935
|
+
if (!groupkeyGroups.has(groupkey)) {
|
|
75936
|
+
groupkeyGroups.set(groupkey, {
|
|
75937
|
+
label: group.groupName || group.label,
|
|
75938
|
+
// 使用 groupName 或 label
|
|
75939
|
+
groupkey: groupkey,
|
|
75940
|
+
groupName: group.groupName || group.label,
|
|
75941
|
+
data: [],
|
|
75942
|
+
originalGroups: [] // 保存原始组数据
|
|
75943
|
+
});
|
|
75944
|
+
originalMap.set(groupkey, []);
|
|
75945
|
+
}
|
|
75946
|
+
groupkeyGroups.get(groupkey).originalGroups.push(deepClone(group));
|
|
75947
|
+
originalMap.get(groupkey).push(deepClone(group));
|
|
75948
|
+
} else {
|
|
75949
|
+
// 没有 groupkey 的组,保持不变
|
|
75950
|
+
groupkeyGroups.set(group.label || `no-groupkey-${Date.now()}`, {
|
|
75951
|
+
label: group.label,
|
|
75952
|
+
data: [],
|
|
75953
|
+
originalGroups: [deepClone(group)]
|
|
75954
|
+
});
|
|
75955
|
+
if (!originalMap.has(group.label)) {
|
|
75956
|
+
originalMap.set(group.label, []);
|
|
75957
|
+
}
|
|
75958
|
+
originalMap.get(group.label).push(deepClone(group));
|
|
75959
|
+
}
|
|
75960
|
+
});
|
|
75961
|
+
|
|
75962
|
+
// 对每个聚合组,按 itemKey 合并 data
|
|
75963
|
+
const aggregated = [];
|
|
75964
|
+
groupkeyGroups.forEach((aggGroup, key) => {
|
|
75965
|
+
if (aggGroup.originalGroups.length === 0) {
|
|
75966
|
+
return;
|
|
75967
|
+
}
|
|
75968
|
+
|
|
75969
|
+
// 按 itemKey 分组合并
|
|
75970
|
+
const itemKeyMap = new Map();
|
|
75971
|
+
aggGroup.originalGroups.forEach(originalGroup => {
|
|
75972
|
+
if (Array.isArray(originalGroup.data)) {
|
|
75973
|
+
originalGroup.data.forEach(item => {
|
|
75974
|
+
const itemKey = item.itemKey || item.key;
|
|
75975
|
+
if (!itemKeyMap.has(itemKey)) {
|
|
75976
|
+
// 取第一个出现的项作为模板,保留所有属性
|
|
75977
|
+
itemKeyMap.set(itemKey, {
|
|
75978
|
+
...deepClone(item),
|
|
75979
|
+
itemKey: itemKey,
|
|
75980
|
+
originalItems: [] // 保存所有原始项
|
|
75981
|
+
});
|
|
75982
|
+
}
|
|
75983
|
+
itemKeyMap.get(itemKey).originalItems.push(deepClone(item));
|
|
75984
|
+
});
|
|
75985
|
+
}
|
|
75986
|
+
});
|
|
75987
|
+
|
|
75988
|
+
// 将 itemKeyMap 转换为数组
|
|
75989
|
+
const aggregatedData = Array.from(itemKeyMap.values());
|
|
75990
|
+
aggregated.push({
|
|
75991
|
+
label: aggGroup.label,
|
|
75992
|
+
groupkey: aggGroup.groupkey,
|
|
75993
|
+
groupName: aggGroup.groupName,
|
|
75994
|
+
data: aggregatedData,
|
|
75995
|
+
originalGroups: aggGroup.originalGroups
|
|
75996
|
+
});
|
|
75997
|
+
});
|
|
75998
|
+
return {
|
|
75999
|
+
aggregated,
|
|
76000
|
+
originalMap
|
|
76001
|
+
};
|
|
76002
|
+
}
|
|
76003
|
+
|
|
76004
|
+
/**
|
|
76005
|
+
* 将聚合后的数据展开为原始数据
|
|
76006
|
+
* 用于表格展示时恢复原始结构
|
|
76007
|
+
* @param {Array} aggregatedColumns - 聚合后的列数据
|
|
76008
|
+
* @param {Map} originalMap - 原始数据映射(可选,如果没有则从 aggregatedColumns 中获取)
|
|
76009
|
+
* @returns {Array} 展开后的原始列数据
|
|
76010
|
+
*/
|
|
76011
|
+
function expandAggregatedColumns(aggregatedColumns, originalMap = null) {
|
|
76012
|
+
if (!Array.isArray(aggregatedColumns) || aggregatedColumns.length === 0) {
|
|
76013
|
+
return [];
|
|
76014
|
+
}
|
|
76015
|
+
const expanded = [];
|
|
76016
|
+
aggregatedColumns.forEach(aggGroup => {
|
|
76017
|
+
if (!aggGroup.originalGroups || aggGroup.originalGroups.length === 0) {
|
|
76018
|
+
// 如果没有 originalGroups,说明不是聚合数据,直接使用
|
|
76019
|
+
expanded.push(deepClone(aggGroup));
|
|
76020
|
+
return;
|
|
76021
|
+
}
|
|
76022
|
+
|
|
76023
|
+
// 从聚合数据中获取当前状态(type, sort, fixed 等)
|
|
76024
|
+
const currentStateMap = new Map();
|
|
76025
|
+
if (Array.isArray(aggGroup.data)) {
|
|
76026
|
+
aggGroup.data.forEach(item => {
|
|
76027
|
+
const itemKey = item.itemKey || item.key;
|
|
76028
|
+
if (itemKey) {
|
|
76029
|
+
currentStateMap.set(itemKey, {
|
|
76030
|
+
type: item.type,
|
|
76031
|
+
sort: item.sort,
|
|
76032
|
+
fixed: item.fixed
|
|
76033
|
+
});
|
|
76034
|
+
}
|
|
76035
|
+
});
|
|
76036
|
+
}
|
|
76037
|
+
|
|
76038
|
+
// 将状态同步到原始组
|
|
76039
|
+
aggGroup.originalGroups.forEach(originalGroup => {
|
|
76040
|
+
const expandedGroup = deepClone(originalGroup);
|
|
76041
|
+
|
|
76042
|
+
// 恢复原始 label(如果存在 groupName 则使用原始的 label)
|
|
76043
|
+
if (aggGroup.groupName && originalGroup.label) {
|
|
76044
|
+
expandedGroup.label = originalGroup.label;
|
|
76045
|
+
}
|
|
76046
|
+
|
|
76047
|
+
// 同步每个 item 的状态,并按照聚合数据中的 sort 值排序
|
|
76048
|
+
if (Array.isArray(expandedGroup.data)) {
|
|
76049
|
+
expandedGroup.data.forEach(item => {
|
|
76050
|
+
const itemKey = item.itemKey || item.key;
|
|
76051
|
+
const currentState = currentStateMap.get(itemKey);
|
|
76052
|
+
if (currentState) {
|
|
76053
|
+
// 同步状态:type, sort, fixed 等
|
|
76054
|
+
item.type = currentState.type;
|
|
76055
|
+
item.sort = currentState.sort;
|
|
76056
|
+
if (currentState.fixed) {
|
|
76057
|
+
item.fixed = currentState.fixed;
|
|
76058
|
+
} else {
|
|
76059
|
+
delete item.fixed;
|
|
76060
|
+
}
|
|
76061
|
+
}
|
|
76062
|
+
});
|
|
76063
|
+
// 按照 sort 值排序,确保顺序与聚合数据中的顺序一致
|
|
76064
|
+
expandedGroup.data.sort((a, b) => {
|
|
76065
|
+
const sortA = typeof a.sort === 'number' ? a.sort : Number(a.sort) || 0;
|
|
76066
|
+
const sortB = typeof b.sort === 'number' ? b.sort : Number(b.sort) || 0;
|
|
76067
|
+
return sortA - sortB;
|
|
76068
|
+
});
|
|
76069
|
+
}
|
|
76070
|
+
expanded.push(expandedGroup);
|
|
76071
|
+
});
|
|
76072
|
+
});
|
|
76073
|
+
return expanded;
|
|
76074
|
+
}
|
|
76075
|
+
|
|
76076
|
+
/**
|
|
76077
|
+
* 根据 itemKey 同步操作所有相关的项
|
|
76078
|
+
* @param {Array} columns - 列数据(checkBoxMenu 格式)
|
|
76079
|
+
* @param {string} itemKey - 要同步的 itemKey
|
|
76080
|
+
* @param {Function} updateFn - 更新函数,接收 (item) => void
|
|
76081
|
+
*/
|
|
76082
|
+
function syncItemsByItemKey(columns, itemKey, updateFn) {
|
|
76083
|
+
if (!Array.isArray(columns) || !itemKey) {
|
|
76084
|
+
return;
|
|
76085
|
+
}
|
|
76086
|
+
columns.forEach(group => {
|
|
76087
|
+
if (Array.isArray(group.data)) {
|
|
76088
|
+
group.data.forEach(item => {
|
|
76089
|
+
const currentItemKey = item.itemKey || item.key;
|
|
76090
|
+
if (currentItemKey === itemKey) {
|
|
76091
|
+
updateFn(item);
|
|
76092
|
+
}
|
|
76093
|
+
});
|
|
76094
|
+
}
|
|
76095
|
+
});
|
|
76096
|
+
}
|
|
76097
|
+
|
|
76098
|
+
/**
|
|
76099
|
+
* 判断项是否属于聚合组
|
|
76100
|
+
* @param {Object} item - 项数据
|
|
76101
|
+
* @param {Array} columns - 列数据(checkBoxMenu 格式)
|
|
76102
|
+
* @returns {boolean} 是否属于聚合组
|
|
76103
|
+
*/
|
|
76104
|
+
function isItemInAggregatedGroup(item, columns) {
|
|
76105
|
+
if (!item || !columns || !Array.isArray(columns)) {
|
|
76106
|
+
return false;
|
|
76107
|
+
}
|
|
76108
|
+
const itemKey = item.itemKey || item.key;
|
|
76109
|
+
if (!itemKey) {
|
|
76110
|
+
return false;
|
|
76111
|
+
}
|
|
76112
|
+
|
|
76113
|
+
// 查找该项所属的组
|
|
76114
|
+
for (const group of columns) {
|
|
76115
|
+
if (Array.isArray(group.data)) {
|
|
76116
|
+
const foundItem = group.data.find(i => (i.itemKey || i.key) === itemKey);
|
|
76117
|
+
if (foundItem) {
|
|
76118
|
+
// 如果组的 originalGroups 存在且长度 > 1,说明是聚合组
|
|
76119
|
+
return group.originalGroups && Array.isArray(group.originalGroups) && group.originalGroups.length > 1;
|
|
76120
|
+
}
|
|
76121
|
+
}
|
|
76122
|
+
}
|
|
76123
|
+
return false;
|
|
76124
|
+
}
|
|
75867
76125
|
;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.use[1]!./node_modules/cache-loader/dist/cjs.js??ruleSet[0].use[0]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/custom-column/index.vue?vue&type=script&lang=js
|
|
75868
76126
|
|
|
75869
76127
|
|
|
@@ -75883,6 +76141,8 @@ var pin_namespaceObject = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAA
|
|
|
75883
76141
|
|
|
75884
76142
|
|
|
75885
76143
|
|
|
76144
|
+
|
|
76145
|
+
|
|
75886
76146
|
|
|
75887
76147
|
|
|
75888
76148
|
/* harmony default export */ var custom_columnvue_type_script_lang_js = ({
|
|
@@ -75918,6 +76178,11 @@ var pin_namespaceObject = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAA
|
|
|
75918
76178
|
useMultiLevelHeader: {
|
|
75919
76179
|
type: Boolean,
|
|
75920
76180
|
default: false
|
|
76181
|
+
},
|
|
76182
|
+
// 是否启用聚合分组(仅在 useMultiLevelHeader 为 true 时生效) - gridOptions.customColumnConfig.aggregationGroup配置
|
|
76183
|
+
aggregationGroup: {
|
|
76184
|
+
type: Boolean,
|
|
76185
|
+
default: false
|
|
75921
76186
|
}
|
|
75922
76187
|
},
|
|
75923
76188
|
data() {
|
|
@@ -75945,6 +76210,10 @@ var pin_namespaceObject = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAA
|
|
|
75945
76210
|
search: '',
|
|
75946
76211
|
/** 原始列数据备份 */
|
|
75947
76212
|
columnList: [],
|
|
76213
|
+
/** 聚合模式下的原始数据映射(用于展开) */
|
|
76214
|
+
originalColumnMap: null,
|
|
76215
|
+
/** 是否处于聚合模式 */
|
|
76216
|
+
isAggregationMode: false,
|
|
75948
76217
|
/** 对话框按钮配置 */
|
|
75949
76218
|
dialogButtons: [{
|
|
75950
76219
|
text: '取消',
|
|
@@ -76030,7 +76299,98 @@ var pin_namespaceObject = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAA
|
|
|
76030
76299
|
// 根据是否有固定列决定分割列位置
|
|
76031
76300
|
return fixedCols.length > 0 ? [...fixedCols, separator, ...normalCols] : [separator, ...normalCols];
|
|
76032
76301
|
};
|
|
76033
|
-
|
|
76302
|
+
|
|
76303
|
+
// ====== 聚合处理逻辑 ======
|
|
76304
|
+
// 判断是否需要聚合:useMultiLevelHeader && aggregationGroup && 存在相同的 groupkey
|
|
76305
|
+
this.isAggregationMode = false;
|
|
76306
|
+
this.originalColumnMap = null;
|
|
76307
|
+
if (this.useMultiLevelHeader && this.aggregationGroup && shouldAggregate(initColumn)) {
|
|
76308
|
+
// 进行聚合处理
|
|
76309
|
+
const {
|
|
76310
|
+
aggregated,
|
|
76311
|
+
originalMap
|
|
76312
|
+
} = aggregateColumns(initColumn);
|
|
76313
|
+
initColumn = aggregated;
|
|
76314
|
+
this.originalColumnMap = originalMap;
|
|
76315
|
+
this.isAggregationMode = true;
|
|
76316
|
+
|
|
76317
|
+
// 为聚合后的数据设置 parent 属性
|
|
76318
|
+
initColumn.forEach(group => {
|
|
76319
|
+
if (Array.isArray(group.data)) {
|
|
76320
|
+
group.data.forEach(item => {
|
|
76321
|
+
item.parent = {
|
|
76322
|
+
label: group.label
|
|
76323
|
+
};
|
|
76324
|
+
});
|
|
76325
|
+
}
|
|
76326
|
+
});
|
|
76327
|
+
if (bePreservedColumn && bePreservedColumn.length > 0) {
|
|
76328
|
+
// 将保存的数据按 itemKey 分组(服务端保存的是聚合后的结构)
|
|
76329
|
+
const preservedByItemKey = new Map();
|
|
76330
|
+
bePreservedColumn.forEach(col => {
|
|
76331
|
+
const itemKey = col.itemKey || col.key;
|
|
76332
|
+
if (itemKey && !preservedByItemKey.has(itemKey)) {
|
|
76333
|
+
preservedByItemKey.set(itemKey, col);
|
|
76334
|
+
}
|
|
76335
|
+
});
|
|
76336
|
+
|
|
76337
|
+
// 将保存的数据状态应用到聚合后的数据上
|
|
76338
|
+
initColumn.forEach(group => {
|
|
76339
|
+
if (Array.isArray(group.data)) {
|
|
76340
|
+
group.data.forEach(item => {
|
|
76341
|
+
const itemKey = item.itemKey || item.key;
|
|
76342
|
+
const preservedItem = preservedByItemKey.get(itemKey);
|
|
76343
|
+
if (preservedItem) {
|
|
76344
|
+
item.type = ['true', true, '1', 1].includes(preservedItem.type);
|
|
76345
|
+
item.sort = preservedItem.sort;
|
|
76346
|
+
item.fixed = preservedItem.fixed;
|
|
76347
|
+
} else {
|
|
76348
|
+
// 如果服务端没有保存该项,说明该项之前没有被选中,应该设置为 false
|
|
76349
|
+
item.type = false;
|
|
76350
|
+
}
|
|
76351
|
+
});
|
|
76352
|
+
}
|
|
76353
|
+
});
|
|
76354
|
+
} else {
|
|
76355
|
+
// 聚合模式下,如果没有保存的数据(恢复默认时),需要确保使用原始数据的 type 值
|
|
76356
|
+
// 因为 aggregateColumns 会保留第一个出现的项的属性,但如果第一个项的 type 是 false,
|
|
76357
|
+
// 我们需要检查所有 originalItems,如果有任何一个的 type 是 true,则使用 true
|
|
76358
|
+
// 如果所有 originalItems 的 type 都是 false 或 undefined,则使用 true(默认选中)
|
|
76359
|
+
initColumn.forEach(group => {
|
|
76360
|
+
if (Array.isArray(group.data)) {
|
|
76361
|
+
group.data.forEach(item => {
|
|
76362
|
+
if (item.originalItems && item.originalItems.length > 0) {
|
|
76363
|
+
// 检查所有 originalItems 的 type 值
|
|
76364
|
+
const hasTrueType = item.originalItems.some(origItem => origItem.type === true || origItem.type === 'true' || origItem.type === 1 || origItem.type === '1');
|
|
76365
|
+
// 如果任何一个 originalItem 的 type 是 true,则使用 true;否则使用 true(默认选中)
|
|
76366
|
+
item.type = hasTrueType || item.type === undefined || item.type === null ? true : item.type;
|
|
76367
|
+
} else if (item.type === undefined || item.type === null) {
|
|
76368
|
+
// 如果没有 originalItems,默认设置为 true
|
|
76369
|
+
item.type = true;
|
|
76370
|
+
}
|
|
76371
|
+
});
|
|
76372
|
+
}
|
|
76373
|
+
});
|
|
76374
|
+
}
|
|
76375
|
+
|
|
76376
|
+
// 聚合模式下,需要设置 checkBoxMenu 和 draggableMenu
|
|
76377
|
+
this.checkBoxMenu = this.deepClone(initColumn);
|
|
76378
|
+
// 聚合模式下,左侧顺序应该保持原始数据的顺序,不受保存顺序影响
|
|
76379
|
+
// 所以这里不根据 savedGroupOrder 重新排序 checkBoxMenu
|
|
76380
|
+
this.draggableMenu = setDraggableMenu(this.checkBoxMenu);
|
|
76381
|
+
if (this.useMultiLevelHeader) {
|
|
76382
|
+
if (this.baseGroupOrder.length === 0) {
|
|
76383
|
+
this.baseGroupOrder = this.checkBoxMenu.map(g => g.label);
|
|
76384
|
+
}
|
|
76385
|
+
// 如果有保存的顺序,使用保存的顺序;否则使用 baseGroupOrder
|
|
76386
|
+
if (this.savedGroupOrder && this.savedGroupOrder.length > 0) {
|
|
76387
|
+
this.groupOrderPersist = this.savedGroupOrder.slice();
|
|
76388
|
+
} else if (this.groupOrderPersist.length === 0) {
|
|
76389
|
+
this.groupOrderPersist = this.baseGroupOrder.slice();
|
|
76390
|
+
}
|
|
76391
|
+
this.refreshMultiHeaderDerivedData();
|
|
76392
|
+
}
|
|
76393
|
+
} else if (bePreservedColumn && bePreservedColumn.length > 0) {
|
|
76034
76394
|
// 需要处理被保存过的进行回显
|
|
76035
76395
|
initColumn.forEach(cols => {
|
|
76036
76396
|
cols.data.forEach(col => {
|
|
@@ -76059,12 +76419,16 @@ var pin_namespaceObject = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAA
|
|
|
76059
76419
|
} else {
|
|
76060
76420
|
// console.log('==========从未被保存过', initColumn)
|
|
76061
76421
|
|
|
76062
|
-
//
|
|
76422
|
+
// 从未被保存过:按照原始数据的默认状态初始化
|
|
76423
|
+
// 如果原始数据有 type 字段,使用原始数据的 type 值;否则默认为 true
|
|
76063
76424
|
let num = 0;
|
|
76064
76425
|
initColumn.forEach(cols => {
|
|
76065
76426
|
cols.data.forEach(col => {
|
|
76066
76427
|
num++;
|
|
76067
|
-
|
|
76428
|
+
// 如果原始数据没有 type 字段,则设置为 true(默认选中)
|
|
76429
|
+
if (col.type === undefined || col.type === null) {
|
|
76430
|
+
col.type = true;
|
|
76431
|
+
}
|
|
76068
76432
|
col.width = col.width ? +col.width : 0;
|
|
76069
76433
|
col.sort = num;
|
|
76070
76434
|
// 设置 fixed 和 parent 属性
|
|
@@ -76089,11 +76453,98 @@ var pin_namespaceObject = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAA
|
|
|
76089
76453
|
}
|
|
76090
76454
|
if (this.useMultiLevelHeader) {
|
|
76091
76455
|
// 多级表头模式
|
|
76092
|
-
|
|
76093
|
-
|
|
76094
|
-
|
|
76095
|
-
|
|
76096
|
-
|
|
76456
|
+
// 如果是聚合模式,需要基于 groupCards 的顺序构建数据传给表格
|
|
76457
|
+
if (this.isAggregationMode) {
|
|
76458
|
+
// 使用和 submit 方法相同的逻辑,基于 groupCards 和 fixedAreaList 构建聚合数据
|
|
76459
|
+
const orderedAggregatedGroups = [];
|
|
76460
|
+
const labelToGroupData = new Map();
|
|
76461
|
+
let sortIndex = 1
|
|
76462
|
+
|
|
76463
|
+
// 先处理固定项,按固定项的顺序添加到对应组,并重新分配 sort 值
|
|
76464
|
+
;
|
|
76465
|
+
(this.fixedAreaList || []).forEach(item => {
|
|
76466
|
+
if (item.type && item.parent) {
|
|
76467
|
+
const label = item.parent.label;
|
|
76468
|
+
if (!labelToGroupData.has(label)) {
|
|
76469
|
+
labelToGroupData.set(label, []);
|
|
76470
|
+
}
|
|
76471
|
+
const itemData = {
|
|
76472
|
+
...item,
|
|
76473
|
+
parent: item.parent
|
|
76474
|
+
};
|
|
76475
|
+
itemData.sort = sortIndex++;
|
|
76476
|
+
labelToGroupData.get(label).push(itemData);
|
|
76477
|
+
}
|
|
76478
|
+
});
|
|
76479
|
+
|
|
76480
|
+
// 然后处理 groupCards 中的项,按它们在 groupCards 中的顺序添加到对应组,并重新分配 sort 值
|
|
76481
|
+
this.groupCards.forEach(group => {
|
|
76482
|
+
const label = group.label;
|
|
76483
|
+
if (!labelToGroupData.has(label)) {
|
|
76484
|
+
labelToGroupData.set(label, []);
|
|
76485
|
+
}
|
|
76486
|
+
;
|
|
76487
|
+
(group.items || []).forEach(item => {
|
|
76488
|
+
if (item.type && item.parent) {
|
|
76489
|
+
const itemData = {
|
|
76490
|
+
...item,
|
|
76491
|
+
parent: item.parent
|
|
76492
|
+
};
|
|
76493
|
+
itemData.sort = sortIndex++;
|
|
76494
|
+
labelToGroupData.get(label).push(itemData);
|
|
76495
|
+
}
|
|
76496
|
+
});
|
|
76497
|
+
});
|
|
76498
|
+
|
|
76499
|
+
// 按 groupCards 的顺序构建聚合组
|
|
76500
|
+
const orderedLabels = this.groupCards.map(g => g.label);
|
|
76501
|
+
// 先添加有固定项的组(如果它们不在 groupCards 中)
|
|
76502
|
+
const fixedGroupLabels = new Set();
|
|
76503
|
+
(this.fixedAreaList || []).forEach(item => {
|
|
76504
|
+
if (item.type && item.parent) {
|
|
76505
|
+
fixedGroupLabels.add(item.parent.label);
|
|
76506
|
+
}
|
|
76507
|
+
});
|
|
76508
|
+
fixedGroupLabels.forEach(label => {
|
|
76509
|
+
if (!orderedLabels.includes(label) && labelToGroupData.has(label)) {
|
|
76510
|
+
orderedLabels.push(label);
|
|
76511
|
+
}
|
|
76512
|
+
});
|
|
76513
|
+
|
|
76514
|
+
// 构建聚合组数据
|
|
76515
|
+
orderedLabels.forEach(label => {
|
|
76516
|
+
const items = labelToGroupData.get(label) || [];
|
|
76517
|
+
if (items.length > 0) {
|
|
76518
|
+
const sourceGroup = this.checkBoxMenu.find(g => g.label === label);
|
|
76519
|
+
const group = {
|
|
76520
|
+
label: label,
|
|
76521
|
+
data: items.map(item => {
|
|
76522
|
+
const {
|
|
76523
|
+
parent,
|
|
76524
|
+
...itemData
|
|
76525
|
+
} = item;
|
|
76526
|
+
return itemData;
|
|
76527
|
+
})
|
|
76528
|
+
};
|
|
76529
|
+
if (sourceGroup) {
|
|
76530
|
+
if (sourceGroup.groupkey) group.groupkey = sourceGroup.groupkey;
|
|
76531
|
+
if (sourceGroup.groupName) group.groupName = sourceGroup.groupName;
|
|
76532
|
+
if (sourceGroup.originalGroups) group.originalGroups = sourceGroup.originalGroups;
|
|
76533
|
+
}
|
|
76534
|
+
orderedAggregatedGroups.push(group);
|
|
76535
|
+
}
|
|
76536
|
+
});
|
|
76537
|
+
|
|
76538
|
+
// 展开聚合数据传给表格
|
|
76539
|
+
const expandedColumns = expandAggregatedColumns(orderedAggregatedGroups, this.originalColumnMap);
|
|
76540
|
+
this.emitChangeTableGroup(expandedColumns);
|
|
76541
|
+
} else {
|
|
76542
|
+
const clonedCheckBoxMenu = this.checkBoxMenu.map(group => ({
|
|
76543
|
+
...group,
|
|
76544
|
+
data: group.data.map(col => this.deepClone(col))
|
|
76545
|
+
}));
|
|
76546
|
+
this.emitChangeTableGroup(clonedCheckBoxMenu);
|
|
76547
|
+
}
|
|
76097
76548
|
} else {
|
|
76098
76549
|
const clonedDraggableMenu = this.draggableMenu.filter(item => item.key !== 'sort-cut-off').map(item => this.deepClone(item)).sort((a, b) => a.sort - b.sort);
|
|
76099
76550
|
this.emitChangeTable(clonedDraggableMenu);
|
|
@@ -76163,18 +76614,86 @@ var pin_namespaceObject = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAA
|
|
|
76163
76614
|
* @param { boolean } type 是否显示
|
|
76164
76615
|
*/
|
|
76165
76616
|
changeCheckbox(key, type) {
|
|
76166
|
-
|
|
76167
|
-
|
|
76168
|
-
|
|
76617
|
+
// 查找操作的项
|
|
76618
|
+
let targetItem = null;
|
|
76619
|
+
this.checkBoxMenu.forEach(group => {
|
|
76620
|
+
if (Array.isArray(group.data)) {
|
|
76621
|
+
group.data.forEach(item => {
|
|
76622
|
+
if (item.key === key) {
|
|
76623
|
+
targetItem = item;
|
|
76624
|
+
}
|
|
76625
|
+
});
|
|
76169
76626
|
}
|
|
76170
76627
|
});
|
|
76171
|
-
|
|
76172
|
-
|
|
76173
|
-
|
|
76174
|
-
|
|
76628
|
+
|
|
76629
|
+
// 如果是聚合模式,需要同步所有相同 itemKey 的项
|
|
76630
|
+
if (this.isAggregationMode && targetItem) {
|
|
76631
|
+
const itemKey = targetItem.itemKey || targetItem.key;
|
|
76632
|
+
if (itemKey) {
|
|
76633
|
+
// 同步所有相同 itemKey 的项
|
|
76634
|
+
syncItemsByItemKey(this.checkBoxMenu, itemKey, item => {
|
|
76635
|
+
item.type = type;
|
|
76636
|
+
});
|
|
76637
|
+
// 在聚合模式下,需要从 checkBoxMenu 重新构建 draggableMenu,以确保所有项的 parent 属性正确
|
|
76638
|
+
// 但是需要保留 draggableMenu 中的顺序(通过 sort 值)和 fixed 状态
|
|
76639
|
+
const setDraggableMenu = arr => {
|
|
76640
|
+
const allColumns = arr.flatMap(item => item.data);
|
|
76641
|
+
const fixedCols = allColumns.filter(col => col.fixed === 'left').sort((a, b) => a.sort - b.sort);
|
|
76642
|
+
const normalCols = allColumns.filter(col => col.fixed !== 'left').sort((a, b) => a.sort - b.sort);
|
|
76643
|
+
const separator = {
|
|
76644
|
+
type: true,
|
|
76645
|
+
label: '',
|
|
76646
|
+
key: 'sort-cut-off',
|
|
76647
|
+
fixed: fixedCols.length > 0 ? 'left' : undefined,
|
|
76648
|
+
parent: ''
|
|
76649
|
+
};
|
|
76650
|
+
return fixedCols.length > 0 ? [...fixedCols, separator, ...normalCols] : [separator, ...normalCols];
|
|
76651
|
+
};
|
|
76652
|
+
|
|
76653
|
+
// 保存当前的 sort 和 fixed 状态
|
|
76654
|
+
const currentStateMap = new Map();
|
|
76655
|
+
this.draggableMenu.forEach(item => {
|
|
76656
|
+
if (item.key !== 'sort-cut-off') {
|
|
76657
|
+
const itemKeyForState = item.itemKey || item.key;
|
|
76658
|
+
currentStateMap.set(itemKeyForState, {
|
|
76659
|
+
sort: item.sort,
|
|
76660
|
+
fixed: item.fixed
|
|
76661
|
+
});
|
|
76662
|
+
}
|
|
76663
|
+
});
|
|
76664
|
+
|
|
76665
|
+
// 从 checkBoxMenu 重新构建 draggableMenu
|
|
76666
|
+
this.draggableMenu = setDraggableMenu(this.checkBoxMenu);
|
|
76667
|
+
|
|
76668
|
+
// 恢复 sort 和 fixed 状态
|
|
76669
|
+
this.draggableMenu.forEach(item => {
|
|
76670
|
+
if (item.key !== 'sort-cut-off') {
|
|
76671
|
+
const itemKeyForState = item.itemKey || item.key;
|
|
76672
|
+
const state = currentStateMap.get(itemKeyForState);
|
|
76673
|
+
if (state) {
|
|
76674
|
+
item.sort = state.sort;
|
|
76675
|
+
if (state.fixed) {
|
|
76676
|
+
item.fixed = state.fixed;
|
|
76677
|
+
}
|
|
76678
|
+
}
|
|
76679
|
+
}
|
|
76680
|
+
});
|
|
76681
|
+
}
|
|
76682
|
+
} else {
|
|
76683
|
+
// 非聚合模式,保持原有逻辑
|
|
76684
|
+
this.draggableMenu.forEach(item => {
|
|
76685
|
+
if (item.key === key) {
|
|
76686
|
+
item.type = type;
|
|
76175
76687
|
}
|
|
76176
76688
|
});
|
|
76177
|
-
|
|
76689
|
+
this.checkBoxMenu.forEach(item => {
|
|
76690
|
+
item.data.forEach(each => {
|
|
76691
|
+
if (each.key === key) {
|
|
76692
|
+
each.type = type;
|
|
76693
|
+
}
|
|
76694
|
+
});
|
|
76695
|
+
});
|
|
76696
|
+
}
|
|
76178
76697
|
if (this.useMultiLevelHeader) {
|
|
76179
76698
|
this.refreshMultiHeaderDerivedData();
|
|
76180
76699
|
}
|
|
@@ -76187,7 +76706,10 @@ var pin_namespaceObject = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAA
|
|
|
76187
76706
|
this.savedGroupOrder = [];
|
|
76188
76707
|
this.baseGroupOrder = [];
|
|
76189
76708
|
}
|
|
76190
|
-
|
|
76709
|
+
// 恢复默认时,传递空数组作为 bePreservedColumn,让 initTableList 按照原始数据的默认状态初始化
|
|
76710
|
+
// 注意:这里传入空数组,initTableList 会走到 else 分支,将所有项的 type 设置为 true
|
|
76711
|
+
// 但原始数据可能已经有自己的 type 值,所以需要先重置为原始数据
|
|
76712
|
+
this.initTableList(this.deepClone(this.columnList), []);
|
|
76191
76713
|
// 恢复默认后,滚动到顶部
|
|
76192
76714
|
this.$nextTick(() => {
|
|
76193
76715
|
this.$nextTick(() => {
|
|
@@ -76240,17 +76762,75 @@ var pin_namespaceObject = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAA
|
|
|
76240
76762
|
}
|
|
76241
76763
|
const shouldCheck = !this.getGroupCheckState(group);
|
|
76242
76764
|
|
|
76243
|
-
//
|
|
76244
|
-
|
|
76245
|
-
|
|
76246
|
-
|
|
76247
|
-
|
|
76248
|
-
|
|
76249
|
-
|
|
76250
|
-
|
|
76765
|
+
// 如果是聚合模式,需要同步所有相同 itemKey 的项
|
|
76766
|
+
if (this.isAggregationMode) {
|
|
76767
|
+
group.data.forEach(item => {
|
|
76768
|
+
const itemKey = item.itemKey || item.key;
|
|
76769
|
+
if (itemKey) {
|
|
76770
|
+
// 同步所有相同 itemKey 的项
|
|
76771
|
+
syncItemsByItemKey(this.checkBoxMenu, itemKey, item => {
|
|
76772
|
+
item.type = shouldCheck;
|
|
76773
|
+
});
|
|
76251
76774
|
}
|
|
76252
76775
|
});
|
|
76253
|
-
|
|
76776
|
+
// 在聚合模式下,需要从 checkBoxMenu 重新构建 draggableMenu,以确保所有项的 parent 属性正确
|
|
76777
|
+
// 但是需要保留 draggableMenu 中的顺序(通过 sort 值)和 fixed 状态
|
|
76778
|
+
const setDraggableMenu = arr => {
|
|
76779
|
+
const allColumns = arr.flatMap(item => item.data);
|
|
76780
|
+
const fixedCols = allColumns.filter(col => col.fixed === 'left').sort((a, b) => a.sort - b.sort);
|
|
76781
|
+
const normalCols = allColumns.filter(col => col.fixed !== 'left').sort((a, b) => a.sort - b.sort);
|
|
76782
|
+
const separator = {
|
|
76783
|
+
type: true,
|
|
76784
|
+
label: '',
|
|
76785
|
+
key: 'sort-cut-off',
|
|
76786
|
+
fixed: fixedCols.length > 0 ? 'left' : undefined,
|
|
76787
|
+
parent: ''
|
|
76788
|
+
};
|
|
76789
|
+
return fixedCols.length > 0 ? [...fixedCols, separator, ...normalCols] : [separator, ...normalCols];
|
|
76790
|
+
};
|
|
76791
|
+
|
|
76792
|
+
// 保存当前的 sort 和 fixed 状态
|
|
76793
|
+
const currentStateMap = new Map();
|
|
76794
|
+
this.draggableMenu.forEach(item => {
|
|
76795
|
+
if (item.key !== 'sort-cut-off') {
|
|
76796
|
+
const itemKeyForState = item.itemKey || item.key;
|
|
76797
|
+
currentStateMap.set(itemKeyForState, {
|
|
76798
|
+
sort: item.sort,
|
|
76799
|
+
fixed: item.fixed
|
|
76800
|
+
});
|
|
76801
|
+
}
|
|
76802
|
+
});
|
|
76803
|
+
|
|
76804
|
+
// 从 checkBoxMenu 重新构建 draggableMenu
|
|
76805
|
+
this.draggableMenu = setDraggableMenu(this.checkBoxMenu);
|
|
76806
|
+
|
|
76807
|
+
// 恢复 sort 和 fixed 状态
|
|
76808
|
+
this.draggableMenu.forEach(item => {
|
|
76809
|
+
if (item.key !== 'sort-cut-off') {
|
|
76810
|
+
const itemKeyForState = item.itemKey || item.key;
|
|
76811
|
+
const state = currentStateMap.get(itemKeyForState);
|
|
76812
|
+
if (state) {
|
|
76813
|
+
item.sort = state.sort;
|
|
76814
|
+
if (state.fixed) {
|
|
76815
|
+
item.fixed = state.fixed;
|
|
76816
|
+
}
|
|
76817
|
+
}
|
|
76818
|
+
}
|
|
76819
|
+
});
|
|
76820
|
+
} else {
|
|
76821
|
+
// 非聚合模式,保持原有逻辑
|
|
76822
|
+
// 批量更新该组下所有项的勾选状态
|
|
76823
|
+
group.data.forEach(item => {
|
|
76824
|
+
// 更新 checkBoxMenu 中的状态
|
|
76825
|
+
item.type = shouldCheck;
|
|
76826
|
+
// 同步更新 draggableMenu 中的状态
|
|
76827
|
+
this.draggableMenu.forEach(dragItem => {
|
|
76828
|
+
if (dragItem.key === item.key) {
|
|
76829
|
+
dragItem.type = shouldCheck;
|
|
76830
|
+
}
|
|
76831
|
+
});
|
|
76832
|
+
});
|
|
76833
|
+
}
|
|
76254
76834
|
if (this.useMultiLevelHeader) {
|
|
76255
76835
|
this.refreshMultiHeaderDerivedData();
|
|
76256
76836
|
}
|
|
@@ -76383,6 +76963,14 @@ var pin_namespaceObject = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAA
|
|
|
76383
76963
|
return item && item.fixed === 'left';
|
|
76384
76964
|
},
|
|
76385
76965
|
toggleFixed(item, toFixed) {
|
|
76966
|
+
// 如果是聚合模式且该项属于聚合组,禁止固定
|
|
76967
|
+
if (this.isAggregationMode && toFixed) {
|
|
76968
|
+
if (isItemInAggregatedGroup(item, this.checkBoxMenu)) {
|
|
76969
|
+
this.$message.warning('聚合组内的项不能进行固定');
|
|
76970
|
+
return;
|
|
76971
|
+
}
|
|
76972
|
+
}
|
|
76973
|
+
|
|
76386
76974
|
// 根据 toFixed 将该项移动到分割线以上或以下
|
|
76387
76975
|
const idx = this.draggableMenu.findIndex(i => i.key === item.key);
|
|
76388
76976
|
if (idx === -1) return;
|
|
@@ -76448,19 +77036,43 @@ var pin_namespaceObject = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAA
|
|
|
76448
77036
|
const present = new Set();
|
|
76449
77037
|
orderedLabels.forEach(label => {
|
|
76450
77038
|
if (labelToData.has(label)) {
|
|
76451
|
-
|
|
77039
|
+
// 从 checkBoxMenu 中找到对应的组,获取 groupkey 和 groupName
|
|
77040
|
+
const sourceGroup = this.checkBoxMenu.find(g => g.label === label);
|
|
77041
|
+
const groupData = {
|
|
76452
77042
|
label,
|
|
76453
77043
|
data: labelToData.get(label)
|
|
76454
|
-
}
|
|
77044
|
+
};
|
|
77045
|
+
// 如果是聚合模式,需要保存 groupkey 和 groupName
|
|
77046
|
+
if (this.isAggregationMode && sourceGroup) {
|
|
77047
|
+
if (sourceGroup.groupkey) {
|
|
77048
|
+
groupData.groupkey = sourceGroup.groupkey;
|
|
77049
|
+
}
|
|
77050
|
+
if (sourceGroup.groupName) {
|
|
77051
|
+
groupData.groupName = sourceGroup.groupName;
|
|
77052
|
+
}
|
|
77053
|
+
}
|
|
77054
|
+
params.column.push(groupData);
|
|
76455
77055
|
present.add(label);
|
|
76456
77056
|
}
|
|
76457
77057
|
});
|
|
76458
77058
|
baseOrder.forEach(label => {
|
|
76459
77059
|
if (!present.has(label) && labelToData.has(label)) {
|
|
76460
|
-
|
|
77060
|
+
// 从 checkBoxMenu 中找到对应的组,获取 groupkey 和 groupName
|
|
77061
|
+
const sourceGroup = this.checkBoxMenu.find(g => g.label === label);
|
|
77062
|
+
const groupData = {
|
|
76461
77063
|
label,
|
|
76462
77064
|
data: labelToData.get(label)
|
|
76463
|
-
}
|
|
77065
|
+
};
|
|
77066
|
+
// 如果是聚合模式,需要保存 groupkey 和 groupName
|
|
77067
|
+
if (this.isAggregationMode && sourceGroup) {
|
|
77068
|
+
if (sourceGroup.groupkey) {
|
|
77069
|
+
groupData.groupkey = sourceGroup.groupkey;
|
|
77070
|
+
}
|
|
77071
|
+
if (sourceGroup.groupName) {
|
|
77072
|
+
groupData.groupName = sourceGroup.groupName;
|
|
77073
|
+
}
|
|
77074
|
+
}
|
|
77075
|
+
params.column.push(groupData);
|
|
76464
77076
|
}
|
|
76465
77077
|
});
|
|
76466
77078
|
} else {
|
|
@@ -76530,11 +77142,99 @@ var pin_namespaceObject = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAA
|
|
|
76530
77142
|
});
|
|
76531
77143
|
if (this.useMultiLevelHeader) {
|
|
76532
77144
|
// 多级表头模式
|
|
76533
|
-
|
|
76534
|
-
|
|
76535
|
-
|
|
76536
|
-
|
|
76537
|
-
|
|
77145
|
+
// 如果是聚合模式,需要展开为原始数据传给表格
|
|
77146
|
+
// 注意:需要基于当前的 groupCards 和 fixedAreaList 构建聚合数据,以反映拖动后的顺序
|
|
77147
|
+
if (this.isAggregationMode) {
|
|
77148
|
+
// 先从 groupCards 和 fixedAreaList 构建出聚合后的数据结构(反映当前顺序)
|
|
77149
|
+
const orderedAggregatedGroups = [];
|
|
77150
|
+
const labelToGroupData = new Map();
|
|
77151
|
+
let sortIndex = 1
|
|
77152
|
+
|
|
77153
|
+
// 先处理固定项,按固定项的顺序添加到对应组,并重新分配 sort 值
|
|
77154
|
+
;
|
|
77155
|
+
(this.fixedAreaList || []).forEach(item => {
|
|
77156
|
+
if (item.type && item.parent) {
|
|
77157
|
+
const label = item.parent.label;
|
|
77158
|
+
if (!labelToGroupData.has(label)) {
|
|
77159
|
+
labelToGroupData.set(label, []);
|
|
77160
|
+
}
|
|
77161
|
+
const itemData = {
|
|
77162
|
+
...item,
|
|
77163
|
+
parent: item.parent
|
|
77164
|
+
};
|
|
77165
|
+
itemData.sort = sortIndex++;
|
|
77166
|
+
labelToGroupData.get(label).push(itemData);
|
|
77167
|
+
}
|
|
77168
|
+
});
|
|
77169
|
+
|
|
77170
|
+
// 然后处理 groupCards 中的项,按它们在 groupCards 中的顺序添加到对应组,并重新分配 sort 值
|
|
77171
|
+
this.groupCards.forEach(group => {
|
|
77172
|
+
const label = group.label;
|
|
77173
|
+
if (!labelToGroupData.has(label)) {
|
|
77174
|
+
labelToGroupData.set(label, []);
|
|
77175
|
+
}
|
|
77176
|
+
;
|
|
77177
|
+
(group.items || []).forEach(item => {
|
|
77178
|
+
if (item.type && item.parent) {
|
|
77179
|
+
const itemData = {
|
|
77180
|
+
...item,
|
|
77181
|
+
parent: item.parent
|
|
77182
|
+
};
|
|
77183
|
+
itemData.sort = sortIndex++;
|
|
77184
|
+
labelToGroupData.get(label).push(itemData);
|
|
77185
|
+
}
|
|
77186
|
+
});
|
|
77187
|
+
});
|
|
77188
|
+
|
|
77189
|
+
// 按 groupCards 的顺序构建聚合组
|
|
77190
|
+
const orderedLabels = this.groupCards.map(g => g.label);
|
|
77191
|
+
// 先添加有固定项的组(如果它们不在 groupCards 中)
|
|
77192
|
+
const fixedGroupLabels = new Set();
|
|
77193
|
+
(this.fixedAreaList || []).forEach(item => {
|
|
77194
|
+
if (item.type && item.parent) {
|
|
77195
|
+
fixedGroupLabels.add(item.parent.label);
|
|
77196
|
+
}
|
|
77197
|
+
});
|
|
77198
|
+
fixedGroupLabels.forEach(label => {
|
|
77199
|
+
if (!orderedLabels.includes(label) && labelToGroupData.has(label)) {
|
|
77200
|
+
orderedLabels.push(label);
|
|
77201
|
+
}
|
|
77202
|
+
});
|
|
77203
|
+
|
|
77204
|
+
// 构建聚合组数据
|
|
77205
|
+
orderedLabels.forEach(label => {
|
|
77206
|
+
const items = labelToGroupData.get(label) || [];
|
|
77207
|
+
if (items.length > 0) {
|
|
77208
|
+
const sourceGroup = this.checkBoxMenu.find(g => g.label === label);
|
|
77209
|
+
const group = {
|
|
77210
|
+
label: label,
|
|
77211
|
+
data: items.map(item => {
|
|
77212
|
+
const {
|
|
77213
|
+
parent,
|
|
77214
|
+
...itemData
|
|
77215
|
+
} = item;
|
|
77216
|
+
return itemData;
|
|
77217
|
+
})
|
|
77218
|
+
};
|
|
77219
|
+
if (sourceGroup) {
|
|
77220
|
+
if (sourceGroup.groupkey) group.groupkey = sourceGroup.groupkey;
|
|
77221
|
+
if (sourceGroup.groupName) group.groupName = sourceGroup.groupName;
|
|
77222
|
+
if (sourceGroup.originalGroups) group.originalGroups = sourceGroup.originalGroups;
|
|
77223
|
+
}
|
|
77224
|
+
orderedAggregatedGroups.push(group);
|
|
77225
|
+
}
|
|
77226
|
+
});
|
|
77227
|
+
|
|
77228
|
+
// 展开聚合数据传给表格
|
|
77229
|
+
const expandedColumns = expandAggregatedColumns(orderedAggregatedGroups, this.originalColumnMap);
|
|
77230
|
+
this.emitChangeTableGroup(expandedColumns);
|
|
77231
|
+
} else {
|
|
77232
|
+
const clonedColumn = params.column.map(group => ({
|
|
77233
|
+
...group,
|
|
77234
|
+
data: group.data.map(col => this.deepClone(col))
|
|
77235
|
+
}));
|
|
77236
|
+
this.emitChangeTableGroup(clonedColumn);
|
|
77237
|
+
}
|
|
76538
77238
|
} else {
|
|
76539
77239
|
this.emitChangeTable(cols.sort((a, b) => a.sort - b.sort));
|
|
76540
77240
|
}
|
|
@@ -76585,8 +77285,8 @@ var pin_namespaceObject = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAA
|
|
|
76585
77285
|
;
|
|
76586
77286
|
var custom_column_component = normalizeComponent(
|
|
76587
77287
|
components_custom_columnvue_type_script_lang_js,
|
|
76588
|
-
|
|
76589
|
-
|
|
77288
|
+
custom_columnvue_type_template_id_d822d96a_render,
|
|
77289
|
+
custom_columnvue_type_template_id_d822d96a_staticRenderFns,
|
|
76590
77290
|
false,
|
|
76591
77291
|
null,
|
|
76592
77292
|
null,
|
|
@@ -77287,7 +77987,8 @@ var custom_column_component = normalizeComponent(
|
|
|
77287
77987
|
// 更新分页配置
|
|
77288
77988
|
this.gridOptions.pagerConfig.currentPage = currentPage;
|
|
77289
77989
|
this.gridOptions.pagerConfig.pageSize = pageSize;
|
|
77290
|
-
|
|
77990
|
+
// 如果有置顶行,总数需要减1(置顶行不参与分页计数)
|
|
77991
|
+
this.gridOptions.pagerConfig.total = specialFirstRow ? allData.length - 1 : allData.length;
|
|
77291
77992
|
|
|
77292
77993
|
// 获取当前页数据
|
|
77293
77994
|
currentPageData = normalData.slice(start, end);
|
|
@@ -77537,8 +78238,8 @@ var custom_column_component = normalizeComponent(
|
|
|
77537
78238
|
;
|
|
77538
78239
|
var table_component = normalizeComponent(
|
|
77539
78240
|
components_tablevue_type_script_lang_js,
|
|
77540
|
-
|
|
77541
|
-
|
|
78241
|
+
tablevue_type_template_id_22e15733_render,
|
|
78242
|
+
tablevue_type_template_id_22e15733_staticRenderFns,
|
|
77542
78243
|
false,
|
|
77543
78244
|
null,
|
|
77544
78245
|
null,
|
|
@@ -78833,8 +79534,6 @@ var ByCommonSelectorvue_type_template_id_05ec4584_render = function render() {
|
|
|
78833
79534
|
};
|
|
78834
79535
|
var ByCommonSelectorvue_type_template_id_05ec4584_staticRenderFns = [];
|
|
78835
79536
|
|
|
78836
|
-
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.some.js
|
|
78837
|
-
var es_iterator_some = __webpack_require__(3579);
|
|
78838
79537
|
;// ./node_modules/pinyin-pro/dist/index.mjs
|
|
78839
79538
|
|
|
78840
79539
|
|