diff --git a/src/jmapNew/theme/components/utils/menuJudge.js b/src/jmapNew/theme/components/utils/menuJudge.js index eec67f809..23ca52bb2 100644 --- a/src/jmapNew/theme/components/utils/menuJudge.js +++ b/src/jmapNew/theme/components/utils/menuJudge.js @@ -14,23 +14,21 @@ export function judgeStationControl( const centralStation = store.getters["map/getDeviceByCode"]( centralStationCode ); + const isCenterMode = centralStation.controlMode === "Center"; + const isLocalMode = + centralStation.controlMode === "Local" || + centralStation.controlMode === "Emergency"; // 角色车站是 设备所属车站或所属集中站 if (work === "localWork") { - const flag1 = - centralStation.controlMode === "Center" && - isAvailableInOtherControlMode; - const flag2 = + const isBelongingStation = store.state.training.roleDeviceCode === stationCode || store.state.training.roleDeviceCode === centralStationCode; - return flag1 && flag2; - } else if (work === "dispatchWork") { - const flag1 = - centralStation.controlMode === "Local" || - centralStation.controlMode === "Emergency"; return ( - centralStation.controlMode === "Center" || - (flag1 && isAvailableInOtherControlMode) + ((isCenterMode && isAvailableInOtherControlMode) || isLocalMode) && + isBelongingStation ); + } else if (work === "dispatchWork") { + return isCenterMode || (isLocalMode && isAvailableInOtherControlMode); } else { return true; }