Преглед на файлове

refactor(examination): 移除专业相关字段和逻辑,简化课程选择条件

将专业选择相关字段和逻辑移除,课程选择现在仅依赖学期ID
同时清理了不再使用的代码和注释
tanshanming преди 7 месеца
родител
ревизия
1891ce78a0
променени са 2 файла, в които са добавени 76 реда и са изтрити 77 реда
  1. 36 37
      src/views/exm/examinationManagement/form.vue
  2. 40 40
      src/views/exm/questionnaireManagement/form.vue

+ 36 - 37
src/views/exm/examinationManagement/form.vue

@@ -30,15 +30,15 @@
 					</a-select-option>
 				</a-select>
 			</a-form-item>
-			<a-form-item label="专业" name="majorId">
+			<!-- <a-form-item label="专业" name="majorId">
 				<a-select v-model:value="form.majorId" placeholder="请选择专业" allowClear @change="handleMajorChange">
 					<a-select-option v-for="item in majorList" :key="item.id" :value="item.id">
 						{{ item.majorName }}
 					</a-select-option>
 				</a-select>
-			</a-form-item>
+			</a-form-item> -->
 			<a-form-item label="课程" name="courseId">
-				<a-select v-model:value="form.courseId" placeholder="请选择课程" allowClear :disabled="!form.majorId">
+				<a-select v-model:value="form.courseId" placeholder="请选择课程" allowClear :disabled="!form.semesterId">
 					<a-select-option v-for="item in courseList" :key="item.courseId" :value="item.courseId">
 						{{ item.courseName }}
 					</a-select-option>
@@ -112,11 +112,11 @@
 				:pagination="false"
 				style="margin-top: 16px"
 			>
-				<template #bodyCell="{ column, record }">
+				<!-- <template #bodyCell="{ column, record }">
 					<template v-if="column.key === 'subjectId'">
 						{{ subjectEnumFormat(record.subjectId) }}
 					</template>
-				</template>
+				</template> -->
 			</a-table>
 			<a-pagination
 				v-show="paperPage.total > 0"
@@ -164,8 +164,8 @@
 		startTime: null,
 		endTime: null,
 		examStatus: 0,
