sortChangefirst(column){
//不參與排序的數組
// if (this.$refs.table) this.$refs.table.clearSort()
let freeGood = []
// //參與排序的數組
let elseFree = []
// //fieldName 為對應列的prop
let fieldName = column.prop
let sortingType = column.order
// //降序
if (sortingType === "descending"){
this.newTabledata.forEach(item => {
//在整個tableData中找到不參與排序的所有數據
if (item.keyStatus===1) {
//不參與排序的所有數據加到數組中
freeGood.push(item)
}
else {
//參與排序的數據
elseFree.push(item)
}
})
//進行排序
this.newTabledata = elseFree.sort((a, b) => parseFloat(b[fieldName]) - parseFloat(a[fieldName]))
//如果要排序字符串
//可以對fieldName進行判斷進行如下操作
//this.tableData = elseFree.sort((a, b) => b[fieldName].localeCompare(a[fieldName]))
}else{
this.newTabledata.forEach(item => {
if (item.keyStatus===1) {
freeGood.push(item)
}else {
elseFree.push(item)
}
})
this.newTabledata = elseFree.sort((a, b) => parseFloat(a[fieldName]) - parseFloat(b[fieldName]))
}
this.newTabledata=freeGood.concat(this.newTabledata)
},