@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
|
@@ -74524,8 +74524,8 @@ var component = normalizeComponent(
|
|
|
74524
74524
|
)
|
|
74525
74525
|
|
|
74526
74526
|
/* harmony default export */ var pager = (component.exports);
|
|
74527
|
-
;// ./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-40.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=
|
|
74528
|
-
var
|
|
74527
|
+
;// ./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-40.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
|
|
74528
|
+
var tablevue_type_template_id_22e15733_render = function render() {
|
|
74529
74529
|
var _vm = this,
|
|
74530
74530
|
_c = _vm._self._c;
|
|
74531
74531
|
return _c('div', [_c('vxe-grid', _vm._g(_vm._b({
|
|
@@ -74597,6 +74597,7 @@ var tablevue_type_template_id_35ba1298_render = function render() {
|
|
|
74597
74597
|
"submit-method": _vm.gridOptions.customColumnConfig.submitMethod,
|
|
74598
74598
|
"fixed-max-count": _vm.gridOptions.customColumnConfig.fixedMaxCount,
|
|
74599
74599
|
"use-multi-level-header": _vm.gridOptions.customColumnConfig.useMultiLevelHeader,
|
|
74600
|
+
"aggregation-group": _vm.gridOptions.customColumnConfig.aggregationGroup,
|
|
74600
74601
|
"dialog-visible": _vm.customTableVisible
|
|
74601
74602
|
},
|
|
74602
74603
|
on: {
|
|
@@ -74609,7 +74610,7 @@ var tablevue_type_template_id_35ba1298_render = function render() {
|
|
|
74609
74610
|
}
|
|
74610
74611
|
}) : _vm._e()], 1);
|
|
74611
74612
|
};
|
|
74612
|
-
var
|
|
74613
|
+
var tablevue_type_template_id_22e15733_staticRenderFns = [];
|
|
74613
74614
|
|
|
74614
74615
|
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.push.js
|
|
74615
74616
|
var es_array_push = __webpack_require__(4114);
|
|
@@ -74631,8 +74632,8 @@ var es_set_is_superset_of_v2 = __webpack_require__(2475);
|
|
|
74631
74632
|
var es_set_symmetric_difference_v2 = __webpack_require__(5024);
|
|
74632
74633
|
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.set.union.v2.js
|
|
74633
74634
|
var es_set_union_v2 = __webpack_require__(1698);
|
|
74634
|
-
;// ./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-40.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=
|
|
74635
|
-
var
|
|
74635
|
+
;// ./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-40.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
|
|
74636
|
+
var custom_columnvue_type_template_id_d822d96a_render = function render() {
|
|
74636
74637
|
var _vm = this,
|
|
74637
74638
|
_c = _vm._self._c;
|
|
74638
74639
|
return _c('div', {
|
|
@@ -75023,7 +75024,7 @@ var custom_columnvue_type_template_id_2a1d0253_render = function render() {
|
|
|
75023
75024
|
}), 0)], 1)], 1)]);
|
|
75024
75025
|
}), 0)], 1)], 1)])])])])], 1);
|
|
75025
75026
|
};
|
|
75026
|
-
var
|
|
75027
|
+
var custom_columnvue_type_template_id_d822d96a_staticRenderFns = [];
|
|
75027
75028
|
|
|
75028
75029
|
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.filter.js
|
|
75029
75030
|
var es_iterator_filter = __webpack_require__(2489);
|
|
@@ -75031,6 +75032,8 @@ var es_iterator_filter = __webpack_require__(2489);
|
|
|
75031
75032
|
var es_iterator_find = __webpack_require__(116);
|
|
75032
75033
|
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.flat-map.js
|
|
75033
75034
|
var es_iterator_flat_map = __webpack_require__(531);
|
|
75035
|
+
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.some.js
|
|
75036
|
+
var es_iterator_some = __webpack_require__(3579);
|
|
75034
75037
|
// EXTERNAL MODULE: ./node_modules/vuedraggable/dist/vuedraggable.umd.js
|
|
75035
75038
|
var vuedraggable_umd = __webpack_require__(9135);
|
|
75036
75039
|
var vuedraggable_umd_default = /*#__PURE__*/__webpack_require__.n(vuedraggable_umd);
|
|
@@ -75854,6 +75857,261 @@ const isNullValue = value => {
|
|
|
75854
75857
|
|
|
75855
75858
|
;// ./src/assets/icons/pin.png
|
|
75856
75859
|
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";
|
|
75860
|
+
;// ./src/utils/aggregationUtils.js
|
|
75861
|
+
|
|
75862
|
+
|
|
75863
|
+
|
|
75864
|
+
|
|
75865
|
+
|
|
75866
|
+
|
|
75867
|
+
|
|
75868
|
+
/**
|
|
75869
|
+
* 聚合工具函数
|
|
75870
|
+
* 用于处理多级表头的聚合分组逻辑
|
|
75871
|
+
*/
|
|
75872
|
+
|
|
75873
|
+
/**
|
|
75874
|
+
* 判断是否需要聚合处理
|
|
75875
|
+
* @param {Array} columns - 列数据
|
|
75876
|
+
* @returns {boolean} 是否需要聚合
|
|
75877
|
+
*/
|
|
75878
|
+
function shouldAggregate(columns) {
|
|
75879
|
+
if (!Array.isArray(columns) || columns.length === 0) {
|
|
75880
|
+
return false;
|
|
75881
|
+
}
|
|
75882
|
+
|
|
75883
|
+
// 统计 groupkey 的出现次数
|
|
75884
|
+
const groupkeyCount = new Map();
|
|
75885
|
+
columns.forEach(group => {
|
|
75886
|
+
const groupkey = group.groupkey || group.groupKey || group.aggrKey;
|
|
75887
|
+
if (groupkey) {
|
|
75888
|
+
groupkeyCount.set(groupkey, (groupkeyCount.get(groupkey) || 0) + 1);
|
|
75889
|
+
}
|
|
75890
|
+
});
|
|
75891
|
+
|
|
75892
|
+
// 如果有重复的 groupkey,则需要聚合
|
|
75893
|
+
return Array.from(groupkeyCount.values()).some(count => count > 1);
|
|
75894
|
+
}
|
|
75895
|
+
|
|
75896
|
+
/**
|
|
75897
|
+
* 聚合列数据
|
|
75898
|
+
* 将具有相同 groupkey 的组聚合为一个组
|
|
75899
|
+
* @param {Array} columns - 原始列数据
|
|
75900
|
+
* @returns {Object} { aggregated: 聚合后的数据, originalMap: 原始数据映射 }
|
|
75901
|
+
*/
|
|
75902
|
+
function aggregateColumns(columns) {
|
|
75903
|
+
if (!Array.isArray(columns) || columns.length === 0) {
|
|
75904
|
+
return {
|
|
75905
|
+
aggregated: [],
|
|
75906
|
+
originalMap: new Map()
|
|
75907
|
+
};
|
|
75908
|
+
}
|
|
75909
|
+
|
|
75910
|
+
// 检查是否需要聚合
|
|
75911
|
+
if (!shouldAggregate(columns)) {
|
|
75912
|
+
return {
|
|
75913
|
+
aggregated: deepClone(columns),
|
|
75914
|
+
originalMap: new Map()
|
|
75915
|
+
};
|
|
75916
|
+
}
|
|
75917
|
+
|
|
75918
|
+
// 按 groupkey 分组
|
|
75919
|
+
const groupkeyGroups = new Map();
|
|
75920
|
+
const originalMap = new Map(); // 聚合组 -> 原始组数组的映射
|
|
75921
|
+
|
|
75922
|
+
columns.forEach(group => {
|
|
75923
|
+
const groupkey = group.groupkey || group.groupKey || group.aggrKey;
|
|
75924
|
+
if (groupkey) {
|
|
75925
|
+
if (!groupkeyGroups.has(groupkey)) {
|
|
75926
|
+
groupkeyGroups.set(groupkey, {
|
|
75927
|
+
label: group.groupName || group.label,
|
|
75928
|
+
// 使用 groupName 或 label
|
|
75929
|
+
groupkey: groupkey,
|
|
75930
|
+
groupName: group.groupName || group.label,
|
|
75931
|
+
data: [],
|
|
75932
|
+
originalGroups: [] // 保存原始组数据
|
|
75933
|
+
});
|
|
75934
|
+
originalMap.set(groupkey, []);
|
|
75935
|
+
}
|
|
75936
|
+
groupkeyGroups.get(groupkey).originalGroups.push(deepClone(group));
|
|
75937
|
+
originalMap.get(groupkey).push(deepClone(group));
|
|
75938
|
+
} else {
|
|
75939
|
+
// 没有 groupkey 的组,保持不变
|
|
75940
|
+
groupkeyGroups.set(group.label || `no-groupkey-${Date.now()}`, {
|
|
75941
|
+
label: group.label,
|
|
75942
|
+
data: [],
|
|
75943
|
+
originalGroups: [deepClone(group)]
|
|
75944
|
+
});
|
|
75945
|
+
if (!originalMap.has(group.label)) {
|
|
75946
|
+
originalMap.set(group.label, []);
|
|
75947
|
+
}
|
|
75948
|
+
originalMap.get(group.label).push(deepClone(group));
|
|
75949
|
+
}
|
|
75950
|
+
});
|
|
75951
|
+
|
|
75952
|
+
// 对每个聚合组,按 itemKey 合并 data
|
|
75953
|
+
const aggregated = [];
|
|
75954
|
+
groupkeyGroups.forEach((aggGroup, key) => {
|
|
75955
|
+
if (aggGroup.originalGroups.length === 0) {
|
|
75956
|
+
return;
|
|
75957
|
+
}
|
|
75958
|
+
|
|
75959
|
+
// 按 itemKey 分组合并
|
|
75960
|
+
const itemKeyMap = new Map();
|
|
75961
|
+
aggGroup.originalGroups.forEach(originalGroup => {
|
|
75962
|
+
if (Array.isArray(originalGroup.data)) {
|
|
75963
|
+
originalGroup.data.forEach(item => {
|
|
75964
|
+
const itemKey = item.itemKey || item.key;
|
|
75965
|
+
if (!itemKeyMap.has(itemKey)) {
|
|
75966
|
+
// 取第一个出现的项作为模板,保留所有属性
|
|
75967
|
+
itemKeyMap.set(itemKey, {
|
|
75968
|
+
...deepClone(item),
|
|
75969
|
+
itemKey: itemKey,
|
|
75970
|
+
originalItems: [] // 保存所有原始项
|
|
75971
|
+
});
|
|
75972
|
+
}
|
|
75973
|
+
itemKeyMap.get(itemKey).originalItems.push(deepClone(item));
|
|
75974
|
+
});
|
|
75975
|
+
}
|
|
75976
|
+
});
|
|
75977
|
+
|
|
75978
|
+
// 将 itemKeyMap 转换为数组
|
|
75979
|
+
const aggregatedData = Array.from(itemKeyMap.values());
|
|
75980
|
+
aggregated.push({
|
|
75981
|
+
label: aggGroup.label,
|
|
75982
|
+
groupkey: aggGroup.groupkey,
|
|
75983
|
+
groupName: aggGroup.groupName,
|
|
75984
|
+
data: aggregatedData,
|
|
75985
|
+
originalGroups: aggGroup.originalGroups
|
|
75986
|
+
});
|
|
75987
|
+
});
|
|
75988
|
+
return {
|
|
75989
|
+
aggregated,
|
|
75990
|
+
originalMap
|
|
75991
|
+
};
|
|
75992
|
+
}
|
|
75993
|
+
|
|
75994
|
+
/**
|
|
75995
|
+
* 将聚合后的数据展开为原始数据
|
|
75996
|
+
* 用于表格展示时恢复原始结构
|
|
75997
|
+
* @param {Array} aggregatedColumns - 聚合后的列数据
|
|
75998
|
+
* @param {Map} originalMap - 原始数据映射(可选,如果没有则从 aggregatedColumns 中获取)
|
|
75999
|
+
* @returns {Array} 展开后的原始列数据
|
|
76000
|
+
*/
|
|
76001
|
+
function expandAggregatedColumns(aggregatedColumns, originalMap = null) {
|
|
76002
|
+
if (!Array.isArray(aggregatedColumns) || aggregatedColumns.length === 0) {
|
|
76003
|
+
return [];
|
|
76004
|
+
}
|
|
76005
|
+
const expanded = [];
|
|
76006
|
+
aggregatedColumns.forEach(aggGroup => {
|
|
76007
|
+
if (!aggGroup.originalGroups || aggGroup.originalGroups.length === 0) {
|
|
76008
|
+
// 如果没有 originalGroups,说明不是聚合数据,直接使用
|
|
76009
|
+
expanded.push(deepClone(aggGroup));
|
|
76010
|
+
return;
|
|
76011
|
+
}
|
|
76012
|
+
|
|
76013
|
+
// 从聚合数据中获取当前状态(type, sort, fixed 等)
|
|
76014
|
+
const currentStateMap = new Map();
|
|
76015
|
+
if (Array.isArray(aggGroup.data)) {
|
|
76016
|
+
aggGroup.data.forEach(item => {
|
|
76017
|
+
const itemKey = item.itemKey || item.key;
|
|
76018
|
+
if (itemKey) {
|
|
76019
|
+
currentStateMap.set(itemKey, {
|
|
76020
|
+
type: item.type,
|
|
76021
|
+
sort: item.sort,
|
|
76022
|
+
fixed: item.fixed
|
|
76023
|
+
});
|
|
76024
|
+
}
|
|
76025
|
+
});
|
|
76026
|
+
}
|
|
76027
|
+
|
|
76028
|
+
// 将状态同步到原始组
|
|
76029
|
+
aggGroup.originalGroups.forEach(originalGroup => {
|
|
76030
|
+
const expandedGroup = deepClone(originalGroup);
|
|
76031
|
+
|
|
76032
|
+
// 恢复原始 label(如果存在 groupName 则使用原始的 label)
|
|
76033
|
+
if (aggGroup.groupName && originalGroup.label) {
|
|
76034
|
+
expandedGroup.label = originalGroup.label;
|
|
76035
|
+
}
|
|
76036
|
+
|
|
76037
|
+
// 同步每个 item 的状态,并按照聚合数据中的 sort 值排序
|
|
76038
|
+
if (Array.isArray(expandedGroup.data)) {
|
|
76039
|
+
expandedGroup.data.forEach(item => {
|
|
76040
|
+
const itemKey = item.itemKey || item.key;
|
|
76041
|
+
const currentState = currentStateMap.get(itemKey);
|
|
76042
|
+
if (currentState) {
|
|
76043
|
+
// 同步状态:type, sort, fixed 等
|
|
76044
|
+
item.type = currentState.type;
|
|
76045
|
+
item.sort = currentState.sort;
|
|
76046
|
+
if (currentState.fixed) {
|
|
76047
|
+
item.fixed = currentState.fixed;
|
|
76048
|
+
} else {
|
|
76049
|
+
delete item.fixed;
|
|
76050
|
+
}
|
|
76051
|
+
}
|
|
76052
|
+
});
|
|
76053
|
+
// 按照 sort 值排序,确保顺序与聚合数据中的顺序一致
|
|
76054
|
+
expandedGroup.data.sort((a, b) => {
|
|
76055
|
+
const sortA = typeof a.sort === 'number' ? a.sort : Number(a.sort) || 0;
|
|
76056
|
+
const sortB = typeof b.sort === 'number' ? b.sort : Number(b.sort) || 0;
|
|
76057
|
+
return sortA - sortB;
|
|
76058
|
+
});
|
|
76059
|
+
}
|
|
76060
|
+
expanded.push(expandedGroup);
|
|
76061
|
+
});
|
|
76062
|
+
});
|
|
76063
|
+
return expanded;
|
|
76064
|
+
}
|
|
76065
|
+
|
|
76066
|
+
/**
|
|
76067
|
+
* 根据 itemKey 同步操作所有相关的项
|
|
76068
|
+
* @param {Array} columns - 列数据(checkBoxMenu 格式)
|
|
76069
|
+
* @param {string} itemKey - 要同步的 itemKey
|
|
76070
|
+
* @param {Function} updateFn - 更新函数,接收 (item) => void
|
|
76071
|
+
*/
|
|
76072
|
+
function syncItemsByItemKey(columns, itemKey, updateFn) {
|
|
76073
|
+
if (!Array.isArray(columns) || !itemKey) {
|
|
76074
|
+
return;
|
|
76075
|
+
}
|
|
76076
|
+
columns.forEach(group => {
|
|
76077
|
+
if (Array.isArray(group.data)) {
|
|
76078
|
+
group.data.forEach(item => {
|
|
76079
|
+
const currentItemKey = item.itemKey || item.key;
|
|
76080
|
+
if (currentItemKey === itemKey) {
|
|
76081
|
+
updateFn(item);
|
|
76082
|
+
}
|
|
76083
|
+
});
|
|
76084
|
+
}
|
|
76085
|
+
});
|
|
76086
|
+
}
|
|
76087
|
+
|
|
76088
|
+
/**
|
|
76089
|
+
* 判断项是否属于聚合组
|
|
76090
|
+
* @param {Object} item - 项数据
|
|
76091
|
+
* @param {Array} columns - 列数据(checkBoxMenu 格式)
|
|
76092
|
+
* @returns {boolean} 是否属于聚合组
|
|
76093
|
+
*/
|
|
76094
|
+
function isItemInAggregatedGroup(item, columns) {
|
|
76095
|
+
if (!item || !columns || !Array.isArray(columns)) {
|
|
76096
|
+
return false;
|
|
76097
|
+
}
|
|
76098
|
+
const itemKey = item.itemKey || item.key;
|
|
76099
|
+
if (!itemKey) {
|
|
76100
|
+
return false;
|
|
76101
|
+
}
|
|
76102
|
+
|
|
76103
|
+
// 查找该项所属的组
|
|
76104
|
+
for (const group of columns) {
|
|
76105
|
+
if (Array.isArray(group.data)) {
|
|
76106
|
+
const foundItem = group.data.find(i => (i.itemKey || i.key) === itemKey);
|
|
76107
|
+
if (foundItem) {
|
|
76108
|
+
// 如果组的 originalGroups 存在且长度 > 1,说明是聚合组
|
|
76109
|
+
return group.originalGroups && Array.isArray(group.originalGroups) && group.originalGroups.length > 1;
|
|
76110
|
+
}
|
|
76111
|
+
}
|
|
76112
|
+
}
|
|
76113
|
+
return false;
|
|
76114
|
+
}
|
|
75857
76115
|
;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.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
|
|
75858
76116
|
|
|
75859
76117
|
|
|
@@ -75873,6 +76131,8 @@ var pin_namespaceObject = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAA
|
|
|
75873
76131
|
|
|
75874
76132
|
|
|
75875
76133
|
|
|
76134
|
+
|
|
76135
|
+
|
|
75876
76136
|
|
|
75877
76137
|
|
|
75878
76138
|
/* harmony default export */ var custom_columnvue_type_script_lang_js = ({
|
|
@@ -75908,6 +76168,11 @@ var pin_namespaceObject = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAA
|
|
|
75908
76168
|
useMultiLevelHeader: {
|
|
75909
76169
|
type: Boolean,
|
|
75910
76170
|
default: false
|
|
76171
|
+
},
|
|
76172
|
+
// 是否启用聚合分组(仅在 useMultiLevelHeader 为 true 时生效) - gridOptions.customColumnConfig.aggregationGroup配置
|
|
76173
|
+
aggregationGroup: {
|
|
76174
|
+
type: Boolean,
|
|
76175
|
+
default: false
|
|
75911
76176
|
}
|
|
75912
76177
|
},
|
|
75913
76178
|
data() {
|
|
@@ -75935,6 +76200,10 @@ var pin_namespaceObject = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAA
|
|
|
75935
76200
|
search: '',
|
|
75936
76201
|
/** 原始列数据备份 */
|
|
75937
76202
|
columnList: [],
|
|
76203
|
+
/** 聚合模式下的原始数据映射(用于展开) */
|
|
76204
|
+
originalColumnMap: null,
|
|
76205
|
+
/** 是否处于聚合模式 */
|
|
76206
|
+
isAggregationMode: false,
|
|
75938
76207
|
/** 对话框按钮配置 */
|
|
75939
76208
|
dialogButtons: [{
|
|
75940
76209
|
text: '取消',
|
|
@@ -76020,7 +76289,98 @@ var pin_namespaceObject = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAA
|
|
|
76020
76289
|
// 根据是否有固定列决定分割列位置
|
|
76021
76290
|
return fixedCols.length > 0 ? [...fixedCols, separator, ...normalCols] : [separator, ...normalCols];
|
|
76022
76291
|
};
|
|
76023
|
-
|
|
76292
|
+
|
|
76293
|
+
// ====== 聚合处理逻辑 ======
|
|
76294
|
+
// 判断是否需要聚合:useMultiLevelHeader && aggregationGroup && 存在相同的 groupkey
|
|
76295
|
+
this.isAggregationMode = false;
|
|
76296
|
+
this.originalColumnMap = null;
|
|
76297
|
+
if (this.useMultiLevelHeader && this.aggregationGroup && shouldAggregate(initColumn)) {
|
|
76298
|
+
// 进行聚合处理
|
|
76299
|
+
const {
|
|
76300
|
+
aggregated,
|
|
76301
|
+
originalMap
|
|
76302
|
+
} = aggregateColumns(initColumn);
|
|
76303
|
+
initColumn = aggregated;
|
|
76304
|
+
this.originalColumnMap = originalMap;
|
|
76305
|
+
this.isAggregationMode = true;
|
|
76306
|
+
|
|
76307
|
+
// 为聚合后的数据设置 parent 属性
|
|
76308
|
+
initColumn.forEach(group => {
|
|
76309
|
+
if (Array.isArray(group.data)) {
|
|
76310
|
+
group.data.forEach(item => {
|
|
76311
|
+
item.parent = {
|
|
76312
|
+
label: group.label
|
|
76313
|
+
};
|
|
76314
|
+
});
|
|
76315
|
+
}
|
|
76316
|
+
});
|
|
76317
|
+
if (bePreservedColumn && bePreservedColumn.length > 0) {
|
|
76318
|
+
// 将保存的数据按 itemKey 分组(服务端保存的是聚合后的结构)
|
|
76319
|
+
const preservedByItemKey = new Map();
|
|
76320
|
+
bePreservedColumn.forEach(col => {
|
|
76321
|
+
const itemKey = col.itemKey || col.key;
|
|
76322
|
+
if (itemKey && !preservedByItemKey.has(itemKey)) {
|
|
76323
|
+
preservedByItemKey.set(itemKey, col);
|
|
76324
|
+
}
|
|
76325
|
+
});
|
|
76326
|
+
|
|
76327
|
+
// 将保存的数据状态应用到聚合后的数据上
|
|
76328
|
+
initColumn.forEach(group => {
|
|
76329
|
+
if (Array.isArray(group.data)) {
|
|
76330
|
+
group.data.forEach(item => {
|
|
76331
|
+
const itemKey = item.itemKey || item.key;
|
|
76332
|
+
const preservedItem = preservedByItemKey.get(itemKey);
|
|
76333
|
+
if (preservedItem) {
|
|
76334
|
+
item.type = ['true', true, '1', 1].includes(preservedItem.type);
|
|
76335
|
+
item.sort = preservedItem.sort;
|
|
76336
|
+
item.fixed = preservedItem.fixed;
|
|
76337
|
+
} else {
|
|
76338
|
+
// 如果服务端没有保存该项,说明该项之前没有被选中,应该设置为 false
|
|
76339
|
+
item.type = false;
|
|
76340
|
+
}
|
|
76341
|
+
});
|
|
76342
|
+
}
|
|
76343
|
+
});
|
|
76344
|
+
} else {
|
|
76345
|
+
// 聚合模式下,如果没有保存的数据(恢复默认时),需要确保使用原始数据的 type 值
|
|
76346
|
+
// 因为 aggregateColumns 会保留第一个出现的项的属性,但如果第一个项的 type 是 false,
|
|
76347
|
+
// 我们需要检查所有 originalItems,如果有任何一个的 type 是 true,则使用 true
|
|
76348
|
+
// 如果所有 originalItems 的 type 都是 false 或 undefined,则使用 true(默认选中)
|
|
76349
|
+
initColumn.forEach(group => {
|
|
76350
|
+
if (Array.isArray(group.data)) {
|
|
76351
|
+
group.data.forEach(item => {
|
|
76352
|
+
if (item.originalItems && item.originalItems.length > 0) {
|
|
76353
|
+
// 检查所有 originalItems 的 type 值
|
|
76354
|
+
const hasTrueType = item.originalItems.some(origItem => origItem.type === true || origItem.type === 'true' || origItem.type === 1 || origItem.type === '1');
|
|
76355
|
+
// 如果任何一个 originalItem 的 type 是 true,则使用 true;否则使用 true(默认选中)
|
|
76356
|
+
item.type = hasTrueType || item.type === undefined || item.type === null ? true : item.type;
|
|
76357
|
+
} else if (item.type === undefined || item.type === null) {
|
|
76358
|
+
// 如果没有 originalItems,默认设置为 true
|
|
76359
|
+
item.type = true;
|
|
76360
|
+
}
|
|
76361
|
+
});
|
|
76362
|
+
}
|
|
76363
|
+
});
|
|
76364
|
+
}
|
|
76365
|
+
|
|
76366
|
+
// 聚合模式下,需要设置 checkBoxMenu 和 draggableMenu
|
|
76367
|
+
this.checkBoxMenu = this.deepClone(initColumn);
|
|
76368
|
+
// 聚合模式下,左侧顺序应该保持原始数据的顺序,不受保存顺序影响
|
|
76369
|
+
// 所以这里不根据 savedGroupOrder 重新排序 checkBoxMenu
|
|
76370
|
+
this.draggableMenu = setDraggableMenu(this.checkBoxMenu);
|
|
76371
|
+
if (this.useMultiLevelHeader) {
|
|
76372
|
+
if (this.baseGroupOrder.length === 0) {
|
|
76373
|
+
this.baseGroupOrder = this.checkBoxMenu.map(g => g.label);
|
|
76374
|
+
}
|
|
76375
|
+
// 如果有保存的顺序,使用保存的顺序;否则使用 baseGroupOrder
|
|
76376
|
+
if (this.savedGroupOrder && this.savedGroupOrder.length > 0) {
|
|
76377
|
+
this.groupOrderPersist = this.savedGroupOrder.slice();
|
|
76378
|
+
} else if (this.groupOrderPersist.length === 0) {
|
|
76379
|
+
this.groupOrderPersist = this.baseGroupOrder.slice();
|
|
76380
|
+
}
|
|
76381
|
+
this.refreshMultiHeaderDerivedData();
|
|
76382
|
+
}
|
|
76383
|
+
} else if (bePreservedColumn && bePreservedColumn.length > 0) {
|
|
76024
76384
|
// 需要处理被保存过的进行回显
|
|
76025
76385
|
initColumn.forEach(cols => {
|
|
76026
76386
|
cols.data.forEach(col => {
|
|
@@ -76049,12 +76409,16 @@ var pin_namespaceObject = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAA
|
|
|
76049
76409
|
} else {
|
|
76050
76410
|
// console.log('==========从未被保存过', initColumn)
|
|
76051
76411
|
|
|
76052
|
-
//
|
|
76412
|
+
// 从未被保存过:按照原始数据的默认状态初始化
|
|
76413
|
+
// 如果原始数据有 type 字段,使用原始数据的 type 值;否则默认为 true
|
|
76053
76414
|
let num = 0;
|
|
76054
76415
|
initColumn.forEach(cols => {
|
|
76055
76416
|
cols.data.forEach(col => {
|
|
76056
76417
|
num++;
|
|
76057
|
-
|
|
76418
|
+
// 如果原始数据没有 type 字段,则设置为 true(默认选中)
|
|
76419
|
+
if (col.type === undefined || col.type === null) {
|
|
76420
|
+
col.type = true;
|
|
76421
|
+
}
|
|
76058
76422
|
col.width = col.width ? +col.width : 0;
|
|
76059
76423
|
col.sort = num;
|
|
76060
76424
|
// 设置 fixed 和 parent 属性
|
|
@@ -76079,11 +76443,98 @@ var pin_namespaceObject = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAA
|
|
|
76079
76443
|
}
|
|
76080
76444
|
if (this.useMultiLevelHeader) {
|
|
76081
76445
|
// 多级表头模式
|
|
76082
|
-
|
|
76083
|
-
|
|
76084
|
-
|
|
76085
|
-
|
|
76086
|
-
|
|
76446
|
+
// 如果是聚合模式,需要基于 groupCards 的顺序构建数据传给表格
|
|
76447
|
+
if (this.isAggregationMode) {
|
|
76448
|
+
// 使用和 submit 方法相同的逻辑,基于 groupCards 和 fixedAreaList 构建聚合数据
|
|
76449
|
+
const orderedAggregatedGroups = [];
|
|
76450
|
+
const labelToGroupData = new Map();
|
|
76451
|
+
let sortIndex = 1
|
|
76452
|
+
|
|
76453
|
+
// 先处理固定项,按固定项的顺序添加到对应组,并重新分配 sort 值
|
|
76454
|
+
;
|
|
76455
|
+
(this.fixedAreaList || []).forEach(item => {
|
|
76456
|
+
if (item.type && item.parent) {
|
|
76457
|
+
const label = item.parent.label;
|
|
76458
|
+
if (!labelToGroupData.has(label)) {
|
|
76459
|
+
labelToGroupData.set(label, []);
|
|
76460
|
+
}
|
|
76461
|
+
const itemData = {
|
|
76462
|
+
...item,
|
|
76463
|
+
parent: item.parent
|
|
76464
|
+
};
|
|
76465
|
+
itemData.sort = sortIndex++;
|
|
76466
|
+
labelToGroupData.get(label).push(itemData);
|
|
76467
|
+
}
|
|
76468
|
+
});
|
|
76469
|
+
|
|
76470
|
+
// 然后处理 groupCards 中的项,按它们在 groupCards 中的顺序添加到对应组,并重新分配 sort 值
|
|
76471
|
+
this.groupCards.forEach(group => {
|
|
76472
|
+
const label = group.label;
|
|
76473
|
+
if (!labelToGroupData.has(label)) {
|
|
76474
|
+
labelToGroupData.set(label, []);
|
|
76475
|
+
}
|
|
76476
|
+
;
|
|
76477
|
+
(group.items || []).forEach(item => {
|
|
76478
|
+
if (item.type && item.parent) {
|
|
76479
|
+
const itemData = {
|
|
76480
|
+
...item,
|
|
76481
|
+
parent: item.parent
|
|
76482
|
+
};
|
|
76483
|
+
itemData.sort = sortIndex++;
|
|
76484
|
+
labelToGroupData.get(label).push(itemData);
|
|
76485
|
+
}
|
|
76486
|
+
});
|
|
76487
|
+
});
|
|
76488
|
+
|
|
76489
|
+
// 按 groupCards 的顺序构建聚合组
|
|
76490
|
+
const orderedLabels = this.groupCards.map(g => g.label);
|
|
76491
|
+
// 先添加有固定项的组(如果它们不在 groupCards 中)
|
|
76492
|
+
const fixedGroupLabels = new Set();
|
|
76493
|
+
(this.fixedAreaList || []).forEach(item => {
|
|
76494
|
+
if (item.type && item.parent) {
|
|
76495
|
+
fixedGroupLabels.add(item.parent.label);
|
|
76496
|
+
}
|
|
76497
|
+
});
|
|
76498
|
+
fixedGroupLabels.forEach(label => {
|
|
76499
|
+
if (!orderedLabels.includes(label) && labelToGroupData.has(label)) {
|
|
76500
|
+
orderedLabels.push(label);
|
|
76501
|
+
}
|
|
76502
|
+
});
|
|
76503
|
+
|
|
76504
|
+
// 构建聚合组数据
|
|
76505
|
+
orderedLabels.forEach(label => {
|
|
76506
|
+
const items = labelToGroupData.get(label) || [];
|
|
76507
|
+
if (items.length > 0) {
|
|
76508
|
+
const sourceGroup = this.checkBoxMenu.find(g => g.label === label);
|
|
76509
|
+
const group = {
|
|
76510
|
+
label: label,
|
|
76511
|
+
data: items.map(item => {
|
|
76512
|
+
const {
|
|
76513
|
+
parent,
|
|
76514
|
+
...itemData
|
|
76515
|
+
} = item;
|
|
76516
|
+
return itemData;
|
|
76517
|
+
})
|
|
76518
|
+
};
|
|
76519
|
+
if (sourceGroup) {
|
|
76520
|
+
if (sourceGroup.groupkey) group.groupkey = sourceGroup.groupkey;
|
|
76521
|
+
if (sourceGroup.groupName) group.groupName = sourceGroup.groupName;
|
|
76522
|
+
if (sourceGroup.originalGroups) group.originalGroups = sourceGroup.originalGroups;
|
|
76523
|
+
}
|
|
76524
|
+
orderedAggregatedGroups.push(group);
|
|
76525
|
+
}
|
|
76526
|
+
});
|
|
76527
|
+
|
|
76528
|
+
// 展开聚合数据传给表格
|
|
76529
|
+
const expandedColumns = expandAggregatedColumns(orderedAggregatedGroups, this.originalColumnMap);
|
|
76530
|
+
this.emitChangeTableGroup(expandedColumns);
|
|
76531
|
+
} else {
|
|
76532
|
+
const clonedCheckBoxMenu = this.checkBoxMenu.map(group => ({
|
|
76533
|
+
...group,
|
|
76534
|
+
data: group.data.map(col => this.deepClone(col))
|
|
76535
|
+
}));
|
|
76536
|
+
this.emitChangeTableGroup(clonedCheckBoxMenu);
|
|
76537
|
+
}
|
|
76087
76538
|
} else {
|
|
76088
76539
|
const clonedDraggableMenu = this.draggableMenu.filter(item => item.key !== 'sort-cut-off').map(item => this.deepClone(item)).sort((a, b) => a.sort - b.sort);
|
|
76089
76540
|
this.emitChangeTable(clonedDraggableMenu);
|
|
@@ -76153,18 +76604,86 @@ var pin_namespaceObject = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAA
|
|
|
76153
76604
|
* @param { boolean } type 是否显示
|
|
76154
76605
|
*/
|
|
76155
76606
|
changeCheckbox(key, type) {
|
|
76156
|
-
|
|
76157
|
-
|
|
76158
|
-
|
|
76607
|
+
// 查找操作的项
|
|
76608
|
+
let targetItem = null;
|
|
76609
|
+
this.checkBoxMenu.forEach(group => {
|
|
76610
|
+
if (Array.isArray(group.data)) {
|
|
76611
|
+
group.data.forEach(item => {
|
|
76612
|
+
if (item.key === key) {
|
|
76613
|
+
targetItem = item;
|
|
76614
|
+
}
|
|
76615
|
+
});
|
|
76159
76616
|
}
|
|
76160
76617
|
});
|
|
76161
|
-
|
|
76162
|
-
|
|
76163
|
-
|
|
76164
|
-
|
|
76618
|
+
|
|
76619
|
+
// 如果是聚合模式,需要同步所有相同 itemKey 的项
|
|
76620
|
+
if (this.isAggregationMode && targetItem) {
|
|
76621
|
+
const itemKey = targetItem.itemKey || targetItem.key;
|
|
76622
|
+
if (itemKey) {
|
|
76623
|
+
// 同步所有相同 itemKey 的项
|
|
76624
|
+
syncItemsByItemKey(this.checkBoxMenu, itemKey, item => {
|
|
76625
|
+
item.type = type;
|
|
76626
|
+
});
|
|
76627
|
+
// 在聚合模式下,需要从 checkBoxMenu 重新构建 draggableMenu,以确保所有项的 parent 属性正确
|
|
76628
|
+
// 但是需要保留 draggableMenu 中的顺序(通过 sort 值)和 fixed 状态
|
|
76629
|
+
const setDraggableMenu = arr => {
|
|
76630
|
+
const allColumns = arr.flatMap(item => item.data);
|
|
76631
|
+
const fixedCols = allColumns.filter(col => col.fixed === 'left').sort((a, b) => a.sort - b.sort);
|
|
76632
|
+
const normalCols = allColumns.filter(col => col.fixed !== 'left').sort((a, b) => a.sort - b.sort);
|
|
76633
|
+
const separator = {
|
|
76634
|
+
type: true,
|
|
76635
|
+
label: '',
|
|
76636
|
+
key: 'sort-cut-off',
|
|
76637
|
+
fixed: fixedCols.length > 0 ? 'left' : undefined,
|
|
76638
|
+
parent: ''
|
|
76639
|
+
};
|
|
76640
|
+
return fixedCols.length > 0 ? [...fixedCols, separator, ...normalCols] : [separator, ...normalCols];
|
|
76641
|
+
};
|
|
76642
|
+
|
|
76643
|
+
// 保存当前的 sort 和 fixed 状态
|
|
76644
|
+
const currentStateMap = new Map();
|
|
76645
|
+
this.draggableMenu.forEach(item => {
|
|
76646
|
+
if (item.key !== 'sort-cut-off') {
|
|
76647
|
+
const itemKeyForState = item.itemKey || item.key;
|
|
76648
|
+
currentStateMap.set(itemKeyForState, {
|
|
76649
|
+
sort: item.sort,
|
|
76650
|
+
fixed: item.fixed
|
|
76651
|
+
});
|
|
76652
|
+
}
|
|
76653
|
+
});
|
|
76654
|
+
|
|
76655
|
+
// 从 checkBoxMenu 重新构建 draggableMenu
|
|
76656
|
+
this.draggableMenu = setDraggableMenu(this.checkBoxMenu);
|
|
76657
|
+
|
|
76658
|
+
// 恢复 sort 和 fixed 状态
|
|
76659
|
+
this.draggableMenu.forEach(item => {
|
|
76660
|
+
if (item.key !== 'sort-cut-off') {
|
|
76661
|
+
const itemKeyForState = item.itemKey || item.key;
|
|
76662
|
+
const state = currentStateMap.get(itemKeyForState);
|
|
76663
|
+
if (state) {
|
|
76664
|
+
item.sort = state.sort;
|
|
76665
|
+
if (state.fixed) {
|
|
76666
|
+
item.fixed = state.fixed;
|
|
76667
|
+
}
|
|
76668
|
+
}
|
|
76669
|
+
}
|
|
76670
|
+
});
|
|
76671
|
+
}
|
|
76672
|
+
} else {
|
|
76673
|
+
// 非聚合模式,保持原有逻辑
|
|
76674
|
+
this.draggableMenu.forEach(item => {
|
|
76675
|
+
if (item.key === key) {
|
|
76676
|
+
item.type = type;
|
|
76165
76677
|
}
|
|
76166
76678
|
});
|
|
76167
|
-
|
|
76679
|
+
this.checkBoxMenu.forEach(item => {
|
|
76680
|
+
item.data.forEach(each => {
|
|
76681
|
+
if (each.key === key) {
|
|
76682
|
+
each.type = type;
|
|
76683
|
+
}
|
|
76684
|
+
});
|
|
76685
|
+
});
|
|
76686
|
+
}
|
|
76168
76687
|
if (this.useMultiLevelHeader) {
|
|
76169
76688
|
this.refreshMultiHeaderDerivedData();
|
|
76170
76689
|
}
|
|
@@ -76177,7 +76696,10 @@ var pin_namespaceObject = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAA
|
|
|
76177
76696
|
this.savedGroupOrder = [];
|
|
76178
76697
|
this.baseGroupOrder = [];
|
|
76179
76698
|
}
|
|
76180
|
-
|
|
76699
|
+
// 恢复默认时,传递空数组作为 bePreservedColumn,让 initTableList 按照原始数据的默认状态初始化
|
|
76700
|
+
// 注意:这里传入空数组,initTableList 会走到 else 分支,将所有项的 type 设置为 true
|
|
76701
|
+
// 但原始数据可能已经有自己的 type 值,所以需要先重置为原始数据
|
|
76702
|
+
this.initTableList(this.deepClone(this.columnList), []);
|
|
76181
76703
|
// 恢复默认后,滚动到顶部
|
|
76182
76704
|
this.$nextTick(() => {
|
|
76183
76705
|
this.$nextTick(() => {
|
|
@@ -76230,17 +76752,75 @@ var pin_namespaceObject = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAA
|
|
|
76230
76752
|
}
|
|
76231
76753
|
const shouldCheck = !this.getGroupCheckState(group);
|
|
76232
76754
|
|
|
76233
|
-
//
|
|
76234
|
-
|
|
76235
|
-
|
|
76236
|
-
|
|
76237
|
-
|
|
76238
|
-
|
|
76239
|
-
|
|
76240
|
-
|
|
76755
|
+
// 如果是聚合模式,需要同步所有相同 itemKey 的项
|
|
76756
|
+
if (this.isAggregationMode) {
|
|
76757
|
+
group.data.forEach(item => {
|
|
76758
|
+
const itemKey = item.itemKey || item.key;
|
|
76759
|
+
if (itemKey) {
|
|
76760
|
+
// 同步所有相同 itemKey 的项
|
|
76761
|
+
syncItemsByItemKey(this.checkBoxMenu, itemKey, item => {
|
|
76762
|
+
item.type = shouldCheck;
|
|
76763
|
+
});
|
|
76241
76764
|
}
|
|
76242
76765
|
});
|
|
76243
|
-
|
|
76766
|
+
// 在聚合模式下,需要从 checkBoxMenu 重新构建 draggableMenu,以确保所有项的 parent 属性正确
|
|
76767
|
+
// 但是需要保留 draggableMenu 中的顺序(通过 sort 值)和 fixed 状态
|
|
76768
|
+
const setDraggableMenu = arr => {
|
|
76769
|
+
const allColumns = arr.flatMap(item => item.data);
|
|
76770
|
+
const fixedCols = allColumns.filter(col => col.fixed === 'left').sort((a, b) => a.sort - b.sort);
|
|
76771
|
+
const normalCols = allColumns.filter(col => col.fixed !== 'left').sort((a, b) => a.sort - b.sort);
|
|
76772
|
+
const separator = {
|
|
76773
|
+
type: true,
|
|
76774
|
+
label: '',
|
|
76775
|
+
key: 'sort-cut-off',
|
|
76776
|
+
fixed: fixedCols.length > 0 ? 'left' : undefined,
|
|
76777
|
+
parent: ''
|
|
76778
|
+
};
|
|
76779
|
+
return fixedCols.length > 0 ? [...fixedCols, separator, ...normalCols] : [separator, ...normalCols];
|
|
76780
|
+
};
|
|
76781
|
+
|
|
76782
|
+
// 保存当前的 sort 和 fixed 状态
|
|
76783
|
+
const currentStateMap = new Map();
|
|
76784
|
+
this.draggableMenu.forEach(item => {
|
|
76785
|
+
if (item.key !== 'sort-cut-off') {
|
|
76786
|
+
const itemKeyForState = item.itemKey || item.key;
|
|
76787
|
+
currentStateMap.set(itemKeyForState, {
|
|
76788
|
+
sort: item.sort,
|
|
76789
|
+
fixed: item.fixed
|
|
76790
|
+
});
|
|
76791
|
+
}
|
|
76792
|
+
});
|
|
76793
|
+
|
|
76794
|
+
// 从 checkBoxMenu 重新构建 draggableMenu
|
|
76795
|
+
this.draggableMenu = setDraggableMenu(this.checkBoxMenu);
|
|
76796
|
+
|
|
76797
|
+
// 恢复 sort 和 fixed 状态
|
|
76798
|
+
this.draggableMenu.forEach(item => {
|
|
76799
|
+
if (item.key !== 'sort-cut-off') {
|
|
76800
|
+
const itemKeyForState = item.itemKey || item.key;
|
|
76801
|
+
const state = currentStateMap.get(itemKeyForState);
|
|
76802
|
+
if (state) {
|
|
76803
|
+
item.sort = state.sort;
|
|
76804
|
+
if (state.fixed) {
|
|
76805
|
+
item.fixed = state.fixed;
|
|
76806
|
+
}
|
|
76807
|
+
}
|
|
76808
|
+
}
|
|
76809
|
+
});
|
|
76810
|
+
} else {
|
|
76811
|
+
// 非聚合模式,保持原有逻辑
|
|
76812
|
+
// 批量更新该组下所有项的勾选状态
|
|
76813
|
+
group.data.forEach(item => {
|
|
76814
|
+
// 更新 checkBoxMenu 中的状态
|
|
76815
|
+
item.type = shouldCheck;
|
|
76816
|
+
// 同步更新 draggableMenu 中的状态
|
|
76817
|
+
this.draggableMenu.forEach(dragItem => {
|
|
76818
|
+
if (dragItem.key === item.key) {
|
|
76819
|
+
dragItem.type = shouldCheck;
|
|
76820
|
+
}
|
|
76821
|
+
});
|
|
76822
|
+
});
|
|
76823
|
+
}
|
|
76244
76824
|
if (this.useMultiLevelHeader) {
|
|
76245
76825
|
this.refreshMultiHeaderDerivedData();
|
|
76246
76826
|
}
|
|
@@ -76373,6 +76953,14 @@ var pin_namespaceObject = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAA
|
|
|
76373
76953
|
return item && item.fixed === 'left';
|
|
76374
76954
|
},
|
|
76375
76955
|
toggleFixed(item, toFixed) {
|
|
76956
|
+
// 如果是聚合模式且该项属于聚合组,禁止固定
|
|
76957
|
+
if (this.isAggregationMode && toFixed) {
|
|
76958
|
+
if (isItemInAggregatedGroup(item, this.checkBoxMenu)) {
|
|
76959
|
+
this.$message.warning('聚合组内的项不能进行固定');
|
|
76960
|
+
return;
|
|
76961
|
+
}
|
|
76962
|
+
}
|
|
76963
|
+
|
|
76376
76964
|
// 根据 toFixed 将该项移动到分割线以上或以下
|
|
76377
76965
|
const idx = this.draggableMenu.findIndex(i => i.key === item.key);
|
|
76378
76966
|
if (idx === -1) return;
|
|
@@ -76438,19 +77026,43 @@ var pin_namespaceObject = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAA
|
|
|
76438
77026
|
const present = new Set();
|
|
76439
77027
|
orderedLabels.forEach(label => {
|
|
76440
77028
|
if (labelToData.has(label)) {
|
|
76441
|
-
|
|
77029
|
+
// 从 checkBoxMenu 中找到对应的组,获取 groupkey 和 groupName
|
|
77030
|
+
const sourceGroup = this.checkBoxMenu.find(g => g.label === label);
|
|
77031
|
+
const groupData = {
|
|
76442
77032
|
label,
|
|
76443
77033
|
data: labelToData.get(label)
|
|
76444
|
-
}
|
|
77034
|
+
};
|
|
77035
|
+
// 如果是聚合模式,需要保存 groupkey 和 groupName
|
|
77036
|
+
if (this.isAggregationMode && sourceGroup) {
|
|
77037
|
+
if (sourceGroup.groupkey) {
|
|
77038
|
+
groupData.groupkey = sourceGroup.groupkey;
|
|
77039
|
+
}
|
|
77040
|
+
if (sourceGroup.groupName) {
|
|
77041
|
+
groupData.groupName = sourceGroup.groupName;
|
|
77042
|
+
}
|
|
77043
|
+
}
|
|
77044
|
+
params.column.push(groupData);
|
|
76445
77045
|
present.add(label);
|
|
76446
77046
|
}
|
|
76447
77047
|
});
|
|
76448
77048
|
baseOrder.forEach(label => {
|
|
76449
77049
|
if (!present.has(label) && labelToData.has(label)) {
|
|
76450
|
-
|
|
77050
|
+
// 从 checkBoxMenu 中找到对应的组,获取 groupkey 和 groupName
|
|
77051
|
+
const sourceGroup = this.checkBoxMenu.find(g => g.label === label);
|
|
77052
|
+
const groupData = {
|
|
76451
77053
|
label,
|
|
76452
77054
|
data: labelToData.get(label)
|
|
76453
|
-
}
|
|
77055
|
+
};
|
|
77056
|
+
// 如果是聚合模式,需要保存 groupkey 和 groupName
|
|
77057
|
+
if (this.isAggregationMode && sourceGroup) {
|
|
77058
|
+
if (sourceGroup.groupkey) {
|
|
77059
|
+
groupData.groupkey = sourceGroup.groupkey;
|
|
77060
|
+
}
|
|
77061
|
+
if (sourceGroup.groupName) {
|
|
77062
|
+
groupData.groupName = sourceGroup.groupName;
|
|
77063
|
+
}
|
|
77064
|
+
}
|
|
77065
|
+
params.column.push(groupData);
|
|
76454
77066
|
}
|
|
76455
77067
|
});
|
|
76456
77068
|
} else {
|
|
@@ -76520,11 +77132,99 @@ var pin_namespaceObject = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAA
|
|
|
76520
77132
|
});
|
|
76521
77133
|
if (this.useMultiLevelHeader) {
|
|
76522
77134
|
// 多级表头模式
|
|
76523
|
-
|
|
76524
|
-
|
|
76525
|
-
|
|
76526
|
-
|
|
76527
|
-
|
|
77135
|
+
// 如果是聚合模式,需要展开为原始数据传给表格
|
|
77136
|
+
// 注意:需要基于当前的 groupCards 和 fixedAreaList 构建聚合数据,以反映拖动后的顺序
|
|
77137
|
+
if (this.isAggregationMode) {
|
|
77138
|
+
// 先从 groupCards 和 fixedAreaList 构建出聚合后的数据结构(反映当前顺序)
|
|
77139
|
+
const orderedAggregatedGroups = [];
|
|
77140
|
+
const labelToGroupData = new Map();
|
|
77141
|
+
let sortIndex = 1
|
|
77142
|
+
|
|
77143
|
+
// 先处理固定项,按固定项的顺序添加到对应组,并重新分配 sort 值
|
|
77144
|
+
;
|
|
77145
|
+
(this.fixedAreaList || []).forEach(item => {
|
|
77146
|
+
if (item.type && item.parent) {
|
|
77147
|
+
const label = item.parent.label;
|
|
77148
|
+
if (!labelToGroupData.has(label)) {
|
|
77149
|
+
labelToGroupData.set(label, []);
|
|
77150
|
+
}
|
|
77151
|
+
const itemData = {
|
|
77152
|
+
...item,
|
|
77153
|
+
parent: item.parent
|
|
77154
|
+
};
|
|
77155
|
+
itemData.sort = sortIndex++;
|
|
77156
|
+
labelToGroupData.get(label).push(itemData);
|
|
77157
|
+
}
|
|
77158
|
+
});
|
|
77159
|
+
|
|
77160
|
+
// 然后处理 groupCards 中的项,按它们在 groupCards 中的顺序添加到对应组,并重新分配 sort 值
|
|
77161
|
+
this.groupCards.forEach(group => {
|
|
77162
|
+
const label = group.label;
|
|
77163
|
+
if (!labelToGroupData.has(label)) {
|
|
77164
|
+
labelToGroupData.set(label, []);
|
|
77165
|
+
}
|
|
77166
|
+
;
|
|
77167
|
+
(group.items || []).forEach(item => {
|
|
77168
|
+
if (item.type && item.parent) {
|
|
77169
|
+
const itemData = {
|
|
77170
|
+
...item,
|
|
77171
|
+
parent: item.parent
|
|
77172
|
+
};
|
|
77173
|
+
itemData.sort = sortIndex++;
|
|
77174
|
+
labelToGroupData.get(label).push(itemData);
|
|
77175
|
+
}
|
|
77176
|
+
});
|
|
77177
|
+
});
|
|
77178
|
+
|
|
77179
|
+
// 按 groupCards 的顺序构建聚合组
|
|
77180
|
+
const orderedLabels = this.groupCards.map(g => g.label);
|
|
77181
|
+
// 先添加有固定项的组(如果它们不在 groupCards 中)
|
|
77182
|
+
const fixedGroupLabels = new Set();
|
|
77183
|
+
(this.fixedAreaList || []).forEach(item => {
|
|
77184
|
+
if (item.type && item.parent) {
|
|
77185
|
+
fixedGroupLabels.add(item.parent.label);
|
|
77186
|
+
}
|
|
77187
|
+
});
|
|
77188
|
+
fixedGroupLabels.forEach(label => {
|
|
77189
|
+
if (!orderedLabels.includes(label) && labelToGroupData.has(label)) {
|
|
77190
|
+
orderedLabels.push(label);
|
|
77191
|
+
}
|
|
77192
|
+
});
|
|
77193
|
+
|
|
77194
|
+
// 构建聚合组数据
|
|
77195
|
+
orderedLabels.forEach(label => {
|
|
77196
|
+
const items = labelToGroupData.get(label) || [];
|
|
77197
|
+
if (items.length > 0) {
|
|
77198
|
+
const sourceGroup = this.checkBoxMenu.find(g => g.label === label);
|
|
77199
|
+
const group = {
|
|
77200
|
+
label: label,
|
|
77201
|
+
data: items.map(item => {
|
|
77202
|
+
const {
|
|
77203
|
+
parent,
|
|
77204
|
+
...itemData
|
|
77205
|
+
} = item;
|
|
77206
|
+
return itemData;
|
|
77207
|
+
})
|
|
77208
|
+
};
|
|
77209
|
+
if (sourceGroup) {
|
|
77210
|
+
if (sourceGroup.groupkey) group.groupkey = sourceGroup.groupkey;
|
|
77211
|
+
if (sourceGroup.groupName) group.groupName = sourceGroup.groupName;
|
|
77212
|
+
if (sourceGroup.originalGroups) group.originalGroups = sourceGroup.originalGroups;
|
|
77213
|
+
}
|
|
77214
|
+
orderedAggregatedGroups.push(group);
|
|
77215
|
+
}
|
|
77216
|
+
});
|
|
77217
|
+
|
|
77218
|
+
// 展开聚合数据传给表格
|
|
77219
|
+
const expandedColumns = expandAggregatedColumns(orderedAggregatedGroups, this.originalColumnMap);
|
|
77220
|
+
this.emitChangeTableGroup(expandedColumns);
|
|
77221
|
+
} else {
|
|
77222
|
+
const clonedColumn = params.column.map(group => ({
|
|
77223
|
+
...group,
|
|
77224
|
+
data: group.data.map(col => this.deepClone(col))
|
|
77225
|
+
}));
|
|
77226
|
+
this.emitChangeTableGroup(clonedColumn);
|
|
77227
|
+
}
|
|
76528
77228
|
} else {
|
|
76529
77229
|
this.emitChangeTable(cols.sort((a, b) => a.sort - b.sort));
|
|
76530
77230
|
}
|
|
@@ -76575,8 +77275,8 @@ var pin_namespaceObject = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAA
|
|
|
76575
77275
|
;
|
|
76576
77276
|
var custom_column_component = normalizeComponent(
|
|
76577
77277
|
components_custom_columnvue_type_script_lang_js,
|
|
76578
|
-
|
|
76579
|
-
|
|
77278
|
+
custom_columnvue_type_template_id_d822d96a_render,
|
|
77279
|
+
custom_columnvue_type_template_id_d822d96a_staticRenderFns,
|
|
76580
77280
|
false,
|
|
76581
77281
|
null,
|
|
76582
77282
|
null,
|
|
@@ -77277,7 +77977,8 @@ var custom_column_component = normalizeComponent(
|
|
|
77277
77977
|
// 更新分页配置
|
|
77278
77978
|
this.gridOptions.pagerConfig.currentPage = currentPage;
|
|
77279
77979
|
this.gridOptions.pagerConfig.pageSize = pageSize;
|
|
77280
|
-
|
|
77980
|
+
// 如果有置顶行,总数需要减1(置顶行不参与分页计数)
|
|
77981
|
+
this.gridOptions.pagerConfig.total = specialFirstRow ? allData.length - 1 : allData.length;
|
|
77281
77982
|
|
|
77282
77983
|
// 获取当前页数据
|
|
77283
77984
|
currentPageData = normalData.slice(start, end);
|
|
@@ -77527,8 +78228,8 @@ var custom_column_component = normalizeComponent(
|
|
|
77527
78228
|
;
|
|
77528
78229
|
var table_component = normalizeComponent(
|
|
77529
78230
|
components_tablevue_type_script_lang_js,
|
|
77530
|
-
|
|
77531
|
-
|
|
78231
|
+
tablevue_type_template_id_22e15733_render,
|
|
78232
|
+
tablevue_type_template_id_22e15733_staticRenderFns,
|
|
77532
78233
|
false,
|
|
77533
78234
|
null,
|
|
77534
78235
|
null,
|
|
@@ -78823,8 +79524,6 @@ var ByCommonSelectorvue_type_template_id_05ec4584_render = function render() {
|
|
|
78823
79524
|
};
|
|
78824
79525
|
var ByCommonSelectorvue_type_template_id_05ec4584_staticRenderFns = [];
|
|
78825
79526
|
|
|
78826
|
-
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.some.js
|
|
78827
|
-
var es_iterator_some = __webpack_require__(3579);
|
|
78828
79527
|
;// ./node_modules/pinyin-pro/dist/index.mjs
|
|
78829
79528
|
|
|
78830
79529
|
|