| | |
| | | AutocompleteInput, |
| | | DeleteButton, |
| | | useGetRecordId, |
| | | useGetOne, |
| | | Button, |
| | | } from "react-admin"; |
| | | import { Box, Typography, Card, Stack } from "@mui/material"; |
| | | import { styled } from "@mui/material/styles"; |
| | |
| | | } from "@/config/setting"; |
| | | import * as Common from "@/utils/common"; |
| | | import CustomerTopToolBar from "../../components/EditTopToolBar"; |
| | | import SerialRuleItemEdit from "./SerialRuleItemEdit"; |
| | | |
| | | const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({ |
| | | "& .css-1vooibu-MuiSvgIcon-root": { |
| | |
| | | const SerialRuleItemList = () => { |
| | | const translate = useTranslate(); |
| | | const [createDialog, setCreateDialog] = useState(false); |
| | | const [editDialog, setEditDialog] = useState(false); |
| | | const [drawerVal, setDrawerVal] = useState(false); |
| | | const [select, setSelect] = useState({}); |
| | | const ruleId = useGetRecordId(); |
| | | |
| | | const { data: dicts, isPending, error } = useGetOne('serialRule', { id: ruleId }); |
| | | return ( |
| | | <> |
| | | <Box display="flex"> |
| | |
| | | marginRight: drawerVal ? `${PAGE_DRAWER_WIDTH}px` : 0, |
| | | }} |
| | | title={"menu.serialRuleItem"} |
| | | empty={ |
| | | <EmptyData |
| | | onClick={() => { |
| | | setCreateDialog(true); |
| | | }} |
| | | /> |
| | | } |
| | | empty={false} |
| | | filters={filters} |
| | | filter={{ ruleId: ruleId }} |
| | | sort={{ field: "create_time", order: "desc" }} |
| | | sort={{ field: "sort", order: "asc" }} |
| | | actions={ |
| | | <TopToolbar> |
| | | <FilterButton /> |
| | |
| | | bulkActionButtons={() => ( |
| | | <BulkDeleteButton mutationMode={OPERATE_MODE} /> |
| | | )} |
| | | rowClick={false} |
| | | omit={["id", "createTime", "createBy", "memo"]} |
| | | rowClick={(id, resource, record) => { |
| | | setSelect(record) |
| | | setEditDialog(true) |
| | | }} |
| | | omit={["id", "ruleId", "createTime", "createBy", "memo"]} |
| | | > |
| | | <NumberField source="id" /> |
| | | <NumberField |
| | |
| | | source="sort" |
| | | label="table.field.serialRuleItem.sort" |
| | | /> |
| | | <ReferenceField |
| | | source="updateBy" |
| | | <TextField |
| | | source="updateBy$" |
| | | label="common.field.updateBy" |
| | | reference="user" |
| | | link={false} |
| | | sortable={false} |
| | | > |
| | | <TextField source="nickname" /> |
| | | </ReferenceField> |
| | | /> |
| | | <DateField |
| | | source="updateTime" |
| | | label="common.field.updateTime" |
| | | showTime |
| | | /> |
| | | <ReferenceField |
| | | source="createBy" |
| | | <TextField |
| | | source="createBy$" |
| | | label="common.field.createBy" |
| | | reference="user" |
| | | link={false} |
| | | sortable={false} |
| | | > |
| | | <TextField source="nickname" /> |
| | | </ReferenceField> |
| | | /> |
| | | <DateField |
| | | source="createTime" |
| | | label="common.field.createTime" |
| | |
| | | sortable={false} |
| | | /> |
| | | <WrapperField cellClassName="opt" label="common.field.opt"> |
| | | <EditButton sx={{ padding: "1px", fontSize: ".75rem" }} /> |
| | | <Button onClick={() => { |
| | | // setSelect(record) |
| | | setEditDialog(true) |
| | | }} label={'ra.action.edit'} |
| | | > </Button> |
| | | <DeleteButton |
| | | sx={{ padding: "1px", fontSize: ".75rem" }} |
| | | mutationMode={OPERATE_MODE} |
| | | redirect={'/serialRule/' + ruleId} |
| | | /> |
| | | </WrapperField> |
| | | </StyledDatagrid> |
| | | </List> |
| | | <SerialRuleItemCreate open={createDialog} setOpen={setCreateDialog} /> |
| | | <SerialRuleItemCreate open={createDialog} setOpen={setCreateDialog} record={dicts} /> |
| | | <SerialRuleItemEdit open={editDialog} setOpen={setEditDialog} record={select} /> |
| | | <PageDrawer |
| | | title="SerialRuleItem Detail" |
| | | drawerVal={drawerVal} |