diff --git a/api/.vscode/launch.json b/api/.vscode/launch.json index 705376c..65b3714 100644 --- a/api/.vscode/launch.json +++ b/api/.vscode/launch.json @@ -15,12 +15,13 @@ "args": [ "-p 4900", // 研发 - "-g postgres://postgres:123456@10.8.30.166:5432/PumpStation", + "-g postgres://postgres:123456@10.8.16.77:5432/PumpStation", // "-g postgres://FashionAdmin:123456@10.8.30.166:5432/PumpStation", // "-x http://221.230.55.28:7007", //商用代理 "-x https://iotaproxy.anxinyun.cn", //商用代理 "--redisHost localhost", "--redisPort 6379", + "--waterWebUrl http://10.8.16.58:5000", // 水环境web // 测试 // "--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 5a1e89b..0553f5b 100644 --- a/api/app/lib/controllers/bigScreen/index .js +++ b/api/app/lib/controllers/bigScreen/index .js @@ -2,7 +2,7 @@ const Hex = require('crypto-js/enc-hex'); const MD5 = require('crypto-js/md5'); const moment = require('moment'); - +const request = require('superagent'); let axyTokenCache = { @@ -61,10 +61,11 @@ const pumpInformation = async function (ctx) { try { const models = ctx.fs.dc.models; const { page, limit, name } = ctx.query; - const res = await models.PumpInformation.findAll(); + // const res = await models.PumpInformation.findAll(); + const res = await request.get(`${ctx.app.fs.opts.waterWebUrl}/assets/data/shuibengDetail.json`) ctx.status = 200; - ctx.body = res; + ctx.body = res.body; } catch (error) { ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); ctx.status = 400; diff --git a/api/config.js b/api/config.js index 2e18e10..daccc4f 100644 --- a/api/config.js +++ b/api/config.js @@ -19,12 +19,14 @@ args.option('apiAnxinyunUrl', "安心云api"); args.option('axyProject', '安心云泵站项目信息'); args.option(['x', 'iota-proxy'], 'iota代理URL'); +args.option('waterWebUrl', '水环境web'); const flags = args.parse(process.argv); 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 +const WATER_WEB_URL = process.env.WATER_WEB_URL || flags.waterWebUrl // Redis 参数 const IOTA_REDIS_SERVER_HOST = process.env.IOTA_REDIS_SERVER_HOST || flags.redisHost || "localhost";//redis IP @@ -49,13 +51,13 @@ const product = { opts: { maxSize: 104857600, // 100M } - },{ + }, { entry: require('./utils/iota-api').entry, opts: { - host: ANXINCLOUD_PROXY_IOTA, - match: '/_iota_api' + host: ANXINCLOUD_PROXY_IOTA, + match: '/_iota_api' } - }, { + }, { entry: require('./app').entry, opts: { dev, @@ -64,6 +66,7 @@ const product = { ], // 不做认证的路由,也可以使用 exclude: ["*"] 跳过所有路由 // apiAnxinyunUrl: API_ANXINYUN_URL, axyProject: AXY_BZ_PROJECT, + waterWebUrl: WATER_WEB_URL, redis: { host: IOTA_REDIS_SERVER_HOST, port: IOTA_REDIS_SERVER_PORT, @@ -73,11 +76,11 @@ const product = { name: 'anxinyun', root: API_ANXINYUN_URL }, - // {// name 会作为一个 request 出现在 ctx.app.fs - // name: 'iota', - // root: ANXINCLOUD_PROXY_IOTA - // } - ], + // {// name 会作为一个 request 出现在 ctx.app.fs + // name: 'iota', + // root: ANXINCLOUD_PROXY_IOTA + // } + ], } } ], diff --git a/web/client/src/sections/bigScreen/components/basis.js b/web/client/src/sections/bigScreen/components/basis.js index 61ff13c..53105e9 100644 --- a/web/client/src/sections/bigScreen/components/basis.js +++ b/web/client/src/sections/bigScreen/components/basis.js @@ -17,7 +17,7 @@ const Basis = ({ actions, dispatch, setshowData, siteList, siteData, waterLevelS const [strucId, setStrucId] = useState() //站点ID const [information, setInformation] = useState({}) - const [pumpInformation, setPumpInformation] = useState([]) + const [pumpInformation, setPumpInformation] = useState({}) const [pumpNumber, setPumpNumber] = useState(0) useEffect(() => { @@ -29,8 +29,8 @@ const Basis = ({ actions, dispatch, setshowData, siteList, siteData, waterLevelS }, []) useEffect(() => { - if (pumpInformation?.length && strucId) { - setInformation(pumpInformation?.find(v => v.structureId == strucId) || {}) + if (pumpInformation && strucId) { + setInformation(Object.values(pumpInformation)?.find(v => v.structId == strucId) || {}) } }, [pumpInformation, strucId]) diff --git a/web/client/src/sections/bigScreen/components/basis/right_1.js b/web/client/src/sections/bigScreen/components/basis/right_1.js index c93f11c..c31dd92 100644 --- a/web/client/src/sections/bigScreen/components/basis/right_1.js +++ b/web/client/src/sections/bigScreen/components/basis/right_1.js @@ -4,7 +4,7 @@ import { Select } from 'antd'; import '../basis.less'; import './right_1.less'; -export default function Right_1 ({ data, siteList, pumpInformation, setPumpInformation, strucId, setStrucId, POWER_STATIONS, setInformation }) { +export default function Right_1({ data, siteList, pumpInformation, setPumpInformation, strucId, setStrucId, POWER_STATIONS, setInformation }) { const renderSelect = () => { return