zhaojijng 2 éve
szülő
commit
bd86f3c705

+ 2 - 2
src/components/SearchInput/index.tsx

@@ -10,7 +10,7 @@ type mapResType = {
   [key: string]: any;
 };
 import { querySpace } from '@/services/ant-design-pro/environment';
-
+import { projectId } from '@/config/api.js';
 const { Option } = Select;
 
 type SearchInputProps = {
@@ -20,7 +20,6 @@ type SearchInputProps = {
 const SearchInput: React.FC<SearchInputProps> = ({ mapList }) => {
   const [matchData, setMatchData] = useState<mapResType[]>([]);
   const [value, setValue] = useState<any>();
-  const { projectId } = useModel('spaceFunc');
   const { changeSearchBuildId, changeSearchFloorId, changeSearchText } = useModel('searchInfo');
 
   //这是搜索 的下拉列表的显示
@@ -56,6 +55,7 @@ const SearchInput: React.FC<SearchInputProps> = ({ mapList }) => {
 
   //这是搜索的下拉列表的点击
   const handleChange = (sel: string) => {
+    debugger;
     setValue(null); //清空输入的值
     setMatchData([]); //清空搜索匹配列表
     var filterItem = matchData.filter((item) => {

+ 7 - 4
src/components/map/index.tsx

@@ -29,6 +29,9 @@ const Map: React.FC<MapProps> = ({ type, selFloorId, render, mapList, mapSize })
   const [translateX, setTranslateX] = useState<number>(0);
   const [translateY, setTranslateY] = useState<number>(0);
   const [mscale, setMscale] = useState<number>(1);
+  //最大的缩放比例
+  const [maxscale, setMaxscale] = useState<number>(1.6);
+  const [minscale, setMinscale] = useState<number>(0.3);
   const [canMove, setCanMove] = useState<boolean>(false);
 
   const [mapKey, setMapKey] = useState<number>(0);
@@ -58,10 +61,7 @@ const Map: React.FC<MapProps> = ({ type, selFloorId, render, mapList, mapSize })
       setStartPageY(event.pageY);
     }
   };
-  //最大的缩放比例
-  const maxscale = 1.6;
-  //最小的缩放比例
-  const minscale = 0.3;
+
   const mapZoom = (event: React.MouseEvent) => {
     event.stopPropagation();
     if (mscale < maxscale) {
@@ -79,6 +79,9 @@ const Map: React.FC<MapProps> = ({ type, selFloorId, render, mapList, mapSize })
   useEffect(() => {
     var scale = fixWidth / mapSize.width;
     setMscale(scale);
+    if (scale < 0.3) {
+      setMinscale(scale);
+    }
   }, [mapSize]);
 
   //当地图发生改变时 的搜索

+ 1 - 1
src/components/topNavigator/index.tsx

@@ -5,6 +5,7 @@ import { Select } from 'antd';
 
 import type { navigatorItem } from '@/pages/Environment/index';
 import { getBuildingList, getFloorList } from '@/services/ant-design-pro/environment';
+import { projectId } from '@/config/api.js';
 import { useModel } from 'umi';
 export type topNavigatorProps = {
   navigatorList?: navigatorItem[];
@@ -33,7 +34,6 @@ const TopNavigator: React.FC<topNavigatorProps> = ({
   changeBuildId,
   selParamObj,
 }) => {
-  const { projectId } = useModel('spaceFunc');
   //存储的 搜索到空间的buildingId floorId
   const { searchBuildId, searchFloorId } = useModel('searchInfo');
   const [buildList, setBuildList] = useState<buildItem[]>([]);

+ 2 - 0
src/config/api.js

@@ -1 +1,3 @@
 export const BASE_PATH = '/api';
+export const projectId = 'Pj3301100002';
+  //const projectId = 'Pj1101080259';

+ 1 - 4
src/models/spaceFunc.ts

@@ -43,11 +43,8 @@ export default function () {
       }
     }
   }, []);
-  //const projectId = 'Pj1101080259';
-  const projectId = 'Pj3301100002';
-  window.localStorage.setItem('localProjectId', projectId);
+
   return {
     getSpaceFunc,
-    projectId,
   };
 }

+ 4 - 1
src/pages/Environment/index.tsx

@@ -7,6 +7,7 @@ import TopNavigator from '@/components/topNavigator';
 import ChartModal from './components/chartModal';
 import moment from 'moment';
 import { getMapList, queryEnvironmentParam } from '@/services/ant-design-pro/environment';
+import { projectId } from '@/config/api.js';
 import { equipImageMap } from '@/config/image.js';
 import { Spin } from 'antd';
 import Icon from '@/tenants-ui/Icon';
@@ -27,7 +28,6 @@ export type navigatorItem = {
   [key: string]: any;
 };
 const Environment: React.FC = () => {
-  const { projectId } = useModel('spaceFunc');
   const { envir_temperature, envir_wet, envir_co2, envir_pm25, envir_jiaquan } = equipImageMap;
 
   const [searchText, setSearchText] = useState<{ text: any }>();
@@ -154,6 +154,9 @@ const Environment: React.FC = () => {
             height: (res.data || {}).height,
           };
           setMapSize(mapSize);
+          //   data.forEach((item) => {
+          //     console.log('item', item);
+          //   });
           setMapList(data);
         })
         .catch(() => {

+ 1 - 1
src/pages/Equipment/components/deviceModal/index.jsx

@@ -9,9 +9,9 @@ import CurtainEq from './curtainEq';
 import { getSpaceAdjustList } from '@/services/ant-design-pro/equipment';
 import { useRef } from 'react';
 import { useModel } from 'umi';
+import { projectId } from '@/config/api.js';
 
 export default ({ onClose, showSpace }) => {
-  const { projectId } = useModel('spaceFunc');
   const envArr = [
     {
       name: '温度',

+ 2 - 2
src/pages/Equipment/components/topNavRight/index.tsx

@@ -6,8 +6,8 @@ import { EllipsisOutlined, ExclamationCircleOutlined } from '@ant-design/icons';
 import styles from './index.less';
 //import { equipImageMap } from '@/config/image.js';
 import type { navigatorItem } from '@/pages/Environment/index';
+import { projectId } from '@/config/api.js';
 
-import { useModel } from 'umi';
 import { changeCurtain, changeAllAir, changeLight } from '@/pages/Equipment/equipmentControl';
 
 export type topNavRightProps = {
@@ -25,7 +25,7 @@ const TopNavRight: React.FC<topNavRightProps> = ({
 }) => {
   //const [modalvisible, setModalvisible] = useState<boolean>(false);
   //去掉全部设备的 设备列表
-  const { projectId } = useModel('spaceFunc');
+
   const [deviceList, setDeviceList] = useState<navigatorItem[]>([]);
   useEffect(() => {
     setDeviceList(navigatorList.slice(1));

+ 2 - 1
src/pages/Equipment/index.tsx

@@ -17,6 +17,7 @@ import { ExclamationCircleOutlined } from '@ant-design/icons';
 import { equipImageMap } from '@/config/image.js';
 import Icon from '@/tenants-ui/Icon';
 import type { navigatorItem } from '@/pages/Environment/index';
+import { projectId } from '@/config/api.js';
 import {
   getMapList,
   queryEquipStatistics,
@@ -42,7 +43,7 @@ type statistics = {
   runCount: number;
 };
 const Environment: React.FC = () => {
-  const { getSpaceFunc, projectId } = useModel('spaceFunc');
+  const { getSpaceFunc } = useModel('spaceFunc');
   const { changeSearchFloorId } = useModel('searchInfo');
   const { envir_all, equip_air, equip_lamp, envir_curtain } = equipImageMap;
 

+ 2 - 1
src/services/ant-design-pro/environment.ts

@@ -1,5 +1,6 @@
 /** 登录接口 POST /api/login/account */
 import { request } from 'umi';
+import { projectId } from '@/config/api.js';
 
 export async function getMapList(body: any, options?: { [key: string]: any }) {
   return request<API.MapInfoRes>('/sgadmin/duoduo-service/setup-service/map/queryMapInfo', {
@@ -51,7 +52,7 @@ export async function queryDeviceTimeManage(params: any, options?: { [key: strin
 }
 
 function getProjectId() {
-  const id = window.localStorage.getItem('localProjectId');
+  const id = projectId;
   return id;
 }
 

+ 3 - 2
src/services/ant-design-pro/equipment.js

@@ -1,8 +1,9 @@
 import { request } from 'umi';
-import { projectId } from '@/models/spaceFunc.ts';
+import { projectId } from '@/config/api.js';
 
 function getProjectId() {
-    const id = window.localStorage.getItem('localProjectId')
+    //const id = window.localStorage.getItem('localProjectId')
+    const id = projectId
     return id;
 }
 

+ 1 - 2
src/services/ant-design-pro/index.ts

@@ -4,9 +4,8 @@
 // API 唯一标识:
 import * as api from './api';
 import * as login from './login';
-import * as environment from './environment';
+
 export default {
   api,
   login,
-  environment,
 };