Skip to content

Commit 65059e1

Browse files
committed
v1.4.1 - 修复TaskList组件自定义列及数据绑定问题 & SonarQube安全弱点修复
1 parent b3ba0f1 commit 65059e1

File tree

11 files changed

+110
-65
lines changed

11 files changed

+110
-65
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [1.4.1] - 2025-10-26
9+
10+
### Fixed
11+
- TaskList客制化列展示问题修复
12+
- TaskList客制化列数据动态绑定问题修复
13+
- SonarQube代码质量检查问题修改
14+
- MTaskList Custom Column Display Issue Fix
15+
- TaskList Custom Column Data Dynamic Binding Issue Fix
16+
- SonarQube code quality inspection issue modification
17+
818
## [1.4.0] - 2025-10-11
919

1020
### Added

demo/App.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ const availableColumns = ref<TaskListColumnConfig[]>([
5353
{ key: 'estimatedHours', label: '预估工时', visible: true },
5454
{ key: 'actualHours', label: '实际工时', visible: true },
5555
{ key: 'progress', label: '进度', visible: true },
56+
{ key: 'custom', label: '自定义列', visible: true, width: 120 }, // 添加默认宽度120px
5657
])
5758
5859
// TaskList宽度配置

demo/data.json

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"actualHours": 3942.75,
1212
"type": "story",
1313
"description": "ADX-2024新药完整临床试验计划,从I期到III期临床试验",
14+
"custom": 180000,
1415
"children": [
1516
{
1617
"id": 1100,
@@ -24,6 +25,7 @@
2425
"type": "story",
2526
"parentId": 1000,
2627
"description": "评估ADX-2024在健康志愿者和患者中的安全性、耐受性和药代动力学特征",
28+
"custom": "test11111",
2729
"children": [
2830
{
2931
"id": 1101,
@@ -36,7 +38,8 @@
3638
"actualHours": 480,
3739
"type": "task",
3840
"parentId": 1100,
39-
"description": "完成I期试验方案设计、伦理委员会审批及监管部门申报"
41+
"description": "完成I期试验方案设计、伦理委员会审批及监管部门申报",
42+
"custom": "test11111"
4043
},
4144
{
4245
"id": 1102,
@@ -50,7 +53,8 @@
5053
"type": "task",
5154
"predecessor": [1101],
5255
"parentId": 1100,
53-
"description": "招募24名健康志愿者,完成医学筛选和入组评估"
56+
"description": "招募24名健康志愿者,完成医学筛选和入组评估",
57+
"custom": "test11111"
5458
},
5559
{
5660
"id": 1103,
@@ -64,7 +68,8 @@
6468
"type": "task",
6569
"predecessor": [1102],
6670
"parentId": 1100,
67-
"description": "按照剂量递增方案给药,密切监测不良反应和药代动力学参数"
71+
"description": "按照剂量递增方案给药,密切监测不良反应和药代动力学参数",
72+
"custom": "test11111"
6873
}
6974
],
7075
"collapsed": false
@@ -81,6 +86,7 @@
8186
"type": "story",
8287
"parentId": 1000,
8388
"description": "在目标患者群体中评估ADX-2024的初步疗效和进一步的安全性",
89+
"custom": "test11111",
8490
"children": [
8591
{
8692
"id": 1201,
@@ -94,7 +100,8 @@
94100
"type": "task",
95101
"predecessor": [1103],
96102
"parentId": 1200,
97-
"description": "启动5个临床中心,完成研究者培训和质量体系建立"
103+
"description": "启动5个临床中心,完成研究者培训和质量体系建立",
104+
"custom": "test11111"
98105
},
99106
{
100107
"id": 1202,
@@ -108,7 +115,8 @@
108115
"type": "task",
109116
"predecessor": [1201],
110117
"parentId": 1200,
111-
"description": "计划入组120名患者,采用双盲随机对照设计"
118+
"description": "计划入组120名患者,采用双盲随机对照设计",
119+
"custom": "test11111"
112120
},
113121
{
114122
"id": 1203,
@@ -122,7 +130,8 @@
122130
"type": "task",
123131
"predecessor": [1202],
124132
"parentId": 1200,
125-
"description": "定期评估患者疗效指标,收集安全性数据,进行中期分析"
133+
"description": "定期评估患者疗效指标,收集安全性数据,进行中期分析",
134+
"custom": "test11111"
126135
}
127136
],
128137
"collapsed": false

demo/version-history.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,5 +216,19 @@
216216
"<span style=\"font-weight: bold; color: #f00;\">特别感谢贡献者 @qiuchengw</span>",
217217
"<span style=\"font-weight: bold; color: #f00;\">Special thanks to contributor @qiuchengw</span>"
218218
]
219+
},
220+
{
221+
"version": "1.4.1",
222+
"date": "2025-10-26",
223+
"notes": [
224+
"TaskList客制化列展示问题修复",
225+
"TaskList Custom Column Display Issue Fix",
226+
"TaskList客制化列数据动态绑定问题修复",
227+
"TaskList Custom Column Data Dynamic Binding Issue Fix",
228+
"SonarQube代码质量检查问题修改",
229+
"SonarQube code quality inspection issue modification",
230+
"<span style=\"font-weight: bold; color: #f00;\">特别感谢 @Guduxwa</span>",
231+
"<span style=\"font-weight: bold; color: #f00;\">Special thanks to @Guduxwa</span>"
232+
]
219233
}
220234
]

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jordium-gantt-vue3",
3-
"version": "1.4.0",
3+
"version": "1.4.1",
44
"type": "module",
55
"main": "dist/jordium-gantt-vue3.cjs.js",
66
"module": "dist/jordium-gantt-vue3.es.js",

