ip地址排序
将ip为空的排在前面或后面 将ip有数字由大到小排序
let tableData = [{ip:1.2.3.4},{ip:2.3.4.5},{ip:3.4.5.6},{ip:''}]
tableData.sort((a, b) => {
return funTime.ipToNumber(a.ip) - funTime.ipToNumber(b.ip);
})
ipToNumber(ip) {
return ip.split('.').reduce((acc, octet, index) => {
return (acc + (octet << (8 * (3 - index)) >>> 0))
}, 0);
}