feat: 支持跳转到license详情

This commit is contained in:
caiyuchao
2025-09-20 18:18:29 +08:00
parent b02067a541
commit 9338462134
2 changed files with 67 additions and 0 deletions

View File

@@ -11,6 +11,16 @@ const routes: RouteRecordRaw[] = [
hideInMenu: true, 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; export default routes;

View 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>