// 先按deviceState分組,然后每個(gè)分組中在按workProgress排序
arr.sort((a, b) => {
if (a.deviceState === b.deviceState) {
return a.workProgress === null
? 1
: b.workProgress === null
? -1
: Number(a.workProgress) > Number(b.workProgress)
? -1
: 1
} else {
return map[a.deviceState] - map[b.deviceState]
}
})
先按deviceState分組橄登,然后每個(gè)分組中再按workProgress排序(null值過濾出來)