|
@ -44,8 +44,8 @@ export default { |
|
|
timeNode(val) { |
|
|
timeNode(val) { |
|
|
if (val && this.roleId) { |
|
|
if (val && this.roleId) { |
|
|
// 根据时间和角色查找日常任务 |
|
|
// 根据时间和角色查找日常任务 |
|
|
this.getGlobalData(); |
|
|
// this.getGlobalData(); |
|
|
this.getInitTasks(); |
|
|
// this.getInitTasks(); |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
@ -57,7 +57,11 @@ export default { |
|
|
*/ |
|
|
*/ |
|
|
roleId(val) { |
|
|
roleId(val) { |
|
|
if (val) { |
|
|
if (val) { |
|
|
this.setTimeNode(Date.now()); |
|
|
// 如果storage里有timeNode,修改store里的timeNode |
|
|
|
|
|
this.setTimeNode(+this.$t.storage.getStorageSync('timeNode') || Date.now()); |
|
|
|
|
|
// 清空storage |
|
|
|
|
|
this.$t.storage.setStorageSync('timeNode', ''); |
|
|
|
|
|
console.log('当角色发生变化时: ', this.timeNode); |
|
|
// 根据角色查找永久的日常任务 |
|
|
// 根据角色查找永久的日常任务 |
|
|
this.getPermanent(val); |
|
|
this.getPermanent(val); |
|
|
} |
|
|
} |
|
@ -106,13 +110,19 @@ export default { |
|
|
// 没有项目id参数 |
|
|
// 没有项目id参数 |
|
|
this.$t.ui.showToast('缺少项目信息参数'); |
|
|
this.$t.ui.showToast('缺少项目信息参数'); |
|
|
} else { |
|
|
} else { |
|
|
|
|
|
// 如果storage里有timeNode,修改store里的timeNode |
|
|
|
|
|
this.setTimeNode(this.$t.storage.getStorageSync('timeNode') - 0); |
|
|
|
|
|
// 清空storage |
|
|
|
|
|
this.$t.storage.setStorageSync('timeNode', ''); |
|
|
|
|
|
console.log('timeNode: ', this.$t.storage.getStorageSync('timeNode'), this.timeNode); |
|
|
// 根据项目id获取项目信息 |
|
|
// 根据项目id获取项目信息 |
|
|
await this.getProjectById({ projectId: options.p }); |
|
|
await this.getProjectById({ projectId: options.p }); |
|
|
// 根据项目id获取角色列表 |
|
|
// 根据项目id获取角色列表 |
|
|
await this.getRoles({ projectId: options.p }); |
|
|
await this.getRoles({ projectId: options.p }); |
|
|
this.setInitialRoleId(this.visibleRoles); |
|
|
this.setInitialRoleId(this.visibleRoles); |
|
|
// 获取初始定期任务 |
|
|
// 根据时间和角色查找日常任务 |
|
|
// await this.getInitTasks(); |
|
|
await this.getGlobalData(); |
|
|
|
|
|
await this.getInitTasks(); |
|
|
} |
|
|
} |
|
|
} catch (error) { |
|
|
} catch (error) { |
|
|
console.error('project init function:', error); |
|
|
console.error('project init function:', error); |
|
@ -126,7 +136,7 @@ export default { |
|
|
await this.getTasks({ queryType: 1 }); |
|
|
await this.getTasks({ queryType: 1 }); |
|
|
|
|
|
|
|
|
// 预加载 上下的定期任务 |
|
|
// 预加载 上下的定期任务 |
|
|
if (this.tasks && this.tasks.length && this.tasks.plugins && this.tasks.plugins.length) { |
|
|
if (this.tasks && this.tasks.length && this.tasks.id) { |
|
|
this.$nextTick(() => { |
|
|
this.$nextTick(() => { |
|
|
const { tasks, timeGranularity } = this; |
|
|
const { tasks, timeGranularity } = this; |
|
|
this.getTasks({ timeNode: +tasks[0].planStart, queryType: 0, queryNum: 6 }); |
|
|
this.getTasks({ timeNode: +tasks[0].planStart, queryType: 0, queryNum: 6 }); |
|
@ -146,8 +156,11 @@ export default { |
|
|
setInitialRoleId(visibleList) { |
|
|
setInitialRoleId(visibleList) { |
|
|
const index = visibleList.findIndex(item => item.mine === '1'); |
|
|
const index = visibleList.findIndex(item => item.mine === '1'); |
|
|
const currentRole = index > 0 ? visibleList[index] : visibleList[0]; |
|
|
const currentRole = index > 0 ? visibleList[index] : visibleList[0]; |
|
|
const currentRoleId = currentRole ? currentRole.id : ''; |
|
|
const storageRoleId = this.$t.storage.getStorageSync('roleId'); |
|
|
|
|
|
const currentRoleId = storageRoleId ? storageRoleId : currentRole ? currentRole.id : ''; |
|
|
this.setRoleId(currentRoleId); |
|
|
this.setRoleId(currentRoleId); |
|
|
|
|
|
// 清空storage |
|
|
|
|
|
this.$t.storage.setStorageSync('roleId', ''); |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
@ -170,7 +183,7 @@ export default { |
|
|
queryNum: query.queryNum || 3, |
|
|
queryNum: query.queryNum || 3, |
|
|
queryType: query.queryType, |
|
|
queryType: query.queryType, |
|
|
}; |
|
|
}; |
|
|
|
|
|
console.log('params: ', params); |
|
|
await this.getRegulars(params); |
|
|
await this.getRegulars(params); |
|
|
this.setShowSkeleton(false); |
|
|
this.setShowSkeleton(false); |
|
|
} catch (error) { |
|
|
} catch (error) { |
|
|