From 161e5e1c4e86ca59e945ddcdde9f7bf525f34911 Mon Sep 17 00:00:00 2001
From: skyouc
Date: 星期二, 05 八月 2025 13:07:26 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/devlop' into devlop
---
rsf-admin/src/page/stockManage/locRevise/LocReviseCreate.jsx | 282 +++++++++++++++++++++++++++++---------------------------
1 files changed, 146 insertions(+), 136 deletions(-)
diff --git a/rsf-admin/src/page/stockManage/locRevise/LocReviseCreate.jsx b/rsf-admin/src/page/stockManage/locRevise/LocReviseCreate.jsx
index 36f977a..daf0441 100644
--- a/rsf-admin/src/page/stockManage/locRevise/LocReviseCreate.jsx
+++ b/rsf-admin/src/page/stockManage/locRevise/LocReviseCreate.jsx
@@ -5,21 +5,33 @@
DateInput,
ReferenceInput,
AutocompleteInput,
+ SelectColumnsButton,
+ DatagridConfigurable,
Toolbar,
required,
useNotify,
DeleteButton,
+ BooleanField,
+ EditButton,
+ WrapperField,
SaveButton,
SimpleForm,
+ NumberField,
useRefresh,
+ TextField,
+ DateField,
CreateBase,
+ TopToolbar,
+ FilterButton,
+ SearchInput,
+ List,
+ Create,
} from 'react-admin';
import {
Dialog,
DialogActions,
DialogContent,
DialogTitle,
- TextField,
IconButton,
MenuItem,
Tooltip,
@@ -27,8 +39,11 @@
Button,
Stack,
Grid,
+ Card,
Box,
+ CardContent,
} from '@mui/material';
+import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_PAGE_SIZE } from '@/config/setting';
import ConfirmationNumberIcon from '@mui/icons-material/ConfirmationNumber';
import DialogCloseButton from "../../components/DialogCloseButton.jsx";
import WarehouseSelect from "../../components/WarehouseSelect.jsx";
@@ -36,21 +51,13 @@
import { DataGrid, useGridApiRef } from '@mui/x-data-grid';
import ConfirmButton from "../../components/ConfirmButton";
import { Add, Edit, Delete } from '@mui/icons-material';
+import SelectLocsRevise from "./SelectLocsRevise.jsx";
import DictSelect from "../../components/DictSelect";
import SaveIcon from '@mui/icons-material/Save';
import { styled } from '@mui/material/styles';
+import { redirect } from "react-router";
import request from '@/utils/request';
import _, { set } from 'lodash';
-
-const StyledSimpleForm = styled(SimpleForm)(({ theme }) => ({
- '& .MuiToolbar-root-RaToolbar-root': {
- '& .RaToolbar-defaultToolbar': {
- justifyContent: 'flex-end',
- }
- }
-
-}));
-
const LocReviseCreate = (props) => {
const { open, setOpen, orderId } = props;
@@ -60,6 +67,7 @@
const translate = useTranslate();
const [tabelData, setTableData] = useState([]);
const [disabled, setDisabled] = useState(false);
+ const [isVisible, setIsVisible] = useState("block");
const [selectedRows, setSelectedRows] = useState([]);
const [createDialog, setCreateDialog] = useState(false);
const [formData, setFormData] = useState({ type: '0', orgAreaId: null, tarAreaId: null, exceTime: null, code: null });
@@ -74,38 +82,46 @@
setTableData([...tabelData]);
}
- const handleSubmit = async () => {
- setFinally()
- setDisabled(true)
+ const FormToolbar = () => {
+ return (
+ <Toolbar sx={{ justifyContent: 'flex-end' }}>
+ <SaveButton disabled={disabled} />
+ <DeleteButton mutationMode="optimistic" />
+ </Toolbar>
+ )
+ }
+ // const handleSubmit = async () => {
+ // setFinally()
+ // setDisabled(true)
- if (orderId == null || orderId == undefined) {
- const parmas = {
- "revise": formData,
- "items": tabelData,
- }
+ // if (orderId == null || orderId == undefined) {
+ // const parmas = {
+ // "revise": formData,
+ // "items": tabelData,
+ // }
- const res = await request.post(`/transfer/items/save`, parmas);
- if (res?.data?.code === 200) {
- setOpen(false);
- } else {
- notify(res.data.msg);
- }
- } else {
- const parmas = {
- "transfer": formData,
- "items": tabelData,
- }
- const res = await request.post(`/transfer/items/update`, parmas);
- if (res?.data?.code === 200) {
- setOpen(false);
- } else {
- notify(res.data.msg);
- }
- }
- setDisabled(false)
- refresh();
+ // const res = await request.post(`/transfer/items/save`, parmas);
+ // if (res?.data?.code === 200) {
+ // setOpen(false);
+ // } else {
+ // notify(res.data.msg);
+ // }
+ // } else {
+ // const parmas = {
+ // "transfer": formData,
+ // "items": tabelData,
+ // }
+ // const res = await request.post(`/transfer/items/update`, parmas);
+ // if (res?.data?.code === 200) {
+ // setOpen(false);
+ // } else {
+ // notify(res.data.msg);
+ // }
+ // }
+ // setDisabled(false)
+ // refresh();
- };
+ // };
const handleDeleteItem = () => {
const newTableData = _.filter(tabelData, (item) => !selectedRows.includes(item.matnrId));
@@ -113,20 +129,15 @@
}
const newAddClick = () => {
- if (formData.areaId == null || formData.areaId == undefined) {
- notify("搴撳尯涓嶈兘涓虹┖锛侊紒", { type: 'error' })
- return
- }
setCreateDialog(true)
}
const mutationOptions = {
onSuccess: (data) => {
- notify(`鏂囩珷 "${data.title}" 鍒涘缓鎴愬姛`, { type: 'success' });
+ setIsVisible("block")
+ setDisabled(true)
+ refresh()
},
- onError: (error) => {
- notify(`鍒涘缓澶辫触: ${error.message}`, { type: 'error' });
- }
};
const handleChange = (value, name) => {
@@ -139,20 +150,15 @@
return (
<>
<Box sx={{ padding: 1 }}>
- <CreateBase resource="locRevise" mutationOptions={mutationOptions} >
- <SimpleForm >
+ <Create resource="locRevise"
+ title={false}
+ mutationOptions={mutationOptions} >
+ <SimpleForm toolbar={<FormToolbar />}>
<Grid container spacing={2} sx={{
'& .MuiToolbar-root-RaToolbar-root.RaToolbar-defaultToolbar': {
justifyContent: 'flex-end',
}
}}>
- <Grid item md={2}>
- <TextInput
- source="code"
- label={translate("table.field.locRevise.code")}
- readOnly
- />
- </Grid>
<Grid item md={2}>
<AutocompleteInput
choices={dicts}
@@ -160,6 +166,7 @@
optionValue="value"
defaultValue="1"
source="type"
+ parse={v => v}
label={translate("table.field.transfer.type")}
/>
</Grid>
@@ -168,6 +175,7 @@
<AutocompleteInput
optionText='name'
optionValue="id"
+ parse={v => v}
label={translate("table.field.locRevise.areaName")}
/>
</ReferenceInput>
@@ -175,36 +183,38 @@
<Grid item md={2}>
<DateInput
source="exceTime"
+ parse={v => v}
label="table.field.locRevise.exceTime"
/>
</Grid>
</Grid>
</SimpleForm>
- </CreateBase>
- <Box sx={{ mt: 2 }}>
- <Stack direction="row" spacing={2} sx={{ justifyContent: "flex-end" }}>
- <Button variant="contained" onClick={newAddClick} >
- {translate('common.action.newAddMats')}
- </Button>
- <ConfirmButton label={"toolbar.delete"} variant="outlined" color="error" onConfirm={handleDeleteItem} />
- </Stack>
+ </Create>
+ <Box sx={{ display: isVisible }}>
+ <Card sx={{ height: 630 }}>
+ <Box>
+ <Box sx={{ mt: 2 }}>
+ <Stack direction="row" spacing={2} sx={{ justifyContent: "flex-start" }}>
+ <Button variant="contained" onClick={newAddClick} >
+ {translate('common.action.newAddMats')}
+ </Button>
+ <ConfirmButton label={"toolbar.delete"} variant="outlined" color="error" onConfirm={handleDeleteItem} />
+ </Stack>
+ </Box>
+ <Box sx={{ mt: 2 }}>
+ <TransferTableView
+ tabelData={tabelData}
+ setTableData={setTableData}
+ orderId={orderId}
+ selectedRows={selectedRows}
+ setSelectedRows={setSelectedRows}
+ tableRef={tableRef}>
+ </TransferTableView>
+ </Box>
+ </Box>
+ </Card>
</Box>
- <Box sx={{ mt: 2 }}>
- <TransferTableView
- tabelData={tabelData}
- setTableData={setTableData}
- orderId={orderId}
- selectedRows={selectedRows}
- setSelectedRows={setSelectedRows}
- tableRef={tableRef}>
- </TransferTableView>
- </Box>
- <Toolbar sx={{ width: '100%', justifyContent: 'flex-start', bgcolor: 'white' }} >
- <Button disabled={disabled} onClick={handleSubmit} variant="contained" startIcon={<SaveIcon />}>
- {translate('toolbar.confirm')}
- </Button>
- </Toolbar>
- {/* <CreateBySelectMats
+ <SelectLocsRevise
data={tabelData}
queryForm={formData}
open={createDialog}
@@ -212,7 +222,7 @@
selectedRows={selectedRows}
setSelectedRows={setSelectedRows}
setData={setTableData}
- /> */}
+ />
</Box>
</>
)
@@ -332,20 +342,20 @@
const notify = useNotify();
const [columns, setColumns] = useState([
{
- field: 'maktx',
- headerName: translate('table.field.outStockItem.maktx'),
- width: 250,
+ field: 'code',
+ headerName: translate('table.field.locItem.locCode'),
+ width: 100,
editable: false,
},
{
- field: 'matnrCode',
- headerName: translate('table.field.outStockItem.matnrCode'),
+ field: 'areaId',
+ headerName: translate('table.field.loc.areaId'),
width: 130,
editable: false,
},
{
- field: 'anfme',
- headerName: translate('table.field.outStockItem.anfme'),
+ field: 'type',
+ headerName: translate('table.field.loc.type'),
type: 'number',
minWidth: 100,
flex: 1,
@@ -353,8 +363,8 @@
valueFormatter: (val) => val < 0 ? 0 : val,
},
{
- field: 'splrCode',
- headerName: translate('table.field.outStockItem.splrCode'),
+ field: 'warehouseId',
+ headerName: translate('table.field.loc.warehouseId'),
minWidth: 100,
flex: 1,
editable: true,
@@ -363,8 +373,8 @@
),
},
{
- field: 'splrName',
- headerName: translate('table.field.outStockItem.splrName') + "*",
+ field: 'useStatus',
+ headerName: translate('table.field.loc.useStatus') + "*",
minWidth: 100,
flex: 1,
editable: true,
@@ -373,18 +383,32 @@
),
},
{
- field: 'batch',
- headerName: translate('table.field.outStockItem.splrBatch'),
+ field: 'channel',
+ headerName: translate('table.field.loc.channel'),
minWidth: 100,
flex: 1,
editable: true,
},
{
- field: 'stockUnit',
- headerName: translate('table.field.outStockItem.stockUnit'),
+ field: 'row',
+ headerName: translate('table.field.loc.row'),
minWidth: 100,
flex: 1,
- editable: true,
+ editable: false,
+ },
+ {
+ field: 'col',
+ headerName: translate('table.field.loc.col'),
+ minWidth: 100,
+ flex: 1,
+ editable: false,
+ },
+ {
+ field: 'lev',
+ headerName: translate('table.field.loc.lev'),
+ minWidth: 100,
+ flex: 1,
+ editable: false,
},
])
@@ -404,49 +428,39 @@
let cdata = useRef([]);
- useEffect(() => {
- if (extendColumns == undefined || extendColumns.length < 1) {
- getDynamicFields();
- }
- }, []);
+ // useEffect(() => {
+ // if (extendColumns == undefined || extendColumns.length < 1) {
+ // getDynamicFields();
+ // }
+ // }, []);
useEffect(() => {
cdata.current = tabelData
}, [tabelData]);
- const getDynamicFields = async () => {
- const {
- data: { code, data, msg },
- } = await request.get("/fields/enable/list");
- if (code === 200) {
- const cols = data.map(el => ({
- field: el.fields,
- headerName: el.fieldsAlise,
- minWidth: 100,
- flex: 1,
- editable: false
- }))
- setColumns([...columns, ...cols, action])
- setExtendColumns(cols);
- } else {
- notify(msg);
- }
- }
-
+ // const getDynamicFields = async () => {
+ // const {
+ // data: { code, data, msg },
+ // } = await request.get("/fields/enable/list");
+ // if (code === 200) {
+ // const cols = data.map(el => ({
+ // field: el.fields,
+ // headerName: el.fieldsAlise,
+ // minWidth: 100,
+ // flex: 1,
+ // editable: false
+ // }))
+ // setColumns([...columns, ...cols, action])
+ // setExtendColumns(cols);
+ // } else {
+ // notify(msg);
+ // }
+ // }
const handleDelete = (row) => {
const newData = _.filter(cdata.current, (item) => item.matnrId !== row.matnrId);
setTableData(newData);
- };
-
-
- const processRowUpdate = (newRow, oldRow) => {
- const rows = tabelData.map((r) =>
- r.matnrId === newRow.matnrId ? { ...newRow } : r
- )
- setTableData(rows)
- return newRow;
};
const handleSelectionChange = (ids) => {
@@ -454,11 +468,7 @@
};
tableRef.current = useGridApiRef();
-
const tableIds = tabelData.map(map => map.id);
- // setSelectedRows(tableIds);
- // // console.log(selectedRows);
-
return (
<Box>
@@ -480,7 +490,7 @@
rowSelectionModel={tableIds}
onRowSelectionModelChange={handleSelectionChange}
sx={{
- height: 580,
+ height: 500,
'& .MuiDataGrid-cell input': {
border: '1px solid #ccc'
},
--
Gitblit v1.9.1