update data
This commit is contained in:
41
src/store/features/cuttingSlice.js
Normal file
41
src/store/features/cuttingSlice.js
Normal file
@@ -0,0 +1,41 @@
|
||||
import { createSlice } from "@reduxjs/toolkit";
|
||||
|
||||
export const initialState = {
|
||||
table: [],
|
||||
chart: {
|
||||
year: [],
|
||||
week: [],
|
||||
month: [],
|
||||
day: [],
|
||||
},
|
||||
};
|
||||
|
||||
const cuttingSlice = createSlice({
|
||||
name: "cutting",
|
||||
initialState,
|
||||
reducers: {
|
||||
setCuttingTable: (state, action) => {
|
||||
console.log("setting cuttting table...");
|
||||
state.table = action.payload;
|
||||
},
|
||||
setCuttingChart: (state, action) => {
|
||||
switch (action.payload.dateType) {
|
||||
case "year":
|
||||
state.chart.year = action.payload.detData;
|
||||
break;
|
||||
case "weekly":
|
||||
state.chart.week = action.payload.detData;
|
||||
break;
|
||||
case "month":
|
||||
state.chart.month = action.payload.detData;
|
||||
break;
|
||||
case "day":
|
||||
state.chart.day = action.payload.detData;
|
||||
break;
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
export default cuttingSlice.reducer;
|
||||
export const { setCuttingTable, setCuttingChart } = cuttingSlice.actions;
|
||||
@@ -12,6 +12,7 @@ import energySlice from "./features/EnergySlice";
|
||||
import israReducer from "./features/QualityIsraSlice";
|
||||
import annealFanFrequenceReducer from "./features/annealFanFrequenceSlice";
|
||||
import annealFanInfoReducer from "./features/annealFanInfoSlice";
|
||||
import cuttingReducer from "./features/cuttingSlice";
|
||||
|
||||
export const store = configureStore({
|
||||
reducer: {
|
||||
@@ -41,5 +42,7 @@ export const store = configureStore({
|
||||
energy: energySlice,
|
||||
// 能耗
|
||||
isra: israReducer,
|
||||
// 切割
|
||||
cutting: cuttingReducer
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user