From adf790ea15fc0364855e0d7bdc97aae5db5b315c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=98=E6=B0=91=E5=BA=B7?= Date: Fri, 21 Mar 2025 02:21:14 +0800 Subject: [PATCH] =?UTF-8?q?SBOM=E6=98=BE=E7=A4=BA=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/Jyh/Version/Detail/SBOM.vue | 80 +++++---------------- src/views/Jyh/Version/Detail/SBOMDetail.vue | 40 ++++++----- 2 files changed, 38 insertions(+), 82 deletions(-) diff --git a/src/views/Jyh/Version/Detail/SBOM.vue b/src/views/Jyh/Version/Detail/SBOM.vue index 5105c4a..66963a4 100644 --- a/src/views/Jyh/Version/Detail/SBOM.vue +++ b/src/views/Jyh/Version/Detail/SBOM.vue @@ -6,9 +6,9 @@
- + @@ -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 diff --git a/src/views/Jyh/Version/Detail/SBOMDetail.vue b/src/views/Jyh/Version/Detail/SBOMDetail.vue index c988590..71fcbdc 100644 --- a/src/views/Jyh/Version/Detail/SBOMDetail.vue +++ b/src/views/Jyh/Version/Detail/SBOMDetail.vue @@ -2,15 +2,15 @@
-

openssl

+

{{props.selectRow.libraryName || '--'}}

安全漏洞: - 3 + {{props.selectRow.lowVulCount || '--'}} 许可证 - 获准的 + {{props.selectRow.licenseName || '--'}}
@@ -18,13 +18,13 @@ -

request

+

{{'--'}}

-

CNVD-201105-215

+

{{props.selectRow.cveId || '--'}}

@@ -35,57 +35,57 @@ -

2.0

+

{{props.selectRow.currentVersion || '--'}}

-

3.0

+

{{props.selectRow.latestVersion || '--'}}

-

1

+

{{props.selectRow.depth || '--'}}

-

-

+

{{props.selectRow.vendor || '--'}}

-

NOT_SPECIFIED

+

{{props.selectRow.platform || '--'}}

-

-

+

{{props.selectRow.scope || '--'}}

-

cpp

+

{{props.selectRow.language || '--'}}

-

-

+

{{props.selectRow.activityScore || '--'}}

-

-

+

{{props.selectRow.downloadCount || '--'}}

-

BOM定义文件

+

{{props.selectRow.recogMethod || '--'}}

-

100%

+

{{props.selectRow.matchingDegree || '--'}}

@@ -95,7 +95,7 @@ -

openssl

+

{{props.selectRow.treeLevel || '--'}}

@@ -104,8 +104,10 @@