-		semesterId: null,
-		majorId: null
+		semesterId: null
+		// majorId: null
 	})
 
 	const rules = {
@@ -220,21 +220,21 @@
 		courseList.value = []
 
 		// 如果学期和专业都已选择,则查询课程列表
-		if (value && form.majorId) {
+		if (value) {
 			loadCourseList()
 		}
 	}
 
 	// 专业变更处理函数
-	const handleMajorChange = (value) => {
-		form.courseId = null
-		courseList.value = []
+	// const handleMajorChange = (value) => {
+	// 	form.courseId = null
+	// 	courseList.value = []
 
-		// 如果学期和专业都已选择,则查询课程列表
-		if (value && form.semesterId) {
-			loadCourseList()
-		}
-	}
+	// 	// 如果学期和专业都已选择,则查询课程列表
+	// 	if (value && form.semesterId) {
+	// 		loadCourseList()
+	// 	}
+	// }
 
 	// 加载课程列表
 	const loadCourseList = () => {
@@ -243,8 +243,7 @@
 		// 根据选择的学期和专业加载课程列表
 		resourceAuditApi
 			.courseAllList({
-				semesterId: form.semesterId,
-				majorId: form.majorId
+				semesterId: form.semesterId
 			})
 			.then((res) => {
 				if (res.code === 200) {
@@ -268,7 +267,7 @@
 
 	// 试卷类型变更
 	const paperTypeChange = () => {
-		paperPage.queryParam.subjectId = null
+		paperPage.queryParam.paperId = null
 		form.paperId = null
 		selectedPaperName.value = ''
 	}
@@ -361,7 +360,7 @@
 		form.examName = ''
 		form.paperId = null
 		form.semesterId = null // 重置学期
-		form.majorId = null // 重置专业
+		// form.majorId = null // 重置专业
 		form.courseId = null
 		form.startTime = null
 		form.endTime = null
@@ -395,7 +394,7 @@
 					}
 
 					// 如果是编辑模式,需要根据已有数据加载相应的课程列表
-					if (re.semesterId && re.majorId) {
+					if (re.semesterId) {
 						// 直接加载课程列表
 						loadCourseList()
 					}
@@ -425,22 +424,22 @@
 				semesterLoading()
 			})
 		// 加载专业
-		const majorLoading = message.loading('正在加载专业列表...', 0)
-		resourceAuditApi
-			.majordownList()
-			.then((res) => {
-				if (res.code === 200) {
-					majorList.value = res.data
-				} else {
-					message.error('加载专业列表失败:' + (res.msg || '未知错误'))
-				}
-			})
-			.catch((err) => {
-				message.error('加载专业列表失败:' + (err.message || '网络错误'))
-			})
-			.finally(() => {
-				majorLoading()
-			})
+		// const majorLoading = message.loading('正在加载专业列表...', 0)
+		// resourceAuditApi
+		// 	.majordownList()
+		// 	.then((res) => {
+		// 		if (res.code === 200) {
+		// 			majorList.value = res.data
+		// 		} else {
+		// 			message.error('加载专业列表失败:' + (res.msg || '未知错误'))
+		// 		}
+		// 	})
+		// 	.catch((err) => {
+		// 		message.error('加载专业列表失败:' + (err.message || '网络错误'))
+		// 	})
+		// 	.finally(() => {
+		// 		majorLoading()
+		// 	})
 	})
 </script>
 

+ 40 - 40
src/views/exm/questionnaireManagement/form.vue

@@ -30,15 +30,15 @@
 					</a-select-option>
 				</a-select>
 			</a-form-item>
-			<a-form-item label="专业" name="majorId">
+			<!-- <a-form-item label="专业" name="majorId">
 				<a-select v-model:value="form.majorId" placeholder="请选择专业" allowClear @change="handleMajorChange">
 					<a-select-option v-for="item in majorList" :key="item.id" :value="item.id">
 						{{ item.majorName }}
 					</a-select-option>
 				</a-select>
-			</a-form-item>
+			</a-form-item> -->
 			<a-form-item label="课程" name="courseId">
-				<a-select v-model:value="form.courseId" placeholder="请选择课程" allowClear :disabled="!form.majorId">
+				<a-select v-model:value="form.courseId" placeholder="请选择课程" allowClear :disabled="!form.semesterId">
 					<a-select-option v-for="item in courseList" :key="item.courseId" :value="item.courseId">
 						{{ item.courseName }}
 					</a-select-option>
@@ -91,6 +91,7 @@
 						v-model:value="paperPage.queryParam.paperType"
 						placeholder="请选择试卷类型"
 						@change="paperTypeChange"
+						disabled
 					>
 						<a-select-option v-for="item in paperTypeEnum" :key="item.key" :value="item.key">
 							{{ item.value }}
@@ -111,11 +112,11 @@
 				:pagination="false"
 				style="margin-top: 16px"
 			>
-				<template #bodyCell="{ column, record }">
+				<!-- <template #bodyCell="{ column, record }">
 					<template v-if="column.key === 'subjectId'">
 						{{ subjectEnumFormat(record.subjectId) }}
 					</template>
-				</template>
+				</template> -->
 			</a-table>
 			<a-pagination
 				v-show="paperPage.total > 0"
@@ -163,8 +164,8 @@
 		startTime: null,
 		endTime: null,
 		examStatus: 0,
-		semesterId: null,
-		majorId: null
+		semesterId: null
+		// majorId: null
 	})
 
 	const rules = {
@@ -193,8 +194,8 @@
 		selectedPaper: null,
 		showDialog: false,
 		queryParam: {
-			subjectId: null,
-			paperType: null,
+			paperId: null,
+			paperType: '5',
 			pageIndex: 1,
 			pageSize: 5
 		},
@@ -219,21 +220,21 @@
 		courseList.value = []
 
 		// 如果学期和专业都已选择,则查询课程列表
-		if (value && form.majorId) {
+		if (value) {
 			loadCourseList()
 		}
 	}
 
 	// 专业变更处理函数
-	const handleMajorChange = (value) => {
-		form.courseId = null
-		courseList.value = []
+	// const handleMajorChange = (value) => {
+	// 	form.courseId = null
+	// 	courseList.value = []
 
-		// 如果学期和专业都已选择,则查询课程列表
-		if (value && form.semesterId) {
-			loadCourseList()
-		}
-	}
+	// 	// 如果学期和专业都已选择,则查询课程列表
+	// 	if (value && form.semesterId) {
+	// 		loadCourseList()
+	// 	}
+	// }
 
 	// 加载课程列表
 	const loadCourseList = () => {
@@ -242,8 +243,7 @@
 		// 根据选择的学期和专业加载课程列表
 		resourceAuditApi
 			.courseAllList({
-				semesterId: form.semesterId,
-				majorId: form.majorId
+				semesterId: form.semesterId
 			})
 			.then((res) => {
 				if (res.code === 200) {
@@ -267,7 +267,7 @@
 
 	// 试卷类型变更
 	const paperTypeChange = () => {
-		paperPage.queryParam.subjectId = null
+		paperPage.queryParam.paperId = null
 		form.paperId = null
 		selectedPaperName.value = ''
 	}
@@ -290,7 +290,7 @@
 		}
 		delete params.pageIndex
 		delete params.pageSize
-		const data = await examPaperApi.pageList(params)
+		const data = await examPaperApi.selectExamList(params)
 		const re = data
 		paperPage.tableData = re.records
 		paperPage.total = re.total
@@ -360,7 +360,7 @@
 		form.examName = ''
 		form.paperId = null
 		form.semesterId = null // 重置学期
-		form.majorId = null // 重置专业
+		// form.majorId = null // 重置专业
 		form.courseId = null
 		form.startTime = null
 		form.endTime = null
@@ -392,7 +392,7 @@
 						})
 					}
 					// 如果是编辑模式,需要根据已有数据加载相应的课程列表
-					if (re.semesterId && re.majorId) {
+					if (re.semesterId) {
 						// 直接加载课程列表
 						loadCourseList()
 					}
@@ -421,22 +421,22 @@
 				semesterLoading()
 			})
 		// 加载专业
-		const majorLoading = message.loading('正在加载专业列表...', 0)
-		resourceAuditApi
-			.majordownList()
-			.then((res) => {
-				if (res.code === 200) {
-					majorList.value = res.data
-				} else {
-					message.error('加载专业列表失败:' + (res.msg || '未知错误'))
-				}
-			})
-			.catch((err) => {
-				message.error('加载专业列表失败:' + (err.message || '网络错误'))
-			})
-			.finally(() => {
-				majorLoading()
-			})
+		// const majorLoading = message.loading('正在加载专业列表...', 0)
+		// resourceAuditApi
+		// 	.majordownList()
+		// 	.then((res) => {
+		// 		if (res.code === 200) {
+		// 			majorList.value = res.data
+		// 		} else {
+		// 			message.error('加载专业列表失败:' + (res.msg || '未知错误'))
+		// 		}
+		// 	})
+		// 	.catch((err) => {
+		// 		message.error('加载专业列表失败:' + (err.message || '网络错误'))
+		// 	})
+		// 	.finally(() => {
+		// 		majorLoading()
+		// 	})
 	})
 </script>