| | |
| | | import { Dialog, DialogTitle, Box, DialogActions, DialogContent } from "@mui/material"; |
| | | import React, { useState, useRef, useEffect, useMemo, useCallback, Form } from "react"; |
| | | import { styled } from '@mui/material/styles'; |
| | | import { FilterButton, TopToolbar, Toolbar, useTranslate, SaveButton, List, SelectInput, NumberField, WrapperField, EditButton, DeleteButton, TextField, DateField, TextInput, BooleanField, NumberInput, ReferenceField, SearchInput, SelectColumnsButton, DatagridConfigurable, Button } from "react-admin"; |
| | | import { FilterButton, TopToolbar, Toolbar, useTranslate, SaveButton, List, SelectInput, NumberField, WrapperField, EditButton, DeleteButton, TextField, DateField, TextInput, BooleanField, NumberInput, ReferenceField, SearchInput, SelectColumnsButton, DatagridConfigurable, Button, useRefresh } from "react-admin"; |
| | | import DialogCloseButton from "../components/DialogCloseButton"; |
| | | import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_ITEM_PAGE_SIZE } from '@/config/setting'; |
| | | |
| | | const filters = [ |
| | | <SearchInput source="condition" alwaysOn />, |
| | | <NumberInput source="type" label="table.field.deviceSite.type" />, |
| | | <TextInput source="site" label="table.field.deviceSite.site" />, |
| | | <TextInput source="name" label="table.field.deviceSite.name" />, |
| | | <TextInput source="wcsCode" label="table.field.deviceSite.wcsCode" />, |
| | | <TextInput source="label" label="table.field.deviceSite.label" />, |
| | | <TextInput source="device" label="table.field.deviceSite.device" />, |
| | | <TextInput source="deviceCode" label="table.field.deviceSite.deviceCode" />, |
| | | <TextInput source="deviceSite" label="table.field.deviceSite.deviceSite" />, |
| | | <TextInput label="common.field.memo" source="memo" />, |
| | | <SelectInput |
| | | label="common.field.status" |
| | | source="status" |
| | | choices={[ |
| | | { id: '1', name: 'common.enums.statusTrue' }, |
| | | { id: '0', name: 'common.enums.statusFalse' }, |
| | | ]} |
| | | resettable |
| | | /> |
| | | ] |
| | | const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({ |
| | | '& .css-1vooibu-MuiSvgIcon-root': { |
| | | height: '.9em' |
| | |
| | | const { open, setOpen, record } = props; |
| | | const translate = useTranslate(); |
| | | const [drawerVal, setDrawerVal] = useState(false); |
| | | const refresh = useRefresh(); |
| | | const handleClose = (event, reason) => { |
| | | if (reason !== "backdropClick") { |
| | | setOpen(false); |
| | |
| | | }} |
| | | title={"menu.deviceSite"} |
| | | empty={false} |
| | | filters={filters} |
| | | sort={{ field: "create_time", order: "desc" }} |
| | | actions={( |
| | | <TopToolbar> |
| | | <FilterButton /> |
| | | <SelectColumnsButton preferenceKey='deviceSite' /> |
| | | </TopToolbar> |
| | | )} |
| | |
| | | <StyledDatagrid |
| | | preferenceKey='deviceSite' |
| | | bulkActionButtons={false} |
| | | rowClick={(id, resource, record) => false} |
| | | rowClick='toggleSelection' |
| | | onToggleItem={(id, resource, record)=>{ |
| | | console.log(id); |
| | | setOpen(false); |
| | | refresh(); |
| | | }} |
| | | omit={['id', 'createTime', 'createBy', 'memo', 'updateBy$', 'createBy$', 'createTime', 'updateTime']} |
| | | > |
| | | <NumberField source="id" /> |
| | |
| | | <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> |
| | | <Button label="toolbar.selectSite" onClick={(id, resource, record)=>{ |
| | | console.log(id); |
| | | setOpen(false) |
| | | refresh(); |
| | | }}/> |
| | | </WrapperField> |
| | | </StyledDatagrid> |
| | | </List> |
| | | </DialogContent> |