Skip to content

Commit 287cb6e

Browse files
author
piexlMax(奇淼
committed
feat: 优化error样式
1 parent b9788e9 commit 287cb6e

File tree

1 file changed

+74
-15
lines changed

1 file changed

+74
-15
lines changed

web/src/view/systemTools/sysError/sysError.vue

Lines changed: 74 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -110,14 +110,32 @@
110110
label="错误等级"
111111
prop="level"
112112
width="120"
113-
/>
113+
>
114+
<template #default="scope">
115+
<el-tag
116+
effect="dark"
117+
:type="levelTagMap[scope.row.level] || 'info'"
118+
>
119+
{{ levelLabelMap[scope.row.level] || defaultLevelLabel }}
120+
</el-tag>
121+
</template>
122+
</el-table-column>
114123

115124
<el-table-column
116125
align="left"
117126
label="处理状态"
118127
prop="status"
119-
width="120"
120-
/>
128+
width="140"
129+
>
130+
<template #default="scope">
131+
<el-tag
132+
effect="light"
133+
:type="statusTagMap[scope.row.status] || 'info'"
134+
>
135+
{{ statusLabelMap[scope.row.status] || defaultStatusLabel }}
136+
</el-tag>
137+
</template>
138+
</el-table-column>
121139

122140
<el-table-column
123141
align="left"
@@ -148,9 +166,9 @@
148166
link
149167
class="table-button"
150168
@click="getSolution(scope.row.ID)"
151-
><el-icon><ai-gva /></el-icon
152-
>方案</el-button
153169
>
170+
<el-icon><ai-gva /></el-icon>方案
171+
</el-button>
154172
<el-button
155173
type="primary"
156174
link
@@ -195,10 +213,20 @@
195213
{{ detailForm.form }}
196214
</el-descriptions-item>
197215
<el-descriptions-item label="错误等级">
198-
{{ detailForm.level }}
216+
<el-tag
217+
effect="dark"
218+
:type="levelTagMap[detailForm.level] || 'info'"
219+
>
220+
{{ levelLabelMap[detailForm.level] || defaultLevelLabel }}
221+
</el-tag>
199222
</el-descriptions-item>
200223
<el-descriptions-item label="处理状态">
201-
{{ detailForm.status || '未处理' }}
224+
<el-tag
225+
effect="light"
226+
:type="statusTagMap[detailForm.status] || 'info'"
227+
>
228+
{{ statusLabelMap[detailForm.status] || defaultStatusLabel }}
229+
</el-tag>
202230
</el-descriptions-item>
203231
<el-descriptions-item label="错误内容" :span="2">
204232
<pre class="whitespace-pre-wrap break-words">{{ detailForm.info }}</pre>
@@ -248,13 +276,22 @@
248276
getTableData()
249277
}
250278
251-
const getSolution = (id) =>{
252-
getSysErrorSolution({ id }).then((res) => {
253-
if (res.code === 0) {
254-
ElMessage({ type: 'success', message: res.msg || '处理已提交,1分钟后完成' })
255-
getTableData()
279+
const getSolution = async (id) => {
280+
const confirmed = await ElMessageBox.confirm(
281+
'日志将通过 AI-PATH 传输至 GVA AI 用于错误分析,并在 GVA 官方平台短暂存储作为 AI 上下文。是否确认进行 AI 处理?(此功能仅向授权用户开放)',
282+
'提示(Beta)',
283+
{
284+
confirmButtonText: '确认',
285+
cancelButtonText: '取消',
286+
type: 'warning'
256287
}
257-
})
288+
).catch(() => false)
289+
if (!confirmed) return
290+
const res = await getSysErrorSolution({ id })
291+
if (res.code === 0) {
292+
ElMessage({ type: 'success', message: res.msg || '处理已提交,1分钟后完成' })
293+
getTableData()
294+
}
258295
}
259296
// 搜索
260297
const onSubmit = () => {
@@ -393,6 +430,28 @@
393430
detailShow.value = false
394431
detailForm.value = {}
395432
}
396-
</script>
397433
398-
<style></style>
434+
const statusLabelMap = {
435+
未处理: '未处理',
436+
处理中: '处理中',
437+
处理完成: '处理完成',
438+
处理失败: '处理失败'
439+
}
440+
const statusTagMap = {
441+
未处理: 'info',
442+
处理中: 'warning',
443+
处理完成: 'success',
444+
处理失败: 'danger'
445+
}
446+
const defaultStatusLabel = '未处理'
447+
448+
const levelLabelMap = {
449+
fatal: '致命错误',
450+
error: '一般错误'
451+
}
452+
const levelTagMap = {
453+
fatal: 'danger',
454+
error: 'warning'
455+
}
456+
const defaultLevelLabel = '一般错误'
457+
</script>

0 commit comments

Comments
 (0)