| | |
| | | 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", |
| | |
| | | quality: "quality", |
| | | complete: "complete", |
| | | close: "close", |
| | | asnCreate: "asnCreate", |
| | | }, |
| | | }; |
| | | |
| | |
| | | projectName: "项目名称", |
| | | }, |
| | | qlyInspect: { |
| | | asnItemId: "通知单明细ID", |
| | | asnId: "收货通知单号", |
| | | asnCode: "收货通知单编码", |
| | | code: "编码", |
| | | wkType: "业务类型", |
| | | safeQty: "合格数量", |
| | | dlyQty: "送货数量", |
| | | rcptQty: "收货数量 ", |
| | | isptQty: "质检数量", |
| | | isptStatus: "质检状态", |
| | | }, |
| | | qlyIsptItem: { |
| | | ispectId: "主单ID", |
| | |
| | | maxWeight: "最大重量", |
| | | }, |
| | | asnOrder: { |
| | | code: "编码", |
| | | code: "ASN单号", |
| | | poCode: "PO编码", |
| | | poId: "PO标识", |
| | | type: "单据类型", |
| | |
| | | quality: "质检", |
| | | complete: "完成", |
| | | close: "关闭", |
| | | asnCreate: "通过ASN创建", |
| | | }, |
| | | }; |
| | | |
| | |
| | | |
| | | const [formData, setFormData] = useState({ |
| | | name: '', |
| | | code: '' |
| | | code: '', |
| | | groupId: '' |
| | | }); |
| | | |
| | | const [tableData, setTableData] = useState([]); |
| | |
| | | const reset = () => { |
| | | setFormData({ |
| | | name: '', |
| | | code: '' |
| | | code: '', |
| | | groupId: '' |
| | | }) |
| | | } |
| | | |
| | |
| | | const res = await request.post(`/matnr/page`, { |
| | | ...formData, |
| | | current: 1, |
| | | pageSize: 199, |
| | | pageSize: 100, |
| | | orderBy: "create_time desc" |
| | | }); |
| | | if (res?.data?.code === 200) { |
New file |
| | |
| | | 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> |
| | | ); |
| | | }; |
| | |
| | | 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': { |
| | |
| | | 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" />, |
| | |
| | | sort={{ field: "create_time", order: "desc" }} |
| | | actions={( |
| | | <TopToolbar> |
| | | <AsnCreatButton /> |
| | | <FilterButton /> |
| | | <SelectColumnsButton preferenceKey='qlyInspect' /> |
| | | <MyExportButton /> |
| | |
| | | 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" /> |
| | |
| | | setDrawerVal={setDrawerVal} |
| | | > |
| | | </PageDrawer> |
| | | |
| | | |
| | | </Box> |
| | | ) |
| | | } |
| | |
| | | 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); |
| | |
| | | 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); |
| | |
| | | </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} |
| | | /> |
| | | </> |
| | | ) |
| | | } |