diff --git a/api/.vscode/launch.json b/api/.vscode/launch.json index 1adc141..18c82f6 100644 --- a/api/.vscode/launch.json +++ b/api/.vscode/launch.json @@ -15,8 +15,8 @@ "args": [ "-p 4900", // 研发 - // "-g postgres://postgres:123456@10.8.30.39:5432/PumpStation", - "-g postgres://FashionAdmin:123456@10.8.30.156:5432/PumpStation", + "-g postgres://postgres:123456@10.8.30.166:5432/PumpStation", + // "-g postgres://FashionAdmin:123456@10.8.30.166:5432/PumpStation", // 测试 // "--apiEmisUrl http://10.8.30.161:1111", // "--qnak XuDgkao6cL0HidoMAPnA5OB10Mc_Ew08mpIfRJK5", diff --git a/api/app/lib/controllers/auth/index.js b/api/app/lib/controllers/auth/index.js index 7a163b4..4ddaa8a 100644 --- a/api/app/lib/controllers/auth/index.js +++ b/api/app/lib/controllers/auth/index.js @@ -36,7 +36,7 @@ async function login (ctx, next) { expired: expired }); ctx.status = 200; - ctx.body = userInfo; + ctx.body = userInfo } else { ctx.status = 400; ctx.body = { diff --git a/web/client/assets/images/monitor/oblique.png b/web/client/assets/images/monitor/oblique.png new file mode 100644 index 0000000..cdbd72b Binary files /dev/null and b/web/client/assets/images/monitor/oblique.png differ diff --git a/web/client/assets/images/realTime/buttom-d.png b/web/client/assets/images/realTime/buttom-d.png new file mode 100644 index 0000000..2638b7f Binary files /dev/null and b/web/client/assets/images/realTime/buttom-d.png differ diff --git a/web/client/assets/images/realTime/center.png b/web/client/assets/images/realTime/center.png new file mode 100644 index 0000000..82b555c Binary files /dev/null and b/web/client/assets/images/realTime/center.png differ diff --git a/web/client/assets/images/realTime/left-p.png b/web/client/assets/images/realTime/left-p.png new file mode 100644 index 0000000..184c646 Binary files /dev/null and b/web/client/assets/images/realTime/left-p.png differ diff --git a/web/client/assets/images/realTime/level.png b/web/client/assets/images/realTime/level.png new file mode 100644 index 0000000..56f6f4b Binary files /dev/null and b/web/client/assets/images/realTime/level.png differ diff --git a/web/client/assets/images/realTime/right-p.png b/web/client/assets/images/realTime/right-p.png new file mode 100644 index 0000000..71c5834 Binary files /dev/null and b/web/client/assets/images/realTime/right-p.png differ diff --git a/web/client/assets/images/realTime/soft-one.png b/web/client/assets/images/realTime/soft-one.png new file mode 100644 index 0000000..0bca904 Binary files /dev/null and b/web/client/assets/images/realTime/soft-one.png differ diff --git a/web/client/assets/images/realTime/soft-two.png b/web/client/assets/images/realTime/soft-two.png new file mode 100644 index 0000000..2460f13 Binary files /dev/null and b/web/client/assets/images/realTime/soft-two.png differ diff --git a/web/client/assets/images/realTime/this-day.png b/web/client/assets/images/realTime/this-day.png new file mode 100644 index 0000000..8305db5 Binary files /dev/null and b/web/client/assets/images/realTime/this-day.png differ diff --git a/web/client/assets/images/realTime/this-week.png b/web/client/assets/images/realTime/this-week.png new file mode 100644 index 0000000..7246ae9 Binary files /dev/null and b/web/client/assets/images/realTime/this-week.png differ diff --git a/web/client/assets/images/realTime/this-year.png b/web/client/assets/images/realTime/this-year.png new file mode 100644 index 0000000..ae28f1d Binary files /dev/null and b/web/client/assets/images/realTime/this-year.png differ diff --git a/web/client/index.html b/web/client/index.html index fdf026a..6050223 100644 --- a/web/client/index.html +++ b/web/client/index.html @@ -8,11 +8,11 @@ + src="https://webapi.amap.com/maps?v=2.0&key=e20863d113b69b83f553ea14dfec668f&plugin=AMap.AutoComplete,AMap.PlaceSearch,aMap.DistrictSearch"> diff --git a/web/client/src/sections/auth/actions/auth.js b/web/client/src/sections/auth/actions/auth.js index 3fdc65d..b76dd2f 100644 --- a/web/client/src/sections/auth/actions/auth.js +++ b/web/client/src/sections/auth/actions/auth.js @@ -47,7 +47,7 @@ export const LOGOUT = 'LOGOUT'; export function logout (user) { const token = user.token; const url = ApiTable.logout; - sessionStorage.removeItem('user'); + // sessionStorage.removeItem('user'); localStorage.removeItem('zhongding_selected_sider') localStorage.removeItem('zhongding_open_sider') Request.put(url, { diff --git a/web/client/src/sections/bigScreen/components/amap.js b/web/client/src/sections/bigScreen/components/amap.js index 240485d..52e9244 100644 --- a/web/client/src/sections/bigScreen/components/amap.js +++ b/web/client/src/sections/bigScreen/components/amap.js @@ -19,7 +19,7 @@ const Amap = ({ showData }) => { if (AMap) loadMap(); } catch (e) { var script = document.createElement("script"); - script.src = "https://webapi.amap.com/maps?v=2.0&key=00f9a29dedcdbd8befec3dfe0cef5003&plugin=AMap.AutoComplete,AMap.PlaceSearch,AMap.Marker"; + script.src = "https://webapi.amap.com/maps?v=2.0&key=e20863d113b69b83f553ea14dfec668f&plugin=AMap.AutoComplete,AMap.PlaceSearch,AMap.Marker"; document.body.appendChild(script); loadMap(); } @@ -43,7 +43,7 @@ const Amap = ({ showData }) => { zooms: [5, 20], pitch: 0, // 地图俯仰角度,有效范围 0 度- 83 度 viewMode: '3D', // 地图模式 - mapStyle: 'amap://styles/fb26776387242721c2fc32e2cb1daccc', // 主题样式 + mapStyle: 'amap://styles/1f6a7625ef9b3dc9cdd9ff016a7cc66e', // 主题样式 // rotation: 60 // showLabel: false layers: [ diff --git a/web/client/src/sections/bigScreen/components/basis.js b/web/client/src/sections/bigScreen/components/basis.js index 508fff1..394e279 100644 --- a/web/client/src/sections/bigScreen/components/basis.js +++ b/web/client/src/sections/bigScreen/components/basis.js @@ -11,7 +11,7 @@ import Right_2 from './basis/right_2'; import { POWER_STATIONS } from './shuizhan_detail'; import './basis.less' -const Basis = ({ actions, dispatch, user, setshowData }) => { +const Basis = ({ actions, dispatch, setshowData }) => { const { bigScreen } = actions const [siteList, setSiteList] = useState([]) //站点列表 @@ -93,8 +93,8 @@ const Basis = ({ actions, dispatch, user, setshowData }) => { 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'), + startTime: moment().startOf('day').format('YYYY-MM-DD HH:mm:ss'), + endTime: moment().endOf('day').format('YYYY-MM-DD HH:mm:ss'), limit: 1 } } @@ -117,7 +117,7 @@ const Basis = ({ actions, dispatch, user, setshowData }) => { useEffect(async () => { if (strucId) { - + await dispatch(bigScreen.axyData({ type: 'get', url: `structures/${strucId}/factors` })).then(async r => { //泵站信息 let informationId = r.payload.data?.find(v => v.name == '泵站信息')?.id @@ -131,7 +131,7 @@ const Basis = ({ actions, dispatch, user, setshowData }) => { 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 } @@ -180,7 +180,7 @@ const Basis = ({ actions, dispatch, user, setshowData }) => { }}>
{v.name}
- {v.data?.map((s, i) => ) + {v.data?.map((s, i) => ) } diff --git a/web/client/src/sections/bigScreen/components/basis/right_2.js b/web/client/src/sections/bigScreen/components/basis/right_2.js index 564258f..b2731d2 100644 --- a/web/client/src/sections/bigScreen/components/basis/right_2.js +++ b/web/client/src/sections/bigScreen/components/basis/right_2.js @@ -63,7 +63,7 @@ export default function Right_2 ({ depthWater }) { areaStyle: { color: '#0e9cff26', }, - data: depthWater?.map(v => v.sLiquid_level) + data: depthWater?.map(v => (v.sLiquid_level?.toFixed(2) || 0)) }, { type: 'line', @@ -72,7 +72,7 @@ export default function Right_2 ({ depthWater }) { areaStyle: { color: '#0e9cff26', }, - data: depthWater?.map(v => v.sGrille_level) + data: depthWater?.map(v => (v.sGrille_level?.toFixed(2) || 0)) }, ] diff --git a/web/client/src/sections/bigScreen/components/capacity.js b/web/client/src/sections/bigScreen/components/capacity.js index 77a23de..c125dca 100644 --- a/web/client/src/sections/bigScreen/components/capacity.js +++ b/web/client/src/sections/bigScreen/components/capacity.js @@ -5,15 +5,15 @@ import moment from 'moment' import ReactECharts from 'echarts-for-react'; import './index.less' -const Capacity = ({ actions, dispatch, user, }) => { +const Capacity = ({ actions, dispatch, siteList, }) => { const { bigScreen } = actions const [pageLeft, setPageLeft] = useState(0) //左边翻页 const [pageRight, setPageRight] = useState(0) //左边翻页 - const [siteList, setSiteList] = useState([]) //站点列表 + // const [siteList, setSiteList] = useState([]) //站点列表 const [pumpList, setPumpList] = useState([]) //水泵列表 const [strucId, setStrucId] = useState() //站点ID - const [pumpId, setPumpId] = useState() //水泵id - const [usePumpId, setUsePumpId] = useState() //水泵id + const [pumpId, setPumpId] = useState([]) //水泵id + const [usePumpId, setUsePumpId] = useState([]) //水泵id const [pumpData, setPumpData] = useState([]) //水泵数据 const [cabinetData, setCabinetData] = useState([]) //进线柜数据 const [centreData, setCentreData] = useState({}) //中间数据 @@ -23,20 +23,20 @@ const Capacity = ({ actions, dispatch, user, }) => { + + 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) - } - }) - }, []) + setStrucId(siteList[0]?.value) + }, [siteList]) useEffect(async () => { let pump = [] let cabinetSun = [] - let pumpSun = [] let sun = {} + let day1 = 0 + let day30 = 0 + let day365 = 0 + let daySun = 0 if (strucId) { await dispatch(bigScreen.axyData({ type: 'get', url: `structures/${strucId}/factors` })).then(async r => { if (r.success) { @@ -49,98 +49,106 @@ const Capacity = ({ actions, dispatch, user, }) => { })).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) - setUsePumpId(p.payload.data[0]?.groups[0]?.stations[0]?.id) + setPumpId(voltageId) + setUsePumpId(voltageId) if (dataId.length) { - let sameDay //当天最新一条数据 - let beforeDay //前一天最新一条数据 - let month //上个月最新一条数据 - let year //去年最新一条数据 // 当前时间 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'), + 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) { pump = d.payload.data?.stations || [] - sameDay = d.payload.data?.stations || [] + d.payload.data?.stations?.map(f => { + daySun += f?.data[0]?.eMotor_EQ + }) } }) - // 昨天最后一条数据 + // 今天 await dispatch(bigScreen.axyData({ - type: 'get', url: `stations/theme/data`, params: { + type: 'get', url: `stations/data/theme`, params: { query: { stations: dataId.join(), - startTime: moment().day(moment().day() - 7).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: 1 + begin: moment().startOf('day').format('x'), + end: moment().endOf('day').format('x'), + aggtype: "h", + method: 'diff' } } })).then(d => { if (d.success) { - beforeDay = d.payload.data?.stations || [] - + d.payload.data[0]?.stations.map(f => { + f.data?.map(h => { + if (!h.changData) { + day1 += h.values.eMotor_EQ + } + }) + }) } }) - // 上月最后一条数据 + // 本月 await dispatch(bigScreen.axyData({ - type: 'get', url: `stations/theme/data`, params: { + type: 'get', url: `stations/data/theme`, params: { query: { stations: dataId.join(), - startTime: moment().month(moment().month() - 1).startOf('month').format('YYYY-MM-DD HH:mm:ss'), - endTime: moment().month(moment().month() - 1).endOf('month').format('YYYY-MM-DD HH:mm:ss'), - limit: 1 + begin: moment().startOf('month').format('x'), + end: moment().endOf('month').format('x'), + aggtype: "d", + method: 'diff' } } })).then(d => { if (d.success) { - month = d.payload.data?.stations || [] - + d.payload.data[0]?.stations.map(f => { + f.data?.map(h => { + if (!h.changData) { + day30 += h.values.eMotor_EQ + } + }) + }) } }) - //去年最后一条数据 + // 今年 await dispatch(bigScreen.axyData({ - type: 'get', url: `stations/theme/data`, params: { + type: 'get', url: `stations/data/theme`, params: { query: { stations: dataId.join(), - startTime: moment().year(moment().year() - 1).month(moment().month() - 1).startOf('year').format('YYYY-MM-DD HH:mm:ss'), - endTime: moment().year(moment().year() - 1).month(moment().month() - 1).endOf('year').format('YYYY-MM-DD HH:mm:ss'), - limit: 1 + begin: moment().startOf('year').format('x'), + end: moment().endOf('year').format('x'), + aggtype: "d", + method: 'diff' } } })).then(d => { if (d.success) { - year = d.payload.data?.stations || [] + d.payload.data[0]?.stations.map(f => { + f.data?.map(h => { + if (!h.changData) { + day365 += h.values.eMotor_EQ + } + }) + }) } }) - sameDay?.map(u => { - let find1 = beforeDay?.find(c => c.id == u.id) - let find2 = month?.find(c => c.id == u.id) - let find3 = year?.find(c => c.id == u.id) - - pumpSun.push({ - today: u?.data[0]?.eMotor_EQ && find1?.data[0]?.eMotor_EQ ? (u?.data[0]?.eMotor_EQ - find1?.data[0]?.eMotor_EQ) : '--', - sameMonth: u?.data[0]?.eMotor_EQ && find2?.data[0]?.eMotor_EQ ? (u?.data[0]?.eMotor_EQ - find2?.data[0]?.eMotor_EQ) : '--', - thisYear: u?.data[0]?.eMotor_EQ && find3?.data[0]?.eMotor_EQ ? (u?.data[0]?.eMotor_EQ - find3?.data[0]?.eMotor_EQ) : '--', - eMotor_EQ: u?.data[0]?.eMotor_EQ, - id: u.id, - name: u.name, - }) - }) + } } @@ -163,11 +171,7 @@ const Capacity = ({ actions, dispatch, user, }) => { }) }) if (dataId.length) { - let sameDay //当天最新一条数据 - let beforeDay //前一天最新一条数据 - let month //上个月最新一条数据 - let year //去年最新一条数据 - // 当前时间 + // // 当前时间 await dispatch(bigScreen.axyData({ type: 'get', url: `stations/theme/data`, params: { query: { @@ -179,73 +183,107 @@ const Capacity = ({ actions, dispatch, user, }) => { } })).then(d => { if (d.success) { - sameDay = d.payload.data?.stations || [] + d.payload.data?.stations?.map(f => { + daySun += f?.data[0]?.eQF_EQ + cabinetSun.push({ + today: 0, + sameMonth: 0, + thisYear: 0, + eQF_EQ: f?.data[0]?.eQF_EQ, + id: f.id, + name: f.name, + sQF_CLOSING: f?.data[0]?.sQF_CLOSING + }) + }) } }) - // 昨天最后一条数据 + // 今天 await dispatch(bigScreen.axyData({ - type: 'get', url: `stations/theme/data`, params: { + type: 'get', url: `stations/data/theme`, params: { query: { stations: dataId.join(), - startTime: moment().day(moment().day() - 7).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: 1 + begin: moment().startOf('day').format('x'), + end: moment().endOf('day').format('x'), + aggtype: "h", + method: 'diff' } } })).then(d => { if (d.success) { - beforeDay = d.payload.data?.stations || [] - + cabinetSun.forEach(p => { + d.payload.data[0]?.stations.map(f => { + if (p.id == f.id) { + f.data?.map(h => { + if (!h.changData) { + p.today = p.today + h.values.eQF_EQ + p.sameMonth = p.sameMonth + h.values.eQF_EQ + p.thisYear = p.thisYear + h.values.eQF_EQ + day1 += h.values.eQF_EQ + } + }) + } + }) + }) } }) - // 上月最后一条数据 + // 本月 await dispatch(bigScreen.axyData({ - type: 'get', url: `stations/theme/data`, params: { + type: 'get', url: `stations/data/theme`, params: { query: { stations: dataId.join(), - startTime: moment().month(moment().month() - 1).startOf('month').format('YYYY-MM-DD HH:mm:ss'), - endTime: moment().month(moment().month() - 1).endOf('month').format('YYYY-MM-DD HH:mm:ss'), - limit: 1 + begin: moment().startOf('month').format('x'), + end: moment().endOf('month').format('x'), + aggtype: "d", + method: 'diff' } } })).then(d => { if (d.success) { - month = d.payload.data?.stations || [] - + cabinetSun.forEach(p => { + d.payload.data[0]?.stations.map(f => { + if (p.id == f.id) { + f.data?.map(h => { + if (!h.changData) { + p.sameMonth = p.sameMonth + h.values.eQF_EQ + day30 += h.values.eQF_EQ + } + }) + } + }) + }) } }) - //去年最后一条数据 + // 今年 await dispatch(bigScreen.axyData({ - type: 'get', url: `stations/theme/data`, params: { + type: 'get', url: `stations/data/theme`, params: { query: { stations: dataId.join(), - startTime: moment().year(moment().year() - 1).month(moment().month() - 1).startOf('year').format('YYYY-MM-DD HH:mm:ss'), - endTime: moment().year(moment().year() - 1).month(moment().month() - 1).endOf('year').format('YYYY-MM-DD HH:mm:ss'), - limit: 1 + begin: moment().startOf('year').format('x'), + end: moment().endOf('year').format('x'), + aggtype: "d", + method: 'diff' } } })).then(d => { if (d.success) { - year = d.payload.data?.stations || [] + // year = d.payload.data[0]?.stations + cabinetSun.forEach(p => { + d.payload.data[0]?.stations.map(f => { + if (p.id == f.id) { + f.data?.map(h => { + if (!h.changData) { + p.thisYear = p.thisYear + h.values.eQF_EQ + day365 += h.values.eQF_EQ + } + }) + } + }) + }) } }) - sameDay?.map(u => { - let find1 = beforeDay?.find(c => c.id == u.id) - let find2 = month?.find(c => c.id == u.id) - let find3 = year?.find(c => c.id == u.id) - cabinetSun.push({ - today: u?.data[0]?.eQF_EQ && find1?.data[0]?.eQF_EQ ? (u?.data[0]?.eQF_EQ - find1?.data[0]?.eQF_EQ) : '--', - sameMonth: u?.data[0]?.eQF_EQ && find2?.data[0]?.eQF_EQ ? (u?.data[0]?.eQF_EQ - find2?.data[0]?.eQF_EQ) : '--', - thisYear: u?.data[0]?.eQF_EQ && find3?.data[0]?.eQF_EQ ? (u?.data[0]?.eQF_EQ - find3?.data[0]?.eQF_EQ) : '--', - eQF_EQ: u?.data[0]?.eQF_EQ, - id: u.id, - name: u.name, - sQF_CLOSING: u?.data[0]?.sQF_CLOSING - }) - }) } } }) @@ -260,7 +298,6 @@ const Capacity = ({ actions, dispatch, user, }) => { params: { query: { factorId: informationId } } })).then(async p => { if (p.success) { - await dispatch(bigScreen.axyData({ type: 'get', url: `stations/theme/data`, params: { query: { @@ -305,38 +342,22 @@ const Capacity = ({ actions, dispatch, user, }) => { setCabinetData(cabinetSun) //计算各个阶段的总点电量 - let day1 = 0 - let day30 = 0 - let day365 = 0 - let daySun = 0 - pumpSun?.map(h => { - if (!isNaN(h.today)) day1 += h.today - if (!isNaN(h.sameMonth)) day30 += h.sameMonth - if (!isNaN(h.thisYear)) day365 += h.thisYear - if (!isNaN(h.eQF_EQ)) daySun += h.eQF_EQ - }) - cabinetSun?.map(h => { - if (!isNaN(h.today)) day1 += h.today - if (!isNaN(h.sameMonth)) day30 += h.sameMonth - if (!isNaN(h.thisYear)) day365 += h.thisYear - if (!isNaN(h.eQF_EQ)) daySun += h.eQF_EQ - }) sun.day1 = day1 - sun.day30 = day30 - sun.day365 = day365 + sun.day30 = day30 + day1 + sun.day365 = day365 + day1 sun.daySun = daySun setCentreData(sun) }, [strucId]) useEffect(async () => { - if (pumpId) { + if (pumpId?.length > 0) { //电流趋势 await dispatch(bigScreen.axyData({ type: 'get', url: `stations/theme/data`, params: { query: { - stations: pumpId, + stations: pumpId?.join(), startTime: moment().add(-12, 'hours').format('YYYY-MM-DD HH:mm:ss'), endTime: moment().format('YYYY-MM-DD HH:mm:ss'), limit: 1440 @@ -344,11 +365,12 @@ const Capacity = ({ actions, dispatch, user, }) => { } })).then(d => { if (d.success) { - let trend = [] - d.payload.data?.stations[0]?.data?.map((s, i) => { - trend.push({ time: s.time, eMotor_A_A: s.eMotor_A_A }) - }) - setElectricityTrend(trend) + // let trend = [] + // d.payload.data?.stations[0]?.data?.map((s, i) => { + // trend.push({ time: s.time, eMotor_A_A: s.eMotor_A_A }) + // }) + + setElectricityTrend(d.payload.data?.stations) } }) @@ -357,28 +379,20 @@ const Capacity = ({ actions, dispatch, user, }) => { }, [pumpId]) useEffect(async () => { - if (usePumpId) { + if (usePumpId?.length > 0) { //电流趋势 await dispatch(bigScreen.axyData({ type: 'get', url: `stations/theme/data`, params: { query: { - stations: usePumpId, + stations: usePumpId?.join(), startTime: moment().add(-12, 'hours').format('YYYY-MM-DD HH:mm:ss'), endTime: moment().format('YYYY-MM-DD HH:mm:ss'), - limit: 1440 + limit: 3 } } })).then(d => { if (d.success) { - let trend = [] - let front = {} - d.payload.data?.stations[0]?.data?.map((s, i) => { - front = s - if (i > 0) { - trend.push({ time: front.time, value: front?.eMotor_EQ - s.eMotor_EQ }) - } - }) - setUseTrend(trend) + setUseTrend(d.payload.data?.stations) } }) @@ -533,7 +547,7 @@ const Capacity = ({ actions, dispatch, user, }) => {
- 总用量:{centreData?.daySun} kWh + 总用量:{centreData?.daySun?.toFixed(2)} kWh
{
-
+
今年用电:
{centreData?.day365?.toFixed(2) || '--'} ℃
-
+
当月用电:
{centreData?.day30?.toFixed(2) || '--'} ℃
-
+
当日用电:
{centreData?.day1?.toFixed(2) || '--'} ℃
-
集水池液位
-
-
{centreData?.sGrille_level?.toFixed(2) || 0} m
} +
+
集水池液位
+
-
@@ -667,7 +754,7 @@ const Capacity = ({ actions, dispatch, user, }) => {
-
+
{ }, yAxis: { type: 'value', - name: "单位:M", + name: "单位:m", areaStyle: { color: '#FFF', }, @@ -727,7 +814,7 @@ const Capacity = ({ actions, dispatch, user, }) => { areaStyle: { color: '#0e9cff26', }, - data: depthWater?.map(v => v.sLiquid_level) + data: depthWater?.map(v => v.sLiquid_level?.toFixed(2) || 0) }, { type: 'line', name: '池前(上游)液位', @@ -735,7 +822,7 @@ const Capacity = ({ actions, dispatch, user, }) => { areaStyle: { color: '#0e9cff26', }, - data: depthWater?.map(v => v.sGrille_level) + data: depthWater?.map(v => v.sGrille_level?.toFixed(2) || 0) }, ] }} @@ -758,10 +845,15 @@ const Capacity = ({ actions, dispatch, user, }) => { { - setUsePumpId(v) + onChange={v => { + if (v?.length < 4) { + setUsePumpId(v) + } }} options={pumpList?.map(v => ({ value: v.id, label: v.name })) || []} /> @@ -867,7 +962,7 @@ const Capacity = ({ actions, dispatch, user, }) => { trigger: 'axis' }, legend: { - // data: ['集水池液位',], + data: useTrend?.map(v => v.name) || [], right: '10%', textStyle: { color: '#FFF', @@ -877,26 +972,31 @@ const Capacity = ({ actions, dispatch, user, }) => { type: 'category', // name: "时间", boundaryGap: false, - data: useTrend?.map(v => moment(v.time).format('MM-DD HH:mm')) + data: useTrend[0]?.data?.map(v => moment(v.time).format('MM-DD HH:mm')) }, yAxis: { type: 'value', - name: "单位:M", + name: "单位:kwh", areaStyle: { color: '#FFF', }, }, - series: [ - { + series: useTrend?.map(v => { + let front = [{}, {}] + return { type: 'line', - // name: '集水池液位', + name: v.name, smooth: true, areaStyle: { color: '#0e9cff26', }, - data: useTrend?.map(v => v.value) + data: v.data?.map(s => { + front[0] = front[1] + front[1] = s + return front[0]?.eMotor_EQ && (s?.eMotor_EQ - front[0]?.eMotor_EQ)?.toFixed(2) || 0 + }) || [] } - ] + }) || [] }} notMerge={true} lazyUpdate={true} diff --git a/web/client/src/sections/bigScreen/components/electrical.js b/web/client/src/sections/bigScreen/components/electrical.js index dbfaa3e..8bb3e0d 100644 --- a/web/client/src/sections/bigScreen/components/electrical.js +++ b/web/client/src/sections/bigScreen/components/electrical.js @@ -8,12 +8,12 @@ import LineBoxStatus from '../components/electrity/lineBoxStatus'; import VoltageTrend from '../components/electrity/voltageTrend'; import LevelTrend from '../components/electrity/levelTrend'; -const Electrical = ({ dispatch, actions, user, module, setModule }) => { +const Electrical = ({ dispatch, actions, siteList}) => { const { bigScreen } = actions const [pageLeft, setPageLeft] = useState(0) //左边翻页 const [pageRight, setPageRight] = useState(0) //左边翻页 - const [siteList, setSiteList] = useState([]) //站点列表 + // const [siteList, setSiteList] = useState([]) //站点列表 const [pumpList, setPumpList] = useState([]) //水泵列表 const [cabinetList, setCabinetList] = useState([]) //水泵列表 const [strucId, setStrucId] = useState() //站点ID @@ -31,14 +31,10 @@ const Electrical = ({ dispatch, actions, user, module, setModule }) => { const [electricityTrend, setElectricityTrend] = useState([]) //电流趋势 const [useTrend, setUseTrend] = 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) - } - }) - }, []) + setStrucId(siteList[0]?.value) + }, [siteList]) useEffect(async () => { if (strucId) { @@ -74,8 +70,8 @@ const Electrical = ({ dispatch, actions, user, module, setModule }) => { // 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'), + // startTime: moment().startOf('day').format('YYYY-MM-DD HH:mm:ss'), + // endTime: moment().endOf('day').format('YYYY-MM-DD HH:mm:ss'), // limit: 1 // } // } @@ -106,24 +102,6 @@ const Electrical = ({ dispatch, actions, user, module, setModule }) => { }) 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) { - - // } - // }) - - // } } }) } @@ -143,7 +121,7 @@ const Electrical = ({ dispatch, actions, user, module, setModule }) => { 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 } @@ -169,7 +147,7 @@ const Electrical = ({ dispatch, actions, user, module, setModule }) => { type: 'get', url: `stations/theme/data`, params: { query: { stations: pumpId, - startTime: moment().startOf('day').format('YYYY:MM:DD HH:mm:ss'), + startTime: moment().startOf('day').format('YYYY-MM-DD HH:mm:ss'), endTime: moment().format('YYYY-MM-DD HH:mm:ss'), limit: 1 } @@ -189,7 +167,7 @@ const Electrical = ({ dispatch, actions, user, module, setModule }) => { type: 'get', url: `stations/theme/data`, params: { query: { stations: cabinetId, - startTime: moment().startOf('day').format('YYYY:MM:DD HH:mm:ss'), + startTime: moment().startOf('day').format('YYYY-MM-DD HH:mm:ss'), endTime: moment().format('YYYY-MM-DD HH:mm:ss'), limit: 1 } @@ -209,7 +187,7 @@ const Electrical = ({ dispatch, actions, user, module, setModule }) => { type: 'get', url: `stations/theme/data`, params: { query: { stations: voltagePumpId?.join(), - 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 } @@ -260,6 +238,8 @@ const Electrical = ({ dispatch, actions, user, module, setModule }) => {
+
集水池水位{depthWater[0]?.sLiquid_level?.toFixed(2) || 0}
+
池前上游水位{depthWater[0]?.sGrille_level?.toFixed(2) || 0}
v.sLiquid_level) + data: depthWater?.map(v => v.sLiquid_level?.toFixed(2) || 0) }, { type: 'line', name: '池前(上游)液位', @@ -80,7 +80,7 @@ const LevelTrend = ({ user, voltagePumpId, pumpList, setVoltagePumpId, depthWate areaStyle: { color: '#0e9cff26', }, - data: depthWater?.map(v => v.sGrille_level) + data: depthWater?.map(v => v.sGrille_level?.toFixed(2) || 0) }, ] }} diff --git a/web/client/src/sections/bigScreen/components/electrity/realTimeStatus.js b/web/client/src/sections/bigScreen/components/electrity/realTimeStatus.js index b5e5562..c969d18 100644 --- a/web/client/src/sections/bigScreen/components/electrity/realTimeStatus.js +++ b/web/client/src/sections/bigScreen/components/electrity/realTimeStatus.js @@ -14,7 +14,7 @@ const RealTimeStatus = ({ user, pumpId, pumpList, setPumpId, pumpOne }) => { backgroundImage: 'url(/assets/images/monitor/headerTitle.png)', backgroundSize: '100% 36px', backgroundPosition: '0 0', - backgroundRepeat: 'no-repeat',zIndex:2, + backgroundRepeat: 'no-repeat', zIndex: 2, width: '26%', height: '40%', minWidth: 360, position: "absolute", left: 10, top: 0 }}>
@@ -51,14 +51,18 @@ const RealTimeStatus = ({ user, pumpId, pumpList, setPumpId, pumpOne }) => { display: 'flex', alignItems: "center", justifyContent: 'space-between', }}>
控制方式:
-
现场就地
+
{pumpOne?.data[0]?.sMotor_LR ? '现场就地' : "平台远程"}
远程模式:
-
平台手动
+
+ {pumpOne?.data[0]?.sMotor_RunMode == 1 ? '就地手动' + : pumpOne?.data[0]?.sMotor_RunMode == 2 ? "平台手动" + : pumpOne?.data[0]?.sMotor_RunMode == 2 ? "平台液控" : "--"} +
@@ -68,11 +72,11 @@ const RealTimeStatus = ({ user, pumpId, pumpList, setPumpId, pumpOne }) => { width: '100%', height: 43, display: 'flex', justifyContent: "space-between", alignItems: 'center' }}>
-
单次时间:
+
单次时间:
{pumpOne?.data[0]?.dPump_T_S} min
-
积累时间:
+
积累时间:
{pumpOne?.data[0]?.dPump_T_T} h
@@ -82,11 +86,11 @@ const RealTimeStatus = ({ user, pumpId, pumpList, setPumpId, pumpOne }) => { width: '100%', height: 43, display: 'flex', justifyContent: "space-between", alignItems: 'center' }}>
-
运行电流:
+
运行电流:
{pumpOne?.data[0]?.eMotor_A_A} min
-
运行电压:
+
运行电压:
{pumpOne?.data[0]?.eMotor_A_V} h
diff --git a/web/client/src/sections/bigScreen/components/electrity/voltageTrend.js b/web/client/src/sections/bigScreen/components/electrity/voltageTrend.js index ae5baf2..fee2fbc 100644 --- a/web/client/src/sections/bigScreen/components/electrity/voltageTrend.js +++ b/web/client/src/sections/bigScreen/components/electrity/voltageTrend.js @@ -76,7 +76,7 @@ const VoltageTrend = ({ user, voltagePumpId, pumpList, setVoltagePumpId, data }) }, yAxis: { type: 'value', - name: "单位:M", + name: "单位:V", areaStyle: { color: '#FFF', }, diff --git a/web/client/src/sections/bigScreen/components/realTime.js b/web/client/src/sections/bigScreen/components/realTime.js index cc58340..62cfedc 100644 --- a/web/client/src/sections/bigScreen/components/realTime.js +++ b/web/client/src/sections/bigScreen/components/realTime.js @@ -6,14 +6,15 @@ 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'; +import Below from '../components/realTime/below'; +import RunTime from '../components/realTime/runTime'; +import AccumulateTime from '../components/realTime/accumulateTime'; -const RealTime = ({ dispatch, actions, user, module, setModule }) => { +const RealTime = ({ dispatch, actions, user, siteList, }) => { 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 @@ -30,19 +31,24 @@ const RealTime = ({ dispatch, actions, user, module, setModule }) => { const [depthWater, setDepthWater] = useState([]) //液位趋势 const [electricityTrend, setElectricityTrend] = useState([]) //电流趋势 const [useTrend, setUseTrend] = useState([]) //用电趋势 - const [interval, setInterval] = useState('本日') //用电概况区间 + const [stations, setStations] = useState({}) //测点id + const [softStartData, setSoftStartData] = useState([]) //软启动总用电数据 + const [electro, setElectro] = useState({ week: 0, year: 0, day: 0 }) //用电概况 + const [level, setLevel] = useState(0) //实时液位 + + + 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) - } - }) - }, []) + setStrucId(siteList[0]?.value) + }, [siteList]) useEffect(async () => { if (strucId) { + let station = {} + let week = 0 //本周 + let year = 0 //年 + let day = 0 //今日 await dispatch(bigScreen.axyData({ type: 'get', url: `structures/${strucId}/factors` })).then(async r => { if (r.success) { //水泵信息 @@ -51,145 +57,267 @@ const RealTime = ({ dispatch, actions, user, module, setModule }) => { await dispatch(bigScreen.axyData({ type: 'get', url: `structures/${strucId}/stations`, params: { query: { factorId: waterId } } + })).then(async p => { + if (p.success) { + let dataId = p.payload.data[0]?.groups[0]?.stations?.map(k => k.id) || [] + station.pump = dataId + // let voltageId =[] + + // 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().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) { + setSoftStartData(d.payload.data?.stations) + } + }) + + //今天 + await dispatch(bigScreen.axyData({ + type: 'get', url: `stations/data/theme`, params: { + query: { + stations: dataId.join(), + begin: moment().startOf('day').format('x'), + end: moment().endOf('day').format('x'), + aggtype: "h", + method: 'diff' + } + } + })).then(d => { + if (d.success) { + d.payload.data[0]?.stations?.map(c => { + c.data?.map(f => { + if (!f.changData) { + day += (f?.values?.eMotor_EQ || 0) + week += (f?.values?.eMotor_EQ || 0) + year += (f?.values?.eMotor_EQ || 0) + } + }) + }) + } + }) + //本周 + await dispatch(bigScreen.axyData({ + type: 'get', url: `stations/data/theme`, params: { + query: { + stations: dataId.join(), + begin: moment().weekday(1).startOf('day').format('x'), + end: moment().weekday(7).endOf('day').format('x'), + aggtype: "d", + method: 'diff' + } + } + })).then(d => { + if (d.success) { + d.payload.data[0]?.stations?.map(c => { + c.data?.map(f => { + if (!f.changData) { + week += (f?.values?.eMotor_EQ || 0) + } + }) + }) + } + }) + //今年 + await dispatch(bigScreen.axyData({ + type: 'get', url: `stations/data/theme`, params: { + query: { + stations: dataId.join(), + begin: moment().startOf('year').format('x'), + end: moment().endOf('year').format('x'), + aggtype: "d", + method: 'diff' + } + } + })).then(d => { + if (d.success) { + d.payload.data[0]?.stations?.map(c => { + c.data?.map(f => { + if (!f.changData) { + year += (f?.values?.eMotor_EQ || 0) + } + }) + }) + } + }) + } + } + }) + } + // 进线柜 + 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 = [] - 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) { - // } - // }) - // } - + station.cabine = dataId + // 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) { + + } + }) + + // // 今天 await dispatch(bigScreen.axyData({ type: 'get', url: `stations/data/theme`, params: { query: { stations: dataId.join(), - begin: moment().add(-100, 'hours').format('x'), + begin: moment().startOf('day').format('x'), end: moment().endOf('day').format('x'), - // limit: 1 - aggtype:'d', - orderDirection:'ASC', + aggtype: "h", + method: 'diff' } } })).then(d => { if (d.success) { + d.payload.data[0]?.stations?.map(c => { + c.data?.map(f => { + if (!f.changData) { + day += (f?.values?.eQF_EQ || 0) + week += (f?.values?.eQF_EQ || 0) + year += (f?.values?.eQF_EQ || 0) + } + }) + }) } }) + // // 本周 + await dispatch(bigScreen.axyData({ + type: 'get', url: `stations/data/theme`, params: { + query: { + stations: dataId.join(), + begin: moment().weekday(1).startOf('day').format('x'), + end: moment().weekday(7).endOf('day').format('x'), + aggtype: "d", + method: 'diff' + } + } + })).then(d => { + if (d.success) { + d.payload.data[0]?.stations?.map(c => { + c.data?.map(f => { + if (!f.changData) { + week += (f?.values?.eQF_EQ || 0) + } + }) + }) + } + }) + // // 今年 + await dispatch(bigScreen.axyData({ + type: 'get', url: `stations/data/theme`, params: { + query: { + stations: dataId.join(), + begin: moment().startOf('year').format('x'), + end: moment().endOf('year').format('x'), + aggtype: "d", + method: 'diff' + } + } + })).then(d => { + if (d.success) { + d.payload.data[0]?.stations?.map(c => { + c.data?.map(f => { + if (!f.changData) { + year += (f?.values?.eQF_EQ || 0) + } + }) + }) + } + }) + } + } + }) + } + + + //泵站信息 + 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().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) { + setLevel(d.payload.data?.stations[0]?.data[0]?.sLiquid_level || 0) + } + }) } + }) } - // 进线柜 - // 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) - // } - // }) - // } - - // }) - // } } }) + setStations(station) + setElectro({ day: day, week: week, year: year }) } + }, [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'), + // startTime: moment().startOf('day').format('YYYY-MM-DD HH:mm:ss'), // endTime: moment().format('YYYY-MM-DD HH:mm:ss'), // limit: 1 // } @@ -209,7 +337,7 @@ const RealTime = ({ dispatch, actions, user, module, setModule }) => { // type: 'get', url: `stations/theme/data`, params: { // query: { // stations: cabinetId, - // startTime: moment().startOf('day').format('YYYY:MM:DD HH:mm:ss'), + // startTime: moment().startOf('day').format('YYYY-MM-DD HH:mm:ss'), // endTime: moment().format('YYYY-MM-DD HH:mm:ss'), // limit: 1 // } @@ -247,43 +375,45 @@ const RealTime = ({ dispatch, actions, user, module, setModule }) => { return
- - {/* */} - - {/* */} + + + + +
-
- 环境湿度:
{depthWater[0]?.sHumidity} % + backgroundImage: 'url(/assets/images/realTime/buttom-d.png)', backgroundSize: '100% 100%', backgroundPosition: 'center', backgroundRepeat: 'no-repeat', + width: '100%', height: 40, lineHeight: "40px", textAlign: "center" + }}> 本周用电量:{electro?.week?.toFixed(2)}
+ +
+
-
- 环境湿度:
{depthWater[0]?.sTEMP || "--"} ℃ + backgroundImage: 'url(/assets/images/realTime/buttom-d.png)', backgroundSize: '100% 100%', backgroundPosition: 'center', backgroundRepeat: 'no-repeat', + width: '100%', height: 40, lineHeight: "40px", textAlign: "center" + }}>今年用电量:{electro?.year?.toFixed(2)}
+ +
+
-
- 信号:
{depthWater[0]?.CSQ4G} + backgroundImage: 'url(/assets/images/realTime/buttom-d.png)', backgroundSize: '100% 100%', backgroundPosition: 'center', backgroundRepeat: 'no-repeat', + width: '100%', height: 40, lineHeight: "40px", textAlign: "center" + }}> 今日用电量:{electro?.day?.toFixed(2)}
+
- +
{ + + const [page, setPage] = useState(0) + + + + return
+
+
累计运行时间
+
+
+
单位:h
+
+ {softStartData?.length > 0 && <> + { + if (page > 0) setPage(page - 1) + }} /> + { + softStartData?.slice(page * 2, (page + 1) * 2)?.map((v, index) => { + return
+
{v.name}
+
{v.data[0]?.dPump_T_T}
+
+ }) + } + { + if (page + 1 < Math.ceil(softStartData?.length / 2)) setPage(page + 1) + }} /> + } +
+
+
+ +} + +function mapStateToProps (state) { + const { auth, global } = state; + return { + user: auth.user, + clientHeight: global.clientHeight, + }; +} + +export default connect(mapStateToProps)(AccumulateTime); \ No newline at end of file diff --git a/web/client/src/sections/bigScreen/components/realTime/below.js b/web/client/src/sections/bigScreen/components/realTime/below.js new file mode 100644 index 0000000..be20f9a --- /dev/null +++ b/web/client/src/sections/bigScreen/components/realTime/below.js @@ -0,0 +1,448 @@ +import React, { useEffect, useState } from 'react'; +import { connect } from 'react-redux'; +import { Select } from 'antd'; +import ReactECharts from 'echarts-for-react'; +import moment from 'moment' + +const { Option } = Select; + +const Below = ({ dispatch, actions, stations,level }) => { + const { bigScreen } = actions + const [page, setPage] = useState(0) + const [threePower, setThreePower] = useState([]) + const [electricity, setElectricity] = useState([]) + + + useEffect(async () => { + let now = 0 + let before = 0 + let timeData = [] + if (stations?.pump) { + await dispatch(bigScreen.axyData({ + type: 'get', url: `stations/theme/data`, params: { + query: { + stations: stations?.pump?.join(), + startTime: moment().add(-6, 'hours').format('YYYY-MM-DD HH:mm:ss'), + endTime: moment().endOf('day').format('YYYY-MM-DD HH:mm:ss'), + limit: 1440 + } + } + })).then(d => { + if (d.success) { + let threedata = [] + d.payload.data?.stations?.map((s, index) => { + if (index == 0) { + s.data?.map(a => { + threedata?.push({ A: a.eMotor_A_A, B: a.eMotor_B_A, C: a.eMotor_C_A, time: a.time }) + }) + } else { + threedata.forEach((f, i) => { + s.data?.map((a, ii) => { + if (i == ii) { + f.A = f.A + a.eMotor_A_A + f.B = f.B + a.eMotor_B_A + f.C = f.C + a.eMotor_C_A + } + }) + }) + } + + }) + setThreePower(threedata); + } + }) + + + + //现在 + await dispatch(bigScreen.axyData({ + type: 'get', url: `stations/data/theme`, params: { + query: { + stations: stations?.pump.join(), + begin: moment().startOf('year').format('x'), + end: moment().endOf('year').format('x'), + aggtype: "d", + method: 'diff' + } + } + })).then(d => { + if (d.success) { + + d.payload.data[0]?.stations?.map(c => { + c.data?.map(f => { + if (!f.changData) { + if (timeData.find(p => p.time == moment(f.time).format('YYYY-MM'))) { + timeData.forEach(x => { + if (x.time == moment(f.time).format('YYYY-MM')) { + x.electro = x.electro + f.values?.eMotor_EQ + } + }) + } else { + timeData.push({ time: moment(f.time).format('YYYY-MM'), electro: f.values?.eMotor_EQ }) + } + } + }) + }) + + } + }) + + await dispatch(bigScreen.axyData({ + type: 'get', url: `stations/data/theme`, params: { + query: { + stations: stations?.pump.join(), + begin: moment().startOf("day").format('x'), + end: moment().endOf("day").format('x'), + aggtype: "h", + method: 'diff' + } + } + })).then(d => { + if (d.success) { + console.log(timeData); + timeData.forEach((x, i) => { + if (i == (timeData?.length - 1)) { + d.payload.data[0]?.stations?.map(c => { + c.data?.map(f => { + if (!f.changData) { + x.electro = x.electro + f.values?.eMotor_EQ + } + }) + }) + } + }) + + } + }) + + + + } + + + if (stations?.cabine) { + //现在 + await dispatch(bigScreen.axyData({ + type: 'get', url: `stations/data/theme`, params: { + query: { + stations: stations?.cabine.join(), + begin: moment().startOf('year').format('x'), + end: moment().endOf('year').format('x'), + aggtype: "d", + method: 'diff' + } + } + })).then(d => { + if (d.success) { + + d.payload.data[0]?.stations?.map(c => { + c.data?.map(f => { + if (!f.changData) { + if (timeData.find(p => p.time == moment(f.time).format('YYYY-MM'))) { + timeData.forEach(x => { + if (x.time == moment(f.time).format('YYYY-MM')) { + x.electro = x.electro + f.values?.eQF_EQ + } + }) + } else { + timeData.push({ time: moment(f.time).format('YYYY-MM'), electro: f.values?.eQF_EQ }) + } + } + }) + }) + + } + }) + + await dispatch(bigScreen.axyData({ + type: 'get', url: `stations/data/theme`, params: { + query: { + stations: stations?.cabine.join(), + begin: moment().startOf("day").format('x'), + end: moment().endOf("day").format('x'), + aggtype: "h", + method: 'diff' + } + } + })).then(d => { + if (d.success) { + console.log(timeData); + timeData.forEach((x, i) => { + if (i == (timeData?.length - 1)) { + d.payload.data[0]?.stations?.map(c => { + c.data?.map(f => { + if (!f.changData) { + x.electro = x.electro + f.values?.eQF_EQ + } + }) + }) + } + }) + + } + }) + } + setElectricity(timeData); + + }, [stations]) + + return
+
+
+
三相电流
+
+ v.time) + }, + { + type: 'inside', + }, + ], + tooltip: { + trigger: 'axis' + }, + legend: { + data: ['A相电流', 'B相电流', 'C相电流'], + right: '10%', + textStyle: { + color: '#FFF', + }, + }, + xAxis: { + type: 'category', + // name: "时间", + boundaryGap: false, + data: threePower?.map(v => moment(v.time).format('MM-DD HH:mm')) + }, + yAxis: { + type: 'value', + name: "单位:A", + areaStyle: { + color: '#FFF', + }, + }, + series: [ + { + type: 'line', + name: 'A相电流', + smooth: true, + areaStyle: { + color: '#0e9cff26', + }, + data: threePower?.map(v => v.A?.toFixed(2)) + }, { + type: 'line', + name: 'B相电流', + smooth: true, + areaStyle: { + color: '#0e9cff26', + }, + data: threePower?.map(v => v.B?.toFixed(2)) + }, { + type: 'line', + name: 'C相电流', + smooth: true, + areaStyle: { + color: '#0e9cff26', + }, + data: threePower?.map(v => v.C?.toFixed(2)) + }, + ] + }} + notMerge={true} + lazyUpdate={true} + style={{ width: "100%", height: "100%" }} + theme={'ReactEChart'} + /> + +
+
+
+
实时液位
+
+
+ +
{level?.toFixed(2) || 0} m
+
+ +
+
+
+
用电趋势
+
+ moment(v.time).month() + 1) || [] + }, + yAxis: { + type: 'value', + name: "单位:kwh", + areaStyle: { + color: '#FFF', + }, + }, + series: [ + { + type: 'bar', + name: '总用电量', + smooth: true, + areaStyle: { + color: '#0e9cff26', + }, + data: electricity?.map(v => v.electro?.toFixed(2)) || [] + } + ] + }} + notMerge={true} + lazyUpdate={true} + style={{ width: "100%", height: "100%" }} + theme={'ReactEChart'} + /> +
+
+ +} + +function mapStateToProps (state) { + const { auth, global } = state; + return { + user: auth.user, + clientHeight: global.clientHeight, + actions: global.actions, + }; +} + +export default connect(mapStateToProps)(Below); \ No newline at end of file diff --git a/web/client/src/sections/bigScreen/components/realTime/general.js b/web/client/src/sections/bigScreen/components/realTime/general.js index a056f2e..db7f45e 100644 --- a/web/client/src/sections/bigScreen/components/realTime/general.js +++ b/web/client/src/sections/bigScreen/components/realTime/general.js @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { useEffect, useState } from 'react'; import { connect } from 'react-redux'; import { Select } from 'antd'; import ReactECharts from 'echarts-for-react'; @@ -6,11 +6,175 @@ import moment from 'moment' const { Option } = Select; -const General = ({ user, setInterval, interval, }) => { +const General = ({ dispatch, actions, stations }) => { + const { bigScreen } = actions + const [electro, setElectro] = useState({ now: 0, before: 0 }) //用电概况 + const [interval, setInterval] = useState('本日') //用电概况区间 + useEffect(async () => { + let now = 0 + let before = 0 + let time = interval == '本日' ? + "day" : interval == '本月' ? + "month" : interval == '本年' ? + "year" : "" + let pastTime = { + begin: interval == '本日' ? + moment().day(moment().day() - 1).startOf(time).format('x') : interval == '本月' ? + moment().month(moment().month() - 1).startOf(time).format('x') : interval == '本年' ? + moment().year(moment().year() - 1).startOf(time).format('x') : "", + end: interval == '本日' ? + moment().day(moment().day() - 1).endOf(time).format('x') : interval == '本月' ? + moment().month(moment().month() - 1).endOf(time).format('x') : interval == '本年' ? + moment().year(moment().year() - 1).endOf(time).format('x') : "", + } + if (stations?.pump) { + //现在 + await dispatch(bigScreen.axyData({ + type: 'get', url: `stations/data/theme`, params: { + query: { + stations: stations?.pump.join(), + begin: moment().startOf(time).format('x'), + end: moment().endOf(time).format('x'), + aggtype: interval == '本日' ? "h" : "d", + method: 'diff' + } + } + })).then(d => { + if (d.success) { + d.payload.data[0]?.stations?.map(c => { + c.data?.map(f => { + if (!f.changData) { + now += (f?.values?.eMotor_EQ || 0) + } + }) + }) + } + }) + if (interval != '本日') { + await dispatch(bigScreen.axyData({ + type: 'get', url: `stations/data/theme`, params: { + query: { + stations: stations?.pump.join(), + begin: moment().startOf("day").format('x'), + end: moment().endOf("day").format('x'), + aggtype: "h", + method: 'diff' + } + } + })).then(d => { + if (d.success) { + d.payload.data[0]?.stations?.map(c => { + c.data?.map(f => { + if (!f.changData) { + now += (f?.values?.eMotor_EQ || 0) + } + }) + }) + } + }) + } + + + + //以前 + await dispatch(bigScreen.axyData({ + type: 'get', url: `stations/data/theme`, params: { + query: { + stations: stations?.pump?.join(), + ...pastTime, + aggtype: interval == '本日' ? "h" : "d", + method: 'diff' + } + } + })).then(d => { + if (d.success) { + d.payload.data[0]?.stations?.map(c => { + c.data?.map(f => { + if (!f.changData) { + before += (f?.values?.eMotor_EQ || 0) + } + }) + }) + } + }) + } + + + if (stations?.cabine) { + // 现在 + await dispatch(bigScreen.axyData({ + type: 'get', url: `stations/data/theme`, params: { + query: { + stations: stations?.cabine?.join(), + begin: moment().startOf(time).format('x'), + end: moment().endOf(time).format('x'), + aggtype: interval == '本日' ? "h" : "d", + method: 'diff' + } + } + })).then(d => { + if (d.success) { + d.payload.data[0]?.stations?.map(c => { + c.data?.map(f => { + if (!f.changData) { + now += (f?.values?.eQF_EQ || 0) + } + }) + }) + } + }) + if (interval != '本日') { + await dispatch(bigScreen.axyData({ + type: 'get', url: `stations/data/theme`, params: { + query: { + stations: stations?.cabine?.join(), + begin: moment().startOf("day").format('x'), + end: moment().endOf("day").format('x'), + aggtype: "h", + method: 'diff' + } + } + })).then(d => { + if (d.success) { + d.payload.data[0]?.stations?.map(c => { + c.data?.map(f => { + if (!f.changData) { + now += (f?.values?.eQF_EQ || 0) + } + }) + }) + } + }) + } + // 以前 + await dispatch(bigScreen.axyData({ + type: 'get', url: `stations/data/theme`, params: { + query: { + stations: stations?.cabine?.join(), + ...pastTime, + aggtype: interval == '本日' ? "h" : "d", + method: 'diff' + } + } + })).then(d => { + if (d.success) { + d.payload.data[0]?.stations?.map(c => { + c.data?.map(f => { + if (!f.changData) { + before += (f?.values?.eQF_EQ || 0) + } + }) + }) + } + }) + } + setElectro({ now: now, before: before }) + + }, [stations, interval]) return
{ "当日用电" : interval == '本月' ? "当月用电" : interval == '本年' ? "当年用电" : ""}
-
{ } kwh
+
{electro?.now.toFixed(2)} kwh
@@ -52,7 +216,7 @@ const General = ({ user, setInterval, interval, }) => { "昨日用电" : interval == '本月' ? "上月用电" : interval == '本年' ? "上年用电" : ""}
-
{ } kwh
+
{electro?.before?.toFixed(2)} kwh
@@ -61,9 +225,13 @@ const General = ({ user, setInterval, interval, }) => {
-
+
用电同比
+
+ {electro?.now && electro?.before ? (((electro?.now - electro?.before) / electro?.before) * 100).toFixed(2) : "--"} % + +
@@ -77,6 +245,7 @@ function mapStateToProps (state) { return { user: auth.user, clientHeight: global.clientHeight, + actions: global.actions, }; } diff --git a/web/client/src/sections/bigScreen/components/realTime/runTime.js b/web/client/src/sections/bigScreen/components/realTime/runTime.js new file mode 100644 index 0000000..ee8870a --- /dev/null +++ b/web/client/src/sections/bigScreen/components/realTime/runTime.js @@ -0,0 +1,64 @@ +import React, { useEffect, useState } from 'react'; +import { connect } from 'react-redux'; +import { Select } from 'antd'; +import ReactECharts from 'echarts-for-react'; +import moment from 'moment' + +const { Option } = Select; + +const RunTime = ({ user, softStartData }) => { + + const [page, setPage] = useState(0) + + + + return
+
+
单次运行时间
+
+
+
单位:min
+
+ {softStartData?.length > 0 && <> + { + if (page > 0) setPage(page - 1) + }} /> + { + softStartData?.slice(page * 2, (page + 1) * 2)?.map((v, index) => { + return
+
{v.name}
+
{v.data[0]?.dPump_T_S}
+
+ }) + } + { + if (page + 1 < Math.ceil(softStartData?.length / 2)) setPage(page + 1) + }} /> + } +
+
+
+ +} + +function mapStateToProps (state) { + const { auth, global } = state; + return { + user: auth.user, + clientHeight: global.clientHeight, + }; +} + +export default connect(mapStateToProps)(RunTime); \ No newline at end of file diff --git a/web/client/src/sections/bigScreen/components/realTime/softStart.js b/web/client/src/sections/bigScreen/components/realTime/softStart.js index 3d2c0da..e656df4 100644 --- a/web/client/src/sections/bigScreen/components/realTime/softStart.js +++ b/web/client/src/sections/bigScreen/components/realTime/softStart.js @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { useEffect, useState } from 'react'; import { connect } from 'react-redux'; import { Select } from 'antd'; import ReactECharts from 'echarts-for-react'; @@ -6,9 +6,9 @@ import moment from 'moment' const { Option } = Select; -const SoftStart = ({ user, setInterval, interval }) => { - +const SoftStart = ({ user, softStartData }) => { + const [page, setPage] = useState(0) @@ -23,11 +23,30 @@ const SoftStart = ({ user, setInterval, interval }) => {
软启动总用电量
-
单位:kwh
-
- - - +
单位:kwh
+
+ {softStartData?.length > 0 && <> + { + if (page > 0) setPage(page - 1) + }} /> + { + softStartData?.slice(page * 2, (page + 1) * 2)?.map((v, index) => { + return
+
{v.name}
+
{v.data[0]?.eMotor_EQ}
+
+ }) + } + { + if (page + 1 < Math.ceil(softStartData?.length / 2)) setPage(page + 1) + }} /> + }
diff --git a/web/client/src/sections/bigScreen/containers/systemManagement.js b/web/client/src/sections/bigScreen/containers/systemManagement.js index 07ed06a..c9597e6 100644 --- a/web/client/src/sections/bigScreen/containers/systemManagement.js +++ b/web/client/src/sections/bigScreen/containers/systemManagement.js @@ -13,12 +13,20 @@ import './style.less'; const TreeNode = Tree.TreeNode; -const SystemManagement = ({ clientHeight, user, history }) => { +const SystemManagement = ({ dispatch, actions, user, history }) => { + const { bigScreen } = actions - const [module, setModule] = useState('realTime') + const [module, setModule] = useState('basis') const [showData, setshowData] = useState([]) - useEffect(() => { + const [siteList, setSiteList] = 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 })) || []) + } + }) }, []) return ( @@ -37,9 +45,9 @@ const SystemManagement = ({ clientHeight, user, history }) => {
: ""} - {module == 'capacity' ? : ""} - {module == 'electrical' ? : ""} - {module == 'realTime' ? : ""} + {module == 'capacity' ? : ""} + {module == 'electrical' ? : ""} + {module == 'realTime' ? : ""} ) } @@ -49,6 +57,7 @@ function mapStateToProps (state) { return { user: auth.user, clientHeight: global.clientHeight, + actions: global.actions, }; }