Просмотр исходного кода

默认选中之前选中的楼层 建筑

zhaojijng 2 лет назад
Родитель
Сommit
e015853da6
3 измененных файлов с 23 добавлено и 2 удалено
  1. 21 0
      src/models/buildFloor.ts
  2. 1 1
      src/pages/Runtime/index.tsx
  3. 1 1
      src/sgcomponents/map/index.tsx

+ 21 - 0
src/models/buildFloor.ts

@@ -0,0 +1,21 @@
+import React, { useState, useCallback } from 'react';
+
+export default function () {
+  const [lastBuildId, setLastBuildId] = useState<string>(''); //最后选择的建筑id
+  const [lastFloorId, setLastFloorId] = useState<string>(''); //最后选择的楼层id
+
+  const changeLastBuildId = useCallback((value: string) => {
+    setLastBuildId(value);
+  }, []);
+
+  const changeLastFloorId = useCallback((value: string) => {
+    setLastFloorId(value);
+  }, []);
+
+  return {
+    lastBuildId,
+    lastFloorId,
+    changeLastBuildId,
+    changeLastFloorId,
+  };
+}

+ 1 - 1
src/pages/Runtime/index.tsx

@@ -110,7 +110,7 @@ const Runtime: React.FC = () => {
             ritem.runTimeStatus = 'overtimeWork'; //加班
           }
           ritem.showTimeList = timeList;
-          console.log('timeList', timeList);
+          //console.log('timeList', timeList);
           ritem.showTimeStr =
             timeList.length > 0
               ? timeList[0][0] +

+ 1 - 1
src/sgcomponents/map/index.tsx

@@ -134,7 +134,7 @@ const Map: React.FC<MapProps> = ({ type, selFloorId, render, mapList, mapSize })
       if (filterItem.length == 0) return;
       //找到搜索的空间
       changeSearchSpace(filterItem[0]);
-      console.log('selectSpace2', filterItem[0]);
+      //console.log('selectSpace2', filterItem[0]);
       left = -((filterItem[0] || {}).left || 0);
       top = -((filterItem[0] || {}).top || 0);
       var mapWrapWidth = (mapRef.current || {}).clientWidth || 0;