Procházet zdrojové kódy

Merge branch 'master' of http://39.106.8.246:3003/sagacloud/sagacloud-manager-control

zhaojijng před 3 roky
rodič
revize
33ca0f663c

binární
src/assets/images/page-enviroment/chartTemp.png


binární
src/assets/images/page-enviroment/rule-co2.png


binární
src/assets/images/page-enviroment/rule-co21.png


binární
src/assets/images/page-enviroment/rule-hcho.png


binární
src/assets/images/page-enviroment/rule-pm25.png


+ 5 - 1
src/config/image.js

@@ -1,5 +1,4 @@
 export const equipImageMap = {
-  chartTemp: require('@/assets/images/page-enviroment/chartTemp.png'),
   temperMapTop: require('@/assets/images/page-enviroment/temperMapTop.png'),
   co2MapTop: require('@/assets/images/page-enviroment/co2MapTop.png'),
   maptemp1: require('@/assets/images/page-enviroment/maptemp1.png'),
@@ -27,6 +26,11 @@ export const equipImageMap = {
 
   maptemp6: require('@/assets/images/page-enviroment/maptemp6.png'),
 
+// 环境指数说明
+ruleCo2: require('@/assets/images/page-enviroment/rule-co2.png'),
+ruleHcho: require('@/assets/images/page-enviroment/rule-hcho.png'),
+rulePm25: require('@/assets/images/page-enviroment/rule-pm25.png'),
+
   // 设备
 airClose: require('@/assets/images/page-equipment/airClose.png'),
 airOpen: require('@/assets/images/page-equipment/airOpen.png'),

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 37 - 73
src/pages/Environment/components/chartModal/index.jsx


+ 21 - 1
src/pages/Environment/components/chartModal/index.less

@@ -1,5 +1,5 @@
 .main {
-  height: 680px;
+  //   height: 680px;
   background-color: #fff;
   border-radius: 20px;
   .header {
@@ -84,6 +84,26 @@
       padding-left: 22px;
       color: #4d5262;
       line-height: 22px;
+      text-align: justify;
+    }
+  }
+  .chartText {
+    padding: 10px 0;
+    color: #c4c4c4;
+  }
+  .leveSt {
+    padding-top: 40px;
+    color: #140050;
+    font-weight: 500;
+    line-height: 12px;
+  }
+  .ruleBox {
+    display: flex;
+    justify-content: center;
+    padding: 20px 0;
+    .ruleImg {
+      width: 305px;
+      height: 96px;
     }
   }
 }

+ 86 - 0
src/pages/Environment/components/chartModal/lineChart.jsx

@@ -0,0 +1,86 @@
+import React, { useState, useEffect } from 'react';
+import { Line } from '@ant-design/plots';
+import { queryPropertyData } from '@/services/ant-design-pro/environment';
+export default ({ paramObj }) => {
+  let [data, setData] = useState([]);
+  let [levelMax, setLevelMax] = useState(0);
+  const dealTime = (date) => {
+    const str = date.substr(8, 4);
+    const time = str.slice(0, 2) + ':' + str.slice(2);
+    return time;
+  };
+  useEffect(() => {
+    if (paramObj.id) {
+      fn();
+    }
+  }, [paramObj]);
+  const fn = async () => {
+    setData([]);
+    let dataArr = [];
+    if (paramObj.id == 'Tdb,RH') {
+      const arrId = paramObj.id.split(',');
+      let resArr = [];
+      arrId.forEach((item, idx) => {
+        const type = item == 'Tdb' ? '温度' : '湿度';
+        const resData = getChartData(item, type);
+        resArr.push(resData);
+      });
+      Promise.all(resArr).then((res) => {
+        dataArr = [...res[0], ...res[1]];
+        setData(dataArr);
+      });
+    } else {
+      const resData = await getChartData(paramObj.id, paramObj.name);
+      setData(resData);
+    }
+  };
+  const getChartData = (objId, type) => {
+    const params = {
+      spaceId: 'Sp110108025953063175f9ba4f5cb334deee89dc2cc1',
+      funcid: objId,
+    };
+    return queryPropertyData(params).then((res) => {
+      const max = res.dayTarget[0] && res.dayTarget[0][paramObj.maxType];
+      setLevelMax(max); // 最大值
+      res.propertyData.shift();
+      const arr = res.propertyData;
+      let chartArr = [];
+      arr.forEach((itemArr) => {
+        const scales = itemArr[1] == '-9999' ? '--' : Number(itemArr[1].toFixed(paramObj.pointNum));
+        chartArr.push({ Date: dealTime(itemArr[0]), scales: scales, type: type });
+      });
+      return chartArr;
+    });
+  };
+  const config = {
+    data,
+    xField: 'Date',
+    yField: 'scales',
+    seriesField: 'type',
+    xAxis: {
+      range: [0, 1],
+    },
+    yAxis: {
+      tickCount: 6,
+    },
+    annotations: [
+      // 辅助线
+      {
+        type: 'line',
+        start: [0, levelMax],
+        end: [data.length - 1, levelMax],
+        top: true,
+        style: {
+          stroke: paramObj.id == 'Tdb,RH' ? 'white' : 'red',
+          lineWidth: 1,
+        },
+      },
+    ],
+    areaStyle: () => {
+      return {
+        fill: 'l(270) 0:#ffffff 1:#3C76E7',
+      };
+    },
+  };
+  return <Line {...config} />;
+};

+ 12 - 0
src/services/ant-design-pro/environment.ts

@@ -46,6 +46,18 @@ export async function queryDeviceTimeManage(params: any, options?: { [key: strin
     },
   );
 }
+
+function commonParams() {
+  return `openid=9a1ecfbacb6b4f249bf2dd3ec7793ead&pubname=sagacareAndtenantslink&projectId=Pj1101080259&userName=%E5%AE%89%E5%B0%8F%E9%9C%9E&userPhone=17611228068&userId=9a1ecfbacb6b4f249bf2dd3ec7793ead`;
+}
+// chart
+export async function queryPropertyData(params: any, options?: { [key: string]: any }) {
+  return request<API.DeviceTimeType>(`/server/spaceAdjust/queryPropertyData?${commonParams()}`, {
+    method: 'GET',
+    params: params,
+    ...(options || {}),
+  });
+}
 export async function queryEnvironmentParam(body: any, otherParam: { [key: string]: any }) {
   //api2/duoduo-service/object-service/object/floor/queryParam
   return request<API.EnvironmentParam>(