diff --git a/src/utils/routerHelper.ts b/src/utils/routerHelper.ts index af6a9c3c..a6825653 100644 --- a/src/utils/routerHelper.ts +++ b/src/utils/routerHelper.ts @@ -1,10 +1,22 @@ +import type { RouteLocationNormalized, Router, RouteRecordNormalized } from 'vue-router' import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router' -import type { Router, RouteLocationNormalized, RouteRecordNormalized } from 'vue-router' import { isUrl } from '@/utils/is' -import { omit, cloneDeep } from 'lodash-es' +import { cloneDeep, omit } from 'lodash-es' const modules = import.meta.glob('../views/**/*.{vue,tsx}') - +/** + * 注册一个异步组件 + * @param componentPath 例:/bpm/oa/leave/detail + */ +export const registerComponent = (componentPath: string) => { + for (const item in modules) { + if (item.includes(componentPath)) { + // 使用异步组件的方式来动态加载组件 + // @ts-ignore + return defineAsyncComponent(modules[item]) + } + } +} /* Layout */ export const Layout = () => import('@/layout/Layout.vue') diff --git a/src/views/bpm/oa/leave/detail.vue b/src/views/bpm/oa/leave/detail.vue index 2ce8a39d..a1b646a1 100644 --- a/src/views/bpm/oa/leave/detail.vue +++ b/src/views/bpm/oa/leave/detail.vue @@ -1,6 +1,6 @@ - + @@ -21,6 +21,7 @@ import { DICT_TYPE } from '@/utils/dict' import { formatDate } from '@/utils/formatTime' import { propTypes } from '@/utils/propTypes' import * as LeaveApi from '@/api/bpm/leave' + const { query } = useRoute() // 查询参数 const props = defineProps({ @@ -34,7 +35,7 @@ const queryId = query.id as unknown as number // 从 URL 传递过来的 id 编 const getInfo = async () => { detailLoading.value = true try { - detailData.value = await LeaveApi.getLeave(queryId || props.id) + detailData.value = await LeaveApi.getLeave(props.id || queryId) } finally { detailLoading.value = false } diff --git a/src/views/bpm/processInstance/detail/index.vue b/src/views/bpm/processInstance/detail/index.vue index 62fe3ab2..eb01e6e0 100644 --- a/src/views/bpm/processInstance/detail/index.vue +++ b/src/views/bpm/processInstance/detail/index.vue @@ -2,81 +2,78 @@ 审批任务【{{ item.name }}】 - + - + {{ processInstance.name }} - + {{ processInstance.startUser.nickname }} - {{ processInstance.startUser.deptName }} + {{ processInstance.startUser.deptName }} - 通过 + + 通过 - 不通过 + + 不通过 - 转办 + + 转办 - 委派 + + 委派 - 回退 + + 回退 - + 申请信息【{{ processInstance.name }}】 - + - + - - 点击查看 - + @@ -85,18 +82,18 @@ -