|
|
@@ -950,12 +950,25 @@ export default {
|
|
|
},
|
|
|
// 定义一个排序函数,根据 orderTableData 中 pointName 的顺序对 tableData 进行排序
|
|
|
sortTableDataByOrder(tableData, orderTableData) {
|
|
|
- const orderMap = new Map(orderTableData.map((item, index) => [item.pointName, index]));
|
|
|
+ // 构建 orderMap,使用 pointId 作为键,索引作为值
|
|
|
+ const orderMap = new Map(orderTableData.map((item, index) => [item.pointId, index]));
|
|
|
|
|
|
return tableData.sort((a, b) => {
|
|
|
- return (orderMap.get(a.pointName) || Infinity) - (orderMap.get(b.pointName) || Infinity);
|
|
|
+ // 如果 pointId 在 orderMap 中,按 orderMap 的索引排序
|
|
|
+ // 如果 pointId 不在 orderMap 中,排在最后,并按 pointId 的自然顺序排列
|
|
|
+ const indexA = orderMap.has(a.pointId) ? orderMap.get(a.pointId) : Infinity;
|
|
|
+ const indexB = orderMap.has(b.pointId) ? orderMap.get(b.pointId) : Infinity;
|
|
|
+
|
|
|
+ if (indexA === indexB) {
|
|
|
+ // 当两者都不在 orderMap 中时,按 pointId 的自然顺序排列
|
|
|
+ return a.pointId - b.pointId;
|
|
|
+ }
|
|
|
+
|
|
|
+ return indexA - indexB;
|
|
|
});
|
|
|
},
|
|
|
+
|
|
|
+
|
|
|
// 子组件选中的隔离点逆传递拿到的数据
|
|
|
handleSelectPoint(points) {
|
|
|
console.log(points, "父组件接收逆向传递选中的隔离点");
|