API返回英文优先级(high/medium/low),前端显示转换为中文(高/中/低)
This commit is contained in:
@@ -55,7 +55,7 @@
|
|||||||
<div class="task-title-section">
|
<div class="task-title-section">
|
||||||
<h3 class="task-title">{{ task.title }}</h3>
|
<h3 class="task-title">{{ task.title }}</h3>
|
||||||
<el-tag :type="getTaskTagType(task.priority)" size="small">
|
<el-tag :type="getTaskTagType(task.priority)" size="small">
|
||||||
{{ task.priority }}
|
{{ getPriorityLabel(task.priority) }}
|
||||||
</el-tag>
|
</el-tag>
|
||||||
</div>
|
</div>
|
||||||
<el-dropdown trigger="click">
|
<el-dropdown trigger="click">
|
||||||
@@ -783,11 +783,30 @@ const deleteTaskItem = async (task: Task) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 优先级英文转中文映射
|
||||||
|
*/
|
||||||
|
const priorityToChineseMap: Record<string, string> = {
|
||||||
|
'high': '高',
|
||||||
|
'medium': '中',
|
||||||
|
'low': '低'
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取中文优先级显示
|
||||||
|
*/
|
||||||
|
const getPriorityLabel = (priority: string) => {
|
||||||
|
return priorityToChineseMap[priority] || priority
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取任务标签类型
|
* 获取任务标签类型
|
||||||
*/
|
*/
|
||||||
const getTaskTagType = (priority: string) => {
|
const getTaskTagType = (priority: string) => {
|
||||||
const typeMap: Record<string, string> = {
|
const typeMap: Record<string, string> = {
|
||||||
|
'high': 'danger',
|
||||||
|
'medium': 'warning',
|
||||||
|
'low': 'info',
|
||||||
'高': 'danger',
|
'高': 'danger',
|
||||||
'中': 'warning',
|
'中': 'warning',
|
||||||
'低': 'info'
|
'低': 'info'
|
||||||
|
|||||||
Reference in New Issue
Block a user