Skip to content

Commit c5c9f2d

Browse files
committed
gantt timelineBar drag perf
1 parent 99ad23f commit c5c9f2d

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/components/layout/gantt/GanttTimelineHeader.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,12 @@ function ganttTimeLineYearHeight() {
5959
{{ cateColumTimeline.cateTitle }}
6060
</div>
6161
</div>
62-
<div class="flex items-center gantt-timeline-column">
62+
<div class="flex items-center gantt-timeline-column" :style="`height:${ganttInfo.ganttShowKind === GanttShowKind.YEAR && ganttTimeLineYearHeight()}`">
6363
<div
6464
v-for="(timeline, idx) in ganttInfo.timeline" :key="`${layoutId}-${idx}`"
6565
:data-value="timeline.value"
6666
:data-group-value="timeline.categoryTitle"
67-
:style="`width: ${getTimelineColumnWidth(props.ganttInfo.ganttShowKind)}px;height:${ganttInfo.ganttShowKind === GanttShowKind.YEAR && ganttTimeLineYearHeight()}`"
67+
:style="`width: ${getTimelineColumnWidth(props.ganttInfo.ganttShowKind)}px`"
6868
:title="`${timeline.value} (${timeline.categoryTitle})`"
6969
:class="`${props.styleProps.cellClass} iw-gantt-timeline-cell flex justify-center items-center bg-base-200 ${idx !== 0 && 'border-l border-l-base-300'}`"
7070
>

src/components/layout/gantt/GanttTimelineRows.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ onUnmounted(() => {
338338
unregisterRowTreeTriggerEvent(rowTreeEventId!)
339339
})
340340
341-
function handleMouseMove(event: MouseEvent, date: string, idx: number) {
341+
function handleMouseMove(event: MouseEvent, date: string) {
342342
if (props.ganttInfo.ganttShowKind !== GanttShowKind.DAY)
343343
return
344344
if (curTimelineBar.value && curTimelineBar.value !== event.target) {
@@ -370,7 +370,7 @@ function handleMouseMove(event: MouseEvent, date: string, idx: number) {
370370
}
371371
372372
curTimelineBar.value = (event.target as HTMLElement)
373-
curTimelineRowRef.value = timelineRowRef.value[idx]
373+
curTimelineRowRef.value = (event.target as HTMLElement).parentElement
374374
}
375375
376376
async function stopResize(e: PointerEvent, isSave = false) {
@@ -436,7 +436,7 @@ function updateResize(e: PointerEvent) {
436436
<template>
437437
<div ref="ganttTimelineRef" class="relative iw-gantt-timeline-area">
438438
<div
439-
v-for="(row, rowIdx) in props.records"
439+
v-for="row in props.records"
440440
ref="timelineRowRef"
441441
:key="`${props.layoutId}-${row[props.pkColumnName]}`"
442442
:data-pk="row[props.pkColumnName]"
@@ -469,15 +469,15 @@ function updateResize(e: PointerEvent) {
469469
:title="getTimelineBarTitle(row, true)"
470470
:data-start-time="row[props.ganttProps.planStartTimeColumnName]"
471471
:data-end-time="row[props.ganttProps.planEndTimeColumnName]"
472-
@mousemove="(e) => { handleMouseMove(e, operationDateEnum.PLAN, rowIdx) }"
472+
@mousemove="(e) => { handleMouseMove(e, operationDateEnum.PLAN) }"
473473
/>
474474
<div
475475
v-if="props.ganttProps.actualStartTimeColumnName && props.ganttProps.actualEndTimeColumnName && (row[props.ganttProps.actualStartTimeColumnName] || row[props.ganttProps.actualEndTimeColumnName])"
476476
class="iw-gantt-timeline-actual-bar absolute hidden py-1 bg-success rounded-sm"
477477
:title="getTimelineBarTitle(row, false)"
478478
:data-start-time="row[props.ganttProps.actualStartTimeColumnName]"
479479
:data-end-time="row[props.ganttProps.actualEndTimeColumnName]"
480-
@mousemove="(e) => { handleMouseMove(e, operationDateEnum.ACT, rowIdx) }"
480+
@mousemove="(e) => { handleMouseMove(e, operationDateEnum.ACT) }"
481481
/>
482482
</div>
483483
<div

0 commit comments

Comments
 (0)