diff --git a/api/.vscode/launch.json b/api/.vscode/launch.json
index 18c82f6..004411d 100644
--- a/api/.vscode/launch.json
+++ b/api/.vscode/launch.json
@@ -16,7 +16,9 @@
"-p 4900",
// 研发
"-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",
// "--qnak XuDgkao6cL0HidoMAPnA5OB10Mc_Ew08mpIfRJK5",
diff --git a/api/app/lib/controllers/bigScreen/index .js b/api/app/lib/controllers/bigScreen/index .js
index cdb4992..b881d10 100644
--- a/api/app/lib/controllers/bigScreen/index .js
+++ b/api/app/lib/controllers/bigScreen/index .js
@@ -56,8 +56,7 @@ async function axyData (ctx, next) {
const pumpInformation = async function (ctx) {
-
- let errMsg = { message: '获取泵站信息失败' }
+ let errMsg = { message: '获取泵站数据失败' }
try {
const models = ctx.fs.dc.models;
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 = {
axyData,
- pumpInformation
+ pumpInformation,
+ getPumpStation,
+ getVideoUrl
+
}
\ No newline at end of file
diff --git a/api/app/lib/index.js b/api/app/lib/index.js
index c6224e4..7684a5e 100644
--- a/api/app/lib/index.js
+++ b/api/app/lib/index.js
@@ -4,7 +4,7 @@ const fs = require('fs');
const path = require('path');
const utils = require('./utils')
const routes = require('./routes');
-//const redisConnect = require('./service/redis')
+const redisConnect = require('./service/redis')
const socketConect = require('./service/socket')
const paasRequest = require('./service/paasRequest');
const authenticator = require('./middlewares/authenticator');
@@ -22,7 +22,7 @@ module.exports.entry = function (app, router, opts) {
app.fs.api.logAttr = app.fs.api.logAttr || {};
// 顺序固定 ↓
- //redisConnect(app, opts)
+ redisConnect(app, opts)
socketConect(app, opts)
// 实例其他平台请求方法
diff --git a/api/app/lib/models/video.js b/api/app/lib/models/video.js
new file mode 100644
index 0000000..82ad11a
--- /dev/null
+++ b/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;
+};
\ No newline at end of file
diff --git a/api/app/lib/routes/organization/index.js b/api/app/lib/routes/organization/index.js
index 5b20a1e..2ac3110 100644
--- a/api/app/lib/routes/organization/index.js
+++ b/api/app/lib/routes/organization/index.js
@@ -3,10 +3,39 @@
const data = require('../../controllers/bigScreen/index ');
module.exports = function (app, router, opts) {
-
- app.fs.api.logAttr['POST/axyData'] = { content: '获取安心云数据', visible: true };
- router.post('/axyData', data.axyData);
+ app.fs.api.logAttr['POST/axyData'] = { content: '获取安心云数据', visible: true };
+ router.post('/axyData', data.axyData);
+
+ app.fs.api.logAttr['GET/pumpInformation'] = { content: '获取泵站信息', visible: true };
+ 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);
+
+
- app.fs.api.logAttr['GET/pumpInformation'] = { content: '获取泵站信息', visible: true };
- router.get('/pumpInformation', data.pumpInformation);
};
\ No newline at end of file
diff --git a/api/app/lib/schedule/workorder_statistics.js b/api/app/lib/schedule/workorder_statistics.js
new file mode 100644
index 0000000..03c224d
--- /dev/null
+++ b/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}`);
+ }
+}
\ No newline at end of file
diff --git a/api/config.js b/api/config.js
index e374f7b..f14bb66 100644
--- a/api/config.js
+++ b/api/config.js
@@ -11,6 +11,10 @@ const dev = process.env.NODE_ENV == 'development';
args.option(['p', 'port'], '启动端口');
args.option(['g', 'pg'], 'postgre 服务 URL');
+args.option('redisHost', 'redisHost');
+args.option('redisPort', 'redisPort');
+args.option('redisPswd', 'redisPassword');
+
args.option('apiAnxinyunUrl', "安心云api");
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 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('缺少启动参数,异常退出');
args.showHelp();
process.exit(-1);
@@ -46,6 +55,11 @@ const product = {
], // 不做认证的路由,也可以使用 exclude: ["*"] 跳过所有路由
// apiAnxinyunUrl: API_ANXINYUN_URL,
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
name: 'anxinyun',
root: API_ANXINYUN_URL
diff --git a/scripts/0.1/data/pump_information.sql b/scripts/0.1/data/pump_information.sql
index d182706..d922274 100644
--- a/scripts/0.1/data/pump_information.sql
+++ b/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,
- 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,
- 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,
- 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,
- 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,
- 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,
- 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,
- 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,
- 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年','--');
diff --git a/scripts/0.2/schema/1.video.sql b/scripts/0.2/schema/1.video.sql
new file mode 100644
index 0000000..50260c6
--- /dev/null
+++ b/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);
+
diff --git a/web/client/assets/images/monitor/pillar.png b/web/client/assets/images/monitor/pillar.png
index 3321f36..594f0c1 100644
Binary files a/web/client/assets/images/monitor/pillar.png and b/web/client/assets/images/monitor/pillar.png differ
diff --git a/web/client/src/sections/bigScreen/actions/bigScreen.js b/web/client/src/sections/bigScreen/actions/bigScreen.js
index d7cf19f..c14e4eb 100644
--- a/web/client/src/sections/bigScreen/actions/bigScreen.js
+++ b/web/client/src/sections/bigScreen/actions/bigScreen.js
@@ -25,6 +25,90 @@ export function pumpInformation (query = {}) {
});
}
-export default {
- axyData
-}
\ No newline at end of file
+
+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' }
+ });
+}
+
+
diff --git a/web/client/src/sections/bigScreen/actions/index.js b/web/client/src/sections/bigScreen/actions/index.js
index e0bb1c7..4bd20cd 100644
--- a/web/client/src/sections/bigScreen/actions/index.js
+++ b/web/client/src/sections/bigScreen/actions/index.js
@@ -1,8 +1,27 @@
'use strict';
+import { basicAction } from '@peace/utils'
+import { ApiTable } from '$utils'
+
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 {
- ...bigScreen
+ ...bigScreen,
+ ...video,
+ getPumpStation,
}
\ No newline at end of file
diff --git a/web/client/src/sections/bigScreen/actions/video.js b/web/client/src/sections/bigScreen/actions/video.js
new file mode 100644
index 0000000..ad375f5
--- /dev/null
+++ b/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,
+}
\ No newline at end of file
diff --git a/web/client/src/sections/bigScreen/components/basis.js b/web/client/src/sections/bigScreen/components/basis.js
index fc782a7..bf96cad 100644
--- a/web/client/src/sections/bigScreen/components/basis.js
+++ b/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 './basis.less'
-const Basis = ({ actions, dispatch, setshowData, siteList, siteData }) => {
+const Basis = ({ actions, dispatch, setshowData, siteList, siteData, waterLevelSix, waterPumpStateAll }) => {
const { bigScreen } = actions
- // const [siteList, setSiteList] = useState([]) //站点列表
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 [pumpInformation, setPumpInformation] = useState([])
-
- const left1Data = useRef([])
- const left2Data = useRef([])
- const pumpNumber = useRef(0)
-
-
+ const [pumpNumber, setPumpNumber] = useState(0)
useEffect(() => {
dispatch(bigScreen.pumpInformation({})).then(res => {
@@ -35,6 +26,7 @@ const Basis = ({ actions, dispatch, setshowData, siteList, siteData }) => {
setPumpInformation(res.payload.data || [])
}
})
+
}, [])
useEffect(() => {
if (pumpInformation?.length && strucId) {
@@ -42,82 +34,20 @@ const Basis = ({ actions, dispatch, setshowData, siteList, siteData }) => {
}
}, [pumpInformation, strucId])
+ useEffect(() => {
+ if (waterPumpStateAll?.length) {
+ let num = 0
+ waterPumpStateAll?.forEach(v => {
+ num += v.data.length || 0
+ })
+ setPumpNumber(num)
+ }
+ }, [waterPumpStateAll])
useEffect(async () => {
-
if (siteData) {
- //获取所有泵站的集水池液位
- 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'))
- }
- })
- }
-
- })
- }
-
- //水泵信息
- let waterId = r.payload.data?.find(v => v.name == '泵站水泵')?.id
- if (waterId) {
- await dispatch(bigScreen.axyData({
- 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'))
- }
- })
- }
- }
- })
- }
- })
- })
+ //水泵状态
+ dispatch(bigScreen.getWaterPumpStateAll({ key: 'waterPumpStateAll', methodType: 'get', }))
}
}, [siteData])
@@ -136,41 +66,16 @@ const Basis = ({ actions, dispatch, setshowData, siteList, siteData }) => {
setStrucId(nextStructId);
}, [siteList])
- useEffect(async () => {
+ useEffect(() => {
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
- 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)
- }
- })
- }
- })
- }
- })
+ //泵站水位数据
+ dispatch(bigScreen.getWaterLevelSix({ key: 'waterLevelSix', methodType: 'hget', field: 'struc' + strucId }))
}
}, [strucId])
return
-
+
@@ -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',
display: 'flex', alignItems: 'flex-end', lineHeight: "40px"
}}>
-
地点
+
站点
编号
{
// 允许的滚动方向
forceVisible="y"
>
- {left2Data.current.map(v =>
@@ -210,7 +115,7 @@ const Basis = ({ actions, dispatch, setshowData, siteList, siteData }) => {
-
+
{
backgroundSize: '100% 100%', backgroundPosition: 'center', backgroundRepeat: 'no-repeat',
}}>
- 提升泵数量:{pumpNumber.current}
+ 提升泵数量:{pumpNumber || 0}
}
-function mapStateToProps(state) {
- const { auth, global } = state;
+function mapStateToProps (state) {
+ const { auth, global, waterLevelSix, waterPumpStateAll } = state;
return {
user: auth.user,
clientHeight: global.clientHeight,
actions: global.actions,
+ waterLevelSix: waterLevelSix?.data || [],
+ waterPumpStateAll: waterPumpStateAll?.data || [],
+
};
}
diff --git a/web/client/src/sections/bigScreen/components/basis/left_1.js b/web/client/src/sections/bigScreen/components/basis/left_1.js
index 264132e..0979ad5 100644
--- a/web/client/src/sections/bigScreen/components/basis/left_1.js
+++ b/web/client/src/sections/bigScreen/components/basis/left_1.js
@@ -1,21 +1,28 @@
-import React from 'react';
+import React, { useEffect, useState } from 'react';
+import { connect } from 'react-redux';
import CardTitle from '../public/cardTitle';
import '../basis.less';
import './left_1.less';
-export default function Left_1 (props) {
- const { data } = props;
+const Left_1 = ({ dispatch, actions, waterLevelAll }) => {
+
+ const { bigScreen } = actions
+
+
+ useEffect(() => {
+ dispatch(bigScreen.getWaterLevelAll({ key: 'waterLevelAll', methodType: 'get' }))
+ }, [])
return (
- {data?.map(d =>
+ {waterLevelAll?.map(d =>
-
{d.name}
+
{d.name}
{d.level?.toFixed(2) || 0} m
@@ -25,3 +32,15 @@ export default function Left_1 (props) {
)
}
+
+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);
diff --git a/web/client/src/sections/bigScreen/components/capacity.js b/web/client/src/sections/bigScreen/components/capacity.js
index a91c023..d5c1a80 100644
--- a/web/client/src/sections/bigScreen/components/capacity.js
+++ b/web/client/src/sections/bigScreen/components/capacity.js
@@ -5,19 +5,14 @@ import moment from 'moment'
import ReactECharts from 'echarts-for-react';
import './index.less'
-const Capacity = ({ actions, dispatch, siteList, }) => {
+const Capacity = ({ actions, dispatch, siteList, capacity, waterLevelSix, currentSix }) => {
const { bigScreen } = actions
const [pageLeft, setPageLeft] = useState(0) //左边翻页
const [pageRight, setPageRight] = useState(0) //左边翻页
- // const [siteList, setSiteList] = useState([]) //站点列表
const [pumpList, setPumpList] = useState([]) //水泵列表
const [strucId, setStrucId] = useState() //站点ID
const [pumpId, setPumpId] = 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 [useTrend, setUseTrend] = useState([]) //用电趋势
@@ -38,372 +33,25 @@ const Capacity = ({ actions, dispatch, siteList, }) => {
setStrucId(nextStructId);
}, [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
- }
- })
- })
- }
- })
-
- }
-
- }
- })
- }
- //进线柜
- 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)
- }
- })
- }
-
- })
- }
- }
- })
+ 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 }))
}
-
- 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])
- useEffect(async () => {
- if (pumpId?.length > 0) {
- //电流趋势
- await dispatch(bigScreen.axyData({
- type: 'get', url: `stations/theme/data`, params: {
- query: {
- stations: pumpId?.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) {
- 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)
- }
- })
-
+ useEffect(() => {
+ if (currentSix?.length) {
+ setPumpId(currentSix?.slice(0, 3)?.map(v => v.id))
+ setUsePumpId(currentSix?.slice(0, 3)?.map(v => v.id))
+ setPumpList(currentSix?.map(v => ({ value: v.id, label: v.name })))
+ setElectricityTrend(currentSix?.slice(0, 3) || [])
+ setUseTrend(currentSix?.slice(0, 3) || [])
}
- }, [usePumpId])
-
+ }, [currentSix])
@@ -415,14 +63,14 @@ const Capacity = ({ actions, dispatch, siteList, }) => {
width: '30%', height: '100%', display: 'flex', justifyContent: 'center',
}}>
- {pumpData.length > 0 && <>
+ {capacity?.pump?.length > 0 && <>
{
if (pageLeft > 0) setPageLeft(pageLeft - 1)
}} />
{
- pumpData?.slice(pageLeft * 2, (pageLeft + 1) * 2)?.map((v, index) => {
+ capacity?.pump?.slice(pageLeft * 2, (pageLeft + 1) * 2)?.map((v, index) => {
return
{
{
- 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, }) => {
}}>
湿度:
-
{centreData?.sHumidity} %
+
{capacity?.sun?.sHumidity} %
- 总用量:{centreData?.daySun?.toFixed(2)} kWh
+ 总用量:{capacity?.sun?.daySun?.toFixed(2)} kWh
{
}}>
温度:
-
{centreData?.sTEMP} ℃
+
{capacity?.sun?.sTEMP} ℃
{
}}>
今年用电:
-
{centreData?.day365?.toFixed(2) || '--'} kWh
+
{capacity?.sun?.day365?.toFixed(2) || '--'} kWh
{
}}>
当月用电:
-
{centreData?.day30?.toFixed(2) || '--'} kWh
+
{capacity?.sun?.day30?.toFixed(2) || '--'} kWh
{
}}>
当日用电:
-
{centreData?.day1?.toFixed(2) || '--'} kWh
+
{capacity?.sun?.day1?.toFixed(2) || '--'} kWh
{
},
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, }) => {
{/* 进线柜 */}
- {cabinetData.length > 0 && <>
+ {capacity?.cabinetSun?.length > 0 && <>
{
if (pageRight > 0) setPageRight(pageRight - 1)
}} />
{
- cabinetData?.slice(pageRight * 2, (pageRight + 1) * 2)?.map((v, index) => {
+ capacity?.cabinetSun?.slice(pageRight * 2, (pageRight + 1) * 2)?.map((v, index) => {
return
{
{
- if (pageRight + 1 < Math.ceil(cabinetData.length / 2)) setPageRight(pageRight + 1)
+ if (pageRight + 1 < Math.ceil(capacity?.cabinetSun.length / 2)) setPageRight(pageRight + 1)
}} />>}
@@ -825,7 +473,7 @@ const Capacity = ({ actions, dispatch, siteList, }) => {
areaStyle: {
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',
name: '池前(上游)液位',
@@ -833,7 +481,7 @@ const Capacity = ({ actions, dispatch, siteList, }) => {
areaStyle: {
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 => {
if (v?.length < 4) {
setPumpId(v)
+ setElectricityTrend(currentSix?.filter(d => v.includes(d.id)) || [])
}
}}
- options={pumpList?.map(v => ({ value: v.id, label: v.name })) || []}
+ options={pumpList || []}
/>
{
onChange={v => {
if (v?.length < 4) {
setUsePumpId(v)
+ setUseTrend(currentSix?.filter(d => v.includes(d.id)) || [])
}
}}
- options={pumpList?.map(v => ({ value: v.id, label: v.name })) || []}
+ options={pumpList || []}
/>
{
}
-function mapStateToProps(state) {
- const { auth, global } = state;
+function mapStateToProps (state) {
+ const { auth, global, capacity, waterLevelSix, currentSix } = state;
+
+
return {
user: auth.user,
clientHeight: global.clientHeight,
actions: global.actions,
+ capacity: capacity?.data || {},
+ waterLevelSix: waterLevelSix?.data || [],
+ currentSix: currentSix?.data || [],
};
}
export default connect(mapStateToProps)(Capacity)
\ No newline at end of file
diff --git a/web/client/src/sections/bigScreen/components/electrical.js b/web/client/src/sections/bigScreen/components/electrical.js
index e989250..07c1d37 100644
--- a/web/client/src/sections/bigScreen/components/electrical.js
+++ b/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 LevelTrend from '../components/electrity/levelTrend';
-const Electrical = ({ dispatch, actions, siteList }) => {
+const Electrical = ({ dispatch, actions, siteList, waterLevelSix, currentSix, cabinet }) => {
const { bigScreen } = actions
- const [pageLeft, setPageLeft] = useState(0) //左边翻页
- const [pageRight, setPageRight] = useState(0) //左边翻页
- // const [siteList, setSiteList] = useState([]) //站点列表
const [pumpList, setPumpList] = useState([]) //水泵列表
const [cabinetList, setCabinetList] = useState([]) //水泵列表
const [strucId, setStrucId] = useState() //站点ID
const [pumpId, setPumpId] = useState() //水泵id
const [cabinetId, setCabinetId] = useState() //进线柜id
- const [usePumpId, setUsePumpId] = useState() //水泵id
const [voltagePumpId, setVoltagePumpId] = useState([]) //水泵电压id
const [pumpOne, setPumpOne] = useState({ data: [] }) //单个水泵数据
const [voltagepump, setVoltagePump] = useState([]) //单个水泵数据
-
const [cabinetOne, setCabinetOne] = useState({ data: [] }) //单个进线柜数据
- const [cabinetData, setCabinetData] = useState([]) //进线柜数据
- const [centreData, setCentreData] = useState({}) //中间数据
- const [depthWater, setDepthWater] = useState([]) //液位趋势
- const [electricityTrend, setElectricityTrend] = useState([]) //电流趋势
- const [useTrend, setUseTrend] = useState([]) //用电趋势
-
const [changeable, setChangeable] = useState(true) // 泵站是否可切换
useEffect(() => {
@@ -48,161 +37,69 @@ const Electrical = ({ dispatch, actions, siteList }) => {
setStrucId(nextStructId);
}, [siteList])
- useEffect(async () => {
- if (strucId) {
- await dispatch(bigScreen.axyData({ type: 'get', url: `structures/${strucId}/factors` })).then(async r => {
- if (r.success) {
- //水泵信息
- let waterId = r.payload.data?.find(v => v.name == '泵站水泵')?.id
- if (waterId) {
- await dispatch(bigScreen.axyData({
- type: 'get', url: `structures/${strucId}/stations`,
- params: { query: { factorId: waterId } }
- })).then(async p => {
- if (p.success) {
- let dataId = []
- let voltageId = []
- p.payload.data?.map(v => {
- v.groups?.map(s => {
- s.stations?.map(f => {
- dataId.push(f.id)
- if (voltageId?.length < 3) {
- voltageId.push(f.id)
- }
- })
- })
- })
- setPumpList(p.payload.data[0]?.groups[0]?.stations)
- setPumpId(p.payload.data[0]?.groups[0]?.stations[0]?.id)
- setVoltagePumpId(voltageId)
- setUsePumpId(p.payload.data[0]?.groups[0]?.stations[0]?.id)
- }
- })
- }
- // 进线柜
- 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)
- }
- })
- }
-
-
- // //泵站信息
- 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(d => {
- if (d.success) {
- setDepthWater(d.payload.data?.stations[0]?.data)
- }
- })
- }
-
- })
- }
- }
- })
+ useEffect(() => {
+ if (cabinet?.length) {
+ setCabinetId(cabinet[0].id)
+ setCabinetOne(cabinet[0] || {})
+ setCabinetList(cabinet?.map(v => ({ value: v.id, label: v.name })) || [])
}
+ }, [cabinet])
- }, [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: [] })
- }
- })
+ useEffect(() => {
+ if (currentSix?.length) {
+ setPumpId(currentSix[0].id)
+ setPumpOne(currentSix[0] || {})
+ setVoltagePumpId(currentSix?.slice(0, 3)?.map(v => v.id))
+ setPumpList(currentSix || [])
+ setVoltagePump(currentSix?.slice(0, 3) || [])
+ }
+ }, [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 }))
}
- }, [pumpId])
+ }, [strucId])
- 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
-
-
-
-
+
+
+
+
{
}}>
环境湿度:
-
{depthWater[depthWater.length - 1]?.sHumidity || "--"} %
+
{waterLevelSix[waterLevelSix.length - 1]?.sHumidity || "--"} %
{
环境温度:
-
{depthWater[depthWater.length - 1]?.sTEMP || "--"} ℃
+
{waterLevelSix[waterLevelSix.length - 1]?.sTEMP || "--"} ℃
{
}}>
信号:
-
{depthWater[depthWater.length - 1]?.CSQ4G || "--"}
+
{waterLevelSix[waterLevelSix.length - 1]?.CSQ4G || "--"}
-
集水池水位{depthWater[depthWater?.length - 1]?.sLiquid_level?.toFixed(2) || 0}米
-
池前上游水位{depthWater[depthWater?.length - 1]?.sGrille_level?.toFixed(2) || 0}米
+
集水池水位{waterLevelSix[waterLevelSix?.length - 1]?.sLiquid_level?.toFixed(2) || 0}米
+
池前上游水位{waterLevelSix[waterLevelSix?.length - 1]?.sGrille_level?.toFixed(2) || 0}米
{
}
-function mapStateToProps(state) {
- const { auth, global } = state;
+function mapStateToProps (state) {
+ const { auth, global, waterLevelSix, currentSix, cabinet } = state;
return {
user: auth.user,
clientHeight: global.clientHeight,
actions: global.actions,
+ waterLevelSix: waterLevelSix?.data || [],
+ currentSix: currentSix?.data || [],
+ cabinet: cabinet?.data || [],
+
};
}
diff --git a/web/client/src/sections/bigScreen/components/electrity/lineBoxStatus.js b/web/client/src/sections/bigScreen/components/electrity/lineBoxStatus.js
index ea427d2..a510208 100644
--- a/web/client/src/sections/bigScreen/components/electrity/lineBoxStatus.js
+++ b/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 }) => {
@@ -12,7 +12,7 @@ const LineBoxStatus = ({ user, cabinetId, cabinetList, setCabinetId, cabinetOne
return
@@ -24,6 +24,7 @@ const LineBoxStatus = ({ user, cabinetId, cabinetList, setCabinetId, cabinetOne
optionFilterProp="children"
onSelect={v => {
setCabinetId(v)
+ setCabinetOne(cabinet?.find(d => d.id == v) || {})
}}
options={cabinetList || []}
/>
@@ -63,11 +64,11 @@ const LineBoxStatus = ({ user, cabinetId, cabinetList, setCabinetId, cabinetOne
width: '100%', height: 43, display: 'flex', justifyContent: "space-between", alignItems: 'center'
}}>
-
A相电流:
+
A相电流:
{cabinetOne?.data[0]?.eQF_A_A} A
-
A相电压:
+
A相电压:
{cabinetOne?.data[0]?.eQF_A_V} V
@@ -77,11 +78,11 @@ const LineBoxStatus = ({ user, cabinetId, cabinetList, setCabinetId, cabinetOne
width: '100%', height: 43, display: 'flex', justifyContent: "space-between", alignItems: 'center'
}}>
-
B相电流:
+
B相电流:
{cabinetOne?.data[0]?.eQF_B_A} A
-
B相电压:
+
B相电压:
{cabinetOne?.data[0]?.eQF_B_V} V
@@ -91,11 +92,11 @@ const LineBoxStatus = ({ user, cabinetId, cabinetList, setCabinetId, cabinetOne
width: '100%', height: 43, display: 'flex', justifyContent: "space-between", alignItems: 'center'
}}>
-
C相电流:
+
C相电流:
{cabinetOne?.data[0]?.eQF_C_A} A
-
B相电压:
+
B相电压:
{cabinetOne?.data[0]?.eQF_C_V} V
diff --git a/web/client/src/sections/bigScreen/components/electrity/realTimeStatus.js b/web/client/src/sections/bigScreen/components/electrity/realTimeStatus.js
index a1b9656..9896107 100644
--- a/web/client/src/sections/bigScreen/components/electrity/realTimeStatus.js
+++ b/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 { Select, Modal, Switch, Input, Button, Form, message } from 'antd';
-const RealTimeStatus = (props) => {
- const { dispatch, actions, user, pumpId, pumpList, setPumpId, pumpOne, strucId, siteList, setPumpOne } = props;
+const RealTimeStatus = ({dispatch, actions, user, pumpId, pumpList, setPumpId, pumpOne, strucId, siteList, setPumpOne, currentSix }) => {
+
const { bigScreen } = actions;
const [pwOpen, setPwOpen] = useState(false);
@@ -146,6 +146,7 @@ const RealTimeStatus = (props) => {
onSelect={(v, option) => {
setPumpId(v)
setPumpName(option.label)
+ setPumpOne(currentSix?.find(d => d.id == v) || {})
}}
options={pumpList?.map(v => ({ value: v.id, label: v.name })) || []}
/>
@@ -272,7 +273,7 @@ const RealTimeStatus = (props) => {
}
-function mapStateToProps(state) {
+function mapStateToProps (state) {
const { auth, global } = state;
return {
user: auth.user,
diff --git a/web/client/src/sections/bigScreen/components/electrity/voltageTrend.js b/web/client/src/sections/bigScreen/components/electrity/voltageTrend.js
index 3ff6c5f..d8bc424 100644
--- a/web/client/src/sections/bigScreen/components/electrity/voltageTrend.js
+++ b/web/client/src/sections/bigScreen/components/electrity/voltageTrend.js
@@ -6,7 +6,7 @@ import moment from 'moment'
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 => {
if (v?.length < 4) {
setVoltagePumpId(v)
+ setVoltagePump(currentSix?.filter(d => v.includes(d.id)) || [])
}
}}
diff --git a/web/client/src/sections/bigScreen/components/realTime.js b/web/client/src/sections/bigScreen/components/realTime.js
index 42ca0cc..13279cf 100644
--- a/web/client/src/sections/bigScreen/components/realTime.js
+++ b/web/client/src/sections/bigScreen/components/realTime.js
@@ -36,8 +36,13 @@ const RealTime = ({ dispatch, actions, user, siteList, }) => {
setStrucId(nextStructId);
}, [siteList])
+
+
useEffect(async () => {
if (strucId) {
+
+
+
let station = {}
let week = 0 //本周
let year = 0 //年
@@ -284,34 +289,34 @@ const RealTime = ({ dispatch, actions, user, siteList, }) => {
-
+
本周用电量:{electro?.week?.toFixed(2)}
+ }}> 本周用电量:{electro?.week?.toFixed(2)} kwh
今年用电量:{electro?.year?.toFixed(2)}
+ }}>今年用电量:{electro?.year?.toFixed(2)} kwh
今日用电量:{electro?.day?.toFixed(2)}
+ }}> 今日用电量:{electro?.day?.toFixed(2)} kwh
@@ -343,7 +348,7 @@ const RealTime = ({ dispatch, actions, user, siteList, }) => {
}
-function mapStateToProps(state) {
+function mapStateToProps (state) {
const { auth, global } = state;
return {
user: auth.user,
diff --git a/web/client/src/sections/bigScreen/components/realTime/below.js b/web/client/src/sections/bigScreen/components/realTime/below.js
index 0e22df7..183e616 100644
--- a/web/client/src/sections/bigScreen/components/realTime/below.js
+++ b/web/client/src/sections/bigScreen/components/realTime/below.js
@@ -6,70 +6,26 @@ import moment from 'moment'
const { Option } = Select;
-const Below = ({ dispatch, actions, stations, level }) => {
+const Below = ({ dispatch, actions, stations, level, strucId, threePhase }) => {
const { bigScreen } = actions
const [page, setPage] = useState(0)
const [threePower, setThreePower] = useState([])
const [electricity, setElectricity] = useState([])
+
+ useEffect(() => {
+ if (strucId) {
+ dispatch(bigScreen.getThreePhase({ key: 'threePhase', methodType: 'hget', field: 'struc' + strucId }))
+ }
+ }, [strucId])
+
+
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 = []
-
- 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({
@@ -227,7 +183,7 @@ const Below = ({ dispatch, actions, stations, level }) => {
},
{
type: 'inside',
-
+
},
],
tooltip: {
@@ -267,7 +223,7 @@ const Below = ({ dispatch, actions, stations, level }) => {
areaStyle: {
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',
name: 'B相电流',
@@ -275,7 +231,7 @@ const Below = ({ dispatch, actions, stations, level }) => {
areaStyle: {
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',
name: 'C相电流',
@@ -283,7 +239,7 @@ const Below = ({ dispatch, actions, stations, level }) => {
areaStyle: {
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) {
- const { auth, global } = state;
+ const { auth, global, threePhase } = state;
return {
user: auth.user,
clientHeight: global.clientHeight,
actions: global.actions,
+ threePhase: threePhase?.data || []
};
}
diff --git a/web/client/src/sections/bigScreen/components/video.js b/web/client/src/sections/bigScreen/components/video.js
index 55b68e5..749ba8b 100644
--- a/web/client/src/sections/bigScreen/components/video.js
+++ b/web/client/src/sections/bigScreen/components/video.js
@@ -1,19 +1,57 @@
-import React from 'react';
-
-const Video = () => {
- return
+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])
+
+ return
+}
+
+
+function mapStateToProps (state) {
+ const { auth, global, videoUrl } = state;
+ return {
+ user: auth.user,
+ clientHeight: global.clientHeight,
+ actions: global.actions,
+ videoUrl: videoUrl?.data || []
+ };
}
-export default Video;
\ No newline at end of file
+export default connect(mapStateToProps)(Video);
\ No newline at end of file
diff --git a/web/client/src/sections/bigScreen/containers/systemManagement.js b/web/client/src/sections/bigScreen/containers/systemManagement.js
index 6bfb834..1dc7613 100644
--- a/web/client/src/sections/bigScreen/containers/systemManagement.js
+++ b/web/client/src/sections/bigScreen/containers/systemManagement.js
@@ -26,9 +26,9 @@ const SystemManagement = ({ dispatch, actions, user, history }) => {
useEffect(() => {
const tabKey = sessionStorage.getItem('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) {
- 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 })) || [])
setSitData(res.payload.data)
}
@@ -54,7 +54,7 @@ const SystemManagement = ({ dispatch, actions, user, history }) => {
{module == 'capacity' ?
: ""}
{module == 'electrical' ?
: ""}
{module == 'realTime' ?
: ""}
- {module === 'video' &&
}
+ {module === 'video' &&
}
)
}
diff --git a/web/client/src/utils/webapi.js b/web/client/src/utils/webapi.js
index 5991081..9b0168e 100644
--- a/web/client/src/utils/webapi.js
+++ b/web/client/src/utils/webapi.js
@@ -20,10 +20,9 @@ export const ApiTable = {
login: 'login',
logout: 'logout',
-
axyData: 'axyData', //安心云数据
- pumpInformation:'pumpInformation'
-
+ pumpInformation:'pumpInformation' ,
+ videoUrl:"videoUrl",
};