Prechádzať zdrojové kódy

refactor(question): 移除Excel导入前的检查步骤,直接导入

简化导入流程,去除冗余的检查步骤,直接进行文件导入操作
tanshanming 7 mesiacov pred
rodič
commit
23b70fd559
1 zmenil súbory, kde vykonal 22 pridanie a 24 odobranie
  1. 22 24
      src/views/exm/question/index.vue

+ 22 - 24
src/views/exm/question/index.vue

@@ -310,35 +310,33 @@
 	// 处理Excel导入
 	const handleImportExcel = (options) => {
 		const { file } = options
-		const loading = message.loading('正在检查文件...', 0)
-
+		// const loading = message.loading('正在检查文件...', 0)
 		// 先调用检查接口
+		// tQuestionApi
+		// 	.checkExcel(file)
+		// 	.then((checkRes) => {
+		// 		loading()
+		// 		// 检查通过后,再调用导入接口
+		const importLoading = message.loading('正在导入中...', 0)
 		tQuestionApi
-			.checkExcel(file)
-			.then((checkRes) => {
-				loading()
-				// 检查通过后,再调用导入接口
-				const importLoading = message.loading('正在导入中...', 0)
-
-				return tQuestionApi
-					.importExcel(file)
-					.then((res) => {
-						importLoading()
-						message.success('导入成功')
-						search() // 刷新列表
-					})
-					.catch((error) => {
-						importLoading()
-						message.error('导入失败,请检查Excel文件格式是否正确')
-						console.error('导入失败:', error)
-						throw error // 继续抛出错误以便外层catch捕获
-					})
+			.importExcel(file)
+			.then((res) => {
+				importLoading()
+				message.success('导入成功')
+				search() // 刷新列表
 			})
 			.catch((error) => {
-				loading()
-				message.error('文件检查失败,请确保Excel格式正确')
-				console.error('检查失败:', error)
+				importLoading()
+				message.error('导入失败,请检查Excel文件格式是否正确')
+				console.error('导入失败:', error)
+				throw error // 继续抛出错误以便外层catch捕获
 			})
+		// })
+		// .catch((error) => {
+		// 	loading()
+		// 	message.error('文件检查失败,请确保Excel格式正确')
+		// 	console.error('检查失败:', error)
+		// })
 	}
 </script>