update 能源,规格:

This commit is contained in:
lb
2023-12-28 15:16:23 +08:00
parent c2802627d6
commit 4e73410495
8 changed files with 461 additions and 330 deletions

View File

@@ -13,6 +13,76 @@ export const initialState = {
// 天然气2
ngQty2: "0", // m³
},
trend: {
natGas1: {
// 暂时只存了周数据:
week: [],
month: [],
year: [],
},
natGasII: {
week: [],
month: [],
year: [],
},
elec: {
week: [
// { qty: 10, time: "01" },
// { qty: 20, time: "02" },
// { qty: 30, time: "03" },
// { qty: 40, time: "04" },
// { qty: 50, time: "05" },
// { qty: 60, time: "06" },
// { qty: 70, time: "07" },
],
month: [
// { qty: 20, time: "02" },
// { qty: 30, time: "03" },
// { qty: 40, time: "04" },
// { qty: 50, time: "05" },
// { qty: 60, time: "06" },
// { qty: 70, time: "07" },
// { qty: 80, time: "08" },
// { qty: 90, time: "09" },
// { qty: 100, time: "10" },
// { qty: 110, time: "11" },
// { qty: 120, time: "12" },
// { qty: 130, time: "13" },
// { qty: 140, time: "14" },
// { qty: 150, time: "15" },
// { qty: 160, time: "16" },
// { qty: 170, time: "17" },
// { qty: 180, time: "18" },
// { qty: 190, time: "19" },
// { qty: 200, time: "20" },
// { qty: 210, time: "21" },
// { qty: 220, time: "22" },
// { qty: 230, time: "23" },
// { qty: 240, time: "24" },
// { qty: 250, time: "25" },
// { qty: 260, time: "26" },
// { qty: 270, time: "27" },
// { qty: 280, time: "28" },
// { qty: 290, time: "29" },
// { qty: 300, time: "30" },
// { qty: 310, time: "31" },
],
year: [
// { qty: 10, time: "01" },
// { qty: 20, time: "02" },
// { qty: 30, time: "03" },
// { qty: 40, time: "04" },
// { qty: 50, time: "05" },
// { qty: 60, time: "06" },
// { qty: 70, time: "07" },
// { qty: 80, time: "08" },
// { qty: 90, time: "09" },
// { qty: 100, time: "10" },
// { qty: 110, time: "11" },
// { qty: 120, time: "12" },
],
},
},
};
const energySlice = createSlice({
@@ -22,6 +92,23 @@ const energySlice = createSlice({
setInfo: (state, action) => {
state.info = { ...state.info, ...action.payload };
},
setElecTrend: (state, action) => {
state.trend.elec = action.payload;
},
setSumGasData: (state, action) => {
if ("sumGas1Now" in action.payload) {
state.info.ngQty1 = action.payload.sumGas1Now;
}
if ("sumGas2Now" in action.payload) {
state.info.ngQty2 = action.payload.sumGas2Now;
}
if ("hisSumGas1" in action.payload) {
state.trend.natGas1.week = action.payload.hisSumGas1;
}
if ("hisSumGas2" in action.payload) {
state.trend.natGas2.week = action.payload.hisSumGas2;
}
},
},
});