地图资源 全部换成 npm的资源 加快了加载速度 ,地图加了一个定位到机器的按钮,手动定位到机器 ,实时显示工作中空闲状态 机器加入显示设备类型 机器人任务界面 保存定时任务 bug修复

This commit is contained in:
mmc
2026-10-29 16:39:25 +08:00
parent 91c01e249f
commit 04f74277bf
9 changed files with 392 additions and 568 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -531,7 +531,7 @@ export default function DeviceOverviewPage() {
...d,
id: d.deviceId || index,
name: d.deviceAlias || d.deviceName || d.callsign || '未知设备',
type: d.productName || t('constants.uav'),
type: d.deviceType || "割草机",
status: d.onlineStatus === 1 ? t('devices.online') : t('devices.offline'),
mode: d.feStatus == 1 ? '作业中' : d.feStatus == 2 ? t('devices.idle') : d.mode_code == 0 ? t('devices.idle') : d.mode_code == 1 ? '现场调试' : d.mode_code == 2 ? '远程调试' : d.mode_code == 3 ? '固件升级中' : '作业中',
capacity_percent: d.capacity_percent || 100,
@@ -823,6 +823,12 @@ export default function DeviceOverviewPage() {
<span style={{ fontSize: 12 }}>v{selectedDevice.firmwareVersion}</span>
</div>
)}
{selectedDevice.deviceType && (
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
<span style={{ color: '#666', fontSize: 12 }}>{t('devices.deviceType')}</span>
<span style={{ fontSize: 12 }}>{selectedDevice.deviceType}</span>
</div>
)}
{(selectedDevice.productName?.includes(t('constants.uav')) || selectedDevice.device_sn) && (
<>
<div style={{ display: 'flex', justifyContent: 'space-between' }}>

View File

@@ -2174,138 +2174,6 @@ export default function DeviceStatusPage() {
{/* 页面顶部按钮区域 */}
{/*{!isUAV && (
<div
style={{
marginBottom: 8,
padding: '4px 0px',
background: '#f5f7fa',
borderRadius: 8,
display: 'flex',
alignItems: 'center',
justifyContent: 'space-between',
gap: 12,
}}
>
<div style={{ display: 'flex', alignItems: 'center', gap: 12 }}>
<Text strong>{t('devices.pathPlanning')}:</Text>
<Text type="secondary" style={{ color: '#8c8c8c' }}>{t('devices.markedPointsCount', { count: markedPoints?.length })}</Text>
</div>
<Space size="middle">
<Space>
<span>{t('devices.workMode')}</span>
<Switch
size="small"
checked={isLoopMode}
onChange={handleChange}
/>
<span>{isLoopMode ? t('devices.bowMode') : t('devices.abMode')}</span>
</Space>
<Button
type="primary"
onClick={handleMarkPoint}
disabled={!realtimePosition}
>
{t('devices.markPoint')}
</Button>
<Button
type="default"
onClick={handleUndoMark}
disabled={markedPoints?.length === 0}
>
{t('devices.undoMark')}
</Button>
<Button
type="default"
onClick={handleClearPoints}
>
{t('devices.clearMarks')}
</Button>
{/*<Button
type="primary"
ghost
onClick={handleComplete}
disabled={markedPoints?.length < 2}
>
{t('devices.complete')}
</Button>*/}
{/*<Button
type="primary"
onClick={handleOpenSaveModal}
//disabled={!completeFlag}
>
{t('common.save')}
</Button>
</Space>
</div>
)}}*/}
<div
@@ -2390,7 +2258,7 @@ export default function DeviceStatusPage() {
<Tag color={isUAV ? 'cyan' : 'blue'}>
{isUAV ? t('constants.uav') : t('devices.robot')}
{isUAV ? t('constants.uav') : device?.deviceType ? device?.deviceType : t('devices.robot')}
</Tag>

View File

@@ -144,10 +144,14 @@ export default function MapEditorPage() {
};
loadDevices();
}, [stationId]);
useEffect(() => {
console.log("siteMapInfoId state:", siteMapInfoId);
}, [siteMapInfoId]);
const getSiteMapInfoFn = () => {
getSiteMapInfo({ siteId: stationId }).then((res: any) => {
if (res?.code === 200 && res.data) {
setSiteMapInfoId(res.data.id ?? null);
console.log(res.data.id, "res.data.id")
setReturnPointConfigList(res?.data?.restPoints || []);
// 同时加载已保存的障碍物点(tempObstaclePoints),方便编辑
const savedObstacles = (res?.data?.tempObstaclePoints || []).map((op: any) => ({
@@ -161,12 +165,16 @@ export default function MapEditorPage() {
} else {
setSiteMapInfoId(null);
console.log("res.data.id111")
setReturnPointConfigList([]);
setObstaclePointConfigList([]);
}
}).catch(() => {
setSiteMapInfoId(null);
console.log("res.data.id112221")
setReturnPointConfigList([]);
setObstaclePointConfigList([]);
@@ -737,7 +745,8 @@ export default function MapEditorPage() {
const handleObstacleRadiusChange = async (
index: number,
radius: number
radius: number,
siteMapInfoId: number | null
) => {
console.log("nextList")
@@ -749,6 +758,7 @@ export default function MapEditorPage() {
? { ...item, radius: roundedRadius }
: item
);
console.log(nextList, "333", siteMapInfoId, "siteMapInfoIdnextList")
const payload = {
id: siteMapInfoId,
tempObstaclePoints: nextList?.map((item) => ({
@@ -1097,6 +1107,8 @@ export default function MapEditorPage() {
onObstacleRadiusChange={handleObstacleRadiusChange}
siteMapInfoId={siteMapInfoId}
/>

View File

@@ -1400,23 +1400,21 @@ export default function RobotTaskPage() {
rules = { type: 'MONTH', dayOfMonth: scheduleForm.dayOfMonth, dayTime: scheduleForm.dayTime };
}
let success = true;
for (const sn of dispatchRobotSns) {
for (const route of routes) {
const finalData = {
deviceId: sn,
orgId: currentStation?.orgId,
planName: scheduleForm.planName,
routeId: route.id,
siteId: stationId,
deviceTaskPlanRules: rules,
startTime: scheduleForm.excuteDayStartTime,
finishTime: scheduleForm.excuteDayEndTime,
};
const res = await saveDeviceTask(finalData);
if (res.code !== 200) {
success = false;
utils.message.error(res.msg || t('devices.createFailed'));
}
for (const route of routes) {
const finalData = {
deviceId: dispatchRobotSns,
orgId: currentStation?.orgId,
planName: scheduleForm.planName,
routeId: route.id,
siteId: stationId,
deviceTaskPlanRules: rules,
startTime: scheduleForm.excuteDayStartTime,
finishTime: scheduleForm.excuteDayEndTime,
};
const res = await saveDeviceTask(finalData);
if (res.code !== 200) {
success = false;
utils.message.error(res.msg || t('devices.createFailed'));
}
}
if (success) {

View File

@@ -162,6 +162,14 @@ export default class DeviceController {
if (msg?.type == 'device_status_changed') {
this.deviceStatusChangedMsg?.(msg);
}
if (msg?.type == 'route_post') {
console.log('route_post');
this.onRoutePost?.(msg);
}
};
ws.onerror = () => {
@@ -508,7 +516,7 @@ export default class DeviceController {
break;
case 'route_post':
console.log('route post:', msg);
console.log('route_post:', msg);
if (msg.deviceId) {
this.onRoutePost?.(msg);
}

View File

@@ -2701,7 +2701,7 @@ const zh = {
addRule: '新增规则',
editRule: '编辑规则',
viewRule: '查看规则',
operator: '比较运算符',
//operator: '比较运算符',
invalidJson: '动作参数 JSON 格式不正确',
confirmDeleteRule: '确定删除规则「{{name}}」吗?',
flvPlaybackError: 'FLV 播放出错',