refactor: drawer实现请假流程 & 重新编辑跳转

This commit is contained in:
dap
2025-08-20 11:04:38 +08:00
parent 26feff20fc
commit 4a64b75fb8
6 changed files with 307 additions and 32 deletions

View File

@@ -0,0 +1,33 @@
import { onActivated, onMounted, ref } from 'vue';
import { createGlobalState } from '@vueuse/core';
export function useRouteIdEdit(callback: (id: string) => void, timeout = 500) {
const { businessId } = useQueryId();
function openEditFromRouteId() {
const id = businessId.value;
if (!id) {
return;
}
setTimeout(() => {
// 回调
callback?.(id);
// 执行完 清理id
businessId.value = '';
}, timeout);
}
onMounted(openEditFromRouteId);
onActivated(openEditFromRouteId);
}
/**
* 用来存储业务ID 传值
*/
export const useQueryId = createGlobalState(() => {
const businessId = ref('');
return {
businessId,
};
});