@weitutech/by-components 1.1.183 → 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.
@@ -74524,18 +74524,11 @@ 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=23b79ced
74528
- var tablevue_type_template_id_23b79ced_render = function render() {
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
- return _c('div', {
74532
- staticClass: "by-table-wrapper",
74533
- class: {
74534
- 'custom-loading-mode': (_vm.loadingStyle === 'pulse' || _vm.loadingStyle === 'box') && _vm.loading
74535
- }
74536
- }, [_c('div', {
74537
- staticClass: "vxe-grid-wrapper"
74538
- }, [_c('vxe-grid', _vm._g(_vm._b({
74531
+ return _c('div', [_c('vxe-grid', _vm._g(_vm._b({
74539
74532
  ref: "xGrid",
74540
74533
  on: {
74541
74534
  "cell-click": _vm.handleCellClick,
@@ -74597,13 +74590,14 @@ var tablevue_type_template_id_23b79ced_render = function render() {
74597
74590
  },
74598
74591
  proxy: true
74599
74592
  }], null, true)
74600
- }, 'vxe-grid', _vm.options, false), _vm.eventListeners))], 1), _vm.gridOptions && _vm.gridOptions.customColumnConfig && _vm.gridOptions.customColumnConfig.showCustomColumn ? _c('CustomColumn', {
74593
+ }, 'vxe-grid', _vm.options, false), _vm.eventListeners)), _vm.gridOptions && _vm.gridOptions.customColumnConfig && _vm.gridOptions.customColumnConfig.showCustomColumn ? _c('CustomColumn', {
74601
74594
  ref: "CustomColumnRef",
74602
74595
  attrs: {
74603
74596
  "info-method": _vm.gridOptions.customColumnConfig.infoMethod,
74604
74597
  "submit-method": _vm.gridOptions.customColumnConfig.submitMethod,
74605
74598
  "fixed-max-count": _vm.gridOptions.customColumnConfig.fixedMaxCount,
74606
74599
  "use-multi-level-header": _vm.gridOptions.customColumnConfig.useMultiLevelHeader,
74600
+ "aggregation-group": _vm.gridOptions.customColumnConfig.aggregationGroup,
74607
74601
  "dialog-visible": _vm.customTableVisible
74608
74602
  },
74609
74603
  on: {
@@ -74616,7 +74610,7 @@ var tablevue_type_template_id_23b79ced_render = function render() {
74616
74610
  }
74617
74611
  }) : _vm._e()], 1);
74618
74612
  };
74619
- var tablevue_type_template_id_23b79ced_staticRenderFns = [];
74613
+ var tablevue_type_template_id_22e15733_staticRenderFns = [];
74620
74614
 
74621
74615
  // EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.push.js
74622
74616
  var es_array_push = __webpack_require__(4114);
@@ -74638,8 +74632,8 @@ var es_set_is_superset_of_v2 = __webpack_require__(2475);
74638
74632
  var es_set_symmetric_difference_v2 = __webpack_require__(5024);
74639
74633
  // EXTERNAL MODULE: ./node_modules/core-js/modules/es.set.union.v2.js
74640
74634
  var es_set_union_v2 = __webpack_require__(1698);
74641
- ;// ./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=2a1d0253
74642
- var custom_columnvue_type_template_id_2a1d0253_render = function render() {
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() {
74643
74637
  var _vm = this,
74644
74638
  _c = _vm._self._c;
74645
74639
  return _c('div', {
@@ -75030,7 +75024,7 @@ var custom_columnvue_type_template_id_2a1d0253_render = function render() {
75030
75024
  }), 0)], 1)], 1)]);
75031
75025
  }), 0)], 1)], 1)])])])])], 1);
75032
75026
  };
75033
- var custom_columnvue_type_template_id_2a1d0253_staticRenderFns = [];
75027
+ var custom_columnvue_type_template_id_d822d96a_staticRenderFns = [];
75034
75028
 
75035
75029
  // EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.filter.js
75036
75030
  var es_iterator_filter = __webpack_require__(2489);
@@ -75038,6 +75032,8 @@ var es_iterator_filter = __webpack_require__(2489);
75038
75032
  var es_iterator_find = __webpack_require__(116);
