adtec-core-package 2.8.8 → 2.8.9
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/utils/FrameworkUtils.ts +27 -10
package/package.json
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import elTableTool from '../components/Table/ElTableTool.ts'
|
|
2
2
|
import { ElMessage } from 'element-plus'
|
|
3
3
|
import * as XLSX from 'xlsx-js-style'
|
|
4
|
-
import { Linq } from 'linq-to-ts'
|
|
5
4
|
import Base64 from 'crypto-js/enc-base64'
|
|
6
5
|
import Utf8 from 'crypto-js/enc-utf8'
|
|
7
6
|
/**
|
|
@@ -219,27 +218,45 @@ export default {
|
|
|
219
218
|
//row单元格合并
|
|
220
219
|
if (rowMerges) {
|
|
221
220
|
rowMerges.forEach((m: any) => {
|
|
222
|
-
const groupList =
|
|
221
|
+
const groupList = groupBy(data1, (r: any) => {
|
|
223
222
|
const obj: any = {}
|
|
224
223
|
m.conditions.forEach((c: any) => {
|
|
225
224
|
obj[c] = r[c]
|
|
226
225
|
})
|
|
227
|
-
return obj
|
|
226
|
+
return JSON.stringify(obj)
|
|
228
227
|
})
|
|
229
|
-
|
|
230
|
-
groupList.forEach((c: any) => {
|
|
228
|
+
|
|
229
|
+
Object.values(groupList).forEach((c: any) => {
|
|
231
230
|
m.fields.forEach((m1: any) => {
|
|
232
|
-
const cIndex = dataColumns.
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
231
|
+
const cIndex = dataColumns.findIndex((col) => col.property === m1)
|
|
232
|
+
if (cIndex === -1) return
|
|
233
|
+
|
|
234
|
+
const orderNums = c.elements.map((item: any) => item._orderNum)
|
|
235
|
+
const minOrderNum = orderNums.length ? Math.min(...orderNums) : 0
|
|
236
|
+
const maxOrderNum = orderNums.length ? Math.max(...orderNums) : 0
|
|
237
|
+
|
|
237
238
|
merges.push({
|
|
238
239
|
s: { c: cIndex, r: minOrderNum },
|
|
239
240
|
e: { c: cIndex, r: maxOrderNum },
|
|
240
241
|
})
|
|
241
242
|
})
|
|
242
243
|
})
|
|
244
|
+
function groupBy<T>(
|
|
245
|
+
array: T[],
|
|
246
|
+
getKey: (item: T) => string,
|
|
247
|
+
): Record<string, { elements: T[] }> {
|
|
248
|
+
return array.reduce(
|
|
249
|
+
(groups, item) => {
|
|
250
|
+
const key = getKey(item)
|
|
251
|
+
if (!groups[key]) {
|
|
252
|
+
groups[key] = { elements: [] }
|
|
253
|
+
}
|
|
254
|
+
groups[key].elements.push(item)
|
|
255
|
+
return groups
|
|
256
|
+
},
|
|
257
|
+
{} as Record<string, { elements: T[] }>,
|
|
258
|
+
)
|
|
259
|
+
}
|
|
243
260
|
})
|
|
244
261
|
}
|
|
245
262
|
data1?.forEach((r: any) => {
|