From 496c047fdb5b1637f5bd8ac92dcbeb5f8f6d27d4 Mon Sep 17 00:00:00 2001 From: verou <857149855@qq.com> Date: 星期一, 31 三月 2025 10:39:03 +0800 Subject: [PATCH] feat:质检单 --- rsf-admin/src/page/qlyInspect/QlyInspectList.jsx | 87 ++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 85 insertions(+), 2 deletions(-) diff --git a/rsf-admin/src/page/qlyInspect/QlyInspectList.jsx b/rsf-admin/src/page/qlyInspect/QlyInspectList.jsx index 7da510e..3bc69b4 100644 --- a/rsf-admin/src/page/qlyInspect/QlyInspectList.jsx +++ b/rsf-admin/src/page/qlyInspect/QlyInspectList.jsx @@ -31,6 +31,8 @@ ReferenceArrayInput, AutocompleteInput, DeleteButton, + Button, + useRefresh, } from 'react-admin'; import { Box, Typography, Card, Stack } from '@mui/material'; import { styled } from '@mui/material/styles'; @@ -43,6 +45,10 @@ 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 request from '@/utils/request'; const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({ '& .css-1vooibu-MuiSvgIcon-root': { @@ -113,7 +119,7 @@ > <StyledDatagrid preferenceKey='qlyInspect' - bulkActionButtons={() => <BulkDeleteButton mutationMode={OPERATE_MODE} />} + bulkActionButtons={<BulkDeleteButton mutationMode={OPERATE_MODE} />} rowClick={(id, resource, record) => false} expand={() => <QlyInspectPanel />} expandSingle={true} @@ -139,7 +145,10 @@ <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"> - <DeleteButton sx={{ padding: '1px', fontSize: '.75rem' }} mutationMode={OPERATE_MODE} /> + {/* <DeleteButton sx={{ padding: '1px', fontSize: '.75rem' }} mutationMode={OPERATE_MODE} /> */} + <InspectionButton /> + <CompleteButton /> + <CloseButton /> </WrapperField> </StyledDatagrid> </List> @@ -158,3 +167,77 @@ } export default QlyInspectList; + +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.quality"}> + <ConstructionIcon /> + </Button> + ) +} + +const CompleteButton = () => { + const record = useRecordContext(); + const notify = useNotify(); + const refresh = useRefresh(); + const requestComplete = async () => { + const { data: { code, data, msg } } = await request.post(`/qlyInspect/update`, { ...record, code: '222222' }); + + if (code === 200) { + notify(msg); + refresh() + } else { + notify(msg); + } + } + + + return ( + <Button onClick={requestComplete} label={"toolbar.complete"}> + <TaskIcon /> + </Button> + ) +} + +const CloseButton = () => { + const record = useRecordContext(); + const notify = useNotify(); + const refresh = useRefresh(); + + const requestClose = async () => { + const { data: { code, data, msg } } = await request.post(`/qlyInspect/update`, { ...record, code: '222222' }); + + if (code === 200) { + notify(msg); + refresh() + } else { + notify(msg); + } + } + + + return ( + <Button onClick={requestClose} label={"toolbar.close"}> + <CloseIcon /> + </Button> + ) +} -- Gitblit v1.9.1