Files
Situation-Awareness-Platfor…/src/views/Jyh/AIRepair/index.vue

254 lines
6.8 KiB
Vue
Raw Normal View History

2025-03-14 20:03:14 +08:00
<template>
<div class="info-outside w-full">
<div class="info">
<div class="flex items-center justify-start w-full gap-1">
<img src="@/assets/imgs/jyh/aiIcon.png">
<span class="text-base font-medium">AI修复建议:</span>
</div>
<div>
<ul>
<li v-for="info in infoList">{{ info }}</li>
</ul>
</div>
</div>
</div>
2025-03-14 20:03:14 +08:00
<div class="ai-container">
2025-03-19 21:43:36 +08:00
<template v-if="tableData.length>0">
<div class="ai-container-card" style="width: 100%;" v-for="(rowItem, index) in tableData" :key="index">
<Panel :expand="!rowItem.expand">
<template #header>
<div class="ai-panel-header">
<div style="padding: 25px 8px 0px 20px;">
<img style="width: 36px; height: 33px;" src="@/assets/imgs/jyh/warning.png">
2025-03-14 20:03:14 +08:00
</div>
2025-03-19 21:43:36 +08:00
<div style="width: 100%; padding: 20px 20px 0px 0;">
<div class="ai-panel-header-title">
<div>
<d-tag color="red-w98" class="mr-1" size="sm">{{'严重'}}</d-tag>
<span>{{rowItem.libraryName||'--'}}</span>
</div>
<div style="cursor: pointer; display: flex; gap: 8px; align-items: center;" @click="rowItem.expand == rowItem.expand">
<img style="width: 14px; height: 14px;" src="@/assets/imgs/jyh/collapseIcon.png">
<span>全部收起</span>
</div>
2025-03-14 20:03:14 +08:00
</div>
2025-03-19 21:43:36 +08:00
<div class="ai-panel-header-sub-title">
<div>
<span class="weak-text">安全问题</span>
<span>{{rowItem.vulnerabilities.length ||'--'}}</span>
</div>
<div>
<span class="weak-text">修复兼容性</span>
<span>{{rowItem.vulnerabilities.length ||'--'}}</span>
<img src="@/assets/imgs/jyh/help.png" class="icon-sm">
<d-tag class="ml-1" type="warning" size="sm">{{rowItem.vulnerabilities.length>0?rowItem.vulnerabilities[0].severity:'--'}}</d-tag>
</div>
<div>
<span class="weak-text">升级版本</span>
<span>{{rowItem.currentVersion ||'--'}}</span>
<img src="@/assets/imgs/jyh/ic_digital_power_next_step_@2x.png" class="icon-sm">
<span>{{rowItem.currentVersion ||'--'}}</span>
</div>
2025-03-14 20:03:14 +08:00
</div>
</div>
</div>
2025-03-19 21:43:36 +08:00
</template>
2025-03-14 20:03:14 +08:00
2025-03-19 21:43:36 +08:00
<template #body>
<div style="padding: 8px 20px 20px 20px; width: 100%;">
<Table class="jyh-table" :tableConfig="tableConfig" :dataSource="rowItem.vulnerabilities"/>
<div class="w-full flex items-center justify-end"><span>{{ rowItem.vulnerabilities.length }}</span></div>
</div>
</template>
</Panel>
</div>
</template>
<NoData v-else :small="false"></NoData>
2025-03-14 20:03:14 +08:00
</div>
</template>
<script setup>
2025-03-19 21:43:36 +08:00
import { ref,onMounted,defineProps } from 'vue';
2025-03-14 20:03:14 +08:00
import Panel from '@/components/AIRepair/Panel.vue';
import Table from '@/components/AIRepair/Table.vue';
2025-03-19 21:43:36 +08:00
import NoData from '@/components/NoData/NoData.vue';
2025-03-18 22:01:02 +08:00
import { getRepairInfo } from '@/api/jyh';
2025-03-19 21:43:36 +08:00
const propsData = defineProps(['versionId']);
const infoList = ref([
'当前代码主要风险为易受常见的注入攻击包括命令注入、SQL注入、表达式注入针对每种攻击应提供相应的防范措施如数据校验、使用安全函数和限制程序权限。',
'相对上一次检查【提升点】在于代码基础编码问题少了47.8%问题总数降低29.3%'
])
2025-03-14 20:03:14 +08:00
const tableConfig = ref([
{
2025-03-19 21:43:36 +08:00
field: 'vulnId',
2025-03-14 20:03:14 +08:00
header: '安全问题编号',
sortable: true,
sortMethod: null
},
{
2025-03-19 21:43:36 +08:00
field: 'vulnType',
2025-03-14 20:03:14 +08:00
header: '安全问题类型',
sortable: false,
sortMethod: null
},
{
2025-03-19 21:43:36 +08:00
field: 'vulnId',
2025-03-14 20:03:14 +08:00
header: 'CWE编号',
sortable: false,
sortMethod: null
},
{
2025-03-19 21:43:36 +08:00
field: 'cvssScore',
2025-03-14 20:03:14 +08:00
header: '分值',
sortable: true,
sortMethod: null
},
])
const list = ref([
{
expand: true,
title: 'Morgan',
data: {
listData: [
{
securityProblemCode: '1',
type: '安全问题',
CWEcode: 'CWE-123',
score: 70
},
{
securityProblemCode: '2',
type: '安全问题',
CWEcode: 'MIT-LICENSE',
score: 89
}
]
}
},
{
expand: true,
title: 'webpack',
data: {
listData: [
{
securityProblemCode: '1',
type: '安全问题',
CWEcode: 'CWE-123',
score: 100
},
{
securityProblemCode: '2',
type: '安全问题',
CWEcode: 'MIT-LICENSE',
score: 90
2025-03-14 20:03:14 +08:00
}
]
}
}
])
2025-03-18 22:01:02 +08:00
const getInfo = async() => {
2025-03-19 21:43:36 +08:00
const { data } = await getRepairInfo({
"current": 1,
"size": 10,
2025-03-21 09:49:58 +08:00
// "softwareId": 47,
softwareId: propsData.versionId,
2025-03-19 21:43:36 +08:00
});
debugger
if(data.code===200) {
tableData.value = data?.data?.components || [];
// pager.value.total = data?.data?.data?.total || [];
}
2025-03-18 22:01:02 +08:00
}
2025-03-19 21:43:36 +08:00
const tableData = ref([]);
onMounted( () => {
getInfo()
});
2025-03-14 20:03:14 +08:00
</script>
<style scoped lang="scss">
@import 'devui-theme/styles-var/devui-var.scss';
.ai-container {
width: 100%;
display: flex;
flex-direction: column;
gap: 20px;
justify-content: center;
&-card {
border-top: 2px solid $devui-danger;
background-color: $devui-base-bg;
border-radius: var(--devui-border-radius-card, 8px);
box-shadow: var(--devui-shadow-length-base, 0 2px 6px 0) var(--devui-light-shadow, rgba(37, 43, 58, .12));
}
}
.ai-panel-header {
display: flex;
flex-direction: row;
2025-03-15 18:01:29 +08:00
height: 80px;
2025-03-14 20:03:14 +08:00
&-title {
width: 100%;
display: flex;
justify-content: space-between;
align-items: center;
}
&-sub-title {
display: flex;
align-items: center;
margin-top: 10px;
div {
display: flex;
gap: 8px;
align-items: center;
margin-right: 20px;
position: relative;
&:not(:last-child)::after {
content: '';
position: absolute;
right: -10px;
height: 100%;
width: 1px;
background-color: $devui-line;
}
}
}
}
.weak-text {
color: $devui-text-weak;
}
.icon-sm {
width: 14px;
height: 14px;
}
.info-outside {
margin: 20px 0;
padding: 1px;
border-radius: 8px;
background-image: linear-gradient(134.79deg, #A4F7DF 0%, #A0CEFB 21%, #5F9AFE 43%, #D9B9FC 62%, #01EFBB 73%, #FBAE46 100%);
}
.info {
padding: 10px 20px;
border-radius: 8px;
background-color: #ffffff;
img {
width: 24px;
height: 24px;
}
ul {
list-style: disc;
padding-left: 18px;
line-height: 22px;
}
}
2025-03-19 21:43:36 +08:00
</style>