Browse Source

泵站优化

master
wenlele 1 year ago
parent
commit
2780449493
  1. 2
      api/.vscode/launch.json
  2. 43
      api/app/lib/controllers/bigScreen/index .js
  3. 4
      api/app/lib/index.js
  4. 45
      api/app/lib/models/video.js
  5. 31
      api/app/lib/routes/organization/index.js
  6. 458
      api/app/lib/schedule/workorder_statistics.js
  7. 16
      api/config.js
  8. 48
      scripts/0.1/data/pump_information.sql
  9. 18
      scripts/0.2/schema/1.video.sql
  10. BIN
      web/client/assets/images/monitor/pillar.png
  11. 88
      web/client/src/sections/bigScreen/actions/bigScreen.js
  12. 21
      web/client/src/sections/bigScreen/actions/index.js
  13. 21
      web/client/src/sections/bigScreen/actions/video.js
  14. 146
      web/client/src/sections/bigScreen/components/basis.js
  15. 27
      web/client/src/sections/bigScreen/components/basis/left_1.js
  16. 423
      web/client/src/sections/bigScreen/components/capacity.js
  17. 217
      web/client/src/sections/bigScreen/components/electrical.js
  18. 3
      web/client/src/sections/bigScreen/components/electrity/lineBoxStatus.js
  19. 5
      web/client/src/sections/bigScreen/components/electrity/realTimeStatus.js
  20. 3
      web/client/src/sections/bigScreen/components/electrity/voltageTrend.js
  21. 19
      web/client/src/sections/bigScreen/components/realTime.js
  22. 71
      web/client/src/sections/bigScreen/components/realTime/below.js
  23. 46
      web/client/src/sections/bigScreen/components/video.js
  24. 4
      web/client/src/sections/bigScreen/containers/systemManagement.js
  25. 5
      web/client/src/utils/webapi.js

2
api/.vscode/launch.json

@ -17,6 +17,8 @@
// //
"-g postgres://postgres:123456@10.8.30.166:5432/PumpStation", "-g postgres://postgres:123456@10.8.30.166:5432/PumpStation",
// "-g postgres://FashionAdmin:123456@10.8.30.166:5432/PumpStation", // "-g postgres://FashionAdmin:123456@10.8.30.166:5432/PumpStation",
"--redisHost localhost",
"--redisPort 6379",
// //
// "--apiEmisUrl http://10.8.30.161:1111", // "--apiEmisUrl http://10.8.30.161:1111",
// "--qnak XuDgkao6cL0HidoMAPnA5OB10Mc_Ew08mpIfRJK5", // "--qnak XuDgkao6cL0HidoMAPnA5OB10Mc_Ew08mpIfRJK5",

43
api/app/lib/controllers/bigScreen/index .js

@ -56,8 +56,7 @@ async function axyData (ctx, next) {
const pumpInformation = async function (ctx) { const pumpInformation = async function (ctx) {
let errMsg = { message: '获取泵站数据失败' }
let errMsg = { message: '获取泵站信息失败' }
try { try {
const models = ctx.fs.dc.models; const models = ctx.fs.dc.models;
const { page, limit, name } = ctx.query; const { page, limit, name } = ctx.query;
@ -75,11 +74,49 @@ const pumpInformation = async function (ctx) {
const getPumpStation = async function (ctx) {
try {
const { key, methodType, field } = ctx.query;
let res
if (field) {
res = await ctx.redis[methodType](key, field) || []
} else {
res = await ctx.redis[methodType](key) || []
}
ctx.status = 200;
ctx.body = JSON.parse(res)
} catch (error) {
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`);
ctx.status = 400;
ctx.body = { message: '获取所有泵站信息失败' }
}
}
const getVideoUrl = async function (ctx) {
let errMsg = { message: '获取视频监控url' }
try {
const models = ctx.fs.dc.models;
const res = await models.Video.findAll();
ctx.status = 200;
ctx.body = res;
} catch (error) {
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`);
ctx.status = 400;
ctx.body = errMsg
}
}
module.exports = { module.exports = {
axyData, axyData,
pumpInformation pumpInformation,
getPumpStation,
getVideoUrl
} }

4
api/app/lib/index.js

@ -4,7 +4,7 @@ const fs = require('fs');
const path = require('path'); const path = require('path');
const utils = require('./utils') const utils = require('./utils')
const routes = require('./routes'); const routes = require('./routes');
//const redisConnect = require('./service/redis') const redisConnect = require('./service/redis')
const socketConect = require('./service/socket') const socketConect = require('./service/socket')
const paasRequest = require('./service/paasRequest'); const paasRequest = require('./service/paasRequest');
const authenticator = require('./middlewares/authenticator'); const authenticator = require('./middlewares/authenticator');
@ -22,7 +22,7 @@ module.exports.entry = function (app, router, opts) {
app.fs.api.logAttr = app.fs.api.logAttr || {}; app.fs.api.logAttr = app.fs.api.logAttr || {};
// 顺序固定 ↓ // 顺序固定 ↓
//redisConnect(app, opts) redisConnect(app, opts)
socketConect(app, opts) socketConect(app, opts)
// 实例其他平台请求方法 // 实例其他平台请求方法

45
api/app/lib/models/video.js

@ -0,0 +1,45 @@
/* eslint-disable*/
'use strict';
module.exports = dc => {
const DataTypes = dc.ORM;
const sequelize = dc.orm;
const Video = sequelize.define("video", {
id: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: true,
field: "id",
autoIncrement: true,
unique: "video_id_uindex"
},
videoUrl: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "video_url",
autoIncrement: false
},
strucId: {
type: DataTypes.INTEGER,
allowNull: true,
defaultValue: null,
comment: "",
primaryKey: false,
field: "struc_id",
autoIncrement: false
},
}, {
tableName: "video",
comment: "",
indexes: []
});
dc.models.Video = Video;
return Video;
};

31
api/app/lib/routes/organization/index.js

@ -3,10 +3,39 @@
const data = require('../../controllers/bigScreen/index '); const data = require('../../controllers/bigScreen/index ');
module.exports = function (app, router, opts) { module.exports = function (app, router, opts) {
app.fs.api.logAttr['POST/axyData'] = { content: '获取安心云数据', visible: true }; app.fs.api.logAttr['POST/axyData'] = { content: '获取安心云数据', visible: true };
router.post('/axyData', data.axyData); router.post('/axyData', data.axyData);
app.fs.api.logAttr['GET/pumpInformation'] = { content: '获取泵站信息', visible: true }; app.fs.api.logAttr['GET/pumpInformation'] = { content: '获取泵站信息', visible: true };
router.get('/pumpInformation', data.pumpInformation); router.get('/pumpInformation', data.pumpInformation);
app.fs.api.logAttr['get/videoUrl'] = { content: '获取视频监控url', visible: true };
router.get('/videoUrl', data.getVideoUrl);
app.fs.api.logAttr['get/pump/station'] = { content: '获取所有站点信息', visible: true };
router.get('/pump/station', data.getPumpStation);
app.fs.api.logAttr['get/water/level/all'] = { content: '获取所有泵站七天内最新集水池液位', visible: true };
router.get('/water/level/all', data.getPumpStation);
app.fs.api.logAttr['get/water/level/six'] = { content: '获取泵站6h最新集水池液位', visible: true };
router.get('/water/level/six', data.getPumpStation);
app.fs.api.logAttr['get/water/pump/state/all'] = { content: '获取水泵状态', visible: true };
router.get('/water/pump/state/all', data.getPumpStation);
app.fs.api.logAttr['get/capacity'] = { content: '获取能耗监测数据', visible: true };
router.get('/capacity', data.getPumpStation);
app.fs.api.logAttr['get/currentSix'] = { content: '获取水泵数据', visible: true };
router.get('/currentSix', data.getPumpStation);
app.fs.api.logAttr['get/cabinet'] = { content: '获取进线柜数据', visible: true };
router.get('/cabinet', data.getPumpStation);
app.fs.api.logAttr['get/threePhase'] = { content: '获取三相电流数据', visible: true };
router.get('/threePhase', data.getPumpStation);
}; };

458
api/app/lib/schedule/workorder_statistics.js

@ -0,0 +1,458 @@
const moment = require('moment')
// let isDev = false
let isDev = true
module.exports = function (app, opts) {
const workorderStatistics = app.fs.scheduleInit(
{
interval: '24 0 */5 * * *',
immediate: isDev,
proRun: !isDev,
// disabled: true,
},
async () => {
try {
const { models, ORM: sequelize } = app.fs.dc
const { parseProcessData } = app.fs.utils
let data = await getAnxinyunToken(app)
//获取所有泵站
let structureList = await app.fs.anxinyun.get(`/organizations/${data.orgId}/structures?token=${data.token}`) || []
await app.redis.set("structure", JSON.stringify(structureList))
if (structureList.length) {
let waterLevelData = [] //七天内每个泵站的集水池液位
let waterLevelSix = {} //泵站最新6h的集水池液位
let waterPumpStateAll = [] //所有水泵的状态
let capacity = {} //能耗监测
let currentSix = {} //水泵六小时数据
let cabinet = {} //进线柜
let threePhase = {} //三相电流
for (let index = 0; index < structureList.length; index++) {
const strucOne = structureList[index];
//单个泵站
let pumpOne = await app.fs.anxinyun.get(`structures/${strucOne.id}/factors?token=${data.token}`) || []
if (pumpOne.length) {
let pump = [] //能耗监测--水泵
let cabinetSun = [] //能耗监测--进线柜
let sun = {}
let day1 = 0
let day30 = 0
let day365 = 0
let daySun = 0
//泵站信息
let informationId = pumpOne.find(v => v.name == '泵站信息').id
if (informationId) {
let pumpInformation = await app.fs.anxinyun.get(`structures/${strucOne.id}/stations?token=${data.token}`, { query: { factorId: informationId } }) || []
if (pumpInformation.length > 0 && pumpInformation[0].groups.length && pumpInformation[0].groups[0].stations[0].id) {
//七天内该泵站最新的集水池液位
let waterLevel = await app.fs.anxinyun.get(`stations/theme/data?token=${data.token}`, {
query: {
stations: pumpInformation[0].groups[0].stations[0].id,
startTime: moment().startOf('week').format('YYYY-MM-DD HH:mm:ss'),
endTime: moment().endOf('week').format('YYYY-MM-DD HH:mm:ss'),
limit: 1
}
}) || {}
let findOne = waterLevel.stations[0].data[0] || {}
sun.sHumidity = findOne.sHumidity
sun.sTEMP = findOne.sTEMP
sun.sGrille_level = findOne.sGrille_level
waterLevelData.push({
strucId: strucOne.id, name: strucOne.name, level: findOne.sLiquid_level || 0
})
//该泵站最新6h的集水池液位
let waterLevel6 = await app.fs.anxinyun.get(`stations/theme/data?token=${data.token}`, {
query: {
stations: pumpInformation[0].groups[0].stations[0].id,
startTime: moment().add(-6, 'hours').format('YYYY-MM-DD HH:mm:ss'),
endTime: moment().format('YYYY-MM-DD HH:mm:ss'),
limit: 1440
}
}) || {}
waterLevelSix['struc' + strucOne.id] = waterLevel6.stations[0] && JSON.stringify(waterLevel6.stations[0].data)
}
}
//水泵信息
let waterId = pumpOne.find(v => v.name == '泵站水泵').id
if (waterId) {
let waterpPmpInformation = await app.fs.anxinyun.get(`structures/${strucOne.id}/stations?token=${data.token}`, { query: { factorId: waterId } }) || []
let dataId = []
waterpPmpInformation.forEach(v => {
v.groups.forEach(s => {
s.stations.forEach(f => {
dataId.push(f.id)
})
})
})
if (dataId.length) {
// 当前时间
let todayOne = await app.fs.anxinyun.get(`stations/theme/data?token=${data.token}`, {
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
}
}) || []
waterPumpStateAll.push({ strucId: strucOne.id, name: strucOne.name, data: todayOne.stations })
pump = todayOne.stations || []
todayOne.stations && todayOne.stations.forEach(d => {
daySun += d.data[0] && d.data[0].eMotor_EQ || 0
})
// 今天
let dayCollect = await app.fs.anxinyun.get(`stations/data/theme?token=${data.token}`, {
query: {
stations: dataId.join(),
begin: moment().startOf('day').format('x'),
end: moment().endOf('day').format('x'),
aggtype: "h",
method: 'diff'
}
}) || []
if (dayCollect.length) {
dayCollect[0].stations.forEach(f => {
f.data.forEach(h => {
if (!h.changData) {
day1 += h.values.eMotor_EQ
}
})
})
}
// 本月
let monthCollect = await app.fs.anxinyun.get(`stations/data/theme?token=${data.token}`, {
query: {
stations: dataId.join(),
begin: moment().startOf('month').format('x'),
end: moment().endOf('month').format('x'),
aggtype: "d",
method: 'diff'
}
}) || []
if (monthCollect.length) {
monthCollect[0].stations.forEach(f => {
f.data.forEach(h => {
if (!h.changData) {
day30 += h.values.eMotor_EQ
}
})
})
}
// 今年
let yearCollect = await app.fs.anxinyun.get(`stations/data/theme?token=${data.token}`, {
query: {
stations: dataId.join(),
begin: moment().startOf('year').format('x'),
end: moment().endOf('year').format('x'),
aggtype: "d",
method: 'diff'
}
}) || []
if (yearCollect.length) {
yearCollect[0].stations.map(f => {
f.data.forEach(h => {
if (!h.changData) {
day365 += h.values.eMotor_EQ
}
})
})
}
let current = await app.fs.anxinyun.get(`stations/theme/data?token=${data.token}`, {
query: {
stations: dataId.join(),
startTime: moment().add(-6, 'hours').format('YYYY-MM-DD HH:mm:ss'),
endTime: moment().format('YYYY-MM-DD HH:mm:ss'),
limit: 1440
}
}) || {}
currentSix['struc' + strucOne.id] = JSON.stringify(current.stations)
let threedata = []
let timeSet = new Set()
if (current.stations && current.stations.length) {
current.stations.map(p => {
p.data.map(s => {
timeSet.add(moment(s.time).format('YYYY-MM-DD HH:mm:ss'))
})
})
let time = [...timeSet].sort((a, b) => moment(a).isBefore(b) ? -1 : 1)
time.map(x => {
let A = []
let B = []
let C = []
current.stations.map((s, index) => {
let abcData = s.data.find(f => moment(f.time).format('YYYY-MM-DD HH:mm:ss') == x) || {}
let a = abcData.eMotor_A_A
let b = abcData.eMotor_B_A
let c = abcData.eMotor_C_A
if (a) A.push(a)
if (b) B.push(b)
if (c) C.push(c)
})
const sum = (arr) => {
let sum = 0
arr.map(h => {
sum += h
})
return sum
}
threedata.push({
A: A.length && (sum(A) / A.length) || null,
B: B.length && (sum(B) / B.length) || null,
C: C.length && (sum(C) / C.length) || null,
time: x
})
})
}
threePhase['struc' + strucOne.id] = JSON.stringify(threedata)
}
}
//进线柜
let wireCabinetId = pumpOne.find(v => v.name == '泵站进线柜').id
if (wireCabinetId) {
let dataList = await app.fs.anxinyun.get(`structures/${strucOne.id}/stations?token=${data.token}`, { query: { factorId: wireCabinetId } }) || []
let dataId = []
dataList.map(v => {
v.groups.map(s => {
s.stations.map(f => {
dataId.push(f.id)
})
})
})
if (dataId.length) {
// 当前时间
let todayOne = await app.fs.anxinyun.get(`stations/theme/data?token=${data.token}`, {
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
}
}) || {}
let cabinetOne = todayOne.stations && todayOne.stations || []
cabinet['struc' + strucOne.id] = JSON.stringify(cabinetOne)
cabinetOne.forEach(d => {
let todayFindOne = d.data[0] || {}
daySun += todayFindOne.eQF_EQ || 0
cabinetSun.push({
today: 0,
sameMonth: 0,
thisYear: 0,
eQF_EQ: todayFindOne.eQF_EQ || 0,
id: d.id,
name: d.name,
sQF_CLOSING: todayFindOne.sQF_CLOSING
})
})
// 今天
let dayCollect = await app.fs.anxinyun.get(`stations/data/theme?token=${data.token}`, {
query: {
stations: dataId.join(),
begin: moment().startOf('day').format('x'),
end: moment().endOf('day').format('x'),
aggtype: "h",
method: 'diff'
}
}) || []
cabinetSun.forEach(p => {
if (dayCollect.length) {
dayCollect[0].stations.forEach(f => {
if (p.id == f.id) {
f.data.forEach(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
}
})
}
})
}
})
// 本月
let monthCollect = await app.fs.anxinyun.get(`stations/data/theme?token=${data.token}`, {
query: {
stations: dataId.join(),
begin: moment().startOf('month').format('x'),
end: moment().endOf('month').format('x'),
aggtype: "d",
method: 'diff'
}
}) || []
cabinetSun.forEach(p => {
if (monthCollect.length) {
monthCollect[0].stations.forEach(f => {
if (p.id == f.id) {
f.data.forEach(h => {
if (!h.changData) {
p.sameMonth = p.sameMonth + h.values.eQF_EQ
day30 += h.values.eQF_EQ
}
})
}
})
}
})
// 今年
let yearCollect = await app.fs.anxinyun.get(`stations/data/theme?token=${data.token}`, {
query: {
stations: dataId.join(),
begin: moment().startOf('year').format('x'),
end: moment().endOf('year').format('x'),
aggtype: "d",
method: 'diff'
}
}) || []
cabinetSun.forEach(p => {
if (yearCollect.length) {
yearCollect[0].stations.forEach(f => {
if (p.id == f.id) {
f.data.forEach(h => {
if (!h.changData) {
p.thisYear = p.thisYear + h.values.eQF_EQ
day365 += h.values.eQF_EQ
}
})
}
})
}
})
}
}
sun.day1 = day1
sun.day30 = day30 + day1
sun.day365 = day365 + day1
sun.daySun = daySun
let capacityOne = { pump, cabinetSun, sun }
capacity['struc' + strucOne.id] = JSON.stringify(capacityOne)
}
}
await app.redis.set("waterLevelAll", JSON.stringify(waterLevelData))
await app.redis.hmset("waterLevelSix", waterLevelSix)
await app.redis.set("waterPumpStateAll", JSON.stringify(waterPumpStateAll))
await app.redis.hmset("capacity", capacity)
await app.redis.hmset("currentSix", currentSix)
await app.redis.hmset("cabinet", cabinet)
await app.redis.hmset("threePhase", threePhase)
}
} catch (error) {
console.error(error);
}
}
)
return {
workorderStatistics,
}
}
let axyTokenCache = {
token: null,
orgId: null,
expireTime: null //过期时间
}
const getAnxinyunToken = async function (app) {
try {
if (!axyTokenCache.token || moment() > moment(axyTokenCache.expireTime)) {
if (app.fs.opts.axyProject.split('/').length === 3) {
const dataToAxy = {
p: app.fs.opts.axyProject.split('/')[0],
username: app.fs.opts.axyProject.split('/')[1],
password: app.fs.opts.axyProject.split('/')[2],
}
const axyResponse = await app.fs.anxinyun.post('project/login', { data: dataToAxy })
if (axyResponse.authorized) {
axyTokenCache.token = axyResponse.token //放进缓存
axyTokenCache.orgId = axyResponse.orgId //放进缓存
axyTokenCache.expireTime = moment().add(20, 'hour').format('YYYY-MM-DD HH:mm:ss')
}
}
}
return axyTokenCache
} catch (error) {
app.fs.logger.error(`sechedule: laborAttendance, error: ${error}`);
}
}