75039
75033
  // EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.flat-map.js
75040
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);
75041
75037
  // EXTERNAL MODULE: ./node_modules/vuedraggable/dist/vuedraggable.umd.js
75042
75038
  var vuedraggable_umd = __webpack_require__(9135);
75043
75039
  var vuedraggable_umd_default = /*#__PURE__*/__webpack_require__.n(vuedraggable_umd);
@@ -75861,6 +75857,261 @@ const isNullValue = value => {
75861
75857
 
75862
75858
  ;// ./src/assets/icons/pin.png
75863
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
+ }
75864
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
75865
76116
 
75866
76117
 
@@ -75880,6 +76131,8 @@ var pin_namespaceObject = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAA
75880
76131
 
75881
76132
 
75882
76133
 
76134
+
76135
+
75883
76136
 
75884
76137
 
75885
76138
  /* harmony default export */ var custom_columnvue_type_script_lang_js = ({
@@ -75915,6 +76168,11 @@ var pin_namespaceObject = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAA
75915
76168
  useMultiLevelHeader: {
75916
76169
  type: Boolean,
75917
76170
  default: false
76171
+ },
76172
+ // 是否启用聚合分组(仅在 useMultiLevelHeader 为 true 时生效) - gridOptions.customColumnConfig.aggregationGroup配置
76173
+ aggregationGroup: {
76174
+ type: Boolean,
76175
+ default: false
75918
76176
  }
75919
76177
  },
75920
76178
  data() {
@@ -75942,6 +76200,10 @@ var pin_namespaceObject = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAA
75942
76200
  search: '',
75943
76201
  /** 原始列数据备份 */
75944
76202
  columnList: [],
76203
+ /** 聚合模式下的原始数据映射(用于展开) */
76204
+ originalColumnMap: null,
76205
+ /** 是否处于聚合模式 */
76206
+ isAggregationMode: false,
75945
76207
  /** 对话框按钮配置 */
75946
76208
  dialogButtons: [{
75947
76209
  text: '取消',
@@ -76027,7 +76289,98 @@ var pin_namespaceObject = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAA
76027
76289
  // 根据是否有固定列决定分割列位置
76028
76290
  return fixedCols.length > 0 ? [...fixedCols, separator, ...normalCols] : [separator, ...normalCols];
76029
76291
  };
76030
- if (bePreservedColumn && bePreservedColumn.length > 0) {
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) {
76031
76384
  // 需要处理被保存过的进行回显
76032
76385
  initColumn.forEach(cols => {
76033
76386
  cols.data.forEach(col => {
@@ -76056,12 +76409,16 @@ var pin_namespaceObject = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAA
76056
76409
  } else {
76057
76410
  // console.log('==========从未被保存过', initColumn)
76058
76411
 
76059
- // 从未被保存过
76412
+ // 从未被保存过:按照原始数据的默认状态初始化
76413
+ // 如果原始数据有 type 字段,使用原始数据的 type 值;否则默认为 true
76060
76414
  let num = 0;
76061
76415
  initColumn.forEach(cols => {
76062
76416
  cols.data.forEach(col => {
76063
76417
  num++;
76064
- col.type = true;
76418
+ // 如果原始数据没有 type 字段,则设置为 true(默认选中)
76419
+ if (col.type === undefined || col.type === null) {
76420
+ col.type = true;
76421
+ }
76065
76422
  col.width = col.width ? +col.width : 0;
76066
76423
  col.sort = num;
76067
76424
  // 设置 fixed 和 parent 属性
@@ -76086,11 +76443,98 @@ var pin_namespaceObject = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAA
76086
76443
  }
76087
76444
  if (this.useMultiLevelHeader) {
76088
76445
  // 多级表头模式
76089
- const clonedCheckBoxMenu = this.checkBoxMenu.map(group => ({
76090
- ...group,
76091
- data: group.data.map(col => this.deepClone(col))
76092
- }));
76093
- this.emitChangeTableGroup(clonedCheckBoxMenu);
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
+ }
76094
76538
  } else {
76095
76539
  const clonedDraggableMenu = this.draggableMenu.filter(item => item.key !== 'sort-cut-off').map(item => this.deepClone(item)).sort((a, b) => a.sort - b.sort);
76096
76540
  this.emitChangeTable(clonedDraggableMenu);
@@ -76160,18 +76604,86 @@ var pin_namespaceObject = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAA
76160
76604
  * @param { boolean } type 是否显示
76161
76605
  */
76162
76606
  changeCheckbox(key, type) {
76163
- this.draggableMenu.forEach(item => {
76164
- if (item.key === key) {
76165
- item.type = type;
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
+ });
76166
76616
  }
76167
76617
  });
76168
- this.checkBoxMenu.forEach(item => {
76169
- item.data.forEach(each => {
76170
- if (each.key === key) {
76171
- each.type = type;
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;
76172
76677
  }
76173
76678
  });
76174
- });
76679
+ this.checkBoxMenu.forEach(item => {
76680
+ item.data.forEach(each => {
76681
+ if (each.key === key) {
76682
+ each.type = type;
76683
+ }
76684
+ });
76685
+ });
76686
+ }
76175
76687
  if (this.useMultiLevelHeader) {
76176
76688
  this.refreshMultiHeaderDerivedData();
76177
76689
  }
@@ -76184,7 +76696,10 @@ var pin_namespaceObject = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAA
76184
76696
  this.savedGroupOrder = [];
76185
76697
  this.baseGroupOrder = [];
76186
76698
  }
76187
- this.initTableList(this.deepClone(this.columnList));
76699
+ // 恢复默认时,传递空数组作为 bePreservedColumn,让 initTableList 按照原始数据的默认状态初始化
76700
+ // 注意:这里传入空数组,initTableList 会走到 else 分支,将所有项的 type 设置为 true
76701
+ // 但原始数据可能已经有自己的 type 值,所以需要先重置为原始数据
76702
+ this.initTableList(this.deepClone(this.columnList), []);
76188
76703
  // 恢复默认后,滚动到顶部
76189
76704
  this.$nextTick(() => {
76190
76705
  this.$nextTick(() => {
@@ -76237,17 +76752,75 @@ var pin_namespaceObject = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAA
76237
76752
  }
76238
76753
  const shouldCheck = !this.getGroupCheckState(group);
76239
76754
 
76240
- // 批量更新该组下所有项的勾选状态
76241
- group.data.forEach(item => {
76242
- // 更新 checkBoxMenu 中的状态
76243
- item.type = shouldCheck;
76244
- // 同步更新 draggableMenu 中的状态
76245
- this.draggableMenu.forEach(dragItem => {
76246
- if (dragItem.key === item.key) {
76247
- dragItem.type = shouldCheck;
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
+ });
76248
76764
  }
76249
76765
  });
76250
- });
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
+ }
76251
76824
  if (this.useMultiLevelHeader) {
76252
76825
  this.refreshMultiHeaderDerivedData();
76253
76826
  }
@@ -76380,6 +76953,14 @@ var pin_namespaceObject = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAA
76380
76953
  return item && item.fixed === 'left';
76381
76954
  },
76382
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
+
76383
76964
  // 根据 toFixed 将该项移动到分割线以上或以下
76384
76965
  const idx = this.draggableMenu.findIndex(i => i.key === item.key);
76385
76966
  if (idx === -1) return;
@@ -76445,19 +77026,43 @@ var pin_namespaceObject = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAA
76445
77026
  const present = new Set();
76446
77027
  orderedLabels.forEach(label => {
76447
77028
  if (labelToData.has(label)) {
76448
- params.column.push({
77029
+ // 从 checkBoxMenu 中找到对应的组,获取 groupkey 和 groupName
77030
+ const sourceGroup = this.checkBoxMenu.find(g => g.label === label);
77031
+ const groupData = {
76449
77032
  label,
76450
77033
  data: labelToData.get(label)
76451
- });
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);
76452
77045
  present.add(label);
76453
77046
  }
76454
77047
  });
76455
77048
  baseOrder.forEach(label => {
76456
77049
  if (!present.has(label) && labelToData.has(label)) {
76457
- params.column.push({
77050
+ // 从 checkBoxMenu 中找到对应的组,获取 groupkey 和 groupName
77051
+ const sourceGroup = this.checkBoxMenu.find(g => g.label === label);
77052
+ const groupData = {
76458
77053
  label,
76459
77054
  data: labelToData.get(label)
76460
- });
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);
76461
77066
  }
76462
77067
  });
76463
77068
  } else {
@@ -76527,11 +77132,99 @@ var pin_namespaceObject = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAA
76527
77132
  });
76528
77133
  if (this.useMultiLevelHeader) {
76529
77134
  // 多级表头模式
76530
- const clonedColumn = params.column.map(group => ({
76531
- ...group,
76532
- data: group.data.map(col => this.deepClone(col))
76533
- }));
76534
- this.emitChangeTableGroup(clonedColumn);
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
+ }
76535
77228
  } else {
76536
77229
  this.emitChangeTable(cols.sort((a, b) => a.sort - b.sort));
76537
77230
  }
@@ -76582,8 +77275,8 @@ var pin_namespaceObject = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAA
76582
77275
  ;
76583
77276
  var custom_column_component = normalizeComponent(
76584
77277
  components_custom_columnvue_type_script_lang_js,
76585
- custom_columnvue_type_template_id_2a1d0253_render,
76586
- custom_columnvue_type_template_id_2a1d0253_staticRenderFns,
77278
+ custom_columnvue_type_template_id_d822d96a_render,
77279
+ custom_columnvue_type_template_id_d822d96a_staticRenderFns,
76587
77280
  false,
76588
77281
  null,
76589
77282
  null,
@@ -76662,14 +77355,6 @@ var custom_column_component = normalizeComponent(
76662
77355
  loading: {
76663
77356
  type: Boolean,
76664
77357
  default: false
76665
- },
76666
- loadingStyle: {
76667
- // loading样式类型:'pulse' 3D旋转圆环样式(默认),'box' 方块变形动画样式,'default' 使用vxe-table默认样式
76668
- type: String,
76669
- default: 'default',
76670
- validator(value) {
76671
- return ['pulse', 'box', 'default'].includes(value);
76672
- }
76673
77358
  }
76674
77359
  },
76675
77360
  data() {
@@ -76698,9 +77383,7 @@ var custom_column_component = normalizeComponent(
76698
77383
  tableWidth: 1200,
76699
77384
  // 默认值,将在客户端初始化
76700
77385
  // 是否为移动设备
76701
- isMobile: false,
76702
- // MutationObserver实例
76703
- loadingObserver: null
77386
+ isMobile: false
76704
77387
  };
76705
77388
  },
76706
77389
  mounted() {
@@ -76714,52 +77397,14 @@ var custom_column_component = normalizeComponent(
76714
77397
 
76715
77398
  // 前端分页模式下初始化默认排序
76716
77399
  this.initDefaultSortForFrontendPagination();
76717
-
76718
- // 初始化自定义loading
76719
- if (this.loadingStyle === 'pulse' || this.loadingStyle === 'box') {
76720
- this.$nextTick(() => {
76721
- this.initCustomLoading();
76722
- // 使用MutationObserver监听DOM变化,确保默认loading被隐藏
76723
- if (this.$refs.xGrid && this.$refs.xGrid.$el) {
76724
- this.observeLoadingChanges();
76725
- }
76726
- });
76727
- }
76728
77400
  },
76729
77401
  beforeDestroy() {
76730
77402
  // 确保只在客户端环境中移除事件监听
76731
77403
  if (typeof window !== 'undefined') {
76732
77404
  this.removeResizeListener();
76733
- // 清理MutationObserver
76734
- if (this.loadingObserver) {
76735
- this.loadingObserver.disconnect();
76736
- this.loadingObserver = null;
76737
- }
76738
77405
  }
76739
77406
  },
76740
77407
  watch: {
76741
- loading(newVal) {
76742
- if (this.loadingStyle === 'pulse' || this.loadingStyle === 'box') {
76743
- this.$nextTick(() => {
76744
- this.updateCustomLoading();
76745
- });
76746
- }
76747
- },
76748
- loadingStyle() {
76749
- if (this.loadingStyle === 'pulse' || this.loadingStyle === 'box') {
76750
- this.$nextTick(() => {
76751
- this.updateCustomLoading();
76752
- });
76753
- } else {
76754
- // 切换到default样式时,移除自定义loading
76755
- if (this.$refs.xGrid && this.$refs.xGrid.$el) {
76756
- const customLoading = this.$refs.xGrid.$el.querySelector('.custom-loading-content');
76757
- if (customLoading) {
76758
- customLoading.remove();
76759
- }
76760
- }
76761
- }
76762
- },
76763
77408
  'gridOptions.columns': {
76764
77409
  handler(newColumns) {
76765
77410
  //这里保存的列宽要恢复至最初未拖动时的列宽
@@ -76880,19 +77525,9 @@ var custom_column_component = normalizeComponent(
76880
77525
  copyFields: this.gridOptions.copyFields || [],
76881
77526
  emptyText: this.gridOptions.emptyText || '暂无数据',
76882
77527
  loading: this.loading,
76883
- loadingConfig: (() => {
76884
- const baseConfig = {
76885
- ...this.gridOptions.loadingConfig
76886
- };
76887
- // 如果使用自定义loading样式,隐藏默认的loading文字和图标
76888
- if (this.loadingStyle === 'pulse' || this.loadingStyle === 'box') {
76889
- baseConfig.text = null;
76890
- baseConfig.icon = null;
76891
- } else {
76892
- baseConfig.text = baseConfig.text || '加载中...';
76893
- }
76894
- return baseConfig;
76895
- })(),
77528
+ loadingConfig: {
77529
+ text: '加载中...'
77530
+ },
76896
77531
  columns: newColumns,
76897
77532
  data,
76898
77533
  resizableConfig: {
@@ -77342,7 +77977,8 @@ var custom_column_component = normalizeComponent(
77342
77977
  // 更新分页配置
77343
77978
  this.gridOptions.pagerConfig.currentPage = currentPage;
77344
77979
  this.gridOptions.pagerConfig.pageSize = pageSize;
77345
- this.gridOptions.pagerConfig.total = allData.length;
77980
+ // 如果有置顶行,总数需要减1(置顶行不参与分页计数)
77981
+ this.gridOptions.pagerConfig.total = specialFirstRow ? allData.length - 1 : allData.length;
77346
77982
 
77347
77983
  // 获取当前页数据
77348
77984
  currentPageData = normalData.slice(start, end);
@@ -77549,200 +78185,6 @@ var custom_column_component = normalizeComponent(
77549
78185
  });
77550
78186
  }
77551
78187
  },
77552
- /**
77553
- * 初始化自定义loading
77554
- */
77555
- initCustomLoading() {
77556
- if (this.loadingStyle !== 'pulse' && this.loadingStyle !== 'box') return;
77557
- this.$nextTick(() => {
77558
- this.updateCustomLoading();
77559
- });
77560
- },
77561
- /**
77562
- * 监听loading DOM变化,确保默认loading被隐藏
77563
- */
77564
- observeLoadingChanges() {
77565
- if (!this.$refs.xGrid || !this.$refs.xGrid.$el) return;
77566
- const gridEl = this.$refs.xGrid.$el;
77567
-
77568
- // 如果已经有observer,先断开
77569
- if (this.loadingObserver) {
77570
- this.loadingObserver.disconnect();
77571
- }
77572
-
77573
- // 创建MutationObserver
77574
- this.loadingObserver = new MutationObserver(() => {
77575
- if (this.loading && (this.loadingStyle === 'pulse' || this.loadingStyle === 'box')) {
77576
- this.hideDefaultLoading();
77577
- }
77578
- });
77579
-
77580
- // 开始监听
77581
- this.loadingObserver.observe(gridEl, {
77582
- childList: true,
77583
- subtree: true
77584
- });
77585
- },
77586
- /**
77587
- * 强制隐藏默认loading
77588
- */
77589
- hideDefaultLoading() {
77590
- if (!this.$refs.xGrid || !this.$refs.xGrid.$el) return;
77591
- const gridEl = this.$refs.xGrid.$el;
77592
- const loadingEl = gridEl.querySelector('.vxe-loading');
77593
- if (!loadingEl) return;
77594
-
77595
- // 隐藏所有可能的默认loading元素
77596
- const selectors = ['.vxe-loading--spinner', '.vxe-loading--text', '.vxe-icon', 'i[class*="spinner"]', 'i[class*="loading"]', '.vxe-loading--content > *:not(.custom-loading-content)'];
77597
- selectors.forEach(selector => {
77598
- const elements = loadingEl.querySelectorAll(selector);
77599
- elements.forEach(el => {
77600
- if (!el.closest('.custom-loading-content')) {
77601
- el.style.display = 'none';
77602
- el.style.visibility = 'hidden';
77603
- el.style.opacity = '0';
77604
- }
77605
- });
77606
- });
77607
- },
77608
- /**
77609
- * 更新自定义loading显示
77610
- */
77611
- updateCustomLoading() {
77612
- if (!this.$refs.xGrid || !this.$refs.xGrid.$el) return;
77613
- const gridEl = this.$refs.xGrid.$el;
77614
- const loadingEl = gridEl.querySelector('.vxe-loading');
77615
- if (!loadingEl) {
77616
- // 如果loading元素不存在,延迟重试
77617
- if (this.loading && (this.loadingStyle === 'pulse' || this.loadingStyle === 'box')) {
77618
- setTimeout(() => {
77619
- this.updateCustomLoading();
77620
- }, 100);
77621
- }
77622
- return;
77623
- }
77624
- let customLoading = loadingEl.querySelector('.custom-loading-content');
77625
-
77626
- // 强制隐藏默认loading(只在自定义loading模式下)
77627
- if (this.loading && (this.loadingStyle === 'pulse' || this.loadingStyle === 'box')) {
77628
- this.hideDefaultLoading();
77629
- }
77630
- if (this.loading && (this.loadingStyle === 'pulse' || this.loadingStyle === 'box')) {
77631
- if (!customLoading) {
77632
- // 创建自定义loading元素
77633
- customLoading = document.createElement('div');
77634
- customLoading.className = 'custom-loading-content';
77635
- if (this.loadingStyle === 'pulse') {
77636
- var _this$gridOptions$loa;
77637
- // 3D旋转圆环样式
77638
- // 获取loading文案配置
77639
- const loadingText = ((_this$gridOptions$loa = this.gridOptions.loadingConfig) === null || _this$gridOptions$loa === void 0 ? void 0 : _this$gridOptions$loa.text) || '加载中...';
77640
-
77641
- // 将文案转换为字符数组
77642
- const textChars = loadingText.split('');
77643
-
77644
- // 创建容器
77645
- const uiverseDiv = document.createElement('div');
77646
- uiverseDiv.className = 'table-loading-pulse';
77647
- const loaderContainer = document.createElement('div');
77648
- loaderContainer.className = 'loader-container';
77649
-
77650
- // 创建文字元素(使用h3标签)
77651
- if (loadingText) {
77652
- const textElement = document.createElement('h3');
77653
- textElement.className = 'loader-text';
77654
-
77655
- // 为每个字符创建span,并设置动画延迟
77656
- textChars.forEach((char, index) => {
77657
- const charSpan = document.createElement('span');
77658
- charSpan.className = 'loader-char';
77659
- charSpan.style.animationDelay = `${index * 0.15}s`;
77660
- charSpan.textContent = char === ' ' ? '\u00A0' : char; // 使用不间断空格
77661
- textElement.appendChild(charSpan);
77662
- });
77663
- loaderContainer.appendChild(textElement);
77664
- }
77665
-
77666
- // 添加旋转圆环
77667
- for (let i = 0; i < 4; i++) {
77668
- const ring = document.createElement('div');
77669
- ring.className = 'loader-ring';
77670
- loaderContainer.appendChild(ring);
77671
- }
77672
- uiverseDiv.appendChild(loaderContainer);
77673
- customLoading.appendChild(uiverseDiv);
77674
- } else if (this.loadingStyle === 'box') {
77675
- var _this$gridOptions$loa2;
77676
- // 方块变形动画样式
77677
- const boxDiv = document.createElement('div');
77678
- boxDiv.className = 'table-loading-box';
77679
- const loader = document.createElement('div');
77680
- loader.className = 'loader';
77681
-
77682
- // 创建三个方块
77683
- const box1 = document.createElement('div');
77684
- box1.className = 'box1';
77685
- const box2 = document.createElement('div');
77686
- box2.className = 'box2';
77687
- const box3 = document.createElement('div');
77688
- box3.className = 'box3';
77689
- loader.appendChild(box1);
77690
- loader.appendChild(box2);
77691
- loader.appendChild(box3);
77692
-
77693
- // 创建容器包裹loader和文字
77694
- const loaderContainer = document.createElement('div');
77695
- loaderContainer.className = 'loader-container';
77696
- loaderContainer.appendChild(loader);
77697
-
77698
- // 添加文字动画(显示在下方)
77699
- const loadingText = ((_this$gridOptions$loa2 = this.gridOptions.loadingConfig) === null || _this$gridOptions$loa2 === void 0 ? void 0 : _this$gridOptions$loa2.text) || '加载中...';
77700
- if (loadingText) {
77701
- const textChars = loadingText.split('');
77702
- const textElement = document.createElement('h3');
77703
- textElement.className = 'loader-text';
77704
- textChars.forEach((char, index) => {
77705
- const charSpan = document.createElement('span');
77706
- charSpan.className = 'loader-char';
77707
- charSpan.style.animationDelay = `${index * 0.1}s`;
77708
- charSpan.textContent = char === ' ' ? '\u00A0' : char;
77709
- textElement.appendChild(charSpan);
77710
- });
77711
- loaderContainer.appendChild(textElement);
77712
- }
77713
- boxDiv.appendChild(loaderContainer);
77714
- customLoading.appendChild(boxDiv);
77715
- }
77716
- loadingEl.appendChild(customLoading);
77717
-
77718
- // 确保loading在表格中央区域居中显示
77719
- this.$nextTick(() => {
77720
- if (customLoading) {
77721
- customLoading.style.position = 'absolute';
77722
- customLoading.style.top = '0';
77723
- customLoading.style.left = '0';
77724
- customLoading.style.right = '0';
77725
- customLoading.style.bottom = '0';
77726
- customLoading.style.display = 'flex';
77727
- customLoading.style.justifyContent = 'center';
77728
- customLoading.style.alignItems = 'center';
77729
- customLoading.style.zIndex = '10001';
77730
- }
77731
- });
77732
-
77733
- // 再次确保默认loading被隐藏
77734
- setTimeout(() => {
77735
- this.hideDefaultLoading();
77736
- }, 50);
77737
- } else {
77738
- customLoading.style.display = 'flex';
77739
- customLoading.style.visibility = 'visible';
77740
- }
77741
- } else if (customLoading) {
77742
- // loading结束时隐藏
77743
- customLoading.style.display = 'none';
77744
- }
77745
- },
77746
78188
  /**
77747
78189
  * 确保默认排序高亮(数据变化时调用,支持前端分页和虚拟滚动)
77748
78190
  */
@@ -77786,8 +78228,8 @@ var custom_column_component = normalizeComponent(
77786
78228
  ;
77787
78229
  var table_component = normalizeComponent(
77788
78230
  components_tablevue_type_script_lang_js,
77789
- tablevue_type_template_id_23b79ced_render,
77790
- tablevue_type_template_id_23b79ced_staticRenderFns,
78231
+ tablevue_type_template_id_22e15733_render,
78232
+ tablevue_type_template_id_22e15733_staticRenderFns,
77791
78233
  false,
77792
78234
  null,
77793
78235
  null,
@@ -79082,8 +79524,6 @@ var ByCommonSelectorvue_type_template_id_05ec4584_render = function render() {
79082
79524
  };
79083
79525
  var ByCommonSelectorvue_type_template_id_05ec4584_staticRenderFns = [];
79084
79526
 
79085
- // EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.some.js
79086
- var es_iterator_some = __webpack_require__(3579);
79087
79527
  ;// ./node_modules/pinyin-pro/dist/index.mjs
79088
79528
 
79089
79529