|  |  |  | 
|---|
|  |  |  | 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, | 
|---|
|  |  |  | List, | 
|---|
|  |  |  | DatagridConfigurable, | 
|---|
|  |  |  | SearchInput, | 
|---|
|  |  |  | TopToolbar, | 
|---|
|  |  |  | SelectColumnsButton, | 
|---|
|  |  |  | EditButton, | 
|---|
|  |  |  | FilterButton, | 
|---|
|  |  |  | CreateButton, | 
|---|
|  |  |  | ExportButton, | 
|---|
|  |  |  | BulkDeleteButton, | 
|---|
|  |  |  | WrapperField, | 
|---|
|  |  |  | useRecordContext, | 
|---|
|  |  |  | useTranslate, | 
|---|
|  |  |  | useNotify, | 
|---|
|  |  |  | useRefresh, | 
|---|
|  |  |  | useListContext, | 
|---|
|  |  |  | FunctionField, | 
|---|
|  |  |  | TextField, | 
|---|
|  |  |  | NumberField, | 
|---|
|  |  |  | DateField, | 
|---|
|  |  |  | BooleanField, | 
|---|
|  |  |  | ReferenceField, | 
|---|
|  |  |  | TextInput, | 
|---|
|  |  |  | DateTimeInput, | 
|---|
|  |  |  | DateInput, | 
|---|
|  |  |  | SelectInput, | 
|---|
|  |  |  | NumberInput, | 
|---|
|  |  |  | ReferenceInput, | 
|---|
|  |  |  | ReferenceArrayInput, | 
|---|
|  |  |  | AutocompleteInput, | 
|---|
|  |  |  | DeleteButton, | 
|---|
|  |  |  | Button, | 
|---|
|  |  |  | } from 'react-admin'; | 
|---|
|  |  |  | import { Box, Typography, Card, Stack } from '@mui/material'; | 
|---|
|  |  |  | import { styled } from '@mui/material/styles'; | 
|---|
|  |  |  | import AsnOrderCreate from "./AsnOrderCreate"; | 
|---|
|  |  |  | import AsnOrderModal from "./AsnOrderModal"; | 
|---|
|  |  |  | import AsnOrderPanel from "./AsnOrderPanel"; | 
|---|
|  |  |  | import EmptyData from "../components/EmptyData"; | 
|---|
|  |  |  | import MyCreateButton from "../components/MyCreateButton"; | 
|---|
|  |  |  | 
|---|
|  |  |  | import MyField from "../components/MyField"; | 
|---|
|  |  |  | import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_PAGE_SIZE } from '@/config/setting'; | 
|---|
|  |  |  | import * as Common from '@/utils/common'; | 
|---|
|  |  |  | import ConstructionIcon from "@mui/icons-material/Construction"; | 
|---|
|  |  |  | import FileDownloadIcon from '@mui/icons-material/FileDownload'; | 
|---|
|  |  |  | import EditIcon from '@mui/icons-material/Edit'; | 
|---|
|  |  |  | import request from '@/utils/request'; | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 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 />, | 
|---|
|  |  |  | <SearchInput source="condition" alwaysOn />, | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <TextInput source="code" label="table.field.asnOrder.code" />, | 
|---|
|  |  |  | <TextInput source="poCode" label="table.field.asnOrder.poCode" />, | 
|---|
|  |  |  | <NumberInput source="poId" label="table.field.asnOrder.poId" />, | 
|---|
|  |  |  | <TextInput source="type" label="table.field.asnOrder.type" />, | 
|---|
|  |  |  | <TextInput source="wkType" label="table.field.asnOrder.wkType" />, | 
|---|
|  |  |  | <NumberInput source="anfme" label="table.field.asnOrder.anfme" />, | 
|---|
|  |  |  | <NumberInput source="qty" label="table.field.asnOrder.qty" />, | 
|---|
|  |  |  | <TextInput source="logisNo" label="table.field.asnOrder.logisNo" />, | 
|---|
|  |  |  | <DateInput source="arrTime" label="table.field.asnOrder.arrTime" />, | 
|---|
|  |  |  | <SelectInput source="rleStatus" label="table.field.asnOrder.rleStatus" | 
|---|
|  |  |  | choices={[ | 
|---|
|  |  |  | { id: 0, name: ' 正常' }, | 
|---|
|  |  |  | { id:  1, name: ' 已释放' }, | 
|---|
|  |  |  | ]} | 
|---|
|  |  |  | />, | 
|---|
|  |  |  | <TextInput source="name" label="table.field.asnOrder.name" />, | 
|---|
|  |  |  | <TextInput source="code" label="table.field.asnOrder.code" />, | 
|---|
|  |  |  | <TextInput source="poCode" label="table.field.asnOrder.poCode" />, | 
|---|
|  |  |  | <NumberInput source="poId" label="table.field.asnOrder.poId" />, | 
|---|
|  |  |  | <TextInput source="type" label="table.field.asnOrder.type" />, | 
|---|
|  |  |  | <TextInput source="wkType" label="table.field.asnOrder.wkType" />, | 
|---|
|  |  |  | <NumberInput source="anfme" label="table.field.asnOrder.anfme" />, | 
|---|
|  |  |  | <NumberInput source="qty" label="table.field.asnOrder.qty" />, | 
|---|
|  |  |  | <TextInput source="logisNo" label="table.field.asnOrder.logisNo" />, | 
|---|
|  |  |  | <DateInput source="arrTime" label="table.field.asnOrder.arrTime" />, | 
|---|
|  |  |  | <SelectInput source="rleStatus" label="table.field.asnOrder.rleStatus" | 
|---|
|  |  |  | choices={[ | 
|---|
|  |  |  | { id: 0, name: ' 正常' }, | 
|---|
|  |  |  | { id: 1, name: ' 已释放' }, | 
|---|
|  |  |  | ]} | 
|---|
|  |  |  | />, | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <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 | 
|---|
|  |  |  | />, | 
|---|
|  |  |  | <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 AsnOrderList = () => { | 
|---|
|  |  |  | 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 [modalType, setmodalType] = useState(0); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 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.asnOrder"} | 
|---|
|  |  |  | empty={<EmptyData onClick={() => { setCreateDialog(true) }} />} | 
|---|
|  |  |  | filters={filters} | 
|---|
|  |  |  | sort={{ field: "create_time", order: "desc" }} | 
|---|
|  |  |  | actions={( | 
|---|
|  |  |  | <TopToolbar> | 
|---|
|  |  |  | <FilterButton /> | 
|---|
|  |  |  | <MyCreateButton onClick={() => { setCreateDialog(true) }} /> | 
|---|
|  |  |  | <SelectColumnsButton preferenceKey='asnOrder' /> | 
|---|
|  |  |  | <MyExportButton /> | 
|---|
|  |  |  | </TopToolbar> | 
|---|
|  |  |  | )} | 
|---|
|  |  |  | perPage={DEFAULT_PAGE_SIZE} | 
|---|
|  |  |  | const navigate = useNavigate(); | 
|---|
|  |  |  | const assign = (record) => { | 
|---|
|  |  |  | navigate(`/asnOrderItem?asnId=${record.id}`); | 
|---|
|  |  |  | }; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 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.asnOrder"} | 
|---|
|  |  |  | empty={<EmptyData onClick={() => { setCreateDialog(true); setmodalType(0) }} />} | 
|---|
|  |  |  | filters={filters} | 
|---|
|  |  |  | sort={{ field: "create_time", order: "desc" }} | 
|---|
|  |  |  | actions={( | 
|---|
|  |  |  | <TopToolbar> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <FilterButton /> | 
|---|
|  |  |  | <MyCreateButton onClick={() => { setCreateDialog(true); setmodalType(0) }} /> | 
|---|
|  |  |  | <SelectColumnsButton preferenceKey='asnOrder' /> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <MyExportButton /> | 
|---|
|  |  |  | </TopToolbar> | 
|---|
|  |  |  | )} | 
|---|
|  |  |  | perPage={DEFAULT_PAGE_SIZE} | 
|---|
|  |  |  | > | 
|---|
|  |  |  | <StyledDatagrid | 
|---|
|  |  |  | preferenceKey='asnOrder' | 
|---|
|  |  |  | bulkActionButtons={<> <InspectionsButton /><BulkDeleteButton mutationMode={OPERATE_MODE} /></>} | 
|---|
|  |  |  | rowClick={(id, resource, record) => false} | 
|---|
|  |  |  | expand={(e) => <AsnOrderPanel key={Math.floor(Math.random() * 100)} />} | 
|---|
|  |  |  | expandSingle={true} | 
|---|
|  |  |  | omit={['id', 'createTime', 'createBy', 'memo']} | 
|---|
|  |  |  | > | 
|---|
|  |  |  | <NumberField source="id" /> | 
|---|
|  |  |  | <TextField source="code" label="table.field.asnOrder.code" /> | 
|---|
|  |  |  | <TextField source="poCode" label="table.field.asnOrder.poCode" /> | 
|---|
|  |  |  | <NumberField source="poId" label="table.field.asnOrder.poId" /> | 
|---|
|  |  |  | <TextField source="type" label="table.field.asnOrder.type" /> | 
|---|
|  |  |  | <TextField source="wkType" label="table.field.asnOrder.wkType" /> | 
|---|
|  |  |  | <NumberField source="anfme" label="table.field.asnOrder.anfme" /> | 
|---|
|  |  |  | <NumberField source="qty" label="table.field.asnOrder.qty" /> | 
|---|
|  |  |  | <TextField source="logisNo" label="table.field.asnOrder.logisNo" /> | 
|---|
|  |  |  | <DateField source="arrTime" label="table.field.asnOrder.arrTime" showTime /> | 
|---|
|  |  |  | <TextField source="rleStatus$" label="table.field.asnOrder.rleStatus" sortable={false} /> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <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" > | 
|---|
|  |  |  | {/* <Button label="toolbar.print" onClick={print}> | 
|---|
|  |  |  | <FileDownloadIcon /> | 
|---|
|  |  |  | </Button> */} | 
|---|
|  |  |  | {/* <EditButton sx={{ padding: '1px', fontSize: '.75rem' }} /> */} | 
|---|
|  |  |  | <MyButton setCreateDialog={setCreateDialog} setmodalType={setmodalType} /> | 
|---|
|  |  |  | {/* <Button | 
|---|
|  |  |  | color="primary" | 
|---|
|  |  |  | startIcon={<EditIcon />} | 
|---|
|  |  |  | onClick={(event, record) => handleEditClick(record)} | 
|---|
|  |  |  | sx={{ ml: 1 }} | 
|---|
|  |  |  | label={'ra.action.edit'} | 
|---|
|  |  |  | > | 
|---|
|  |  |  | <StyledDatagrid | 
|---|
|  |  |  | preferenceKey='asnOrder' | 
|---|
|  |  |  | bulkActionButtons={() => <BulkDeleteButton mutationMode={OPERATE_MODE} />} | 
|---|
|  |  |  | rowClick={(id, resource, record) => false} | 
|---|
|  |  |  | expand={() => <AsnOrderPanel />} | 
|---|
|  |  |  | expandSingle={true} | 
|---|
|  |  |  | omit={['id', 'createTime', 'createBy', 'memo']} | 
|---|
|  |  |  | > | 
|---|
|  |  |  | <NumberField source="id" /> | 
|---|
|  |  |  | <TextField source="code" label="table.field.asnOrder.code" /> | 
|---|
|  |  |  | <TextField source="poCode" label="table.field.asnOrder.poCode" /> | 
|---|
|  |  |  | <NumberField source="poId" label="table.field.asnOrder.poId" /> | 
|---|
|  |  |  | <TextField source="type" label="table.field.asnOrder.type" /> | 
|---|
|  |  |  | <TextField source="wkType" label="table.field.asnOrder.wkType" /> | 
|---|
|  |  |  | <NumberField source="anfme" label="table.field.asnOrder.anfme" /> | 
|---|
|  |  |  | <NumberField source="qty" label="table.field.asnOrder.qty" /> | 
|---|
|  |  |  | <TextField source="logisNo" label="table.field.asnOrder.logisNo" /> | 
|---|
|  |  |  | <DateField source="arrTime" label="table.field.asnOrder.arrTime" showTime /> | 
|---|
|  |  |  | <TextField source="rleStatus$" label="table.field.asnOrder.rleStatus" sortable={false} /> | 
|---|
|  |  |  | <TextField source="name" label="table.field.asnOrder.name" /> | 
|---|
|  |  |  | </Button> */} | 
|---|
|  |  |  | <InspectionButton /> | 
|---|
|  |  |  | <DeleteButton sx={{ padding: '1px', fontSize: '.75rem' }} mutationMode={OPERATE_MODE} /> | 
|---|
|  |  |  | </WrapperField> | 
|---|
|  |  |  | </StyledDatagrid> | 
|---|
|  |  |  | </List> | 
|---|
|  |  |  | <AsnOrderModal | 
|---|
|  |  |  | open={createDialog} | 
|---|
|  |  |  | setOpen={setCreateDialog} | 
|---|
|  |  |  | asnId={modalType} | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | <PageDrawer | 
|---|
|  |  |  | title='AsnOrder Detail' | 
|---|
|  |  |  | drawerVal={drawerVal} | 
|---|
|  |  |  | setDrawerVal={setDrawerVal} | 
|---|
|  |  |  | > | 
|---|
|  |  |  | </PageDrawer> | 
|---|
|  |  |  | </Box > | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | export default AsnOrderList; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <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> | 
|---|
|  |  |  | <AsnOrderCreate | 
|---|
|  |  |  | open={createDialog} | 
|---|
|  |  |  | setOpen={setCreateDialog} | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | <PageDrawer | 
|---|
|  |  |  | title='AsnOrder Detail' | 
|---|
|  |  |  | drawerVal={drawerVal} | 
|---|
|  |  |  | setDrawerVal={setDrawerVal} | 
|---|
|  |  |  | > | 
|---|
|  |  |  | </PageDrawer> | 
|---|
|  |  |  | </Box> | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | const MyButton = ({ setCreateDialog, setmodalType }) => { | 
|---|
|  |  |  | const record = useRecordContext(); | 
|---|
|  |  |  | const handleEditClick = () => { | 
|---|
|  |  |  | const id = record.id; | 
|---|
|  |  |  | setmodalType(id); | 
|---|
|  |  |  | setCreateDialog(true); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | return ( | 
|---|
|  |  |  | <Button | 
|---|
|  |  |  | color="primary" | 
|---|
|  |  |  | startIcon={<EditIcon />} | 
|---|
|  |  |  | onClick={() => handleEditClick()} | 
|---|
|  |  |  | sx={{ ml: 1 }} | 
|---|
|  |  |  | label={'ra.action.edit'} | 
|---|
|  |  |  | > | 
|---|
|  |  |  | </Button> | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | export default AsnOrderList; | 
|---|
|  |  |  | const InspectionButton = () => { | 
|---|
|  |  |  | const record = useRecordContext(); | 
|---|
|  |  |  | const notify = useNotify(); | 
|---|
|  |  |  | const refresh = useRefresh(); | 
|---|
|  |  |  | const inspection = () => { | 
|---|
|  |  |  | requestInspect([record]) | 
|---|
|  |  |  | }; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const requestInspect = async (rows) => { | 
|---|
|  |  |  | const { data: { code, data, msg } } = await request.post(`/asnOrder/inspect`, rows); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (code === 200) { | 
|---|
|  |  |  | notify(msg); | 
|---|
|  |  |  | refresh() | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | notify(msg); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return ( | 
|---|
|  |  |  | <Button onClick={inspection} label={"toolbar.inspection"}> | 
|---|
|  |  |  | <ConstructionIcon /> | 
|---|
|  |  |  | </Button> | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const InspectionsButton = () => { | 
|---|
|  |  |  | const { selectedIds, onUnselectItems, data } = useListContext(); | 
|---|
|  |  |  | const notify = useNotify(); | 
|---|
|  |  |  | const refresh = useRefresh(); | 
|---|
|  |  |  | const inspection = () => { | 
|---|
|  |  |  | if (selectedIds.length === 0) { | 
|---|
|  |  |  | notify('请选择通知单'); | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | const rows = data.filter((item) => selectedIds.includes(item.id)) | 
|---|
|  |  |  | requestInspect(rows) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const requestInspect = async (rows) => { | 
|---|
|  |  |  | const { data: { code, data, msg } } = await request.post(`/asnOrder/inspect`, rows); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (code === 200) { | 
|---|
|  |  |  | notify(msg); | 
|---|
|  |  |  | refresh() | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | notify(msg); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return ( | 
|---|
|  |  |  | <Button onClick={inspection} label={"toolbar.inspection"}> | 
|---|
|  |  |  | <ConstructionIcon /> | 
|---|
|  |  |  | </Button> | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | } | 
|---|