SBOM显示修复

This commit is contained in:
付民康
2025-03-21 02:21:14 +08:00
parent 75ca45ac35
commit adf790ea15
2 changed files with 38 additions and 82 deletions

View File

@@ -6,9 +6,9 @@
<Card simple class="jyh-card mt-3">
<div class="clear-padding">
<d-table class="jyh-table" v-if="tableData.length>0" :indent="32" @check-change="treeCheckChange" :data="tableData" row-key="id">
<d-column field="licenseName" header="组织名称" show-overflow-tooltip>
<d-column field="libraryName" header="组织名称" show-overflow-tooltip>
<template #default="scope">
<a class="devui-link" @click="showDetail = true">{{ scope.row.licenseName }}</a>
<a class="devui-link" @click="setSelectRow(scope.row)">{{ scope.row.libraryName }}</a>
</template>
</d-column>
<d-column field="latestVersion" header="版本"></d-column>
@@ -30,65 +30,15 @@ const propsData = defineProps(['versionId']);
const checked = ref(false);
const route = useRoute(); // 获取路由对象
const showDetail = ref(false);
const baseTreeTableData1 = ref([
{
id: '1',
licenseName: 'openssl',
latestVersion: 'N.A.',
components: [
{
id: '2',
licenseName: 'ssl',
latestVersion: 'N.A.',
components: [
{
id: '3',
licenseName: 'ssl',
latestVersion: 'N.A.'
},
{
id: '4',
licenseName: 'crypto',
latestVersion: 'N.A.'
}
]
}
]
},
{
id: '5',
licenseName: 'Text-Template-1.56',
latestVersion: 'N.A.',
children: [
{
id: '6',
licenseName: 'ssl',
latestVersion: 'N.A.',
children: [
{
id: '7',
licenseName: 'ssl',
latestVersion: 'N.A.'
},
{
id: '8',
licenseName: 'crypto',
latestVersion: 'N.A.'
}
]
}
]
},
{
id: '9',
licenseName: 'Text-Template-1.56',
latestVersion: 'N.A.'
}
]);
const selectRow = ref({});
const tableData = ref([]);
const setSelectRow = (row) => {
selectRow.value = row;
showDetail.value = true;
}
const renameComponentsToChildren = (obj) => {
// 如果传入的不是对象,直接返回
if (typeof obj !== 'object' || obj === null) {
@@ -96,9 +46,11 @@ const renameComponentsToChildren = (obj) => {
}
// 如果对象有 `components` 属性,将其改为 `children`
if (obj.hasOwnProperty('components')) {
obj.children = obj.components; // 将 components 改为 children
delete obj.components; // 删除原来的 components 属性
if (obj.hasOwnProperty('component')) {
obj.id = obj.component.id; // 将 components 改为 children
obj.libraryName = obj.component.libraryName; // components 改为 children
obj.latestVersion = obj.component.latestVersion; // 将 components 改为 children
// delete obj.components; // 删除原来的 components 属性
}
// 递归处理对象的子元素
@@ -123,8 +75,10 @@ const fetchDependencyTree = async () => {
current: 1,
size: 10
});
if(data.data.code===200 &&data?.data?.data &&data?.data?.data.total>0) {
tableData.value = [renameComponentsToChildren(data?.data?.data)] || [];
debugger
if(data.data.code===200 &&data?.data?.data?.components) {
tableData.value = renameComponentsToChildren(data?.data?.data?.components);
debugger
// pager.value.total = data?.data?.data?.total || [];
} else {
// tableData.value = baseTreeTableData1.value