mirror of
https://gitee.com/dapppp/ruoyi-plus-vben5.git
synced 2026-03-23 15:34:32 +08:00
refactor: drawer实现请假流程 & 重新编辑跳转
This commit is contained in:
@@ -3,9 +3,41 @@
|
||||
未修改文件名 而是新加了这个文件
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import LeaveFormPage from './leave-form.vue';
|
||||
import { onMounted } from 'vue';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
|
||||
import { useTabs } from '@vben/hooks';
|
||||
|
||||
import { Spin } from 'ant-design-vue';
|
||||
|
||||
import { useQueryId } from './hook';
|
||||
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
const id = route.query.id as string;
|
||||
|
||||
/**
|
||||
* 从我的任务 -> 点击重新编辑会跳转到这里
|
||||
* 相当于一个中转 因为我的任务无法获取到列表页的路径(与ele交互不同)
|
||||
*
|
||||
* 为什么不使用路由的query来实现?
|
||||
* 因为刷新后参数不会丢失 且tab存的也是全路径 切换也不会丢失 这不符合预期
|
||||
* 可以通过window.history.replaceState来删除query参数 但是tab切换还是会保留
|
||||
*/
|
||||
const { closeCurrentTab } = useTabs();
|
||||
const { businessId } = useQueryId();
|
||||
onMounted(async () => {
|
||||
await closeCurrentTab();
|
||||
if (id) {
|
||||
// 设置业务ID 存储在内存
|
||||
businessId.value = id;
|
||||
router.push({ path: '/demo/leave' });
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<LeaveFormPage />
|
||||
<div>
|
||||
<Spin :spinning="true" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user