super-page-runtime 2.1.48 → 2.1.50
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/dist/es/components/runtime/utils/api/api-util.d.ts +1 -18
- package/dist/es/components/runtime/utils/api/api-util.js +2 -306
- package/dist/es/components/runtime/utils/api/page-expose-util.js +8 -1
- package/dist/es/components/runtime/utils/charts/chart-columnline-util.js +1 -0
- package/dist/es/components/runtime/utils/events/standard-event.d.ts +11 -1
- package/dist/es/components/runtime/utils/events/standard-event.js +334 -36
- package/dist/es/components/runtime/utils/page-helper-util.d.ts +3 -1
- package/dist/es/components/runtime/utils/page-helper-util.js +21 -2
- package/dist/es/components/runtime/views/assemblys/chart/table/chart-table-util.js +480 -0
- package/dist/es/components/runtime/views/assemblys/chart/table/group-column-item.vue.js +44 -0
- package/dist/es/components/runtime/views/assemblys/chart/table/group-column-item.vue2.js +4 -0
- package/dist/es/components/runtime/views/assemblys/chart/table/group-column.vue.js +64 -0
- package/dist/es/components/runtime/views/assemblys/chart/table/group-column.vue2.js +4 -0
- package/dist/es/components/runtime/views/assemblys/chart/table/normal-column.vue.js +242 -0
- package/dist/es/components/runtime/views/assemblys/chart/table/normal-column.vue2.js +4 -0
- package/dist/es/components/runtime/views/assemblys/chart/table/table-runtime.vue2.js +301 -34
- package/dist/es/components/runtime/views/assemblys/data/table/main-table-runtime.vue.js +46 -14
- package/dist/es/components/runtime/views/assemblys/data/table/sub-table-runtime.vue.js +28 -4
- package/dist/es/components/runtime/views/assemblys/form/input-text/inputtext-runtime.vue2.js +3 -1
- package/dist/es/components/runtime/views/super-page-dialog.vue.d.ts +4 -0
- package/dist/es/components/runtime/views/super-page-dialog.vue.js +5 -1
- package/dist/es/components/runtime/views/super-page.vue.js +3 -2
- package/package.json +2 -2
|
@@ -0,0 +1,480 @@
|
|
|
1
|
+
import { getValueFromVariable } from "../../../../utils/page-helper-util.js";
|
|
2
|
+
import { getCustomFunc } from "../../../../utils/events/event-util.js";
|
|
3
|
+
class ExpressionEvaluator {
|
|
4
|
+
static evaluate(pageContext, conditions, data) {
|
|
5
|
+
const expressions = conditions.map(
|
|
6
|
+
(condition) => this.createExpression(pageContext, condition, data)
|
|
7
|
+
);
|
|
8
|
+
const joinedExpression = expressions.join(" ");
|
|
9
|
+
return this.evaluateExpression(joinedExpression);
|
|
10
|
+
}
|
|
11
|
+
static createExpression(pageContext, condition, data) {
|
|
12
|
+
const { propName, operator, propValue, leftBracket, rightBracket, joinSign, dataType } = condition;
|
|
13
|
+
if (!propName || propName === "") {
|
|
14
|
+
return "";
|
|
15
|
+
}
|
|
16
|
+
let value = getValueFromVariable(pageContext.entity, propName, data);
|
|
17
|
+
let expression2 = `${leftBracket} ${this.getComparisonExpression(value, operator, getValueFromVariable(pageContext.entity, propValue, data), dataType)} ${rightBracket}`;
|
|
18
|
+
if (joinSign) {
|
|
19
|
+
if (joinSign === "and" || joinSign === "AND") {
|
|
20
|
+
expression2 += "&&";
|
|
21
|
+
} else if (joinSign === "or" || joinSign === "OR") {
|
|
22
|
+
expression2 += "||";
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return expression2.trim();
|
|
26
|
+
}
|
|
27
|
+
static getComparisonExpression(value, operator, propValue, dataType) {
|
|
28
|
+
if (!operator) {
|
|
29
|
+
operator = "EQ";
|
|
30
|
+
}
|
|
31
|
+
const parsedValue = this.parseValue(value, dataType);
|
|
32
|
+
const parsedPropValue = this.parseValue(propValue, dataType);
|
|
33
|
+
switch (operator) {
|
|
34
|
+
case "EQ":
|
|
35
|
+
return `${parsedValue} === ${parsedPropValue}`;
|
|
36
|
+
case "GT":
|
|
37
|
+
return `${parsedValue} > ${parsedPropValue}`;
|
|
38
|
+
case "LT":
|
|
39
|
+
return `${parsedValue} < ${parsedPropValue}`;
|
|
40
|
+
case "GET":
|
|
41
|
+
return `${parsedValue} >= ${parsedPropValue}`;
|
|
42
|
+
case "LET":
|
|
43
|
+
return `${parsedValue} <= ${parsedPropValue}`;
|
|
44
|
+
case "NET":
|
|
45
|
+
return `${parsedValue} !== ${parsedPropValue}`;
|
|
46
|
+
case "CONTAIN":
|
|
47
|
+
return `${parsedValue}.includes(${parsedPropValue})`;
|
|
48
|
+
case "NOT_CONTAIN":
|
|
49
|
+
return `!${parsedValue}.includes(${parsedPropValue})`;
|
|
50
|
+
case "IS_NULL":
|
|
51
|
+
return `${parsedValue} === null`;
|
|
52
|
+
case "IS_NOT_NULL":
|
|
53
|
+
return `${parsedValue} !== null`;
|
|
54
|
+
default:
|
|
55
|
+
throw new Error(`比较符号不匹配: ${operator}`);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
static changeDataType(dataType) {
|
|
59
|
+
let resultDataType = dataType;
|
|
60
|
+
if (dataType) {
|
|
61
|
+
if (dataType === "TEXT") {
|
|
62
|
+
resultDataType = "string";
|
|
63
|
+
} else if (dataType === "DATE" || dataType === "TIME") {
|
|
64
|
+
resultDataType = "date";
|
|
65
|
+
} else if (dataType === "DOUBLE" || dataType === "FLOAT" || dataType === "INTEGER" || dataType === "LONG" || dataType === "BOOLEAN") {
|
|
66
|
+
resultDataType = "number";
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return resultDataType;
|
|
70
|
+
}
|
|
71
|
+
static parseValue(value, dataType) {
|
|
72
|
+
dataType = this.changeDataType(dataType);
|
|
73
|
+
switch (dataType) {
|
|
74
|
+
case "number":
|
|
75
|
+
return Number(value);
|
|
76
|
+
case "date":
|
|
77
|
+
return new Date(value).getTime();
|
|
78
|
+
case "string":
|
|
79
|
+
return `"${value}"`;
|
|
80
|
+
default:
|
|
81
|
+
throw new Error(`数据类型解析错误: ${dataType}`);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
static evaluateExpression(expression) {
|
|
85
|
+
try {
|
|
86
|
+
return eval(expression);
|
|
87
|
+
} catch (error) {
|
|
88
|
+
console.error("表达式错误:", expression, error);
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
function getSummaryTitleColumn(configure) {
|
|
94
|
+
const result = {};
|
|
95
|
+
if (configure.props.summaries.titleColumn && configure.props.summaries.titleColumn.length > 0) {
|
|
96
|
+
configure.props.summaries.titleColumn.forEach((item) => {
|
|
97
|
+
result[item.prop] = item;
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
return result;
|
|
101
|
+
}
|
|
102
|
+
function getSummaryDataColumn(configure, type) {
|
|
103
|
+
const result = {};
|
|
104
|
+
if (configure.props.summaries.dataColumn && configure.props.summaries.dataColumn.length > 0) {
|
|
105
|
+
configure.props.summaries.dataColumn.forEach((item) => {
|
|
106
|
+
var _a;
|
|
107
|
+
const columnConfigs = (_a = configure.items) == null ? void 0 : _a.find(
|
|
108
|
+
(columnItem) => item.prop === columnItem.props.base.prop
|
|
109
|
+
);
|
|
110
|
+
if (columnConfigs) {
|
|
111
|
+
if (type === "table" && columnConfigs.props.base.tableSummary) {
|
|
112
|
+
result[item.prop] = item;
|
|
113
|
+
} else if (type === "group" && columnConfigs.props.base.groupSummary) {
|
|
114
|
+
result[item.prop] = item;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
return result;
|
|
120
|
+
}
|
|
121
|
+
function summaryStatistics(summaryColumn, data, prop, pageContext) {
|
|
122
|
+
let sumsIndex = "";
|
|
123
|
+
const summaryMode = summaryColumn.summaryMode;
|
|
124
|
+
const values = data.map((item) => Number(item[prop])).filter((value) => !Number.isNaN(value));
|
|
125
|
+
if (values.length > 0) {
|
|
126
|
+
if (summaryMode === "custom") {
|
|
127
|
+
const func = getCustomFunc(pageContext, summaryColumn.customFunc);
|
|
128
|
+
if (func) {
|
|
129
|
+
const resultValue = func.apply(func, [{ data, prop }]);
|
|
130
|
+
if (resultValue) {
|
|
131
|
+
sumsIndex = ` ${resultValue}`;
|
|
132
|
+
} else {
|
|
133
|
+
sumsIndex = " N/A";
|
|
134
|
+
}
|
|
135
|
+
} else {
|
|
136
|
+
sumsIndex = " N/A";
|
|
137
|
+
}
|
|
138
|
+
} else {
|
|
139
|
+
switch (summaryMode) {
|
|
140
|
+
case "sum":
|
|
141
|
+
sumsIndex = ` ${values.reduce((prev, curr) => prev + curr, 0)}`;
|
|
142
|
+
break;
|
|
143
|
+
case "avg":
|
|
144
|
+
sumsIndex = ` ${values.reduce((prev, curr) => prev + curr, 0) / values.length}`;
|
|
145
|
+
break;
|
|
146
|
+
case "min":
|
|
147
|
+
sumsIndex = ` ${Math.min(...values)}`;
|
|
148
|
+
break;
|
|
149
|
+
case "max":
|
|
150
|
+
sumsIndex = ` ${Math.max(...values)}`;
|
|
151
|
+
break;
|
|
152
|
+
default:
|
|
153
|
+
sumsIndex = " N/A";
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
} else {
|
|
157
|
+
sumsIndex = " N/A";
|
|
158
|
+
}
|
|
159
|
+
return sumsIndex;
|
|
160
|
+
}
|
|
161
|
+
function replacePlaceholders(template, data) {
|
|
162
|
+
if (template) {
|
|
163
|
+
return template.replace(/\$\{row\.(\w+)\}/g, (match, p1) => {
|
|
164
|
+
return Object.prototype.hasOwnProperty.call(data, p1) ? data[p1] : "";
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
function getHeaderCellStyleUtil(data, runtimeStyle, props) {
|
|
169
|
+
var _a;
|
|
170
|
+
const headerStyle = {};
|
|
171
|
+
if (data.column.property) {
|
|
172
|
+
(_a = runtimeStyle.titleStyle) == null ? void 0 : _a.forEach((item) => {
|
|
173
|
+
if (item.field && item.field.includes(data.column.property)) {
|
|
174
|
+
if (item.scopeFunc) {
|
|
175
|
+
const func = getCustomFunc(props.pageContext, item.scopeFunc);
|
|
176
|
+
if (func) {
|
|
177
|
+
const funcResult = func.apply(func, [{ item, data }]);
|
|
178
|
+
if (funcResult !== false) {
|
|
179
|
+
copyStyle(headerStyle, item);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
} else {
|
|
183
|
+
copyStyle(headerStyle, item);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
const cellTitleStytle = getCellStyleUtil(data, runtimeStyle.cellTitleStyle, props);
|
|
189
|
+
if (cellTitleStytle) {
|
|
190
|
+
Object.assign(headerStyle, cellTitleStytle);
|
|
191
|
+
}
|
|
192
|
+
return headerStyle;
|
|
193
|
+
}
|
|
194
|
+
function getRowStyleUtil(data, groupSummaryDataRowIndex, props) {
|
|
195
|
+
const returnStyle = {};
|
|
196
|
+
if (props.configure.style.rowStyle) {
|
|
197
|
+
for (let i = 0; i < props.configure.style.rowStyle.length; i++) {
|
|
198
|
+
const rowStyle = props.configure.style.rowStyle[i];
|
|
199
|
+
debugger;
|
|
200
|
+
if (rowStyle.scopeFunc) {
|
|
201
|
+
const func = getCustomFunc(props.pageContext, rowStyle.scopeFunc);
|
|
202
|
+
if (func) {
|
|
203
|
+
const funcResult = func.apply(func, [{ data }]);
|
|
204
|
+
if (funcResult !== void 0 && funcResult !== null && funcResult !== false) {
|
|
205
|
+
copyStyle(returnStyle, rowStyle);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
} else if (rowStyle.matchingCondition) {
|
|
209
|
+
const result = ExpressionEvaluator.evaluate(
|
|
210
|
+
props.pageContext,
|
|
211
|
+
rowStyle.matchingCondition,
|
|
212
|
+
data.row
|
|
213
|
+
);
|
|
214
|
+
if (result || result === void 0) {
|
|
215
|
+
copyStyle(returnStyle, rowStyle);
|
|
216
|
+
}
|
|
217
|
+
} else {
|
|
218
|
+
copyStyle(returnStyle, rowStyle);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
if (groupSummaryDataRowIndex && groupSummaryDataRowIndex.length > 0 && groupSummaryDataRowIndex.indexOf(data.rowIndex) !== -1) {
|
|
223
|
+
const result = {};
|
|
224
|
+
if (props.configure.style.collectStyle && props.configure.style.collectStyle.length > 0) {
|
|
225
|
+
for (let i = 0; i < props.configure.style.collectStyle.length; i++) {
|
|
226
|
+
const collectStyle = props.configure.style.collectStyle[i];
|
|
227
|
+
copyStyle(result, collectStyle);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
if (Object.keys(result).length === 0) {
|
|
231
|
+
result["background-color"] = "var(--el-table-row-hover-bg-color)";
|
|
232
|
+
}
|
|
233
|
+
return result;
|
|
234
|
+
}
|
|
235
|
+
return returnStyle;
|
|
236
|
+
}
|
|
237
|
+
function getCellStyleUtil(data, cellStyles, props) {
|
|
238
|
+
const cellStyle = {};
|
|
239
|
+
if (cellStyles) {
|
|
240
|
+
for (let i = 0; i < cellStyles.length; i++) {
|
|
241
|
+
const columnsStyleSetting = cellStyles[i];
|
|
242
|
+
if (columnsStyleSetting.scopeFunc) {
|
|
243
|
+
const func = getCustomFunc(props.pageContext, columnsStyleSetting.scopeFunc);
|
|
244
|
+
if (func) {
|
|
245
|
+
const funcResult = func.apply(func, [{ data }]);
|
|
246
|
+
if (funcResult !== false) {
|
|
247
|
+
copyStyle(cellStyle, columnsStyleSetting);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
} else if (columnsStyleSetting.matchingCondition) {
|
|
251
|
+
const result = ExpressionEvaluator.evaluate(
|
|
252
|
+
props.pageContext,
|
|
253
|
+
columnsStyleSetting.matchingCondition,
|
|
254
|
+
data.row
|
|
255
|
+
);
|
|
256
|
+
if (result || result === void 0) {
|
|
257
|
+
copyStyle(cellStyle, columnsStyleSetting);
|
|
258
|
+
}
|
|
259
|
+
} else {
|
|
260
|
+
copyStyle(cellStyle, columnsStyleSetting);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
return cellStyle;
|
|
265
|
+
}
|
|
266
|
+
function copyStyle(target, source) {
|
|
267
|
+
Object.assign(target, source.style);
|
|
268
|
+
if (source.customStyle) {
|
|
269
|
+
Object.assign(target, JSON.parse(source.customStyle));
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
function rowDataToColumn(data, configure) {
|
|
273
|
+
const groupByFields = configure.props.dataOrigin.groupField;
|
|
274
|
+
const titleColumns = configure.props.dataOrigin.rowToColumn.titleColumns;
|
|
275
|
+
const dataColumns = configure.props.dataOrigin.rowToColumn.dataColumns;
|
|
276
|
+
const result = [];
|
|
277
|
+
const groupedData = {};
|
|
278
|
+
data.forEach((item) => {
|
|
279
|
+
const key = groupByFields.map((field) => item[field]).join("|");
|
|
280
|
+
if (!groupedData[key]) {
|
|
281
|
+
const group = {};
|
|
282
|
+
groupByFields.forEach((field) => group[field] = item[field]);
|
|
283
|
+
groupedData[key] = group;
|
|
284
|
+
result.push(group);
|
|
285
|
+
}
|
|
286
|
+
dataColumns.forEach((valueField) => {
|
|
287
|
+
const columnNameParts = titleColumns.map((field) => item[field]);
|
|
288
|
+
const columnName = `${columnNameParts.join("")}${valueField}`;
|
|
289
|
+
groupedData[key][columnName] = item[valueField];
|
|
290
|
+
});
|
|
291
|
+
});
|
|
292
|
+
return result;
|
|
293
|
+
}
|
|
294
|
+
function colDataToRow(data, configure) {
|
|
295
|
+
const groupByFields = configure.props.dataOrigin.groupField;
|
|
296
|
+
const titleColumns = configure.props.dataOrigin.columnToRow.titleColumns;
|
|
297
|
+
const dataColumns = configure.props.dataOrigin.columnToRow.dataColumns;
|
|
298
|
+
const transColumns = configure.props.dataOrigin.columnToRow.transColumns;
|
|
299
|
+
const dataColumnsMapping = configure.props.dataOrigin.columnToRow.dataColumnsMapping;
|
|
300
|
+
if (data.length === 0) {
|
|
301
|
+
return data;
|
|
302
|
+
}
|
|
303
|
+
const result = [];
|
|
304
|
+
const newData = groupBy(data, groupByFields);
|
|
305
|
+
const dataColumnsConfig = dataColumns.reduce((max, current) => {
|
|
306
|
+
return current.columns.length > max.columns.length ? current : max;
|
|
307
|
+
}, dataColumns[0]);
|
|
308
|
+
const dataColumnsAndNewColumnMapping = dataColumns.reduce((acc, item) => {
|
|
309
|
+
item.columns.forEach((column) => {
|
|
310
|
+
acc[column] = item.prop;
|
|
311
|
+
});
|
|
312
|
+
return acc;
|
|
313
|
+
}, {});
|
|
314
|
+
newData.forEach((item) => {
|
|
315
|
+
dataColumnsConfig.columns.forEach((col) => {
|
|
316
|
+
const newColumnsProp = dataColumnsConfig.prop;
|
|
317
|
+
const dataRow = {};
|
|
318
|
+
groupByFields.forEach((field) => {
|
|
319
|
+
dataRow[field] = item[field];
|
|
320
|
+
});
|
|
321
|
+
dataRow[newColumnsProp] = item[col];
|
|
322
|
+
if (dataColumns.length > 1) {
|
|
323
|
+
const columnMapping = dataColumnsMapping.find((item2) => item2.props.includes(col));
|
|
324
|
+
if (columnMapping && columnMapping.props.length > 1) {
|
|
325
|
+
columnMapping.props.forEach((prop) => {
|
|
326
|
+
if (prop !== col && dataColumnsAndNewColumnMapping[prop]) {
|
|
327
|
+
dataRow[dataColumnsAndNewColumnMapping[prop]] = item[prop];
|
|
328
|
+
}
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
titleColumns.forEach((titleCol) => {
|
|
333
|
+
const sourceTitleRenameConfigs = transColumns.filter(
|
|
334
|
+
(transCol) => transCol.relatedTitle === titleCol.prop
|
|
335
|
+
);
|
|
336
|
+
let rename = false;
|
|
337
|
+
if (sourceTitleRenameConfigs && sourceTitleRenameConfigs.length > 0) {
|
|
338
|
+
sourceTitleRenameConfigs.forEach((item2) => {
|
|
339
|
+
if (item2.columns.includes(col)) {
|
|
340
|
+
dataRow[titleCol.prop] = item2.label;
|
|
341
|
+
rename = true;
|
|
342
|
+
return;
|
|
343
|
+
}
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
if (!rename) {
|
|
347
|
+
dataRow[titleCol.prop] = col;
|
|
348
|
+
}
|
|
349
|
+
});
|
|
350
|
+
result.push(dataRow);
|
|
351
|
+
});
|
|
352
|
+
});
|
|
353
|
+
return result;
|
|
354
|
+
}
|
|
355
|
+
function getColumnToRowTableConfig(configure) {
|
|
356
|
+
const sourceConfig = configure.items;
|
|
357
|
+
const groupField = configure.props.dataOrigin.groupField;
|
|
358
|
+
const titleColumns = configure.props.dataOrigin.columnToRow.titleColumns;
|
|
359
|
+
const dataColumns = configure.props.dataOrigin.columnToRow.dataColumns;
|
|
360
|
+
const newTableColumns = [];
|
|
361
|
+
groupField.forEach((field) => {
|
|
362
|
+
if (sourceConfig) {
|
|
363
|
+
const column = sourceConfig.find((item) => item.props.base.prop === field);
|
|
364
|
+
if (column) {
|
|
365
|
+
newTableColumns.push(column);
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
});
|
|
369
|
+
const newCols = [...titleColumns, ...dataColumns];
|
|
370
|
+
newCols.forEach((field) => {
|
|
371
|
+
if (sourceConfig) {
|
|
372
|
+
const column = sourceConfig.find((item) => item.props.base.prop === field);
|
|
373
|
+
if (column) {
|
|
374
|
+
newTableColumns.push(column);
|
|
375
|
+
} else {
|
|
376
|
+
newTableColumns.push({
|
|
377
|
+
uuid: (/* @__PURE__ */ new Date()).getTime(),
|
|
378
|
+
// 生成新的UUID
|
|
379
|
+
name: "",
|
|
380
|
+
props: {
|
|
381
|
+
base: {
|
|
382
|
+
prop: field.prop,
|
|
383
|
+
name: field.title,
|
|
384
|
+
sortable: true,
|
|
385
|
+
headerAlign: "center",
|
|
386
|
+
align: "center",
|
|
387
|
+
fixed: false,
|
|
388
|
+
visible: true,
|
|
389
|
+
dataType: "string"
|
|
390
|
+
},
|
|
391
|
+
format: {},
|
|
392
|
+
size: {
|
|
393
|
+
pc: {}
|
|
394
|
+
}
|
|
395
|
+
},
|
|
396
|
+
style: {},
|
|
397
|
+
componentIndex: 0,
|
|
398
|
+
// 根据实际情况设置
|
|
399
|
+
runtime: {
|
|
400
|
+
common: {
|
|
401
|
+
class: "",
|
|
402
|
+
style: {
|
|
403
|
+
pc_style: {},
|
|
404
|
+
pc_class: ""
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
});
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
});
|
|
412
|
+
return newTableColumns;
|
|
413
|
+
}
|
|
414
|
+
function groupBy(data, groupFields) {
|
|
415
|
+
const grouped = {};
|
|
416
|
+
data.forEach((item) => {
|
|
417
|
+
const key = groupFields.map((field) => item[field]).join("|");
|
|
418
|
+
if (!grouped[key]) {
|
|
419
|
+
grouped[key] = {
|
|
420
|
+
...item,
|
|
421
|
+
// 复制所有字段
|
|
422
|
+
records: []
|
|
423
|
+
// 初始化记录数组
|
|
424
|
+
};
|
|
425
|
+
groupFields.forEach((field, index) => {
|
|
426
|
+
grouped[key][field] = item[field];
|
|
427
|
+
});
|
|
428
|
+
}
|
|
429
|
+
grouped[key].records.push(item);
|
|
430
|
+
});
|
|
431
|
+
return Object.values(grouped).map((group) => ({
|
|
432
|
+
...group,
|
|
433
|
+
// 复制所有分组信息
|
|
434
|
+
records: void 0
|
|
435
|
+
// 移除records字段,因为不需要展示
|
|
436
|
+
}));
|
|
437
|
+
}
|
|
438
|
+
function getIndexColumn() {
|
|
439
|
+
return {
|
|
440
|
+
props: {
|
|
441
|
+
base: {
|
|
442
|
+
name: "序号",
|
|
443
|
+
prop: "$index",
|
|
444
|
+
columnWidth: 80,
|
|
445
|
+
sortable: true,
|
|
446
|
+
visible: true,
|
|
447
|
+
displayOrder: 1,
|
|
448
|
+
alignTitle: "center",
|
|
449
|
+
alignContent: "center"
|
|
450
|
+
}
|
|
451
|
+
},
|
|
452
|
+
events: [],
|
|
453
|
+
style: {
|
|
454
|
+
titleFont: {},
|
|
455
|
+
contentFont: {},
|
|
456
|
+
width: {},
|
|
457
|
+
background: {},
|
|
458
|
+
tableCell: [{ type: "", model: "" }],
|
|
459
|
+
conentPadding: {},
|
|
460
|
+
tittlePadding: {},
|
|
461
|
+
border: {},
|
|
462
|
+
shadow: {},
|
|
463
|
+
tittleClass: ""
|
|
464
|
+
}
|
|
465
|
+
};
|
|
466
|
+
}
|
|
467
|
+
export {
|
|
468
|
+
ExpressionEvaluator,
|
|
469
|
+
colDataToRow,
|
|
470
|
+
getCellStyleUtil,
|
|
471
|
+
getColumnToRowTableConfig,
|
|
472
|
+
getHeaderCellStyleUtil,
|
|
473
|
+
getIndexColumn,
|
|
474
|
+
getRowStyleUtil,
|
|
475
|
+
getSummaryDataColumn,
|
|
476
|
+
getSummaryTitleColumn,
|
|
477
|
+
replacePlaceholders,
|
|
478
|
+
rowDataToColumn,
|
|
479
|
+
summaryStatistics
|
|
480
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { defineComponent, openBlock, createBlock } from "vue";
|
|
2
|
+
import _sfc_main$1 from "./group-column.vue.js";
|
|
3
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
4
|
+
__name: "group-column-item",
|
|
5
|
+
props: {
|
|
6
|
+
configure: {
|
|
7
|
+
type: Object,
|
|
8
|
+
default: () => {
|
|
9
|
+
return {};
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
pageContext: {
|
|
13
|
+
type: Object,
|
|
14
|
+
default: () => {
|
|
15
|
+
return {};
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
groupColumnItem: {
|
|
19
|
+
type: Object,
|
|
20
|
+
default: () => {
|
|
21
|
+
return {};
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
columnsConfigKeyValues: {
|
|
25
|
+
type: Object,
|
|
26
|
+
default: () => {
|
|
27
|
+
return {};
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
setup(__props) {
|
|
32
|
+
return (_ctx, _cache) => {
|
|
33
|
+
return openBlock(), createBlock(_sfc_main$1, {
|
|
34
|
+
configure: __props.configure,
|
|
35
|
+
pageContext: __props.pageContext,
|
|
36
|
+
groupColumn: __props.groupColumnItem,
|
|
37
|
+
columnsConfigKeyValues: __props.columnsConfigKeyValues
|
|
38
|
+
}, null, 8, ["configure", "pageContext", "groupColumn", "columnsConfigKeyValues"]);
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
export {
|
|
43
|
+
_sfc_main as default
|
|
44
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { defineComponent, resolveComponent, openBlock, createBlock, withCtx, createTextVNode, toDisplayString, createElementBlock, Fragment, renderList, createCommentVNode } from "vue";
|
|
2
|
+
import _sfc_main$2 from "./normal-column.vue.js";
|
|
3
|
+
import _sfc_main$1 from "./group-column-item.vue.js";
|
|
4
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
5
|
+
__name: "group-column",
|
|
6
|
+
props: {
|
|
7
|
+
configure: {
|
|
8
|
+
type: Object,
|
|
9
|
+
default: () => {
|
|
10
|
+
return {};
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
pageContext: {
|
|
14
|
+
type: Object,
|
|
15
|
+
default: () => {
|
|
16
|
+
return {};
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
groupColumn: {
|
|
20
|
+
type: Object,
|
|
21
|
+
default: () => {
|
|
22
|
+
return {};
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
columnsConfigKeyValues: {
|
|
26
|
+
type: Object,
|
|
27
|
+
default: () => {
|
|
28
|
+
return {};
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
setup(__props) {
|
|
33
|
+
return (_ctx, _cache) => {
|
|
34
|
+
const _component_el_table_column = resolveComponent("el-table-column");
|
|
35
|
+
return openBlock(), createBlock(_component_el_table_column, { "header-align": "center" }, {
|
|
36
|
+
header: withCtx(() => [
|
|
37
|
+
createTextVNode(toDisplayString(__props.groupColumn.titleText), 1)
|
|
38
|
+
]),
|
|
39
|
+
default: withCtx(() => [
|
|
40
|
+
__props.groupColumn.children && __props.groupColumn.children.length > 0 ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(__props.groupColumn.children, (item, index) => {
|
|
41
|
+
return openBlock(), createElementBlock(Fragment, { key: index }, [
|
|
42
|
+
item.children && item.children.length > 0 ? (openBlock(), createBlock(_sfc_main$1, {
|
|
43
|
+
key: index,
|
|
44
|
+
configure: __props.configure,
|
|
45
|
+
pageContext: __props.pageContext,
|
|
46
|
+
groupColumnItem: item,
|
|
47
|
+
columnsConfigKeyValues: __props.columnsConfigKeyValues
|
|
48
|
+
}, null, 8, ["configure", "pageContext", "groupColumnItem", "columnsConfigKeyValues"])) : (openBlock(), createBlock(_sfc_main$2, {
|
|
49
|
+
key: 1,
|
|
50
|
+
pageContext: __props.pageContext,
|
|
51
|
+
configure: __props.configure,
|
|
52
|
+
column: __props.columnsConfigKeyValues[item.columnUuid]
|
|
53
|
+
}, null, 8, ["pageContext", "configure", "column"]))
|
|
54
|
+
], 64);
|
|
55
|
+
}), 128)) : createCommentVNode("", true)
|
|
56
|
+
]),
|
|
57
|
+
_: 1
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
export {
|
|
63
|
+
_sfc_main as default
|
|
64
|
+
};
|