16
api/config.js

@ -11,6 +11,10 @@ const dev = process.env.NODE_ENV == 'development';
args.option(['p', 'port'], '启动端口'); args.option(['p', 'port'], '启动端口');
args.option(['g', 'pg'], 'postgre 服务 URL'); args.option(['g', 'pg'], 'postgre 服务 URL');
args.option('redisHost', 'redisHost');
args.option('redisPort', 'redisPort');
args.option('redisPswd', 'redisPassword');
args.option('apiAnxinyunUrl', "安心云api"); args.option('apiAnxinyunUrl', "安心云api");
args.option('axyProject', '安心云泵站项目信息'); args.option('axyProject', '安心云泵站项目信息');
@ -20,9 +24,14 @@ const BENGZHAN_DB = process.env.BENGZHAN_DB || flags.pg;
const API_ANXINYUN_URL = process.env.API_ANXINYUN_URL || flags.apiAnxinyunUrl const API_ANXINYUN_URL = process.env.API_ANXINYUN_URL || flags.apiAnxinyunUrl
const AXY_BZ_PROJECT = process.env.AXY_BZ_PROJECT || flags.axyProject const AXY_BZ_PROJECT = process.env.AXY_BZ_PROJECT || flags.axyProject
// Redis 参数
const IOTA_REDIS_SERVER_HOST = process.env.IOTA_REDIS_SERVER_HOST || flags.redisHost || "localhost";//redis IP
const IOTA_REDIS_SERVER_PORT = process.env.IOTA_REDIS_SERVER_PORT || flags.redisPort || "6379";//redis 端口
const IOTA_REDIS_SERVER_PWD = process.env.IOTA_REDIS_SERVER_PWD || flags.redisPswd || "";//redis 密码
if (!BENGZHAN_DB || !API_ANXINYUN_URL || !AXY_BZ_PROJECT) { if (!BENGZHAN_DB || !API_ANXINYUN_URL || !AXY_BZ_PROJECT || !IOTA_REDIS_SERVER_HOST || !IOTA_REDIS_SERVER_PORT) {
console.log('缺少启动参数,异常退出'); console.log('缺少启动参数,异常退出');
args.showHelp(); args.showHelp();
process.exit(-1); process.exit(-1);
@ -46,6 +55,11 @@ const product = {
], // 不做认证的路由,也可以使用 exclude: ["*"] 跳过所有路由 ], // 不做认证的路由,也可以使用 exclude: ["*"] 跳过所有路由
// apiAnxinyunUrl: API_ANXINYUN_URL, // apiAnxinyunUrl: API_ANXINYUN_URL,
axyProject: AXY_BZ_PROJECT, axyProject: AXY_BZ_PROJECT,
redis: {
host: IOTA_REDIS_SERVER_HOST,
port: IOTA_REDIS_SERVER_PORT,
pwd: IOTA_REDIS_SERVER_PWD
},
pssaRequest: [{// name 会作为一个 request 出现在 ctx.app.fs pssaRequest: [{// name 会作为一个 request 出现在 ctx.app.fs
name: 'anxinyun', name: 'anxinyun',
root: API_ANXINYUN_URL root: API_ANXINYUN_URL

48
scripts/0.1/data/pump_information.sql

@ -1,25 +1,55 @@
--
INSERT INTO public.t_pump_information (id, structure_id, area, scale, water_type, elc_type, by_type, func, num, start_time, reinforce_time) VALUES (DEFAULT, INSERT INTO public.t_pump_information (id, structure_id, area, scale, water_type, elc_type, by_type, func, num, start_time, reinforce_time) VALUES (DEFAULT,
3569, '东新乡', 840,'1000ZLB—4轴流泵','JSL12—14','S91000KVA','排灌结合',4,'1974年','2009年'); 3569, '东新乡', 1050,'1000ZLB—4轴流泵','JSL12—14','S9800KVA2','纯排',5,'1985年','2009年');
--
INSERT INTO public.t_pump_information (id, structure_id, area, scale, water_type, elc_type, by_type, func, num, start_time, reinforce_time) VALUES (DEFAULT,
3592, '富山乡', 2010,'28、36','6台180、6台155','1250、1650','排涝',12,'1983年','2008年');
--
INSERT INTO public.t_pump_information (id, structure_id, area, scale, water_type, elc_type, by_type, func, num, start_time, reinforce_time) VALUES (DEFAULT,
3594, '东新乡', 60 ,'ZLB28—70轴流泵','Y—200T—4','80KVA箱式变压器','纯排',2,'2013年','--');
--
INSERT INTO public.t_pump_information (id, structure_id, area, scale, water_type, elc_type, by_type, func, num, start_time, reinforce_time) VALUES (DEFAULT,
3595, '东新乡',260,'20ZLB—70轴流泵','Y67—130kw','315KVA箱式变压器','纯排',2,'2014年','--');
--
INSERT INTO public.t_pump_information (id, structure_id, area, scale, water_type, elc_type, by_type, func, num, start_time, reinforce_time) VALUES (DEFAULT,
3593, '东新乡',240, 'ZLB28—70轴流泵','Y—200T—4','S9315KVA','排灌结合',3,'1974年','1992年');
--
INSERT INTO public.t_pump_information (id, structure_id, area, scale, water_type, elc_type, by_type, func, num, start_time, reinforce_time) VALUES (DEFAULT,
3598, '东新乡', 340,'ZLB28—70轴流泵','Y—200T—4','S9315KVA','排灌结合',3,'1974年','1988年');
--
INSERT INTO public.t_pump_information (id, structure_id, area, scale, water_type, elc_type, by_type, func, num, start_time, reinforce_time) VALUES (DEFAULT,
3597, '东新乡',260,'20ZLB—70轴流泵','Y67—130kw','S9_315KVA变压器','灌溉',2,'2014年','--');
--
INSERT INTO public.t_pump_information (id, structure_id, area, scale, water_type, elc_type, by_type, func, num, start_time, reinforce_time) VALUES (DEFAULT, INSERT INTO public.t_pump_information (id, structure_id, area, scale, water_type, elc_type, by_type, func, num, start_time, reinforce_time) VALUES (DEFAULT,
3592, '富山乡', 2010,'','6台180、6台155','1250、1650','排涝',12,'1983年','2008年'); 3599, '富山乡',390, '28','130','--','排涝',3,'1973年','2008年');
-- 象湖站
INSERT INTO public.t_pump_information (id, structure_id, area, scale, water_type, elc_type, by_type, func, num, start_time, reinforce_time) VALUES (DEFAULT, INSERT INTO public.t_pump_information (id, structure_id, area, scale, water_type, elc_type, by_type, func, num, start_time, reinforce_time) VALUES (DEFAULT,
3594, '东新乡', 60 ,'ZLB28—70轴流泵','Y—200T—4','80KVA箱式变压器','纯排',2,'2013年',''); 3652, '象湖站',1050, '1200ZLB—160轴流泵','JsL10—12(210KW)','s9—M500KVA、s9—M800KVA','',5,'2008','--');
-- 沥山电排站
INSERT INTO public.t_pump_information (id, structure_id, area, scale, water_type, elc_type, by_type, func, num, start_time, reinforce_time) VALUES (DEFAULT, INSERT INTO public.t_pump_information (id, structure_id, area, scale, water_type, elc_type, by_type, func, num, start_time, reinforce_time) VALUES (DEFAULT,
3595, '东新乡',260,'20ZLB—70轴流泵','Y67—130kw','315KVA箱式变压器','纯排',2,'2014年',''); 3642, '象湖站',1680, '1200ZLB—160轴流泵','JsL10—12(210KW)','s9—M1000KVA/2','',8,'2004年','--');
-- 张坊电排站
INSERT INTO public.t_pump_information (id, structure_id, area, scale, water_type, elc_type, by_type, func, num, start_time, reinforce_time) VALUES (DEFAULT, INSERT INTO public.t_pump_information (id, structure_id, area, scale, water_type, elc_type, by_type, func, num, start_time, reinforce_time) VALUES (DEFAULT,
3593, '东新乡',240, 'ZLB28—70轴流泵','Y—200T—4','S9315KVA','排灌结合',3,'1974年','1992年'); 3590, '象湖站',2500, '1400ZLB-5立式半调节轴流泵','YL630-16/1430(500KW)','SCB11-160/10/0.4','',5,'2020','--');
-- 河下电排站
INSERT INTO public.t_pump_information (id, structure_id, area, scale, water_type, elc_type, by_type, func, num, start_time, reinforce_time) VALUES (DEFAULT, INSERT INTO public.t_pump_information (id, structure_id, area, scale, water_type, elc_type, by_type, func, num, start_time, reinforce_time) VALUES (DEFAULT,
3598, '东新乡', 340,'ZLB28—70轴流泵','Y—200T—4','S9315KVA','排灌结合',3,'1974年','1988年'); 3596, '东新乡',320, 'ZLB28—70轴流泵','Y—200T—4','S9315KVA','排灌结合',4,'1972','1987');
-- 万寿湖电排站
INSERT INTO public.t_pump_information (id, structure_id, area, scale, water_type, elc_type, by_type, func, num, start_time, reinforce_time) VALUES (DEFAULT, INSERT INTO public.t_pump_information (id, structure_id, area, scale, water_type, elc_type, by_type, func, num, start_time, reinforce_time) VALUES (DEFAULT,
3597, '东新乡',260,'20ZLB—70轴流泵','Y67—130kw','S9_315KVA变压器','灌溉',2,'2014年',''); 3600, '象湖站',660, '1000ZLB-5立式半调节轴流泵','JsL14—12(220KW)','SCB11-1000/10/0.4、SCB11-80/10/0.4','排涝',3,'2020','--');
-- 河外电排站
INSERT INTO public.t_pump_information (id, structure_id, area, scale, water_type, elc_type, by_type, func, num, start_time, reinforce_time) VALUES (DEFAULT, INSERT INTO public.t_pump_information (id, structure_id, area, scale, water_type, elc_type, by_type, func, num, start_time, reinforce_time) VALUES (DEFAULT,
3599, '富山乡',390, '','','','排涝',3,'1973','2008'); 3601, '富山乡',90, '--','45','--','排涝',2,'1984','2021');
-- 雄溪泵站
INSERT INTO public.t_pump_information (id, structure_id, area, scale, water_type, elc_type, by_type, func, num, start_time, reinforce_time) VALUES (DEFAULT,
3653, '象湖站',630, '1200ZLB—160轴流泵','JsL10—12(210KW)','s9—M315KVA、s9—M500KVA','排涝',3,'2003年','--');

18
scripts/0.2/schema/1.video.sql

@ -0,0 +1,18 @@
create table video
(
id serial not null,
video_url varchar(255) not null,
struc_id int
);
comment on column video.video_url is '泵站摄像头嵌入链接';
comment on column video.struc_id is '泵站id,不填就是全部';
create unique index video_id_uindex
on video (id);
alter table video
add constraint video_pk
primary key (id);

BIN
web/client/assets/images/monitor/pillar.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 785 KiB

After

Width:  |  Height:  |  Size: 805 KiB

88
web/client/src/sections/bigScreen/actions/bigScreen.js

@ -25,6 +25,90 @@ export function pumpInformation (query = {}) {
}); });
} }
export default {
axyData export function getWaterLevelAll (query = {}) {
return dispatch => basicAction({
type: 'get',
dispatch: dispatch,
actionType: 'GET_WATER_LEVEL_ALL',
url: 'water/level/all',
query: query,
msg: { error: '获取所有泵站七天内最新集水池液位失败' },
reducer: { name: 'waterLevelAll' }
});
}
export function getWaterLevelSix (query = {}) {
return dispatch => basicAction({
type: 'get',
dispatch: dispatch,
actionType: 'GET_WATER_LEVEL_SIX',
url: 'water/level/six',
query: query,
msg: { error: '获取泵站6h最新集水池液位失败' },
reducer: { name: 'waterLevelSix' }
});
}
export function getWaterPumpStateAll (query = {}) {
return dispatch => basicAction({
type: 'get',
dispatch: dispatch,
actionType: 'GET_WATER_PUMP_STATE_ALL',
url: 'water/pump/state/all',
query: query,
msg: { error: '获取水泵状态失败' },
reducer: { name: 'waterPumpStateAll' }
});
}
export function getCapacity (query = {}) {
return dispatch => basicAction({
type: 'get',
dispatch: dispatch,
actionType: 'GET_CAPACITY',
url: 'capacity',
query: query,
msg: { error: '获取能耗监测数据失败' },
reducer: { name: 'capacity' }
});
}
export function getCurrentSix (query = {}) {
return dispatch => basicAction({
type: 'get',
dispatch: dispatch,
actionType: 'GET_CURENT_SIX',
url: 'currentSix',
query: query,
msg: { error: '获取水泵数据失败' },
reducer: { name: 'currentSix' }
});
}
export function getCabinet (query = {}) {
return dispatch => basicAction({
type: 'get',
dispatch: dispatch,
actionType: 'GET_CABINET',
url: 'cabinet',
query: query,
msg: { error: '获取进线柜数据失败' },
reducer: { name: 'cabinet' }
});
} }
export function getThreePhase (query = {}) {
return dispatch => basicAction({
type: 'get',
dispatch: dispatch,
actionType: 'GET_THREEPHASE',
url: 'threePhase',
query: query,
msg: { error: '获取三相电流数据失败' },
reducer: { name: 'threePhase' }
});
}

