Ver código fonte

去除冗余代码

zhaojijng 2 anos atrás
pai
commit
cbdd2a3728

+ 11 - 3
config/proxy.ts

@@ -9,12 +9,20 @@
 export default {
   dev: {
     // localhost:8000/api/** -> https://preview.pro.ant.design/api/**
-    '/sgadmin': {
-      //   target: 'https://duoduoenv.sagacloud.cn/',
+    '/sgadmin/duoduo-service': {
+      //target: 'https://duoduoenv.sagacloud.cn/',
       target: 'http://10.100.28.79',
       changeOrigin: true,
       pathRewrite: {
-        '^/sgadmin': '/',
+        '^/sgadmin/duoduo-service': '/sgadmin/duoduo-service',
+      },
+    },
+    '/sgadmin/sso': {
+      //target: 'https://duoduoenv.sagacloud.cn/',
+      target: 'http://10.100.28.79',
+      changeOrigin: true,
+      pathRewrite: {
+        '^/sgadmin/sso': '/sgadmin/sso',
       },
     },
   },

+ 6 - 11
config/routes.ts

@@ -24,23 +24,23 @@
     routes: [
       {
         path: '/',
-        redirect: '/equipment',
+        redirect: '/environment',
       },
       {
         path: '/noAuth',
         component: './NoAuth',
       },
       {
-        path: '/equipment',
-        name: 'equipment',
-        component: './Equipment',
-      },
-      {
         path: '/environment',
         name: 'environment',
         component: './Environment',
       },
       {
+        path: '/equipment',
+        name: 'equipment',
+        component: './Equipment',
+      },
+      {
         path: '/runtime',
         name: 'runtime',
         component: './Runtime',
@@ -50,11 +50,6 @@
         name: 'recordList',
         component: './Runtime/RecordList',
       },
-      {
-        path: '/ceshi',
-        name: 'ceshi',
-        component: './Ceshi',
-      },
     ],
   },
 ];

+ 3 - 2
src/components/topNavigator/index.tsx

@@ -50,7 +50,7 @@ const TopNavigator: React.FC<topNavigatorProps> = ({
         //如果搜索的buildId 改变
         setCurrentBuild(searchBuildId);
       } else {
-        //显示
+        //为了 显示楼层选择
         setCurrentFloor(searchFloorId);
         //父亲的floorId
         //这块 其实只想楼层id改变时调用 建筑id 改变时不调用
@@ -115,7 +115,7 @@ const TopNavigator: React.FC<topNavigatorProps> = ({
           return { label: item.localName, value: item.id };
         }),
       );
-
+      //为了 显示楼层选择
       setCurrentFloor(searchFloorId || (resData[0] || {}).id); //如果有搜索的楼层id 则用搜索的结果
       changeFloorId && changeFloorId(searchFloorId || (resData[0] || {}).id); //改变父组件的floorId的值
     }
@@ -153,6 +153,7 @@ const TopNavigator: React.FC<topNavigatorProps> = ({
     //父亲的buildId改变
     changeBuildId && changeBuildId(val);
   }, []);
+
   const changFloorHandle = useCallback((val) => {
     setCurrentFloor(val);
 

+ 0 - 25
src/hooks/useMapList.ts

@@ -1,25 +0,0 @@
-import { useState, useEffect } from 'react';
-import { getMapList } from '@/services/ant-design-pro/environment';
-
-let mapListData: any = [];
-
-function useMapList(selFloorId: string) {
-  const [mapList, setMapList] = useState<API.MapInfo[]>([]);
-
-  //console.log(mapListData, 'mapListData');
-
-  //当selFloorId 改变时调用
-  useEffect(() => {
-    if (selFloorId) {
-      //   getMapList({ floorId: selFloorId, projectId: '' }).then((res) => {
-      //     var data: API.MapInfo[] = (res.data || {}).spaceList || [];
-      //     mapListData = data;
-      //     setMapList(data);
-      //   });
-    }
-  }, [selFloorId]);
-
-  return { mapList };
-}
-
-export { useMapList, mapListData };

+ 1 - 2
src/hooks/useMenuList.ts

@@ -6,15 +6,14 @@ export type menutype = {
 };
 export default function () {
   const [menuList, setMenuList] = useState<menutype[]>();
+  //进入时赋值
   useEffect(() => {
     //debugger;
-    //  setTimeout(() => {
     setMenuList([
       { name: '环境信息', id: 'environment' },
       { name: '设备管理', id: 'equipment' },
       { name: '运行时间', id: 'runtime' },
     ]);
-    //  }, 0);
   }, []);
 
   return { menuList };

+ 4 - 4
src/models/searchInfo.ts

@@ -1,10 +1,10 @@
 import React, { useState, useCallback } from 'react';
 
 export default function () {
-  const [searchBuildId, setSearchBuildId] = useState<string>();
-  const [searchFloorId, setSearchFloorId] = useState<string>();
-  const [searchText, setSearchText] = useState<any>({});
-  const [searchSpace, setSearchSpace] = useState<any>({});
+  const [searchBuildId, setSearchBuildId] = useState<string>(); //搜索的建筑id
+  const [searchFloorId, setSearchFloorId] = useState<string>(); //搜索的楼层id
+  const [searchText, setSearchText] = useState<any>({}); //搜索的空间名字
+  const [searchSpace, setSearchSpace] = useState<any>({}); //搜索的空间信息
   const changeSearchBuildId = useCallback((value: string) => {
     setSearchBuildId(value);
   }, []);

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

@@ -26,7 +26,6 @@ const Runtime: React.FC = () => {
   const { searchSpace } = useModel('searchInfo');
   const { getSpaceFunc } = useModel('spaceFunc');
   const [loading, setLoading] = useState<boolean>(false);
-  const [searchText, setSearchText] = useState<{ text: any }>();
   const [runtimeNav, setRuntimeNav] = useState<runtimeNavType>({});
   const [mapList, setMapList] = useState<API.MapInfo[]>([]);
   const [mapSize, setMapSize] = useState<any>({});