连续任务下发列表 取消连续任务 增加模式切换 方向盘手柄 加一个提示 切换模式控件 加一个高亮效果 任务监控界面 数据完善
This commit is contained in:
@@ -499,6 +499,50 @@ export function createRegionDefaultTask(params) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//下发连续任务
|
||||||
|
|
||||||
|
export function createConsecutiveTasks(data) {
|
||||||
|
return request({
|
||||||
|
url: '/iot/deviceTask/createConsecutiveTask',
|
||||||
|
method: 'post',
|
||||||
|
data,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
//取消连续任务/iot/deviceTask/cancelConsecutiveTask
|
||||||
|
|
||||||
|
export function cancelConsecutiveTask(data) {
|
||||||
|
return request({
|
||||||
|
url: '/iot/deviceTask/cancelConsecutiveTask ',
|
||||||
|
method: 'post',
|
||||||
|
data,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//连续任务记录
|
||||||
|
|
||||||
|
export function getConsecutiveTask(data) {
|
||||||
|
return request({
|
||||||
|
url: '/iot/deviceTask/getConsecutiveTask',
|
||||||
|
method: 'post',
|
||||||
|
data,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
///iot/host/modeChage 切换控制模式
|
||||||
|
|
||||||
|
export function modeChage(params) {
|
||||||
|
return request({
|
||||||
|
url: '/iot/host/modeChage',
|
||||||
|
method: 'get',
|
||||||
|
params,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -394,17 +394,17 @@ const CesiumMap = React.forwardRef(({ ifClear, ifClearPlanLine, ifClearNavLine,
|
|||||||
});
|
});
|
||||||
|
|
||||||
// 自动跳转到第一个障碍物
|
// 自动跳转到第一个障碍物
|
||||||
//if (firstPos) {
|
if (firstPos) {
|
||||||
// flyToView(viewer, 100, {
|
flyToView(viewer, 100, {
|
||||||
// destination: Cesium.Cartesian3.fromDegrees(firstPos.lon, firstPos.lat, 60),
|
destination: Cesium.Cartesian3.fromDegrees(firstPos.lon, firstPos.lat, 60),
|
||||||
// orientation: {
|
orientation: {
|
||||||
// heading: Cesium.Math.toRadians(0),
|
heading: Cesium.Math.toRadians(0),
|
||||||
// pitch: Cesium.Math.toRadians(-40),
|
pitch: Cesium.Math.toRadians(-40),
|
||||||
// roll: 0
|
roll: 0
|
||||||
// },
|
},
|
||||||
// duration: 2.0
|
duration: 2.0
|
||||||
// }, 'live-obstacle-jump');
|
}, 'live-obstacle-jump');
|
||||||
//}
|
}
|
||||||
viewer.scene.requestRender();
|
viewer.scene.requestRender();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,6 +39,14 @@ const KEY_MAP: Record<string, string> = {
|
|||||||
A: 'left',
|
A: 'left',
|
||||||
D: 'right',
|
D: 'right',
|
||||||
};
|
};
|
||||||
|
const KEY_LABELS: Record<string, string> = {
|
||||||
|
up: 'W/↑',
|
||||||
|
down: 'S/↓',
|
||||||
|
left: 'A/←',
|
||||||
|
right: 'D/→',
|
||||||
|
center: 'SPACE'
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
const DIRECTIONS = ['up', 'down', 'left', 'right'];
|
const DIRECTIONS = ['up', 'down', 'left', 'right'];
|
||||||
|
|
||||||
@@ -340,7 +348,7 @@ const DPadControl: React.FC<DPadControlProps> = ({
|
|||||||
type="button"
|
type="button"
|
||||||
aria-label={ariaLabel}
|
aria-label={ariaLabel}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
className={`${btnBase} ${pressed[key] ? btnActive : btnIdle
|
className={`${btnBase} relative ${pressed[key] ? btnActive : btnIdle
|
||||||
} ${disabled
|
} ${disabled
|
||||||
? 'opacity-40 cursor-not-allowed'
|
? 'opacity-40 cursor-not-allowed'
|
||||||
: 'cursor-pointer'
|
: 'cursor-pointer'
|
||||||
@@ -371,6 +379,9 @@ const DPadControl: React.FC<DPadControlProps> = ({
|
|||||||
onContextMenu={(e) => e.preventDefault()}
|
onContextMenu={(e) => e.preventDefault()}
|
||||||
>
|
>
|
||||||
{icon}
|
{icon}
|
||||||
|
<span className="absolute -top-4 -right+1 px-1 bg-slate-900/80 text-[8px] text-slate-400 rounded border border-slate-700 pointer-events-none group-hover:text-cyan-400 transition-colors">
|
||||||
|
{KEY_LABELS[key]}
|
||||||
|
</span>
|
||||||
</button>
|
</button>
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -379,7 +390,7 @@ const DPadControl: React.FC<DPadControlProps> = ({
|
|||||||
type="button"
|
type="button"
|
||||||
aria-label={t('devices.emergencyStop')}
|
aria-label={t('devices.emergencyStop')}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
className={`${btnBase} ${pressed.center
|
className={`${btnBase} relative ${pressed.center
|
||||||
? 'border-red-500 bg-red-500/40 text-white shadow-[0_0_16px_rgba(239,68,68,0.6)]'
|
? 'border-red-500 bg-red-500/40 text-white shadow-[0_0_16px_rgba(239,68,68,0.6)]'
|
||||||
: 'border-red-500/70 bg-red-500/10 text-red-400 hover:bg-red-500/20'
|
: 'border-red-500/70 bg-red-500/10 text-red-400 hover:bg-red-500/20'
|
||||||
} ${disabled
|
} ${disabled
|
||||||
@@ -389,6 +400,9 @@ const DPadControl: React.FC<DPadControlProps> = ({
|
|||||||
onClick={startEmergency}
|
onClick={startEmergency}
|
||||||
>
|
>
|
||||||
<ShieldAlert className="w-5 h-5" />
|
<ShieldAlert className="w-5 h-5" />
|
||||||
|
<span className="absolute -top-1 -right-1 px-1 bg-slate-900/80 text-[8px] text-red-400/80 rounded border border-red-500/30 pointer-events-none">
|
||||||
|
{KEY_LABELS.center}
|
||||||
|
</span>
|
||||||
</button>
|
</button>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1362,7 +1362,11 @@ export default function MapEditorPage() {
|
|||||||
options={[
|
options={[
|
||||||
{ value: 'MOWING_TASK', label: t('devices.mapEditor.typeMowing') },
|
{ value: 'MOWING_TASK', label: t('devices.mapEditor.typeMowing') },
|
||||||
{ value: 'INSPECTION_TASK', label: t('devices.mapEditor.typeInspection') },
|
{ value: 'INSPECTION_TASK', label: t('devices.mapEditor.typeInspection') },
|
||||||
|
//{ value: 'BACK_TO_REST_POINT', label: t('devices.mapEditor.typeBackToRest') },
|
||||||
|
|
||||||
{ value: 'OTHER', label: t('devices.mapEditor.typeOther') },
|
{ value: 'OTHER', label: t('devices.mapEditor.typeOther') },
|
||||||
|
// BACK_TO_REST_POINT("BACK_TO_REST_POINT", "返航任务"),
|
||||||
|
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -18,7 +18,8 @@ export type RobotFeature =
|
|||||||
| 'lowBatteryReturn'
|
| 'lowBatteryReturn'
|
||||||
| 'tiltProtection'
|
| 'tiltProtection'
|
||||||
| 'findCar'
|
| 'findCar'
|
||||||
| 'autoback';
|
| 'autoback'
|
||||||
|
| 'controlMode';
|
||||||
|
|
||||||
export interface FeatureConfig {
|
export interface FeatureConfig {
|
||||||
key: RobotFeature;
|
key: RobotFeature;
|
||||||
@@ -27,8 +28,10 @@ export interface FeatureConfig {
|
|||||||
inactiveColor: string;
|
inactiveColor: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 功能方块:方块样式展示,不再包含急停(急停已移至方向盘中键)
|
// 功能方块
|
||||||
const FEATURES: FeatureConfig[] = [
|
const FEATURES: FeatureConfig[] = [
|
||||||
|
{ key: 'controlMode', icon: <ShieldAlert className="w-6 h-6" />, activeColor: '#0dab2d', inactiveColor: '#94a3b8' },
|
||||||
|
|
||||||
{ key: 'obstacleAvoidance', icon: <Siren className="w-6 h-6" />, activeColor: '#3b82f6', inactiveColor: '#94a3b8' },
|
{ key: 'obstacleAvoidance', icon: <Siren className="w-6 h-6" />, activeColor: '#3b82f6', inactiveColor: '#94a3b8' },
|
||||||
{ key: 'lowBatteryReturn', icon: <BatteryWarning className="w-6 h-6" />, activeColor: '#f59e0b', inactiveColor: '#94a3b8' },
|
{ key: 'lowBatteryReturn', icon: <BatteryWarning className="w-6 h-6" />, activeColor: '#f59e0b', inactiveColor: '#94a3b8' },
|
||||||
{ key: 'tiltProtection', icon: <MoveVertical className="w-6 h-6" />, activeColor: '#10b981', inactiveColor: '#94a3b8' },
|
{ key: 'tiltProtection', icon: <MoveVertical className="w-6 h-6" />, activeColor: '#10b981', inactiveColor: '#94a3b8' },
|
||||||
@@ -36,7 +39,7 @@ const FEATURES: FeatureConfig[] = [
|
|||||||
{ key: 'findCar', icon: <ShieldAlert className="w-6 h-6" />, activeColor: '#ef4444', inactiveColor: '#94a3b8' },
|
{ key: 'findCar', icon: <ShieldAlert className="w-6 h-6" />, activeColor: '#ef4444', inactiveColor: '#94a3b8' },
|
||||||
];
|
];
|
||||||
|
|
||||||
// 急停方块(仅在 showEmergencyStop 时展示,兼容其他页面)
|
// 急停方块
|
||||||
const EMERGENCY: FeatureConfig = {
|
const EMERGENCY: FeatureConfig = {
|
||||||
key: 'emergencyStop',
|
key: 'emergencyStop',
|
||||||
icon: <ShieldAlert className="w-6 h-6" />,
|
icon: <ShieldAlert className="w-6 h-6" />,
|
||||||
@@ -49,8 +52,10 @@ interface RobotFeatureButtonsProps {
|
|||||||
onToggle?: (feature: RobotFeature, enabled: boolean) => void;
|
onToggle?: (feature: RobotFeature, enabled: boolean) => void;
|
||||||
className?: string;
|
className?: string;
|
||||||
showEmergencyStop?: boolean;
|
showEmergencyStop?: boolean;
|
||||||
sendFindCar: () => {};
|
sendFindCar?: () => void;
|
||||||
sendAutoBack?: () => {};
|
sendAutoBack?: () => void;
|
||||||
|
sendControlMode?: () => void;
|
||||||
|
controlMode?: number | string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const RobotFeatureButtons: React.FC<RobotFeatureButtonsProps> = ({
|
const RobotFeatureButtons: React.FC<RobotFeatureButtonsProps> = ({
|
||||||
@@ -59,28 +64,48 @@ const RobotFeatureButtons: React.FC<RobotFeatureButtonsProps> = ({
|
|||||||
className = '',
|
className = '',
|
||||||
showEmergencyStop = true,
|
showEmergencyStop = true,
|
||||||
sendFindCar,
|
sendFindCar,
|
||||||
sendAutoBack
|
sendAutoBack,
|
||||||
|
sendControlMode,
|
||||||
|
controlMode
|
||||||
}) => {
|
}) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { userInfo } = useSelector((state: RootState) => state.user);
|
const { userInfo } = useSelector((state: RootState) => state.user);
|
||||||
const [active, setActive] = useState<Set<RobotFeature>>(new Set(activeFeatures));
|
const [active, setActive] = useState<Set<RobotFeature>>(new Set(activeFeatures));
|
||||||
|
// 临时按压闪烁标记
|
||||||
|
const [flashKey, setFlashKey] = useState<RobotFeature | null>(null);
|
||||||
|
|
||||||
|
// 一次性触发,不toggle的按钮列表
|
||||||
|
const oneShotKeys: RobotFeature[] = ['emergencyStop', 'findCar', 'autoback', 'controlMode'];
|
||||||
|
|
||||||
const list = showEmergencyStop ? [EMERGENCY, ...FEATURES] : FEATURES;
|
const list = showEmergencyStop ? [EMERGENCY, ...FEATURES] : FEATURES;
|
||||||
|
|
||||||
const handleClick = (feature: RobotFeature) => {
|
const handleClick = (feature: RobotFeature) => {
|
||||||
// 急停:点击时直接下发 button7(绕过控制权限校验)
|
// 触发按压反馈
|
||||||
|
setFlashKey(feature);
|
||||||
|
setTimeout(() => {
|
||||||
|
setFlashKey(null);
|
||||||
|
}, 200);
|
||||||
|
|
||||||
|
// 一次性按钮:只发指令,不切换active状态
|
||||||
|
if (oneShotKeys.includes(feature)) {
|
||||||
if (feature === 'emergencyStop') {
|
if (feature === 'emergencyStop') {
|
||||||
sendEmergencyStop(userInfo);
|
sendEmergencyStop(userInfo);
|
||||||
onToggle?.(feature, true);
|
onToggle?.(feature, true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 寻车:下发指令的同时,与其他功能一样切换选中状态(toggle 效果)
|
|
||||||
if (feature === 'findCar') {
|
if (feature === 'findCar') {
|
||||||
sendFindCar?.();
|
sendFindCar?.();
|
||||||
}
|
}
|
||||||
if (feature === 'autoback') {
|
if (feature === 'autoback') {
|
||||||
sendAutoBack?.();
|
sendAutoBack?.();
|
||||||
}
|
}
|
||||||
|
if (feature === 'controlMode') {
|
||||||
|
sendControlMode?.();
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 开关类:保留toggle
|
||||||
const next = !active.has(feature);
|
const next = !active.has(feature);
|
||||||
const nextSet = new Set(active);
|
const nextSet = new Set(active);
|
||||||
if (next) nextSet.add(feature);
|
if (next) nextSet.add(feature);
|
||||||
@@ -91,26 +116,56 @@ const RobotFeatureButtons: React.FC<RobotFeatureButtonsProps> = ({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={`flex w-full ${className} flex-wrap content-start items-start gap-x-2 gap-y-2 justify-start self-start`}>
|
<div className={`flex w-full ${className} flex-wrap content-start items-start gap-x-2 gap-y-2 justify-start self-start`}>
|
||||||
|
<style>
|
||||||
|
{`
|
||||||
|
@keyframes controlModeGlow {
|
||||||
|
0% { box-shadow: 0 0 5px rgba(13, 171, 45, 0.4); border-color: rgba(13, 171, 45, 0.4); }
|
||||||
|
50% { box-shadow: 0 0 15px rgba(13, 171, 45, 0.8); border-color: rgba(13, 171, 45, 0.8); }
|
||||||
|
100% { box-shadow: 0 0 5px rgba(13, 171, 45, 0.4); border-color: rgba(13, 171, 45, 0.4); }
|
||||||
|
}
|
||||||
|
.control-mode-glow {
|
||||||
|
animation: controlModeGlow 1.5s infinite ease-in-out;
|
||||||
|
}
|
||||||
|
`}
|
||||||
|
</style>
|
||||||
{list.map((f) => {
|
{list.map((f) => {
|
||||||
|
const isOneShot = oneShotKeys.includes(f.key);
|
||||||
const isActive = active.has(f.key);
|
const isActive = active.has(f.key);
|
||||||
|
const isFlashing = flashKey === f.key;
|
||||||
|
const shouldGlow = f.key === 'controlMode' && controlMode != 3;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<button
|
<button
|
||||||
key={f.key}
|
key={f.key}
|
||||||
onClick={() => handleClick(f.key)}
|
onClick={() => handleClick(f.key)}
|
||||||
className="flex flex-col items-center justify-center gap-1.5 rounded-lg border transition-all duration-200 select-none hover:shadow-md"
|
className={`flex flex-col items-center justify-center gap-1.5 rounded-lg border transition-all duration-150 select-none hover:shadow-md ${shouldGlow ? 'control-mode-glow' : ''}`}
|
||||||
style={{
|
style={{
|
||||||
aspectRatio: '1 / 1',
|
aspectRatio: '1 / 1',
|
||||||
height: 64,
|
height: 64,
|
||||||
color: isActive ? f.activeColor : f.inactiveColor,
|
// 一次性按钮基础样式 + 按压变暗
|
||||||
backgroundColor: isActive ? `${f.activeColor}1a` : '#fafafa',
|
color: isOneShot
|
||||||
borderColor: isActive ? f.activeColor : '#e5e7eb',
|
? (isFlashing ? '#333' : f.inactiveColor)
|
||||||
boxShadow: isActive ? `0 0 12px ${f.activeColor}33` : 'none',
|
: (isActive ? f.activeColor : f.inactiveColor),
|
||||||
|
backgroundColor: isOneShot
|
||||||
|
? (isFlashing ? '#eaeaea' : '#fafafa')
|
||||||
|
: (isActive ? `${f.activeColor}1a` : '#fafafa'),
|
||||||
|
borderColor: isOneShot
|
||||||
|
? (isFlashing ? '#ccc' : (shouldGlow ? f.activeColor : '#e5e7eb'))
|
||||||
|
: (isActive ? f.activeColor : '#e5e7eb'),
|
||||||
|
boxShadow: isOneShot
|
||||||
|
? (isFlashing ? 'inset 0 1px 3px rgba(0,0,0,0.15)' : (shouldGlow ? `0 0 10px ${f.activeColor}66` : 'none'))
|
||||||
|
: (isActive ? `0 0 12px ${f.activeColor}33` : 'none'),
|
||||||
cursor: 'pointer',
|
cursor: 'pointer',
|
||||||
|
transform: isFlashing ? 'scale(0.97)' : 'scale(1)',
|
||||||
}}
|
}}
|
||||||
title={t(`devices.features.${f.key}`)}
|
title={t(`devices.features.${f.key}`)}
|
||||||
>
|
>
|
||||||
<span className="flex items-center justify-center">{f.icon}</span>
|
<span className="flex items-center justify-center">{f.icon}</span>
|
||||||
<span className="text-xs font-medium text-center leading-tight px-1" style={{ color: isActive ? f.activeColor : '#595959' }}>
|
<span className="text-xs font-medium text-center leading-tight px-1" style={{
|
||||||
|
color: isOneShot
|
||||||
|
? (isFlashing ? '#222' : '#595959')
|
||||||
|
: (isActive ? f.activeColor : '#595959')
|
||||||
|
}}>
|
||||||
{t(`devices.features.${f.key}`)}
|
{t(`devices.features.${f.key}`)}
|
||||||
</span>
|
</span>
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -42,6 +42,10 @@ import {
|
|||||||
deleteRoute,
|
deleteRoute,
|
||||||
getTaskPath,
|
getTaskPath,
|
||||||
createRegionDefaultTask,
|
createRegionDefaultTask,
|
||||||
|
createConsecutiveTasks,
|
||||||
|
cancelConsecutiveTask,
|
||||||
|
getConsecutiveTask,
|
||||||
|
modeChage
|
||||||
} from '../../api/device';
|
} from '../../api/device';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import DraggableBox from '../Draggable';
|
import DraggableBox from '../Draggable';
|
||||||
@@ -75,6 +79,7 @@ export default function RobotTaskPage() {
|
|||||||
const [polyPoints, setPolyPoints] = useState([]);
|
const [polyPoints, setPolyPoints] = useState([]);
|
||||||
const [detectReportInfo, setDeportInfo] = useState<any>(null);
|
const [detectReportInfo, setDeportInfo] = useState<any>(null);
|
||||||
const [selectedDeviceMap, setSelectedDeviceMap] = useState<Record<string, string>>({});
|
const [selectedDeviceMap, setSelectedDeviceMap] = useState<Record<string, string>>({});
|
||||||
|
const [consecutiveTaskList, setConsecutiveTaskList] = useState([]);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -93,6 +98,7 @@ export default function RobotTaskPage() {
|
|||||||
|
|
||||||
const [routeSearch, setRouteSearch] = useState('');
|
const [routeSearch, setRouteSearch] = useState('');
|
||||||
const [routeList, setRouteList] = useState([]);
|
const [routeList, setRouteList] = useState([]);
|
||||||
|
const [consecutiveLoading, setConsecutiveLoading] = useState(false);
|
||||||
|
|
||||||
// 执行任务弹窗
|
// 执行任务弹窗
|
||||||
const [executeModalVisible, setExecuteModalVisible] = useState(false);
|
const [executeModalVisible, setExecuteModalVisible] = useState(false);
|
||||||
@@ -130,6 +136,56 @@ export default function RobotTaskPage() {
|
|||||||
robot: null,
|
robot: null,
|
||||||
dateRange: null,
|
dateRange: null,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const [consecutiveFilterForm, setConsecutiveFilterForm] = useState({
|
||||||
|
taskStatus: null,
|
||||||
|
deviceId: null,
|
||||||
|
dateRange: null,
|
||||||
|
});
|
||||||
|
// 获取连续任务列表
|
||||||
|
const fetchConsecutiveTaskList = async () => {
|
||||||
|
if (!stationId) return;
|
||||||
|
setConsecutiveLoading(true);
|
||||||
|
|
||||||
|
try {
|
||||||
|
const params = { siteId: stationId };
|
||||||
|
if (consecutiveFilterForm.taskStatus) params.taskStatus = consecutiveFilterForm.taskStatus;
|
||||||
|
if (consecutiveFilterForm.deviceId) params.deviceId = consecutiveFilterForm.deviceId;
|
||||||
|
if (consecutiveFilterForm.dateRange && consecutiveFilterForm.dateRange.length === 2) {
|
||||||
|
params.startTime = consecutiveFilterForm.dateRange[0].format("YYYY-MM-DD HH:mm:ss");
|
||||||
|
params.endTime = consecutiveFilterForm.dateRange[1].format("YYYY-MM-DD HH:mm:ss");
|
||||||
|
}
|
||||||
|
const res = await getConsecutiveTask(params);
|
||||||
|
if (res.code == 200) {
|
||||||
|
setConsecutiveTaskList(res.rows || res.data || []);
|
||||||
|
setConsecutiveLoading(false);
|
||||||
|
}
|
||||||
|
} catch (err) { console.error("获取连续任务失败:", err); } finally {
|
||||||
|
setConsecutiveLoading(false);
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (stationId) fetchConsecutiveTaskList();
|
||||||
|
}, [consecutiveFilterForm, stationId]);
|
||||||
|
|
||||||
|
// 取消连续任务
|
||||||
|
const handleCancelConsecutiveTask = async (record) => {
|
||||||
|
try {
|
||||||
|
const ids = [record.id, record.taskId].filter(Boolean);
|
||||||
|
const res = await cancelConsecutiveTask({ deviceIds: ids });
|
||||||
|
if (res.code === 200) {
|
||||||
|
utils.message.success(t("common.operationSuccess"));
|
||||||
|
fetchConsecutiveTaskList();
|
||||||
|
} else {
|
||||||
|
utils.message.error(res.msg || t("common.operationFailed"));
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.error("取消连续任务失败:", err);
|
||||||
|
utils.message.error(t("common.operationFailed"));
|
||||||
|
}
|
||||||
|
};
|
||||||
// 取消任务模式 normal普通取消 force强制取消
|
// 取消任务模式 normal普通取消 force强制取消
|
||||||
const [cancelMode, setCancelMode] = useState<'normal' | 'force'>('normal');
|
const [cancelMode, setCancelMode] = useState<'normal' | 'force'>('normal');
|
||||||
|
|
||||||
@@ -751,6 +807,7 @@ export default function RobotTaskPage() {
|
|||||||
fetchTaskList();
|
fetchTaskList();
|
||||||
fetchTaskPoolList();
|
fetchTaskPoolList();
|
||||||
fetchTaskHistoryList();
|
fetchTaskHistoryList();
|
||||||
|
fetchConsecutiveTaskList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -835,6 +892,7 @@ export default function RobotTaskPage() {
|
|||||||
utils.message.success(t('devices.fixed2TaskSuspended2Fixed2CancelledFixed2'));
|
utils.message.success(t('devices.fixed2TaskSuspended2Fixed2CancelledFixed2'));
|
||||||
fetchTaskPoolList();
|
fetchTaskPoolList();
|
||||||
fetchTaskHistoryList();
|
fetchTaskHistoryList();
|
||||||
|
fetchConsecutiveTaskList();
|
||||||
setExecute(false);
|
setExecute(false);
|
||||||
//if (controllerRef.current) {
|
//if (controllerRef.current) {
|
||||||
// controllerRef.current.destroy?.();
|
// controllerRef.current.destroy?.();
|
||||||
@@ -906,6 +964,8 @@ export default function RobotTaskPage() {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (stationId) {
|
if (stationId) {
|
||||||
fetchRouteList();
|
fetchRouteList();
|
||||||
|
fetchConsecutiveTaskList();
|
||||||
|
|
||||||
}
|
}
|
||||||
}, [stationId]);
|
}, [stationId]);
|
||||||
|
|
||||||
@@ -921,6 +981,7 @@ export default function RobotTaskPage() {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (stationId) {
|
if (stationId) {
|
||||||
fetchTaskPoolList();
|
fetchTaskPoolList();
|
||||||
|
|
||||||
}
|
}
|
||||||
}, [poolFilterForm, stationId]);
|
}, [poolFilterForm, stationId]);
|
||||||
|
|
||||||
@@ -1055,6 +1116,10 @@ export default function RobotTaskPage() {
|
|||||||
dataIndex: 'deviceId',
|
dataIndex: 'deviceId',
|
||||||
width: 180,
|
width: 180,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: t('devices.workName'),
|
||||||
|
dataIndex: 'workName',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: t('devices.taskId'),
|
title: t('devices.taskId'),
|
||||||
dataIndex: 'id',
|
dataIndex: 'id',
|
||||||
@@ -1162,6 +1227,16 @@ export default function RobotTaskPage() {
|
|||||||
dataIndex: 'deviceId',
|
dataIndex: 'deviceId',
|
||||||
width: 220,
|
width: 220,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: t('devices.workName'),
|
||||||
|
dataIndex: 'workName',
|
||||||
|
width: 220,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t('devices.taskId'),
|
||||||
|
dataIndex: 'id',
|
||||||
|
width: 220,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: t('roles.status'),
|
title: t('roles.status'),
|
||||||
dataIndex: 'taskStausTranslate',
|
dataIndex: 'taskStausTranslate',
|
||||||
@@ -1202,7 +1277,24 @@ export default function RobotTaskPage() {
|
|||||||
const showContinueBtn = ['FAILED', 'CANCELED'].includes(record.taskStaus);
|
const showContinueBtn = ['FAILED', 'CANCELED'].includes(record.taskStaus);
|
||||||
|
|
||||||
if (!showContinueBtn) return null;
|
if (!showContinueBtn) return null;
|
||||||
const currentSn = selectedDeviceMap[record.taskId] ?? record.serialNumber;
|
|
||||||
|
// 每行独立的 key,避免不同行共用同一个 key 导致互相关联
|
||||||
|
const rowKey = String(record.taskId ?? record.id);
|
||||||
|
// 默认选中当前行任务的设备(deviceId 即设备 SN)
|
||||||
|
const rowDeviceSn = record.deviceId ?? record.serialNumber;
|
||||||
|
const currentSn = selectedDeviceMap[rowKey] ?? rowDeviceSn;
|
||||||
|
|
||||||
|
const robotOptions = (devices || []).map(item => ({
|
||||||
|
value: item.serialNumber,
|
||||||
|
label: `${item.deviceAlias || item.deviceName} (${item.serialNumber})`
|
||||||
|
}));
|
||||||
|
// 历史任务所属设备可能已不在当前设备列表中,补充一条选项保证默认值可显示
|
||||||
|
if (rowDeviceSn && !robotOptions.some(opt => opt.value === rowDeviceSn)) {
|
||||||
|
robotOptions.unshift({
|
||||||
|
value: rowDeviceSn,
|
||||||
|
label: record.deviceAlias || record.deviceName || rowDeviceSn
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div style={{ display: 'flex', gap: 8, alignItems: 'center' }}>
|
<div style={{ display: 'flex', gap: 8, alignItems: 'center' }}>
|
||||||
@@ -1212,21 +1304,18 @@ export default function RobotTaskPage() {
|
|||||||
onChange={(val) => {
|
onChange={(val) => {
|
||||||
setSelectedDeviceMap(prev => ({
|
setSelectedDeviceMap(prev => ({
|
||||||
...prev,
|
...prev,
|
||||||
[record.taskId]: val
|
[rowKey]: val
|
||||||
}));
|
}));
|
||||||
}}
|
}}
|
||||||
szie="small"
|
size="small"
|
||||||
style={{ flex: 1, minWidth: 100 }}
|
style={{ flex: 1, minWidth: 100 }}
|
||||||
options={(devices || []).map(item => ({
|
options={robotOptions}
|
||||||
value: item.serialNumber,
|
|
||||||
label: `${item.deviceAlias || item.deviceName} (${item.serialNumber})`
|
|
||||||
}))}
|
|
||||||
/>
|
/>
|
||||||
<Button
|
<Button
|
||||||
type="link"
|
type="link"
|
||||||
size="small"
|
size="small"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
const chooseSn = selectedDeviceMap[record.taskId] ?? record.serialNumber;
|
const chooseSn = selectedDeviceMap[rowKey] ?? rowDeviceSn;
|
||||||
handleContinueWord(record, chooseSn);
|
handleContinueWord(record, chooseSn);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@@ -1392,7 +1481,28 @@ export default function RobotTaskPage() {
|
|||||||
setRouteMode('');
|
setRouteMode('');
|
||||||
setFocusOverlay(null);
|
setFocusOverlay(null);
|
||||||
};
|
};
|
||||||
|
const handleControlMode = () => {
|
||||||
|
if (!dispatchRobotSns) {
|
||||||
|
messageApi.error(t('devices.selectDevice'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const data = {
|
||||||
|
controlMode: 3,
|
||||||
|
deviceId: dispatchRobotSns
|
||||||
|
}
|
||||||
|
modeChage(data).then(res => {
|
||||||
|
if (res.code == 200) {
|
||||||
|
messageApi.success(t('devices.controlModeSuccess'));
|
||||||
|
} else {
|
||||||
|
messageApi.error(res.msg || t('devices.controlModeFail'));
|
||||||
|
|
||||||
|
}
|
||||||
|
}).catch(err => {
|
||||||
|
messageApi.success(t('devices.controlModeFail'));
|
||||||
|
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// 统一下发任务(立即执行 / 定时任务)
|
// 统一下发任务(立即执行 / 定时任务)
|
||||||
@@ -1442,14 +1552,28 @@ export default function RobotTaskPage() {
|
|||||||
fetchTaskHistoryList();
|
fetchTaskHistoryList();
|
||||||
}
|
}
|
||||||
} else if (dispatchMode === 'immediate' && dispatchSource == "region") {
|
} else if (dispatchMode === 'immediate' && dispatchSource == "region") {
|
||||||
|
try {
|
||||||
const data = {
|
const data = {
|
||||||
deviceId: dispatchRobotSns,
|
deviceId: dispatchRobotSns,
|
||||||
siteId: stationId,
|
routeIds: dispatchRouteIds,
|
||||||
orgId: currentStation?.orgId,
|
orgId: currentStation?.orgId,
|
||||||
regionId: dispatchRegionIds,
|
siteId: stationId,
|
||||||
routeId: dispatchRouteIds,
|
//regionId: dispatchRegionIds,
|
||||||
|
};
|
||||||
|
const res = await createConsecutiveTasks(data);
|
||||||
|
if (res.code === 200) {
|
||||||
|
utils.message.success(t("devices.taskCreated"));
|
||||||
|
fetchTaskList();
|
||||||
|
fetchTaskPoolList();
|
||||||
|
fetchTaskHistoryList();
|
||||||
|
fetchConsecutiveTaskList();
|
||||||
|
} else {
|
||||||
|
utils.message.error(res.msg || t("devices.createFailed"));
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.error("下发连续任务失败:", err);
|
||||||
|
utils.message.error(t("devices.createTaskError"));
|
||||||
}
|
}
|
||||||
createRegionDefaultTask(data)
|
|
||||||
} else {
|
} else {
|
||||||
if (!scheduleForm.planName) {
|
if (!scheduleForm.planName) {
|
||||||
utils.message.error(t('devices.fillRequired', { fields: t('devices.taskName') }));
|
utils.message.error(t('devices.fillRequired', { fields: t('devices.taskName') }));
|
||||||
@@ -1797,6 +1921,10 @@ export default function RobotTaskPage() {
|
|||||||
{
|
{
|
||||||
key: 'history',
|
key: 'history',
|
||||||
label: t('devices.taskHistory'),
|
label: t('devices.taskHistory'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'consecutive',
|
||||||
|
label: t('devices.taskConsecutive'),
|
||||||
}
|
}
|
||||||
]}
|
]}
|
||||||
tabBarExtraContent={
|
tabBarExtraContent={
|
||||||
@@ -1805,6 +1933,8 @@ export default function RobotTaskPage() {
|
|||||||
fetchTaskList();
|
fetchTaskList();
|
||||||
fetchTaskPoolList();
|
fetchTaskPoolList();
|
||||||
fetchTaskHistoryList();
|
fetchTaskHistoryList();
|
||||||
|
fetchConsecutiveTaskList();
|
||||||
|
|
||||||
}} />
|
}} />
|
||||||
{/*<Tooltip title={t('devices.createTask')}>
|
{/*<Tooltip title={t('devices.createTask')}>
|
||||||
<PlusOutlined
|
<PlusOutlined
|
||||||
@@ -1994,14 +2124,84 @@ export default function RobotTaskPage() {
|
|||||||
rowKey="id"
|
rowKey="id"
|
||||||
columns={taskHistoryColumns}
|
columns={taskHistoryColumns}
|
||||||
dataSource={taskHistoryList}
|
dataSource={taskHistoryList}
|
||||||
pagination={false}
|
pagination={{ pageSize: 10, showSizeChanger: false, showQuickJumper: true, showTotal: (total) => '共 ' + total + ' 条' }}
|
||||||
scroll={{ x: 800, y: 150 }}
|
|
||||||
|
scroll={{ x: 800, y: 140 }}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
{activeTab === "consecutive" && (
|
||||||
|
<>
|
||||||
|
<div style={{ marginBottom: 8, display: "flex", gap: 8, alignItems: "center" }}>
|
||||||
|
<RangePicker size="small" format="YYYY-MM-DD HH:mm:ss" showTime
|
||||||
|
placeholder={[t("devices.startTime"), t("devices.endTime")]}
|
||||||
|
value={consecutiveFilterForm.dateRange}
|
||||||
|
onChange={(dates) => setConsecutiveFilterForm(prev => ({ ...prev, dateRange: dates }))}
|
||||||
|
/>
|
||||||
|
<Select style={{ width: 120 }} size="small" placeholder={t("roles.status")} allowClear
|
||||||
|
options={[
|
||||||
|
{ label: t("devices.statusExecuting"), value: "EXECUTING" },
|
||||||
|
{ label: t("video.pause"), value: "PAUSE" },
|
||||||
|
{ label: t("devices.statusFinished"), value: "FINISH" },
|
||||||
|
{ label: t("devices.statusFailed"), value: "FAILED" },
|
||||||
|
{ label: t("clean.cancelled"), value: "CANCELED" },
|
||||||
|
{ label: t("devices.statusNew"), value: "NEW" },
|
||||||
|
]}
|
||||||
|
value={consecutiveFilterForm.taskStatus}
|
||||||
|
onChange={(val) => setConsecutiveFilterForm(prev => ({ ...prev, taskStatus: val }))}
|
||||||
|
/>
|
||||||
|
<Select style={{ width: 340 }} size="small" placeholder={t("devices.allRobots")} allowClear
|
||||||
|
options={devices?.map(item => ({
|
||||||
|
value: item.serialNumber,
|
||||||
|
label: item.deviceAlias || item.deviceName
|
||||||
|
}))}
|
||||||
|
value={consecutiveFilterForm.deviceId}
|
||||||
|
onChange={(val) => setConsecutiveFilterForm(prev => ({ ...prev, deviceId: val || null }))}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<Table
|
||||||
|
size="small"
|
||||||
|
rowKey="id"
|
||||||
|
columns={[
|
||||||
|
{ title: t('common.id'), dataIndex: 'id', width: 80 },
|
||||||
|
{ title: t('devices.device'), dataIndex: 'deviceId', width: 160, render: v => v || '-' },
|
||||||
|
{ title: t('devices.startTime'), dataIndex: 'startTime', width: 170, render: v => v || '-' },
|
||||||
|
{ title: t('devices.endTime'), dataIndex: 'endTime', width: 170, render: v => v || '-' },
|
||||||
|
{
|
||||||
|
title: t('roles.status'), dataIndex: 'taskStatus', width: 100,
|
||||||
|
render: (text) => {
|
||||||
|
const color = ({ EXECUTING: 'processing', PAUSE: 'warning', FINISH: 'success', FAILED: 'error', CANCELED: 'default', NEW: 'default' })[text] || 'default';
|
||||||
|
return <Tag color={color} style={{ margin: 0 }}>{text || '-'}</Tag>;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t('roles.actions'), width: 80,
|
||||||
|
render: (_t2, r) => (
|
||||||
|
<Popconfirm
|
||||||
|
title={t('devices.confirmCancelTask')}
|
||||||
|
onConfirm={() => handleCancelConsecutiveTask(r)}
|
||||||
|
okText={t('common.ok')}
|
||||||
|
cancelText={t('common.cancel')}
|
||||||
|
>
|
||||||
|
<Button type="text" size="small" danger onClick={e => e.stopPropagation()}>{t('common.cancel')}</Button>
|
||||||
|
</Popconfirm>
|
||||||
|
)
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
dataSource={consecutiveTaskList ?? []}
|
||||||
|
loading={consecutiveLoading}
|
||||||
|
pagination={{ pageSize: 10, showSizeChanger: false, showQuickJumper: true, showTotal: (total) => '共 ' + total + ' 条' }}
|
||||||
|
scroll={{ x: 760, y: 140 }}
|
||||||
|
empty={<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</Card>
|
</Card>
|
||||||
</Col>
|
</Col>
|
||||||
|
|
||||||
|
|
||||||
<Col xs={24} xl={10} style={{ display: "flex", flexDirection: "column" }}>
|
<Col xs={24} xl={10} style={{ display: "flex", flexDirection: "column" }}>
|
||||||
<Card
|
<Card
|
||||||
title={<span style={{ fontSize: fontTitle, fontWeight: 700 }}>{t('devices.taskDispatch')}</span>}
|
title={<span style={{ fontSize: fontTitle, fontWeight: 700 }}>{t('devices.taskDispatch')}</span>}
|
||||||
@@ -2026,7 +2226,7 @@ export default function RobotTaskPage() {
|
|||||||
{(!routeList || routeList.length === 0) ? (
|
{(!routeList || routeList.length === 0) ? (
|
||||||
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />
|
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />
|
||||||
) : (
|
) : (
|
||||||
<div style={{ display: 'flex', flexWrap: 'wrap', gap: 8 }}>
|
<div style={{ display: 'flex', flexWrap: 'wrap', gap: 8, maxHeight: 250, overflowY: "auto", }}>
|
||||||
{routeList.map(route => {
|
{routeList.map(route => {
|
||||||
const checked = dispatchRouteIds.includes(route.id);
|
const checked = dispatchRouteIds.includes(route.id);
|
||||||
|
|
||||||
@@ -2445,6 +2645,8 @@ export default function RobotTaskPage() {
|
|||||||
</Radio.Group>
|
</Radio.Group>
|
||||||
</div>*/}
|
</div>*/}
|
||||||
|
|
||||||
|
{dispatchSource === 'route' && (
|
||||||
|
<>
|
||||||
<TaskTypeRadio value={dispatchMode} onChange={setDispatchMode} />
|
<TaskTypeRadio value={dispatchMode} onChange={setDispatchMode} />
|
||||||
|
|
||||||
{/* 定时任务表单 */}
|
{/* 定时任务表单 */}
|
||||||
@@ -2492,18 +2694,63 @@ export default function RobotTaskPage() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
|
||||||
{/* 选择执行机器人 */}
|
{/* 选择执行机器人 */}
|
||||||
<div>
|
<div>
|
||||||
<label style={{ display: 'block', marginBottom: 4, fontWeight: 500 }}>{t('devices.taskSelectRobot')}</label>
|
{/* label + 按钮 同行 */}
|
||||||
|
<div style={{ display: 'flex', alignItems: 'center', gap: 12, marginBottom: 4 }}>
|
||||||
|
<label style={{ fontWeight: 500 }}>{t('devices.taskSelectRobot')}</label>
|
||||||
|
{/*{(() => {
|
||||||
|
console.log(robotRealtimePosition, "robotRealtimePosition")
|
||||||
|
const mode = robotRealtimePosition?.controlMode || robotRealtimePosition?.control_mode;
|
||||||
|
if (mode == 2) return;
|
||||||
|
|
||||||
|
const modeConfig: Record<string, { label: string; color: string }> = {
|
||||||
|
'0': {
|
||||||
|
label: t('devices.controlOff'),
|
||||||
|
color: '#999999',
|
||||||
|
},
|
||||||
|
'1': {
|
||||||
|
label: t('devices.localCpntrol'),
|
||||||
|
color: '#ff6f6f',
|
||||||
|
},
|
||||||
|
'2': {
|
||||||
|
label: t('devices.autoTask'),
|
||||||
|
color: '#9eff9e',
|
||||||
|
},
|
||||||
|
'3': {
|
||||||
|
label: t('devices.remoteControl'),
|
||||||
|
color: '#9eff9e',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
return <Button
|
||||||
|
size="small"
|
||||||
|
onClick={(e) => {
|
||||||
|
e.stopPropagation();
|
||||||
|
handleControlMode();
|
||||||
|
console.log('控制模式按钮点击', dispatchRobotSns);
|
||||||
|
}} >
|
||||||
|
{mode} {t('devices.features.controlMode')} </Button>
|
||||||
|
})()}*/}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
<Select
|
<Select
|
||||||
placeholder={t('devices.taskSelectRobot')}
|
placeholder={t('devices.taskSelectRobot')}
|
||||||
value={dispatchRobotSns}
|
value={dispatchRobotSns}
|
||||||
onChange={setDispatchRobotSns}
|
onChange={setDispatchRobotSns}
|
||||||
style={{ width: '100%' }}
|
style={{ width: '100%' }}
|
||||||
options={(devices || []).map(item => ({ value: item.serialNumber, label: `${item.deviceAlias || item.deviceName} (${item.serialNumber})` }))}
|
options={(devices || []).map(item => ({
|
||||||
|
value: item.serialNumber,
|
||||||
|
label: `${item.deviceAlias || item.deviceName} (${item.serialNumber})`
|
||||||
|
}))}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
{/* 下发方式:按路线 / 按区域 */}
|
{/* 下发方式:按路线 / 按区域 */}
|
||||||
|
|
||||||
@@ -2526,7 +2773,7 @@ export default function RobotTaskPage() {
|
|||||||
|
|
||||||
</Row>
|
</Row>
|
||||||
|
|
||||||
<Row gutter={16} >
|
{/*<Row gutter={16} >
|
||||||
<Col xs={24} xl={6} style={{ display: "flex", flexDirection: "column" }} >
|
<Col xs={24} xl={6} style={{ display: "flex", flexDirection: "column" }} >
|
||||||
<Card
|
<Card
|
||||||
title={<span style={{ fontSize: fontTitle, fontWeight: 700 }}>{t('devices.operationSuggestion')}</span>}
|
title={<span style={{ fontSize: fontTitle, fontWeight: 700 }}>{t('devices.operationSuggestion')}</span>}
|
||||||
@@ -2659,7 +2906,7 @@ export default function RobotTaskPage() {
|
|||||||
</Row>
|
</Row>
|
||||||
</Card>
|
</Card>
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>*/}
|
||||||
|
|
||||||
|
|
||||||
{/*{showVideo && executingRobot && execute && taskPoolList.length > 0 && (
|
{/*{showVideo && executingRobot && execute && taskPoolList.length > 0 && (
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
const en = {
|
const en = {
|
||||||
common: {
|
common: {
|
||||||
save: 'Save',
|
save: 'Save',
|
||||||
|
id: 'id',
|
||||||
saveChanges: 'Save Changes',
|
saveChanges: 'Save Changes',
|
||||||
cancel: 'Cancel',
|
cancel: 'Cancel',
|
||||||
confirm: 'Confirm',
|
confirm: 'Confirm',
|
||||||
@@ -655,6 +656,9 @@
|
|||||||
rtRightMeasureRpm: 'Right Measured RPM',
|
rtRightMeasureRpm: 'Right Measured RPM',
|
||||||
rtLeftMotorRpm: 'Left Motor RPM',
|
rtLeftMotorRpm: 'Left Motor RPM',
|
||||||
rtRightMotorRpm: 'Right Motor RPM',
|
rtRightMotorRpm: 'Right Motor RPM',
|
||||||
|
controlModeSuccess: 'Control Mode Success',
|
||||||
|
controlModeFail: 'Control Mode Fail',
|
||||||
|
selectDevice: 'Select Device',
|
||||||
gamepad: {
|
gamepad: {
|
||||||
leftStick: 'Left Stick',
|
leftStick: 'Left Stick',
|
||||||
leftStickDesc: 'Control direction',
|
leftStickDesc: 'Control direction',
|
||||||
@@ -695,6 +699,7 @@
|
|||||||
tiltProtection: 'Tilt Protection',
|
tiltProtection: 'Tilt Protection',
|
||||||
findCar: 'Find Car',
|
findCar: 'Find Car',
|
||||||
autoback: 'Auto Back',
|
autoback: 'Auto Back',
|
||||||
|
controlMode: 'Control Mode Switch',
|
||||||
},
|
},
|
||||||
dpad: {
|
dpad: {
|
||||||
title: 'Direction Control',
|
title: 'Direction Control',
|
||||||
@@ -881,6 +886,7 @@
|
|||||||
"inspectionNo": "Inspection No",
|
"inspectionNo": "Inspection No",
|
||||||
"activeTime": "Active Time",
|
"activeTime": "Active Time",
|
||||||
"dealer": "Dealer",
|
"dealer": "Dealer",
|
||||||
|
taskConsecutive: 'Task Consecutive',
|
||||||
paramEnum: {
|
paramEnum: {
|
||||||
deviceTypeM: 'Mower',
|
deviceTypeM: 'Mower',
|
||||||
deviceTypeI: 'Inspection',
|
deviceTypeI: 'Inspection',
|
||||||
@@ -910,6 +916,7 @@
|
|||||||
noConfiguredRegions: 'noConfiguredRegions',
|
noConfiguredRegions: 'noConfiguredRegions',
|
||||||
noConfiguredObstaclePoints: "noConfiguredObstaclePoints",
|
noConfiguredObstaclePoints: "noConfiguredObstaclePoints",
|
||||||
legend: 'Legend',
|
legend: 'Legend',
|
||||||
|
typeBackToRest: 'Return Point',
|
||||||
unbound: 'Unbound',
|
unbound: 'Unbound',
|
||||||
duplicateBindDevice: 'Duplicate Bind Device',
|
duplicateBindDevice: 'Duplicate Bind Device',
|
||||||
restArea: 'Region',
|
restArea: 'Region',
|
||||||
@@ -1052,10 +1059,10 @@
|
|||||||
satelliteCount: 'Satellite Count',
|
satelliteCount: 'Satellite Count',
|
||||||
savePathTitle: 'Save Path Title',
|
savePathTitle: 'Save Path Title',
|
||||||
savePlan: 'Save Plan',
|
savePlan: 'Save Plan',
|
||||||
|
workName: 'Work Name',
|
||||||
saving: 'Saving',
|
saving: 'Saving',
|
||||||
searchDeviceName: 'Search Device Name',
|
searchDeviceName: 'Search Device Name',
|
||||||
searchWaylinePlaceholder: 'Search Wayline Placeholder',
|
searchWaylinePlaceholder: 'Search Wayline Placeholder',
|
||||||
selectDevice: 'Select Device',
|
|
||||||
selectDrone: 'Select Drone',
|
selectDrone: 'Select Drone',
|
||||||
selectExecuteDroneFirst: 'Select Execute Drone First',
|
selectExecuteDroneFirst: 'Select Execute Drone First',
|
||||||
selectNoDrone: 'Select No Drone',
|
selectNoDrone: 'Select No Drone',
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ const zh = {
|
|||||||
common: {
|
common: {
|
||||||
// 按钮
|
// 按钮
|
||||||
save: '保存',
|
save: '保存',
|
||||||
|
id: 'id',
|
||||||
|
|
||||||
saveChanges: '保存修改',
|
saveChanges: '保存修改',
|
||||||
cancel: '取消',
|
cancel: '取消',
|
||||||
confirm: '确认',
|
confirm: '确认',
|
||||||
@@ -729,6 +731,8 @@ const zh = {
|
|||||||
tiltProtection: '倾斜保护',
|
tiltProtection: '倾斜保护',
|
||||||
findCar: '寻车',
|
findCar: '寻车',
|
||||||
autoback: '返航',
|
autoback: '返航',
|
||||||
|
controlMode: '控制模式切换',
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
dpad: {
|
dpad: {
|
||||||
@@ -925,6 +929,12 @@ const zh = {
|
|||||||
taskScheduleSetting: '定时任务设置',
|
taskScheduleSetting: '定时任务设置',
|
||||||
taskExecuteNow: '下发任务',
|
taskExecuteNow: '下发任务',
|
||||||
taskSaveSchedule: '保存定时任务',
|
taskSaveSchedule: '保存定时任务',
|
||||||
|
controlModeSuccess: '模式切换成功',
|
||||||
|
controlModeFail: '模式切换失败',
|
||||||
|
selectDevice: '请先选择机器',
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
taskSelectRegionFirst: '请先选择任务区域',
|
taskSelectRegionFirst: '请先选择任务区域',
|
||||||
taskSelectRouteFirst: '所选区域未关联任何路径',
|
taskSelectRouteFirst: '所选区域未关联任何路径',
|
||||||
taskSelectRobotFirst: '请先选择执行机器人',
|
taskSelectRobotFirst: '请先选择执行机器人',
|
||||||
@@ -971,7 +981,7 @@ const zh = {
|
|||||||
rtLeftSpeed: '左速度',
|
rtLeftSpeed: '左速度',
|
||||||
rtLeftTemp: '左电机温度',
|
rtLeftTemp: '左电机温度',
|
||||||
rtMainTemp: '芯片温度',
|
rtMainTemp: '芯片温度',
|
||||||
rtMode: '模式',
|
rtMode: '控制模式',
|
||||||
rtPitchAngle: '俯仰角度',
|
rtPitchAngle: '俯仰角度',
|
||||||
rtRollAngle: '翻滚角度',
|
rtRollAngle: '翻滚角度',
|
||||||
rtPositioning: '定位',
|
rtPositioning: '定位',
|
||||||
@@ -994,9 +1004,9 @@ const zh = {
|
|||||||
savePathTitle: '保存路径标题',
|
savePathTitle: '保存路径标题',
|
||||||
savePlan: '保存计划',
|
savePlan: '保存计划',
|
||||||
saving: '保存中...',
|
saving: '保存中...',
|
||||||
|
workName: '路线名称',
|
||||||
searchDeviceName: '搜索设备名称',
|
searchDeviceName: '搜索设备名称',
|
||||||
searchWaylinePlaceholder: '搜索航线占位',
|
searchWaylinePlaceholder: '搜索航线占位',
|
||||||
selectDevice: '选择设备',
|
|
||||||
selectDrone: '选择无人机',
|
selectDrone: '选择无人机',
|
||||||
selectExecuteDroneFirst: '执行无人机',
|
selectExecuteDroneFirst: '执行无人机',
|
||||||
selectNoDrone: '无无人机',
|
selectNoDrone: '无无人机',
|
||||||
@@ -1507,6 +1517,8 @@ const zh = {
|
|||||||
"inspectionNo": "检测报告号",
|
"inspectionNo": "检测报告号",
|
||||||
"activeTime": "激活时间",
|
"activeTime": "激活时间",
|
||||||
"dealer": "经销商",
|
"dealer": "经销商",
|
||||||
|
taskConsecutive: '连续任务',
|
||||||
|
|
||||||
paramEnum: {
|
paramEnum: {
|
||||||
deviceTypeM: '割草机',
|
deviceTypeM: '割草机',
|
||||||
deviceTypeI: '巡检',
|
deviceTypeI: '巡检',
|
||||||
@@ -1549,6 +1561,8 @@ const zh = {
|
|||||||
routeName: '路径名称',
|
routeName: '路径名称',
|
||||||
routeNamePlaceholder: '请输入路径名称',
|
routeNamePlaceholder: '请输入路径名称',
|
||||||
routeType: '路径规划类型',
|
routeType: '路径规划类型',
|
||||||
|
typeBackToRest: '返航任务',
|
||||||
|
|
||||||
typeMowing: '割草任务',
|
typeMowing: '割草任务',
|
||||||
typeInspection: '巡检任务',
|
typeInspection: '巡检任务',
|
||||||
typeOther: '其他类型',
|
typeOther: '其他类型',
|
||||||
|
|||||||
@@ -1482,6 +1482,7 @@ const RealTimeMonitorPage = () => {
|
|||||||
onToggle={(feature, enabled) => {
|
onToggle={(feature, enabled) => {
|
||||||
console.log('[RTMonitor Feature]', feature, enabled);
|
console.log('[RTMonitor Feature]', feature, enabled);
|
||||||
}}
|
}}
|
||||||
|
controlMode={pickRealtimeRecord(realtimeMap, selectedDevice)?.controlMode}
|
||||||
/>
|
/>
|
||||||
</Card>
|
</Card>
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ import { useSelector } from 'react-redux';
|
|||||||
import { RootState } from '../store';
|
import { RootState } from '../store';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import { getRobotTaskList, getSiteDevice, getDeviceTastPool, getSiteDeviceTaskHistory } from '../api/device';
|
import { getRobotTaskList, getSiteDevice, getDeviceTastPool, getSiteDeviceTaskHistory, } from '../api/device';
|
||||||
import { getAlarmList, getAlarmStatistics } from '../api/alarmApi';
|
import { getAlarmList, getAlarmStatistics } from '../api/alarmApi';
|
||||||
import { alarmTypeMap } from '@/constants.js';
|
import { alarmTypeMap } from '@/constants.js';
|
||||||
import { useNavigate } from 'react-router-dom';
|
import { useNavigate } from 'react-router-dom';
|
||||||
@@ -81,6 +81,8 @@ const TaskMonitorPage: React.FC = () => {
|
|||||||
const [selectedDeviceSerial, setSelectedDeviceSerial] = useState<string | null>(null);
|
const [selectedDeviceSerial, setSelectedDeviceSerial] = useState<string | null>(null);
|
||||||
const [focusLocation, setFocusLocation] = useState<any>(null);
|
const [focusLocation, setFocusLocation] = useState<any>(null);
|
||||||
const [messageApi, contextHolder] = message.useMessage();
|
const [messageApi, contextHolder] = message.useMessage();
|
||||||
|
const [taskPoolList, setTaskPoolList] = useState([]);
|
||||||
|
|
||||||
|
|
||||||
const controllerRef = useRef<DeviceController | null>(null);
|
const controllerRef = useRef<DeviceController | null>(null);
|
||||||
const mapRef = useRef<any>(null);
|
const mapRef = useRef<any>(null);
|
||||||
@@ -101,7 +103,7 @@ const TaskMonitorPage: React.FC = () => {
|
|||||||
if (!stationId) return;
|
if (!stationId) return;
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
try {
|
try {
|
||||||
const [taskRes, alarmRes, alarmStatRes, deviceRes, taskHistoreList] = await Promise.all([
|
const [taskRes, alarmRes, alarmStatRes, deviceRes, taskHistoreList, taskpoollist] = await Promise.all([
|
||||||
getRobotTaskList({ siteId: String(stationId), pageNum: 1, pageSize: 999 }),
|
getRobotTaskList({ siteId: String(stationId), pageNum: 1, pageSize: 999 }),
|
||||||
getAlarmList({ siteId: stationId, pageNum: 1, pageSize: 9999 }),
|
getAlarmList({ siteId: stationId, pageNum: 1, pageSize: 9999 }),
|
||||||
getAlarmStatistics({ siteId: stationId }),
|
getAlarmStatistics({ siteId: stationId }),
|
||||||
@@ -111,6 +113,13 @@ const TaskMonitorPage: React.FC = () => {
|
|||||||
orgId: currentStation?.orgId,
|
orgId: currentStation?.orgId,
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 99999999
|
pageSize: 99999999
|
||||||
|
}),
|
||||||
|
getDeviceTastPool({
|
||||||
|
userId: userInfo?.userId,
|
||||||
|
siteId: stationId,
|
||||||
|
orgId: currentStation?.orgId,
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 99999999
|
||||||
})
|
})
|
||||||
]);
|
]);
|
||||||
|
|
||||||
@@ -119,6 +128,7 @@ const TaskMonitorPage: React.FC = () => {
|
|||||||
if (alarmStatRes.code === 200) setAlarmStats(alarmStatRes.data || null);
|
if (alarmStatRes.code === 200) setAlarmStats(alarmStatRes.data || null);
|
||||||
if (deviceRes.code === 200) setDevices(deviceRes.rows || []);
|
if (deviceRes.code === 200) setDevices(deviceRes.rows || []);
|
||||||
if (taskHistoreList.code == 200) setTaskHistoryLisy(taskHistoreList.rows || []);
|
if (taskHistoreList.code == 200) setTaskHistoryLisy(taskHistoreList.rows || []);
|
||||||
|
if (taskpoollist.code == 200) setTaskPoolList(taskpoollist.rows || []);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Fetch monitoring data failed', err);
|
console.error('Fetch monitoring data failed', err);
|
||||||
} finally {
|
} finally {
|
||||||
@@ -126,6 +136,8 @@ const TaskMonitorPage: React.FC = () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
fetchData();
|
fetchData();
|
||||||
//const timer = setInterval(fetchData, 60000); // 每分钟刷新一次
|
//const timer = setInterval(fetchData, 60000); // 每分钟刷新一次
|
||||||
@@ -181,11 +193,11 @@ const TaskMonitorPage: React.FC = () => {
|
|||||||
const taskSummary = useMemo(() => {
|
const taskSummary = useMemo(() => {
|
||||||
const todayTasks = taskList.filter(t => dayjs(t.createTime).isSame(dayjs(), 'day'));
|
const todayTasks = taskList.filter(t => dayjs(t.createTime).isSame(dayjs(), 'day'));
|
||||||
return {
|
return {
|
||||||
pending: todayTasks.filter(t => t.taskStaus === 'NEW').length,
|
pending: taskPoolList.filter(t => t.taskStaus === 'NEW').length,
|
||||||
running: todayTasks.filter(t => t.taskStaus === 'EXECUTING').length,
|
running: taskPoolList.filter(t => t.taskStaus === 'EXECUTING').length,
|
||||||
completed: todayTasks.filter(t => ['FINISH', 'FINISHED'].includes(t.taskStaus)).length,
|
completed: taskListHis.filter(t => ['FINISH', 'FINISHED'].includes(t.taskStaus)).length,
|
||||||
failed: todayTasks.filter(t => t.taskStaus === 'FAILED').length,
|
failed: taskListHis.filter(t => t.taskStaus === 'FAILED').length,
|
||||||
total: todayTasks.length
|
total: taskListHis.length
|
||||||
};
|
};
|
||||||
}, [taskList]);
|
}, [taskList]);
|
||||||
|
|
||||||
@@ -253,16 +265,16 @@ const TaskMonitorPage: React.FC = () => {
|
|||||||
{contextHolder}
|
{contextHolder}
|
||||||
|
|
||||||
<div style={{ padding: '0 0 16px' }}>
|
<div style={{ padding: '0 0 16px' }}>
|
||||||
<Title level={4} style={{ margin: 0, color: '#17456d', letterSpacing: 1 }}>任务监控指挥中心</Title>
|
<Title level={4} style={{ margin: 0, color: '#17456d', letterSpacing: 1 }}>任务监控中心</Title>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Row gutter={12} style={{ height: columnHeight }}>
|
<Row gutter={12} style={{ height: columnHeight }}>
|
||||||
{/* 左侧面板 */}
|
{/* 左侧面板 */}
|
||||||
<Col span={5} style={{ height: '100%', display: 'flex', flexDirection: 'column', minWidth: 0 }}>
|
<Col span={5} style={{ height: '100%', display: 'flex', flexDirection: 'column', minWidth: 0 }}>
|
||||||
<MonitorCard title="任务总览" icon={<LayoutGrid size={18} color="#1890ff" />} height="30%">
|
<MonitorCard title="任务总览" icon={<LayoutGrid size={18} color="#1890ff" />} height="30%" extra={<Button type="link" size="small" onClick={() => navigate('/devices/robotTask')}>查看更多</Button>}>
|
||||||
<Row gutter={8}>
|
<Row gutter={8}>
|
||||||
{[
|
{[
|
||||||
{ label: '待部署', value: taskSummary.pending, color: '#faad14', bg: '#fff7e6' },
|
{ label: '待进行', value: taskSummary.pending, color: '#faad14', bg: '#fff7e6' },
|
||||||
{ label: '进行中', value: taskSummary.running, color: '#1890ff', bg: '#e6f7ff' },
|
{ label: '进行中', value: taskSummary.running, color: '#1890ff', bg: '#e6f7ff' },
|
||||||
{ label: '已完成', value: taskSummary.completed, color: '#52c41a', bg: '#f6ffed' },
|
{ label: '已完成', value: taskSummary.completed, color: '#52c41a', bg: '#f6ffed' },
|
||||||
{ label: '故障', value: taskSummary.failed, color: '#ff4d4f', bg: '#fff1f0' }
|
{ label: '故障', value: taskSummary.failed, color: '#ff4d4f', bg: '#fff1f0' }
|
||||||
@@ -282,7 +294,7 @@ const TaskMonitorPage: React.FC = () => {
|
|||||||
))}
|
))}
|
||||||
</Row>
|
</Row>
|
||||||
<div style={{ marginTop: 16 }}>
|
<div style={{ marginTop: 16 }}>
|
||||||
{taskList.slice(0, 2).map((task, idx) => (
|
{taskPoolList.slice(0, 2).map((task, idx) => (
|
||||||
<div key={idx} style={{ background: '#f8faff', padding: '10px 12px', borderRadius: 8, marginBottom: 8, border: '1px solid #e6f7ff' }}>
|
<div key={idx} style={{ background: '#f8faff', padding: '10px 12px', borderRadius: 8, marginBottom: 8, border: '1px solid #e6f7ff' }}>
|
||||||
<div style={{ display: 'flex', justifyContent: 'space-between', fontSize: 13, marginBottom: 4 }}>
|
<div style={{ display: 'flex', justifyContent: 'space-between', fontSize: 13, marginBottom: 4 }}>
|
||||||
<span style={{ fontWeight: 500, color: '#262626' }}>{task.planName}</span>
|
<span style={{ fontWeight: 500, color: '#262626' }}>{task.planName}</span>
|
||||||
@@ -291,7 +303,7 @@ const TaskMonitorPage: React.FC = () => {
|
|||||||
<Progress percent={Math.floor(Math.random() * 40 + 60)} size="small" showInfo={false} strokeColor="#1890ff" />
|
<Progress percent={Math.floor(Math.random() * 40 + 60)} size="small" showInfo={false} strokeColor="#1890ff" />
|
||||||
<div style={{ fontSize: 11, color: '#8c8c8c', marginTop: 4 }}>
|
<div style={{ fontSize: 11, color: '#8c8c8c', marginTop: 4 }}>
|
||||||
<Clock size={10} style={{ marginRight: 4 }} />
|
<Clock size={10} style={{ marginRight: 4 }} />
|
||||||
{dayjs(task.createTime).format('HH:mm:ss')} 下发
|
{dayjs(task.createTime).format('YY-MM-DD HH:mm:ss')} 下发
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
|
|||||||
Reference in New Issue
Block a user