Files
Situation-Awareness-Platfor…/src/views/Jyh/Version/Detail/VulnerabilitiesList.vue

327 lines
8.3 KiB
Vue
Raw Normal View History

2025-03-13 19:38:45 +08:00
<template>
<div class="soft-detail-container">
<div class="mt-3">
2025-03-19 16:20:20 +08:00
<d-table class="jyh-table" v-if="tableData.length>0" :striped="false" :data="tableData" table-layout="auto">
2025-03-13 19:38:45 +08:00
<d-column type="index" width="40"></d-column>
2025-03-19 12:08:19 +08:00
<d-column field="vulnId" header="编码" filterable :filter-list="filterList" @filter-change="handleFilterChange">
2025-03-13 19:38:45 +08:00
<template #default="scope">
2025-03-19 12:08:19 +08:00
<a @click="openVulnDetail(scope.row)">{{ scope.row.vulnId }}</a>
2025-03-13 19:38:45 +08:00
</template>
</d-column>
<d-column
2025-03-19 12:08:19 +08:00
field="cweId"
2025-03-13 19:38:45 +08:00
header="CVE ID"
filterable
:filter-list="filterList"
@filter-change="handleFilterChange"
></d-column>
<d-column
2025-03-19 12:08:19 +08:00
field="cvssScore"
2025-03-13 19:38:45 +08:00
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">
<a>{{ scope.row.version }}</a>
</template>
</d-column>
<d-column
2025-03-19 12:08:19 +08:00
field="severity"
2025-03-13 19:38:45 +08:00
header="漏洞级别"
sortable
:sort-method="sortNameMethod"
filterable
:filter-list="filterList"
@filter-change="handleFilterChange"
>
<template #default="scope">
2025-03-19 12:08:19 +08:00
<a>{{ scope.row.severity }}</a>
2025-03-13 19:38:45 +08:00
</template>
</d-column>
<d-column
2025-03-19 12:08:19 +08:00
field="fixVersion"
2025-03-13 19:38:45 +08:00
header="补丁版本"
sortable
:sort-method="sortNameMethod"
filterable
:filter-list="filterList"
@filter-change="handleFilterChange"
>
<template #default="scope">
2025-03-19 12:08:19 +08:00
<a>{{ scope.row.fixVersion }}</a>
</template>
</d-column>
<d-column field="publishDate" header="补丁修复时间" fixed-right="0px">
<template #default="scope">
{{ dayjs(scope.row.publishDate).format('YYYY-MM-DD') }}
2025-03-13 19:38:45 +08:00
</template>
</d-column>
</d-table>
2025-03-19 16:20:20 +08:00
<NoData v-else :small="false"></NoData>
2025-03-13 19:38:45 +08:00
</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="总计"
2025-03-19 16:32:10 +08:00
@page-index-change="fetchVulnList"
@page-size-change="fetchVulnList"
2025-03-13 19:38:45 +08:00
/>
</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"
2025-03-19 16:32:10 +08:00
>你确认删除此项{{ item.cla_name }} </span
2025-03-13 19:38:45 +08:00
>
</GModal>
2025-03-19 10:36:20 +08:00
2025-03-15 13:18:02 +08:00
<!-- 漏洞详情 -->
2025-03-19 12:08:19 +08:00
<d-drawer v-model="vulnDetailVisable" style="width: auto">
2025-03-19 10:34:17 +08:00
<VulnerabilityDetail :softwareId="currentVuln.softwareId" :vulnId="currentVuln.id"></VulnerabilityDetail>
2025-03-15 13:18:02 +08:00
</d-drawer>
2025-03-13 19:38:45 +08:00
</div>
</template>
<script setup lang="ts">
2025-03-19 12:08:19 +08:00
import * as dayjs from 'dayjs';
2025-03-13 19:38:45 +08:00
import SettingTitle from '@/components/Setting/SettingTitle/index.vue';
import SettingText from '@/components/Setting/SettingText/index.vue';
2025-03-19 16:20:20 +08:00
import { ref, reactive, onMounted,defineProps } from 'vue';
2025-03-13 19:38:45 +08:00
import { getGroupClaList, setGroupClaStatus, deleteGroupCla } from '@/api/cla';
import { useRouter, useRoute } from 'vue-router';
import { GModal } from '@/components/Setting/index';
2025-03-19 10:36:20 +08:00
import { reqCatch } from '@/utils/catch';
2025-03-13 19:38:45 +08:00
import { getOrgInfo } from '@/views/Org/hooks/orgInfo';
import { Message } from 'vue-devui';
2025-03-19 10:36:20 +08:00
import VulnerabilityDetail from '@/views/Jyh/Version/Detail/VulnerabilityDetail.vue';
2025-03-19 12:08:19 +08:00
import { getVulnList } from '@/api/jyh';
2025-03-19 16:20:20 +08:00
import NoData from '@/components/NoData/NoData.vue';
2025-03-13 19:38:45 +08:00
const { namespace } = getOrgInfo();
2025-03-19 16:20:20 +08:00
const propsData = defineProps(['versionId']);
const tableData = ref([]);
2025-03-13 19:38:45 +08:00
const formData = ref({
title: '',
type: '',
useType: '',
formData: '',
select: '',
time1: null,
name: '',
versionCode: '',
pulishTime: ''
});
const typeOptions = reactive(['主软件', '依赖软件']);
const riskOptions = reactive(['低', '中', '高']);
const useTypeOptions = reactive(['软件', '文档', '文档+软件']);
const isUseOptions = reactive(['是', '否']);
const pager = ref({
total: 10,
pageIndex: 1,
pageSize: 10
});
// 删除弹窗
const item = ref('');
const deleteModal = ref();
const deletevModels = ref(false);
const openDelete = (row: any) => {
item.value = row;
deleteModal.value.showFlag = true;
deletevModels.value = true;
};
const router = useRouter();
const repoFun = (arr: any) => {
return arr ? (arr.length > 3 ? arr.slice(0, 3) : arr) : [];
};
// 编辑
const editRow = (row: any) => {
// 后续请换成params暂时params传参没传过去
router.push({
path: 'cla/edit/' + row.object_id,
query: { cla: row.cla, pageType: 'edit' }
});
};
// 确认删除
const confirmDelete = async (e: any) => {
// const res = await reqCatch(deleteGroupCla, { group_id: namespace.value, cla_id: item.value.object_id });
// if (!res.error) {
// getGroupClaListData();
// }
};
// 去成员页
const goMember = (row: any) => {
// 后续请换成params暂时params传参没传过去,注意路由有个:claID
router.push({
path: 'cla/claId/member',
query: { claId: row.object_id, claName: row.cla_name, group_path: namespace.value, pageType: 'edit' }
});
};
const getGroupClaListData = async () => {
// const params = {
// group_id: namespace.value,
// page: pager.value.pageIndex,
// per_page: pager.value.pageSize
// };
// const res = await reqCatch(getGroupClaList, params);
// if (!res.error) {
// tableData.value = res?.data?.data?.content;
// pager.value.total = res.data.data.total;
// }
};
getGroupClaListData();
const setClaStatus = async (row: any) => {
// const params = {
// group_id: namespace.value,
// cla_id: row.object_id,
// status: row.status
// };
// const res = await reqCatch(setGroupClaStatus, params);
// if (!res.error) {
// Message.success('操作成功!');
// getGroupClaListData();
// }
};
const signCla = (row: any) => {
router.push('/cla/' + row.object_id);
};
2025-03-15 13:18:02 +08:00
const vulnDetailVisable = ref(false);
const currentVuln = ref();
const openVulnDetail = (row) => {
vulnDetailVisable.value = true;
2025-03-19 12:08:19 +08:00
if (row.softwareId && row.id) {
2025-03-19 10:34:17 +08:00
currentVuln.value = row;
} else {
currentVuln.value = {
2025-03-19 16:20:20 +08:00
// softwareId: 47,
softwareId: propsData.versionId,
2025-03-19 10:34:17 +08:00
id: 72
2025-03-19 12:08:19 +08:00
};
2025-03-19 10:34:17 +08:00
}
2025-03-19 12:08:19 +08:00
};
2025-03-19 16:20:20 +08:00
const fetchVulnList = async () => {
const { data } = await getVulnList({
// softwareId: 47,
softwareId: propsData.versionId,
2025-03-19 16:32:10 +08:00
componentId: '',
2025-03-19 12:08:19 +08:00
current: 1,
size: 10
});
2025-03-19 16:20:20 +08:00
if(data.data.code===200) {
tableData.value = data?.data?.data?.records || [];
2025-03-19 16:32:10 +08:00
pager.value.total = data?.data?.data?.total || [];
2025-03-19 16:20:20 +08:00
}
}
const valLists = ref([]);
onMounted( () => {
fetchVulnList()
2025-03-19 12:08:19 +08:00
});
2025-03-13 19:38:45 +08:00
</script>
<style scoped lang="scss">
@import 'devui-theme/styles-var/devui-var.scss';
.soft-detail-container {
2025-03-19 16:20:20 +08:00
//padding: 7px 20px 12px;
2025-03-13 19:38:45 +08:00
}
.error {
color: $devui-contrast;
}
:deep(.devui-table__row td) {
padding-top: 16px;
padding-bottom: 16px;
}
:deep(.devui-tag .devui-tag--default) {
background-color: #fff;
border-radius: 12px;
padding: 4px 8px;
font-size: 12px;
line-height: 16px;
margin-right: 8px;
border: 1px solid #e3e3ee;
}
.one-line {
word-break: break-all;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
.title {
font-size: 14px;
font-weight: 400;
color: #9a9b9c;
line-height: 20px;
}
.cur-title {
font-size: 14px;
font-weight: 500;
color: #2d2d2e;
line-height: 20px;
}
.search-form {
position: relative;
padding: 12px 20px 12px 0;
border-radius: 8px 0px 8px 8px;
//background: #F2F5FC;
.output-btn {
position: absolute;
right: 28px;
bottom: 4px;
color: #191919;
font-family: HarmonyOS Sans SC;
font-weight: regular;
font-size: 14px;
line-height: 22px;
letter-spacing: 0px;
text-align: left;
}
}
.secret-breadcrumb {
padding: 7px 20px 12px;
background: #ffffff;
}
</style>