|
|
@@ -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>
|
|
|
|