|
|
@@ -392,9 +392,20 @@ export default {
|
|
|
} catch (e) { /* ignore */ }
|
|
|
},
|
|
|
// 显示路口弹窗组(多选分屏)
|
|
|
- showCrossingDalogs(nodeData) {
|
|
|
+ async showCrossingDalogs(nodeData) {
|
|
|
console.log('路口多选', nodeData.id, nodeData.label);
|
|
|
|
|
|
+ // 0. 离线检查
|
|
|
+ const detailData = await apiGetCrossingDetailData(nodeData.id, { iconMode: 'simple' });
|
|
|
+ if (detailData?.intersectionData?.status !== '在线') {
|
|
|
+ this.$msg({
|
|
|
+ title: '提示',
|
|
|
+ message: `路口「${nodeData.label || nodeData.id}」设备离线,无法查看详情`,
|
|
|
+ duration: 3000,
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
// 1. 已选中 → 不重复操作
|
|
|
const existIndex = this.crossingSelections.findIndex(c => c.id === nodeData.id);
|
|
|
if (existIndex !== -1) {
|
|
|
@@ -406,8 +417,8 @@ export default {
|
|
|
this.crossingSelections.shift();
|
|
|
}
|
|
|
|
|
|
- // 3. 追加选中
|
|
|
- this.crossingSelections.push({ ...nodeData });
|
|
|
+ // 3. 追加选中,带上预加载数据避免重复请求
|
|
|
+ this.crossingSelections.push({ ...nodeData, _preloadedData: detailData });
|
|
|
|
|
|
// 4. 打开或更新弹窗
|
|
|
this.openCrossingMultiView();
|
|
|
@@ -453,6 +464,14 @@ export default {
|
|
|
async showCrossingDetailDialogs(nodeData) {
|
|
|
console.log('显示路口详情弹窗组', nodeData.id, nodeData.label);
|
|
|
const detailData = await apiGetCrossingDetailData(nodeData.id, { iconMode: 'simple' });
|
|
|
+ if (detailData?.intersectionData?.status !== '在线') {
|
|
|
+ this.$msg({
|
|
|
+ title: '提示',
|
|
|
+ message: `路口「${nodeData.label || nodeData.id}」设备离线,无法查看详情`,
|
|
|
+ duration: 3000,
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
const dialogId = 'crossing_detail' + nodeData.id;
|
|
|
this.$refs.layout.openDialog({
|
|
|
id: dialogId,
|
|
|
@@ -468,7 +487,7 @@ export default {
|
|
|
data: { ...nodeData, preloadedData: detailData },
|
|
|
headerComponent: 'CrossingDetailHeader',
|
|
|
headerProps: {
|
|
|
- currentRoute: detailData?.currentRoute || {},
|
|
|
+ currentRoute: { ...(detailData?.currentRoute || {}), name: nodeData.label || detailData?.currentRoute?.name },
|
|
|
intersectionData: detailData?.intersectionData || {},
|
|
|
cycleLength: detailData?.cycleLength || 0,
|
|
|
}
|