Selaa lähdekoodia

Merge branch 'develop' of http://120.55.44.4:10080/xujunjie/gt_client_pad into develop

ZhaoJun 1 vuosi sitten
vanhempi
commit
64afac8e89
3 muutettua tiedostoa jossa 71 lisäystä ja 2 poistoa
  1. 44 1
      src/pages/Home/index.js
  2. 22 1
      src/pages/Home/index.less
  3. 5 0
      src/services/OperationManagement.js

+ 44 - 1
src/pages/Home/index.js

@@ -1,10 +1,11 @@
 import { getComparisonData } from '@/services/OperationManagement';
 import { queryConditionSnapshot } from '@/services/SmartOps';
-import { UnityAction } from '@/utils/utils';
+import { getToken, UnityAction } from '@/utils/utils';
 import { LoadingOutlined } from '@ant-design/icons';
 import { connect, useParams, useRequest } from '@umijs/max';
 import dayjs from 'dayjs';
 import { useEffect } from 'react';
+import { getScadaPage } from '../../services/OperationManagement';
 import CircleScore from '../Smart/components/CircleScore';
 import styles from './index.less';
 
@@ -17,6 +18,7 @@ const HomePage = (props) => {
   return (
     <div className={styles.content}>
       <LeftContent data={data} />
+      <CenterContent />
       <RightContent data={data} />
     </div>
   );
@@ -32,6 +34,13 @@ const LeftContent = (props) => {
     </div>
   );
 };
+const CenterContent = () => {
+  return (
+    <div className={styles.centerBox}>
+      <Scada />
+    </div>
+  );
+};
 const RightContent = (props) => {
   const { data } = props;
   return (
@@ -205,6 +214,40 @@ const Medicine = () => {
   );
 };
 
+// 工艺监控
+const Scada = () => {
+  const { projectId } = useParams();
+
+  const { data } = useRequest(getScadaPage, {
+    defaultParams: [{ project_id: projectId }],
+    formatResult: (res) => {
+      let domain =
+        process.env.NODE_ENV === 'production'
+          ? 'http://120.55.44.4:8900/'
+          : 'http://47.96.12.136:8788/';
+      const token = getToken();
+      const pageList = res?.filter((item) => item.hide);
+      const urls = pageList.map(
+        (item) =>
+          `${domain}smart-water/scada/index.html#/3dview/${projectId}/${item.id}?JWT-TOKEN=${token}&hideTitle=true`,
+      );
+      return urls.splice(0, 2);
+    },
+  });
+  return (
+    <Box
+      title="工艺监控"
+      onClick={() => UnityAction.sendMsg('menuItem', '工艺监控')}
+    >
+      <div className={styles.scadaContent}>
+        {data?.map((url) => (
+          <iframe src={url} />
+        ))}
+      </div>
+    </Box>
+  );
+};
+
 const Box = ({ title, children, onClick }) => {
   return (
     <div className={styles.box} onClick={onClick}>

+ 22 - 1
src/pages/Home/index.less

@@ -4,6 +4,7 @@
   align-items: center;
   height: 100vh;
   width: 100%;
+  padding-top: 300px;
 }
 .box {
   background: url('@/assets/home-box-bg.png') no-repeat center;
@@ -50,7 +51,19 @@
     text-align: center;
   }
 }
-
+.scadaContent {
+  padding: 20px;
+  height: 300px;
+  width: 1000px;
+  display: flex;
+  justify-content: space-between;
+  iframe {
+    height: 100%;
+    width: calc(50% - 10px);
+    border: none;
+    pointer-events: none;
+  }
+}
 .scoreBox {
   display: flex;
   flex-direction: column;
@@ -97,3 +110,11 @@
   margin-top: 50px;
   margin-bottom: 22px;
 }
+.centerBox {
+  display: flex;
+  height: 880px;
+  align-items: flex-end;
+  .box {
+    width: 100%;
+  }
+}

+ 5 - 0
src/services/OperationManagement.js

@@ -389,3 +389,8 @@ export async function getChemicalAgents(projectID) {
   );
   return res?.data?.list;
 }
+
+export async function getScadaPage(params = {}) {
+  const res = await request(`/api/v1/scada/page?${stringify(params)}`);
+  return res?.data;
+}