|
|
@ -38,9 +38,11 @@ export default { |
|
|
|
* 永久日常任务不发生改变 |
|
|
|
*/ |
|
|
|
timeNode(val) { |
|
|
|
console.log(val); |
|
|
|
if (val && this.roleId) { |
|
|
|
// 根据时间和角色查找日常任务 |
|
|
|
this.getGlobalData(); |
|
|
|
this.getInitTasks(); |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
@ -102,22 +104,25 @@ export default { |
|
|
|
// 根据项目id获取角色列表 |
|
|
|
await this.getRoles({ projectId: options.p }); |
|
|
|
this.setInitialRoleId(this.visibleRoles); |
|
|
|
|
|
|
|
// 根据时间基准点和角色查找定期任务 |
|
|
|
await this.getTasks({ queryType: 0 }); |
|
|
|
await this.getTasks({ queryType: 1 }); |
|
|
|
|
|
|
|
// 预加载 上下的定期任务 |
|
|
|
if (this.tasks && this.tasks.length) { |
|
|
|
await this.getTasks({ timeNode: +this.tasks[0].planStart, queryType: 0, queryNum: 6 }); |
|
|
|
await this.getTasks({ timeNode: +this.tasks[this.tasks.length - 1].planStart, queryType: 1, queryNum: 6 }); |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (error) { |
|
|
|
console.error('project init function:', error); |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
// 切换了 颗粒度 || 角色时候 获取初始定期任务 |
|
|
|
async getInitTasks() { |
|
|
|
// 根据时间基准点和角色查找定期任务 |
|
|
|
await this.getTasks({ queryType: 0 }); |
|
|
|
await this.getTasks({ queryType: 1 }); |
|
|
|
|
|
|
|
// 预加载 上下的定期任务 |
|
|
|
if (this.tasks && this.tasks.length) { |
|
|
|
this.getTasks({ timeNode: +this.tasks[0].planStart, queryType: 0, queryNum: 6 }); |
|
|
|
this.getTasks({ timeNode: +this.tasks[this.tasks.length - 1].planStart, queryType: 1, queryNum: 6 }); |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
// 设置 初始显示角色信息 |
|
|
|
setInitialRoleId(visibleList) { |
|
|
|
const index = visibleList.findIndex(item => item.mine); |
|
|
@ -156,34 +161,6 @@ export default { |
|
|
|
const param = { roleId, timeNode, timeUnit }; |
|
|
|
this.getGlobal(param); |
|
|
|
}, |
|
|
|
|
|
|
|
// 切换角色获取任务 |
|
|
|
async getTasksByRole() { |
|
|
|
try { |
|
|
|
await this.getTasks({ queryType: 0 }); |
|
|
|
await this.getTasks({ queryType: 1 }); |
|
|
|
// 查上页的任务 |
|
|
|
const upQuery = { |
|
|
|
timeNode: +this.tasks[0].planStart, |
|
|
|
queryType: 0, |
|
|
|
queryNum: 6, |
|
|
|
}; |
|
|
|
await this.getTasks(upQuery); |
|
|
|
|
|
|
|
// 查下页的任务 |
|
|
|
// 时间基准点=最后一个任务的开始时间+当前时间颗粒度 |
|
|
|
const cycle = this.$t.time.computeCycle('天'); |
|
|
|
const timeNode = this.$t.time.add(+this.tasks[this.tasks.length - 1].planStart, 1, cycle).valueOf(); |
|
|
|
const downQuery = { |
|
|
|
timeNode, |
|
|
|
queryType: 1, |
|
|
|
queryNum: 6, |
|
|
|
}; |
|
|
|
await this.getTasks(downQuery); |
|
|
|
} catch (error) { |
|
|
|
console.log('error: ', error); |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
}; |
|
|
|
</script> |
|
|
|