|
@@ -53,6 +53,12 @@ export const fetchViewsOrProtocols = createAsyncThunk(
|
|
|
try {
|
|
|
console.log(`触发查询,查询条件是:${JSON.stringify(filter)}`);
|
|
|
|
|
|
+ // 验证必填条件
|
|
|
+ if (!filter.patientType || !filter.bodyPart) {
|
|
|
+ console.warn('缺少必填过滤条件:patientType 或 bodyPart');
|
|
|
+ return rejectWithValue('缺少必填过滤条件:患者类型和身体部位必须选择');
|
|
|
+ }
|
|
|
+
|
|
|
if (filter.selection === 'protocol') {
|
|
|
const response = await fetchProcedures(
|
|
|
filter.patientType,
|
|
@@ -130,6 +136,12 @@ const viewSelectionSlice = createSlice({
|
|
|
// console.log(`在view section中感知到 current patient type 变化: ${currentPatientType.patient_type_name}`);
|
|
|
// 基于过滤条件查询协议或者体位
|
|
|
state.currentPatientType = currentPatientType;
|
|
|
+ } else {
|
|
|
+ // 患者类型被清空,清空相关数据
|
|
|
+ state.currentPatientType = null;
|
|
|
+ state.protocols = [];
|
|
|
+ state.availableViews = [];
|
|
|
+ console.log('患者类型已清空,协议和体位列表已重置');
|
|
|
}
|
|
|
})
|
|
|
.addCase(setCurrentBodyPart, (state, action) => {
|
|
@@ -137,6 +149,12 @@ const viewSelectionSlice = createSlice({
|
|
|
if (currentBodyPart) {
|
|
|
state.currentBodyPart = currentBodyPart;
|
|
|
// console.log(`在view section中感知到 currentBodyPart 变化: ${JSON.stringify(currentBodyPart, null, 2)}`);
|
|
|
+ } else {
|
|
|
+ // 身体部位被清空,清空相关数据
|
|
|
+ state.currentBodyPart = null;
|
|
|
+ state.protocols = [];
|
|
|
+ state.availableViews = [];
|
|
|
+ console.log('身体部位已清空,协议和体位列表已重置');
|
|
|
}
|
|
|
})
|
|
|
.addCase(setSelected, (state, action) => {
|