节假日添加同步

This commit is contained in:
2026-05-28 13:37:37 +08:00
parent 5ec2d573b7
commit 961e882a89
2 changed files with 22 additions and 11 deletions

View File

@ -97,11 +97,8 @@ const responseInterceptor = <T = unknown>(response: AxiosResponse<ApiResponse<T>
switch (data.code) {
case 1:
// 跳转到注册页
router.push('/user/register')
if (!data.msg) {
data.msg = '未知的错误!'
}
break
window.location.href = '/user/register'
throw new Error(data.msg || '未知的错误!')
case -100:
// 退出登录
data.msg = 'token过期'
@ -109,15 +106,15 @@ const responseInterceptor = <T = unknown>(response: AxiosResponse<ApiResponse<T>
removeStorage('userInfo')
removeStorage('menusInfo')
removeStorage('permissionsInfo')
router.push({ name: 'Login' })
break
window.location.href = '/user/login'
throw new Error(data.msg)
case -101:
data.msg = 'token错误'
removeStorage('token')
router.push({ name: 'Login' })
break
window.location.href = '/user/login'
throw new Error(data.msg)
default:
break;
throw new Error(data.msg || '操作失败!')
}
// 其他业务失败弹错误提示并拒绝Promise

View File

@ -10,6 +10,9 @@
<el-button type="primary" @click="handleSearch" v-auth="'contractVariety_addHoliday'"
:loading="loading">搜索</el-button>
<el-button @click="handleReset" :loading="loading">重置</el-button>
<el-button type="primary" :loading="syncLoading" @click="handleSyncRiskControl()" v-auth="'riskControl_editRiskControlSetting'">
同步
</el-button>
</el-form-item>
</el-form>
<div class="search-right">
@ -56,6 +59,7 @@ import { ElMessage, ElMessageBox } from 'element-plus'
import { usePageLoading } from '@/composables/useLoading'
import Table from '@/components/common/Table.vue'
import Form from '@/components/common/Form.vue'
import { syncRiskControlApi } from '@/api/modules/risk'
defineOptions({
name: 'Holidays'
@ -213,6 +217,16 @@ const getList = async () => {
}
}
//
const syncLoading = ref(false)
const handleSyncRiskControl = async () => {
syncLoading.value = true
try {
await syncRiskControlApi()
} finally {
syncLoading.value = false
}
}
/**
* @description: 搜索
*/