From 351f8191a009e12b66e1215eaac70f3857a9b504 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期二, 24 九月 2024 12:51:45 +0800
Subject: [PATCH] #

---
 zy-acs-flow/src/page/bus/BusList.jsx |   41 ++++++++++++++++++++++++++++++++++++-----
 1 files changed, 36 insertions(+), 5 deletions(-)

diff --git a/zy-acs-flow/src/page/bus/BusList.jsx b/zy-acs-flow/src/page/bus/BusList.jsx
index 0222839..ab39add 100644
--- a/zy-acs-flow/src/page/bus/BusList.jsx
+++ b/zy-acs-flow/src/page/bus/BusList.jsx
@@ -33,7 +33,7 @@
     FunctionField,
     Pagination,
 } from 'react-admin';
-import { Box, Typography, Card, Chip } from '@mui/material';
+import { Box, Typography, Button, Chip } from '@mui/material';
 import { styled } from '@mui/material/styles';
 import BusCreate from "./BusCreate";
 import BusPanel from "./BusPanel";
@@ -46,6 +46,9 @@
 import * as Common from '@/utils/common';
 import BusListAside from "./BusListAside";
 import { getBusStsColor } from '@/utils/color-util';
+import CancelIcon from '@mui/icons-material/Cancel';
+import request from '@/utils/request';
+import ConfirmButton from "../components/ConfirmButton";
 
 const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({
     '& .css-1vooibu-MuiSvgIcon-root': {
@@ -67,7 +70,7 @@
         whiteSpace: 'nowrap',
     },
     '& .opt': {
-        width: 80
+        width: 120
     },
 }));
 
@@ -98,6 +101,11 @@
     const [createDialog, setCreateDialog] = useState(false);
     const [drawerVal, setDrawerVal] = useState(false);
 
+    const onCancel = (busId) => {
+        console.log(busId);
+
+    }
+
     return (
         <Box display="flex">
             <List
@@ -112,7 +120,7 @@
                 title={"menu.bus"}
                 empty={<EmptyData onClick={() => { setCreateDialog(true) }} />}
                 filters={filters}
-                sort={{ field: "create_time", order: "asc" }}
+                sort={{ field: "create_time", order: "desc" }}
                 actions={(
                     <TopToolbar>
                         <FilterButton />
@@ -164,8 +172,31 @@
                     {/* <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) && (
-                            <DeleteButton label="" sx={{ padding: '1px', fontSize: '.75rem' }} mutationMode={OPERATE_MODE} />
+                        (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>
+                            <ConfirmButton
+                                label="ra.action.cancel"
+                                size="small"
+                                color="error"
+                                startIcon={<CancelIcon />}
+                                sx={{ padding: '1px', fontSize: '.75rem' }}
+                                data={record.busNo}
+                                onConfirm={() => {
+                                    onCancel(record.id);
+                                }}
+                            />
                         )
                     )} />
                 </StyledDatagrid>

--
Gitblit v1.9.1