节假日添加同步

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

View File

@ -10,6 +10,9 @@
<el-button type="primary" @click="handleSearch" v-auth="'contractVariety_addHoliday'" <el-button type="primary" @click="handleSearch" v-auth="'contractVariety_addHoliday'"
:loading="loading">搜索</el-button> :loading="loading">搜索</el-button>
<el-button @click="handleReset" :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-item>
</el-form> </el-form>
<div class="search-right"> <div class="search-right">
@ -24,7 +27,7 @@
<el-button type="primary" size="small" @click="handleEdit(row)" <el-button type="primary" size="small" @click="handleEdit(row)"
v-auth="'contractVariety_addHoliday'">编辑</el-button> v-auth="'contractVariety_addHoliday'">编辑</el-button>
<el-button type="danger" size="small" @click="handleDel(row)" <el-button type="danger" size="small" @click="handleDel(row)"
v-auth="'contractVariety_addHoliday'">删除</el-button> v-auth="'contractVariety_addHoliday'">删除</el-button>
</template> </template>
</Table> </Table>
@ -56,6 +59,7 @@ import { ElMessage, ElMessageBox } from 'element-plus'
import { usePageLoading } from '@/composables/useLoading' import { usePageLoading } from '@/composables/useLoading'
import Table from '@/components/common/Table.vue' import Table from '@/components/common/Table.vue'
import Form from '@/components/common/Form.vue' import Form from '@/components/common/Form.vue'
import { syncRiskControlApi } from '@/api/modules/risk'
defineOptions({ defineOptions({
name: 'Holidays' 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: 搜索 * @description: 搜索
*/ */