Merge remote-tracking branch 'origin/master'

This commit is contained in:
付民康
2025-03-25 09:24:18 +08:00
7 changed files with 239 additions and 239 deletions

View File

@@ -1,7 +1,6 @@
<template> <template>
<d-table :data="dataSource" @sort-change="handleSortChange" :header-bg="true"> <d-table :data="dataSource" @sort-change="handleSortChange" :header-bg="true">
<d-column v-for="(column, index) in props.tableConfig" :field="column.field" <d-column v-for="(column, index) in props.tableConfig" :field="column.field" :header="column.header"></d-column>
:header="column.header" :sortable="column.sortable" :sort-method="column.sortMethod"></d-column>
</d-table> </d-table>
</template> </template>
@@ -12,15 +11,14 @@ export default defineComponent({
props: { props: {
tableConfig: { tableConfig: {
type: Array, type: Array,
default: () => [], default: () => []
}, },
dataSource: { dataSource: {
type: Array, type: Array,
default: () => [], default: () => []
}, }
}, },
setup(props) { setup(props) {
onMounted(() => { onMounted(() => {
console.log('props', props); console.log('props', props);
}); });
@@ -37,10 +35,8 @@ export default defineComponent({
}; };
return { props, handleSortChange, sortDateMethod, sortNameMethod }; return { props, handleSortChange, sortDateMethod, sortNameMethod };
}, }
}); });
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss"></style>
</style>

View File

