| | |
| | | const columns = [ |
| | | { field: 'id', headerName: 'ID', width: 100 }, |
| | | { field: 'areaId$', headerName: translate('table.field.locAreaMatRela.areaId'), width: 100 }, |
| | | { field: 'locId$', headerName: translate('table.field.locAreaMatRela.locId'), width: 100 }, |
| | | { field: 'locTypeId$', headerName: translate('table.field.locAreaMatRela.locTypeId'), width: 100 }, |
| | | { field: 'matnrId$', headerName: translate('table.field.locAreaMatRela.matnrId'), width: 100 }, |
| | | { field: 'groupId$', headerName: translate('table.field.locAreaMatRela.groupId'), width: 100 }, |
| | | { field: 'locTypeId$', headerName: translate('table.field.locAreaMatRela.locTypeId'), width: 100 }, |
| | | { field: 'locId$', headerName: translate('table.field.locAreaMatRela.locId'), width: 100 }, |
| | | { |
| | | field: 'action', |
| | | headerName: '操作', |
| | |
| | | |
| | | const [parmas, setParmas] = useState({ |
| | | areaMatId: record.id, |
| | | locTypeId: '', |
| | | groupId: '', |
| | | }); |
| | | |
| | | const [tableData, setTableData] = useState([]); |
| | |
| | | <Grid container spacing={2}> |
| | | {/* 物料分组 */} |
| | | <Grid item xs={2}> |
| | | <MatnrTree matnrTree={matnrTree} setParmas={setParmas} reload={reload} /> |
| | | <MatnrTree matnrTree={matnrTree} parmas={parmas} setParmas={setParmas} reload={reload} /> |
| | | </Grid> |
| | | |
| | | {/* 库位类型 */} |
| | | <Grid item xs={2}> |
| | | <LocTree locTree={locTree} setParmas={setParmas} reload={reload} /> |
| | | <LocTree locTree={locTree} parmas={parmas} setParmas={setParmas} reload={reload} /> |
| | | </Grid> |
| | | |
| | | {/* 其他内容 */} |
| | |
| | | export default LocAreaMatPanel; |
| | | |
| | | |
| | | const MatnrTree = ({ matnrTree, setParmas, reload }) => { |
| | | const MatnrTree = ({ matnrTree, parmas, setParmas, reload }) => { |
| | | |
| | | const record = useRecordContext(); |
| | | const notify = useNotify(); |
| | |
| | | groupId: selectedItems |
| | | } |
| | | |
| | | const res = await request.post(`/locAreaMatRela/group/remove/`, parmas); |
| | | const res = await request.post(`/locAreaMatRela/group/remove`, parmas); |
| | | if (res?.data?.code === 200) { |
| | | reload() |
| | | notify(res.data.msg); |
| | |
| | | }; |
| | | |
| | | const handleNodeSelect = (event, nodeId) => { |
| | | event.stopPropagation() |
| | | event.stopPropagation(); |
| | | parmas.groupId = nodeId; |
| | | setParmas(parmas) |
| | | reload() |
| | | }; |
| | | |
| | | return ( |
| | |
| | | multiSelect |
| | | items={matnrTree} |
| | | apiRef={apiRef} |
| | | selectedItems={selectedItems} |
| | | getItemId={(item) => item.id} |
| | | getItemLabel={(item) => item.name} |
| | | defaultExpandedItems={['grid']} |
| | | selectedItems={selectedItems} |
| | | onSelectedItemsChange={handleSelectedItemsChange} |
| | | onItemSelectionToggle={handleItemSelectionToggle} |
| | | onItemClick={handleNodeSelect} |
| | |
| | | ) |
| | | } |
| | | |
| | | const LocTree = ({ locTree, setParmas, reload }) => { |
| | | const LocTree = ({ locTree, setParmas, parmas, reload }) => { |
| | | |
| | | const record = useRecordContext(); |
| | | const notify = useNotify(); |
| | |
| | | }; |
| | | |
| | | const handleNodeSelect = (event, nodeId) => { |
| | | // event.preventDefault(); |
| | | console.log(nodeId) |
| | | event.stopPropagation(); |
| | | parmas.locTypeId = nodeId; |
| | | setParmas(parmas) |
| | | reload() |
| | | }; |
| | | |
| | | return ( |