适用于element-ui table
/**
* 表格某一行上移
* @param {Array} tableData 当前表格数据
* @param {Object} currRow 当前行数据
* @param currRowIndex 当前行索引
*/
function tableDataUp(tableData, currRow, currRowIndex){
if (currRowIndex > 0) {
let upData = tableData[currRowIndex - 1];
tableData.splice(currRowIndex- 1, 1);
tableData.splice(currRowIndex,0, upData);
}
}
/**
* 表格某一行下移
* @param {Array} tableData 当前表格数据
* @param {Object} currRow 当前行数据
* @param currRowIndex 当前行索引
* */
function tableDataDown(tableData, currRow, currRowIndex){
if (currRowIndex.index !== tableData.length-1){
let downData = tableData[currRowIndex+ 1];
tableData.splice(currRowIndex + 1, 1);
tableData.splice(currRowIndex,0, downData);
}
}