| | |
| | | |
| | | let shelfThree; |
| | | |
| | | const startThree = (dom) => { |
| | | shelfThree = new ShelfThree(dom); |
| | | shelfThree.startup(); |
| | | } |
| | | |
| | | const endThree = () => { |
| | | if (shelfThree) { |
| | | shelfThree.destroy(); |
| | | shelfThree = null; |
| | | } |
| | | } |
| | | |
| | | const ShelfView = (props) => { |
| | | const intl = useIntl(); |
| | | const { styles } = useStyles(); |
| | | const refContainer = useRef(); |
| | | const [loading, setLoading] = React.useState(false); |
| | | |
| | | const startThree = () => { |
| | | shelfThree = new ShelfThree(refContainer.current); |
| | | shelfThree.startup(); |
| | | } |
| | | const [shelfList, setShelfList] = React.useState([]); |
| | | |
| | | const endThree = () => { |
| | | if (shelfThree) { |
| | | shelfThree.destroy(); |
| | | shelfThree = null; |
| | | } |
| | | } |
| | | |
| | | |
| | | useEffect(() => { |
| | | // locNo data |
| | | const fetchShelfInfo = async (locNo) => { |
| | | const res = await Http.doGet('/api/map/shelf/info', { locNo: locNo }); |
| | | if (res?.data) { |
| | | console.log(res.data); |
| | | } |
| | | } |
| | | fetchShelfInfo(props.locNo); |
| | | |
| | | // 3d |
| | | setLoading(true); |
| | | endThree(); |
| | | setTimeout(() => { |
| | | setLoading(false); |
| | | startThree(); |
| | | startThree(refContainer.current); |
| | | }, 300) |
| | | |
| | | return endThree; |