21
web/client/src/sections/bigScreen/actions/index.js

@ -1,8 +1,27 @@
'use strict'; 'use strict';
import { basicAction } from '@peace/utils'
import { ApiTable } from '$utils'
import * as bigScreen from './bigScreen' import * as bigScreen from './bigScreen'
import * as video from './video'
export function getPumpStation (query = {}) {
return dispatch => basicAction({
type: 'get',
dispatch: dispatch,
actionType: 'GET_PUMP_STATION',
url: '/pump/station',
query,
msg: { error: '获取所有站点信息失败' }
});
}
export default { export default {
...bigScreen ...bigScreen,
...video,
getPumpStation,
} }

21
web/client/src/sections/bigScreen/actions/video.js

@ -0,0 +1,21 @@
'use strict';
import { basicAction } from '@peace/utils'
import { ApiTable } from '$utils'
export function getVideoUrl (query = {}) {
return dispatch => basicAction({
type: 'get',
dispatch: dispatch,
actionType: 'GET_VIDEO_URL',
url: `${ApiTable.videoUrl}`,
query,
msg: { error: '获取泵站视频监控失败' },
reducer: { name: 'videoUrl' }
});
}
export default {
getVideoUrl,
}

146
web/client/src/sections/bigScreen/components/basis.js

@ -11,23 +11,14 @@ import Right_2 from './basis/right_2';
import { POWER_STATIONS } from './shuizhan_detail'; import { POWER_STATIONS } from './shuizhan_detail';
import './basis.less' import './basis.less'
const Basis = ({ actions, dispatch, setshowData, siteList, siteData }) => { const Basis = ({ actions, dispatch, setshowData, siteList, siteData, waterLevelSix, waterPumpStateAll }) => {
const { bigScreen } = actions const { bigScreen } = actions
// const [siteList, setSiteList] = useState([]) //站点列表
const [strucId, setStrucId] = useState() //站点ID const [strucId, setStrucId] = useState() //站点ID
const [pageRefresh1, setPageRefresh1] = useState(false)
const [pageRefresh2, setPageRefresh2] = useState(0)
const [pageRefresh3, setPageRefresh3] = useState(0)
const [depthWater, setDepthWater] = useState([])
const [information, setInformation] = useState({}) const [information, setInformation] = useState({})
const [pumpInformation, setPumpInformation] = useState([]) const [pumpInformation, setPumpInformation] = useState([])
const [pumpNumber, setPumpNumber] = useState(0)
const left1Data = useRef([])
const left2Data = useRef([])
const pumpNumber = useRef(0)
useEffect(() => { useEffect(() => {
dispatch(bigScreen.pumpInformation({})).then(res => { dispatch(bigScreen.pumpInformation({})).then(res => {
@ -35,6 +26,7 @@ const Basis = ({ actions, dispatch, setshowData, siteList, siteData }) => {
setPumpInformation(res.payload.data || []) setPumpInformation(res.payload.data || [])
} }
}) })
}, []) }, [])
useEffect(() => { useEffect(() => {
if (pumpInformation?.length && strucId) { if (pumpInformation?.length && strucId) {
@ -42,82 +34,20 @@ const Basis = ({ actions, dispatch, setshowData, siteList, siteData }) => {
} }
}, [pumpInformation, strucId]) }, [pumpInformation, strucId])
useEffect(() => {
useEffect(async () => { if (waterPumpStateAll?.length) {
let num = 0
if (siteData) { waterPumpStateAll?.forEach(v => {
//获取所有泵站的集水池液位 num += v.data.length || 0
siteData?.map(async v => {
await dispatch(bigScreen.axyData({ type: 'get', url: `structures/${v.id}/factors` })).then(async r => {
//泵站信息
let informationId = r.payload.data?.find(v => v.name == '泵站信息')?.id
if (informationId) {
await dispatch(bigScreen.axyData({
type: 'get', url: `structures/${v.id}/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(async d => {
if (d.success) {
left1Data.current?.push({ name: v.name, level: d.payload.data?.stations[0]?.data[0]?.sLiquid_level || 0 })
setPageRefresh1(moment().format('x'))
}
})
}
}) })
setPumpNumber(num)
} }
}, [waterPumpStateAll])
//水泵信息 useEffect(async () => {
let waterId = r.payload.data?.find(v => v.name == '泵站水泵')?.id if (siteData) {
if (waterId) { //水泵状态
await dispatch(bigScreen.axyData({ dispatch(bigScreen.getWaterPumpStateAll({ key: 'waterPumpStateAll', methodType: 'get', }))
type: 'get', url: `structures/${v.id}/stations`,
params: { query: { factorId: waterId } }
})).then(async p => {
if (p.success) {
pumpNumber.current += p.payload.data[0]?.groups[0]?.stations.length || 0
setPageRefresh3(!pageRefresh3)
let dataId = []
p.payload.data?.map(v => {
v.groups?.map(s => {
s.stations?.map(f => {
dataId.push(f.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) {
left2Data.current?.push({ name: v.name, data: d.payload.data?.stations })
setPageRefresh2(moment().format('x'))
}
})
}
}
})
}
})
})
} }
}, [siteData]) }, [siteData])
@ -136,41 +66,16 @@ const Basis = ({ actions, dispatch, setshowData, siteList, siteData }) => {
setStrucId(nextStructId); setStrucId(nextStructId);
}, [siteList]) }, [siteList])
useEffect(async () => { useEffect(() => {
if (strucId) { if (strucId) {
await dispatch(bigScreen.axyData({ type: 'get', url: `structures/${strucId}/factors` })).then(async r => { //泵站水位数据
//泵站信息 dispatch(bigScreen.getWaterLevelSix({ key: 'waterLevelSix', methodType: 'hget', field: 'struc' + strucId }))
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(-6, 'hours').format('YYYY-MM-DD HH:mm:ss'),
endTime: moment().format('YYYY-MM-DD HH:mm:ss'),
limit: 1440
}
}
})).then(async d => {
if (d.success) {
setDepthWater(d.payload.data?.stations[0]?.data)
}
})
}
})
}
})
} }
}, [strucId]) }, [strucId])
return <div className='super-screen-body'> return <div className='super-screen-body'>
<div className='super-screen-card left'> <div className='super-screen-card left'>
<Left_1 data={left1Data.current} /> <Left_1 />
<div className='card-item' style={{ height: '55%', minWidth: 350 }}> <div className='card-item' style={{ height: '55%', minWidth: 350 }}>
<CardTitle title='水泵状态' /> <CardTitle title='水泵状态' />
<div className='card-content'> <div className='card-content'>
@ -179,7 +84,7 @@ const Basis = ({ actions, dispatch, setshowData, siteList, siteData }) => {
backgroundImage: 'url(/assets/images/monitor/end.png)', backgroundSize: '100% 100%', backgroundPosition: 'center', backgroundRepeat: 'no-repeat', backgroundImage: 'url(/assets/images/monitor/end.png)', backgroundSize: '100% 100%', backgroundPosition: 'center', backgroundRepeat: 'no-repeat',
display: 'flex', alignItems: 'flex-end', lineHeight: "40px" display: 'flex', alignItems: 'flex-end', lineHeight: "40px"
}}> }}>
<div style={{ width: 80, fontFamily: "SourceHanSansCN-Normal", fontStyle: 'italic', textAlign: "center" }}></div> <div style={{ width: 80, fontFamily: "SourceHanSansCN-Normal", fontStyle: 'italic', textAlign: "center" }}></div>
<div style={{ fontFamily: "SourceHanSansCN-Normal", fontStyle: 'italic', width: "calc(100% - 80px)", textAlign: "center" }}>编号</div> <div style={{ fontFamily: "SourceHanSansCN-Normal", fontStyle: 'italic', width: "calc(100% - 80px)", textAlign: "center" }}>编号</div>
</div> </div>
<SimpleBar <SimpleBar
@ -190,7 +95,7 @@ const Basis = ({ actions, dispatch, setshowData, siteList, siteData }) => {
// 允许的滚动方向 // 允许的滚动方向
forceVisible="y" forceVisible="y"
> >
{left2Data.current.map(v => <div style={{ {waterPumpStateAll?.map(v => <div style={{
display: 'flex', alignItems: 'center', marginTop: 6, width: '100%', height: 36, display: 'flex', alignItems: 'center', marginTop: 6, width: '100%', height: 36,
backgroundImage: 'url(/assets/images/monitor/san-b.png)', backgroundSize: '100% 100%', backgroundPosition: '0 0', backgroundRepeat: 'no-repeat', backgroundImage: 'url(/assets/images/monitor/san-b.png)', backgroundSize: '100% 100%', backgroundPosition: '0 0', backgroundRepeat: 'no-repeat',
}}> }}>
@ -210,7 +115,7 @@ const Basis = ({ actions, dispatch, setshowData, siteList, siteData }) => {
</div > </div >
<div className='super-screen-card right'> <div className='super-screen-card right'>
<Right_1 pumpInformation={pumpInformation} setPumpInformation={setPumpInformation} data={information} siteList={siteList} strucId={strucId} setStrucId={setStrucId} setInformation={setInformation} POWER_STATIONS={POWER_STATIONS} /> <Right_1 pumpInformation={pumpInformation} setPumpInformation={setPumpInformation} data={information} siteList={siteList} strucId={strucId} setStrucId={setStrucId} setInformation={setInformation} POWER_STATIONS={POWER_STATIONS} />
<Right_2 depthWater={depthWater} /> <Right_2 depthWater={waterLevelSix} />
</div> </div>
<div style={{ width: '40%', height: 30, display: 'flex', justifyContent: 'space-around', position: 'absolute', left: 'calc(30%)', bottom: 30, zIndex: 7 }}> <div style={{ width: '40%', height: 30, display: 'flex', justifyContent: 'space-around', position: 'absolute', left: 'calc(30%)', bottom: 30, zIndex: 7 }}>
<div style={{ <div style={{
@ -227,18 +132,21 @@ const Basis = ({ actions, dispatch, setshowData, siteList, siteData }) => {
backgroundSize: '100% 100%', backgroundPosition: 'center', backgroundRepeat: 'no-repeat', backgroundSize: '100% 100%', backgroundPosition: 'center', backgroundRepeat: 'no-repeat',
}}> }}>
<img style={{ width: 40, height: 40, position: 'absolute', left: 12, top: -18, }} src='/assets/images/monitor/pumpPP.png' /> <img style={{ width: 40, height: 40, position: 'absolute', left: 12, top: -18, }} src='/assets/images/monitor/pumpPP.png' />
提升泵数量{pumpNumber.current} 提升泵数量{pumpNumber || 0}
</div> </div>
</div> </div>
</div > </div >
} }
function mapStateToProps (state) { function mapStateToProps (state) {
const { auth, global } = state; const { auth, global, waterLevelSix, waterPumpStateAll } = state;
return { return {
user: auth.user, user: auth.user,
clientHeight: global.clientHeight, clientHeight: global.clientHeight,
actions: global.actions, actions: global.actions,
waterLevelSix: waterLevelSix?.data || [],
waterPumpStateAll: waterPumpStateAll?.data || [],
}; };
} }

27
web/client/src/sections/bigScreen/components/basis/left_1.js

@ -1,17 +1,24 @@
import React from 'react'; import React, { useEffect, useState } from 'react';
import { connect } from 'react-redux';
import CardTitle from '../public/cardTitle'; import CardTitle from '../public/cardTitle';
import '../basis.less'; import '../basis.less';
import './left_1.less'; import './left_1.less';
export default function Left_1 (props) { const Left_1 = ({ dispatch, actions, waterLevelAll }) => {
const { data } = props;
const { bigScreen } = actions
useEffect(() => {
dispatch(bigScreen.getWaterLevelAll({ key: 'waterLevelAll', methodType: 'get' }))
}, [])
return ( return (
<div className='card-item' style={{ height: '40%', minWidth: 359 }}> <div className='card-item' style={{ height: '40%', minWidth: 359 }}>
<CardTitle title='集水池液位' /> <CardTitle title='集水池液位' />
<div className='card-content liquid-level-content'> <div className='card-content liquid-level-content'>
{data?.map(d => <div style={{ width: 166, height: 86, display: 'inline-block' }}> {waterLevelAll?.map(d => <div style={{ width: 166, height: 86, display: 'inline-block' }}>
<div className='liquid-level'> <div className='liquid-level'>
<img className='img' src='/assets/images/monitor/liquid-level.png' /> <img className='img' src='/assets/images/monitor/liquid-level.png' />
<div className='info'> <div className='info'>
@ -25,3 +32,15 @@ export default function Left_1 (props) {
</div> </div>
) )
} }
function mapStateToProps (state) {
const { auth, global, waterLevelAll } = state;
return {
user: auth.user,
clientHeight: global.clientHeight,
actions: global.actions,
waterLevelAll: waterLevelAll?.data || []
};
}
export default connect(mapStateToProps)(Left_1);

423
web/client/src/sections/bigScreen/components/capacity.js

@ -5,19 +5,14 @@ import moment from 'moment'
import ReactECharts from 'echarts-for-react'; import ReactECharts from 'echarts-for-react';
import './index.less' import './index.less'
const Capacity = ({ actions, dispatch, siteList, }) => { const Capacity = ({ actions, dispatch, siteList, capacity, waterLevelSix, currentSix }) => {
const { bigScreen } = actions const { bigScreen } = actions
const [pageLeft, setPageLeft] = useState(0) //左边翻页 const [pageLeft, setPageLeft] = useState(0) //左边翻页
const [pageRight, setPageRight] = useState(0) //左边翻页 const [pageRight, setPageRight] = useState(0) //左边翻页
// const [siteList, setSiteList] = useState([]) //站点列表
const [pumpList, setPumpList] = useState([]) //水泵列表 const [pumpList, setPumpList] = useState([]) //水泵列表
const [strucId, setStrucId] = useState() //站点ID const [strucId, setStrucId] = useState() //站点ID
const [pumpId, setPumpId] = useState([]) //水泵id const [pumpId, setPumpId] = useState([]) //水泵id
const [usePumpId, setUsePumpId] = useState([]) //水泵id const [usePumpId, setUsePumpId] = useState([]) //水泵id
const [pumpData, setPumpData] = useState([]) //水泵数据
const [cabinetData, setCabinetData] = useState([]) //进线柜数据
const [centreData, setCentreData] = useState({}) //中间数据
const [depthWater, setDepthWater] = useState([]) //液位趋势
const [electricityTrend, setElectricityTrend] = useState([]) //电流趋势 const [electricityTrend, setElectricityTrend] = useState([]) //电流趋势
const [useTrend, setUseTrend] = useState([]) //用电趋势 const [useTrend, setUseTrend] = useState([]) //用电趋势
@ -38,372 +33,25 @@ const Capacity = ({ actions, dispatch, siteList, }) => {
setStrucId(nextStructId); setStrucId(nextStructId);
}, [siteList]) }, [siteList])
useEffect(async () => {
let pump = []
let cabinetSun = []
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) {
//水泵信息
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(voltageId)
setUsePumpId(voltageId)
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) {
pump = d.payload.data?.stations || []
d.payload.data?.stations?.map(f => {
daySun += f?.data[0]?.eMotor_EQ
})
}
})
// 今天
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(f => {
f.data?.map(h => {
if (!h.changData) {
day1 += h.values.eMotor_EQ
}
})
})
}
})
// 本月
await dispatch(bigScreen.axyData({
type: 'get', url: `stations/data/theme`, params: {
query: {
stations: dataId.join(),
begin: moment().startOf('month').format('x'),
end: moment().endOf('month').format('x'),
aggtype: "d",
method: 'diff'
}
}
})).then(d => {
if (d.success) {
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/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(f => {
f.data?.map(h => {
if (!h.changData) {
day365 += h.values.eMotor_EQ
}
})
})
}
})
}
useEffect(() => {
if (strucId) {
dispatch(bigScreen.getCapacity({ key: 'capacity', methodType: 'hget', field: 'struc' + strucId }))
dispatch(bigScreen.getWaterLevelSix({ key: 'waterLevelSix', methodType: 'hget', field: 'struc' + strucId }))
dispatch(bigScreen.getCurrentSix({ key: 'currentSix', methodType: 'hget', field: 'struc' + strucId }))
} }
})
}
//进线柜
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(f.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) {
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/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) {
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/data/theme`, params: {
query: {
stations: dataId.join(),
begin: moment().startOf('month').format('x'),
end: moment().endOf('month').format('x'),
aggtype: "d",
method: 'diff'
}
}
})).then(d => {
if (d.success) {
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/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) {
// 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
}
})
}
})
})
}
})
}
}
})
}
//泵站信息
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) {
sun.sHumidity = d.payload.data?.stations[0]?.data[0]?.sHumidity
sun.sTEMP = d.payload.data?.stations[0]?.data[0]?.sTEMP
sun.sGrille_level = d.payload.data?.stations[0]?.data[0]?.sGrille_level
}
})
// 液位趋势
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(-6, '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)
}
})
}
})
}
}
})
}
setPumpData(pump)
setCabinetData(cabinetSun)
//计算各个阶段的总点电量
sun.day1 = day1
sun.day30 = day30 + day1
sun.day365 = day365 + day1
sun.daySun = daySun
setPageLeft(0)
setPageRight(0)
setCentreData(sun)
}, [strucId]) }, [strucId])
useEffect(async () => { useEffect(() => {
if (pumpId?.length > 0) { if (currentSix?.length) {
//电流趋势 setPumpId(currentSix?.slice(0, 3)?.map(v => v.id))
await dispatch(bigScreen.axyData({ setUsePumpId(currentSix?.slice(0, 3)?.map(v => v.id))
type: 'get', url: `stations/theme/data`, params: { setPumpList(currentSix?.map(v => ({ value: v.id, label: v.name })))
query: { setElectricityTrend(currentSix?.slice(0, 3) || [])
stations: pumpId?.join(), setUseTrend(currentSix?.slice(0, 3) || [])
startTime: moment().add(-6, 'hours').format('YYYY-MM-DD HH:mm:ss'),
endTime: moment().format('YYYY-MM-DD HH:mm:ss'),
limit: 1440
}
}
})).then(d => {
if (d.success) {
setElectricityTrend(d.payload.data?.stations)
}
})
}
}, [pumpId])
useEffect(async () => {
if (usePumpId?.length > 0) {
//电流趋势
await dispatch(bigScreen.axyData({
type: 'get', url: `stations/theme/data`, params: {
query: {
stations: usePumpId?.join(),
startTime: moment().add(-6, 'hours').format('YYYY-MM-DD HH:mm:ss'),
endTime: moment().format('YYYY-MM-DD HH:mm:ss'),
limit: 1440
}
}
})).then(d => {
if (d.success) {
setUseTrend(d.payload.data?.stations)
}
})
} }
}, [usePumpId]) }, [currentSix])
@ -415,14 +63,14 @@ const Capacity = ({ actions, dispatch, siteList, }) => {
width: '30%', height: '100%', display: 'flex', justifyContent: 'center', width: '30%', height: '100%', display: 'flex', justifyContent: 'center',
}}> }}>
<div style={{ width: '80%', height: '100%', display: 'flex', alignItems: 'center', justifyContent: 'center', }}> <div style={{ width: '80%', height: '100%', display: 'flex', alignItems: 'center', justifyContent: 'center', }}>
{pumpData.length > 0 && <> {capacity?.pump?.length > 0 && <>
<img style={{ width: 36, height: 36 }} src="/assets/images/monitor/left.png" <img style={{ width: 36, height: 36 }} src="/assets/images/monitor/left.png"
onClick={() => { onClick={() => {
if (pageLeft > 0) setPageLeft(pageLeft - 1) if (pageLeft > 0) setPageLeft(pageLeft - 1)
}} /> }} />
<div style={{ display: 'flex', flexDirection: 'column', justifyContent: 'center' }}> <div style={{ display: 'flex', flexDirection: 'column', justifyContent: 'center' }}>
{ {
pumpData?.slice(pageLeft * 2, (pageLeft + 1) * 2)?.map((v, index) => { capacity?.pump?.slice(pageLeft * 2, (pageLeft + 1) * 2)?.map((v, index) => {
return <div key={'waterPump' + index} style={{ width: 250, height: 200 }}> return <div key={'waterPump' + index} style={{ width: 250, height: 200 }}>
<div style={{ <div style={{
width: '100%', height: 38, width: '100%', height: 38,
@ -524,7 +172,7 @@ const Capacity = ({ actions, dispatch, siteList, }) => {
</div> </div>
<img style={{ width: 36, height: 36 }} src="/assets/images/monitor/right.png" <img style={{ width: 36, height: 36 }} src="/assets/images/monitor/right.png"
onClick={() => { onClick={() => {
if (pageLeft + 1 < Math.ceil(pumpData.length / 2)) setPageLeft(pageLeft + 1) if (pageLeft + 1 < Math.ceil(capacity?.pump?.length / 2)) setPageLeft(pageLeft + 1)
}} /> }} />
</>} </>}
@ -549,11 +197,11 @@ const Capacity = ({ actions, dispatch, siteList, }) => {
}}> }}>
<div style={{ fontSize: 20, color: '#E2F8FF', fontWeight: 600 }}> <div style={{ fontSize: 20, color: '#E2F8FF', fontWeight: 600 }}>
湿度</div> 湿度</div>
<span style={{ fontFamily: "D-DIN-Italic" }}>{centreData?.sHumidity}</span> % <span style={{ fontFamily: "D-DIN-Italic" }}>{capacity?.sun?.sHumidity}</span> %
</div> </div>
<div style={{ color: '#00FFF8', fontSize: 20, position: 'absolute', top: '15%', left: "calc(50% - 90px)", display: 'inline-block' }}> <div style={{ color: '#00FFF8', fontSize: 20, position: 'absolute', top: '15%', left: "calc(50% - 90px)", display: 'inline-block' }}>
<span style={{ fontSize: 20, color: '#E2F8FF', fontWeight: 600, }}> <span style={{ fontSize: 20, color: '#E2F8FF', fontWeight: 600, }}>
总用量</span><span title={centreData?.daySun?.toFixed(2)} style={{ width: 50, fontFamily: "D-DIN-Italic", lineHeight: "16px", display: "inline-block", overflow: 'hidden', whiteSpace: 'nowrap', textOverflow: 'ellipsis', }}>{centreData?.daySun?.toFixed(2)}</span> kWh 总用量</span><span title={capacity?.sun?.daySun?.toFixed(2)} style={{ width: 50, fontFamily: "D-DIN-Italic", lineHeight: "16px", display: "inline-block", overflow: 'hidden', whiteSpace: 'nowrap', textOverflow: 'ellipsis', }}>{capacity?.sun?.daySun?.toFixed(2)}</span> kWh
</div> </div>
<div style={{ <div style={{
backgroundImage: 'url(/assets/images/monitor/pedestal.png)', backgroundImage: 'url(/assets/images/monitor/pedestal.png)',
@ -563,7 +211,7 @@ const Capacity = ({ actions, dispatch, siteList, }) => {
}}> }}>
<div style={{ fontSize: 20, color: '#E2F8FF', fontWeight: 600 }}> <div style={{ fontSize: 20, color: '#E2F8FF', fontWeight: 600 }}>
温度</div> 温度</div>
<sapn style={{ fontFamily: "D-DIN-Italic" }}>{centreData?.sTEMP}</sapn> <sapn style={{ fontFamily: "D-DIN-Italic" }}>{capacity?.sun?.sTEMP}</sapn>
</div> </div>
<div style={{ <div style={{
@ -574,7 +222,7 @@ const Capacity = ({ actions, dispatch, siteList, }) => {
}}> }}>
<div style={{ fontSize: 18, color: '#E2F8FF', fontWeight: 600 }}> <div style={{ fontSize: 18, color: '#E2F8FF', fontWeight: 600 }}>
今年用电</div> 今年用电</div>
<span title={centreData?.day365?.toFixed(2)} style={{ width: 90, fontFamily: "D-DIN-Italic", lineHeight: '16px', textAlign: "center", display: "inline-block", overflow: 'hidden', whiteSpace: 'nowrap', textOverflow: 'ellipsis', }}>{centreData?.day365?.toFixed(2) || '--'}</span> kWh <span title={capacity?.sun?.day365?.toFixed(2)} style={{ width: 90, fontFamily: "D-DIN-Italic", lineHeight: '16px', textAlign: "center", display: "inline-block", overflow: 'hidden', whiteSpace: 'nowrap', textOverflow: 'ellipsis', }}>{capacity?.sun?.day365?.toFixed(2) || '--'}</span> kWh
</div> </div>
<div style={{ <div style={{
backgroundImage: 'url(/assets/images/monitor/oblique.png)', backgroundImage: 'url(/assets/images/monitor/oblique.png)',
@ -584,7 +232,7 @@ const Capacity = ({ actions, dispatch, siteList, }) => {
}}> }}>
<div style={{ fontSize: 18, color: '#E2F8FF', fontWeight: 600 }}> <div style={{ fontSize: 18, color: '#E2F8FF', fontWeight: 600 }}>
当月用电</div> 当月用电</div>
<span title={centreData?.day30?.toFixed(2)} style={{ width: 90, fontFamily: "D-DIN-Italic", lineHeight: '16px', textAlign: "center", display: "inline-block", overflow: 'hidden', whiteSpace: 'nowrap', textOverflow: 'ellipsis', }}>{centreData?.day30?.toFixed(2) || '--'}</span> kWh <span title={capacity?.sun?.day30?.toFixed(2)} style={{ width: 90, fontFamily: "D-DIN-Italic", lineHeight: '16px', textAlign: "center", display: "inline-block", overflow: 'hidden', whiteSpace: 'nowrap', textOverflow: 'ellipsis', }}>{capacity?.sun?.day30?.toFixed(2) || '--'}</span> kWh
</div> </div>
<div style={{ <div style={{
backgroundImage: 'url(/assets/images/monitor/oblique.png)', backgroundImage: 'url(/assets/images/monitor/oblique.png)',
@ -594,7 +242,7 @@ const Capacity = ({ actions, dispatch, siteList, }) => {
}}> }}>
<div style={{ fontSize: 18, color: '#E2F8FF', fontWeight: 600 }}> <div style={{ fontSize: 18, color: '#E2F8FF', fontWeight: 600 }}>
当日用电</div> 当日用电</div>
<span title={centreData?.day1?.toFixed(2)} style={{ width: 90, fontFamily: "D-DIN-Italic", lineHeight: '16px', textAlign: "center", display: "inline-block", overflow: 'hidden', whiteSpace: 'nowrap', textOverflow: 'ellipsis', }}>{centreData?.day1?.toFixed(2) || '--'}</span> kWh <span title={capacity?.sun?.day1?.toFixed(2)} style={{ width: 90, fontFamily: "D-DIN-Italic", lineHeight: '16px', textAlign: "center", display: "inline-block", overflow: 'hidden', whiteSpace: 'nowrap', textOverflow: 'ellipsis', }}>{capacity?.sun?.day1?.toFixed(2) || '--'}</span> kWh
</div> </div>
<div style={{ <div style={{
@ -661,7 +309,7 @@ const Capacity = ({ actions, dispatch, siteList, }) => {
}, },
data: [ data: [
{ {
value: centreData?.sGrille_level?.toFixed(2) || 0, value: capacity?.sun?.sGrille_level?.toFixed(2) || 0,
} }
] ]
} }
@ -703,14 +351,14 @@ const Capacity = ({ actions, dispatch, siteList, }) => {
{/* 进线柜 */} {/* 进线柜 */}
<div style={{ width: '30%', height: '100%', display: 'flex', justifyContent: 'center', }}> <div style={{ width: '30%', height: '100%', display: 'flex', justifyContent: 'center', }}>
<div style={{ width: '80%', height: '100%', display: 'flex', alignItems: 'center', justifyContent: 'center', }}> <div style={{ width: '80%', height: '100%', display: 'flex', alignItems: 'center', justifyContent: 'center', }}>
{cabinetData.length > 0 && <> {capacity?.cabinetSun?.length > 0 && <>
<img style={{ width: 36, height: 36 }} src="/assets/images/monitor/left.png" <img style={{ width: 36, height: 36 }} src="/assets/images/monitor/left.png"
onClick={() => { onClick={() => {
if (pageRight > 0) setPageRight(pageRight - 1) if (pageRight > 0) setPageRight(pageRight - 1)
}} /> }} />
<div style={{ display: 'flex', flexDirection: 'column', justifyContent: 'center' }}> <div style={{ display: 'flex', flexDirection: 'column', justifyContent: 'center' }}>
{ {
cabinetData?.slice(pageRight * 2, (pageRight + 1) * 2)?.map((v, index) => { capacity?.cabinetSun?.slice(pageRight * 2, (pageRight + 1) * 2)?.map((v, index) => {
return <div key={'waterPump' + index} style={{ width: 250, height: 200 }}> return <div key={'waterPump' + index} style={{ width: 250, height: 200 }}>
<div style={{ <div style={{
width: '100%', height: 38, width: '100%', height: 38,
@ -752,7 +400,7 @@ const Capacity = ({ actions, dispatch, siteList, }) => {
</div> </div>
<img style={{ width: 36, height: 36 }} src="/assets/images/monitor/right.png" <img style={{ width: 36, height: 36 }} src="/assets/images/monitor/right.png"
onClick={() => { onClick={() => {
if (pageRight + 1 < Math.ceil(cabinetData.length / 2)) setPageRight(pageRight + 1) if (pageRight + 1 < Math.ceil(capacity?.cabinetSun.length / 2)) setPageRight(pageRight + 1)
}} /></>} }} /></>}
</div> </div>
@ -825,7 +473,7 @@ const Capacity = ({ actions, dispatch, siteList, }) => {
areaStyle: { areaStyle: {
color: '#0e9cff26', color: '#0e9cff26',
}, },
data: depthWater?.map(v => [moment(v.time).format('YYYY-MM-DD HH:mm:ss'), v.sLiquid_level?.toFixed(2) || null]) || [] data: waterLevelSix?.map(v => [moment(v.time).format('YYYY-MM-DD HH:mm:ss'), v.sLiquid_level?.toFixed(2) || null]) || []
}, { }, {
type: 'line', type: 'line',
name: '池前(上游)液位', name: '池前(上游)液位',
@ -833,7 +481,7 @@ const Capacity = ({ actions, dispatch, siteList, }) => {
areaStyle: { areaStyle: {
color: '#0e9cff26', color: '#0e9cff26',
}, },
data: depthWater?.map(v => [moment(v.time).format('YYYY-MM-DD HH:mm:ss'), v.sGrille_level?.toFixed(2) || null]) || [] data: waterLevelSix?.map(v => [moment(v.time).format('YYYY-MM-DD HH:mm:ss'), v.sGrille_level?.toFixed(2) || null]) || []
}, },
] ]
}} }}
@ -864,9 +512,10 @@ const Capacity = ({ actions, dispatch, siteList, }) => {
onChange={v => { onChange={v => {
if (v?.length < 4) { if (v?.length < 4) {
setPumpId(v) setPumpId(v)
setElectricityTrend(currentSix?.filter(d => v.includes(d.id)) || [])
} }
}} }}
options={pumpList?.map(v => ({ value: v.id, label: v.name })) || []} options={pumpList || []}
/> />
</div> </div>
<ReactECharts <ReactECharts
@ -956,9 +605,10 @@ const Capacity = ({ actions, dispatch, siteList, }) => {
onChange={v => { onChange={v => {
if (v?.length < 4) { if (v?.length < 4) {
setUsePumpId(v) setUsePumpId(v)
setUseTrend(currentSix?.filter(d => v.includes(d.id)) || [])
} }
}} }}
options={pumpList?.map(v => ({ value: v.id, label: v.name })) || []} options={pumpList || []}
/> />
</div> </div>
<ReactECharts <ReactECharts
@ -1027,11 +677,16 @@ const Capacity = ({ actions, dispatch, siteList, }) => {
} }
function mapStateToProps (state) { function mapStateToProps (state) {
const { auth, global } = state; const { auth, global, capacity, waterLevelSix, currentSix } = state;
return { return {
user: auth.user, user: auth.user,
clientHeight: global.clientHeight, clientHeight: global.clientHeight,
actions: global.actions, actions: global.actions,
capacity: capacity?.data || {},
waterLevelSix: waterLevelSix?.data || [],
currentSix: currentSix?.data || [],
}; };
} }
export default connect(mapStateToProps)(Capacity) export default connect(mapStateToProps)(Capacity)

217
web/client/src/sections/bigScreen/components/electrical.js

@ -8,29 +8,18 @@ import LineBoxStatus from '../components/electrity/lineBoxStatus';
import VoltageTrend from '../components/electrity/voltageTrend'; import VoltageTrend from '../components/electrity/voltageTrend';
import LevelTrend from '../components/electrity/levelTrend'; import LevelTrend from '../components/electrity/levelTrend';
const Electrical = ({ dispatch, actions, siteList }) => { const Electrical = ({ dispatch, actions, siteList, waterLevelSix, currentSix, cabinet }) => {
const { bigScreen } = actions const { bigScreen } = actions
const [pageLeft, setPageLeft] = useState(0) //左边翻页
const [pageRight, setPageRight] = useState(0) //左边翻页
// const [siteList, setSiteList] = useState([]) //站点列表
const [pumpList, setPumpList] = useState([]) //水泵列表 const [pumpList, setPumpList] = useState([]) //水泵列表
const [cabinetList, setCabinetList] = useState([]) //水泵列表 const [cabinetList, setCabinetList] = useState([]) //水泵列表
const [strucId, setStrucId] = useState() //站点ID const [strucId, setStrucId] = useState() //站点ID
const [pumpId, setPumpId] = useState() //水泵id const [pumpId, setPumpId] = useState() //水泵id
const [cabinetId, setCabinetId] = useState() //进线柜id const [cabinetId, setCabinetId] = useState() //进线柜id
const [usePumpId, setUsePumpId] = useState() //水泵id
const [voltagePumpId, setVoltagePumpId] = useState([]) //水泵电压id const [voltagePumpId, setVoltagePumpId] = useState([]) //水泵电压id
const [pumpOne, setPumpOne] = useState({ data: [] }) //单个水泵数据 const [pumpOne, setPumpOne] = useState({ data: [] }) //单个水泵数据
const [voltagepump, setVoltagePump] = useState([]) //单个水泵数据 const [voltagepump, setVoltagePump] = useState([]) //单个水泵数据
const [cabinetOne, setCabinetOne] = useState({ data: [] }) //单个进线柜数据 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 [changeable, setChangeable] = useState(true) // 泵站是否可切换 const [changeable, setChangeable] = useState(true) // 泵站是否可切换
useEffect(() => { useEffect(() => {
@ -48,161 +37,69 @@ const Electrical = ({ dispatch, actions, siteList }) => {
setStrucId(nextStructId); setStrucId(nextStructId);
}, [siteList]) }, [siteList])
useEffect(async () => { useEffect(() => {
if (strucId) { if (cabinet?.length) {
await dispatch(bigScreen.axyData({ type: 'get', url: `structures/${strucId}/factors` })).then(async r => { setCabinetId(cabinet[0].id)
if (r.success) { setCabinetOne(cabinet[0] || {})
//水泵信息 setCabinetList(cabinet?.map(v => ({ value: v.id, label: v.name })) || [])
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)
}
})
}
// 进线柜
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)
}
})
} }
}, [cabinet])
// //泵站信息 useEffect(() => {
let informationId = r.payload.data?.find(v => v.name == '泵站信息')?.id if (currentSix?.length) {
if (informationId) { setPumpId(currentSix[0].id)
await dispatch(bigScreen.axyData({ setPumpOne(currentSix[0] || {})
type: 'get', url: `structures/${strucId}/stations`, setVoltagePumpId(currentSix?.slice(0, 3)?.map(v => v.id))
params: { query: { factorId: informationId } } setPumpList(currentSix || [])
})).then(async p => { setVoltagePump(currentSix?.slice(0, 3) || [])
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(-6, '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)
}
})
} }
}, [currentSix])
}) useEffect(() => {
} if (strucId) {
} dispatch(bigScreen.getWaterLevelSix({ key: 'waterLevelSix', methodType: 'hget', field: 'struc' + strucId }))
}) dispatch(bigScreen.getCurrentSix({ key: 'currentSix', methodType: 'hget', field: 'struc' + strucId }))
dispatch(bigScreen.getCabinet({ key: 'cabinet', methodType: 'hget', field: 'struc' + strucId }))
} }
}, [strucId]) }, [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(-6, '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 <div style={{ width: '100%', height: 'calc(100% - 200px', color: '#FFF', position: 'absolute', top: 160, left: 0 }}> return <div style={{ width: '100%', height: 'calc(100% - 200px', color: '#FFF', position: 'absolute', top: 160, left: 0 }}>
<div style={{ width: '100%', height: "100%", position: 'relative', }}> <div style={{ width: '100%', height: "100%", position: 'relative', }}>
<RealTimeStatus setPumpOne={setPumpOne} pumpId={pumpId} pumpList={pumpList} setPumpId={setPumpId} pumpOne={pumpOne} strucId={strucId} siteList={siteList} /> <RealTimeStatus
<LineBoxStatus cabinetId={cabinetId} cabinetList={cabinetList} setCabinetId={setCabinetId} cabinetOne={cabinetOne} /> setPumpOne={setPumpOne}
<VoltageTrend pumpList={pumpList} voltagePumpId={voltagePumpId} setVoltagePumpId={setVoltagePumpId} data={voltagepump} /> pumpId={pumpId}
<LevelTrend depthWater={depthWater} /> pumpList={pumpList}
setPumpId={setPumpId}
pumpOne={pumpOne}
strucId={strucId}
siteList={siteList}
currentSix={currentSix}
/>
<LineBoxStatus
cabinetId={cabinetId}
cabinetList={cabinetList}
setCabinetId={setCabinetId}
cabinetOne={cabinetOne}
setCabinetOne={setCabinetOne}
cabinet={cabinet}
/>
<VoltageTrend
pumpList={pumpList}
voltagePumpId={voltagePumpId}
setVoltagePumpId={setVoltagePumpId}
data={voltagepump}
currentSix={currentSix}
setVoltagePump={setVoltagePump}
/>
<LevelTrend
depthWater={waterLevelSix}
/>
<div style={{ <div style={{
width: "30%", height: 160, position: "absolute", left: '35%', top: "8%", width: "30%", height: 160, position: "absolute", left: '35%', top: "8%",
display: 'flex', justifyContent: 'space-between', display: 'flex', justifyContent: 'space-between',
@ -214,7 +111,7 @@ const Electrical = ({ dispatch, actions, siteList }) => {
}}> }}>
<div style={{ fontSize: 20, color: '#E2F8FF', fontWeight: 600 }}> <div style={{ fontSize: 20, color: '#E2F8FF', fontWeight: 600 }}>
环境湿度</div> 环境湿度</div>
<span style={{ color: '#00FFF8', fontFamily: "D-DIN-Italic" }}>{depthWater[depthWater.length - 1]?.sHumidity || "--"} %</span> <span style={{ color: '#00FFF8', fontFamily: "D-DIN-Italic" }}>{waterLevelSix[waterLevelSix.length - 1]?.sHumidity || "--"} %</span>
</div> </div>
<div style={{ <div style={{
backgroundImage: 'url(/assets/images/monitor/pedestal.png)', backgroundImage: 'url(/assets/images/monitor/pedestal.png)',
@ -224,7 +121,7 @@ const Electrical = ({ dispatch, actions, siteList }) => {
<div style={{ fontSize: 20, color: '#E2F8FF', fontWeight: 600 }}> <div style={{ fontSize: 20, color: '#E2F8FF', fontWeight: 600 }}>
环境温度 环境温度
</div> </div>
<span style={{ color: '#00FFF8', fontFamily: "D-DIN-Italic" }}>{depthWater[depthWater.length - 1]?.sTEMP || "--"} </span> <span style={{ color: '#00FFF8', fontFamily: "D-DIN-Italic" }}>{waterLevelSix[waterLevelSix.length - 1]?.sTEMP || "--"} </span>
</div> </div>
<div style={{ <div style={{
backgroundImage: 'url(/assets/images/monitor/pedestal.png)', backgroundImage: 'url(/assets/images/monitor/pedestal.png)',
@ -233,12 +130,12 @@ const Electrical = ({ dispatch, actions, siteList }) => {
}}> }}>
<div style={{ fontSize: 20, color: '#E2F8FF', fontWeight: 600 }}> <div style={{ fontSize: 20, color: '#E2F8FF', fontWeight: 600 }}>
信号</div> 信号</div>
<span style={{ color: '#00FFF8', fontFamily: "D-DIN-Italic" }}>{depthWater[depthWater.length - 1]?.CSQ4G || "--"}</span> <span style={{ color: '#00FFF8', fontFamily: "D-DIN-Italic" }}>{waterLevelSix[waterLevelSix.length - 1]?.CSQ4G || "--"}</span>
</div> </div>
</div> </div>
<img style={{ width: "44%", height: "46%", position: "absolute", left: "28%", top: "34%" }} src={`/assets/images/electrical/centre.png`} /> <img style={{ width: "44%", height: "46%", position: "absolute", left: "28%", top: "34%" }} src={`/assets/images/electrical/centre.png`} />
<div style={{ background: '#102d4c94', border: '1px solid #4CA1FF', position: "absolute", left: "33%", top: "58%" }}>集水池水位<span style={{ color: '#FFCB00', fontFamily: 'DIN-Medium' }}>{depthWater[depthWater?.length - 1]?.sLiquid_level?.toFixed(2) || 0}</span></div> <div style={{ background: '#102d4c94', border: '1px solid #4CA1FF', position: "absolute", left: "33%", top: "58%" }}>集水池水位<span style={{ color: '#FFCB00', fontFamily: 'DIN-Medium' }}>{waterLevelSix[waterLevelSix?.length - 1]?.sLiquid_level?.toFixed(2) || 0}</span></div>
<div style={{ background: '#102d4c94', border: '1px solid #4CA1FF', position: "absolute", left: "36%", top: "70%" }}>池前上游水位<span style={{ color: '#FFCB00', fontFamily: 'DIN-Medium' }}>{depthWater[depthWater?.length - 1]?.sGrille_level?.toFixed(2) || 0}</span></div> <div style={{ background: '#102d4c94', border: '1px solid #4CA1FF', position: "absolute", left: "36%", top: "70%" }}>池前上游水位<span style={{ color: '#FFCB00', fontFamily: 'DIN-Medium' }}>{waterLevelSix[waterLevelSix?.length - 1]?.sGrille_level?.toFixed(2) || 0}</span></div>
<div className='site' style={{ <div className='site' style={{
display: 'flex', justifyContent: 'center', alignItems: 'center', display: 'flex', justifyContent: 'center', alignItems: 'center',
width: '40%', bottom: 10, position: 'absolute', left: "28%" width: '40%', bottom: 10, position: 'absolute', left: "28%"
@ -267,11 +164,15 @@ const Electrical = ({ dispatch, actions, siteList }) => {
} }
function mapStateToProps (state) { function mapStateToProps (state) {
const { auth, global } = state; const { auth, global, waterLevelSix, currentSix, cabinet } = state;
return { return {
user: auth.user, user: auth.user,
clientHeight: global.clientHeight, clientHeight: global.clientHeight,
actions: global.actions, actions: global.actions,
waterLevelSix: waterLevelSix?.data || [],
currentSix: currentSix?.data || [],
cabinet: cabinet?.data || [],
}; };
} }

3
web/client/src/sections/bigScreen/components/electrity/lineBoxStatus.js

@ -4,7 +4,7 @@ import { Select } from 'antd';
const LineBoxStatus = ({ user, cabinetId, cabinetList, setCabinetId, cabinetOne }) => { const LineBoxStatus = ({ user, cabinetId, cabinetList, setCabinetId, cabinetOne, setCabinetOne, cabinet }) => {
@ -24,6 +24,7 @@ const LineBoxStatus = ({ user, cabinetId, cabinetList, setCabinetId, cabinetOne
optionFilterProp="children" optionFilterProp="children"
onSelect={v => { onSelect={v => {
setCabinetId(v) setCabinetId(v)
setCabinetOne(cabinet?.find(d => d.id == v) || {})
}} }}
options={cabinetList || []} options={cabinetList || []}
/> />

5
web/client/src/sections/bigScreen/components/electrity/realTimeStatus.js

@ -2,8 +2,8 @@ import React, { useState, useEffect } from 'react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { Select, Modal, Switch, Input, Button, Form, message } from 'antd'; import { Select, Modal, Switch, Input, Button, Form, message } from 'antd';
const RealTimeStatus = (props) => { const RealTimeStatus = ({dispatch, actions, user, pumpId, pumpList, setPumpId, pumpOne, strucId, siteList, setPumpOne, currentSix }) => {
const { dispatch, actions, user, pumpId, pumpList, setPumpId, pumpOne, strucId, siteList, setPumpOne } = props;
const { bigScreen } = actions; const { bigScreen } = actions;
const [pwOpen, setPwOpen] = useState(false); const [pwOpen, setPwOpen] = useState(false);
@ -146,6 +146,7 @@ const RealTimeStatus = (props) => {
onSelect={(v, option) => { onSelect={(v, option) => {
setPumpId(v) setPumpId(v)
setPumpName(option.label) setPumpName(option.label)
setPumpOne(currentSix?.find(d => d.id == v) || {})
}} }}
options={pumpList?.map(v => ({ value: v.id, label: v.name })) || []} options={pumpList?.map(v => ({ value: v.id, label: v.name })) || []}
/> />

3
web/client/src/sections/bigScreen/components/electrity/voltageTrend.js

@ -6,7 +6,7 @@ import moment from 'moment'
const { Option } = Select; const { Option } = Select;
const VoltageTrend = ({ user, voltagePumpId, pumpList, setVoltagePumpId, data }) => { const VoltageTrend = ({ user, voltagePumpId, pumpList, setVoltagePumpId, data, setVoltagePump, currentSix }) => {
@ -32,6 +32,7 @@ const VoltageTrend = ({ user, voltagePumpId, pumpList, setVoltagePumpId, data })
onChange={v => { onChange={v => {
if (v?.length < 4) { if (v?.length < 4) {
setVoltagePumpId(v) setVoltagePumpId(v)
setVoltagePump(currentSix?.filter(d => v.includes(d.id)) || [])
} }
}} }}

19
web/client/src/sections/bigScreen/components/realTime.js

@ -36,8 +36,13 @@ const RealTime = ({ dispatch, actions, user, siteList, }) => {
setStrucId(nextStructId); setStrucId(nextStructId);
}, [siteList]) }, [siteList])
useEffect(async () => { useEffect(async () => {
if (strucId) { if (strucId) {
let station = {} let station = {}
let week = 0 //本周 let week = 0 //本周
let year = 0 //年 let year = 0 //年
@ -284,34 +289,34 @@ const RealTime = ({ dispatch, actions, user, siteList, }) => {
<SoftStart softStartData={softStartData} /> <SoftStart softStartData={softStartData} />
<RunTime softStartData={softStartData} /> <RunTime softStartData={softStartData} />
<AccumulateTime softStartData={softStartData} /> <AccumulateTime softStartData={softStartData} />
<Below stations={stations} level={level} /> <Below stations={stations} level={level} strucId={strucId} />
<div style={{ <div style={{
width: 166, position: "absolute", left: '29%', top: '4%', width: 182, position: "absolute", left: '29%', top: '4%',
}}> }}>
<div style={{ <div style={{
backgroundImage: 'url(/assets/images/realTime/buttom-d.png)', backgroundSize: '100% 100%', backgroundPosition: 'center', backgroundRepeat: 'no-repeat', backgroundImage: 'url(/assets/images/realTime/buttom-d.png)', backgroundSize: '100% 100%', backgroundPosition: 'center', backgroundRepeat: 'no-repeat',
width: '100%', height: 40, lineHeight: "40px", textAlign: "center" width: '100%', height: 40, lineHeight: "40px", textAlign: "center"
}}> 本周用电量:<span style={{ fontFamily: 'D-DIN-Italic', color: '#00FFF8', fontSize: 20 }}>{electro?.week?.toFixed(2)}</span> }}> 本周用电量:<span style={{ fontFamily: 'D-DIN-Italic', color: '#00FFF8', fontSize: 20 }}>{electro?.week?.toFixed(2)} kwh</span>
</div> </div>
<img style={{ width: "100%", height: 122, }} src={`/assets/images/realTime/this-week.png`} /> <img style={{ width: "100%", height: 122, }} src={`/assets/images/realTime/this-week.png`} />
</div> </div>
<div style={{ <div style={{
width: 166, position: "absolute", left: '59%', top: "13%", width: 182, position: "absolute", left: '59%', top: "13%",
}}> }}>
<div style={{ <div style={{
backgroundImage: 'url(/assets/images/realTime/buttom-d.png)', backgroundSize: '100% 100%', backgroundPosition: 'center', backgroundRepeat: 'no-repeat', backgroundImage: 'url(/assets/images/realTime/buttom-d.png)', backgroundSize: '100% 100%', backgroundPosition: 'center', backgroundRepeat: 'no-repeat',
width: '100%', height: 40, lineHeight: "40px", textAlign: "center" width: '100%', height: 40, lineHeight: "40px", textAlign: "center"
}}>今年用电量:<span style={{ fontFamily: 'D-DIN-Italic', color: '#00FFF8', fontSize: 20 }}>{electro?.year?.toFixed(2)}</span> }}>今年用电量:<span style={{ fontFamily: 'D-DIN-Italic', color: '#00FFF8', fontSize: 20 }}>{electro?.year?.toFixed(2)} kwh</span>
</div> </div>
<img style={{ width: "100%", height: 122, }} src={`/assets/images/realTime/this-year.png`} /> <img style={{ width: "100%", height: 122, }} src={`/assets/images/realTime/this-year.png`} />
</div> </div>
<div style={{ <div style={{
width: 166, position: "absolute", left: '31%', top: '28%', width: 182, position: "absolute", left: '31%', top: '28%',
}}> }}>
<div style={{ <div style={{
backgroundImage: 'url(/assets/images/realTime/buttom-d.png)', backgroundSize: '100% 100%', backgroundPosition: 'center', backgroundRepeat: 'no-repeat', backgroundImage: 'url(/assets/images/realTime/buttom-d.png)', backgroundSize: '100% 100%', backgroundPosition: 'center', backgroundRepeat: 'no-repeat',
width: '100%', height: 40, lineHeight: "40px", textAlign: "center" width: '100%', height: 40, lineHeight: "40px", textAlign: "center"
}}> 今日用电量:<span style={{ fontFamily: 'D-DIN-Italic', color: '#00FFF8', fontSize: 20 }}>{electro?.day?.toFixed(2)}</span> }}> 今日用电量:<span style={{ fontFamily: 'D-DIN-Italic', color: '#00FFF8', fontSize: 20 }}>{electro?.day?.toFixed(2)} kwh</span>
</div> </div>
<img style={{ width: "100%", height: 122, }} src={`/assets/images/realTime/this-day.png`} /> <img style={{ width: "100%", height: 122, }} src={`/assets/images/realTime/this-day.png`} />
</div> </div>

71
web/client/src/sections/bigScreen/components/realTime/below.js

@ -6,70 +6,26 @@ import moment from 'moment'
const { Option } = Select; const { Option } = Select;
const Below = ({ dispatch, actions, stations, level }) => { const Below = ({ dispatch, actions, stations, level, strucId, threePhase }) => {
const { bigScreen } = actions const { bigScreen } = actions
const [page, setPage] = useState(0) const [page, setPage] = useState(0)
const [threePower, setThreePower] = useState([]) const [threePower, setThreePower] = useState([])
const [electricity, setElectricity] = useState([]) const [electricity, setElectricity] = useState([])
useEffect(() => {
if (strucId) {
dispatch(bigScreen.getThreePhase({ key: 'threePhase', methodType: 'hget', field: 'struc' + strucId }))
}
}, [strucId])
useEffect(async () => { useEffect(async () => {
let now = 0 let now = 0
let before = 0 let before = 0
let timeData = [] let timeData = []
if (stations?.pump) { 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 = []
let timeSet = new Set()
d.payload.data?.stations?.map(p => {
p.data?.map(s => {
timeSet.add(moment(s.time).format('YYYY-MM-DD HH:mm:ss'))
})
})
let time = [...timeSet].sort((a, b) => moment(a).isBefore(b) ? -1 : 1)
time?.map(x => {
let A = []
let B = []
let C = []
d.payload.data?.stations?.map((s, index) => {
let a = s.data?.find(f => moment(f.time).format('YYYY-MM-DD HH:mm:ss') == x)?.eMotor_A_A
let b = s.data?.find(f => moment(f.time).format('YYYY-MM-DD HH:mm:ss') == x)?.eMotor_B_A
let c = s.data?.find(f => moment(f.time).format('YYYY-MM-DD HH:mm:ss') == x)?.eMotor_C_A
if (a) A.push(a)
if (b) B.push(b)
if (c) C.push(c)
})
const sum = (arr) => {
let sum = 0
arr.map(h => {
sum += h
})
return sum
}
threedata?.push({
A: A.length && (sum(A) / A.length) || null,
B: B.length && (sum(B) / B.length) || null,
C: C.length && (sum(C) / C.length) || null,
time: x
})
})
setThreePower(threedata);
}
})
//现在 //现在
await dispatch(bigScreen.axyData({ await dispatch(bigScreen.axyData({
@ -267,7 +223,7 @@ const Below = ({ dispatch, actions, stations, level }) => {
areaStyle: { areaStyle: {
color: '#0e9cff26', color: '#0e9cff26',
}, },
data: threePower?.map(v => [moment(v.time).format('YYYY-MM-DD HH:mm:ss'), v.A?.toFixed(2)]) data: threePhase?.map(v => [moment(v.time).format('YYYY-MM-DD HH:mm:ss'), v.A?.toFixed(2)])
}, { }, {
type: 'line', type: 'line',
name: 'B相电流', name: 'B相电流',
@ -275,7 +231,7 @@ const Below = ({ dispatch, actions, stations, level }) => {
areaStyle: { areaStyle: {
color: '#0e9cff26', color: '#0e9cff26',
}, },
data: threePower?.map(v => [moment(v.time).format('YYYY-MM-DD HH:mm:ss'), v.B?.toFixed(2)]) data: threePhase?.map(v => [moment(v.time).format('YYYY-MM-DD HH:mm:ss'), v.B?.toFixed(2)])
}, { }, {
type: 'line', type: 'line',
name: 'C相电流', name: 'C相电流',
@ -283,7 +239,7 @@ const Below = ({ dispatch, actions, stations, level }) => {
areaStyle: { areaStyle: {
color: '#0e9cff26', color: '#0e9cff26',
}, },
data: threePower?.map(v => [moment(v.time).format('YYYY-MM-DD HH:mm:ss'), v.C?.toFixed(2)]) data: threePhase?.map(v => [moment(v.time).format('YYYY-MM-DD HH:mm:ss'), v.C?.toFixed(2)])
}, },
] ]
}} }}
@ -456,11 +412,12 @@ const Below = ({ dispatch, actions, stations, level }) => {
} }
function mapStateToProps (state) { function mapStateToProps (state) {
const { auth, global } = state; const { auth, global, threePhase } = state;
return { return {
user: auth.user, user: auth.user,
clientHeight: global.clientHeight, clientHeight: global.clientHeight,
actions: global.actions, actions: global.actions,
threePhase: threePhase?.data || []
}; };
} }

46
web/client/src/sections/bigScreen/components/video.js

@ -1,6 +1,33 @@
import React from 'react'; import React, { useEffect, useState } from 'react';
import { connect } from 'react-redux';
const Video = ({ actions, dispatch, siteList, videoUrl }) => {
const { bigScreen } = actions
const [url, setSurl] = useState("")
useEffect(() => {
if (siteList?.length) {
dispatch(bigScreen.getVideoUrl({}))
}
}, [siteList])
useEffect(() => {
if (videoUrl?.length) {
const autoStructId = sessionStorage.getItem('structId');
console.log(videoUrl);
if (autoStructId) {
setSurl(videoUrl?.find(d => d.strucId == autoStructId)?.videoUrl)
} else {
setSurl(videoUrl?.find(d => !d.strucId)?.videoUrl)
}
}
}, [videoUrl])
const Video = () => {
return <iframe return <iframe
style={{ style={{
width: '100vw', width: '100vw',
@ -9,11 +36,22 @@ const Video = () => {
top: '170px', top: '170px',
zIndex: 7 zIndex: 7
}} }}
src="https://mediaconsole.ngaiot.com/callService?mid=47501408102333" src={url}
allowFullScreen allowFullScreen
> >
<p>你的浏览器不支持 iframe </p> <p>你的浏览器不支持 iframe </p>
</iframe> </iframe>
} }
export default Video;
function mapStateToProps (state) {
const { auth, global, videoUrl } = state;
return {
user: auth.user,
clientHeight: global.clientHeight,
actions: global.actions,
videoUrl: videoUrl?.data || []
};
}
export default connect(mapStateToProps)(Video);

4
web/client/src/sections/bigScreen/containers/systemManagement.js

@ -26,7 +26,7 @@ const SystemManagement = ({ dispatch, actions, user, history }) => {
useEffect(() => { useEffect(() => {
const tabKey = sessionStorage.getItem('tabKey'); const tabKey = sessionStorage.getItem('tabKey');
if (tabKey) { setModule(tabKey) }; if (tabKey) { setModule(tabKey) };
dispatch(bigScreen.axyData({ type: 'get', url: `organizations/{orgId}/structures` })).then(res => { dispatch(bigScreen.getPumpStation({ key: 'structure', methodType: 'get' })).then(res => {
if (res.success) { if (res.success) {
setSiteList(res.payload.data?.map(v => ({ value: v.id, label: v.name, iotaThingId: v.iotaThingId })) || []) setSiteList(res.payload.data?.map(v => ({ value: v.id, label: v.name, iotaThingId: v.iotaThingId })) || [])
setshowData(res.payload.data?.map(v => ({ name: v.name, lat: v.latitude, lng: v.longitude })) || []) setshowData(res.payload.data?.map(v => ({ name: v.name, lat: v.latitude, lng: v.longitude })) || [])
@ -54,7 +54,7 @@ const SystemManagement = ({ dispatch, actions, user, history }) => {
{module == 'capacity' ? <Capacity siteList={siteList} /> : ""} {module == 'capacity' ? <Capacity siteList={siteList} /> : ""}
{module == 'electrical' ? <Electrical siteList={siteList} /> : ""} {module == 'electrical' ? <Electrical siteList={siteList} /> : ""}
{module == 'realTime' ? <RealTime siteList={siteList} /> : ""} {module == 'realTime' ? <RealTime siteList={siteList} /> : ""}
{module === 'video' && <Video />} {module === 'video' && <Video siteList={siteList} />}
</div> </div>
) )
} }

5
web/client/src/utils/webapi.js

@ -20,10 +20,9 @@ export const ApiTable = {
login: 'login', login: 'login',
logout: 'logout', logout: 'logout',
axyData: 'axyData', //安心云数据 axyData: 'axyData', //安心云数据
pumpInformation:'pumpInformation' pumpInformation:'pumpInformation' ,
videoUrl:"videoUrl",
}; };

Loading…
Cancel
Save