Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] jumpToDate 对于起始边缘日期对不齐 #43

Closed
imlinhanchao opened this issue May 26, 2023 · 3 comments
Closed

[BUG] jumpToDate 对于起始边缘日期对不齐 #43

imlinhanchao opened this issue May 26, 2023 · 3 comments
Assignees
Labels
help wanted Extra attention is needed

Comments

@imlinhanchao
Copy link

Describe the bug
对于起始边缘日期的 jumpToDate 设置后跳转的日期对不齐。

To Reproduce

  1. 设置 rowClick 事件,点击后 调用 jumpToDate 设置 startDate;
  2. 点击第一笔数据,实际跳转日期为 startDate 两天后;

image

Expected behavior
跳转到设置的日期。

Versions

  • Version 2.0.3
  • Browser Edge 113.0.1774.50

Additional context

<x-gantt
    data-id="id"
    :data="dataList"
    :ref="ganttRef"
    start-key="planStartTime"
    end-key="planEndTime"
    @row-click="rowClick"
  >
    <x-gantt-column label="标题" prop="name" />
    <x-gantt-column label="进度" prop="progress" />
    <x-gantt-column label="开始日期" width="100">
      <template #default="{ row }">
        <el-date-picker
          class="date-picker"
          v-model="row.planStartTime"
          type="date"
          placeholder="选择日期"
          size="small"
          style="width: 100%"
          :clearable="false"
          value-format="YYYY-MM-DD"
        />
      </template>
    </x-gantt-column>
    <x-gantt-column label="结束日期" width="100">
      <template #default="{ row }">
        <el-date-picker
          class="date-picker"
          v-model="row.planEndTime"
          type="date"
          placeholder="选择日期"
          size="small"
          style="width: 100%"
          :clearable="false"
          value-format="YYYY-MM-DD"
        />
      </template>
    </x-gantt-column>
</x-gantt>
const dataList = ref([
    {
      id: 1660933075125125000,
      name: '小鸡快跑计划',
      projectId: 1,
      ganttDataType: 39,
      planStartTime: '2023-10-04 15:21:27',
      planEndTime: '2023-11-01 20:33:39',
      assign: 'anim Ut veniam elit aliquip',
      progress: 58,
      estimatedHours: 100,
      totalManHour: 84,
      remainingManHour: 93,
      status: 1,
      children: [
        {
          id: 1661169300083720200,
          parentId: 1660933075125125000,
          name: '孵鸡蛋',
          projectId: 1,
          ganttDataType: 2,
          planStartTime: '2023-11-04 15:21:27',
          planEndTime: '2023-12-01 20:33:39',
          assign: '陈小东',
          progress: 58,
          estimatedHours: 100,
          totalManHour: 84,
          remainingManHour: 93,
          status: 1,
        },
        {
          id: 3,
          parentId: 1660933075125125000,
          name: '框架搭建',
          projectId: 1,
          ganttDataType: 2,
          planStartTime: '2023-10-19',
          planEndTime: '2023-11-14',
          assign: '子路',
          progress: 18,
          estimatedHours: 78,
          totalManHour: 6,
          remainingManHour: 26,
          status: 1,
        },
        {
          id: 4,
          parentId: 1660933075125125000,
          name: '发布',
          projectId: 1,
          ganttDataType: 1,
          planStartTime: '2023-11-14',
          planEndTime: '2023-11-15',
          assign: '子路',
          progress: 18,
          estimatedHours: 78,
          totalManHour: 6,
          remainingManHour: 26,
          status: 1,
        },
    ]
}
const ganttRef = ref();
function rowClick(data) {
  ganttRef.value?.jumpToDate(new Date(data.planStartTime));
}
@imlinhanchao imlinhanchao added the bug Something isn't working label May 26, 2023
@jeremyjone
Copy link
Collaborator

它本身就不是对齐到起始区域。当时做这个是有需求要跳到展示区域,只是大概算了在区域内即可,后来我也没改,直接把代码粘过来的。

现在这个功能对我没啥用了,看你们希望有什么需求吧~应该到什么样的位置

@jeremyjone jeremyjone added help wanted Extra attention is needed and removed bug Something isn't working labels May 26, 2023
@imlinhanchao
Copy link
Author

其实除了第一个,其他的都可以跳转到正确的位置,可能是因为第一个刚好在甘特图日期的边缘,所以导致滚动过去没有办法呈现出完整的甘特图。

@jeremyjone
Copy link
Collaborator

边缘可能确实有问题,我记得我是通过对半除算的大概位置。回头我看看,抽空重写一下这个方法的实现吧

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants