From 2722ca6122433b773d07871f1d9d3567d24a8487 Mon Sep 17 00:00:00 2001 From: lb Date: Thu, 28 Dec 2023 16:59:43 +0800 Subject: [PATCH] update --- .../Common/Energy/EnergyCostChart/index.jsx | 2 -- src/components/Common/Energy/index.jsx | 24 ++++++++++++------- .../Common/SmokeHandle/index.module.scss | 2 +- .../Common/TodayFaultTotal/index.jsx | 1 - .../components/GoodRateChart/index.jsx | 3 --- src/hooks/useTimeCounter.js | 1 - src/store/features/EnergySlice.js | 2 +- src/utils/IS.ts | 21 ++++++++-------- src/utils/checkTypeHelper.ts | 14 +++++++---- src/utils/cutting.ts | 2 +- src/utils/index.ts | 8 +++---- 11 files changed, 43 insertions(+), 37 deletions(-) diff --git a/src/components/Common/Energy/EnergyCostChart/index.jsx b/src/components/Common/Energy/EnergyCostChart/index.jsx index 42a923d..66aa567 100644 --- a/src/components/Common/Energy/EnergyCostChart/index.jsx +++ b/src/components/Common/Energy/EnergyCostChart/index.jsx @@ -73,8 +73,6 @@ const EnergyCostChart = (props) => { export default EnergyCostChart; function getOptions(period, source, trend) { - console.log("trend ==> ", trend); - return { color: ["#FFD160", "#12FFF5", "#2760FF"], grid: { top: 32, right: 12, bottom: 56, left: 48 }, diff --git a/src/components/Common/Energy/index.jsx b/src/components/Common/Energy/index.jsx index edeebe1..7a1576f 100644 --- a/src/components/Common/Energy/index.jsx +++ b/src/components/Common/Energy/index.jsx @@ -19,20 +19,28 @@ function EnergyCost(props) {
- 水耗量 :{" "} - {energyInfo?.waterQty || 0}Km³ + 水耗量: + + {energyInfo?.waterQty || 0}Km³ +
- 天然气I :{" "} - {energyInfo?.ngQty1 || 0}m³ + 天然气I: + + {energyInfo?.ngQty1 || 0} +
- 电耗量 :{" "} - {energyInfo?.elecQty2 || 0}kWh + 电耗量: + + {energyInfo?.elecQty2 || 0}kWh +
- 天然气II{" "} - : {energyInfo?.ngQty2 || 0}m³ + 天然气II: + + {energyInfo?.ngQty2 || 0} +
diff --git a/src/components/Common/SmokeHandle/index.module.scss b/src/components/Common/SmokeHandle/index.module.scss index f4e37e1..bb8632c 100644 --- a/src/components/Common/SmokeHandle/index.module.scss +++ b/src/components/Common/SmokeHandle/index.module.scss @@ -15,7 +15,7 @@ box-shadow: inset 0 0 17px 0px hsla(0, 0%, 100%, 0.15); // width: 288px; height: 56px; - font-size: 20px; + font-size: 16px; letter-spacing: 1.43px; line-height: 56px; text-align: center; diff --git a/src/components/Common/TodayFaultTotal/index.jsx b/src/components/Common/TodayFaultTotal/index.jsx index bdebb24..987a331 100644 --- a/src/components/Common/TodayFaultTotal/index.jsx +++ b/src/components/Common/TodayFaultTotal/index.jsx @@ -73,7 +73,6 @@ function preHandleStatisticData(data, legend) { }); }); - console.log("obj", obj) const series = Array(legend.length) .fill(1) .map((_) => ({ diff --git a/src/components/Common/TodayGood/components/GoodRateChart/index.jsx b/src/components/Common/TodayGood/components/GoodRateChart/index.jsx index 1c3d6c4..c5b6e5e 100644 --- a/src/components/Common/TodayGood/components/GoodRateChart/index.jsx +++ b/src/components/Common/TodayGood/components/GoodRateChart/index.jsx @@ -15,8 +15,6 @@ const GoodRateChart = (props) => { const [dateType, setDateType] = useState("day"); const cutting = useSelector((state) => state.cutting); - console.log("cutting chart", dateType, cutting.chart[dateType]); - useEffect(() => { setUpdateKey(Date.now()); }, [showMore]); @@ -80,7 +78,6 @@ const GoodRateChart = (props) => { export default GoodRateChart; function getOptions(dataList, showMore, dateType) { - console.log("showmore", showMore); const list = [...dataList].sort((a, b) => a.dataTime - b.dataTime); // data: Array(7) // .fill(1) diff --git a/src/hooks/useTimeCounter.js b/src/hooks/useTimeCounter.js index d5e7700..0da16b7 100644 --- a/src/hooks/useTimeCounter.js +++ b/src/hooks/useTimeCounter.js @@ -5,7 +5,6 @@ function useTimeCounter(time) { const [timeTuple, setTimeTuple] = useState([0, 0]); useEffect(() => { - console.log("time counter executed..."); if (time == null) return; let timer = null; if (/分/.test(time) && /秒/.test(time)) { diff --git a/src/store/features/EnergySlice.js b/src/store/features/EnergySlice.js index 31c857a..445d0ca 100644 --- a/src/store/features/EnergySlice.js +++ b/src/store/features/EnergySlice.js @@ -20,7 +20,7 @@ export const initialState = { month: [], year: [], }, - natGasII: { + natGas2: { week: [], month: [], year: [], diff --git a/src/utils/IS.ts b/src/utils/IS.ts index 767b6f7..45844c4 100644 --- a/src/utils/IS.ts +++ b/src/utils/IS.ts @@ -11,12 +11,13 @@ export default function handler(msg: MessageEvent) { console.log("[ISRA DATA] ---> ", serializedData); - if (serializedData == null) return; + if (serializedData == null || serializedData.detData == null) return; + const { detData } = serializedData; // 处理 checkTypeList store.dispatch({ type: "isra/setCheckType", - payload: serializedData.checkType, + payload: detData.checkType, }); // for (const checkType of serializedData.checkTypeList) { // store.dispatch({ @@ -26,25 +27,25 @@ export default function handler(msg: MessageEvent) { // } // 处理 dayStatistic 等数据 - if ("dayStatistic" in serializedData) { + if ("dayStatistic" in detData) { store.dispatch({ type: "isra/setDayStatistic", - payload: serializedData.dayStatistic, + payload: detData.dayStatistic, }); - } else if ("weekStatistic" in serializedData) { + } else if ("weekStatistic" in detData) { store.dispatch({ type: "isra/setWeekStatistic", - payload: serializedData.weekStatistic, + payload: serializedData.detData, }); - } else if ("monthStatistic" in serializedData) { + } else if ("monthStatistic" in detData) { store.dispatch({ type: "isra/setMonthStatistic", - payload: serializedData.monthStatistic, + payload: detData.monthStatistic, }); - } else if ("yearStatistic" in serializedData) { + } else if ("yearStatistic" in detData) { store.dispatch({ type: "isra/setYearStatistic", - payload: serializedData.yearStatistic, + payload: detData.yearStatistic, }); } } diff --git a/src/utils/checkTypeHelper.ts b/src/utils/checkTypeHelper.ts index 4271223..dfdf158 100644 --- a/src/utils/checkTypeHelper.ts +++ b/src/utils/checkTypeHelper.ts @@ -14,9 +14,13 @@ type ProductLineItem = { }; export type MessageItem = { - checkType: string[]; - dayStatistic?: ProductLineItem[]; - weekStatistic?: ProductLineItem[]; - monthStatistic?: ProductLineItem[]; - yearStatistic?: ProductLineItem[]; + type: string; + name: string; + detData: { + checkType: string[]; + dayStatistic?: ProductLineItem[]; + weekStatistic?: ProductLineItem[]; + monthStatistic?: ProductLineItem[]; + yearStatistic?: ProductLineItem[]; + }; }; diff --git a/src/utils/cutting.ts b/src/utils/cutting.ts index 6db47d5..4dc3128 100644 --- a/src/utils/cutting.ts +++ b/src/utils/cutting.ts @@ -21,7 +21,7 @@ export default function handler(msg: MessageEvent) { console.log("[*] websocket: [unable to serialize] ---> ", msg); } - console.log("[CUTTING DATA] ---> ", serializedData); + // console.log("[CUTTING DATA] ---> ", serializedData); if (serializedData == null) return; diff --git a/src/utils/index.ts b/src/utils/index.ts index 14ce1ea..5145797 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -22,7 +22,7 @@ class XClient { this.name = name; this.ws = new WebSocket(url); this.ws.onopen = () => { - console.log(`[*] ${this.name} ws connected`); + // console.log(`[*] ${this.name} ws connected`); }; this.ws.onmessage = onmessage; this.ws.onerror = (err) => { @@ -44,8 +44,8 @@ new XClient( const newUser = uuidv4(); new XClient( - "ws://192.168.1.74:48080/websocket/message?userId=ENERGY" + newUser, - // "ws://10.70.2.2:8080/websocket/message?userId=ENERGY" + newUser, + // "ws://192.168.1.74:48080/websocket/message?userId=ENERGY" + newUser, + "ws://10.70.2.2:8080/websocket/message?userId=ENERGY" + newUser, // "ws://192.168.1.74:48080/websocket/message?userId=ENERGY111", "MES_DATA", energeHandler @@ -70,7 +70,7 @@ new XClient( // 烟气处理相关数据 new XClient( // "ws://10.70.27.122:8080/websocket/message?userId=CUTTING", - "ws://192.168.1.62:48082/websocket/message?userId=" + newUser, + "ws://10.70.2.2:8080/websocket/message?userId=GAS" + newUser, "SMOKE_DATA", smokeHandler );