src/components/TaskBar.vue

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -244,13 +244,13 @@ const taskBarStyle = computed(() => {
244244
const startDateOnly = new Date(
245245
startDate.getFullYear(),
246246
startDate.getMonth(),
247-
startDate.getDate()
247+
startDate.getDate(),
248248
)
249249
const endDateOnly = new Date(endDate.getFullYear(), endDate.getMonth(), endDate.getDate())
250250
const baseStartOnly = new Date(
251251
baseStart.getFullYear(),
252252
baseStart.getMonth(),
253-
baseStart.getDate()
253+
baseStart.getDate(),
254254
)
255255
256256
if (props.currentTimeScale === TimelineScale.YEAR) {
@@ -272,15 +272,15 @@ const taskBarStyle = computed(() => {
272272
const startPosition = calculatePositionFromTimelineData(
273273
startDateOnly,
274274
props.timelineData,
275-
props.currentTimeScale
275+
props.currentTimeScale,
276276
)
277277
// 计算结束位置:为结束日期添加一天来获取正确的结束位置
278278
const nextDay = new Date(endDateOnly)
279279
nextDay.setDate(nextDay.getDate() + 1)
280280
let endPosition = calculatePositionFromTimelineData(
281281
nextDay,
282282
props.timelineData,
283-
props.currentTimeScale
283+
props.currentTimeScale,
284284
)
285285
286286
// 如果结束日期+1天超出范围,使用结束日期的位置+一天的宽度
@@ -295,7 +295,7 @@ const taskBarStyle = computed(() => {
295295
calculatePositionFromTimelineData(
296296
endDateOnly,
297297
props.timelineData,
298-
props.currentTimeScale
298+
props.currentTimeScale,
299299
) + dayWidth
300300
}
301301
@@ -304,7 +304,7 @@ const taskBarStyle = computed(() => {
304304
} else {
305305
// 日视图:基于日期的简单计算
306306
const startDiff = Math.floor(
307-
(startDateOnly.getTime() - baseStartOnly.getTime()) / (1000 * 60 * 60 * 24)
307+
(startDateOnly.getTime() - baseStartOnly.getTime()) / (1000 * 60 * 60 * 24),
308308
)
309309
310310
// 计算持续天数(基于日期,忽略时间)
@@ -501,7 +501,7 @@ const handleMouseMove = (e: MouseEvent) => {
501501
mouseX: e.clientX,
502502
isDragging: isDragging.value || isResizingLeft.value || isResizingRight.value,
503503
},
504-
})
504+
}),
505505
)
506506
507507
// 更新拖拽提示框位置
@@ -766,7 +766,7 @@ const handleMouseMove = (e: MouseEvent) => {
766766
const newDurationDays = newWidth / props.dayWidth
767767
const newEndDate = addDaysToLocalDate(
768768
props.startDate,
769-
resizeStartLeft.value / props.dayWidth + newDurationDays - 1
769+
resizeStartLeft.value / props.dayWidth + newDurationDays - 1,
770770
)
771771
772772
// 只更新临时数据,不触发事件
@@ -798,7 +798,7 @@ const handleMouseUp = () => {
798798
mouseX: 0,
799799
isDragging: false,
800800
},
801-
})
801+
}),
802802
)
803803
804804
// 如果有临时数据,说明发生了拖拽或拉伸,提交数据更新
@@ -882,7 +882,7 @@ watch(
882882
reportBarPosition()
883883
})
884884
},
885-
{ deep: true }
885+
{ deep: true },
886886
)
887887
888888
// 处理TaskBar双击事件
@@ -1171,7 +1171,7 @@ watch(
11711171
}
11721172
}, 200)
11731173
}
1174-
}
1174+
},
11751175
)
11761176
11771177
// 监听外部hideBubbles属性变化,确保Timeline的容器变化能及时反应
@@ -1184,7 +1184,7 @@ watch(
11841184
// 强制重新计算bubbleIndicator,确保容器宽度变化后正确显示半圆
11851185
})
11861186
}
1187-
}
1187+
},
11881188
)
11891189
11901190
// 监听TaskBar可见性变化,只在滚动时实现重新出现动画
@@ -1193,7 +1193,7 @@ watch(
11931193
() => {
11941194
// TaskBar重新出现时,不需要动画效果
11951195
// 半圆会自然消失,TaskBar会立即显示
1196-
}
1196+
},
11971197
)
11981198
11991199
// 监听页面缩放和大小变化,重新计算气泡位置
@@ -1353,13 +1353,13 @@ const calculateYearViewPosition = (targetDate: Date, baseStartDate: Date): numbe
13531353
const daysInHalfYear =
13541354
month <= 6
13551355
? Math.floor(
1356-
(new Date(targetYear, 6, 1).getTime() - new Date(targetYear, 0, 1).getTime()) /
1357-
(1000 * 60 * 60 * 24)
1358-
)
1356+
(new Date(targetYear, 6, 1).getTime() - new Date(targetYear, 0, 1).getTime()) /
1357+
(1000 * 60 * 60 * 24),
1358+
)
13591359
: Math.floor(
1360-
(new Date(targetYear + 1, 0, 1).getTime() - new Date(targetYear, 6, 1).getTime()) /
1361-
(1000 * 60 * 60 * 24)
1362-
)
1360+
(new Date(targetYear + 1, 0, 1).getTime() - new Date(targetYear, 6, 1).getTime()) /
1361+
(1000 * 60 * 60 * 24),
1362+
)
13631363
13641364
const dayPositionInHalfYear = (dayOffset / daysInHalfYear) * halfYearWidth
13651365
position += dayPositionInHalfYear
@@ -1383,7 +1383,7 @@ const calculatePositionFromTimelineData = (
13831383
subDays: Array<{ date: Date; dayOfWeek?: number }>
13841384
}>
13851385
}>,
1386-
timeScale: TimelineScale
1386+
timeScale: TimelineScale,
13871387
) => {
13881388
let cumulativePosition = 0
13891389
@@ -1401,11 +1401,11 @@ const calculatePositionFromTimelineData = (
14011401
// 找到目标日期所在的季度
14021402
const quarterWidth = 60
14031403
const daysInQuarter = Math.ceil(
1404-
(quarterEnd.getTime() - quarterStart.getTime()) / (1000 * 60 * 60 * 24)
1404+
(quarterEnd.getTime() - quarterStart.getTime()) / (1000 * 60 * 60 * 24),
14051405
)
14061406
const dayWidth = quarterWidth / daysInQuarter
14071407
const dayInQuarter = Math.ceil(
1408-
(targetDate.getTime() - quarterStart.getTime()) / (1000 * 60 * 60 * 24)
1408+
(targetDate.getTime() - quarterStart.getTime()) / (1000 * 60 * 60 * 24),
14091409
)
14101410
return cumulativePosition + dayInQuarter * dayWidth
14111411
}

src/components/TaskDrawer.vue

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ watch(
6868
() => [props.task?.isTimerRunning, props.task?.timerStartTime, props.task?.timerElapsedTime],
6969
() => {
7070
updateTimer()
71-
}
71+
},
7272
)
7373
7474
// 计时器本地状态,保证点击后UI立即切换
@@ -84,7 +84,7 @@ watch(
8484
timerInterval.value = null
8585
}
8686
},
87-
{ immediate: true }
87+
{ immediate: true },
8888
)
8989
9090
// 修正计时器每秒递增逻辑,保证计时器正常跳动
@@ -102,7 +102,7 @@ watch(
102102
updateTimer()
103103
}
104104
},
105-
{ immediate: true }
105+
{ immediate: true },
106106
)
107107
108108
onUnmounted(() => {
@@ -153,7 +153,7 @@ const availableParentTasks = computed(() => {
153153
.filter(
154154
task =>
155155
task.id !== props.task?.id && // 排除当前任务自己
156-
(task.type === 'story' || task.type === 'task') // 只显示story和task类型
156+
(task.type === 'story' || task.type === 'task'), // 只显示story和task类型
157157
)
158158
.map(task => ({
159159
...task,
@@ -346,7 +346,7 @@ watch(
346346
// 抽屉显示时重新请求任务数据,确保前置任务列表是最新的
347347
window.dispatchEvent(new CustomEvent('request-task-list'))
348348
}
349-
}
349+
},
350350
)
351351
352352
// 监听 isVisible 变化,同步到父组件
@@ -363,7 +363,7 @@ watch(
363363
formData.parentId = newTask.parentId ?? undefined
364364
}
365365
},
366-
{ immediate: true }
366+
{ immediate: true },
367367
)
368368
369369
// 重置表单
@@ -548,7 +548,7 @@ watch(
548548
newValue => {
549549
progressDisplayValue.value = (newValue || 0).toString()
550550
},
551-
{ immediate: true }
551+
{ immediate: true },
552552
)
553553
554554
// 修正计时器首次启动不跳动问题:每次打开抽屉时重置 timerElapsed,且 timerStartTime 为空时立即赋值
@@ -566,7 +566,7 @@ watch(
566566
}
567567
}
568568
},
569-
{ immediate: true }
569+
{ immediate: true },
570570
)
571571
572572
const handleStartTimer = (desc?: string) => {

src/components/TaskRow.vue

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ const isStoryTask = computed(() => props.task.type === 'story')
6767
const isMilestoneGroup = computed(() => props.task.type === 'milestone-group')
6868
const isMilestoneTask = computed(() => props.task.type === 'milestone')
6969
const isParentTask = computed(
70-
() => isStoryTask.value || hasChildren.value || isMilestoneGroup.value
70+
() => isStoryTask.value || hasChildren.value || isMilestoneGroup.value,
7171
)
7272
function handleToggle() {
7373
emit('toggle', props.task)
@@ -221,7 +221,7 @@ watch(
221221
updateTimer()
222222
}
223223
},
224-
{ immediate: true }
224+
{ immediate: true },
225225
)
226226
227227
// 右键菜单相关状态
@@ -464,6 +464,11 @@ onUnmounted(() => {
464464
{{ props.task.progress != null ? props.task.progress + '%' : '-' }}
465465
</span>
466466
</template>
467+
468+
<!-- 自定义列 - 通过task对象的key动态获取值 -->
469+
<template v-else>
470+
{{ (props.task as any)[column.key] || '-' }}
471+
</template>
467472
</template>
468473
</div>
469474
</div>

0 commit comments

Comments
 (0)