From 867c24186a4150ae26f13f6736e004ff19939729 Mon Sep 17 00:00:00 2001 From: "LINING-PC\\lining" Date: Fri, 30 Jan 2026 16:53:59 +0800 Subject: [PATCH] =?UTF-8?q?v1.9.0=20-=20=E4=BA=8B=E4=BB=B6=E4=BA=A4?= =?UTF-8?q?=E5=8F=89Taskbar=E5=B1=95=E7=A4=BA=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- demo/App.vue | 47 +-- demo/data-resources-with-percent.json | 173 +++++++++++ demo/data-resources.json | 279 +++++++++++++++++- src/components/GanttChart.vue | 269 +++++++++++++---- src/components/TaskBar.vue | 174 +++++++++-- src/components/TaskDrawer.vue | 195 ++++++++++++ src/components/TaskList/TaskList.vue | 8 +- .../composables/taskList/useTaskListLayout.ts | 106 ++++++- src/components/TaskList/taskRow/TaskRow.vue | 101 ++++++- src/components/Timeline.vue | 243 ++++++++++++--- src/composables/useI18n.ts | 14 + src/models/classes/Resource.ts | 97 ++++++ src/models/classes/Task.ts | 12 + src/utils/taskLayoutUtils.ts | 176 +++++++++++ 14 files changed, 1726 insertions(+), 168 deletions(-) create mode 100644 demo/data-resources-with-percent.json create mode 100644 src/utils/taskLayoutUtils.ts diff --git a/demo/App.vue b/demo/App.vue index f8be33c..9d64b05 100644 --- a/demo/App.vue +++ b/demo/App.vue @@ -86,7 +86,7 @@ const applyDataSource = (source: RawDataSource) => { tasks.value = cloneData(payload.tasks ?? []) milestones.value = cloneData(payload.milestones ?? []) - // 从独立的资源数据文件加载资源数据 + // v1.9.0 从资源数据文件加载 const resourcePayload = resourcesData as { resources?: any[] } if (resourcePayload.resources) { resources.value = resourcePayload.resources.map(resData => { @@ -100,9 +100,18 @@ const applyDataSource = (source: RawDataSource) => { department: resData.department, skills: resData.skills, utilization: resData.utilization, + color: resData.color, tasks: resData.tasks || [] }) }) + + // 更新assigneeOptions,添加资源作为责任人选项 + const resourceAssigneeOptions = resources.value.map(res => ({ + value: res.id as string, + label: res.name, + avatar: res.avatar + })) + assigneeOptions.value = [...resourceAssigneeOptions] } else { // 向后兼容:如果没有独立的资源数据,从任务中生成 const resourceMap = new Map() @@ -278,23 +287,9 @@ const resourceListConfig = computed(() => ({ key: 'name', label: '资源名称', visible: true, - width: 150, + width: 200, formatter: (resource: Resource) => resource.name || '-', }, - { - key: 'type', - label: '类型', - visible: true, - width: 100, - formatter: (resource: Resource) => resource.type || '-', - }, - { - key: 'taskCount', - label: '任务数', - visible: true, - width: 100, - formatter: (resource: Resource) => resource.tasks?.length?.toString() || '0', - }, { key: 'utilization', label: '利用率', @@ -310,6 +305,20 @@ const resourceListConfig = computed(() => ({ return `${utilizationPercent}%` }, }, + { + key: 'type', + label: '类型', + visible: true, + width: 100, + formatter: (resource: Resource) => resource.type || '-', + }, + { + key: 'taskCount', + label: '任务数', + visible: true, + width: 100, + formatter: (resource: Resource) => resource.tasks?.length?.toString() || '0', + }, ], defaultWidth: widthUnit.value === '%' @@ -2145,7 +2154,7 @@ const handleCustomMenuAction = (action: string, task: Task) => { - +