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) => { - +