|  |  | 
 |  |  | import MyExportButton from '../../components/MyExportButton'; | 
 |  |  | import PageDrawer from "../../components/PageDrawer"; | 
 |  |  | import request from '@/utils/request'; | 
 |  |  | import MyField from "@/page/components/MyField"; | 
 |  |  | import QlyIsptItemResult from "./QlyIsptItemResult"; | 
 |  |  | import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_ITEM_PAGE_SIZE } from '@/config/setting'; | 
 |  |  |  | 
 |  |  | const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({ | 
 |  |  | 
 |  |  |     <TextInput source="splrName" label="table.field.qlyIsptItem.splrName" />, | 
 |  |  |     <TextInput source="splrBatch" label="table.field.qlyIsptItem.splrBatch" />, | 
 |  |  |     <TextInput source="stockBatch" label="table.field.qlyIsptItem.stockBatch" />, | 
 |  |  |     <TextInput source="platOrderCode" label="table.field.asnOrderItem.platOrderCode" />, | 
 |  |  |     <TextInput source="platWorkCode" label="table.field.asnOrderItem.platWorkCode" />, | 
 |  |  |     <TextInput source="projectCode" label="table.field.asnOrderItem.projectCode" />, | 
 |  |  |     <NumberInput source="rcptQty" label="table.field.qlyIsptItem.rcptQty" />, | 
 |  |  |     <NumberInput source="dlyQty" label="table.field.qlyIsptItem.dlyQty" />, | 
 |  |  |     <NumberInput source="disQty" label="table.field.qlyIsptItem.disQty" />, | 
 |  |  | 
 |  |  |     const translate = useTranslate(); | 
 |  |  |     const [createDialog, setCreateDialog] = useState(false); | 
 |  |  |     const [drawerVal, setDrawerVal] = useState(false); | 
 |  |  |     const [itemInfo, setItemInfo] = useState({}) | 
 |  |  |     const isptId = useGetRecordId(); | 
 |  |  |     const { data: dicts, isPending, error } = useGetOne('qlyInspect', { id: isptId }); | 
 |  |  |     if (dicts == null) { return } | 
 |  |  | 
 |  |  |     return ( | 
 |  |  |         <Box display="flex"> | 
 |  |  |             <List | 
 |  |  |                 storeKey="qlyIsptItem" | 
 |  |  |                 resource="qlyIsptItem" | 
 |  |  |                 filter={{ ispectId: isptId }} | 
 |  |  |                 sx={{ | 
 |  |  |                     flexGrow: 1, | 
 |  |  |                     transition: (theme) => | 
 |  |  |                         theme.transitions.create(['all'], { | 
 |  |  |                             duration: theme.transitions.duration.enteringScreen, | 
 |  |  |                         }), | 
 |  |  |                     marginRight: drawerVal ? `${PAGE_DRAWER_WIDTH}px` : 0, | 
 |  |  |                 }} | 
 |  |  |                 title={"menu.qlyIsptItem"} | 
 |  |  |                 empty={false} | 
 |  |  |                 filters={filters} | 
 |  |  | 
 |  |  |                 )} | 
 |  |  |                 perPage={DEFAULT_ITEM_PAGE_SIZE} | 
 |  |  |             > | 
 |  |  |                <DynamicFields /> | 
 |  |  |                 <DynamicFields | 
 |  |  |                     drawerVal={drawerVal} | 
 |  |  |                     setDrawerVal={setDrawerVal} | 
 |  |  |                     itemInfo={itemInfo} | 
 |  |  |                     setItemInfo={setItemInfo} /> | 
 |  |  |             </List> | 
 |  |  |             <QlyIsptItemCreate | 
 |  |  |                 open={createDialog} | 
 |  |  |                 record={dicts} | 
 |  |  |                 setOpen={setCreateDialog} | 
 |  |  |             /> | 
 |  |  |             <PageDrawer | 
 |  |  |                 title='QlyIsptItem Detail' | 
 |  |  |  | 
 |  |  |             <QlyIsptItemResult | 
 |  |  |                 record={itemInfo} | 
 |  |  |                 drawerVal={drawerVal} | 
 |  |  |                 setDrawerVal={setDrawerVal} | 
 |  |  |             > | 
 |  |  |             </PageDrawer> | 
 |  |  |             </QlyIsptItemResult> | 
 |  |  |         </Box> | 
 |  |  |     ) | 
 |  |  | } | 
 |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  | const DynamicFields = (props) => { | 
 |  |  |     const { drawerVal, setDrawerVal, itemInfo, setItemInfo } = props | 
 |  |  |     const translate = useTranslate(); | 
 |  |  |     const notify = useNotify(); | 
 |  |  |     const [columns, setColumns] = useState([]); | 
 |  |  | 
 |  |  |                 <TextField source="label" label="table.field.qlyIsptItem.label" />, | 
 |  |  |                 <TextField source="splrBatch" label="table.field.qlyIsptItem.splrBatch" />, | 
 |  |  |                 <TextField source="stockBatch" label="table.field.qlyIsptItem.stockBatch" />, | 
 |  |  |                 <TextField source="platOrderCode" label="table.field.asnOrderItem.platOrderCode" />, | 
 |  |  |                 <TextField source="platWorkCode" label="table.field.asnOrderItem.platWorkCode" />, | 
 |  |  |                 <TextField source="projectCode" label="table.field.asnOrderItem.projectCode" />, | 
 |  |  |                 <NumberField source="rcptQty" label="table.field.qlyIsptItem.rcptQty" />, | 
 |  |  |                 <NumberField source="dlyQty" label="table.field.qlyIsptItem.dlyQty" />, | 
 |  |  |                 <NumberField source="anfme" label="table.field.qlyIsptItem.anfme" />, | 
 |  |  |                 <MyField source="anfme" label="table.field.qlyIsptItem.anfme" | 
 |  |  |                     onClick={(event, record, val) => { | 
 |  |  |                         event.stopPropagation(); | 
 |  |  |                         setItemInfo(record) | 
 |  |  |                         setDrawerVal(!!drawerVal && drawerVal === val ? null : val); | 
 |  |  |                     }} | 
 |  |  |                 />, | 
 |  |  |                 <TextField source="splrName" label="table.field.qlyIsptItem.splrName" />, | 
 |  |  |                 <NumberField source="isptResult$" label="table.field.qlyIsptItem.isptResult" />, | 
 |  |  |             ] | 
 |  |  | 
 |  |  |                     preferenceKey='qlyIsptItem' | 
 |  |  |                     bulkActionButtons={() => <BulkDeleteButton mutationMode={OPERATE_MODE} />} | 
 |  |  |                     rowClick={false} | 
 |  |  |                     omit={['id', 'createTime', 'createBy', 'memo', 'dlyQty', 'label', 'stockBatch', 'picPath', 'ispectId', 'statusBool']} | 
 |  |  |                     omit={['id', 'createTime', 'createBy', 'memo', 'dlyQty', 'label', 'stockBatch', 'picPath', 'ispectId', 'statusBool', 'platWorkCode', 'projectCode']} | 
 |  |  |  | 
 |  |  |                 > | 
 |  |  |                     {columns.map((column) => column)} |