|
@ -6,7 +6,7 @@ |
|
|
:lower-threshold="300" |
|
|
:lower-threshold="300" |
|
|
scroll-y="true" |
|
|
scroll-y="true" |
|
|
:upper-threshold="300" |
|
|
:upper-threshold="300" |
|
|
:scroll-into-view="viewId" |
|
|
:scroll-into-view="scrollToTaskId" |
|
|
@scroll="scroll" |
|
|
@scroll="scroll" |
|
|
@scrolltolower="handleScrollBottom" |
|
|
@scrolltolower="handleScrollBottom" |
|
|
@scrolltoupper="handleScrollTop" |
|
|
@scrolltoupper="handleScrollTop" |
|
@ -36,12 +36,12 @@ export default { |
|
|
|
|
|
|
|
|
computed: { |
|
|
computed: { |
|
|
...mapState('role', ['visibleRoles']), |
|
|
...mapState('role', ['visibleRoles']), |
|
|
...mapState('task', ['scrollTop', 'showTips', 'tasks', 'topEnd', 'bottomEnd', 'showSkeleton', 'timeNode', 'viewId']), |
|
|
...mapState('task', ['scrollTop', 'showTips', 'tasks', 'topEnd', 'bottomEnd', 'showSkeleton', 'timeNode', 'scrollToTaskId']), |
|
|
...mapGetters('task', ['timeGranularity']), |
|
|
...mapGetters('task', ['timeGranularity']), |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
methods: { |
|
|
methods: { |
|
|
...mapMutations('task', ['setScrollTop', 'setShrink', 'setUpTasks', 'setDownTasks', 'setViewId']), |
|
|
...mapMutations('task', ['setScrollTop', 'setShrink', 'setUpTasks', 'setDownTasks', 'setScrollToTaskId']), |
|
|
|
|
|
|
|
|
// 滚动 |
|
|
// 滚动 |
|
|
scroll(e) { |
|
|
scroll(e) { |
|
@ -96,22 +96,16 @@ export default { |
|
|
|
|
|
|
|
|
// 设置自动滚动位置 |
|
|
// 设置自动滚动位置 |
|
|
setScrollPosition() { |
|
|
setScrollPosition() { |
|
|
const { tasks, timeNode } = this; |
|
|
// 如果storage里有taskId 滚动到这个id的任务 |
|
|
for (let i = 0; i < tasks.length; i++) { |
|
|
const taskId = this.$t.storage.getStorageSync('taskId'); |
|
|
const item = tasks[i]; |
|
|
if (taskId) { |
|
|
const show = this.$t.time.isSame(+item.planStart, +timeNode, this.timeGranularity); |
|
|
this.setScrollToTaskId(`a${taskId}`); |
|
|
// 如果storage里有timeNode,修改store里的timeNode |
|
|
this.$t.storage.setStorageSync('taskId', ''); // 记录后即刻清除本地存储 |
|
|
const taskId = this.$t.storage.getStorageSync('taskId'); |
|
|
} else { |
|
|
// 清空storage |
|
|
// 没有本地记录的taskId |
|
|
if (taskId) { |
|
|
// 找到当前时间基准线的任务id 记录 并滚动到当前时间基准线 |
|
|
this.setViewId(`a${taskId}`); |
|
|
const task = this.tasks.find(item => this.$moment(+item.planStart).isSame(this.timeNode, this.timeGranularity)); |
|
|
this.$t.storage.setStorageSync('taskId', ''); |
|
|
task && this.setScrollToTaskId(`a${task.id}`); // 有这个task 就记录他的id |
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
if (show) { |
|
|
|
|
|
this.setViewId(`a${item.id}`); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
}, |
|
|