This commit is contained in:
汪少伟
2025-03-21 10:30:37 +08:00
parent cc87314dcb
commit 125f781ac5
2 changed files with 62 additions and 46 deletions

View File

@@ -87,9 +87,12 @@
@click="openWarningDetail(item, index)"
>
<span>{{ item.subject }}</span>
<d-tag v-if="item.importance" :color="tagMap[item.importance].color" size="sm">{{
tagMap[item.importance].text
}}</d-tag>
<d-tag
v-if="item.importance && tagMap[item.importance]"
:color="tagMap[item.importance].color"
size="sm"
>{{ tagMap[item.importance].text }}</d-tag
>
</div>
<div class="time-container">
<d-icon name="icon-time"></d-icon>
@@ -144,19 +147,19 @@ const { isLogin } = useDiscussGetUserInfo();
const homeSearch = ref(null);
const dropdownWidth = ref(0);
const tagMap = {
Critical: {
critical: {
text: '致命',
color: '#c7000b'
},
High: {
high: {
text: '高',
color: '#f66f6a'
},
Medium: {
medium: {
text: '中',
color: '#fac20a'
},
Low: {
low: {
text: '低',
color: '#5e7ce0'
}
@@ -184,9 +187,11 @@ const closeOutside = () => {
};
const submit = (formData) => {
debugger
debugger;
isOpen.value = false;
router.push({ name: 'Search', query: {
router.push({
name: 'Search',
query: {
softwareName: searchStr.value ? searchStr.value : '',
searchType: getIndustryValue(searchType.value),
softwareVersion: formData.softwareVersion || '',
@@ -195,9 +200,10 @@ const submit = (formData) => {
industry: formData.industry || '',
licenseName: formData.licenseName || '',
dependentSoftware: formData.dependentSoftware || '',
releaseDateStart: formData.dateRange&&formData.dateRange.length>0?formData.dateRange[0]:'',
releaseDateEnd: formData.dateRange&&formData.dateRange.length>0?formData.dateRange[1]:'',
} });
releaseDateStart: formData.dateRange && formData.dateRange.length > 0 ? formData.dateRange[0] : '',
releaseDateEnd: formData.dateRange && formData.dateRange.length > 0 ? formData.dateRange[1] : ''
}
});
};
const inputFocus = () => {
@@ -216,15 +222,19 @@ const updateDropdownWidth = () => {
const globalInfo = useGlobalInfoStore();
const industryList = globalInfo.industryList;
const getIndustryValue = (name) => {
const industry = industryList.find(item => item.name === name);
const industry = industryList.find((item) => item.name === name);
return industry ? industry.value : ''; // 如果找不到,返回默认值
};
const search = () => {
// updateHeaderSearch({ searchWord: searchStr.value, searchType: selectedCate.value });
router.push({ name: 'Search', query: {
router.push({
name: 'Search',
query: {
softwareName: searchStr.value ? searchStr.value : '',
searchType: getIndustryValue(searchType.value)} });
searchType: getIndustryValue(searchType.value)
}
});
// window.open(`${import.meta.env.VITE_BASE_URL}repoList?softwareName=${searchStr.value ? searchStr.value : ''}&searchType=${getIndustryValue(searchType.value)}`, '_blank')
};

View File

@@ -1,26 +1,33 @@
<template>
<div class="warning-detail-container">
<div class="warning-title">
<div style="padding-right: 20px;">{{ warningData.subject }}</div>
<div style="padding-right: 20px">{{ warningData.subject }}</div>
<div class="sub-title mt-3">
<div>
<span>重要性</span>
<d-tag size="sm" :color="tagMap[warningData.importance]?.color">{{tagMap[warningData.importance]?.text}}</d-tag>
<d-tag v-if="tagMap[warningData.importance]" size="sm" :color="tagMap[warningData.importance]?.color">{{
tagMap[warningData.importance]?.text
}}</d-tag>
</div>
<div v-if="propsData.type === 'system'">
<d-button v-show="mode === 'readonly'" class="edit-btn" icon="icon-edit" variant="text" title="编辑" @click="handleModeChange"/>
<d-button
v-show="mode === 'readonly'"
class="edit-btn"
icon="icon-edit"
variant="text"
title="编辑"
@click="handleModeChange"
/>
<d-button v-show="mode === 'editonly'" class="edit-btn" @click="handleModeChange">预览</d-button>
</div>
</div>
</div>
<div class="warning-text">
<d-editor-md
v-model="warningData.overview"
:mode="mode"
:toolbar-config="toolbarConfig"
></d-editor-md>
<d-editor-md v-model="warningData.overview" :mode="mode" :toolbar-config="toolbarConfig"></d-editor-md>
</div>
<div :style="{ 'border-radius': propsData.type === 'user' ? '6px' : 0 }" class="warning-from">
{{ warningData.group }} {{ warningData.publishTime }}
</div>
<div :style="{'border-radius': propsData.type === 'user' ? '6px' : 0}" class="warning-from">{{warningData.group}} {{ warningData.publishTime }}</div>
<div v-if="propsData.type === 'system'" class="warning-operation">
<d-button @click="confirm" variant="solid" class="mr-2">确定</d-button>
<d-button @click="$emit('close')">取消</d-button>
@@ -33,48 +40,48 @@ import { ref } from 'vue';
const emit = defineEmits(['close']);
const propsData = defineProps(['type', 'warningData']);
const warningData = ref({});
const warningData: any = ref({});
const toolbarConfig = [
['undo', 'redo'],
['h1', 'h2', 'bold', 'italic', 'strike', 'underline', 'color', 'font'],
['ul', 'ol', 'checklist', 'code', 'link', 'image', 'table'],
['ul', 'ol', 'checklist', 'code', 'link', 'image', 'table']
];
const tagMap = {
'致命': {
致命: {
text: '致命',
color: '#c7000b'
},
'高': {
: {
text: '高',
color: '#f66f6a'
},
'中': {
: {
text: '中',
color: '#fac20a'
},
'低': {
: {
text: '低',
color: '#5e7ce0'
},
'Critical': {
critical: {
text: '致命',
color: '#c7000b'
},
'High': {
high: {
text: '高',
color: '#f66f6a'
},
'Medium': {
medium: {
text: '中',
color: '#fac20a'
},
'Low': {
low: {
text: '低',
color: '#5e7ce0'
}
}
};
const mode = ref('readonly');
console.log(propsData.warningData)
console.log(propsData.warningData);
warningData.value = propsData.warningData ?? {
subject: '【漏洞排查预警】ApacheIgnite远程代码执行漏洞排查CVE-2024-52577)',
importance: '高',
@@ -112,7 +119,7 @@ const handleModeChange = () => {
.sub-title {
display: flex;
justify-content: space-between;
>div:first-of-type>span {
> div:first-of-type > span {
margin-right: 12px;
color: #808080;
font-family: HarmonyOS Sans SC;
@@ -120,10 +127,10 @@ const handleModeChange = () => {
}
}
}
.warning-text {
padding: 20px 20px 0;
background: #F6F6F8;
background: #f6f6f8;
color: initial;
:deep .dp-md-readonly {
@@ -133,7 +140,7 @@ const handleModeChange = () => {
}
:deep .dp-md-view {
background-color: #F6F6F8;
background-color: #f6f6f8;
h2 {
font-size: 1.5em;
@@ -141,7 +148,7 @@ const handleModeChange = () => {
}
p {
color: #252B3A;
color: #252b3a;
font-family: 苹方-;
font-size: 14px;
line-height: 24px;
@@ -150,10 +157,9 @@ const handleModeChange = () => {
}
.text-box {
div {
margin-bottom: 8px;
color: #252B3A;
color: #252b3a;
font-family: HarmonyOS Sans SC;
font-weight: 600;
font-size: 16px;
@@ -161,7 +167,7 @@ const handleModeChange = () => {
}
::v-deep .devui-textarea {
color: #252B3A;
color: #252b3a;
font-family: 苹方-;
font-size: 14px;
line-height: 24px;
@@ -171,7 +177,7 @@ const handleModeChange = () => {
}
.warning-from {
background: #F6F6F8;
background: #f6f6f8;
color: #808080;
font-family: HarmonyOS Sans SC;
font-size: 14px;
@@ -184,4 +190,4 @@ const handleModeChange = () => {
padding: 20px;
}
}
</style>
</style>