|  |  |  | 
|---|
|  |  |  | import { Box, Typography, Card, Stack } from '@mui/material'; | 
|---|
|  |  |  | import { styled } from '@mui/material/styles'; | 
|---|
|  |  |  | import DictTypeCreate from "./DictTypeCreate"; | 
|---|
|  |  |  | import DictTypePanel from "./DictTypePanel"; | 
|---|
|  |  |  | import EmptyData from "../../../components/EmptyData"; | 
|---|
|  |  |  | import MyCreateButton from "../../../components/MyCreateButton"; | 
|---|
|  |  |  | import MyExportButton from '../../../components/MyExportButton'; | 
|---|
|  |  |  | import PageDrawer from "../../../components/PageDrawer"; | 
|---|
|  |  |  | import MyField from "../../../components/MyField"; | 
|---|
|  |  |  | import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_PAGE_SIZE } from '@/config/setting'; | 
|---|
|  |  |  | import * as Common from '@/utils/common'; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({ | 
|---|
|  |  |  | '& .css-1vooibu-MuiSvgIcon-root': { | 
|---|
|  |  |  | 
|---|
|  |  |  | <SearchInput source="condition" alwaysOn />, | 
|---|
|  |  |  | <DateInput label='common.time.after' source="timeStart" alwaysOn />, | 
|---|
|  |  |  | <DateInput label='common.time.before' source="timeEnd" alwaysOn />, | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <TextInput source="code" label="table.field.dictType.code" />, | 
|---|
|  |  |  | <TextInput source="name" label="table.field.dictType.name" />, | 
|---|
|  |  |  | <TextInput source="description" label="table.field.dictType.description" />, | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <TextInput label="common.field.memo" source="memo" />, | 
|---|
|  |  |  | <SelectInput | 
|---|
|  |  |  | label="common.field.status" | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const DictTypeList = () => { | 
|---|
|  |  |  | const translate = useTranslate(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const [createDialog, setCreateDialog] = useState(false); | 
|---|
|  |  |  | const [drawerVal, setDrawerVal] = useState(false); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const navigate = useNavigate(); | 
|---|
|  |  |  | const assign = (record) => { | 
|---|
|  |  |  | navigate(`/dictData?dictTypeId=${record.id}`); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return ( | 
|---|
|  |  |  | <Box display="flex"> | 
|---|
|  |  |  | <List | 
|---|
|  |  |  | 
|---|
|  |  |  | theme.transitions.create(['all'], { | 
|---|
|  |  |  | duration: theme.transitions.duration.enteringScreen, | 
|---|
|  |  |  | }), | 
|---|
|  |  |  | marginRight: !!drawerVal ? `${PAGE_DRAWER_WIDTH}px` : 0, | 
|---|
|  |  |  | marginRight: drawerVal ? `${PAGE_DRAWER_WIDTH}px` : 0, | 
|---|
|  |  |  | }} | 
|---|
|  |  |  | title={"menu.dictType"} | 
|---|
|  |  |  | empty={<EmptyData onClick={() => { setCreateDialog(true) }} />} | 
|---|
|  |  |  | 
|---|
|  |  |  | <StyledDatagrid | 
|---|
|  |  |  | preferenceKey='dictType' | 
|---|
|  |  |  | bulkActionButtons={() => <BulkDeleteButton mutationMode={OPERATE_MODE} />} | 
|---|
|  |  |  | rowClick={(id, resource, record) => false} | 
|---|
|  |  |  | expand={() => <DictTypePanel />} | 
|---|
|  |  |  | expandSingle={true} | 
|---|
|  |  |  | rowClick={'edit'} | 
|---|
|  |  |  | omit={['id', 'createTime', 'createBy', 'memo']} | 
|---|
|  |  |  | > | 
|---|
|  |  |  | <NumberField source="id" /> | 
|---|
|  |  |  | <MyField source="code" label="table.field.dictType.code" | 
|---|
|  |  |  | onClick={(event, record, val) => { | 
|---|
|  |  |  | event.stopPropagation(); | 
|---|
|  |  |  | assign(record); | 
|---|
|  |  |  | }} | 
|---|
|  |  |  | <TextField source="code" label="table.field.dictType.code" | 
|---|
|  |  |  | // onClick={(event, record, val) => { | 
|---|
|  |  |  | //     event.stopPropagation(); | 
|---|
|  |  |  | //     assign(record); | 
|---|
|  |  |  | // }} | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | <TextField source="name" label="table.field.dictType.name" /> | 
|---|
|  |  |  | <TextField source="description" label="table.field.dictType.description" /> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <ReferenceField source="updateBy" label="common.field.updateBy" reference="user" link={false} sortable={false}> | 
|---|
|  |  |  | <TextField source="nickname" /> | 
|---|
|  |  |  | </ReferenceField> | 
|---|
|  |  |  | <TextField source="updateBy$" label="common.field.updateBy" /> | 
|---|
|  |  |  | <DateField source="updateTime" label="common.field.updateTime" showTime /> | 
|---|
|  |  |  | <ReferenceField source="createBy" label="common.field.createBy" reference="user" link={false} sortable={false}> | 
|---|
|  |  |  | <TextField source="nickname" /> | 
|---|
|  |  |  | </ReferenceField> | 
|---|
|  |  |  | <TextField source="createBy$" label="common.field.createBy" /> | 
|---|
|  |  |  | <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} /> | 
|---|