@@ -339,6 +339,8 @@ onUnmounted(() => {
339
339
})
340
340
341
341
function handleMouseMove(event : MouseEvent , date : string , idx : number ) {
342
+ if (props .ganttInfo .ganttShowKind !== GanttShowKind .DAY )
343
+ return
342
344
if (curTimelineBar .value && curTimelineBar .value !== event .target ) {
343
345
isDragging .value = false
344
346
dragBarRef .value ! .style .display = ' none'
@@ -354,13 +356,13 @@ function handleMouseMove(event: MouseEvent, date: string, idx: number) {
354
356
operationDate .value = date
355
357
356
358
dragBarRef .value ! .style .display = ' none'
357
- if (Math .abs (event .clientX - childRect .left ) <= 5 ) {
359
+ if (Math .abs (event .clientX - childRect .left ) <= 5 && ( event . target as HTMLElement ). dataset . startTime ) {
358
360
dragBarRef .value ! .style .left = ` ${leftPosInParent }px `
359
361
dragBarRef .value ! .style .top = ` ${childRect .top - parentRect .top - heightDeviation }px `
360
362
dragBarRef .value ! .style .display = ' block'
361
363
dragLinePosition .value = dragLinePositionEnum .LEFT
362
364
}
363
- if (Math .abs (childRect .right - event .clientX ) <= 5 ) {
365
+ if (Math .abs (childRect .right - event .clientX ) <= 5 && ( event . target as HTMLElement ). dataset . endTime ) {
364
366
dragBarRef .value ! .style .left = ` ${rightPosInParent - 5 }px `
365
367
dragBarRef .value ! .style .top = ` ${childRect .top - parentRect .top - heightDeviation }px `
366
368
dragBarRef .value ! .style .display = ' block'
@@ -396,8 +398,14 @@ async function stopResize(e: PointerEvent, isSave = false) {
396
398
if (Number .parseFloat (curTimelineBar .value ! .style .width ) + travelDistance + Number .parseFloat (curTimelineBar .value ! .style .left ) > curTimelineRowRef .value ! .offsetWidth ) {
397
399
return
398
400
}
399
- curTimelineBar .value ! .style .width = ` ${Number .parseFloat (curTimelineBar .value ! .style .width ) + travelDistance }px `
400
- cellIdx = Math .floor (((Number .parseFloat (curTimelineBar .value ! .style .width ) + Number .parseFloat (curTimelineBar .value ! .style .left )) / timelineColumnWidth ))
401
+ if (! curTimelineBar .value ! .dataset .startTime ) {
402
+ curTimelineBar .value ! .style .left = dragBarRef .value ! .style .left
403
+ cellIdx = Math .floor ((Number .parseFloat (curTimelineBar .value ! .style .left ) / timelineColumnWidth ))
404
+ }
405
+ else {
406
+ curTimelineBar .value ! .style .width = ` ${Number .parseFloat (curTimelineBar .value ! .style .width ) + travelDistance }px `
407
+ cellIdx = Math .floor (((Number .parseFloat (curTimelineBar .value ! .style .width ) + Number .parseFloat (curTimelineBar .value ! .style .left )) / timelineColumnWidth ))
408
+ }
401
409
}
402
410
// 获取到拖拽到哪个格子
403
411
if (cellIdx || cellIdx === 0 ) {
@@ -473,8 +481,9 @@ function updateResize(e: PointerEvent) {
473
481
/>
474
482
</div >
475
483
<div
484
+ v-if =" props.ganttInfo.ganttShowKind === GanttShowKind.DAY"
476
485
ref =" dragBarRef"
477
- class =" hidden absolute cursor-e-resize bg-red-300 px-1 h-[20px]"
486
+ class =" hidden absolute cursor-e-resize bg-red-300 px-1 h-[20px] z-[3199] "
478
487
/>
479
488
</div >
480
489
</template >
0 commit comments