From 0cf1c13ac668cdb689b073c3961592d8ab41316c Mon Sep 17 00:00:00 2001
From: skyouc
Date: 星期三, 21 五月 2025 19:35:17 +0800
Subject: [PATCH] 拣料出库任务优化
---
rsf-admin/src/page/outWork/outBound/OutBoundList.jsx | 112 +++++++++++++++++++++++++++++++++++++++++---------------
1 files changed, 82 insertions(+), 30 deletions(-)
diff --git a/rsf-admin/src/page/outWork/outBound/OutBoundList.jsx b/rsf-admin/src/page/outWork/outBound/OutBoundList.jsx
index 6afcfcd..45573d3 100644
--- a/rsf-admin/src/page/outWork/outBound/OutBoundList.jsx
+++ b/rsf-admin/src/page/outWork/outBound/OutBoundList.jsx
@@ -57,12 +57,16 @@
import request from '@/utils/request';
import LocItemInfoModal from "./locItemInfoModal";
import { Delete } from '@mui/icons-material';
+import _, { set } from 'lodash';
+import StaSelect from "./StaSelect";
const OutBoundList = () => {
const [createDialog, setCreateDialog] = useState(false);
const [tabelData, setTableData] = useState([]);
const [selectedRows, setSelectedRows] = useState([]);
+ const [sta,setSta] = useState("");
+ const notify = useNotify();
const tableRef = useRef();
tableRef.current = useGridApiRef();
const translate = useTranslate();
@@ -71,6 +75,19 @@
const newTableData = _.filter(tabelData, (item) => !selectedRows.includes(item.matnrId));
setTableData(newTableData);
}
+
+ // 娣诲姞涓�涓鐞嗘柊鏁版嵁鐨勫嚱鏁帮紝璁剧疆outQty榛樿鍊�
+ const handleSetData = (newData) => {
+ // 涓烘柊娣诲姞鐨勬暟鎹缃畂utQty榛樿鍊间负anfme鐨勫��
+ const dataWithDefaultQty = newData.map(item => ({
+ ...item,
+ outQty: item.outQty || item.anfme // 濡傛灉outQty宸插瓨鍦ㄥ垯淇濈暀锛屽惁鍒欎娇鐢╝nfme鐨勫��
+ }));
+ setTableData([...tabelData, ...dataWithDefaultQty]);
+ };
+
+
+
return (
<>
<Card sx={{ p: 2, mb: 2, mt:2}}>
@@ -88,37 +105,42 @@
onClick={() => setCreateDialog(true)}
>
{translate('table.field.outBound.withdrawal')}
- </Button>
- <ConfirmButton
- label={'鍒犻櫎'}
- variant="outlined"
- color="error"
- onConfirm={handleDeleteItem}
- />
+ </Button>
</Stack>
</Box>
</Grid>
</Grid>
</Card>
- <Card sx={{ p: 2, mb: 2, mt:2}}>
- <Box sx={{ display: 'flex', flexDirection: 'column', gap: 3 }}>
- <Grid container spacing={2}>
- <Grid item md={2}>
- <Box sx={{ display: 'flex', flexDirection: 'row', alignItems: 'center', gap: 1 }}>
- <Typography width={100} vvariant="h6" gutterBottom>
+ <Card sx={{ p: 2, mb: 2}}>
+ <Form>
+ <Grid container spacing={2}>
+ <Grid item xs={12}>
+ <Box sx={{ display: 'flex', flexDirection: 'column', alignItems: 'flex-start', gap: 1 }}>
+ <Typography variant="h6" >
{translate('table.field.outBound.outSta')}
- </Typography>
- <DictSelect
- label={translate("table.field.outStock.wkType")}
- variant="filled"
- group='2'
- dictTypeCode="sys_business_type"
- required
+ </Typography>
+ <Stack direction='row' spacing={2} minWidth={200}>
+ <StaSelect
+ source="sta"
+ label={translate("table.field.outBound.outSta")}
+ onChange={(e) => {
+ setSta(e.target.value);
+ console.log("绔欑偣宸查�夋嫨:", e.target.value);
+ }}
+ size="small"
+ type="1"
/>
- </Box>
- </Grid>
- </Grid>
- </Box>
+ </Stack>
+ <Stack direction='row' spacing={2} minWidth={200}>
+ <SubmitButton
+ sta={sta}
+ data={tabelData}
+ />
+ </Stack>
+ </Box>
+ </Grid>
+ </Grid>
+ </Form>
</Card>
<Card sx={{ mb: 2}}>
<Box sx={{ }}>
@@ -129,7 +151,7 @@
open={createDialog}
setOpen={setCreateDialog}
data={tabelData}
- setData={setTableData}
+ setData={handleSetData}
/>
</>
@@ -138,6 +160,36 @@
export default OutBoundList;
+const SubmitButton = (props) =>{
+ const translate = useTranslate();
+ const notify = useNotify();
+ const { sta, data } = props;
+ const check = ()=>{
+ if(sta === "" || sta === undefined || sta === null){
+ notify("璇烽�夋嫨绔欑偣");
+ return;
+ }
+ if(data.length === 0){
+ notify("璇烽�夋嫨鐗╂枡");
+ return;
+ }
+ http(sta,data);
+
+ }
+ const http = async (sta,data) => {
+ console.log("鎻愪氦鏁版嵁",sta,data);
+ }
+ return (
+ <Button
+ variant="contained"
+ color="primary"
+ onClick={check}
+ >
+ {translate('table.field.outBound.createTask')}
+ </Button>
+ )
+
+}
const ModalTable = ({ tabelData, setTableData, selectedRows, setSelectedRows, tableRef }) => {
const translate = useTranslate();
@@ -146,9 +198,10 @@
const [columns, setColumns] = useState([
{
field: 'outQty',
- headerName: translate('table.field.outBound.outQty'),
+ headerName: translate('table.field.outBound.outQty')+"*",
width: 100,
- editable: true,
+ editable: true,
+ headerClassName: "custom",
},
{
field: 'anfme',
@@ -201,7 +254,6 @@
cdata.current = tabelData
}, [tabelData]);
-
const getDynamicFields = async () => {
const {
data: { code, data, msg },
@@ -222,14 +274,14 @@
const handleDelete = (row) => {
- const newData = _.filter(cdata.current, (item) => item.matnrId !== row.matnrId);
+ const newData = _.filter(cdata.current, (item) => item.id !== row.id);
setTableData(newData);
};
const processRowUpdate = (newRow, oldRow) => {
const rows = tabelData.map((r) =>
- r.matnrId === newRow.matnrId ? { ...newRow } : r
+ r.id === newRow.id ? { ...newRow } : r
)
setTableData(rows)
return newRow;
--
Gitblit v1.9.1