From 3438712e24fc1641f8941b17aa572ed1bce72b40 Mon Sep 17 00:00:00 2001 From: verou <857149855@qq.com> Date: 星期一, 31 三月 2025 14:20:22 +0800 Subject: [PATCH] feat:质检选单 --- rsf-admin/src/page/qlyInspect/AsnSelModal.jsx | 207 +++++++++++++++++++++++++++++++++++++++++ rsf-admin/src/page/asnOrder/AsnWareModal.jsx | 8 + rsf-admin/src/page/qlyInspect/QlyInspectList.jsx | 38 ++++++- rsf-admin/src/i18n/zh.js | 7 + rsf-admin/src/i18n/en.js | 5 5 files changed, 254 insertions(+), 11 deletions(-) diff --git a/rsf-admin/src/i18n/en.js b/rsf-admin/src/i18n/en.js index 7e0e0da..268f289 100644 --- a/rsf-admin/src/i18n/en.js +++ b/rsf-admin/src/i18n/en.js @@ -410,13 +410,15 @@ projectName: "ProjectName", }, qlyInspect: { - asnItemId: "asnItemId", + asnId: "asnId", + asnCode: "asnCode", code: "code", wkType: "wkType", safeQty: "safeQty", dlyQty: "dlyQty", rcptQty: "rcptQty", isptQty: "isptQty", + isptStatus: "isptStatus", }, qlyIsptItem: { ispectId: "ispectId", @@ -759,6 +761,7 @@ quality: "quality", complete: "complete", close: "close", + asnCreate: "asnCreate", }, }; diff --git a/rsf-admin/src/i18n/zh.js b/rsf-admin/src/i18n/zh.js index 52ad769..9379808 100644 --- a/rsf-admin/src/i18n/zh.js +++ b/rsf-admin/src/i18n/zh.js @@ -418,13 +418,15 @@ projectName: "椤圭洰鍚嶇О", }, qlyInspect: { - asnItemId: "閫氱煡鍗曟槑缁咺D", + asnId: "鏀惰揣閫氱煡鍗曞彿", + asnCode: "鏀惰揣閫氱煡鍗曠紪鐮�", code: "缂栫爜", wkType: "涓氬姟绫诲瀷", safeQty: "鍚堟牸鏁伴噺", dlyQty: "閫佽揣鏁伴噺", rcptQty: "鏀惰揣鏁伴噺 ", isptQty: "璐ㄦ鏁伴噺", + isptStatus: "璐ㄦ鐘舵��", }, qlyIsptItem: { ispectId: "涓诲崟ID", @@ -495,7 +497,7 @@ maxWeight: "鏈�澶ч噸閲�", }, asnOrder: { - code: "缂栫爜", + code: "ASN鍗曞彿", poCode: "PO缂栫爜", poId: "PO鏍囪瘑", type: "鍗曟嵁绫诲瀷", @@ -772,6 +774,7 @@ quality: "璐ㄦ", complete: "瀹屾垚", close: "鍏抽棴", + asnCreate: "閫氳繃ASN鍒涘缓", }, }; diff --git a/rsf-admin/src/page/asnOrder/AsnWareModal.jsx b/rsf-admin/src/page/asnOrder/AsnWareModal.jsx index d4591f8..bd7608d 100644 --- a/rsf-admin/src/page/asnOrder/AsnWareModal.jsx +++ b/rsf-admin/src/page/asnOrder/AsnWareModal.jsx @@ -36,7 +36,8 @@ const [formData, setFormData] = useState({ name: '', - code: '' + code: '', + groupId: '' }); const [tableData, setTableData] = useState([]); @@ -54,7 +55,8 @@ const reset = () => { setFormData({ name: '', - code: '' + code: '', + groupId: '' }) } @@ -84,7 +86,7 @@ const res = await request.post(`/matnr/page`, { ...formData, current: 1, - pageSize: 199, + pageSize: 100, orderBy: "create_time desc" }); if (res?.data?.code === 200) { diff --git a/rsf-admin/src/page/qlyInspect/AsnSelModal.jsx b/rsf-admin/src/page/qlyInspect/AsnSelModal.jsx new file mode 100644 index 0000000..8d65011 --- /dev/null +++ b/rsf-admin/src/page/qlyInspect/AsnSelModal.jsx @@ -0,0 +1,207 @@ +import React, { useState, useEffect, useCallback } from "react"; +import { + Dialog, + DialogActions, + DialogContent, + DialogTitle, + Stack, + Grid, + TextField, + Box, + Button, + Paper, + styled, + RadioGroup, + Radio, + FormControlLabel, +} from '@mui/material'; +import DialogCloseButton from "../components/DialogCloseButton"; +import ConfirmButton from "../components/ConfirmButton"; +import { useTranslate, useNotify, useRefresh } from 'react-admin'; +import request from '@/utils/request'; +import { DataGrid, useGridApiRef } from '@mui/x-data-grid'; +import SaveIcon from '@mui/icons-material/Save'; +import TreeSelectInput from "@/page/components/TreeSelectInput"; +import { throttle } from 'lodash'; + +const AsnSelModal = (props) => { + const { open, setOpen } = props; + + const translate = useTranslate(); + const notify = useNotify(); + const refresh = useRefresh(); + + const handleClose = (event, reason) => { + if (reason !== "backdropClick") { + setOpen(false); + } + }; + + const [formData, setFormData] = useState({ + code: '' + }); + + const [tableData, setTableData] = useState([]); + const [selectedRow, setSelectedRow] = useState(null); + + const handleChange = (e) => { + const { name, value } = e.target; + setFormData((prevData) => ({ + ...prevData, + [name]: value + })); + }; + + const reset = () => { + setFormData({ + code: '' + }) + } + + const handleSubmit = () => { + console.log(selectedRow); + setOpen(false); + reset(); + }; + + const getData = async () => { + const res = await request.post(`/asnOrder/page`, { + ...formData, + current: 1, + pageSize: 100, + orderBy: "create_time desc" + }); + if (res?.data?.code === 200) { + setTableData(res.data.data.records); + } else { + notify(res.data.msg); + } + }; + + useEffect(() => { + getData(); + }, [open]); + + const handleSearch = () => { + getData() + }; + + return ( + <Dialog + open={open} + onClose={handleClose} + aria-labelledby="form-dialog-title" + fullWidth + disableRestoreFocus + maxWidth="lg" + > + <DialogTitle id="form-dialog-title" sx={{ + position: 'sticky', + top: 0, + backgroundColor: 'background.paper', + zIndex: 1000 + }}> + 閫夋嫨asn鍗� + <Box sx={{ position: 'absolute', top: 8, right: 8, zIndex: 1001 }}> + <DialogCloseButton onClose={handleClose} /> + </Box> + </DialogTitle> + <DialogContent sx={{ mt: 2 }}> + <Box component="form" onSubmit={handleSubmit} sx={{ display: 'flex', flexDirection: 'column', gap: 3 }}> + <Grid container spacing={2}> + <Grid item md={4}> + <TextField + label={translate('table.field.asnOrder.code')} + name="code" + value={formData.code} + onChange={handleChange} + size="small" + /> + </Grid> + </Grid> + </Box> + <Box sx={{ mt: 2 }}> + <Stack direction="row" spacing={2}> + <Button variant="contained" onClick={handleSearch}>鎼滅储</Button> + </Stack> + </Box> + <Box sx={{ mt: 2, height: 400, width: '100%' }}> + <AsnSelModalTable + tableData={tableData} + setTableData={setTableData} + selectedRow={selectedRow} + setSelectedRow={setSelectedRow} + /> + </Box> + </DialogContent> + <DialogActions sx={{ position: 'sticky', bottom: 0, backgroundColor: 'background.paper', zIndex: 1000 }}> + <Box sx={{ width: '100%', display: 'flex', justifyContent: 'space-between' }}> + <Button onClick={handleSubmit} variant="contained" startIcon={<SaveIcon />}> + {translate('toolbar.confirm')} + </Button> + </Box> + </DialogActions> + </Dialog> + ); +}; + +export default AsnSelModal; + +const AsnSelModalTable = ({ tableData, setTableData, selectedRow, setSelectedRow }) => { + const translate = useTranslate(); + const notify = useNotify(); + const apiRef = useGridApiRef(); + + const handleRadioChange = (event, id) => { + setSelectedRow(id); + }; + + + const [columns, setColumns] = useState([ + // { field: 'id', headerName: 'ID', width: 100 }, + { + field: 'radio', + headerName: '', + width: 55, + renderCell: (params) => { + return ( + <FormControlLabel + value={params.row.id} + control={<Radio />} + onChange={(event) => handleRadioChange(event, params.row.id)} + /> + ); + }, + }, + { field: 'code', headerName: translate('table.field.asnOrder.code'), width: 200 }, + { field: 'type$', headerName: translate('table.field.asnOrder.type') }, + { field: 'wkType$', headerName: translate('table.field.asnOrder.wkType') }, + { field: 'anfme', headerName: translate('table.field.asnOrder.anfme') }, + { field: 'qty', headerName: translate('table.field.asnOrder.qty') }, + { field: 'logisNo', headerName: translate('table.field.asnOrder.logisNo') }, + ]) + + + const onRowClick = (e) => { + setSelectedRow(e.id) + } + + + + return ( + <div style={{ height: 400, width: '100%' }}> + <RadioGroup value={selectedRow} onChange={handleRadioChange}> + <DataGrid + size="small" + rows={tableData} + columns={columns} + onRowClick={onRowClick} + apiRef={apiRef} + disableColumnMenu={true} + disableColumnSorting + disableMultipleColumnsSorting + /> + </RadioGroup> + </div> + ); +}; \ No newline at end of file diff --git a/rsf-admin/src/page/qlyInspect/QlyInspectList.jsx b/rsf-admin/src/page/qlyInspect/QlyInspectList.jsx index 3bc69b4..a078748 100644 --- a/rsf-admin/src/page/qlyInspect/QlyInspectList.jsx +++ b/rsf-admin/src/page/qlyInspect/QlyInspectList.jsx @@ -48,7 +48,9 @@ import ConstructionIcon from "@mui/icons-material/Construction"; import CloseIcon from "@mui/icons-material/Close"; import TaskIcon from '@mui/icons-material/Task'; +import AddIcon from '@mui/icons-material/Add'; import request from '@/utils/request'; +import AsnSelModal from "./AsnSelModal"; const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({ '& .css-1vooibu-MuiSvgIcon-root': { @@ -67,7 +69,6 @@ const filters = [ <SearchInput source="condition" alwaysOn />, - <NumberInput source="asnItemId" label="table.field.qlyInspect.asnItemId" />, <TextInput source="code" label="table.field.qlyInspect.code" />, <TextInput source="wkType" label="table.field.qlyInspect.wkType" />, <NumberInput source="safeQty" label="table.field.qlyInspect.safeQty" />, @@ -110,6 +111,7 @@ sort={{ field: "create_time", order: "desc" }} actions={( <TopToolbar> + <AsnCreatButton /> <FilterButton /> <SelectColumnsButton preferenceKey='qlyInspect' /> <MyExportButton /> @@ -123,11 +125,13 @@ rowClick={(id, resource, record) => false} expand={() => <QlyInspectPanel />} expandSingle={true} - omit={['id', 'createTime', 'createBy', 'memo']} + omit={['id', 'createTime', 'createBy', 'memo', 'asnId']} > <NumberField source="id" /> - <NumberField source="asnItemId$" label="table.field.qlyInspect.asnItemId" /> + <NumberField source="asnId" label="table.field.qlyInspect.asnId" /> + <NumberField source="asnCode" label="table.field.qlyInspect.asnCode" /> <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="safeQty" label="table.field.qlyInspect.safeQty" /> <NumberField source="dlyQty" label="table.field.qlyInspect.dlyQty" /> @@ -162,6 +166,8 @@ setDrawerVal={setDrawerVal} > </PageDrawer> + + </Box> ) } @@ -200,7 +206,7 @@ const notify = useNotify(); const refresh = useRefresh(); const requestComplete = async () => { - const { data: { code, data, msg } } = await request.post(`/qlyInspect/update`, { ...record, code: '222222' }); + const { data: { code, data, msg } } = await request.post(`/qlyInspect/update`, { ...record, isptStatus: '1' }); if (code === 200) { notify(msg); @@ -224,7 +230,7 @@ const refresh = useRefresh(); const requestClose = async () => { - const { data: { code, data, msg } } = await request.post(`/qlyInspect/update`, { ...record, code: '222222' }); + const { data: { code, data, msg } } = await request.post(`/qlyInspect/update`, { ...record, isptStatus: '3' }); if (code === 200) { notify(msg); @@ -241,3 +247,25 @@ </Button> ) } + +const AsnCreatButton = () => { + const record = useRecordContext(); + const notify = useNotify(); + const refresh = useRefresh(); + const [createDialog, setCreateDialog] = useState(false); + + + + return ( + <> + <Button onClick={() => setCreateDialog(true)} label={"toolbar.asnCreate"}> + <AddIcon /> + </Button> + + <AsnSelModal + open={createDialog} + setOpen={setCreateDialog} + /> + </> + ) +} -- Gitblit v1.9.1