From 259509a4598f0516f583a4529e87c521d6f99450 Mon Sep 17 00:00:00 2001
From: zhang <zc857179121@qq.com>
Date: 星期一, 23 六月 2025 09:39:42 +0800
Subject: [PATCH] 1
---
zy-acs-flow/src/page/mission/MissionCard.jsx | 46 +++++++++++++++++++++++++++++-----------------
1 files changed, 29 insertions(+), 17 deletions(-)
diff --git a/zy-acs-flow/src/page/mission/MissionCard.jsx b/zy-acs-flow/src/page/mission/MissionCard.jsx
index 3bdfed3..99bbe5f 100644
--- a/zy-acs-flow/src/page/mission/MissionCard.jsx
+++ b/zy-acs-flow/src/page/mission/MissionCard.jsx
@@ -1,6 +1,7 @@
+import React, { useState, useEffect } from 'react';
import { Draggable } from '@hello-pangea/dnd';
-import { Box, Card, Typography, Avatar, Divider, Stack, Slider } from '@mui/material';
-import { ReferenceField, useRedirect } from 'react-admin';
+import { Box, Card, Typography, Avatar, Divider, Stack, Slider, useTheme } from '@mui/material';
+import { ReferenceField, useRedirect, useTranslate } from 'react-admin';
import { blueGrey } from '@mui/material/colors';
import { styled } from '@mui/material/styles';
@@ -20,7 +21,9 @@
);
};
-export const MissionCardContent = ({ provided, snapshot, mission, }) => {
+export const MissionCardContent = ({ provided, snapshot, mission }) => {
+ const theme = useTheme();
+ const translate = useTranslate();
const redirect = useRedirect();
const handleClick = () => {
redirect(`/mission/${mission.id}/show`, undefined, undefined, undefined, {
@@ -28,8 +31,15 @@
});
};
- console.log(mission);
+ const [sliderValue, setSliderValue] = useState(mission.progress || 0);
+ useEffect(() => {
+ setSliderValue(mission.progress || 0);
+ }, [mission.progress]);
+
+ const handleSliderChange = (event, newValue) => {
+ setSliderValue(newValue);
+ };
return (
<Box
@@ -51,10 +61,11 @@
<Box display="flex" alignItems="center" mb={1.5}>
<Avatar
sx={{
- width: 30,
- height: 30,
- bgcolor: blueGrey[500],
+ width: 40,
+ height: 28,
+ bgcolor: theme.palette.primary.main,
}}
+ variant="rounded"
>
{mission.agv}
</Avatar>
@@ -66,25 +77,26 @@
<Box>
<Stack direction="row" justifyContent="space-between" mb={1}>
<Typography variant="caption" color="textSecondary">
- Backpack: {mission.backpack}
+ {translate('table.field.mission.backpack')} : {mission.backpack}
</Typography>
<Typography variant="caption" color="textPrimary">
- Code: {mission.destCode}
+ {translate('table.field.mission.code')}: {mission.currCode}
</Typography>
</Stack>
-
- <Stack direction="row" justifyContent="space-between" mb={1}>
+ <Divider orientation="horizontal" flexItem />
+ <Stack direction="row" justifyContent="space-between" >
<Typography variant="overline">
- Task: [{mission.taskNos.join(',')}]
+ {translate('table.field.mission.task')}: [{mission.taskNos.join(',')}]
</Typography>
</Stack>
-
- <Stack pl={1} pr={1} direction="row" spacing={1} alignItems="center">
+ <Stack pl={0.5} pr={0.5} direction="row" spacing={1} alignItems="center" mb={.6}>
<Slider
- aria-label="Temperature"
- defaultValue={mission.progress}
+ aria-label="Progress"
+ // defaultValue={mission.progress}
+ value={sliderValue}
+ onChange={handleSliderChange}
getAriaValueText={(value) => {
- return `${value}掳C`;
+ return `${value}%`;
}}
color="secondary"
size="small"
--
Gitblit v1.9.1