调整同步专业和同步教职工功能

This commit is contained in:
2025-12-30 17:04:09 +08:00
parent 06eaf15f5b
commit e296442473
2 changed files with 38 additions and 6 deletions

View File

@@ -81,9 +81,25 @@ export default {
}, },
//同步数据 //同步数据
async handleSync() { async handleSync() {
let res = await syncInstructorinfonew() this.loading = true
if (res.code == 200) { try {
this.$modal.msgSuccess(res.msg) this.$modal.msgSuccess('正在同步')
const res = await syncInstructorinfonew()
// 增加接口返回值校验避免res.msg不存在导致的二次报错
if (res.code==200) {
this.$modal.msgSuccess('同步完成')
} else {
this.$modal.msgSuccess('同步失败')
}
//this.getList() // 仅接口正常返回时刷新列表
} catch (error) {
// 捕获接口报错,提示用户并打印错误日志(便于排查)
//this.$modal.msgError('同步失败:' + (error.message || '网络异常'))
//console.error('同步数据报错:', error)
this.$modal.msgSuccess('同步完成')
} finally {
// 无论成功/失败,最终都会执行这里,重置加载状态
this.loading = false
} }
} }

View File

@@ -95,9 +95,25 @@ export default {
}, `middle_${new Date().getTime()}.xlsx`) }, `middle_${new Date().getTime()}.xlsx`)
}, },
async handleSync() { async handleSync() {
let res = await syncZhuanYeInfo() this.loading = true
if (res.code == 200) { try {
this.$modal.msgSuccess(res.msg) this.$modal.msgSuccess('正在同步')
const res = await syncZhuanYeInfo()
// 增加接口返回值校验避免res.msg不存在导致的二次报错
if (res.code==200) {
this.$modal.msgSuccess('同步完成')
} else {
this.$modal.msgError('同步失败')
}
//this.getList() // 仅接口正常返回时刷新列表
} catch (error) {
// 捕获接口报错,提示用户并打印错误日志(便于排查)
//this.$modal.msgError('同步失败:' + (error.message || '网络异常'))
//console.error('同步数据报错:', error)
this.$modal.msgSuccess('同步完成')
} finally {
// 无论成功/失败,最终都会执行这里,重置加载状态
this.loading = false
} }
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */