map.ts 552 B

123456789101112131415161718192021
  1. import React, { useState, useCallback } from 'react';
  2. import { getMapList } from '@/services/ant-design-pro/environment';
  3. export default function () {
  4. const [mapList, setMapList] = useState<API.MapInfo[]>([]);
  5. const getMapListData = useCallback((selFloorId) => {
  6. if (selFloorId) {
  7. debugger;
  8. getMapList({ floorId: selFloorId, projectId: '' }).then((res) => {
  9. var data: API.MapInfo[] = (res.data || {}).spaceList || [];
  10. setMapList(data);
  11. });
  12. }
  13. }, []);
  14. return {
  15. mapList,
  16. getMapListData,
  17. };
  18. }