cloud-web-corejs 1.0.268 → 1.0.270

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.
@@ -1,367 +1,375 @@
1
- <template>
2
- <el-dialog
3
- :title="$t1('导出数据')"
4
- width="355px"
5
- custom-class="dialog-style list-dialog"
6
- :visible.sync="showDialog"
7
- :modal="false"
8
- :append-to-body="false"
9
- :modal-append-to-body="false"
10
- :close-on-click-modal="false"
11
- :destroy-on-close="true"
12
- v-el-dialog-center
13
- :before-close="handleBeforeClose"
14
- >
15
- <div class="cont" style="max-height: 500px">
16
- <div class="tit" style="margin-bottom: 5px">
17
- <b>{{ $t1("导出字段") }}</b>
18
- </div>
19
- <el-tree
20
- :props="defaultProps"
21
- :data="data"
22
- show-checkbox
23
- node-key="id"
24
- ref="tree"
25
- default-expand-all
26
- check-on-click-node
27
- :expand-on-click-node="false"
28
- icon-class="el-icon-arrow-right"
29
- :default-checked-keys="defaultCheckedKeys"
30
- ></el-tree>
31
- </div>
32
- <span slot="footer" class="dialog-footer">
33
- <el-button type="primary" plain class="button-sty" @click="handleDialogClose">
34
- <i class="el-icon-close el-icon"></i>
35
- {{ $t1("取 消") }}
36
- </el-button>
37
- <el-button type="primary" @click="dialogConfirm" class="button-sty">
38
- <i class="el-icon-check el-icon"></i>
39
- {{ $t1("确 定") }}
40
- </el-button>
41
- </span>
42
- </el-dialog>
43
- </template>
44
- <script>
45
- import xeUtils from "xe-utils";
46
- export default {
47
- name: "exportFieldDialog",
48
- props: ["param"],
49
- data() {
50
- return {
51
- showDialog: true,
52
- data: [],
53
- defaultProps: {
54
- label: "title", //这里是树结构中需显示的数据(即接口返回的需展示在页面上的参数)
55
- children: "children",
56
- },
57
- defaultCheckedKeys: [],
58
- columns: [],
59
- allFields: [],
60
- };
61
- },
62
- created() {
63
- this.init();
64
- },
65
- methods: {
66
- loopColumnHandle(items, handler) {
67
- items.forEach((item) => {
68
- handler(item);
69
- if (item.children && item.children.length) {
70
- this.loopColumnHandle(item.children, handler);
71
- }
72
- });
73
- },
74
- generateId() {
75
- // 自增序号保证唯一:随机数范围小,列多时会碰撞导致树勾选(node-key)错乱
76
- this.idSeed = (this.idSeed || 0) + 1;
77
- return "expcol_" + Date.now() + "_" + this.idSeed;
78
- },
79
- filterExportVisible(items) {
80
- if (!Array.isArray(items)) return [];
81
-
82
- return items
83
- .filter((item) => item.exportItemVisible === true) // 只保留 exportItemVisible 严格等于 true 的项
84
- .map((item) => {
85
- // 如果有 children,递归过滤
86
- if (Array.isArray(item.children)) {
87
- return {
88
- ...item,
89
- children: this.filterExportVisible(item.children),
90
- };
91
- }
92
- return item;
93
- });
94
- },
95
- filterNonDataExportColumns(items) {
96
- if (!Array.isArray(items)) return [];
97
- return items.reduce((result, item) => {
98
- if (item.params?.exportDisabled) return result;
99
- if (Array.isArray(item.children) && item.children.length) {
100
- let children = this.filterNonDataExportColumns(item.children);
101
- if (!children.length) return result;
102
- result.push({ ...item, children });
103
- } else {
104
- result.push(item);
105
- }
106
- return result;
107
- }, []);
108
- },
109
- init() {
110
- let target = this.getGrid();
111
- let { fullColumn, collectColumn: column1s } = target.getTableColumn();
112
-
113
- let checkMethod = target.$refs.xTable.customOpts?.checkMethod;
114
- // var checkMethod = $xetable ? $xetable.customOpts.checkMethod : null;
115
- // let columns = target.getTableColumn().collectColumn;
116
- let columns = [];
117
- let allFields = [];
118
- if (checkMethod) {
119
- const handleColumnVisible = (column) => {
120
- if (!column.title) return false;
121
- let visible = true;
122
-
123
- let isColGroup = column.children && column.children.length;
124
-
125
- if (isColGroup) {
126
- // 如果是分组字段,则根据子字段的显示状态来处理
127
- let parentVisible = false;
128
- column.children.forEach((item) => {
129
- let itemVisible = handleColumnVisible(item);
130
- if (itemVisible) {
131
- parentVisible = true;
132
- }
133
- });
134
- visible = parentVisible;
135
- /* visible = column.children.some((item) => {
136
- return handleColumnVisible(item);
137
- }); */
138
- } else {
139
- let isDisabled = !checkMethod({
140
- column: column,
141
- });
142
- if (isDisabled) {
143
- // 如果字段被禁用勾选,根据显示状态来处理
144
- visible = column.visible;
145
- }
146
- if (column.field && visible) {
147
- allFields.push(column.field);
148
- }
149
- }
150
- column.exportItemVisible = visible;
151
- return visible;
152
- };
153
- column1s.forEach((column) => {
154
- return handleColumnVisible(column);
155
- });
156
- columns = this.filterExportVisible(column1s);
157
- } else {
158
- columns = column1s;
159
- }
160
- columns = this.filterNonDataExportColumns(columns);
161
-
162
- let exportItem = this.param.type === "exportItem";
163
-
164
- let defaultCheckedKeys = [];
165
- let cols = [];
166
-
167
- let yesFields = [];
168
- let noFields = [];
169
-
170
- let exportColumns = !exportItem
171
- ? target.exportColumns || []
172
- : target.exportItemColumns || [];
173
-
174
- this.loopColumnHandle(exportColumns, (item) => {
175
- if (item.field) {
176
- if (item.export) {
177
- yesFields.push(item.field);
178
- } else {
179
- noFields.push(item.field);
180
- }
181
- }
182
- });
183
-
184
- if (!exportItem) {
185
- //导出主表数据
186
-
187
- fullColumn.forEach((column) => {
188
- if (column.field && !column.params?.exportDisabled) {
189
- if (yesFields.includes(column.field)) {
190
- defaultCheckedKeys.push(column.id);
191
- } else if (!noFields.includes(column.field) && column.visible) {
192
- defaultCheckedKeys.push(column.id);
193
- }
194
- }
195
- });
196
- columns.forEach((column) => {
197
- if (column.title) {
198
- cols.push(column);
199
- }
200
- });
201
- } else {
202
- //导出子表数据
203
- let exportItemColumns = target.exportItemColumns || [];
204
- let originOption = target.params.originOption;
205
- let oriExportItemColumns = originOption.exportItemConfig?.columns || [];
206
-
207
- this.loopColumnHandle(oriExportItemColumns, (item) => {
208
- item.id = this.generateId();
209
- if (item.field && allFields.includes(item.field)) {
210
- if (yesFields.includes(item.field)) {
211
- defaultCheckedKeys.push(item.id);
212
- } else if (!noFields.includes(item.field)) {
213
- defaultCheckedKeys.push(item.id);
214
- }
215
- // allFields.push(item.field);
216
- }
217
- });
218
- oriExportItemColumns.forEach((column) => {
219
- if (column.title) {
220
- cols.push(column);
221
- }
222
- });
223
- }
224
-
225
- this.allFields = allFields;
226
- this.defaultCheckedKeys = defaultCheckedKeys;
227
- /* let data = [
228
- {
229
- label: this.$t1("全部字段"),
230
- id: -1,
231
- leaf: true,
232
- children: this.$baseLodash.cloneDeep(cols),
233
- },
234
- ]; */
235
- this.data = this.$baseLodash.cloneDeep(cols);
236
- },
237
- addTableExportColumns() {
238
- let exportItem = this.param.type === "exportItem";
239
-
240
- let $grid = this.getGrid();
241
- let originOption = $grid.params.originOption;
242
- let leafColumns = this.$refs.tree.getCheckedNodes(true);
243
- let checkLeafIds = leafColumns.map((item) => item.id);
244
-
245
- // let syncEportItemColumns = $grid.exportItemColumns || [];
246
- // let syncExportColumns = $grid.exportColumns || [];
247
-
248
- if (!exportItem) {
249
- //导出主表数据
250
- let exportColumns = [];
251
- let { fullColumn } = $grid.getTableColumn();
252
- fullColumn.map((column) => {
253
- if (column.field && column.title) {
254
- let item = {
255
- field: column.field,
256
- export: checkLeafIds.includes(column.id),
257
- };
258
- exportColumns.push(item);
259
- }
260
- });
261
- $grid.exportColumns = exportColumns;
262
- } else {
263
- //导出子表数据
264
- let exportItemColumns = [];
265
- if (originOption.exportItemConfig?.columns?.length) {
266
- this.loopColumnHandle(originOption.exportItemConfig?.columns, (column) => {
267
- if (column.field && column.title) {
268
- let item = {
269
- field: column.field,
270
- export: checkLeafIds.includes(column.id),
271
- };
272
- exportItemColumns.push(item);
273
- }
274
- });
275
- $grid.exportItemColumns = exportItemColumns;
276
- }
277
- }
278
- this.$vxeTableUtil.addTableJson(originOption.vue, $grid, originOption.tableName);
279
- },
280
- handleBeforeClose(hide) {
281
- // this.$emit('cancel');
282
- this.handleDialogClose();
283
- hide();
284
- },
285
- handleDialogClose() {
286
- this.$emit("close");
287
- this.dialogClose();
288
- },
289
- dialogClose() {
290
- this.showDialog = false;
291
- this.$emit("update:visiable", false);
292
- },
293
- dialogConfirm() {
294
- let target = this.getGrid();
295
- let originOption = target.params.originOption;
296
- let leafColumns = this.$refs.tree.getCheckedNodes(true);
297
- let checkIds = this.$refs.tree.getCheckedNodes(false, true).map((item) => item.id);
298
- let exportItem = this.param.type == "exportItem";
299
- let collectColumn = !exportItem
300
- ? target.getTableColumn().collectColumn
301
- : originOption.exportItemConfig?.columns;
302
- // 按勾选后的实际层级算表头总行数(item.level 在导出明细列上不存在,不可依赖)
303
- let maxRowspan = 1;
304
- let depthDo = (items, depth) => {
305
- (items || []).forEach((item) => {
306
- if (!checkIds.includes(item.id)) return;
307
- if (item.children && item.children.length > 0) {
308
- depthDo(item.children, depth + 1);
309
- } else if (depth > maxRowspan) {
310
- maxRowspan = depth;
311
- }
312
- });
313
- };
314
- depthDo(collectColumn, 1);
315
-
316
- let loopDo = (items, depth) => {
317
- let datas = [];
318
- items.forEach((item) => {
319
- if (checkIds.includes(item.id) && !item.params?.exportDisabled) {
320
- let column = this.$baseLodash.cloneDeep(item);
321
- if (item.children && item.children.length > 0) {
322
- let children = loopDo(item.children, depth + 1);
323
- column.children = children;
324
- column.colSpan = children.length ? children.length : 1;
325
- column.rowSpan = 1;
326
- } else {
327
- // 任意层级的叶子列都要跨到表头底行,否则多层分组表头导出错位
328
- column.rowSpan = maxRowspan - depth + 1;
329
- }
330
- datas.push(column);
331
- }
332
- });
333
- return datas;
334
- };
335
- let columns = loopDo(collectColumn, 1);
336
- this.$emit("confirm", { columns, leafColumns });
337
- this.addTableExportColumns();
338
- this.dialogClose();
339
- },
340
- /* getExportTitleJson() {
341
- let target = this.getGrid();
342
- let columns = target.getColumns();
343
- let cols = [];
344
- columns.forEach((column) => {
345
- if (column.title && column.visible) {
346
- cols.push(column);
347
- }
348
- });
349
- return cols;
350
- }, */
351
- getGrid() {
352
- let that = this.param.vue;
353
- let tableRef = this.param.targetRef;
354
- let $grid;
355
- if (Array.isArray(that.$refs[tableRef])) {
356
- $grid = that.$refs[tableRef][0];
357
- } else {
358
- $grid = that.$refs[tableRef];
359
- }
360
- return $grid;
361
- },
362
- revert() {},
363
- },
364
- };
365
- </script>
366
-
367
- <style scoped></style>
1
+ <template>
2
+ <el-dialog
3
+ :title="$t1('导出数据')"
4
+ width="355px"
5
+ custom-class="dialog-style list-dialog"
6
+ :visible.sync="showDialog"
7
+ :modal="false"
8
+ :append-to-body="false"
9
+ :modal-append-to-body="false"
10
+ :close-on-click-modal="false"
11
+ :destroy-on-close="true"
12
+ v-el-dialog-center
13
+ :before-close="handleBeforeClose"
14
+ >
15
+ <div class="cont" style="max-height: 500px">
16
+ <div class="tit" style="margin-bottom: 5px">
17
+ <b>{{ $t1("导出字段") }}</b>
18
+ </div>
19
+ <el-tree
20
+ :props="defaultProps"
21
+ :data="data"
22
+ show-checkbox
23
+ node-key="id"
24
+ ref="tree"
25
+ default-expand-all
26
+ check-on-click-node
27
+ :expand-on-click-node="false"
28
+ icon-class="el-icon-arrow-right"
29
+ :default-checked-keys="defaultCheckedKeys"
30
+ ></el-tree>
31
+ </div>
32
+ <span slot="footer" class="dialog-footer">
33
+ <el-button type="primary" plain class="button-sty" @click="handleDialogClose">
34
+ <i class="el-icon-close el-icon"></i>
35
+ {{ $t1("取 消") }}
36
+ </el-button>
37
+ <el-button type="primary" @click="dialogConfirm" class="button-sty">
38
+ <i class="el-icon-check el-icon"></i>
39
+ {{ $t1("确 定") }}
40
+ </el-button>
41
+ </span>
42
+ </el-dialog>
43
+ </template>
44
+ <script>
45
+ import xeUtils from "xe-utils";
46
+ import { isItemExport } from "./exportType";
47
+ export default {
48
+ name: "exportFieldDialog",
49
+ props: ["param"],
50
+ data() {
51
+ return {
52
+ showDialog: true,
53
+ data: [],
54
+ defaultProps: {
55
+ label: "title", //这里是树结构中需显示的数据(即接口返回的需展示在页面上的参数)
56
+ children: "children",
57
+ },
58
+ defaultCheckedKeys: [],
59
+ columns: [],
60
+ allFields: [],
61
+ };
62
+ },
63
+ created() {
64
+ this.init();
65
+ },
66
+ methods: {
67
+ loopColumnHandle(items, handler) {
68
+ items.forEach((item) => {
69
+ handler(item);
70
+ if (item.children && item.children.length) {
71
+ this.loopColumnHandle(item.children, handler);
72
+ }
73
+ });
74
+ },
75
+ generateId() {
76
+ // 自增序号保证唯一:随机数范围小,列多时会碰撞导致树勾选(node-key)错乱
77
+ this.idSeed = (this.idSeed || 0) + 1;
78
+ return "expcol_" + Date.now() + "_" + this.idSeed;
79
+ },
80
+ filterExportVisible(items) {
81
+ if (!Array.isArray(items)) return [];
82
+
83
+ return items
84
+ .filter((item) => item.exportItemVisible === true) // 只保留 exportItemVisible 严格等于 true 的项
85
+ .map((item) => {
86
+ // 如果有 children,递归过滤
87
+ if (Array.isArray(item.children)) {
88
+ return {
89
+ ...item,
90
+ children: this.filterExportVisible(item.children),
91
+ };
92
+ }
93
+ return item;
94
+ });
95
+ },
96
+ filterNonDataExportColumns(items) {
97
+ if (!Array.isArray(items)) return [];
98
+ return items.reduce((result, item) => {
99
+ if (item.params?.exportDisabled) return result;
100
+ if (Array.isArray(item.children) && item.children.length) {
101
+ let children = this.filterNonDataExportColumns(item.children);
102
+ if (!children.length) return result;
103
+ result.push({ ...item, children });
104
+ } else {
105
+ result.push(item);
106
+ }
107
+ return result;
108
+ }, []);
109
+ },
110
+ init() {
111
+ let target = this.getGrid();
112
+ let { fullColumn, collectColumn: column1s } = target.getTableColumn();
113
+
114
+ let checkMethod = target.$refs.xTable.customOpts?.checkMethod;
115
+ // var checkMethod = $xetable ? $xetable.customOpts.checkMethod : null;
116
+ // let columns = target.getTableColumn().collectColumn;
117
+ let columns = [];
118
+ let allFields = [];
119
+ if (checkMethod) {
120
+ const handleColumnVisible = (column) => {
121
+ if (!column.title) return false;
122
+ let visible = true;
123
+
124
+ let isColGroup = column.children && column.children.length;
125
+
126
+ if (isColGroup) {
127
+ // 如果是分组字段,则根据子字段的显示状态来处理
128
+ let parentVisible = false;
129
+ column.children.forEach((item) => {
130
+ let itemVisible = handleColumnVisible(item);
131
+ if (itemVisible) {
132
+ parentVisible = true;
133
+ }
134
+ });
135
+ visible = parentVisible;
136
+ /* visible = column.children.some((item) => {
137
+ return handleColumnVisible(item);
138
+ }); */
139
+ } else {
140
+ let isDisabled = !checkMethod({
141
+ column: column,
142
+ });
143
+ if (isDisabled) {
144
+ // 如果字段被禁用勾选,根据显示状态来处理
145
+ visible = column.visible;
146
+ }
147
+ if (column.field && visible) {
148
+ allFields.push(column.field);
149
+ }
150
+ }
151
+ column.exportItemVisible = visible;
152
+ return visible;
153
+ };
154
+ column1s.forEach((column) => {
155
+ return handleColumnVisible(column);
156
+ });
157
+ columns = this.filterExportVisible(column1s);
158
+ } else {
159
+ columns = column1s;
160
+ }
161
+ columns = this.filterNonDataExportColumns(columns);
162
+
163
+ let exportItem = isItemExport(this.param.type);
164
+
165
+ let defaultCheckedKeys = [];
166
+ let cols = [];
167
+
168
+ let yesFields = [];
169
+ let noFields = [];
170
+
171
+ let exportColumns =
172
+ this.$vxeTableUtil.getTableStateValue(
173
+ target,
174
+ !exportItem ? "exportColumns" : "exportItemColumns"
175
+ ) || [];
176
+
177
+ this.loopColumnHandle(exportColumns, (item) => {
178
+ if (item.field) {
179
+ if (item.export) {
180
+ yesFields.push(item.field);
181
+ } else {
182
+ noFields.push(item.field);
183
+ }
184
+ }
185
+ });
186
+
187
+ if (!exportItem) {
188
+ //导出主表数据
189
+
190
+ fullColumn.forEach((column) => {
191
+ if (column.field && !column.params?.exportDisabled) {
192
+ if (yesFields.includes(column.field)) {
193
+ defaultCheckedKeys.push(column.id);
194
+ } else if (!noFields.includes(column.field) && column.visible) {
195
+ defaultCheckedKeys.push(column.id);
196
+ }
197
+ }
198
+ });
199
+ columns.forEach((column) => {
200
+ if (column.title) {
201
+ cols.push(column);
202
+ }
203
+ });
204
+ } else {
205
+ //导出子表数据
206
+ let originOption = target.params.originOption;
207
+ let oriExportItemColumns = originOption.exportItemConfig?.columns || [];
208
+
209
+ // 与主表分支一致的三态:记为导出→勾选,记为不导出→不勾,两者都无(新增列)→ 默认勾选。
210
+ // 这里曾以 allFields.includes(field) 为前置门槛,但 allFields 只在 custom-config
211
+ // 配了 checkMethod 时才有内容,而全库未配任何 checkMethod → 恒为空数组 → 明细列
212
+ // 一个都勾不上,连 exportItemColumns 的勾选记忆也一并失效。明细列与主表列本就是两套
213
+ // 字段,取交集没有意义,故去掉该门槛。
214
+ this.loopColumnHandle(oriExportItemColumns, (item) => {
215
+ item.id = this.generateId();
216
+ if (!item.field) return;
217
+ let isYes = yesFields.includes(item.field);
218
+ let isNo = noFields.includes(item.field);
219
+ if (isYes || !isNo) {
220
+ defaultCheckedKeys.push(item.id);
221
+ }
222
+ });
223
+ oriExportItemColumns.forEach((column) => {
224
+ if (column.title) {
225
+ cols.push(column);
226
+ }
227
+ });
228
+ }
229
+
230
+ this.allFields = allFields;
231
+ this.defaultCheckedKeys = defaultCheckedKeys;
232
+ /* let data = [
233
+ {
234
+ label: this.$t1("全部字段"),
235
+ id: -1,
236
+ leaf: true,
237
+ children: this.$baseLodash.cloneDeep(cols),
238
+ },
239
+ ]; */
240
+ this.data = this.$baseLodash.cloneDeep(cols);
241
+ },
242
+ addTableExportColumns() {
243
+ let exportItem = isItemExport(this.param.type);
244
+
245
+ let $grid = this.getGrid();
246
+ let originOption = $grid.params.originOption;
247
+ let leafColumns = this.$refs.tree.getCheckedNodes(true);
248
+ let checkLeafIds = leafColumns.map((item) => item.id);
249
+
250
+ if (!exportItem) {
251
+ //导出主表数据
252
+ let exportColumns = [];
253
+ let { fullColumn } = $grid.getTableColumn();
254
+ fullColumn.map((column) => {
255
+ if (column.field && column.title) {
256
+ let item = {
257
+ field: column.field,
258
+ export: checkLeafIds.includes(column.id),
259
+ };
260
+ exportColumns.push(item);
261
+ }
262
+ });
263
+ this.$vxeTableUtil.setTableState($grid, "exportColumns", exportColumns);
264
+ } else {
265
+ //导出子表数据
266
+ let exportItemColumns = [];
267
+ if (originOption.exportItemConfig?.columns?.length) {
268
+ this.loopColumnHandle(originOption.exportItemConfig?.columns, (column) => {
269
+ if (column.field && column.title) {
270
+ let item = {
271
+ field: column.field,
272
+ export: checkLeafIds.includes(column.id),
273
+ };
274
+ exportItemColumns.push(item);
275
+ }
276
+ });
277
+ this.$vxeTableUtil.setTableState(
278
+ $grid,
279
+ "exportItemColumns",
280
+ exportItemColumns
281
+ );
282
+ }
283
+ }
284
+ this.$vxeTableUtil.addTableJson(originOption.vue, $grid, originOption.tableName);
285
+ },
286
+ handleBeforeClose(hide) {
287
+ // this.$emit('cancel');
288
+ this.handleDialogClose();
289
+ hide();
290
+ },
291
+ handleDialogClose() {
292
+ this.$emit("close");
293
+ this.dialogClose();
294
+ },
295
+ dialogClose() {
296
+ this.showDialog = false;
297
+ this.$emit("update:visiable", false);
298
+ },
299
+ dialogConfirm() {
300
+ let target = this.getGrid();
301
+ let originOption = target.params.originOption;
302
+ let leafColumns = this.$refs.tree.getCheckedNodes(true);
303
+ let checkIds = this.$refs.tree.getCheckedNodes(false, true).map((item) => item.id);
304
+ let exportItem = isItemExport(this.param.type);
305
+ let collectColumn = !exportItem
306
+ ? target.getTableColumn().collectColumn
307
+ : originOption.exportItemConfig?.columns;
308
+ // 明细导出列未维护时这里是 undefined,下面 depthDo/loopDo 直接遍历会抛错
309
+ collectColumn = collectColumn || [];
310
+ // 按勾选后的实际层级算表头总行数(item.level 在导出明细列上不存在,不可依赖)
311
+ let maxRowspan = 1;
312
+ let depthDo = (items, depth) => {
313
+ (items || []).forEach((item) => {
314
+ if (!checkIds.includes(item.id)) return;
315
+ if (item.children && item.children.length > 0) {
316
+ depthDo(item.children, depth + 1);
317
+ } else if (depth > maxRowspan) {
318
+ maxRowspan = depth;
319
+ }
320
+ });
321
+ };
322
+ depthDo(collectColumn, 1);
323
+
324
+ let loopDo = (items, depth) => {
325
+ let datas = [];
326
+ (items || []).forEach((item) => {
327
+ if (checkIds.includes(item.id) && !item.params?.exportDisabled) {
328
+ let column = this.$baseLodash.cloneDeep(item);
329
+ if (item.children && item.children.length > 0) {
330
+ let children = loopDo(item.children, depth + 1);
331
+ column.children = children;
332
+ column.colSpan = children.length ? children.length : 1;
333
+ column.rowSpan = 1;
334
+ } else {
335
+ // 任意层级的叶子列都要跨到表头底行,否则多层分组表头导出错位
336
+ column.rowSpan = maxRowspan - depth + 1;
337
+ }
338
+ datas.push(column);
339
+ }
340
+ });
341
+ return datas;
342
+ };
343
+ let columns = loopDo(collectColumn, 1);
344
+ this.$emit("confirm", { columns, leafColumns });
345
+ this.addTableExportColumns();
346
+ this.dialogClose();
347
+ },
348
+ /* getExportTitleJson() {
349
+ let target = this.getGrid();
350
+ let columns = target.getColumns();
351
+ let cols = [];
352
+ columns.forEach((column) => {
353
+ if (column.title && column.visible) {
354
+ cols.push(column);
355
+ }
356
+ });
357
+ return cols;
358
+ }, */
359
+ getGrid() {
360
+ let that = this.param.vue;
361
+ let tableRef = this.param.targetRef;
362
+ let $grid;
363
+ if (Array.isArray(that.$refs[tableRef])) {
364
+ $grid = that.$refs[tableRef][0];
365
+ } else {
366
+ $grid = that.$refs[tableRef];
367
+ }
368
+ return $grid;
369
+ },
370
+ revert() {},
371
+ },
372
+ };
373
+ </script>
374
+
375
+ <style scoped></style>