From 7f70cb15d035f0c233b9e62b9e43aa985317c908 Mon Sep 17 00:00:00 2001 From: luxiaotao1123 <t1341870251@163.com> Date: 星期一, 04 十一月 2024 10:22:45 +0800 Subject: [PATCH] # --- zy-acs-flow/src/page/bus/BusList.jsx | 37 +++++++++++++++++++------------------ 1 files changed, 19 insertions(+), 18 deletions(-) diff --git a/zy-acs-flow/src/page/bus/BusList.jsx b/zy-acs-flow/src/page/bus/BusList.jsx index ab39add..d411899 100644 --- a/zy-acs-flow/src/page/bus/BusList.jsx +++ b/zy-acs-flow/src/page/bus/BusList.jsx @@ -32,6 +32,8 @@ DeleteButton, FunctionField, Pagination, + useNotify, + useRefresh, } from 'react-admin'; import { Box, Typography, Button, Chip } from '@mui/material'; import { styled } from '@mui/material/styles'; @@ -61,6 +63,9 @@ minWidth: '16em', }, '& .column-tasksNum': { + maxWidth: '8em', + }, + '& .column-tasksNumTotal': { maxWidth: '8em', }, '& .column-memo': { @@ -97,13 +102,21 @@ const BusList = () => { const translate = useTranslate(); - + const notify = useNotify(); + const refresh = useRefresh(); const [createDialog, setCreateDialog] = useState(false); const [drawerVal, setDrawerVal] = useState(false); const onCancel = (busId) => { - console.log(busId); - + request.get("/bus/cancel/" + busId).then(res => { + const { code, msg, data } = res.data; + if (code === 200) { + notify(msg || 'common.response.success', { type: 'success', messageArgs: { _: msg } }); + refresh(); + } else { + notify(msg || 'common.response.fail', { type: 'error', messageArgs: { _: msg } }); + } + }) } return ( @@ -156,7 +169,8 @@ )} /> {/* <TextField source="name" /> */} </ReferenceField> - <NumberField source="tasksNum" label="table.field.bus.tasksNum" sortable={false} /> + <NumberField source="tasksNum" label="table.field.bus.tasksNum" sortable={false} sx={{ fontWeight: 'bold' }} /> + <NumberField source="tasksNumTotal" label="table.field.bus.tasksNumTotal" sortable={false} sx={{ fontWeight: 'bold' }} /> <DateField source="startTime" label="table.field.bus.startTime" showTime /> <DateField source="endTime" label="table.field.bus.endTime" showTime emptyText="-" /> <TextField source="phase" label="table.field.bus.phase" sortable={false} /> @@ -172,20 +186,7 @@ {/* <BooleanField source="statusBool" label="common.field.status" sortable={false} /> */} <TextField source="memo" label="common.field.memo" sortable={false} emptyText="-" /> <FunctionField label="common.field.opt" cellClassName="opt" render={record => ( - (record.busSts === 15 || true) && ( - // <DeleteButton label="" sx={{ padding: '1px', fontSize: '.75rem' }} mutationMode={OPERATE_MODE} /> - // <Button - // size="small" - // color="error" - // startIcon={<CancelIcon />} - // sx={{ padding: '1px', fontSize: '.75rem' }} - // onClick={(event) => { - // event.stopPropagation(); - // onCancel(record); - // }} - // > - // {translate('ra.action.cancel')} - // </Button> + (record.busSts === 15) && ( <ConfirmButton label="ra.action.cancel" size="small" -- Gitblit v1.9.1