cloud-web-corejs 1.0.181 → 1.0.183
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 +215 -81
- package/src/components/excelExport/mixins.js +1 -1
- package/src/components/hiprint/css/bootstrap.min.css +6 -0
- package/src/components/hiprint/fonts/glyphicons-halflings-regular.eot +0 -0
- package/src/components/hiprint/fonts/glyphicons-halflings-regular.svg +288 -0
- package/src/components/hiprint/fonts/glyphicons-halflings-regular.ttf +0 -0
- package/src/components/hiprint/fonts/glyphicons-halflings-regular.woff +0 -0
- package/src/components/hiprint/fonts/glyphicons-halflings-regular.woff2 +0 -0
- package/src/components/hiprint/view/design/index.vue +1 -0
- package/src/components/table/index.js +1 -1
- package/src/components/xform/form-designer/form-widget/field-widget/fieldMixin.js +1 -1
- package/src/components/xform/form-render/container-item/data-table-item.vue +11 -3
- package/src/components/xform/form-render/container-item/data-table-mixin.js +1 -1
- package/src/utils/vab.js +1 -1
- package/src/views/user/user/edit.vue +687 -456
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,101 +32,235 @@
|
|
|
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>
|
|
41
43
|
</template>
|
|
42
44
|
<script>
|
|
45
|
+
import xeUtils from "xe-utils";
|
|
43
46
|
export default {
|
|
44
47
|
name: "exportFieldDialog",
|
|
45
|
-
props: [
|
|
48
|
+
props: ["param"],
|
|
46
49
|
data() {
|
|
47
50
|
return {
|
|
48
51
|
showDialog: true,
|
|
49
52
|
data: [],
|
|
50
53
|
defaultProps: {
|
|
51
|
-
label:
|
|
52
|
-
children:
|
|
54
|
+
label: "title", //这里是树结构中需显示的数据(即接口返回的需展示在页面上的参数)
|
|
55
|
+
children: "children",
|
|
53
56
|
},
|
|
54
57
|
defaultCheckedKeys: [],
|
|
55
58
|
columns: [],
|
|
56
|
-
allFields: []
|
|
57
|
-
}
|
|
59
|
+
allFields: [],
|
|
60
|
+
};
|
|
58
61
|
},
|
|
59
62
|
created() {
|
|
60
63
|
this.init();
|
|
61
64
|
},
|
|
62
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
|
+
return Math.floor(
|
|
76
|
+
Math.random() * 100000 + Math.random() * 20000 + Math.random() * 5000
|
|
77
|
+
);
|
|
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
|
+
},
|
|
63
95
|
init() {
|
|
64
96
|
let target = this.getGrid();
|
|
65
|
-
let {fullColumn, collectColumn:
|
|
97
|
+
let { fullColumn, collectColumn: column1s } = target.getTableColumn();
|
|
98
|
+
|
|
99
|
+
let checkMethod = target.$refs.xTable.customOpts?.checkMethod;
|
|
100
|
+
// var checkMethod = $xetable ? $xetable.customOpts.checkMethod : null;
|
|
66
101
|
// let columns = target.getTableColumn().collectColumn;
|
|
67
|
-
let
|
|
68
|
-
let yesFields = [];
|
|
69
|
-
let noFields = []
|
|
102
|
+
let columns = [];
|
|
70
103
|
let allFields = [];
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
if (
|
|
74
|
-
|
|
104
|
+
if (checkMethod) {
|
|
105
|
+
const handleColumnVisible = (column) => {
|
|
106
|
+
if (!column.title) return false;
|
|
107
|
+
let visible = true;
|
|
108
|
+
|
|
109
|
+
let isColGroup = column.children && column.children.length;
|
|
110
|
+
|
|
111
|
+
if (isColGroup) {
|
|
112
|
+
// 如果是分组字段,则根据子字段的显示状态来处理
|
|
113
|
+
let parentVisible = false;
|
|
114
|
+
column.children.forEach((item) => {
|
|
115
|
+
let itemVisible = handleColumnVisible(item);
|
|
116
|
+
if (itemVisible) {
|
|
117
|
+
parentVisible = true;
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
visible = parentVisible;
|
|
121
|
+
/* visible = column.children.some((item) => {
|
|
122
|
+
return handleColumnVisible(item);
|
|
123
|
+
}); */
|
|
75
124
|
} else {
|
|
76
|
-
|
|
125
|
+
let isDisabled = !checkMethod({
|
|
126
|
+
column: column,
|
|
127
|
+
});
|
|
128
|
+
if (isDisabled) {
|
|
129
|
+
// 如果字段被禁用勾选,根据显示状态来处理
|
|
130
|
+
visible = column.visible;
|
|
131
|
+
}
|
|
132
|
+
if (column.field && visible) {
|
|
133
|
+
allFields.push(column.field);
|
|
134
|
+
}
|
|
77
135
|
}
|
|
78
|
-
|
|
79
|
-
|
|
136
|
+
column.exportItemVisible = visible;
|
|
137
|
+
return visible;
|
|
138
|
+
};
|
|
139
|
+
column1s.forEach((column) => {
|
|
140
|
+
return handleColumnVisible(column);
|
|
141
|
+
});
|
|
142
|
+
columns = this.filterExportVisible(column1s);
|
|
143
|
+
} else {
|
|
144
|
+
columns = column1s;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
let exportItem = this.param.type === "exportItem";
|
|
80
148
|
|
|
81
|
-
let defaultCheckedKeys = []
|
|
149
|
+
let defaultCheckedKeys = [];
|
|
82
150
|
let cols = [];
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
151
|
+
|
|
152
|
+
let yesFields = [];
|
|
153
|
+
let noFields = [];
|
|
154
|
+
|
|
155
|
+
let exportColumns = !exportItem
|
|
156
|
+
? target.exportColumns || []
|
|
157
|
+
: target.exportItemColumns || [];
|
|
158
|
+
|
|
159
|
+
this.loopColumnHandle(exportColumns, (item) => {
|
|
160
|
+
if (item.field) {
|
|
161
|
+
if (item.export) {
|
|
162
|
+
yesFields.push(item.field);
|
|
163
|
+
} else {
|
|
164
|
+
noFields.push(item.field);
|
|
89
165
|
}
|
|
90
|
-
allFields.push(column.field);
|
|
91
|
-
}
|
|
92
|
-
})
|
|
93
|
-
columns.forEach(column => {
|
|
94
|
-
if (column.title) {
|
|
95
|
-
cols.push(column);
|
|
96
166
|
}
|
|
97
167
|
});
|
|
168
|
+
|
|
169
|
+
if (!exportItem) {
|
|
170
|
+
//导出主表数据
|
|
171
|
+
|
|
172
|
+
fullColumn.forEach((column) => {
|
|
173
|
+
if (column.field) {
|
|
174
|
+
if (yesFields.includes(column.field)) {
|
|
175
|
+
defaultCheckedKeys.push(column.id);
|
|
176
|
+
} else if (!noFields.includes(column.field) && column.visible) {
|
|
177
|
+
defaultCheckedKeys.push(column.id);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
columns.forEach((column) => {
|
|
182
|
+
if (column.title) {
|
|
183
|
+
cols.push(column);
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
} else {
|
|
187
|
+
//导出子表数据
|
|
188
|
+
let exportItemColumns = target.exportItemColumns || [];
|
|
189
|
+
let originOption = target.originOption;
|
|
190
|
+
let oriExportItemColumns = originOption.exportItemConfig?.columns || [];
|
|
191
|
+
|
|
192
|
+
this.loopColumnHandle(oriExportItemColumns, (item) => {
|
|
193
|
+
item.id = this.generateId();
|
|
194
|
+
if (item.field && allFields.includes(item.field)) {
|
|
195
|
+
if (yesFields.includes(item.field)) {
|
|
196
|
+
defaultCheckedKeys.push(item.id);
|
|
197
|
+
} else if (!noFields.includes(item.field)) {
|
|
198
|
+
defaultCheckedKeys.push(item.id);
|
|
199
|
+
}
|
|
200
|
+
// allFields.push(item.field);
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
oriExportItemColumns.forEach((column) => {
|
|
204
|
+
if (column.title) {
|
|
205
|
+
cols.push(column);
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
|
|
98
210
|
this.allFields = allFields;
|
|
99
211
|
this.defaultCheckedKeys = defaultCheckedKeys;
|
|
100
|
-
let data = [
|
|
212
|
+
/* let data = [
|
|
101
213
|
{
|
|
102
|
-
label: this.$t1(
|
|
214
|
+
label: this.$t1("全部字段"),
|
|
103
215
|
id: -1,
|
|
104
216
|
leaf: true,
|
|
105
|
-
children: this.$baseLodash.cloneDeep(cols)
|
|
106
|
-
}
|
|
107
|
-
]
|
|
217
|
+
children: this.$baseLodash.cloneDeep(cols),
|
|
218
|
+
},
|
|
219
|
+
]; */
|
|
108
220
|
this.data = this.$baseLodash.cloneDeep(cols);
|
|
109
221
|
},
|
|
110
222
|
addTableExportColumns() {
|
|
223
|
+
let exportItem = this.param.type === "exportItem";
|
|
224
|
+
|
|
111
225
|
let $grid = this.getGrid();
|
|
112
|
-
let
|
|
113
|
-
let
|
|
114
|
-
let
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
226
|
+
let originOption = $grid.originOption;
|
|
227
|
+
let leafColumns = this.$refs.tree.getCheckedNodes(true);
|
|
228
|
+
let checkLeafIds = leafColumns.map((item) => item.id);
|
|
229
|
+
|
|
230
|
+
// let syncEportItemColumns = $grid.exportItemColumns || [];
|
|
231
|
+
// let syncExportColumns = $grid.exportColumns || [];
|
|
232
|
+
|
|
233
|
+
if (!exportItem) {
|
|
234
|
+
//导出主表数据
|
|
235
|
+
let exportColumns = [];
|
|
236
|
+
let { fullColumn } = $grid.getTableColumn();
|
|
237
|
+
fullColumn.map((column) => {
|
|
238
|
+
if (column.field && column.title) {
|
|
239
|
+
let item = {
|
|
240
|
+
field: column.field,
|
|
241
|
+
export: checkLeafIds.includes(column.id),
|
|
242
|
+
};
|
|
243
|
+
exportColumns.push(item);
|
|
121
244
|
}
|
|
122
|
-
|
|
245
|
+
});
|
|
246
|
+
$grid.exportColumns = exportColumns;
|
|
247
|
+
} else {
|
|
248
|
+
//导出子表数据
|
|
249
|
+
let exportItemColumns = [];
|
|
250
|
+
if (originOption.exportItemConfig?.columns?.length) {
|
|
251
|
+
this.loopColumnHandle(originOption.exportItemConfig?.columns, (column) => {
|
|
252
|
+
if (column.field && column.title) {
|
|
253
|
+
let item = {
|
|
254
|
+
field: column.field,
|
|
255
|
+
export: checkLeafIds.includes(column.id),
|
|
256
|
+
};
|
|
257
|
+
exportItemColumns.push(item);
|
|
258
|
+
}
|
|
259
|
+
});
|
|
260
|
+
$grid.exportItemColumns = exportItemColumns;
|
|
123
261
|
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
$grid.exportColumns = exportColumns;
|
|
127
|
-
this.$vxeTableUtil.addTableJson(originOption.vue, $grid, originOption.tableName)
|
|
262
|
+
}
|
|
263
|
+
this.$vxeTableUtil.addTableJson(originOption.vue, $grid, originOption.tableName);
|
|
128
264
|
},
|
|
129
265
|
handleBeforeClose(hide) {
|
|
130
266
|
// this.$emit('cancel');
|
|
@@ -132,61 +268,64 @@ export default {
|
|
|
132
268
|
hide();
|
|
133
269
|
},
|
|
134
270
|
handleDialogClose() {
|
|
135
|
-
this.$emit(
|
|
136
|
-
this.dialogClose()
|
|
271
|
+
this.$emit("close");
|
|
272
|
+
this.dialogClose();
|
|
137
273
|
},
|
|
138
274
|
dialogClose() {
|
|
139
275
|
this.showDialog = false;
|
|
140
|
-
this.$emit(
|
|
276
|
+
this.$emit("update:visiable", false);
|
|
141
277
|
},
|
|
142
278
|
dialogConfirm() {
|
|
143
279
|
let target = this.getGrid();
|
|
144
|
-
let
|
|
145
|
-
let
|
|
146
|
-
let
|
|
280
|
+
let originOption = target.originOption;
|
|
281
|
+
let leafColumns = this.$refs.tree.getCheckedNodes(true);
|
|
282
|
+
let checkIds = this.$refs.tree.getCheckedNodes(false, true).map((item) => item.id);
|
|
283
|
+
let exportItem = this.param.type == "exportItem";
|
|
284
|
+
let collectColumn = !exportItem
|
|
285
|
+
? target.getTableColumn().collectColumn
|
|
286
|
+
: originOption.exportItemConfig?.columns;
|
|
147
287
|
let maxRowspan = 1;
|
|
148
|
-
leafColumns.forEach(item => {
|
|
288
|
+
leafColumns.forEach((item) => {
|
|
149
289
|
maxRowspan = Math.max(maxRowspan, item.level);
|
|
150
|
-
})
|
|
290
|
+
});
|
|
151
291
|
|
|
152
292
|
let loopDo = (items, parent) => {
|
|
153
|
-
let datas = []
|
|
154
|
-
items.forEach(item => {
|
|
293
|
+
let datas = [];
|
|
294
|
+
items.forEach((item) => {
|
|
155
295
|
if (checkIds.includes(item.id)) {
|
|
156
296
|
let column = this.$baseLodash.cloneDeep(item);
|
|
157
297
|
if (item.children && item.children.length > 0) {
|
|
158
298
|
let children = this.$baseLodash.cloneDeep(loopDo(item.children));
|
|
159
299
|
column.children = children;
|
|
160
300
|
if (children.length) {
|
|
161
|
-
column.colSpan = children.length
|
|
301
|
+
column.colSpan = children.length;
|
|
162
302
|
} else {
|
|
163
|
-
column.colSpan = 1
|
|
303
|
+
column.colSpan = 1;
|
|
164
304
|
}
|
|
165
305
|
} else if (!column.parentId) {
|
|
166
|
-
column.rowSpan = maxRowspan
|
|
306
|
+
column.rowSpan = maxRowspan;
|
|
167
307
|
}
|
|
168
|
-
;
|
|
169
308
|
datas.push(column);
|
|
170
309
|
}
|
|
171
|
-
})
|
|
310
|
+
});
|
|
172
311
|
return datas;
|
|
173
|
-
}
|
|
174
|
-
let columns = loopDo(collectColumn, null)
|
|
175
|
-
this.$emit(
|
|
312
|
+
};
|
|
313
|
+
let columns = loopDo(collectColumn, null);
|
|
314
|
+
this.$emit("confirm", { columns, leafColumns });
|
|
176
315
|
this.addTableExportColumns();
|
|
177
316
|
this.dialogClose();
|
|
178
317
|
},
|
|
179
|
-
getExportTitleJson() {
|
|
318
|
+
/* getExportTitleJson() {
|
|
180
319
|
let target = this.getGrid();
|
|
181
320
|
let columns = target.getColumns();
|
|
182
321
|
let cols = [];
|
|
183
|
-
columns.forEach(column => {
|
|
322
|
+
columns.forEach((column) => {
|
|
184
323
|
if (column.title && column.visible) {
|
|
185
324
|
cols.push(column);
|
|
186
325
|
}
|
|
187
326
|
});
|
|
188
327
|
return cols;
|
|
189
|
-
},
|
|
328
|
+
}, */
|
|
190
329
|
getGrid() {
|
|
191
330
|
let that = this.param.vue;
|
|
192
331
|
let tableRef = this.param.targetRef;
|
|
@@ -198,14 +337,9 @@ export default {
|
|
|
198
337
|
}
|
|
199
338
|
return $grid;
|
|
200
339
|
},
|
|
201
|
-
revert() {
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
}
|
|
205
|
-
}
|
|
340
|
+
revert() {},
|
|
341
|
+
},
|
|
342
|
+
};
|
|
206
343
|
</script>
|
|
207
344
|
|
|
208
|
-
|
|
209
|
-
<style scoped>
|
|
210
|
-
|
|
211
|
-
</style>
|
|
345
|
+
<style scoped></style>
|