数据字典集中治理
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
<el-card class="mb-12">
|
||||
<div class="filters">
|
||||
<el-select v-model="filters.status" placeholder="状态" clearable @change="loadTasks">
|
||||
<el-option v-for="s in statuses" :key="s" :label="s" :value="s" />
|
||||
<el-option v-for="opt in statusOptions" :key="opt.value" :label="opt.label" :value="opt.value" />
|
||||
</el-select>
|
||||
<el-select v-model="filters.milestone_id" placeholder="里程碑" clearable @change="loadTasks">
|
||||
<el-option v-for="m in milestones" :key="m.id" :label="m.name" :value="m.id" />
|
||||
@@ -25,12 +25,14 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="assignee_id" label="负责人" width="160" />
|
||||
<el-table-column prop="priority" label="优先级" width="100" />
|
||||
<el-table-column prop="priority" label="优先级" width="100">
|
||||
<template #default="scope">
|
||||
<el-tag :type="priorityColor(scope.row.priority)">{{ priorityLabel(scope.row.priority) }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="status" label="状态" width="120">
|
||||
<template #default="scope">
|
||||
<el-tag :type="scope.row.status === 'DONE' ? 'success' : scope.row.status === 'BLOCKED' ? 'danger' : 'info'">
|
||||
{{ statusLabel(scope.row.status) }}
|
||||
</el-tag>
|
||||
<el-tag :type="statusColor(scope.row.status)">{{ statusLabel(scope.row.status) }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="due_date" label="截止日期" width="140" />
|
||||
@@ -66,6 +68,7 @@ import { useAuthStore } from "../store/auth";
|
||||
import PermissionAction from "../components/PermissionAction.vue";
|
||||
import { usePermission } from "../utils/permission";
|
||||
import TaskForm from "../components/TaskForm.vue";
|
||||
import { getDictColor, getDictLabel, getDictOptions, statusDict, priorityDict } from "../dictionaries";
|
||||
|
||||
const study = useStudyStore();
|
||||
const auth = useAuthStore();
|
||||
@@ -77,7 +80,7 @@ const total = ref(0);
|
||||
const page = ref(1);
|
||||
const pageSize = 10;
|
||||
|
||||
const statuses = ["TODO", "DOING", "DONE", "BLOCKED"];
|
||||
const statusOptions = getDictOptions(statusDict).filter((opt) => ["TODO", "DOING", "DONE", "BLOCKED"].includes(opt.value));
|
||||
|
||||
const filters = ref({
|
||||
status: "",
|
||||
@@ -179,8 +182,10 @@ const loadSavedFilters = () => {
|
||||
}
|
||||
};
|
||||
|
||||
const statusLabel = (v: string) =>
|
||||
({ TODO: "待处理", DOING: "进行中", DONE: "已完成", BLOCKED: "阻塞" }[v] || v);
|
||||
const statusLabel = (v: string) => getDictLabel(statusDict, v);
|
||||
const statusColor = (v: string) => getDictColor(statusDict, v) || "info";
|
||||
const priorityLabel = (v: string) => getDictLabel(priorityDict, v);
|
||||
const priorityColor = (v: string) => getDictColor(priorityDict, v) || "info";
|
||||
|
||||
const milestoneName = (id: string) => milestoneMap.value[id] || id || "-";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user