@@ -1,21 +1,20 @@
<template> <template>
<div class="secret-container"> <div class="secret-container">
<div class="mt-3 px-20"> <div class="mt-3 px-20">
<d-table :key="tableKey" class="jyh-table" v-if="tableData.length" :striped="false" :data="tableData" table-layout="auto"> <d-table
:key="tableKey"
class="jyh-table"
v-if="tableData.length"
:striped="false"
:data="tableData"
table-layout="auto"
>
<!-- 索引列 --> <!-- 索引列 -->
<d-column type="index" width="40"></d-column> <d-column type="index" width="40"></d-column>
<!-- 动态渲染列 --> <!-- 动态渲染列 -->
<template v-for="column in columns" :key="column.key"> <template v-for="column in columns" :key="column.key">
<d-column <d-column v-if="column.visible" :field="column.key" :header="column.label">
v-if="column.visible"
:field="column.key"
:header="column.label"
:filterable="column.filterable"
:filter-list="column.filterList"
:sortable="column.sortable"
@filter-change="handleFilterChange"
>
<!-- 自定义列内容 --> <!-- 自定义列内容 -->
<template #default="scope"> <template #default="scope">
<template v-if="column.key === 'versionName'"> <template v-if="column.key === 'versionName'">
@@ -55,24 +54,32 @@
</template> </template>
</d-table> </d-table>
<DataPanel v-else skeleton :card="false" :empty="true"> <DataPanel v-else skeleton :card="false" :empty="true"> </DataPanel>
</DataPanel>
</div> </div>
<div class="mt-20 mb-20 flex justify-end"> <div class="mt-20 mb-20 flex justify-end">
<d-pagination size="md" :page-size-options="[10, 20, 50]" :total="pager.total" <d-pagination
v-model:pageSize="pager.pageSize" v-model:pageIndex="pager.pageIndex" :max-items="5" size="md"
:can-change-page-size="true" :can-view-total="true" total-item-text="总计" @page-index-change="changeIndex()" :page-size-options="[10, 20, 50]"
@page-size-change="changeSize()" /> :total="pager.total"
v-model:pageSize="pager.pageSize"
v-model:pageIndex="pager.pageIndex"
:max-items="5"
:can-change-page-size="true"
:can-view-total="true"
total-item-text="总计"
@page-index-change="changeIndex()"
@page-size-change="changeSize()"
/>
</div> </div>
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import AdvanceSearch from '@/components/AdvanceSearch/index.vue' import AdvanceSearch from '@/components/AdvanceSearch/index.vue';
import SettingTitle from '@/components/Setting/SettingTitle/index.vue'; import SettingTitle from '@/components/Setting/SettingTitle/index.vue';
import SettingText from '@/components/Setting/SettingText/index.vue'; import SettingText from '@/components/Setting/SettingText/index.vue';
import { ref,reactive, onMounted } from 'vue'; import { ref, reactive, onMounted } from 'vue';
import { getGroupClaList, setGroupClaStatus, deleteGroupCla } from '@/api/cla'; import { getGroupClaList, setGroupClaStatus, deleteGroupCla } from '@/api/cla';
import { useRouter, useRoute } from 'vue-router'; import { useRouter, useRoute } from 'vue-router';
import { GModal } from '@/components/Setting/index'; import { GModal } from '@/components/Setting/index';
@@ -110,7 +117,7 @@ const tableData = ref([
externalVulnerabilitySource: 'CVE-2025-1234', externalVulnerabilitySource: 'CVE-2025-1234',
versionDescription: '修复了若干安全漏洞', versionDescription: '修复了若干安全漏洞',
compatibilityRisk: '低', compatibilityRisk: '低',
communityEOL: '2028-12-31', communityEOL: '2028-12-31'
}, },
{ {
softwareName: 'react', softwareName: 'react',
@@ -133,7 +140,7 @@ const tableData = ref([
externalVulnerabilitySource: 'CVE-2025-5678', externalVulnerabilitySource: 'CVE-2025-5678',
versionDescription: '新增了并发渲染功能', versionDescription: '新增了并发渲染功能',
compatibilityRisk: '中', compatibilityRisk: '中',
communityEOL: '2030-12-31', communityEOL: '2030-12-31'
}, },
{ {
softwareName: 'vue', softwareName: 'vue',
@@ -156,7 +163,7 @@ const tableData = ref([
externalVulnerabilitySource: 'CVE-2025-9101', externalVulnerabilitySource: 'CVE-2025-9101',
versionDescription: '优化了性能', versionDescription: '优化了性能',
compatibilityRisk: '低', compatibilityRisk: '低',
communityEOL: '2029-12-31', communityEOL: '2029-12-31'
}, },
{ {
softwareName: 'webpack', softwareName: 'webpack',
@@ -179,7 +186,7 @@ const tableData = ref([
externalVulnerabilitySource: 'CVE-2025-1122', externalVulnerabilitySource: 'CVE-2025-1122',
versionDescription: '修复了构建性能问题', versionDescription: '修复了构建性能问题',
compatibilityRisk: '高', compatibilityRisk: '高',
communityEOL: '2027-12-31', communityEOL: '2027-12-31'
}, },
{ {
softwareName: 'babel', softwareName: 'babel',
@@ -202,7 +209,7 @@ const tableData = ref([
externalVulnerabilitySource: 'CVE-2025-3344', externalVulnerabilitySource: 'CVE-2025-3344',
versionDescription: '新增了对新语法的支持', versionDescription: '新增了对新语法的支持',
compatibilityRisk: '中', compatibilityRisk: '中',
communityEOL: '2026-12-31', communityEOL: '2026-12-31'
}, },
{ {
softwareName: 'typescript', softwareName: 'typescript',
@@ -225,7 +232,7 @@ const tableData = ref([
externalVulnerabilitySource: '无', externalVulnerabilitySource: '无',
versionDescription: '新增了装饰器功能', versionDescription: '新增了装饰器功能',
compatibilityRisk: '低', compatibilityRisk: '低',
communityEOL: '2035-12-31', communityEOL: '2035-12-31'
}, },
{ {
softwareName: 'jest', softwareName: 'jest',
@@ -248,7 +255,7 @@ const tableData = ref([
externalVulnerabilitySource: 'CVE-2025-5566', externalVulnerabilitySource: 'CVE-2025-5566',
versionDescription: '优化了测试性能', versionDescription: '优化了测试性能',
compatibilityRisk: '中', compatibilityRisk: '中',
communityEOL: '2032-12-31', communityEOL: '2032-12-31'
}, },
{ {
softwareName: 'docker', softwareName: 'docker',
@@ -271,7 +278,7 @@ const tableData = ref([
externalVulnerabilitySource: 'CVE-2025-7788', externalVulnerabilitySource: 'CVE-2025-7788',
versionDescription: '新增了对ARM架构的支持', versionDescription: '新增了对ARM架构的支持',
compatibilityRisk: '高', compatibilityRisk: '高',
communityEOL: '2030-12-31', communityEOL: '2030-12-31'
}, },
{ {
softwareName: 'kubernetes', softwareName: 'kubernetes',
@@ -294,7 +301,7 @@ const tableData = ref([
externalVulnerabilitySource: 'CVE-2025-9900', externalVulnerabilitySource: 'CVE-2025-9900',
versionDescription: '优化了集群管理功能', versionDescription: '优化了集群管理功能',
compatibilityRisk: '高', compatibilityRisk: '高',
communityEOL: '2033-12-31', communityEOL: '2033-12-31'
}, },
{ {
softwareName: 'postgresql', softwareName: 'postgresql',
@@ -317,10 +324,20 @@ const tableData = ref([
externalVulnerabilitySource: 'CVE-2025-1122', externalVulnerabilitySource: 'CVE-2025-1122',
versionDescription: '新增了JSONB索引功能', versionDescription: '新增了JSONB索引功能',
compatibilityRisk: '低', compatibilityRisk: '低',
communityEOL: '2035-12-31', communityEOL: '2035-12-31'
}, }
]); ]);
const formData = ref({ title: '',type: '', useType: '',formData:'',select: '',time1:null,name:'',versionCode:'',pulishTime:'' }); const formData = ref({
title: '',
type: '',
useType: '',
formData: '',
select: '',
time1: null,
name: '',
versionCode: '',
pulishTime: ''
});
const typeOptions = reactive(['主软件', '依赖软件']); const typeOptions = reactive(['主软件', '依赖软件']);
const riskOptions = reactive(['低', '中', '高']); const riskOptions = reactive(['低', '中', '高']);
const useTypeOptions = reactive(['软件', '文档', '文档+软件']); const useTypeOptions = reactive(['软件', '文档', '文档+软件']);
@@ -332,7 +349,7 @@ const newFormData = ref({
dependentSoftware: '', dependentSoftware: '',
programmingLanguage: '', programmingLanguage: '',
dateRange: ['', ''] dateRange: ['', '']
}) });
const pager = ref({ const pager = ref({
total: 10, total: 10,
@@ -369,10 +386,16 @@ const columns = ref([
{ key: 'softwareScore', label: '软件评分', visible: false, filterable: false, sortable: true }, { key: 'softwareScore', label: '软件评分', visible: false, filterable: false, sortable: true },
{ key: 'sourceCodeDownload', label: '源码包下载地址', visible: true, filterable: false, sortable: false }, { key: 'sourceCodeDownload', label: '源码包下载地址', visible: true, filterable: false, sortable: false },
{ key: 'copyright', label: 'Copyright', visible: false, filterable: false, sortable: false }, { key: 'copyright', label: 'Copyright', visible: false, filterable: false, sortable: false },
{ key: 'externalVulnerabilitySource', label: '外部漏洞源的软件名称', visible: false, filterable: true, sortable: false }, {
key: 'externalVulnerabilitySource',
label: '外部漏洞源的软件名称',
visible: false,
filterable: true,
sortable: false
},
{ key: 'versionDescription', label: '版本描述', visible: false, filterable: false, sortable: false }, { key: 'versionDescription', label: '版本描述', visible: false, filterable: false, sortable: false },
{ key: 'compatibilityRisk', label: '兼容性风险描述', visible: false, filterable: false, sortable: false }, { key: 'compatibilityRisk', label: '兼容性风险描述', visible: false, filterable: false, sortable: false },
{ key: 'communityEOL', label: '社区EOL时间', visible: false, filterable: true, sortable: true }, { key: 'communityEOL', label: '社区EOL时间', visible: false, filterable: true, sortable: true }
]); ]);
// 定义 showColumnList 状态 // 定义 showColumnList 状态
@@ -482,7 +505,6 @@ onMounted(() => {
right: 0; right: 0;
top: 0; top: 0;
} }
} }
.error { .error {
@@ -501,7 +523,7 @@ onMounted(() => {
font-size: 12px; font-size: 12px;
line-height: 16px; line-height: 16px;
margin-right: 8px; margin-right: 8px;
border: 1px solid #E3E3EE; border: 1px solid #e3e3ee;
} }
.one-line { .one-line {
@@ -544,7 +566,6 @@ onMounted(() => {
line-height: 22px; line-height: 22px;
letter-spacing: 0px; letter-spacing: 0px;
text-align: left; text-align: left;
} }
} }

View File

@@ -8,13 +8,7 @@
<NoData></NoData> <NoData></NoData>
</template> </template>
<d-column type="index" width="40"></d-column> <d-column type="index" width="40"></d-column>
<d-column <d-column v-for="(column, index) in tableConfig" :field="column.field" :header="column.header"></d-column>
v-for="(column, index) in tableConfig"
:field="column.field"
:header="column.header"
:sortable="column.sortable"
:sort-method="column.sortMethod"
></d-column>
<d-column header="详情" width="100px"> <d-column header="详情" width="100px">
<template #default="scope"> <template #default="scope">
<a class="devui-link" @click="openPanel(scope.row)">查看</a> <a class="devui-link" @click="openPanel(scope.row)">查看</a>
@@ -44,7 +38,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref,defineProps } from 'vue'; import { ref, defineProps } from 'vue';
import SidePanel from '@/components/LicenseInfo/SidePanel.vue'; import SidePanel from '@/components/LicenseInfo/SidePanel.vue';
import { getLicenseList } from '@/api/jyh'; import { getLicenseList } from '@/api/jyh';
import NoData from '@/components/NoData/NoData.vue'; import NoData from '@/components/NoData/NoData.vue';
@@ -79,7 +73,7 @@ const tableConfig = ref([
header: '许可证种类', header: '许可证种类',
sortable: false, sortable: false,
sortMethod: null sortMethod: null
}, }
// { // {
// field: 'affectedComponent', // field: 'affectedComponent',
// header: '影响软件', // header: '影响软件',
@@ -126,7 +120,7 @@ const getList = async () => {
softwareId: propsData.versionId, softwareId: propsData.versionId,
componentId: '', componentId: '',
current: pager.value.pageIndex, current: pager.value.pageIndex,
size: pager.value.pageSize, size: pager.value.pageSize
}); });
if (!res.error) { if (!res.error) {
console.log(res); console.log(res);

View File

@@ -1,48 +1,56 @@
<template> <template>
<div class="BatchVerify"> <div class="BatchVerify">
<div class="search-form" v-if="isLogin"> <div class="search-form" v-if="isLogin">
<FileUploadButton <FileUploadButton buttonText="批量导入" accept=".xlsx" :onFileUpload="handleFileUpload" />
buttonText="批量导入" <d-search
accept=".xlsx" class="mt-0 mb-2"
:onFileUpload="handleFileUpload" style="width: 400px"
/> :delay="1000"
<d-search class="mt-0 mb-2" style="width: 400px" :delay="1000" @search="onSearch($event)" placeholder="请输入软件名称"></d-search> @search="onSearch($event)"
placeholder="请输入软件名称"
></d-search>
<div class="tjsj"> <div class="tjsj">
<span style="height: 14px" class="split"></span> <span style="height: 14px" class="split"></span>
<span>可使用</span> <span>可使用</span>
<span class="green" @click="filterVerifyResult(1)">{{useNum}}</span> <span class="green" @click="filterVerifyResult(1)">{{ useNum }}</span>
<span style="height: 14px" class="split"></span> <span style="height: 14px" class="split"></span>
<span>有风险</span> <span>有风险</span>
<span class="red" @click="filterVerifyResult(2)">{{riskNum}}</span> <span class="red" @click="filterVerifyResult(2)">{{ riskNum }}</span>
<span style="height: 14px" class="split"></span> <span style="height: 14px" class="split"></span>
<span>未治理</span> <span>未治理</span>
<span class="yellow" @click="filterVerifyResult(0)">{{noNum}}</span> <span class="yellow" @click="filterVerifyResult(0)">{{ noNum }}</span>
</div> </div>
<div class="left-btn"> <div class="left-btn">
<a v-if="isLogin" class="cursor-pointer" href="/static/软件存在及可信校验模版.xlsx" download><i class="icon icon-download-2"></i>下载excel模板</a> <a v-if="isLogin" class="cursor-pointer" href="/static/软件存在及可信校验模版.xlsx" download
><i class="icon icon-download-2"></i>下载excel模板</a
>
<span v-if="isLogin" style="height: 14px" class="split"></span> <span v-if="isLogin" style="height: 14px" class="split"></span>
<d-button v-if="isLogin" class="output-btn" icon="icon-share" variant="text" @click="exportResult">导出</d-button> <d-button v-if="isLogin" class="output-btn" icon="icon-share" variant="text" @click="exportResult"
>导出</d-button
>
<span v-if="isLogin" style="height: 14px" class="split"></span> <span v-if="isLogin" style="height: 14px" class="split"></span>
<TableSetting :columns="columns" :show-column-list="showColumnList" @update:show-column-list="updateShowColumnList"/> <TableSetting
:columns="columns"
:show-column-list="showColumnList"
@update:show-column-list="updateShowColumnList"
/>
</div> </div>
</div> </div>
<div class="mt-3 px-20"> <div class="mt-3 px-20">
<d-table class="jyh-table" v-if="tableData.length" :striped="false" :data="tableData" table-layout="auto" :show-loading="loading"> <d-table
class="jyh-table"
v-if="tableData.length"
:striped="false"
:data="tableData"
table-layout="auto"
:show-loading="loading"
>
<!-- 索引列 --> <!-- 索引列 -->
<d-column type="index" width="40"></d-column> <d-column type="index" width="40"></d-column>
<!-- 动态渲染列 --> <!-- 动态渲染列 -->
<template v-for="column in columns" :key="column.key"> <template v-for="column in columns" :key="column.key">
<d-column <d-column v-if="column.visible" :field="column.key" :header="column.label">
v-if="column.visible"
:field="column.key"
:header="column.label"
:filterable="column.filterable"
:filter-list="column.filterList"
:sortable="column.sortable"
@filter-change="handleFilterChange"
>
<!-- 自定义列内容 --> <!-- 自定义列内容 -->
<template #default="scope"> <template #default="scope">
<template v-if="column.key === 'validStatus'"> <template v-if="column.key === 'validStatus'">
@@ -91,30 +99,33 @@
</d-column> </d-column>
</template> </template>
<d-column header="操作" width="200" fixed-right="0px"> <d-column header="操作" width="200" fixed-right="0px">
<!--TODO:申请入口只有校验不通过的才显示--> <!--TODO:申请入口只有校验不通过的才显示-->
<template #default="scope"> <template #default="scope">
<d-button <d-button variant="text" v-if="scope.row.validStatus == 0" :disabled="scope.row.validStatus !== 0">
variant="text"
v-if="scope.row.validStatus == 0"
:disabled="scope.row.validStatus !== 0"
>
申请入库 申请入库
</d-button> </d-button>
</template> </template>
</d-column> </d-column>
</d-table> </d-table>
<!-- <DataPanel v-else skeleton :card="false" :empty="true">--> <!-- <DataPanel v-else skeleton :card="false" :empty="true">-->
<!-- </DataPanel>--> <!-- </DataPanel>-->
<NoData v-else :small="false"></NoData> <NoData v-else :small="false"></NoData>
</div> </div>
<!-- 删除组件 --> <!-- 删除组件 -->
<GModal v-model="deletevModels" ref="deleteModal" title="删除?" @confirm="confirmDelete" showWarnIcon <GModal
confirmColor="danger"> v-model="deletevModels"
<span class="inline-block text-G900 text-sm font-normal leading-[20px] break-all">你确认删除此项{{ item.cla_name }} ref="deleteModal"
</span> title="删除?"
@confirm="confirmDelete"
showWarnIcon
confirmColor="danger"
>
<span class="inline-block text-G900 text-sm font-normal leading-[20px] break-all"
>你确认删除此项{{ item.cla_name }} </span
>
</GModal> </GModal>
</div> </div>
</template> </template>
@@ -134,28 +145,28 @@ import { storeToRefs } from 'pinia';
import TableSetting from '@/components/TableSetting/index.vue'; import TableSetting from '@/components/TableSetting/index.vue';
import FileUploadButton from '@/components/FileUploadButton/index.vue'; import FileUploadButton from '@/components/FileUploadButton/index.vue';
import { releasePage, repoImport } from '@/api/jyh'; import { releasePage, repoImport } from '@/api/jyh';
import NoData from "@/components/NoData/NoData.vue"; import NoData from '@/components/NoData/NoData.vue';
import * as XLSX from "xlsx" import * as XLSX from 'xlsx';
const useNum = computed(() => { const useNum = computed(() => {
if (tableData.value.length>0) { if (tableData.value.length > 0) {
return tableData.value.filter(item => item.validStatus === 1).length; return tableData.value.filter((item) => item.validStatus === 1).length;
} else { } else {
return 0; return 0;
} }
}); });
const riskNum = computed(() => { const riskNum = computed(() => {
if (tableData.value.length>0) { if (tableData.value.length > 0) {
return tableData.value.filter(item => item.validStatus === 2).length; return tableData.value.filter((item) => item.validStatus === 2).length;
} else { } else {
return 0; return 0;
} }
}); });
const noNum = computed(() => { const noNum = computed(() => {
if (tableData.value.length>0) { if (tableData.value.length > 0) {
return tableData.value.filter(item => item.validStatus === 0).length; return tableData.value.filter((item) => item.validStatus === 0).length;
} else { } else {
return 0; return 0;
} }
@@ -165,10 +176,10 @@ const noNum = computed(() => {
const handleFileUpload = async (file) => { const handleFileUpload = async (file) => {
console.log('选择的文件:', file.name); console.log('选择的文件:', file.name);
const { data, error } = await repoImport({file}); const { data, error } = await repoImport({ file });
if (!error && data) { if (!error && data) {
currentReusltFilter.value = null; currentReusltFilter.value = null;
allTableData.value = data.data.data allTableData.value = data.data.data;
tableData.value = [...allTableData.value]; tableData.value = [...allTableData.value];
} }
@@ -195,14 +206,24 @@ const columns = ref([
{ key: 'licenseCount', label: 'License数量', visible: true, filterable: false, sortable: false }, { key: 'licenseCount', label: 'License数量', visible: true, filterable: false, sortable: false },
{ key: 'industryCategory', label: '行业类型', visible: true, filterable: true, sortable: false }, { key: 'industryCategory', label: '行业类型', visible: true, filterable: true, sortable: false },
{ key: 'primaryLanguage', label: '编程语言', visible: true, filterable: true, sortable: false }, { key: 'primaryLanguage', label: '编程语言', visible: true, filterable: true, sortable: false },
{ key: 'codeLines', label: '代码量', visible: true, filterable: false, sortable: false }, { key: 'codeLines', label: '代码量', visible: true, filterable: false, sortable: false }
]); ]);
const validStatusMap = { const validStatusMap = {
0 : '未治理', 0: '未治理',
1 : '可使用', 1: '可使用',
2 : '有风险' 2: '有风险'
} };
const formData = ref({ title: '',type: '', useType: '',formData:'',select: '',time1:null,name:'',versionCode:'',pulishTime:'' }); const formData = ref({
title: '',
type: '',
useType: '',
formData: '',
select: '',
time1: null,
name: '',
versionCode: '',
pulishTime: ''
});
const typeOptions = reactive(['主软件', '依赖软件']); const typeOptions = reactive(['主软件', '依赖软件']);
const riskOptions = reactive(['低', '中', '高']); const riskOptions = reactive(['低', '中', '高']);
const useTypeOptions = reactive(['软件', '文档', '文档+软件']); const useTypeOptions = reactive(['软件', '文档', '文档+软件']);
@@ -230,35 +251,38 @@ const openDelete = (row: any) => {
deletevModels.value = true; deletevModels.value = true;
}; };
const getReleaseList = async() => { const getReleaseList = async () => {
if (!isLogin.value) { if (!isLogin.value) {
return; return;
} }
loading.value = true; loading.value = true;
const { data, error } = await releasePage({ current: pager.value.pageIndex,size: pager.value.pageSize }); const { data, error } = await releasePage({ current: pager.value.pageIndex, size: pager.value.pageSize });
if (!error && data) { if (!error && data) {
loading.value = false; loading.value = false;
allTableData.value = data.data.records; allTableData.value = data.data.records;
tableData.value = [...allTableData.value] tableData.value = [...allTableData.value];
pager.value.total = data.data.total; pager.value.total = data.data.total;
} else { } else {
loading.value = false; loading.value = false;
} }
}; };
onMounted(async() => { onMounted(async () => {
// getReleaseList(); // getReleaseList();
}); });
const filterTable = () => { const filterTable = () => {
tableData.value = allTableData.value.filter(item => { tableData.value = allTableData.value.filter((item) => {
if (currentReusltFilter.value !== null) { if (currentReusltFilter.value !== null) {
return item.softwareName.trim().toLowerCase().includes(searchStr.value.trim().toLowerCase()) && item.validStatus === currentReusltFilter.value; return (
item.softwareName.trim().toLowerCase().includes(searchStr.value.trim().toLowerCase()) &&
item.validStatus === currentReusltFilter.value
);
} else { } else {
return item.softwareName.trim().toLowerCase().includes(searchStr.value.trim().toLowerCase()); return item.softwareName.trim().toLowerCase().includes(searchStr.value.trim().toLowerCase());
} }
}) });
} };
const filterVerifyResult = (type) => { const filterVerifyResult = (type) => {
if (currentReusltFilter.value === type) { if (currentReusltFilter.value === type) {
@@ -267,12 +291,12 @@ const filterVerifyResult = (type) => {
currentReusltFilter.value = type; currentReusltFilter.value = type;
} }
filterTable(); filterTable();
} };
const onSearch = (str: string) => { const onSearch = (str: string) => {
searchStr.value = str; searchStr.value = str;
filterTable(); filterTable();
} };
const router = useRouter(); const router = useRouter();
@@ -285,8 +309,8 @@ const updateShowColumnList = (newValue) => {
tableKey.value++; // 更新 tableKey强制刷新表格 tableKey.value++; // 更新 tableKey强制刷新表格
}; };
const handleBatchImport = async () => {
const handleBatchImport = async() => { // 多个项目导入 // 多个项目导入
// importRepo.value = queryTable.value.filter((val) => val.checked); // importRepo.value = queryTable.value.filter((val) => val.checked);
loadingStatus.batchMigrating = true; loadingStatus.batchMigrating = true;
// await batchMigrate(); // await batchMigrate();
@@ -294,29 +318,27 @@ const handleBatchImport = async() => { // 多个项目导入
}; };
const exportResult = () => { const exportResult = () => {
if (!allTableData.value.length) { if (!allTableData.value.length) {
Message.info('暂无结果'); Message.info('暂无结果');
return; return;
} }
const exportData = allTableData.value.map(item => { const exportData = allTableData.value.map((item) => {
let res = {} let res = {};
columns.value.forEach(col => { columns.value.forEach((col) => {
if (col.key === 'validStatus') { if (col.key === 'validStatus') {
res[col.label] = validStatusMap[item[col.key]] ? validStatusMap[item[col.key]] : ''; res[col.label] = validStatusMap[item[col.key]] ? validStatusMap[item[col.key]] : '';
} else { } else {
res[col.label] = item[col.key] ? item[col.key] : ''; res[col.label] = item[col.key] ? item[col.key] : '';
} }
}) });
return res return res;
}) });
try { try {
const workSheet = XLSX.utils.json_to_sheet(exportData); const workSheet = XLSX.utils.json_to_sheet(exportData);
const workBook: any = { Sheets: { '校验结果': workSheet}, SheetNames: ['校验结果']}; const workBook: any = { Sheets: { 校验结果: workSheet }, SheetNames: ['校验结果'] };
const excelBuffer = XLSX.write(workBook, { bookType: 'xlsx', type: 'array'}); const excelBuffer = XLSX.write(workBook, { bookType: 'xlsx', type: 'array' });
const link = document.createElement('a'); const link = document.createElement('a');
const blob = new Blob([excelBuffer]); const blob = new Blob([excelBuffer]);
@@ -326,11 +348,11 @@ const exportResult = () => {
document.body.appendChild(link); document.body.appendChild(link);
link.click(); link.click();
document.body.removeChild(link); document.body.removeChild(link);
Message.success('导出成功') Message.success('导出成功');
} catch { } catch {
Message.error('导出失败') Message.error('导出失败');
} }
} };
// 跳转 // 跳转
const gotoDetail = (row) => { const gotoDetail = (row) => {
@@ -421,7 +443,6 @@ const signCla = (row: any) => {
right: 0; right: 0;
top: 0; top: 0;
} }
} }
.error { .error {
@@ -440,7 +461,7 @@ const signCla = (row: any) => {
font-size: 12px; font-size: 12px;
line-height: 16px; line-height: 16px;
margin-right: 8px; margin-right: 8px;
border: 1px solid #E3E3EE; border: 1px solid #e3e3ee;
} }
.one-line { .one-line {
@@ -485,7 +506,6 @@ const signCla = (row: any) => {
line-height: 22px; line-height: 22px;
letter-spacing: 0px; letter-spacing: 0px;
text-align: left; text-align: left;
} }
} }

View File

@@ -97,15 +97,7 @@
<!-- 动态渲染列 --> <!-- 动态渲染列 -->
<template v-for="column in columns" :key="column.key"> <template v-for="column in columns" :key="column.key">
<d-column <d-column v-if="column.visible" :field="column.key" :header="column.label">
v-if="column.visible"
:field="column.key"
:header="column.label"
:filterable="column.filterable"
:filter-list="column.filterList"
:sortable="column.sortable"
@filter-change="handleFilterChange"
>
<!-- 自定义列内容 --> <!-- 自定义列内容 -->
<template #default="scope"> <template #default="scope">
<template v-if="column.key === 'versionName'"> <template v-if="column.key === 'versionName'">

View File

@@ -1,17 +1,18 @@
<template> <template>
<div class="info w-full"> <div class="info w-full">
<div class="flex items-center justify-start w-full gap-1"> <div class="flex items-center justify-start w-full gap-1">
<img src="@/assets/imgs/jyh/infoIcon.png"> <img src="@/assets/imgs/jyh/infoIcon.png" />
<span class="text-base font-medium">治理标准:</span> <span class="text-base font-medium">治理标准:</span>
</div> </div>
<div> <div>
<ul> <ul>
<li> <li>
1在依赖冲突或者解决依赖软件漏洞的场景下产品引入的依赖组件与社区的依赖关系不一致从而通过产品自行录入由使用方自行维护可通过产品快速补包流程维护<a class="devui-link">操作指导</a>该部分的依赖组件漏洞由产品自行解决 1在依赖冲突或者解决依赖软件漏洞的场景下产品引入的依赖组件与社区的依赖关系不一致从而通过产品自行录入由使用方自行维护可通过产品快速补包流程维护<a
</li> class="devui-link"
<li> >操作指导</a
2点击下面组件编码跳转到组件详情页面可直接看到基于当前火车过滤的组件依赖路径 >该部分的依赖组件漏洞由产品自行解决
</li> </li>
<li>2点击下面组件编码跳转到组件详情页面可直接看到基于当前火车过滤的组件依赖路径</li>
</ul> </ul>
</div> </div>
</div> </div>
@@ -20,30 +21,29 @@
<div class="vertical-line"></div> <div class="vertical-line"></div>
<d-button variant="text" @click="openAll(baseTreeTableData1)"> <d-button variant="text" @click="openAll(baseTreeTableData1)">
<div v-if="!isAllExpand" class="flex items-center justify-start gap-1"> <div v-if="!isAllExpand" class="flex items-center justify-start gap-1">
<img style="width: 14px; height: 14px;" src="@/assets/imgs/jyh/openAll.png"> <img style="width: 14px; height: 14px" src="@/assets/imgs/jyh/openAll.png" />
全部展开 全部展开
</div> </div>
<div v-else class="flex items-center justify-start gap-1"> <div v-else class="flex items-center justify-start gap-1">
<img style="width: 14px; height: 14px;" src="@/assets/imgs/jyh/closeAll.png"> <img style="width: 14px; height: 14px" src="@/assets/imgs/jyh/closeAll.png" />
全部关闭 全部关闭
</div> </div>
</d-button> </d-button>
</div> </div>
<Card simple class="jyh-card mt-3"> <Card simple class="jyh-card mt-3">
<div class="clear-padding"> <div class="clear-padding">
<d-table ref="table" :data="baseTreeTableData1" > <d-table ref="table" :data="baseTreeTableData1">
<d-column width="20px" type="index"> <d-column width="20px" type="index"> </d-column>
</d-column>
<d-column field="name" header="软件版本名称" show-overflow-tooltip></d-column> <d-column field="name" header="软件版本名称" show-overflow-tooltip></d-column>
<d-column field="groupid" header="groupid"></d-column> <d-column field="groupid" header="groupid"></d-column>
<d-column field="code" filterable :filter-list="filterList" @filter-change="handleFilterChange" header="软件编号"> <d-column field="code" header="软件编号">
<template #default="scope"> <template #default="scope">
<a class="devui-link" @click="showDetail = true">{{ scope.row.code }}</a> <a class="devui-link" @click="showDetail = true">{{ scope.row.code }}</a>
</template> </template>
</d-column> </d-column>
<d-column field="packageName" filterable :filter-list="packageFilterList" @filter-change="handleFilterChange" header="packageName"></d-column> <d-column field="packageName" header="packageName"></d-column>
<d-column field="version" filterable :filter-list="versionFilterList" @filter-change="handleFilterChange" header="version"></d-column> <d-column field="version" header="version"></d-column>
<d-column field="language" filterable :filter-list="languageFilterList" @filter-change="handleFilterChange" header="编程语言"></d-column> <d-column field="language" header="编程语言"></d-column>
<d-column field="number" header="软件漏洞数量"> <d-column field="number" header="软件漏洞数量">
<template #default="scope"> <template #default="scope">
<a class="devui-link" @click="showDetail = true">{{ scope.row.number }}</a> <a class="devui-link" @click="showDetail = true">{{ scope.row.number }}</a>
@@ -53,35 +53,40 @@
</div> </div>
</Card> </Card>
<div class="w-full flex justify-end my-4"> <div class="w-full flex justify-end my-4">
<d-pagination <d-pagination
size="sm" size="sm"
:total="pager.total" :total="pager.total"
v-model:pageSize="pager.pageSize" v-model:pageSize="pager.pageSize"
v-model:pageIndex="pager.pageIndex" v-model:pageIndex="pager.pageIndex"
:can-view-total="true" :can-view-total="true"
:can-change-page-size="true" :can-change-page-size="true"
:can-jump-page="true" :can-jump-page="true"
:max-items="5" :max-items="5"
/> />
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, reactive } from 'vue'; import { ref, reactive } from 'vue';
import { getDepencyList } from '@/api/jyh' import { getDepencyList } from '@/api/jyh';
const checked = ref(false); const checked = ref(false);
const showDetail = ref(false); const showDetail = ref(false);
const table = ref(null) const table = ref(null);
const isAllExpand = ref(false); const isAllExpand = ref(false);
const pager = ref({ const pager = ref({
pageIndex: 1, pageIndex: 1,
pageSize: 30, pageSize: 30,
total: 10 total: 10
}) });
const filterList = ref([{name: '001', value: '001'}, {name: '002', value: '002'}, {name: '003', value: '003'}, {name: '004', value: '004'}]) const filterList = ref([
{ name: '001', value: '001' },
{ name: '002', value: '002' },
{ name: '003', value: '003' },
{ name: '004', value: '004' }
]);
const handleFilterChange = (val) => { const handleFilterChange = (val) => {
if (!val.length) { if (!val.length) {
baseTreeTableData1.value = [ ...originSource.value ] baseTreeTableData1.value = [...originSource.value];
return return;
} }
const filterList = val.map((item) => item.value); const filterList = val.map((item) => item.value);
baseTreeTableData1.value = originSource.value.filter((item) => filterList.includes(item.code)); baseTreeTableData1.value = originSource.value.filter((item) => filterList.includes(item.code));
@@ -115,7 +120,7 @@ const originSource = ref([
packageName: '包名称', packageName: '包名称',
version: '202306', version: '202306',
language: 'java', language: 'java',
number: '20', number: '20'
}, },
{ {
id: '4', id: '4',
@@ -125,7 +130,7 @@ const originSource = ref([
packageName: '包名称', packageName: '包名称',
version: '202306', version: '202306',
language: 'java', language: 'java',
number: '20', number: '20'
} }
] ]
} }
@@ -159,7 +164,7 @@ const originSource = ref([
packageName: '包名称', packageName: '包名称',
version: '202306', version: '202306',
language: 'java', language: 'java',
number: '11', number: '11'
}, },
{ {
id: '8', id: '8',
@@ -169,7 +174,7 @@ const originSource = ref([
packageName: '包名称', packageName: '包名称',
version: '202306', version: '202306',
language: 'java', language: 'java',
number: '30', number: '30'
} }
] ]
} }
@@ -183,44 +188,50 @@ const originSource = ref([
packageName: '包名称', packageName: '包名称',
version: '202306', version: '202306',
language: 'java', language: 'java',
number: '5', number: '5'
} }
]); ]);
const baseTreeTableData1 = ref([...originSource.value]); const baseTreeTableData1 = ref([...originSource.value]);
const packageFilterList = ref(originSource.value.map(item => { const packageFilterList = ref(
return {name: item.packageName, value: item.packageName} originSource.value.map((item) => {
})) return { name: item.packageName, value: item.packageName };
})
);
const versionFilterList = ref(originSource.value.map(item => { const versionFilterList = ref(
return {name: item.version, value: item.version} originSource.value.map((item) => {
})) return { name: item.version, value: item.version };
})
);
const languageFilterList = ref(originSource.value.map(item => { const languageFilterList = ref(
return {name: item.language, value: item.language} originSource.value.map((item) => {
})) return { name: item.language, value: item.language };
})
);
const openAll = (tree) => { const openAll = (tree) => {
if (!tree || !tree.length) { if (!tree || !tree.length) {
return return;
} }
tree.forEach(node => { tree.forEach((node) => {
table.value.store.toggleRowExpansion(node); table.value.store.toggleRowExpansion(node);
if (node.children) { if (node.children) {
openAll(node.children); openAll(node.children);
} }
}) });
isAllExpand.value = !isAllExpand.value isAllExpand.value = !isAllExpand.value;
} };
const sortNumberMethod = (a, b) => { const sortNumberMethod = (a, b) => {
return a.number > b.number return a.number > b.number;
} };
const getList = async() => { const getList = async () => {
const res = await getDepencyList('APACHE-001'); const res = await getDepencyList('APACHE-001');
} };
getList(); getList();
</script> </script>
@@ -240,7 +251,7 @@ getList();
.info { .info {
padding: 10px 20px; padding: 10px 20px;
border-radius: 4px; border-radius: 4px;
background: #E1E8FD; background: #e1e8fd;
img { img {
width: 14px; width: 14px;
height: 14px; height: 14px;

View File

@@ -3,58 +3,24 @@
<div class="mt-3"> <div class="mt-3">
<d-table class="jyh-table" v-if="tableData.length > 0" :striped="false" :data="tableData" table-layout="auto"> <d-table class="jyh-table" v-if="tableData.length > 0" :striped="false" :data="tableData" table-layout="auto">
<d-column type="index" width="40"></d-column> <d-column type="index" width="40"></d-column>
<d-column field="vulnId" header="编码" filterable :filter-list="filterList" @filter-change="handleFilterChange"> <d-column field="vulnId" header="编码">
<template #default="scope"> <template #default="scope">
<a @click="openVulnDetail(scope.row)">{{ scope.row.vulnId }}</a> <a @click="openVulnDetail(scope.row)">{{ scope.row.vulnId }}</a>
</template> </template>
</d-column> </d-column>
<d-column <d-column field="cweId" header="CVE ID"></d-column>
field="cweId" <d-column field="cvssScore" header="CVSS 打分"></d-column>
header="CVE ID" <d-column field="version" header="修补状态">
filterable
:filter-list="filterList"
@filter-change="handleFilterChange"
></d-column>
<d-column
field="cvssScore"
header="CVSS 打分"
filterable
:filter-list="filterList"
@filter-change="handleFilterChange"
></d-column>
<d-column
field="version"
header="修补状态"
filterable
:filter-list="filterList"
@filter-change="handleFilterChange"
>
<template #default="scope"> <template #default="scope">
<a>{{ scope.row.version }}</a> <a>{{ scope.row.version }}</a>
</template> </template>
</d-column> </d-column>
<d-column <d-column field="severity" header="漏洞级别">
field="severity"
header="漏洞级别"
sortable
:sort-method="sortNameMethod"
filterable
:filter-list="filterList"
@filter-change="handleFilterChange"
>
<template #default="scope"> <template #default="scope">
<a>{{ scope.row.severity }}</a> <a>{{ scope.row.severity }}</a>
</template> </template>
</d-column> </d-column>
<d-column <d-column field="fixVersion" header="补丁版本">
field="fixVersion"
header="补丁版本"
sortable
:sort-method="sortNameMethod"
filterable
:filter-list="filterList"
@filter-change="handleFilterChange"
>
<template #default="scope"> <template #default="scope">
<a>{{ scope.row.fixVersion }}</a> <a>{{ scope.row.fixVersion }}</a>
</template> </template>