diff --git a/api/config.js b/api/config.js index 74acdee..cc8c589 100644 --- a/api/config.js +++ b/api/config.js @@ -16,13 +16,13 @@ args.option('axyProject', '安心云泵站项目信息'); const flags = args.parse(process.argv); -const XUNJIAN_DB = process.env.XUNJIAN_DB || flags.pg; +const BENGZHAN_DB = process.env.XUNJIAN_DB || flags.pg; const API_ANXINYUN_URL = process.env.API_ANXINYUN_URL || flags.apiAnxinyunUrl const AXY_BZ_PROJECT = process.env.AXY_BZ_PROJECT || flags.axyProject -if (!XUNJIAN_DB || !API_ANXINYUN_URL || !AXY_BZ_PROJECT) { +if (!BENGZHAN_DB || !API_ANXINYUN_URL || !AXY_BZ_PROJECT) { console.log('缺少启动参数,异常退出'); args.showHelp(); process.exit(-1); @@ -54,7 +54,7 @@ const product = { } ], dc: { - url: XUNJIAN_DB, + url: BENGZHAN_DB, opts: { pool: { max: 80, diff --git a/web/client/assets/images/realTime/left.png b/web/client/assets/images/realTime/left.png new file mode 100644 index 0000000..069f952 Binary files /dev/null and b/web/client/assets/images/realTime/left.png differ diff --git a/web/client/assets/images/realTime/notebook.png b/web/client/assets/images/realTime/notebook.png new file mode 100644 index 0000000..7b745b3 Binary files /dev/null and b/web/client/assets/images/realTime/notebook.png differ diff --git a/web/client/assets/images/realTime/right.png b/web/client/assets/images/realTime/right.png new file mode 100644 index 0000000..8885e6b Binary files /dev/null and b/web/client/assets/images/realTime/right.png differ diff --git a/web/client/assets/images/realTime/specific.png b/web/client/assets/images/realTime/specific.png new file mode 100644 index 0000000..b0be658 Binary files /dev/null and b/web/client/assets/images/realTime/specific.png differ diff --git a/web/client/src/sections/bigScreen/components/capacity.js b/web/client/src/sections/bigScreen/components/capacity.js index 055c988..77a23de 100644 --- a/web/client/src/sections/bigScreen/components/capacity.js +++ b/web/client/src/sections/bigScreen/components/capacity.js @@ -283,7 +283,7 @@ const Capacity = ({ actions, dispatch, user, }) => { type: 'get', url: `stations/theme/data`, params: { query: { stations: p.payload.data[0]?.groups[0]?.stations[0]?.id, - startTime: moment().add(-24, 'hours').format('YYYY-MM-DD HH:mm:ss'), + startTime: moment().add(-12, 'hours').format('YYYY-MM-DD HH:mm:ss'), endTime: moment().format('YYYY-MM-DD HH:mm:ss'), limit: 1440 } @@ -337,7 +337,7 @@ const Capacity = ({ actions, dispatch, user, }) => { type: 'get', url: `stations/theme/data`, params: { query: { stations: pumpId, - startTime: moment().add(-24, 'hours').format('YYYY-MM-DD HH:mm:ss'), + startTime: moment().add(-12, 'hours').format('YYYY-MM-DD HH:mm:ss'), endTime: moment().format('YYYY-MM-DD HH:mm:ss'), limit: 1440 } @@ -363,7 +363,7 @@ const Capacity = ({ actions, dispatch, user, }) => { type: 'get', url: `stations/theme/data`, params: { query: { stations: usePumpId, - startTime: moment().add(-24, 'hours').format('YYYY-MM-DD HH:mm:ss'), + startTime: moment().add(-12, 'hours').format('YYYY-MM-DD HH:mm:ss'), endTime: moment().format('YYYY-MM-DD HH:mm:ss'), limit: 1440 } diff --git a/web/client/src/sections/bigScreen/components/electrical.js b/web/client/src/sections/bigScreen/components/electrical.js index 2e9d48d..dbfaa3e 100644 --- a/web/client/src/sections/bigScreen/components/electrical.js +++ b/web/client/src/sections/bigScreen/components/electrical.js @@ -219,7 +219,6 @@ const Electrical = ({ dispatch, actions, user, module, setModule }) => { setVoltagePump(d.payload.data?.stations || []) } }) - } }, [voltagePumpId]) @@ -241,7 +240,7 @@ const Electrical = ({ dispatch, actions, user, module, setModule }) => { fontSize: 20, width: 160, height: 160, textAlign: 'center', }}>
- 环境湿度:
{depthWater[0]?.sHumidity} % + 环境湿度:{depthWater[0]?.sHumidity || "--"} %
{ fontSize: 20, width: 160, height: 160, textAlign: 'center', }}>
- 信号:
{depthWater[0]?.CSQ4G} + 信号:
{depthWater[0]?.CSQ4G || "--"} diff --git a/web/client/src/sections/bigScreen/components/electrity/lineBoxStatus.js b/web/client/src/sections/bigScreen/components/electrity/lineBoxStatus.js index 3a7d78b..ca651cd 100644 --- a/web/client/src/sections/bigScreen/components/electrity/lineBoxStatus.js +++ b/web/client/src/sections/bigScreen/components/electrity/lineBoxStatus.js @@ -95,7 +95,7 @@ const LineBoxStatus = ({ user, cabinetId, cabinetList, setCabinetId, cabinetOne
{cabinetOne?.data[0]?.eQF_C_A} A
-
B相电压:
+
B相电压:
{cabinetOne?.data[0]?.eQF_C_V} V
diff --git a/web/client/src/sections/bigScreen/components/realTime.js b/web/client/src/sections/bigScreen/components/realTime.js index 545388e..cc58340 100644 --- a/web/client/src/sections/bigScreen/components/realTime.js +++ b/web/client/src/sections/bigScreen/components/realTime.js @@ -1,17 +1,310 @@ -import React from 'react'; +import React, { useEffect, useState } from 'react'; import { connect } from 'react-redux'; -import { Spin, Card, Modal, TreeSelect, message } from 'antd'; -import ProForm, { ProFormText, ModalForm, ProFormSwitch, ProFormTreeSelect } from '@ant-design/pro-form'; -import Title from 'antd/lib/skeleton/Title'; +import { Select } from 'antd'; +import moment from 'moment' +import ReactECharts from 'echarts-for-react'; +import General from '../components/realTime/general'; +import LineBoxStatus from '../components/electrity/lineBoxStatus'; +import SoftStart from '../components/realTime/softStart'; +import LevelTrend from '../components/electrity/levelTrend'; -const RealTime = ({ user, module, setModule }) => { +const RealTime = ({ dispatch, actions, user, module, setModule }) => { + const { bigScreen } = actions + const [pageLeft, setPageLeft] = useState(0) //左边翻页 + const [pageRight, setPageRight] = useState(0) //左边翻页 + const [siteList, setSiteList] = useState([]) //站点列表 + const [pumpList, setPumpList] = useState([]) //水泵列表 + const [cabinetList, setCabinetList] = useState([]) //水泵列表 + const [strucId, setStrucId] = useState() //站点ID + const [pumpId, setPumpId] = useState() //水泵id + const [cabinetId, setCabinetId] = useState() //进线柜id + const [usePumpId, setUsePumpId] = useState() //水泵id + const [voltagePumpId, setVoltagePumpId] = useState([]) //水泵电压id + const [pumpOne, setPumpOne] = useState({ data: [] }) //单个水泵数据 + const [voltagepump, setVoltagePump] = useState([]) //单个水泵数据 + const [cabinetOne, setCabinetOne] = useState({ data: [] }) //单个进线柜数据 + const [cabinetData, setCabinetData] = useState([]) //进线柜数据 + const [centreData, setCentreData] = useState({}) //中间数据 + const [depthWater, setDepthWater] = useState([]) //液位趋势 + const [electricityTrend, setElectricityTrend] = useState([]) //电流趋势 + const [useTrend, setUseTrend] = useState([]) //用电趋势 + const [interval, setInterval] = useState('本日') //用电概况区间 + useEffect(() => { + dispatch(bigScreen.axyData({ type: 'get', url: `organizations/{orgId}/structures` })).then(res => { + if (res.success) { + setSiteList(res.payload.data?.map(v => ({ value: v.id, label: v.name })) || []) + setStrucId(res.payload.data[0]?.id) + } + }) + }, []) + useEffect(async () => { + if (strucId) { + await dispatch(bigScreen.axyData({ type: 'get', url: `structures/${strucId}/factors` })).then(async r => { + if (r.success) { + //水泵信息 + let waterId = r.payload.data?.find(v => v.name == '泵站水泵')?.id + if (waterId) { + await dispatch(bigScreen.axyData({ + type: 'get', url: `structures/${strucId}/stations`, + params: { query: { factorId: waterId } } + })).then(async p => { + if (p.success) { + let dataId = [] + let voltageId = [] + p.payload.data?.map(v => { + v.groups?.map(s => { + s.stations?.map(f => { + dataId.push(f.id) + if (voltageId?.length < 3) { + voltageId.push(f.id) + } + }) + }) + }) + setPumpList(p.payload.data[0]?.groups[0]?.stations) + setPumpId(p.payload.data[0]?.groups[0]?.stations[0]?.id) + setVoltagePumpId(voltageId) + setUsePumpId(p.payload.data[0]?.groups[0]?.stations[0]?.id) + // if (dataId.length) { + // // 当前时间 + // await dispatch(bigScreen.axyData({ + // type: 'get', url: `stations/theme/data`, params: { + // query: { + // stations: dataId.join(), + // startTime: moment().day(moment().day() - 1).startOf('day').format('YYYY-MM-DD HH:mm:ss'), + // endTime: moment().day(moment().day() - 1).endOf('day').format('YYYY-MM-DD HH:mm:ss'), + // limit: 1440 + // } + // } + // })).then(d => { + // if (d.success) { + // } + // }) + // } + + if (dataId.length) { + // 当前时间 + await dispatch(bigScreen.axyData({ + type: 'get', url: `stations/data/theme`, params: { + query: { + stations: dataId.join(), + begin: moment().add(-100, 'hours').format('x'), + end: moment().endOf('day').format('x'), + // limit: 1 + aggtype:'d', + orderDirection:'ASC', + } + } + })).then(d => { + if (d.success) { + } + }) + } + + } + }) + } + // 进线柜 + // let wireCabinetId = r.payload.data?.find(v => v.name == '泵站进线柜')?.id + // if (wireCabinetId) { + // await dispatch(bigScreen.axyData({ + // type: 'get', url: `structures/${strucId}/stations`, + // params: { query: { factorId: wireCabinetId } } + // })).then(async p => { + // if (p.success) { + // let dataId = [] + // p.payload.data?.map(v => { + // v.groups?.map(s => { + // s.stations?.map(f => { + // dataId.push({ value: f.id, label: f.name }) + // }) + // }) + // }) + // setCabinetList(dataId) + // setCabinetId(p.payload.data[0]?.groups[0]?.stations[0]?.id) + // if (dataId.length) { + // // 当前时间 + // await dispatch(bigScreen.axyData({ + // type: 'get', url: `stations/theme/data`, params: { + // query: { + // stations: dataId.join(), + // startTime: moment().startOf('day').format('YYYY-MM-DD HH:mm:ss'), + // endTime: moment().endOf('day').format('YYYY-MM-DD HH:mm:ss'), + // limit: 1 + // } + // } + // })).then(d => { + // if (d.success) { + + // } + // }) + + // } + // } + // }) + // } + + + // //泵站信息 + // let informationId = r.payload.data?.find(v => v.name == '泵站信息')?.id + // if (informationId) { + // await dispatch(bigScreen.axyData({ + // type: 'get', url: `structures/${strucId}/stations`, + // params: { query: { factorId: informationId } } + // })).then(async p => { + // if (p.success) { + + // // 液位趋势 + // await dispatch(bigScreen.axyData({ + // type: 'get', url: `stations/theme/data`, params: { + // query: { + // stations: p.payload.data[0]?.groups[0]?.stations[0]?.id, + // startTime: moment().add(-24, 'hours').format('YYYY-MM-DD HH:mm:ss'), + // endTime: moment().format('YYYY-MM-DD HH:mm:ss'), + // limit: 1440 + // } + // } + // })).then(d => { + // if (d.success) { + // setDepthWater(d.payload.data?.stations[0]?.data) + // } + // }) + // } + + // }) + // } + } + }) + } + + }, [strucId]) + + // useEffect(async () => { + // if (pumpId) { + // await dispatch(bigScreen.axyData({ + // type: 'get', url: `stations/theme/data`, params: { + // query: { + // stations: pumpId, + // startTime: moment().startOf('day').format('YYYY:MM:DD HH:mm:ss'), + // endTime: moment().format('YYYY-MM-DD HH:mm:ss'), + // limit: 1 + // } + // } + // })).then(d => { + // if (d.success) { + // setPumpOne(d.payload.data?.stations[0] || { data: [] }) + // } + // }) + + // } + // }, [pumpId]) + + // useEffect(async () => { + // if (cabinetId) { + // await dispatch(bigScreen.axyData({ + // type: 'get', url: `stations/theme/data`, params: { + // query: { + // stations: cabinetId, + // startTime: moment().startOf('day').format('YYYY:MM:DD HH:mm:ss'), + // endTime: moment().format('YYYY-MM-DD HH:mm:ss'), + // limit: 1 + // } + // } + // })).then(d => { + // if (d.success) { + // setCabinetOne(d.payload.data?.stations[0] || { data: [] }) + // } + // }) + + // } + // }, [cabinetId]) + + // useEffect(async () => { + // if (voltagePumpId?.length > 0) { + // await dispatch(bigScreen.axyData({ + // type: 'get', url: `stations/theme/data`, params: { + // query: { + // stations: voltagePumpId?.join(), + // startTime: moment().add(-24, 'hours').format('YYYY-MM-DD HH:mm:ss'), + // endTime: moment().format('YYYY-MM-DD HH:mm:ss'), + // limit: 1440 + // } + // } + // })).then(d => { + // if (d.success) { + // setVoltagePump(d.payload.data?.stations || []) + // } + // }) + + // } + // }, [voltagePumpId]) + + + + return
+
+ + {/* */} + + {/* */} +
+
+
+ 环境湿度:
{depthWater[0]?.sHumidity} % +
+
+
+ 环境湿度:
{depthWater[0]?.sTEMP || "--"} ℃ +
+
+
+ 信号:
{depthWater[0]?.CSQ4G} +
+
+ +
+ +
{siteList?.filter(v => v.value == strucId)[0]?.label}
+