|
|
@ -3,7 +3,7 @@ |
|
|
|
<Title /> |
|
|
|
<view class="container flex flex-col flex-1 overflow-hidden bg-gray-100"> |
|
|
|
<Roles @getTasks="getTasks" /> |
|
|
|
<Globals :plugins="plugins" /> |
|
|
|
<Globals :plugins="allPlugins.concat(timePlugins)" /> |
|
|
|
<TimeLine @getTasks="getTasks" class="flex-1 overflow-hidden" ref="child" /> |
|
|
|
</view> |
|
|
|
</view> |
|
|
@ -13,7 +13,7 @@ |
|
|
|
import { mapState, mapMutations, mapActions } from 'vuex'; |
|
|
|
export default { |
|
|
|
data() { |
|
|
|
return { title: 'Hello', height: '', scrollHeight: null, plugins: [] }; |
|
|
|
return { title: 'Hello', height: '', scrollHeight: null, allPlugins: [], timePlugins: [] }; |
|
|
|
}, |
|
|
|
|
|
|
|
computed: { |
|
|
@ -21,6 +21,29 @@ export default { |
|
|
|
...mapState('home', ['visibleRoles', 'roleId', 'timeNode', 'timeUnit', 'tasks']), |
|
|
|
}, |
|
|
|
|
|
|
|
watch: { |
|
|
|
/** |
|
|
|
* 当时间基准点发生变化时 |
|
|
|
* 重新根据时间和角色查询普通日常任务 |
|
|
|
* 永久日常任务不发生改变 |
|
|
|
*/ |
|
|
|
async timeNode() { |
|
|
|
// 根据时间和角色查找日常任务 |
|
|
|
await this.getGlobal(); |
|
|
|
}, |
|
|
|
/** |
|
|
|
* 当角色发生变化时 |
|
|
|
* 重新查询永久日常任务和普通日常任务 |
|
|
|
*/ |
|
|
|
async roleId() { |
|
|
|
this.setTimeNode(new Date().getTime()); |
|
|
|
// 根据角色查找永久的日常任务 |
|
|
|
await this.getPermanent(); |
|
|
|
// 根据时间和角色查找日常任务 |
|
|
|
await this.getGlobal(); |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
async onLoad(options) { |
|
|
|
console.log('options: ', options); |
|
|
|
// this.openPage(); |
|
|
@ -65,6 +88,7 @@ export default { |
|
|
|
'setDownTasks', |
|
|
|
'setDailyTasks', |
|
|
|
'setProjectName', |
|
|
|
'setTimeNode', |
|
|
|
]), |
|
|
|
...mapActions('user', ['getUserId']), |
|
|
|
...mapActions('home', ['getProjectById', 'getRoles', 'handleRegularTask']), |
|
|
@ -113,7 +137,11 @@ export default { |
|
|
|
*/ |
|
|
|
async getPermanent() { |
|
|
|
try { |
|
|
|
this.allPlugins = []; |
|
|
|
const res = await this.$u.api.getPermanent({ roleId: this.roleId }); |
|
|
|
for (let item of res) { |
|
|
|
this.allPlugins = this.allPlugins.concat(item.plugins); |
|
|
|
} |
|
|
|
console.log('res', res); |
|
|
|
} catch (error) { |
|
|
|
console.log('error: ', error); |
|
|
@ -128,12 +156,13 @@ export default { |
|
|
|
*/ |
|
|
|
async getGlobal() { |
|
|
|
try { |
|
|
|
this.timePlugins = []; |
|
|
|
const { roleId, timeNode, timeUnit } = this; |
|
|
|
const params = { roleId, timeNode, timeUnit }; |
|
|
|
const res = await this.$u.api.getGlobal(params); |
|
|
|
for (let task of res) { |
|
|
|
for (let item of task.plugins) { |
|
|
|
this.plugins.push(...item); |
|
|
|
this.timePlugins.push(...item); |
|
|
|
} |
|
|
|
} |
|
|
|
this.setDailyTasks(res); |
|
|
|