cloud-web-corejs 1.0.54-dev.530 → 1.0.54-dev.532
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/package.json +1 -1
- package/src/components/excelExport/exportFieldDialog.vue +154 -81
- package/src/components/excelExport/mixins.js +963 -1
- package/src/components/table/index.js +1044 -1
- package/src/components/table/util/index.js +8 -1
- package/src/components/xform/form-designer/form-widget/field-widget/print-button-widget.vue +10 -0
- package/src/components/xform/form-designer/form-widget/field-widget/print-detail-button-widget.vue +4 -0
- package/src/components/xform/form-designer/form-widget/field-widget/select-export-item-button-widget.vue +92 -0
- package/src/components/xform/form-designer/form-widget/field-widget/table-export-button-widget.vue +37 -37
- package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/data-table-editor.vue +54 -47
- package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/exportItemColumns-dialog.vue +432 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/field-table-export-button/select-export-item-button-editor.vue +71 -0
- package/src/components/xform/form-designer/setting-panel/propertyRegister.js +1 -0
- package/src/components/xform/form-designer/widget-panel/widgetsConfig.js +37 -34
- package/src/components/xform/form-render/container-item/data-table-mixin.js +3025 -1
- package/src/components/xform/lang/zh-CN.js +1 -0
- package/src/components/xform/utils/formula-util copy.js +0 -4
- package/src/utils/vab.js +1 -1218
- package/src/components/xform/form-designer/form-widget/field-widget/tableexportbuttonwidget.vue +0 -99
package/package.json
CHANGED
|
@@ -13,7 +13,9 @@
|
|
|
13
13
|
:before-close="handleBeforeClose"
|
|
14
14
|
>
|
|
15
15
|
<div class="cont" style="max-height: 500px">
|
|
16
|
-
<div class="tit" style="margin-bottom: 5px
|
|
16
|
+
<div class="tit" style="margin-bottom: 5px">
|
|
17
|
+
<b>{{ $t1("导出字段") }}</b>
|
|
18
|
+
</div>
|
|
17
19
|
<el-tree
|
|
18
20
|
:props="defaultProps"
|
|
19
21
|
:data="data"
|
|
@@ -30,11 +32,11 @@
|
|
|
30
32
|
<span slot="footer" class="dialog-footer">
|
|
31
33
|
<el-button type="primary" plain class="button-sty" @click="handleDialogClose">
|
|
32
34
|
<i class="el-icon-close el-icon"></i>
|
|
33
|
-
{{ $t1(
|
|
35
|
+
{{ $t1("取 消") }}
|
|
34
36
|
</el-button>
|
|
35
37
|
<el-button type="primary" @click="dialogConfirm" class="button-sty">
|
|
36
38
|
<i class="el-icon-check el-icon"></i>
|
|
37
|
-
{{ $t1(
|
|
39
|
+
{{ $t1("确 定") }}
|
|
38
40
|
</el-button>
|
|
39
41
|
</span>
|
|
40
42
|
</el-dialog>
|
|
@@ -42,89 +44,162 @@
|
|
|
42
44
|
<script>
|
|
43
45
|
export default {
|
|
44
46
|
name: "exportFieldDialog",
|
|
45
|
-
props: [
|
|
47
|
+
props: ["param"],
|
|
46
48
|
data() {
|
|
47
49
|
return {
|
|
48
50
|
showDialog: true,
|
|
49
51
|
data: [],
|
|
50
52
|
defaultProps: {
|
|
51
|
-
label:
|
|
52
|
-
children:
|
|
53
|
+
label: "title", //这里是树结构中需显示的数据(即接口返回的需展示在页面上的参数)
|
|
54
|
+
children: "children",
|
|
53
55
|
},
|
|
54
56
|
defaultCheckedKeys: [],
|
|
55
57
|
columns: [],
|
|
56
|
-
allFields: []
|
|
57
|
-
}
|
|
58
|
+
allFields: [],
|
|
59
|
+
};
|
|
58
60
|
},
|
|
59
61
|
created() {
|
|
60
62
|
this.init();
|
|
61
63
|
},
|
|
62
64
|
methods: {
|
|
65
|
+
loopColumnHandle(items, handler) {
|
|
66
|
+
items.forEach((item) => {
|
|
67
|
+
handler(item);
|
|
68
|
+
if (item.children && item.children.length) {
|
|
69
|
+
this.loopColumnHandle(item.children, handler);
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
},
|
|
73
|
+
generateId() {
|
|
74
|
+
return Math.floor(
|
|
75
|
+
Math.random() * 100000 + Math.random() * 20000 + Math.random() * 5000
|
|
76
|
+
);
|
|
77
|
+
},
|
|
63
78
|
init() {
|
|
64
79
|
let target = this.getGrid();
|
|
65
|
-
let {fullColumn, collectColumn: columns} = target.getTableColumn();
|
|
80
|
+
let { fullColumn, collectColumn: columns } = target.getTableColumn();
|
|
66
81
|
// let columns = target.getTableColumn().collectColumn;
|
|
67
|
-
|
|
68
|
-
let
|
|
69
|
-
|
|
82
|
+
|
|
83
|
+
let exportItem = this.param.type === "exportItem";
|
|
84
|
+
|
|
70
85
|
let allFields = [];
|
|
71
|
-
|
|
86
|
+
let defaultCheckedKeys = [];
|
|
87
|
+
let cols = [];
|
|
88
|
+
|
|
89
|
+
let yesFields = [];
|
|
90
|
+
let noFields = [];
|
|
91
|
+
|
|
92
|
+
let exportColumns = !exportItem
|
|
93
|
+
? target.exportColumns || []
|
|
94
|
+
: target.exportItemColumns || [];
|
|
95
|
+
|
|
96
|
+
this.loopColumnHandle(exportColumns, (item) => {
|
|
72
97
|
if (item.field) {
|
|
73
98
|
if (item.export) {
|
|
74
|
-
yesFields.push(item.field)
|
|
99
|
+
yesFields.push(item.field);
|
|
75
100
|
} else {
|
|
76
|
-
noFields.push(item.field)
|
|
101
|
+
noFields.push(item.field);
|
|
77
102
|
}
|
|
78
103
|
}
|
|
79
|
-
})
|
|
104
|
+
});
|
|
80
105
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
if (
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
106
|
+
if (!exportItem) {
|
|
107
|
+
//导出主表数据
|
|
108
|
+
|
|
109
|
+
fullColumn.forEach((column) => {
|
|
110
|
+
if (column.field) {
|
|
111
|
+
if (yesFields.includes(column.field)) {
|
|
112
|
+
defaultCheckedKeys.push(column.id);
|
|
113
|
+
} else if (!noFields.includes(column.field) && column.visible) {
|
|
114
|
+
defaultCheckedKeys.push(column.id);
|
|
115
|
+
}
|
|
116
|
+
allFields.push(column.field);
|
|
89
117
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
118
|
+
});
|
|
119
|
+
columns.forEach((column) => {
|
|
120
|
+
if (column.title) {
|
|
121
|
+
cols.push(column);
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
} else {
|
|
125
|
+
//导出子表数据
|
|
126
|
+
let exportItemColumns = target.exportItemColumns || [];
|
|
127
|
+
let originOption = target.originOption;
|
|
128
|
+
let oriExportItemColumns = originOption.exportItemConfig?.columns || [];
|
|
129
|
+
|
|
130
|
+
this.loopColumnHandle(oriExportItemColumns, (item) => {
|
|
131
|
+
item.id = this.generateId();
|
|
132
|
+
if (item.field) {
|
|
133
|
+
if (yesFields.includes(item.field)) {
|
|
134
|
+
defaultCheckedKeys.push(item.id);
|
|
135
|
+
} else if (!noFields.includes(item.field)) {
|
|
136
|
+
defaultCheckedKeys.push(item.id);
|
|
137
|
+
}
|
|
138
|
+
allFields.push(item.field);
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
oriExportItemColumns.forEach((column) => {
|
|
142
|
+
if (column.title) {
|
|
143
|
+
cols.push(column);
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
|
|
98
148
|
this.allFields = allFields;
|
|
99
149
|
this.defaultCheckedKeys = defaultCheckedKeys;
|
|
100
|
-
let data = [
|
|
150
|
+
/* let data = [
|
|
101
151
|
{
|
|
102
|
-
label: this.$t1(
|
|
152
|
+
label: this.$t1("全部字段"),
|
|
103
153
|
id: -1,
|
|
104
154
|
leaf: true,
|
|
105
|
-
children: this.$baseLodash.cloneDeep(cols)
|
|
106
|
-
}
|
|
107
|
-
]
|
|
155
|
+
children: this.$baseLodash.cloneDeep(cols),
|
|
156
|
+
},
|
|
157
|
+
]; */
|
|
108
158
|
this.data = this.$baseLodash.cloneDeep(cols);
|
|
109
159
|
},
|
|
110
160
|
addTableExportColumns() {
|
|
161
|
+
let exportItem = this.param.type === "exportItem";
|
|
162
|
+
|
|
111
163
|
let $grid = this.getGrid();
|
|
112
|
-
let
|
|
113
|
-
let
|
|
114
|
-
let
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
164
|
+
let originOption = $grid.originOption;
|
|
165
|
+
let leafColumns = this.$refs.tree.getCheckedNodes(true);
|
|
166
|
+
let checkLeafIds = leafColumns.map((item) => item.id);
|
|
167
|
+
|
|
168
|
+
// let syncEportItemColumns = $grid.exportItemColumns || [];
|
|
169
|
+
// let syncExportColumns = $grid.exportColumns || [];
|
|
170
|
+
|
|
171
|
+
if (!exportItem) {
|
|
172
|
+
//导出主表数据
|
|
173
|
+
let exportColumns = [];
|
|
174
|
+
let { fullColumn } = $grid.getTableColumn();
|
|
175
|
+
fullColumn.map((column) => {
|
|
176
|
+
if (column.field && column.title) {
|
|
177
|
+
let item = {
|
|
178
|
+
field: column.field,
|
|
179
|
+
export: checkLeafIds.includes(column.id),
|
|
180
|
+
};
|
|
181
|
+
exportColumns.push(item);
|
|
121
182
|
}
|
|
122
|
-
|
|
183
|
+
});
|
|
184
|
+
$grid.exportColumns = exportColumns;
|
|
185
|
+
} else {
|
|
186
|
+
//导出子表数据
|
|
187
|
+
let exportItemColumns = [];
|
|
188
|
+
if (originOption.exportItemConfig?.columns?.length) {
|
|
189
|
+
this.loopColumnHandle(originOption.exportItemConfig?.columns, (column) => {
|
|
190
|
+
if (column.field && column.title) {
|
|
191
|
+
let item = {
|
|
192
|
+
field: column.field,
|
|
193
|
+
export: checkLeafIds.includes(column.id),
|
|
194
|
+
};
|
|
195
|
+
exportItemColumns.push(item);
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
$grid.exportItemColumns = exportItemColumns;
|
|
123
199
|
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
this.$vxeTableUtil.addTableJson(originOption.vue, $grid, originOption.tableName)
|
|
200
|
+
|
|
201
|
+
this.$vxeTableUtil.addTableJson(originOption.vue, $grid, originOption.tableName);
|
|
202
|
+
}
|
|
128
203
|
},
|
|
129
204
|
handleBeforeClose(hide) {
|
|
130
205
|
// this.$emit('cancel');
|
|
@@ -132,61 +207,64 @@ export default {
|
|
|
132
207
|
hide();
|
|
133
208
|
},
|
|
134
209
|
handleDialogClose() {
|
|
135
|
-
this.$emit(
|
|
136
|
-
this.dialogClose()
|
|
210
|
+
this.$emit("close");
|
|
211
|
+
this.dialogClose();
|
|
137
212
|
},
|
|
138
213
|
dialogClose() {
|
|
139
214
|
this.showDialog = false;
|
|
140
|
-
this.$emit(
|
|
215
|
+
this.$emit("update:visiable", false);
|
|
141
216
|
},
|
|
142
217
|
dialogConfirm() {
|
|
143
218
|
let target = this.getGrid();
|
|
144
|
-
let
|
|
145
|
-
let
|
|
146
|
-
let
|
|
219
|
+
let originOption = target.originOption;
|
|
220
|
+
let leafColumns = this.$refs.tree.getCheckedNodes(true);
|
|
221
|
+
let checkIds = this.$refs.tree.getCheckedNodes(false, true).map((item) => item.id);
|
|
222
|
+
let exportItem = this.param.type == "exportItem";
|
|
223
|
+
let collectColumn = !exportItem
|
|
224
|
+
? target.getTableColumn().collectColumn
|
|
225
|
+
: originOption.exportItemConfig?.columns;
|
|
147
226
|
let maxRowspan = 1;
|
|
148
|
-
leafColumns.forEach(item => {
|
|
227
|
+
leafColumns.forEach((item) => {
|
|
149
228
|
maxRowspan = Math.max(maxRowspan, item.level);
|
|
150
|
-
})
|
|
229
|
+
});
|
|
151
230
|
|
|
152
231
|
let loopDo = (items, parent) => {
|
|
153
|
-
let datas = []
|
|
154
|
-
items.forEach(item => {
|
|
232
|
+
let datas = [];
|
|
233
|
+
items.forEach((item) => {
|
|
155
234
|
if (checkIds.includes(item.id)) {
|
|
156
235
|
let column = this.$baseLodash.cloneDeep(item);
|
|
157
236
|
if (item.children && item.children.length > 0) {
|
|
158
237
|
let children = this.$baseLodash.cloneDeep(loopDo(item.children));
|
|
159
238
|
column.children = children;
|
|
160
239
|
if (children.length) {
|
|
161
|
-
column.colSpan = children.length
|
|
240
|
+
column.colSpan = children.length;
|
|
162
241
|
} else {
|
|
163
|
-
column.colSpan = 1
|
|
242
|
+
column.colSpan = 1;
|
|
164
243
|
}
|
|
165
244
|
} else if (!column.parentId) {
|
|
166
|
-
column.rowSpan = maxRowspan
|
|
245
|
+
column.rowSpan = maxRowspan;
|
|
167
246
|
}
|
|
168
|
-
;
|
|
169
247
|
datas.push(column);
|
|
170
248
|
}
|
|
171
|
-
})
|
|
249
|
+
});
|
|
172
250
|
return datas;
|
|
173
|
-
}
|
|
174
|
-
let columns = loopDo(collectColumn, null)
|
|
175
|
-
this.$emit(
|
|
251
|
+
};
|
|
252
|
+
let columns = loopDo(collectColumn, null);
|
|
253
|
+
this.$emit("confirm", { columns, leafColumns });
|
|
176
254
|
this.addTableExportColumns();
|
|
177
255
|
this.dialogClose();
|
|
178
256
|
},
|
|
179
|
-
getExportTitleJson() {
|
|
257
|
+
/* getExportTitleJson() {
|
|
180
258
|
let target = this.getGrid();
|
|
181
259
|
let columns = target.getColumns();
|
|
182
260
|
let cols = [];
|
|
183
|
-
columns.forEach(column => {
|
|
261
|
+
columns.forEach((column) => {
|
|
184
262
|
if (column.title && column.visible) {
|
|
185
263
|
cols.push(column);
|
|
186
264
|
}
|
|
187
265
|
});
|
|
188
266
|
return cols;
|
|
189
|
-
},
|
|
267
|
+
}, */
|
|
190
268
|
getGrid() {
|
|
191
269
|
let that = this.param.vue;
|
|
192
270
|
let tableRef = this.param.targetRef;
|
|
@@ -198,14 +276,9 @@ export default {
|
|
|
198
276
|
}
|
|
199
277
|
return $grid;
|
|
200
278
|
},
|
|
201
|
-
revert() {
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
}
|
|
205
|
-
}
|
|
279
|
+
revert() {},
|
|
280
|
+
},
|
|
281
|
+
};
|
|
206
282
|
</script>
|
|
207
283
|
|
|
208
|
-
|
|
209
|
-
<style scoped>
|
|
210
|
-
|
|
211
|
-
</style>
|
|
284
|
+
<style scoped></style>
|