|  |  |  | 
|---|
|  |  |  | } from 'react-admin'; | 
|---|
|  |  |  | import { Box, Typography, Card, Stack } from '@mui/material'; | 
|---|
|  |  |  | import { styled } from '@mui/material/styles'; | 
|---|
|  |  |  | import QlyInspectCreate from "./QlyInspectCreate"; | 
|---|
|  |  |  | import QlyInspectPanel from "./QlyInspectPanel"; | 
|---|
|  |  |  | 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 { 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 CloseIcon from "@mui/icons-material/Close"; | 
|---|
|  |  |  | import TaskIcon from '@mui/icons-material/Task'; | 
|---|
|  |  |  | 
|---|
|  |  |  | import AsnSelModal from "./AsnSelModal"; | 
|---|
|  |  |  | import InspectModal from "./InspectModal"; | 
|---|
|  |  |  | import QlyInspectOpCreate from './QlyInspectOpCreate'; | 
|---|
|  |  |  | import ConfirmButton from "../../components/ConfirmButton"; | 
|---|
|  |  |  | const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({ | 
|---|
|  |  |  | '& .css-1vooibu-MuiSvgIcon-root': { | 
|---|
|  |  |  | height: '.9em' | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const filters = [ | 
|---|
|  |  |  | <SearchInput source="condition" alwaysOn />, | 
|---|
|  |  |  | <ReferenceInput source="isptStatus" label="table.field.qlyInspect.isptStatus" reference="dictData" filter={{ dictTypeCode: 'sys_qly_inspect_status' }} alwaysOn> | 
|---|
|  |  |  | <AutocompleteInput source="value" optionText='label' optionValue="value" label="table.field.qlyInspect.isptStatus"></AutocompleteInput> | 
|---|
|  |  |  | </ReferenceInput>, | 
|---|
|  |  |  | <TextInput source="code" label="table.field.qlyInspect.code" />, | 
|---|
|  |  |  | <TextInput source="wkType" label="table.field.qlyInspect.wkType" />, | 
|---|
|  |  |  | <NumberInput source="safeQty" label="table.field.qlyInspect.safeQty" />, | 
|---|
|  |  |  | 
|---|
|  |  |  | return ( | 
|---|
|  |  |  | <Box display="flex"> | 
|---|
|  |  |  | <List | 
|---|
|  |  |  | resource="qlyInspect" | 
|---|
|  |  |  | sx={{ | 
|---|
|  |  |  | flexGrow: 1, | 
|---|
|  |  |  | transition: (theme) => | 
|---|
|  |  |  | 
|---|
|  |  |  | actions={( | 
|---|
|  |  |  | <TopToolbar> | 
|---|
|  |  |  | <AsnCreatButton /> | 
|---|
|  |  |  | <MyCreateButton onClick={() => { setOpCreateDialog(true) }} /> | 
|---|
|  |  |  | {/* <MyCreateButton onClick={() => { setOpCreateDialog(true) }} /> */} | 
|---|
|  |  |  | <FilterButton /> | 
|---|
|  |  |  | <SelectColumnsButton preferenceKey='qlyInspect' /> | 
|---|
|  |  |  | <MyExportButton /> | 
|---|
|  |  |  | 
|---|
|  |  |  | > | 
|---|
|  |  |  | <NumberField source="id" /> | 
|---|
|  |  |  | <TextField source="code" label="table.field.qlyInspect.code" /> | 
|---|
|  |  |  | <TextField source="isptStatus$" label="table.field.qlyInspect.isptStatus" /> | 
|---|
|  |  |  | <TextField source="wkType$" label="table.field.qlyInspect.wkType" /> | 
|---|
|  |  |  | <NumberField source="asnId" label="table.field.qlyInspect.asnId" /> | 
|---|
|  |  |  | <NumberField source="asnCode" label="table.field.qlyInspect.asnCode" /> | 
|---|
|  |  |  | <NumberField source="safeQty" label="table.field.qlyInspect.safeQty" /> | 
|---|
|  |  |  | <NumberField source="dlyQty" label="table.field.qlyInspect.dlyQty" /> | 
|---|
|  |  |  | <NumberField source="rcptQty" label="table.field.qlyInspect.rcptQty" /> | 
|---|
|  |  |  | <NumberField source="isptQty" label="table.field.qlyInspect.isptQty" /> | 
|---|
|  |  |  | <TextField source="isptStatus$" label="table.field.qlyInspect.isptStatus" /> | 
|---|
|  |  |  | <TextField source="updateBy$" label="common.field.updateBy" /> | 
|---|
|  |  |  | <DateField source="updateTime" label="common.field.updateTime" showTime /> | 
|---|
|  |  |  | <TextField source="createBy$" label="common.field.createBy" /> | 
|---|
|  |  |  | 
|---|
|  |  |  | <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 /> | 
|---|
|  |  |  | <EditButton label="toolbar.detail" /> | 
|---|
|  |  |  | <InspectionButton /> | 
|---|
|  |  |  | <CompleteButton /> | 
|---|
|  |  |  | <CloseButton /> | 
|---|
|  |  |  | </WrapperField> | 
|---|
|  |  |  | </StyledDatagrid> | 
|---|
|  |  |  | </List> | 
|---|
|  |  |  | {/* <CloseButton /> */} | 
|---|
|  |  |  | </WrapperField> | 
|---|
|  |  |  | </StyledDatagrid> | 
|---|
|  |  |  | </List> | 
|---|
|  |  |  | {/* <QlyInspectCreate | 
|---|
|  |  |  | open={createDialog} | 
|---|
|  |  |  | setOpen={setCreateDialog} | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | export default QlyInspectList; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const PrintLabelButton = () => { | 
|---|
|  |  |  | const record = useRecordContext(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const InspectionButton = () => { | 
|---|
|  |  |  | const record = useRecordContext(); | 
|---|
|  |  |  | const notify = useNotify(); | 
|---|
|  |  |  | 
|---|
|  |  |  | const [createDialog, setCreateDialog] = useState(false); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return ( | 
|---|
|  |  |  | <> | 
|---|
|  |  |  | record.isptStatus != 1 && record.isptStatus != 3 ? (<> | 
|---|
|  |  |  | <Button onClick={() => setCreateDialog(true)} label={"toolbar.quality"}> | 
|---|
|  |  |  | <ConstructionIcon /> | 
|---|
|  |  |  | </Button> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <InspectModal | 
|---|
|  |  |  | open={createDialog} | 
|---|
|  |  |  | setOpen={setCreateDialog} | 
|---|
|  |  |  | ispectId={record.id} | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | </> | 
|---|
|  |  |  | </>) : (<></>) | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | const notify = useNotify(); | 
|---|
|  |  |  | const refresh = useRefresh(); | 
|---|
|  |  |  | const requestComplete = async () => { | 
|---|
|  |  |  | const { data: { code, data, msg } } = await request.post(`/qlyInspect/update`, { ...record, isptStatus: '1' }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const { data: { code, data, msg } } = await request.post(`/qlyInspect/verify/complate/` + record?.id); | 
|---|
|  |  |  | if (code === 200) { | 
|---|
|  |  |  | notify(msg); | 
|---|
|  |  |  | refresh() | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return ( | 
|---|
|  |  |  | <Button onClick={requestComplete} label={"toolbar.complete"} mutationMode={OPERATE_MODE}> | 
|---|
|  |  |  | <TaskIcon /> | 
|---|
|  |  |  | </Button> | 
|---|
|  |  |  | record.isptStatus == 2 ? (<ConfirmButton label={"toolbar.verifyComfirm"} color="secondary" startIcon={<TaskIcon />} onConfirm={requestComplete} />) : (<></>) | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | notify(msg); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return ( | 
|---|
|  |  |  | <Button onClick={requestClose} label={"toolbar.close"}> | 
|---|
|  |  |  | 
|---|
|  |  |  | <AddIcon /> | 
|---|
|  |  |  | </Button> | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <AsnSelModal | 
|---|
|  |  |  | open={createDialog} | 
|---|
|  |  |  | setOpen={setCreateDialog} | 
|---|