mirror of
https://gitee.com/dapppp/ruoyi-plus-vben5.git
synced 2026-04-03 00:53:22 +08:00
fix(workflow): 修复审批面板加载状态闪烁问题
引入防抖延迟设置 loading 状态,避免快速切换任务时出现闪烁
This commit is contained in:
@@ -89,12 +89,19 @@ const loading = ref(false);
|
|||||||
|
|
||||||
// 存放所有请求取消函数
|
// 存放所有请求取消函数
|
||||||
const abortList: (() => void)[] = [];
|
const abortList: (() => void)[] = [];
|
||||||
|
let loadingTimer: ReturnType<typeof setTimeout>;
|
||||||
|
|
||||||
async function handleLoadInfo(task: TaskInfo | undefined) {
|
async function handleLoadInfo(task: TaskInfo | undefined) {
|
||||||
|
currentFlowInfo.value = undefined;
|
||||||
|
onlyForBtnPermissionTask.value = undefined;
|
||||||
if (!task) {
|
if (!task) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
clearTimeout(loadingTimer);
|
||||||
try {
|
try {
|
||||||
loading.value = true;
|
loadingTimer = setTimeout(() => {
|
||||||
|
loading.value = true;
|
||||||
|
}, 300);
|
||||||
// 取消之前的请求 & 清空数组
|
// 取消之前的请求 & 清空数组
|
||||||
abortList.forEach((abort) => abort());
|
abortList.forEach((abort) => abort());
|
||||||
abortList.length = 0;
|
abortList.length = 0;
|
||||||
@@ -128,6 +135,7 @@ async function handleLoadInfo(task: TaskInfo | undefined) {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
} finally {
|
} finally {
|
||||||
|
clearTimeout(loadingTimer);
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user