SOURCE

let data = [
    {
        jkb: '',
        code: '1',
        flag: '',
        passTime: '2022-03-30 17:19:22',
        hs: '',
        message: ' 认证失败 36.4℃',
        userName: '',
        userId: '1',
        mach_id: '118F010T00200031',
        passPosition: '',
        ym: '',
        temperature: 3640,
        company: '公司1',
    },
    {
        jkb: '',
        code: '1',
        flag: '',
        passTime: '2022-03-30 17:19:12',
        hs: '',
        message: ' 认证失败 36.0℃',
        userName: '',
        userId: '1',
        mach_id: '118F010T00200031',
        passPosition: '',
        ym: '',
        temperature: 3600,
        company: '公司5',
    },
    {
        jkb: '',
        code: '1',
        flag: '',
        passTime: '2022-03-27 17:18:30',
        hs: '',
        message: ' 认证失败 36.4℃',
        userName: '',
        userId: '1',
        mach_id: '118F010T00200031',
        passPosition: '',
        ym: '',
        temperature: 3640,
        company: '公司4',
    },
    {
        jkb: '',
        code: '1',
        flag: '',
        passTime: '2022-03-36 17:16:24',
        hs: '',
        message: ' 认证失败 36.1℃',
        userName: '',
        userId: '1',
        mach_id: '118F010T00200031',
        passPosition: '',
        ym: '',
        temperature: 3610,
        company: '公司4',
    },
    {
        jkb: '',
        code: '1',
        flag: '',
        passTime: '2022-03-30 17:16:20',
        hs: '',
        message: ' 认证失败 36.4℃',
        userName: '',
        userId: '88',
        mach_id: '118F010T00200031',
        passPosition: '',
        ym: '',
        temperature: 3640,
        company: '公司3',
    },
    {
        jkb: '',
        code: '1',
        flag: '',
        passTime: '2022-03-30 17:15:48',
        hs: '',
        message: ' 认证失败 36.0℃',
        userName: '',
        userId: '3',
        mach_id: '118F010T00200031',
        passPosition: '',
        ym: '',
        temperature: 3600,
        company: '公司3',
    },
    {
        jkb: '',
        code: '1',
        flag: '',
        passTime: '2022-03-30 17:15:42',
        hs: '',
        message: ' 认证失败 36.4℃',
        userName: '',
        userId: '5',
        mach_id: '118F010T00200031',
        passPosition: '',
        ym: '',
        temperature: 3640,
        company: '公司3',
    },
    {
        jkb: '',
        code: '1',
        flag: '',
        passTime: '2022-03-30 17:15:19',
        hs: '',
        message: ' 认证失败 36.8℃',
        userName: '',
        userId: '6',
        mach_id: '118F010T00200031',
        passPosition: '',
        ym: '',
        temperature: 3680,
        company: '公司2',
    },
    {
        jkb: '',
        code: '1',
        flag: '',
        passTime: '2022-03-30 17:11:17',
        hs: '',
        message: ' 认证失败 36.2℃',
        userName: '',
        userId: '7',
        mach_id: '118F010T00200031',
        passPosition: '',
        ym: '',
        temperature: 3620,
        company: '公司1',
    },
    {
        jkb: '',
        code: '1',
        flag: '',
        passTime: '2022-03-30 17:11:07',
        hs: '',
        message: ' 认证失败 36.7℃',
        userName: '',
        userId: '8',
        mach_id: '118F010T00200031',
        passPosition: '',
        ym: '',
        temperature: 3670,
        company: '公司1',
    },
]

  var obj = {}
  let arr = data.reduce(function (item, next) {
    obj[next.userId] ? '' : (obj[next.userId] = true && item.push(next))
    return item
  }, [])
  console.log(arr)
img{
    display: block
}
console 命令行工具 X clear

                    
>
console