| | |
| | | ReferenceArrayInput, |
| | | AutocompleteInput, |
| | | DeleteButton, |
| | | useGetRecordId, |
| | | Button, |
| | | useRefresh, |
| | | } from 'react-admin'; |
| | | import { Box, Typography, Card, Stack } from '@mui/material'; |
| | | import { styled } from '@mui/material/styles'; |
| | | import CheckDiffItemCreate from "./CheckDiffItemCreate"; |
| | | import CheckDiffItemPanel from "./CheckDiffItemPanel"; |
| | | 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 BillStatusField from '../../../components/BillStatusField'; |
| | | import ApiOutlinedIcon from '@mui/icons-material/ApiOutlined'; |
| | | import ConfirmButton from '../../../components/ConfirmButton'; |
| | | import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_PAGE_SIZE } from '@/config/setting'; |
| | | import * as Common from '@/utils/common'; |
| | | import CheckDiffField from "../../../components/CheckDiffField"; |
| | | import CheckDiffResonDialog from "./CheckDiffResonDialog"; |
| | | import request from '@/utils/request'; |
| | | |
| | | 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 />, |
| | | |
| | | <NumberInput source="checkId" label="table.field.checkDiffItem.checkId" />, |
| | | <TextInput source="orderCode" label="table.field.checkDiffItem.orderCode" />, |
| | | <TextInput source="maktx" label="table.field.checkDiffItem.maktx" />, |
| | |
| | | <NumberInput source="checkQty" label="table.field.checkDiffItem.checkQty" />, |
| | | <NumberInput source="exceStatus" label="table.field.checkDiffItem.exceStatus" />, |
| | | <TextInput source="reason" label="table.field.checkDiffItem.reason" />, |
| | | |
| | | <TextInput label="common.field.memo" source="memo" />, |
| | | <SelectInput |
| | | label="common.field.status" |
| | |
| | | |
| | | const CheckDiffItemList = () => { |
| | | const translate = useTranslate(); |
| | | |
| | | const orderId = useGetRecordId(); |
| | | const [createDialog, setCreateDialog] = useState(false); |
| | | const [drawerVal, setDrawerVal] = useState(false); |
| | | const [waveRule, setWaveRule] = useState(false); |
| | | |
| | | //获取波次规则 |
| | | const closeDialog = async (value) => { |
| | | setWaveRule(false) |
| | | |
| | | } |
| | | |
| | | return ( |
| | | <Box display="flex"> |
| | |
| | | }), |
| | | marginRight: !!drawerVal ? `${PAGE_DRAWER_WIDTH}px` : 0, |
| | | }} |
| | | resource="checkDiffItem" |
| | | title={"menu.checkDiffItem"} |
| | | empty={<EmptyData onClick={() => { setCreateDialog(true) }} />} |
| | | empty={false} |
| | | filters={filters} |
| | | filter={{ checkId: orderId }} |
| | | sort={{ field: "create_time", order: "desc" }} |
| | | actions={( |
| | | <TopToolbar> |
| | | <FilterButton /> |
| | | <MyCreateButton onClick={() => { setCreateDialog(true) }} /> |
| | | <SelectColumnsButton preferenceKey='checkDiffItem' /> |
| | | <MyExportButton /> |
| | | </TopToolbar> |
| | |
| | | > |
| | | <StyledDatagrid |
| | | preferenceKey='checkDiffItem' |
| | | bulkActionButtons={() => <BulkDeleteButton mutationMode={OPERATE_MODE} />} |
| | | bulkActionButtons={false} |
| | | rowClick={(id, resource, record) => false} |
| | | expand={() => <CheckDiffItemPanel />} |
| | | expand={false} |
| | | expandSingle={true} |
| | | omit={['id', 'createTime', 'createBy', 'memo']} |
| | | omit={['id', 'checkId', 'createTime$', 'createBy$', 'memo']} |
| | | > |
| | | <NumberField source="id" /> |
| | | <NumberField source="checkId" label="table.field.checkDiffItem.checkId" /> |
| | | <TextField source="orderCode" label="table.field.checkDiffItem.orderCode" /> |
| | | <TextField source="maktx" label="table.field.checkDiffItem.maktx" /> |
| | | <TextField source="matnrCode" label="table.field.checkDiffItem.matnrCode" /> |
| | | <TextField source="maktx" label="table.field.checkDiffItem.maktx" /> |
| | | <TextField source="spec" label="table.field.checkDiffItem.spec" /> |
| | | <TextField source="model" label="table.field.checkDiffItem.model" /> |
| | | <TextField source="barcode" label="table.field.checkDiffItem.barcode" /> |
| | | <TextField source="batch" label="table.field.checkDiffItem.batch" /> |
| | | <NumberField source="anfme" label="table.field.checkDiffItem.anfme" /> |
| | | <NumberField source="checkQty" label="table.field.checkDiffItem.checkQty" /> |
| | | <NumberField source="exceStatus" label="table.field.checkDiffItem.exceStatus" /> |
| | | <CheckDiffField source="diffQty" label="table.field.checkDiffItem.diffQty" /> |
| | | <TextField source="reason" label="table.field.checkDiffItem.reason" /> |
| | | |
| | | <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} /> |
| | | <BillStatusField cellClassName="status" source="exceStatus$" label="table.field.checkOrder.exceStatus" /> |
| | | <WrapperField cellClassName="opt" label="common.field.opt"> |
| | | <EditButton sx={{ padding: '1px', fontSize: '.75rem' }} /> |
| | | <DeleteButton sx={{ padding: '1px', fontSize: '.75rem' }} mutationMode={OPERATE_MODE} /> |
| | | <CheckButton /> |
| | | </WrapperField> |
| | | </StyledDatagrid> |
| | | </List> |
| | | <CheckDiffItemCreate |
| | | open={createDialog} |
| | | setOpen={setCreateDialog} |
| | | /> |
| | | <PageDrawer |
| | | title='CheckDiffItem Detail' |
| | | drawerVal={drawerVal} |
| | | setDrawerVal={setDrawerVal} |
| | | > |
| | | </PageDrawer> |
| | | {/* <CheckDiffResonDialog open={waveRule} setOpen={setWaveRule} onClose={closeDialog} /> */} |
| | | </Box> |
| | | ) |
| | | } |
| | | |
| | | |
| | | const CheckButton = () => { |
| | | const record = useRecordContext(); |
| | | const notify = useNotify(); |
| | | const refresh = useRefresh(); |
| | | const handleEditClick = async () => { |
| | | record.exceStatus = 2; |
| | | const { data: { code, data, msg } } = await request.post(`/checkDiffItem/update`, record); |
| | | if (code === 200) { |
| | | notify(msg); |
| | | refresh() |
| | | } else { |
| | | notify(msg); |
| | | } |
| | | } |
| | | |
| | | return ( |
| | | record?.exceStatus != 2 ? <><ConfirmButton label={"ra.action.approved"} startIcon={<ApiOutlinedIcon />} onConfirm={handleEditClick} size={"small"} /></> : <></> |
| | | ) |
| | | } |
| | | |
| | | export default CheckDiffItemList; |