feat: 支持跳转到license详情
This commit is contained in:
@@ -11,6 +11,16 @@ const routes: RouteRecordRaw[] = [
|
||||
hideInMenu: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
path: '/license/detail',
|
||||
component: () => import('#/views/license/license/detail/index.vue'),
|
||||
name: 'LicenseDetail',
|
||||
meta: {
|
||||
title: 'License 详情',
|
||||
icon: 'carbon:license-third-party',
|
||||
hideInMenu: true,
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
export default routes;
|
||||
|
||||
57
apps/web-antd/src/views/license/license/detail/index.vue
Normal file
57
apps/web-antd/src/views/license/license/detail/index.vue
Normal file
@@ -0,0 +1,57 @@
|
||||
<script lang="ts" setup>
|
||||
import type { LicenseApi } from '#/api/license/license';
|
||||
|
||||
import { ref } from 'vue';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
|
||||
import { Page } from '@vben/common-ui';
|
||||
import { useTabs } from '@vben/hooks';
|
||||
|
||||
import { Button } from 'ant-design-vue';
|
||||
|
||||
import { getLicense } from '#/api/license/license';
|
||||
import { $t } from '#/locales';
|
||||
|
||||
import Detail from '../components/detail.vue';
|
||||
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const loading = ref(false);
|
||||
const formData = ref<LicenseApi.License>();
|
||||
|
||||
/** 获取详情数据 */
|
||||
async function getDetail(id: any) {
|
||||
if (!id) {
|
||||
return;
|
||||
}
|
||||
loading.value = true;
|
||||
try {
|
||||
const details = await getLicense(id);
|
||||
formData.value = details;
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
return formData.value;
|
||||
}
|
||||
|
||||
const tabs = useTabs();
|
||||
/** 返回列表 */
|
||||
function close() {
|
||||
tabs.closeCurrentTab();
|
||||
router.push('/license');
|
||||
}
|
||||
|
||||
// 初始化
|
||||
getDetail(route.query.id);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Page auto-content-height v-loading="loading">
|
||||
<div class="bg-card flex h-[100%] flex-col rounded-md p-4">
|
||||
<Detail :form-data="formData" />
|
||||
<div class="mt-4 flex justify-center space-x-2">
|
||||
<Button @click="close"> {{ $t('common.back') }}</Button>
|
||||
</div>
|
||||
</div>
|
||||
</Page>
|
||||
</template>
|
||||
Reference in New Issue
Block a user