伦理与启动管理-简单优化
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
import { createDict, getDictColor, getDictLabel } from "./utils";
|
||||
import type { Dict } from "./types";
|
||||
|
||||
export const milestoneTypeDict: Record<string, string> = {
|
||||
ETHICS_SUBMISSION: "伦理递交",
|
||||
ETHICS_APPROVAL: "伦理批件",
|
||||
SITE_INITIATION: "中心启动",
|
||||
SIV: "启动会",
|
||||
FPI: "首例入组",
|
||||
LPI: "末例入组",
|
||||
DBL: "揭盲",
|
||||
CSR: "总结报告",
|
||||
};
|
||||
|
||||
const milestoneStatusItems = [
|
||||
{ value: "NOT_STARTED", label: "未开始", color: "info", order: 1 },
|
||||
{ value: "IN_PROGRESS", label: "进行中", color: "warning", order: 2 },
|
||||
{ value: "DONE", label: "已完成", color: "success", order: 3 },
|
||||
{ value: "COMPLETED", label: "已完成", color: "success", order: 3 },
|
||||
{ value: "BLOCKED", label: "受阻", color: "danger", order: 4 },
|
||||
];
|
||||
|
||||
export const milestoneStatusDict: Dict = createDict(milestoneStatusItems);
|
||||
|
||||
export const milestoneTypeOptions = Object.entries(milestoneTypeDict).map(([value, label]) => ({
|
||||
value,
|
||||
label,
|
||||
}));
|
||||
|
||||
export const milestoneStatusOptions = ["NOT_STARTED", "IN_PROGRESS", "DONE", "BLOCKED"].map((value) => ({
|
||||
value,
|
||||
label: getDictLabel(milestoneStatusDict, value) || value,
|
||||
color: getDictColor(milestoneStatusDict, value),
|
||||
}));
|
||||
|
||||
export const getMilestoneTypeLabel = (value?: string | null) => milestoneTypeDict[value || ""] || value || "—";
|
||||
|
||||
export const getMilestoneStatusLabel = (value?: string | null) =>
|
||||
getDictLabel(milestoneStatusDict, value) || value || "—";
|
||||
|
||||
export const getMilestoneStatusColor = (value?: string | null) => getDictColor(milestoneStatusDict, value) || "info";
|
||||
Reference in New Issue
Block a user