| | |
| | | ReferenceArrayInput, |
| | | AutocompleteInput, |
| | | DeleteButton, |
| | | useGetRecordId, |
| | | useGetPathForRecord, |
| | | useGetOne, |
| | | } from 'react-admin'; |
| | | import { Box, Typography, Card, Stack } from '@mui/material'; |
| | | import { styled } from '@mui/material/styles'; |
| | | import DictDataCreate from "./DictDataCreate"; |
| | | import DictDataPanel from "./DictDataPanel"; |
| | | 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'; |
| | | import CustomerTopToolBar from "../../../components/EditTopToolBar"; |
| | | |
| | | |
| | | const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({ |
| | |
| | | |
| | | const filters = [ |
| | | <SearchInput source="condition" alwaysOn />, |
| | | <DateInput label='common.time.after' source="timeStart" alwaysOn />, |
| | | <DateInput label='common.time.before' source="timeEnd" alwaysOn />, |
| | | |
| | | <TextInput source="dictTypeId" label="table.field.dictData.dictTypeId" />, |
| | | <TextInput source="dictTypeCode" label="table.field.dictData.dictTypeCode" />, |
| | | <TextInput source="value" label="table.field.dictData.value" />, |
| | | <TextInput source="label" label="table.field.dictData.label" />, |
| | | <NumberInput source="sort" label="table.field.dictData.sort" />, |
| | | <TextInput source="color" label="table.field.dictData.color" />, |
| | | |
| | | // <TextInput source="color" label="table.field.dictData.color" />, |
| | | <TextInput label="common.field.memo" source="memo" />, |
| | | <SelectInput |
| | | label="common.field.status" |
| | |
| | | |
| | | const DictDataList = () => { |
| | | const translate = useTranslate(); |
| | | |
| | | const [createDialog, setCreateDialog] = useState(false); |
| | | const [drawerVal, setDrawerVal] = useState(false); |
| | | const [fit, setFilters] = useState(filters); |
| | | const location = useLocation(); |
| | | const queryParams = new URLSearchParams(location.search); |
| | | const dictTypeId = queryParams.get('dictTypeId'); |
| | | console.log(dictTypeId); |
| | | if (dictTypeId != null && dictTypeId != undefined) { |
| | | console.log(dictTypeId); |
| | | console.log(fit); |
| | | } |
| | | |
| | | const dictId = useGetRecordId(); |
| | | const {data: dicts, isPending, error} = useGetOne('dictType', {id: dictId}); |
| | | |
| | | return ( |
| | | <> |
| | | {dictTypeId && <CustomerTopToolBar backPrevious={true} />} |
| | | <Box display="flex" > |
| | | |
| | | <List |
| | | resource="dictData" |
| | | sx={{ |
| | | flexGrow: 1, |
| | | transition: (theme) => |
| | | 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.dictData"} |
| | | empty={<EmptyData onClick={() => { setCreateDialog(true) }} />} |
| | | filters={filters} |
| | | filter={dictTypeId ? { dictTypeId } : undefined} |
| | | filter={{ dictTypeId: dictId }} |
| | | sort={{ field: "create_time", order: "desc" }} |
| | | actions={( |
| | | <TopToolbar> |
| | |
| | | <StyledDatagrid |
| | | preferenceKey='dictData' |
| | | bulkActionButtons={() => <BulkDeleteButton mutationMode={OPERATE_MODE} />} |
| | | rowClick={(id, resource, record) => false} |
| | | expand={() => <DictDataPanel />} |
| | | expandSingle={true} |
| | | rowClick="edit" |
| | | omit={['id', 'createTime', 'createBy', 'memo']} |
| | | > |
| | | <NumberField source="id" /> |
| | |
| | | <TextField source="value" label="table.field.dictData.value" /> |
| | | <TextField source="label" label="table.field.dictData.label" /> |
| | | <NumberField source="sort" label="table.field.dictData.sort" /> |
| | | <TextField source="color" label="table.field.dictData.color" /> |
| | | |
| | | <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} /> |
| | | <WrapperField cellClassName="opt" label="common.field.opt"> |
| | | <EditButton sx={{ padding: '1px', fontSize: '.75rem' }} /> |
| | | <DeleteButton sx={{ padding: '1px', fontSize: '.75rem' }} mutationMode={OPERATE_MODE} /> |
| | | <EditButton sx={{ padding: '1px', fontSize: '.75rem' }} mutationMode={OPERATE_MODE} /> |
| | | <DeleteButton sx={{ padding: '1px', fontSize: '.75rem' }} mutationMode={OPERATE_MODE} redirect={"/dictType/" + dictId} /> |
| | | </WrapperField> |
| | | </StyledDatagrid> |
| | | </List> |
| | | <DictDataCreate |
| | | open={createDialog} |
| | | record={dicts} |
| | | setOpen={setCreateDialog} |
| | | /> |
| | | <PageDrawer |