|  |  | 
 |  |  | import React, { useState, useRef, useEffect, useMemo, useCallback } from "react"; | 
 |  |  | import { useNavigate } from 'react-router-dom'; | 
 |  |  | import React, { | 
 |  |  |   useState, | 
 |  |  |   useRef, | 
 |  |  |   useEffect, | 
 |  |  |   useMemo, | 
 |  |  |   useCallback, | 
 |  |  | } from "react"; | 
 |  |  | import { useNavigate } from "react-router-dom"; | 
 |  |  | import { | 
 |  |  |     List, | 
 |  |  |     DatagridConfigurable, | 
 |  |  |     SearchInput, | 
 |  |  |     TopToolbar, | 
 |  |  |     SelectColumnsButton, | 
 |  |  |     EditButton, | 
 |  |  |     FilterButton, | 
 |  |  |     CreateButton, | 
 |  |  |     ExportButton, | 
 |  |  |     BulkDeleteButton, | 
 |  |  |     WrapperField, | 
 |  |  |     useRecordContext, | 
 |  |  |     useTranslate, | 
 |  |  |     useNotify, | 
 |  |  |     useListContext, | 
 |  |  |     FunctionField, | 
 |  |  |     TextField, | 
 |  |  |     NumberField, | 
 |  |  |     DateField, | 
 |  |  |     BooleanField, | 
 |  |  |     ReferenceField, | 
 |  |  |     TextInput, | 
 |  |  |     DateTimeInput, | 
 |  |  |     DateInput, | 
 |  |  |     SelectInput, | 
 |  |  |     NumberInput, | 
 |  |  |     ReferenceInput, | 
 |  |  |     ReferenceArrayInput, | 
 |  |  |     AutocompleteInput, | 
 |  |  |     DeleteButton, | 
 |  |  | } from 'react-admin'; | 
 |  |  | import { Box, Typography, Card, Stack } from '@mui/material'; | 
 |  |  | import { styled } from '@mui/material/styles'; | 
 |  |  |   List, | 
 |  |  |   DatagridConfigurable, | 
 |  |  |   SearchInput, | 
 |  |  |   TopToolbar, | 
 |  |  |   SelectColumnsButton, | 
 |  |  |   EditButton, | 
 |  |  |   FilterButton, | 
 |  |  |   CreateButton, | 
 |  |  |   ExportButton, | 
 |  |  |   BulkDeleteButton, | 
 |  |  |   WrapperField, | 
 |  |  |   useRecordContext, | 
 |  |  |   useTranslate, | 
 |  |  |   useNotify, | 
 |  |  |   useListContext, | 
 |  |  |   FunctionField, | 
 |  |  |   TextField, | 
 |  |  |   NumberField, | 
 |  |  |   DateField, | 
 |  |  |   BooleanField, | 
 |  |  |   ReferenceField, | 
 |  |  |   TextInput, | 
 |  |  |   DateTimeInput, | 
 |  |  |   DateInput, | 
 |  |  |   SelectInput, | 
 |  |  |   NumberInput, | 
 |  |  |   ReferenceInput, | 
 |  |  |   ReferenceArrayInput, | 
 |  |  |   AutocompleteInput, | 
 |  |  |   DeleteButton, | 
 |  |  | } from "react-admin"; | 
 |  |  | import { Box, Typography, Card, Stack } from "@mui/material"; | 
 |  |  | import { styled } from "@mui/material/styles"; | 
 |  |  | import SerialRuleCreate from "./SerialRuleCreate"; | 
 |  |  | import SerialRulePanel from "./SerialRulePanel"; | 
 |  |  | import EmptyData from "../../components/EmptyData"; | 
 |  |  | import MyCreateButton from "../../components/MyCreateButton"; | 
 |  |  | import MyExportButton from '../../components/MyExportButton'; | 
 |  |  | 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 { | 
 |  |  |   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': { | 
 |  |  |         height: '.9em' | 
 |  |  |     }, | 
 |  |  |     '& .RaDatagrid-row': { | 
 |  |  |         cursor: 'auto' | 
 |  |  |     }, | 
 |  |  |     '& .column-name': { | 
 |  |  |     }, | 
 |  |  |     '& .opt': { | 
 |  |  |         width: 200 | 
 |  |  |     }, | 
 |  |  |   "& .css-1vooibu-MuiSvgIcon-root": { | 
 |  |  |     height: ".9em", | 
 |  |  |   }, | 
 |  |  |   "& .RaDatagrid-row": { | 
 |  |  |     cursor: "auto", | 
 |  |  |   }, | 
 |  |  |   "& .column-name": {}, | 
 |  |  |   "& .opt": { | 
 |  |  |     width: 200, | 
 |  |  |   }, | 
 |  |  | })); | 
 |  |  |  | 
 |  |  | const filters = [ | 
 |  |  |     <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.serialRule.code" />, | 
 |  |  |     <TextInput source="name" label="table.field.serialRule.name" />, | 
 |  |  |     <TextInput source="delimit" label="table.field.serialRule.delimit" />, | 
 |  |  |     <TextInput source="reset" label="table.field.serialRule.reset" />, | 
 |  |  |     <TextInput source="resetDep" label="table.field.serialRule.resetDep" />, | 
 |  |  |     <TextInput source="currValue" label="table.field.serialRule.currValue" />, | 
 |  |  |     <TextInput source="lastCode" label="table.field.serialRule.lastCode" />, | 
 |  |  |  | 
 |  |  |     <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 | 
 |  |  |     />, | 
 |  |  | ] | 
 |  |  |   <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.serialRule.code" />, | 
 |  |  |   <TextInput source="name" label="table.field.serialRule.name" />, | 
 |  |  |   <TextInput source="delimit" label="table.field.serialRule.delimit" />, | 
 |  |  |   <TextInput source="reset" label="table.field.serialRule.reset" />, | 
 |  |  |   <TextInput source="resetDep" label="table.field.serialRule.resetDep" />, | 
 |  |  |   <TextInput source="currValue" label="table.field.serialRule.currValue" />, | 
 |  |  |   <TextInput source="lastCode" label="table.field.serialRule.lastCode" />, | 
 |  |  |   <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 SerialRuleList = () => { | 
 |  |  |     const translate = useTranslate(); | 
 |  |  |   const translate = useTranslate(); | 
 |  |  |  | 
 |  |  |     const [createDialog, setCreateDialog] = useState(false); | 
 |  |  |     const [drawerVal, setDrawerVal] = useState(false); | 
 |  |  |   const [createDialog, setCreateDialog] = useState(false); | 
 |  |  |   const [drawerVal, setDrawerVal] = useState(false); | 
 |  |  |   const [detailDialog, setDetailDialog] = useState(false); | 
 |  |  |   const dicts = JSON.parse(localStorage.getItem('sys_dicts'))?.filter(dict => (dict.dictTypeCode == 'sys_rule_item_type')) || []; | 
 |  |  |  | 
 |  |  |     return ( | 
 |  |  |         <Box display="flex"> | 
 |  |  |             <List | 
 |  |  |                 sx={{ | 
 |  |  |                     flexGrow: 1, | 
 |  |  |                     transition: (theme) => | 
 |  |  |                         theme.transitions.create(['all'], { | 
 |  |  |                             duration: theme.transitions.duration.enteringScreen, | 
 |  |  |                         }), | 
 |  |  |                     marginRight: !!drawerVal ? `${PAGE_DRAWER_WIDTH}px` : 0, | 
 |  |  |                 }} | 
 |  |  |                 title={"menu.serialRule"} | 
 |  |  |                 empty={<EmptyData onClick={() => { setCreateDialog(true) }} />} | 
 |  |  |                 filters={filters} | 
 |  |  |                 sort={{ field: "create_time", order: "desc" }} | 
 |  |  |                 actions={( | 
 |  |  |                     <TopToolbar> | 
 |  |  |                         <FilterButton /> | 
 |  |  |                         <MyCreateButton onClick={() => { setCreateDialog(true) }} /> | 
 |  |  |                         <SelectColumnsButton preferenceKey='serialRule' /> | 
 |  |  |                         <MyExportButton /> | 
 |  |  |                     </TopToolbar> | 
 |  |  |                 )} | 
 |  |  |                 perPage={DEFAULT_PAGE_SIZE} | 
 |  |  |             > | 
 |  |  |                 <StyledDatagrid | 
 |  |  |                     preferenceKey='serialRule' | 
 |  |  |                     bulkActionButtons={() => <BulkDeleteButton mutationMode={OPERATE_MODE} />} | 
 |  |  |                     rowClick={(id, resource, record) => false} | 
 |  |  |                     expand={() => <SerialRulePanel />} | 
 |  |  |                     expandSingle={true} | 
 |  |  |                     omit={['id', 'createTime', 'createBy', 'memo']} | 
 |  |  |                 > | 
 |  |  |                     <NumberField source="id" /> | 
 |  |  |                     <TextField source="code" label="table.field.serialRule.code" /> | 
 |  |  |                     <TextField source="name" label="table.field.serialRule.name" /> | 
 |  |  |                     <TextField source="delimit" label="table.field.serialRule.delimit" /> | 
 |  |  |                     <TextField source="reset" label="table.field.serialRule.reset" /> | 
 |  |  |                     <TextField source="resetDep" label="table.field.serialRule.resetDep" /> | 
 |  |  |                     <TextField source="currValue" label="table.field.serialRule.currValue" /> | 
 |  |  |                     <TextField source="lastCode" label="table.field.serialRule.lastCode" /> | 
 |  |  |   // const navigate = useNavigate(); | 
 |  |  |   // const assign = (record) => { | 
 |  |  |   //   navigate(`/serialRuleItem?ruleId=${record.id}`); | 
 |  |  |   // }; | 
 |  |  |  | 
 |  |  |                     <ReferenceField 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" label="common.field.createBy" reference="user" link={false} sortable={false}> | 
 |  |  |                         <TextField source="nickname" /> | 
 |  |  |                     </ReferenceField> | 
 |  |  |                     <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} /> | 
 |  |  |                     </WrapperField> | 
 |  |  |                 </StyledDatagrid> | 
 |  |  |             </List> | 
 |  |  |             <SerialRuleCreate | 
 |  |  |                 open={createDialog} | 
 |  |  |                 setOpen={setCreateDialog} | 
 |  |  |   return ( | 
 |  |  |     <Box display="flex"> | 
 |  |  |       <List | 
 |  |  |         sx={{ | 
 |  |  |           flexGrow: 1, | 
 |  |  |           transition: (theme) => | 
 |  |  |             theme.transitions.create(["all"], { | 
 |  |  |               duration: theme.transitions.duration.enteringScreen, | 
 |  |  |             }), | 
 |  |  |           marginRight: drawerVal ? `${PAGE_DRAWER_WIDTH}px` : 0, | 
 |  |  |         }} | 
 |  |  |         title={"menu.serialRule"} | 
 |  |  |         empty={ | 
 |  |  |           <EmptyData | 
 |  |  |             onClick={() => { | 
 |  |  |               setCreateDialog(true); | 
 |  |  |             }} | 
 |  |  |           /> | 
 |  |  |         } | 
 |  |  |         filters={filters} | 
 |  |  |         sort={{ field: "create_time", order: "desc" }} | 
 |  |  |         actions={ | 
 |  |  |           <TopToolbar> | 
 |  |  |             <FilterButton /> | 
 |  |  |             <MyCreateButton | 
 |  |  |               onClick={() => { | 
 |  |  |                 setCreateDialog(true); | 
 |  |  |               }} | 
 |  |  |             /> | 
 |  |  |             <PageDrawer | 
 |  |  |                 title='SerialRule Detail' | 
 |  |  |                 drawerVal={drawerVal} | 
 |  |  |                 setDrawerVal={setDrawerVal} | 
 |  |  |             > | 
 |  |  |             </PageDrawer> | 
 |  |  |         </Box> | 
 |  |  |     ) | 
 |  |  | } | 
 |  |  |             <SelectColumnsButton preferenceKey="serialRule" /> | 
 |  |  |             <MyExportButton /> | 
 |  |  |           </TopToolbar> | 
 |  |  |         } | 
 |  |  |         perPage={DEFAULT_PAGE_SIZE} | 
 |  |  |       > | 
 |  |  |         <StyledDatagrid | 
 |  |  |           preferenceKey="serialRule" | 
 |  |  |           bulkActionButtons={() => ( | 
 |  |  |             <BulkDeleteButton mutationMode={OPERATE_MODE} /> | 
 |  |  |           )} | 
 |  |  |           rowClick={'edit'} | 
 |  |  |           omit={["id", "createTime", "createBy", "memo"]} | 
 |  |  |         > | 
 |  |  |           <NumberField source="id" /> | 
 |  |  |           <TextField source="code" label="table.field.serialRule.code" /> | 
 |  |  |           <TextField source="name" label="table.field.serialRule.name" /> | 
 |  |  |           <TextField source="delimit" label="table.field.serialRule.delimit" /> | 
 |  |  |           <TextField label="table.field.serialRule.reset"  source="reset$" /> | 
 |  |  |           <TextField | 
 |  |  |             source="resetDep" | 
 |  |  |             label="table.field.serialRule.resetDep" | 
 |  |  |           /> | 
 |  |  |           <TextField | 
 |  |  |             source="currValue" | 
 |  |  |             label="table.field.serialRule.currValue" | 
 |  |  |           /> | 
 |  |  |           <TextField | 
 |  |  |             source="lastCode" | 
 |  |  |             label="table.field.serialRule.lastCode" | 
 |  |  |           /> | 
 |  |  |  | 
 |  |  |           <TextField | 
 |  |  |             source="updateBy$" | 
 |  |  |             label="common.field.updateBy" | 
 |  |  |           /> | 
 |  |  |           <DateField | 
 |  |  |             source="updateTime" | 
 |  |  |             label="common.field.updateTime" | 
 |  |  |             showTime | 
 |  |  |           /> | 
 |  |  |           <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} | 
 |  |  |             /> | 
 |  |  |           </WrapperField> | 
 |  |  |         </StyledDatagrid> | 
 |  |  |       </List> | 
 |  |  |       <SerialRuleCreate open={createDialog} setOpen={setCreateDialog} /> | 
 |  |  |       {/* <SerialRuleDetail open={detailDialog} setOpen={setDetailDialog} /> */} | 
 |  |  |       <PageDrawer | 
 |  |  |         title="SerialRule Detail" | 
 |  |  |         drawerVal={drawerVal} | 
 |  |  |         setDrawerVal={setDrawerVal} | 
 |  |  |       ></PageDrawer> | 
 |  |  |     </Box> | 
 |  |  |   ); | 
 |  |  | }; | 
 |  |  |  | 
 |  |  | export default SerialRuleList; |