|
@@ -1,4 +1,5 @@
|
|
|
-import { createSlice, PayloadAction, Middleware } from '@reduxjs/toolkit';
|
|
|
+/* eslint-disable */
|
|
|
+import { createSlice, PayloadAction, Middleware, createAsyncThunk } from '@reduxjs/toolkit';
|
|
|
import { AprConfig, getAprExposureParams } from '../../API/exam/APRActions';
|
|
|
import { workstationIdFromWorkstation } from '../workstation';
|
|
|
|
|
@@ -8,6 +9,10 @@ interface AprState {
|
|
|
workstation: string;
|
|
|
isAECEnabled: boolean;
|
|
|
currentExposureMode: string;
|
|
|
+ /**
|
|
|
+ * 是否正在设置中
|
|
|
+ */
|
|
|
+ isPending:boolean;
|
|
|
}
|
|
|
|
|
|
const initialState: AprState = {
|
|
@@ -29,6 +34,7 @@ const initialState: AprState = {
|
|
|
workstation: '',
|
|
|
isAECEnabled: false,
|
|
|
currentExposureMode: '',
|
|
|
+ isPending:false
|
|
|
};
|
|
|
|
|
|
const aprSlice = createSlice({
|
|
@@ -51,8 +57,111 @@ const aprSlice = createSlice({
|
|
|
state.currentExposureMode = action.payload;
|
|
|
},
|
|
|
},
|
|
|
+ extraReducers: (builder) => {
|
|
|
+ builder
|
|
|
+ .addCase(incKV.pending, (state) => {
|
|
|
+ console.log('Increasing kV...');
|
|
|
+ })
|
|
|
+ .addCase(incKV.fulfilled, (state, action) => {
|
|
|
+ console.log('kV increased successfully');
|
|
|
+ state.aprConfig.kV = action.payload;
|
|
|
+ })
|
|
|
+ .addCase(incKV.rejected, (state, action) => {
|
|
|
+ console.error('Failed to increase kV', action.error);
|
|
|
+ })
|
|
|
+ .addCase(decKV.pending, (state) => {
|
|
|
+ console.log('Decreasing kV...');
|
|
|
+ })
|
|
|
+ .addCase(decKV.fulfilled, (state, action) => {
|
|
|
+ console.log('kV decreased successfully');
|
|
|
+ state.aprConfig.kV = action.payload;
|
|
|
+ })
|
|
|
+ .addCase(decKV.rejected, (state, action) => {
|
|
|
+ console.error('Failed to decrease kV', action.error);
|
|
|
+ })
|
|
|
+ .addCase(incMA.pending, (state) => {
|
|
|
+ console.log('Increasing mA...');
|
|
|
+ })
|
|
|
+ .addCase(incMA.fulfilled, (state, action) => {
|
|
|
+ console.log('mA increased successfully');
|
|
|
+ state.aprConfig.mA = action.payload;
|
|
|
+ })
|
|
|
+ .addCase(incMA.rejected, (state, action) => {
|
|
|
+ console.error('Failed to increase mA', action.error);
|
|
|
+ })
|
|
|
+ .addCase(decMA.pending, (state) => {
|
|
|
+ console.log('Decreasing mA...');
|
|
|
+ })
|
|
|
+ .addCase(decMA.fulfilled, (state, action) => {
|
|
|
+ console.log('mA decreased successfully');
|
|
|
+ state.aprConfig.mA = action.payload;
|
|
|
+ })
|
|
|
+ .addCase(decMA.rejected, (state, action) => {
|
|
|
+ console.error('Failed to decrease mA', action.error);
|
|
|
+ })
|
|
|
+ .addCase(incMAS.pending, (state) => {
|
|
|
+ console.log('Increasing mAs...');
|
|
|
+ })
|
|
|
+ .addCase(incMAS.fulfilled, (state, action) => {
|
|
|
+ console.log('mAs increased successfully');
|
|
|
+ state.aprConfig.mAs = action.payload;
|
|
|
+ })
|
|
|
+ .addCase(incMAS.rejected, (state, action) => {
|
|
|
+ console.error('Failed to increase mAs', action.error);
|
|
|
+ })
|
|
|
+ .addCase(decMAS.pending, (state) => {
|
|
|
+ console.log('Decreasing mAs...');
|
|
|
+ })
|
|
|
+ .addCase(decMAS.fulfilled, (state, action) => {
|
|
|
+ console.log('mAs decreased successfully');
|
|
|
+ state.aprConfig.mAs = action.payload;
|
|
|
+ })
|
|
|
+ .addCase(decMAS.rejected, (state, action) => {
|
|
|
+ console.error('Failed to decrease mAs', action.error);
|
|
|
+ })
|
|
|
+ .addCase(incMS.pending, (state) => {
|
|
|
+ console.log('Increasing ms...');
|
|
|
+ })
|
|
|
+ .addCase(incMS.fulfilled, (state, action) => {
|
|
|
+ console.log('ms increased successfully');
|
|
|
+ state.aprConfig.ms = action.payload;
|
|
|
+ })
|
|
|
+ .addCase(incMS.rejected, (state, action) => {
|
|
|
+ console.error('Failed to increase ms', action.error);
|
|
|
+ })
|
|
|
+ .addCase(decMS.pending, (state) => {
|
|
|
+ console.log('Decreasing ms...');
|
|
|
+ })
|
|
|
+ .addCase(decMS.fulfilled, (state, action) => {
|
|
|
+ console.log('ms decreased successfully');
|
|
|
+ state.aprConfig.ms = action.payload;
|
|
|
+ })
|
|
|
+ .addCase(decMS.rejected, (state, action) => {
|
|
|
+ console.error('Failed to decrease ms', action.error);
|
|
|
+ })
|
|
|
+ .addCase(incDensity.pending, (state) => {
|
|
|
+ console.log('Increasing Density...');
|
|
|
+ })
|
|
|
+ .addCase(incDensity.fulfilled, (state, action) => {
|
|
|
+ console.log('Density increased successfully');
|
|
|
+ state.aprConfig.AECDensity = action.payload;
|
|
|
+ })
|
|
|
+ .addCase(incDensity.rejected, (state, action) => {
|
|
|
+ console.error('Failed to increase Density', action.error);
|
|
|
+ })
|
|
|
+ .addCase(decDensity.pending, (state) => {
|
|
|
+ console.log('Decreasing Density...');
|
|
|
+ })
|
|
|
+ .addCase(decDensity.fulfilled, (state, action) => {
|
|
|
+ console.log('Density decreased successfully');
|
|
|
+ state.aprConfig.AECDensity = action.payload;
|
|
|
+ })
|
|
|
+ .addCase(decDensity.rejected, (state, action) => {
|
|
|
+ console.error('Failed to decrease Density', action.error);
|
|
|
+ });
|
|
|
+ },
|
|
|
});
|
|
|
-// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
|
+
|
|
|
const aprMiddleware: Middleware = (store) => (next) => (action: any) => {
|
|
|
if (
|
|
|
action.type === aprSlice.actions.setBodysize.type ||
|
|
@@ -87,6 +196,46 @@ const aprMiddleware: Middleware = (store) => (next) => (action: any) => {
|
|
|
}
|
|
|
return next(action);
|
|
|
};
|
|
|
+
|
|
|
+export const incKV = createAsyncThunk<number, number>('apr/incKV', async (amount: number) => {
|
|
|
+ return amount;
|
|
|
+});
|
|
|
+
|
|
|
+export const decKV = createAsyncThunk<number, number>('apr/decKV', async (amount: number) => {
|
|
|
+ return amount;
|
|
|
+});
|
|
|
+
|
|
|
+export const incMA = createAsyncThunk<number, number>('apr/incMA', async (amount: number) => {
|
|
|
+ return amount;
|
|
|
+});
|
|
|
+
|
|
|
+export const decMA = createAsyncThunk<number, number>('apr/decMA', async (amount: number) => {
|
|
|
+ return amount;
|
|
|
+});
|
|
|
+
|
|
|
+export const incMAS = createAsyncThunk<number, number>('apr/incMAS', async (amount: number) => {
|
|
|
+ return amount;
|
|
|
+});
|
|
|
+
|
|
|
+export const decMAS = createAsyncThunk<number, number>('apr/decMAS', async (amount: number) => {
|
|
|
+ return amount;
|
|
|
+});
|
|
|
+
|
|
|
+export const incMS = createAsyncThunk<number, number>('apr/incMS', async (amount: number) => {
|
|
|
+ return amount;
|
|
|
+});
|
|
|
+
|
|
|
+export const decMS = createAsyncThunk<number, number>('apr/decMS', async (amount: number) => {
|
|
|
+ return amount;
|
|
|
+});
|
|
|
+
|
|
|
+export const incDensity = createAsyncThunk<number, number>('apr/incDensity', async (amount: number) => {
|
|
|
+ return amount;
|
|
|
+});
|
|
|
+
|
|
|
+export const decDensity = createAsyncThunk<number, number>('apr/decDensity', async (amount: number) => {
|
|
|
+ return amount;
|
|
|
+});
|
|
|
|
|
|
export const {
|
|
|
setAprConfig,
|
|
@@ -95,5 +244,6 @@ export const {
|
|
|
setIsAECEnabled,
|
|
|
setCurrentExposureMode,
|
|
|
} = aprSlice.actions;
|
|
|
+
|
|
|
export default aprSlice.reducer;
|
|
|
export { aprMiddleware };
|