merge wsw into master

fix: 去掉表头排序及筛选

Created-by: yfzmpj
Commit-by: 汪少伟
Merged-by: yfzmpj
Description: fix: 去掉表头排序及筛选

See merge request: hk_openRepo/OpenRepo_Portal!68
This commit is contained in:
yfzmpj
2025-03-25 09:16:06 +08:00
7 changed files with 239 additions and 239 deletions

View File

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

View File

@@ -1,21 +1,20 @@
<template>
<div class="secret-container">
<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>
<!-- 动态渲染列 -->
<template v-for="column in columns" :key="column.key">
<d-column
v-if="column.visible"
:field="column.key"
:header="column.label"
:filterable="column.filterable"
:filter-list="column.filterList"
:sortable="column.sortable"
@filter-change="handleFilterChange"
>
<d-column v-if="column.visible" :field="column.key" :header="column.label">
<!-- 自定义列内容 -->
<template #default="scope">
<template v-if="column.key === 'versionName'">
@@ -55,24 +54,32 @@
</template>
</d-table>
<DataPanel v-else skeleton :card="false" :empty="true">
</DataPanel>
<DataPanel v-else skeleton :card="false" :empty="true"> </DataPanel>
</div>
<div class="mt-20 mb-20 flex justify-end">
<d-pagination size="md" :page-size-options="[10, 20, 50]" :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()" />
<d-pagination
size="md"
:page-size-options="[10, 20, 50]"
: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>
</template>
<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 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 { useRouter, useRoute } from 'vue-router';
import { GModal } from '@/components/Setting/index';
@@ -110,7 +117,7 @@ const tableData = ref([
externalVulnerabilitySource: 'CVE-2025-1234',
versionDescription: '修复了若干安全漏洞',
compatibilityRisk: '低',
communityEOL: '2028-12-31',
communityEOL: '2028-12-31'
},
{
softwareName: 'react',
@@ -133,7 +140,7 @@ const tableData = ref([
externalVulnerabilitySource: 'CVE-2025-5678',
versionDescription: '新增了并发渲染功能',
compatibilityRisk: '中',
communityEOL: '2030-12-31',
communityEOL: '2030-12-31'
},
{
softwareName: 'vue',
@@ -156,7 +163,7 @@ const tableData = ref([
externalVulnerabilitySource: 'CVE-2025-9101',
versionDescription: '优化了性能',
compatibilityRisk: '低',
communityEOL: '2029-12-31',
communityEOL: '2029-12-31'
},
{
softwareName: 'webpack',
@@ -179,7 +186,7 @@ const tableData = ref([
externalVulnerabilitySource: 'CVE-2025-1122',
versionDescription: '修复了构建性能问题',
compatibilityRisk: '高',
communityEOL: '2027-12-31',
communityEOL: '2027-12-31'
},
{
softwareName: 'babel',
@@ -202,7 +209,7 @@ const tableData = ref([
externalVulnerabilitySource: 'CVE-2025-3344',
versionDescription: '新增了对新语法的支持',
compatibilityRisk: '中',
communityEOL: '2026-12-31',
communityEOL: '2026-12-31'
},
{
softwareName: 'typescript',
@@ -225,7 +232,7 @@ const tableData = ref([
externalVulnerabilitySource: '无',
versionDescription: '新增了装饰器功能',
compatibilityRisk: '低',
communityEOL: '2035-12-31',
communityEOL: '2035-12-31'
},
{
softwareName: 'jest',
@@ -248,7 +255,7 @@ const tableData = ref([
externalVulnerabilitySource: 'CVE-2025-5566',
versionDescription: '优化了测试性能',
compatibilityRisk: '中',
communityEOL: '2032-12-31',
communityEOL: '2032-12-31'
},
{
softwareName: 'docker',
@@ -271,7 +278,7 @@ const tableData = ref([
externalVulnerabilitySource: 'CVE-2025-7788',
versionDescription: '新增了对ARM架构的支持',
compatibilityRisk: '高',
communityEOL: '2030-12-31',
communityEOL: '2030-12-31'
},
{
softwareName: 'kubernetes',
@@ -294,7 +301,7 @@ const tableData = ref([
externalVulnerabilitySource: 'CVE-2025-9900',
versionDescription: '优化了集群管理功能',
compatibilityRisk: '高',
communityEOL: '2033-12-31',
communityEOL: '2033-12-31'
},
{
softwareName: 'postgresql',
@@ -317,10 +324,20 @@ const tableData = ref([
externalVulnerabilitySource: 'CVE-2025-1122',
versionDescription: '新增了JSONB索引功能',
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 riskOptions = reactive(['低', '中', '高']);
const useTypeOptions = reactive(['软件', '文档', '文档+软件']);
@@ -332,7 +349,7 @@ const newFormData = ref({
dependentSoftware: '',
programmingLanguage: '',
dateRange: ['', '']
})
});
const pager = ref({
total: 10,
@@ -369,10 +386,16 @@ const columns = ref([
{ key: 'softwareScore', label: '软件评分', visible: false, filterable: false, sortable: true },
{ key: 'sourceCodeDownload', label: '源码包下载地址', visible: true, 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: '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 状态
@@ -482,7 +505,6 @@ onMounted(() => {
right: 0;
top: 0;
}
}
.error {
@@ -501,7 +523,7 @@ onMounted(() => {
font-size: 12px;
line-height: 16px;
margin-right: 8px;
border: 1px solid #E3E3EE;
border: 1px solid #e3e3ee;
}
.one-line {
@@ -544,7 +566,6 @@ onMounted(() => {
line-height: 22px;
letter-spacing: 0px;
text-align: left;
}
}

View File

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

View File

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

View File

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

View File

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

View File

@@ -3,58 +3,24 @@
<div class="mt-3">
<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 field="vulnId" header="编码" filterable :filter-list="filterList" @filter-change="handleFilterChange">
<d-column field="vulnId" header="编码">
<template #default="scope">
<a @click="openVulnDetail(scope.row)">{{ scope.row.vulnId }}</a>
</template>
</d-column>
<d-column
field="cweId"
header="CVE ID"
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"
>
<d-column field="cweId" header="CVE ID"></d-column>
<d-column field="cvssScore" header="CVSS 打分"></d-column>
<d-column field="version" header="修补状态">
<template #default="scope">
<a>{{ scope.row.version }}</a>
</template>
</d-column>
<d-column
field="severity"
header="漏洞级别"
sortable
:sort-method="sortNameMethod"
filterable
:filter-list="filterList"
@filter-change="handleFilterChange"
>
<d-column field="severity" header="漏洞级别">
<template #default="scope">
<a>{{ scope.row.severity }}</a>
</template>
</d-column>
<d-column
field="fixVersion"
header="补丁版本"
sortable
:sort-method="sortNameMethod"
filterable
:filter-list="filterList"
@filter-change="handleFilterChange"
>
<d-column field="fixVersion" header="补丁版本">
<template #default="scope">
<a>{{ scope.row.fixVersion }}</a>
</template>