rsf-admin/src/i18n/zh.js | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
rsf-admin/src/page/outWork/outBound/OutBoundList.jsx | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
rsf-admin/src/page/outWork/outBound/StaSelect.jsx | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
rsf-admin/src/page/outWork/outBound/locItemInfoModal.jsx | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
rsf-server/src/main/java/com/vincent/rsf/server/common/domain/PageParam.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
rsf-admin/src/i18n/zh.js
@@ -218,6 +218,7 @@ outSta: '出库站', outQty: '出库数量', anfme: '数量', createTask: '生成任务', }, basContainer: { rsf-admin/src/page/outWork/outBound/OutBoundList.jsx
@@ -57,12 +57,18 @@ 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 +77,19 @@ const newTableData = _.filter(tabelData, (item) => !selectedRows.includes(item.matnrId)); setTableData(newTableData); } // 添加一个处理新数据的函数,设置outQty默认值 const handleSetData = (newData) => { // 为新添加的数据设置outQty默认值为anfme的值 const dataWithDefaultQty = newData.map(item => ({ ...item, outQty: item.outQty || item.anfme // 如果outQty已存在则保留,否则使用anfme的值 })); setTableData([...tabelData, ...dataWithDefaultQty]); }; return ( <> <Card sx={{ p: 2, mb: 2, mt:2}}> @@ -88,37 +107,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 width={100} vvariant="h6" gutterBottom> {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 +153,7 @@ open={createDialog} setOpen={setCreateDialog} data={tabelData} setData={setTableData} setData={handleSetData} /> </> @@ -137,6 +161,54 @@ } export default OutBoundList; const SubmitButton = (props) =>{ const translate = useTranslate(); const notify = useNotify(); const { sta, data } = props; const check = ()=>{ if(sta === ""){ 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 BulkResortButton = () => { const record = useRecordContext(); const bulkResort = () => { resortTask([record]) }; //批量排序 const resortTask = async (row) => { } return ( <Button onClick={bulkResort} label="toolbar.resort"> <SwapVertIcon /> </Button> ) } const ModalTable = ({ tabelData, setTableData, selectedRows, setSelectedRows, tableRef }) => { @@ -146,9 +218,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 +274,6 @@ cdata.current = tabelData }, [tabelData]); const getDynamicFields = async () => { const { data: { code, data, msg }, @@ -222,14 +294,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; rsf-admin/src/page/outWork/outBound/StaSelect.jsx
New file @@ -0,0 +1,70 @@ import EditIcon from '@mui/icons-material/Edit'; import { useState, useEffect } from 'react'; import { Button, useListContext, SelectInput, required, SelectArrayInput, useTranslate, useNotify, SelectArrayInputClasses } from 'react-admin'; import request from '@/utils/request'; const StaSelect = (props) => { const { type , name, multiple = false, perPage = 100, // 默认每页显示100条数据 page = 1, // 默认第一页 ...parmas } = props; const translate = useTranslate(); const notify = useNotify(); const [list, setList] = useState([]); const [loading, setLoading] = useState(false); useEffect(() => { http(); }, [type, page, perPage]); const http = async () => { setLoading(true); try { const res = await request.post('/deviceSite/page', { type: type, current: page, pageSize: perPage }); if (res?.data?.code === 200) { setList(res.data.data.records.map((item) => { return { id: item.site, name: item.site } })); } else { notify(res.data.msg); } } catch (error) { notify('加载站点失败', 'error'); console.error('加载站点失败:', error); } finally { setLoading(false); } }; const InputComponent = multiple ? SelectArrayInput : SelectInput; return ( <SelectInput source={name} choices={list} isLoading={loading} optionValue='id' optionText='name' {...parmas} /> ); }; export default StaSelect; rsf-admin/src/page/outWork/outBound/locItemInfoModal.jsx
@@ -44,15 +44,12 @@ }; const reset = () => { setFormData({ name: '', code: '', groupId: 0 setFormData({ }) } const handleSubmit = () => { const hasarr = data.map(el => +el.matnrId) const hasarr = data.map(el => +el.id) const selectedData = selectedRows.filter(item => !hasarr.includes(item)).map(id => (tableData.find(row => row.id === id))); const value = selectedData.map((el => { const dynamicFields = dyFields.reduce((acc, item) => { @@ -60,15 +57,12 @@ return acc; }, {}); return { matnrId: el.id, maktx: el.name, matnrCode: el.code, stockUnit: el.stockUnit || '', purUnit: el.purchaseUnit || '', ...el, outQty: el.anfme, // 设置outQty默认值为anfme的值 ...dynamicFields } })) setData([...data, ...value]); setData([...value]); setOpen(false); reset(); }; @@ -120,18 +114,18 @@ <Grid container spacing={2}> <Grid item md={4}> <TextField label={translate('table.field.matnr.name')} name="name" value={formData.name} label={translate('table.field.locItem.maktx')} name="maktx" value={formData.maktx} onChange={handleChange} size="small" /> </Grid> <Grid item md={4}> <TextField label={translate('table.field.matnr.code')} name="code" value={formData.code} label={translate('table.field.locItem.matnrCode')} name="matnrCode" value={formData.matnrCode} onChange={handleChange} size="small" /> rsf-server/src/main/java/com/vincent/rsf/server/common/domain/PageParam.java
@@ -82,7 +82,9 @@ Map<String, Object> map = where.getMap(); for (String key : map.keySet()) { Object val = map.get(key); if (Cools.isEmpty(val)){ continue; } if (key.contains("Range")) { ArrayList<String> list = null; if (val instanceof ArrayList) { @@ -175,7 +177,9 @@ Map<String, Object> map = where.getMap(); for (String key : map.keySet()) { Object val = map.get(key); if (Cools.isEmpty(val)){ continue; } if (key.contains("Range")) { ArrayList<String> list = null; if (val instanceof ArrayList) {