From 0af9765f0760d50394f723d1b5423fb3ebe1b0e1 Mon Sep 17 00:00:00 2001 From: skyouc Date: 星期一, 31 三月 2025 14:17:42 +0800 Subject: [PATCH] #新增 1. 新增生成任务明细功能 --- rsf-admin/src/page/qlyInspect/QlyInspectList.jsx | 113 ++++++++++++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 96 insertions(+), 17 deletions(-) diff --git a/rsf-admin/src/page/qlyInspect/QlyInspectList.jsx b/rsf-admin/src/page/qlyInspect/QlyInspectList.jsx index 10bda0b..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': { @@ -60,16 +66,14 @@ const filters = [ <SearchInput source="condition" alwaysOn />, - <DateInput label='common.time.after' source="timeStart" alwaysOn />, - <DateInput label='common.time.before' source="timeEnd" alwaysOn />, - <TextInput source="code" label="table.field.qlyInspect.code" />, - <TextInput source="name" label="table.field.qlyInspect.name" />, - <TextInput source="barcode" label="table.field.qlyInspect.barcode" />, <NumberInput source="asnItemId" label="table.field.qlyInspect.asnItemId" />, - <NumberInput source="poItemId" label="table.field.qlyInspect.poItemId" />, + <TextInput source="code" label="table.field.qlyInspect.code" />, + <TextInput source="wkType" label="table.field.qlyInspect.wkType" />, <NumberInput source="safeQty" label="table.field.qlyInspect.safeQty" />, - <NumberInput source="disQty" label="table.field.qlyInspect.disQty" />, + <NumberInput source="dlyQty" label="table.field.qlyInspect.dlyQty" />, + <NumberInput source="rcptQty" label="table.field.qlyInspect.rcptQty" />, + <NumberInput source="isptQty" label="table.field.qlyInspect.isptQty" />, <TextInput label="common.field.memo" source="memo" />, <SelectInput @@ -98,7 +102,7 @@ theme.transitions.create(['all'], { duration: theme.transitions.duration.enteringScreen, }), - marginRight: !!drawerVal ? `${PAGE_DRAWER_WIDTH}px` : 0, + marginRight: drawerVal ? `${PAGE_DRAWER_WIDTH}px` : 0, }} title={"menu.qlyInspect"} empty={<EmptyData onClick={() => { setCreateDialog(true) }} />} @@ -107,7 +111,6 @@ actions={( <TopToolbar> <FilterButton /> - <MyCreateButton onClick={() => { setCreateDialog(true) }} /> <SelectColumnsButton preferenceKey='qlyInspect' /> <MyExportButton /> </TopToolbar> @@ -116,20 +119,20 @@ > <StyledDatagrid preferenceKey='qlyInspect' - bulkActionButtons={() => <BulkDeleteButton mutationMode={OPERATE_MODE} />} + bulkActionButtons={<BulkDeleteButton mutationMode={OPERATE_MODE} />} rowClick={(id, resource, record) => false} expand={() => <QlyInspectPanel />} expandSingle={true} omit={['id', 'createTime', 'createBy', 'memo']} > <NumberField source="id" /> + <NumberField source="asnItemId$" label="table.field.qlyInspect.asnItemId" /> <TextField source="code" label="table.field.qlyInspect.code" /> - <TextField source="name" label="table.field.qlyInspect.name" /> - <TextField source="barcode" label="table.field.qlyInspect.barcode" /> - <NumberField source="asnItemId" label="table.field.qlyInspect.asnItemId" /> - <NumberField source="poItemId" label="table.field.qlyInspect.poItemId" /> + <TextField source="wkType" label="table.field.qlyInspect.wkType" /> <NumberField source="safeQty" label="table.field.qlyInspect.safeQty" /> - <NumberField source="disQty" label="table.field.qlyInspect.disQty" /> + <NumberField source="dlyQty" label="table.field.qlyInspect.dlyQty" /> + <NumberField source="rcptQty" label="table.field.qlyInspect.rcptQty" /> + <NumberField source="isptQty" label="table.field.qlyInspect.isptQty" /> <ReferenceField source="updateBy" label="common.field.updateBy" reference="user" link={false} sortable={false}> <TextField source="nickname" /> @@ -142,8 +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"> - <EditButton sx={{ padding: '1px', fontSize: '.75rem' }} /> - <DeleteButton sx={{ padding: '1px', fontSize: '.75rem' }} mutationMode={OPERATE_MODE} /> + {/* <DeleteButton sx={{ padding: '1px', fontSize: '.75rem' }} mutationMode={OPERATE_MODE} /> */} + <InspectionButton /> + <CompleteButton /> + <CloseButton /> </WrapperField> </StyledDatagrid> </List> @@ -162,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