dictArraySort (dictArray, sortKey, sortType="ascending", isTime = false) {
if (!isTime) {
if (sortType == 'ascending') {
dictArray.sort(function (dictA, dictB) {
return dictA[sortKey] - dictB[sortKey]
})
}
if (sortType == 'descending') {
dictArray.sort(function (dictA, dictB) {
return dictB[sortKey] - dictA[sortKey]
})
}
} else {
// 如果是日期时间排序
if (sortType == 'ascending') {
dictArray.sort(function (dictA, dictB) {
return Date.parse(dictA[sortKey].replace(/-/g,"/"))-Date.parse(dictB[sortKey].replace(/-/g,"/"))
})
}
if (sortType == 'descending') {
dictArray.sort(function (dictA, dictB) {
return Date.parse(dictB[sortKey].replace(/-/g,"/"))-Date.parse(dictA[sortKey].replace(/-/g,"/"))
})
}
}
return dictArray
},