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

@@ -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>