| | |
| | | tableRef.current = useGridApiRef(); |
| | | const translate = useTranslate(); |
| | | |
| | | const [orgLoc, setOrgLoc] = useState([]); |
| | | const [tarLoc, setTarLoc] = useState([]); |
| | | const [orgLoc, setOrgLoc] = useState(""); |
| | | const [tarLoc, setTarLoc] = useState(""); |
| | | const [tarLocList, setTarLocList] = useState([]); |
| | | |
| | | useEffect(() => { |
| | | selectAreaNoUse(); |
| | | if (orgLoc === "" || orgLoc.length < 7) { |
| | | return; |
| | | } |
| | | selectLocItem().then((is) => { |
| | | if (is) { |
| | | selectAreaNoUse(); |
| | | } |
| | | |
| | | }); |
| | | },[orgLoc]) |
| | | |
| | | |
| | | const selectLocItem = async() =>{ |
| | | const { |
| | | data: { code, data, msg }, |
| | | } = await request.post("/locItem/page",{ |
| | | locCode: orgLoc, |
| | | current: 1, |
| | | pageSize: 100, |
| | | orderBy: "create_time desc" |
| | | }); |
| | | if (code === 200) { |
| | | if(data.total !== 0) { |
| | | setTableData(data.records); |
| | | return true; |
| | | } |
| | | |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | const selectAreaNoUse = async() =>{ |
| | | const { |
| | | data: { code, data, msg }, |
| | | } = await request.post("/loc/areaNoUse/list",{ |
| | | |
| | | locCode: orgLoc |
| | | }); |
| | | if (code === 200) { |
| | | const newData = data.map((item) => { |
| | |
| | | flex: 1, |
| | | editable: false |
| | | })) |
| | | setColumns([...columns, ...cols, action]) |
| | | setColumns([...columns, ...cols]) |
| | | } else { |
| | | notify(msg); |
| | | } |
| | |
| | | <DataGrid |
| | | apiRef={tableRef} |
| | | rows={tabelData} |
| | | columns={columns} |
| | | columns={columns} |
| | | checkboxSelection = {false} |
| | | disableRowSelectionOnClick |
| | | getRowId={(row) => row.matnrId ? row.matnrId : row.id} |
| | | disableColumnFilter |
| | |
| | | }, |
| | | }} |
| | | pageSizeOptions={[10, 25, 50, 100]} |
| | | editMode="row" |
| | | checkboxSelection |
| | | editMode="row" |
| | | onRowSelectionModelChange={handleSelectionChange} |
| | | selectionModel={selectedRows} |
| | | sx={{ |