#
luxiaotao1123
2024-09-24 351f8191a009e12b66e1215eaac70f3857a9b504
zy-acs-flow/src/page/bus/BusList.jsx
@@ -31,8 +31,9 @@
    AutocompleteInput,
    DeleteButton,
    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";
@@ -45,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': {
@@ -66,7 +70,7 @@
        whiteSpace: 'nowrap',
    },
    '& .opt': {
        width: 200
        width: 120
    },
}));
@@ -97,6 +101,11 @@
    const [createDialog, setCreateDialog] = useState(false);
    const [drawerVal, setDrawerVal] = useState(false);
    const onCancel = (busId) => {
        console.log(busId);
    }
    return (
        <Box display="flex">
            <List
@@ -120,6 +129,7 @@
                        <MyExportButton />
                    </TopToolbar>
                )}
                pagination={<Pagination rowsPerPageOptions={[10, 20, 50, 100]} />}
                perPage={20}
            // aside={<BusListAside />}
            >
@@ -134,7 +144,7 @@
                    <NumberField source="id" />
                    <TextField source="uuid" label="table.field.bus.uuid" />
                    <TextField source="busNo" label="table.field.bus.busNo" />
                    <ReferenceField source="busSts" label="table.field.bus.busSts" reference="busSts" link={false} sortable={false}>
                    <ReferenceField source="busSts" label="table.field.bus.busSts" reference="busSts" link={false} sortable={true}>
                        <FunctionField render={record => (
                            <Chip
                                label={record.name}
@@ -161,10 +171,34 @@
                    <DateField source="createTime" label="common.field.createTime" showTime />
                    {/* <BooleanField source="statusBool" label="common.field.status" sortable={false} /> */}
                    <TextField source="memo" label="common.field.memo" sortable={false} emptyText="-" />
                    <WrapperField cellClassName="opt" label="common.field.opt">
                        <EditButton sx={{ padding: '1px', fontSize: '.75rem' }} />
                        <DeleteButton sx={{ padding: '1px', fontSize: '.75rem' }} mutationMode={OPERATE_MODE} />
                    </WrapperField>
                    <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>
                            <ConfirmButton
                                label="ra.action.cancel"
                                size="small"
                                color="error"
                                startIcon={<CancelIcon />}
                                sx={{ padding: '1px', fontSize: '.75rem' }}
                                data={record.busNo}
                                onConfirm={() => {
                                    onCancel(record.id);
                                }}
                            />
                        )
                    )} />
                </StyledDatagrid>
            </List>
            <BusCreate