mirror of
https://github.com/kuaifan/dootask.git
synced 2026-03-04 08:17:04 +00:00
perf: 仪表盘任务数量、最近打开的任务
This commit is contained in:
parent
88163499fe
commit
74b1194398
@ -21,9 +21,9 @@
|
||||
<i class="taskfont" v-html="item.icon"></i>
|
||||
<div class="tabbar-title">{{$L(item.label)}}</div>
|
||||
<template v-if="item.name === 'dashboard'">
|
||||
<Badge v-if="dashboardTask.overdue.length > 0" class="tabbar-badge" type="error" :count="dashboardTask.overdue.length"/>
|
||||
<Badge v-else-if="dashboardTask.today.length > 0" class="tabbar-badge" type="info" :count="dashboardTask.today.length"/>
|
||||
<Badge v-else-if="dashboardTask.all.length > 0" class="tabbar-badge" type="primary" :count="dashboardTask.all.length"/>
|
||||
<Badge v-if="dashboardTask.overdue_count > 0" class="tabbar-badge" type="error" :count="dashboardTask.overdue_count"/>
|
||||
<Badge v-else-if="dashboardTask.today_count > 0" class="tabbar-badge" type="info" :count="dashboardTask.today_count"/>
|
||||
<Badge v-else-if="dashboardTask.all_count > 0" class="tabbar-badge" type="primary" :count="dashboardTask.all_count"/>
|
||||
</template>
|
||||
<template v-else-if="item.name === 'dialog'">
|
||||
<Badge class="tabbar-badge" :text="msgUnreadMention"/>
|
||||
|
||||
@ -39,7 +39,10 @@
|
||||
:key="key"
|
||||
class="task-title"
|
||||
@click.native="openTask(item)"
|
||||
:name="item.name">{{ item.name }}</DropdownItem>
|
||||
:name="item.name">
|
||||
<span v-if="item.flow_item_name" :class="item.flow_item_status">{{item.flow_item_name}}</span>
|
||||
<div class="task-title-text">{{ item.name }}</div>
|
||||
</DropdownItem>
|
||||
</DropdownMenu>
|
||||
<DropdownMenu v-else slot="list">
|
||||
<DropdownItem style="color:darkgrey">{{ $L('暂无打开记录') }}</DropdownItem>
|
||||
@ -136,9 +139,9 @@
|
||||
<li @click="toggleRoute('dashboard')" :class="classNameRoute('dashboard')">
|
||||
<i class="taskfont"></i>
|
||||
<div class="menu-title">{{$L('仪表盘')}}</div>
|
||||
<Badge v-if="dashboardTask.overdue.length > 0" class="menu-badge" type="error" :count="dashboardTask.overdue.length"/>
|
||||
<Badge v-else-if="dashboardTask.today.length > 0" class="menu-badge" type="info" :count="dashboardTask.today.length"/>
|
||||
<Badge v-else-if="dashboardTask.all.length > 0" class="menu-badge" type="primary" :count="dashboardTask.all.length"/>
|
||||
<Badge v-if="dashboardTask.overdue_count > 0" class="menu-badge" type="error" :count="dashboardTask.overdue_count"/>
|
||||
<Badge v-else-if="dashboardTask.today_count > 0" class="menu-badge" type="info" :count="dashboardTask.today_count"/>
|
||||
<Badge v-else-if="dashboardTask.all_count > 0" class="menu-badge" type="primary" :count="dashboardTask.all_count"/>
|
||||
</li>
|
||||
<li @click="toggleRoute('calendar')" :class="classNameRoute('calendar')">
|
||||
<i class="taskfont"></i>
|
||||
@ -374,9 +377,11 @@ import Report from "./manage/components/Report";
|
||||
import notificationKoro from "notification-koro1";
|
||||
import {Store} from "le5le-store";
|
||||
import MobileBack from "../components/Mobile/Back";
|
||||
import TaskMenu from "./manage/components/TaskMenu";
|
||||
|
||||
export default {
|
||||
components: {
|
||||
TaskMenu,
|
||||
MobileBack,
|
||||
MobileTabbar,
|
||||
UserInput,
|
||||
@ -539,7 +544,7 @@ export default {
|
||||
|
||||
unreadTotal() {
|
||||
if (this.userId > 0) {
|
||||
return this.msgAllUnread + this.dashboardTask.overdue.length + this.reportUnreadNumber
|
||||
return this.msgAllUnread + this.dashboardTask.overdue_count + this.reportUnreadNumber
|
||||
} else {
|
||||
return 0
|
||||
}
|
||||
|
||||
@ -270,15 +270,17 @@ export default {
|
||||
//
|
||||
Object.keys(updata).forEach(key => this.$set(this.task, key, updata[key]));
|
||||
//
|
||||
this.$store.dispatch("taskUpdate", Object.assign(updata, {
|
||||
const updateData = Object.assign(updata, {
|
||||
task_id: this.task.id,
|
||||
})).then(({data, msg}) => {
|
||||
});
|
||||
this.$store.dispatch("taskUpdate", updateData).then(({data, msg}) => {
|
||||
$A.messageSuccess(msg);
|
||||
resolve()
|
||||
this.$store.dispatch("saveTaskBrowse", updateData.task_id);
|
||||
this.$emit("on-update", data)
|
||||
}).catch(({msg}) => {
|
||||
$A.modalError(msg);
|
||||
this.$store.dispatch("getTaskOne", this.task.id).catch(() => {})
|
||||
this.$store.dispatch("getTaskOne", updateData.task_id).catch(() => {})
|
||||
reject()
|
||||
});
|
||||
})
|
||||
@ -311,6 +313,7 @@ export default {
|
||||
}
|
||||
this.$store.dispatch(typeDispatch, typeData).then(({msg}) => {
|
||||
$A.messageSuccess(msg);
|
||||
this.$store.dispatch("saveTaskBrowse", typeData.task_id);
|
||||
}).catch(({msg}) => {
|
||||
$A.modalError(msg, 301);
|
||||
}).finally(_ => {
|
||||
|
||||
@ -8,21 +8,21 @@
|
||||
<li @click="scrollTo('today')">
|
||||
<div class="block-title">{{getTitle('today')}}</div>
|
||||
<div class="block-data">
|
||||
<div class="block-num">{{dashboardTask.today.length}}</div>
|
||||
<div class="block-num">{{dashboardTask.today_count}}</div>
|
||||
<i class="taskfont"></i>
|
||||
</div>
|
||||
</li>
|
||||
<li @click="scrollTo('overdue')">
|
||||
<div class="block-title">{{getTitle('overdue')}}</div>
|
||||
<div class="block-data">
|
||||
<div class="block-num">{{dashboardTask.overdue.length}}</div>
|
||||
<div class="block-num">{{dashboardTask.overdue_count}}</div>
|
||||
<i class="taskfont"></i>
|
||||
</div>
|
||||
</li>
|
||||
<li @click="scrollTo('all')">
|
||||
<div class="block-title">{{getTitle('all')}}</div>
|
||||
<div class="block-data">
|
||||
<div class="block-num">{{dashboardTask.all.length}}</div>
|
||||
<div class="block-num">{{dashboardTask.all_count}}</div>
|
||||
<i class="taskfont"></i>
|
||||
</div>
|
||||
</li>
|
||||
@ -136,7 +136,7 @@ export default {
|
||||
|
||||
total() {
|
||||
const {dashboardTask} = this;
|
||||
return dashboardTask.today.length + dashboardTask.overdue.length + dashboardTask.all.length;
|
||||
return dashboardTask.today_count + dashboardTask.overdue_count + dashboardTask.all_count;
|
||||
},
|
||||
},
|
||||
|
||||
@ -144,7 +144,7 @@ export default {
|
||||
getTitle(type) {
|
||||
switch (type) {
|
||||
case 'today':
|
||||
return this.$L('今日任务');
|
||||
return this.$L('今日到期');
|
||||
case 'overdue':
|
||||
return this.$L('超期任务');
|
||||
case 'all':
|
||||
|
||||
23
resources/assets/js/store/getters.js
vendored
23
resources/assets/js/store/getters.js
vendored
@ -115,26 +115,37 @@ export default {
|
||||
return task.owner;
|
||||
}
|
||||
let array = state.cacheTasks.filter(task => filterTask(task));
|
||||
let tmpCount = 0;
|
||||
if (state.taskCompleteTemps.length > 0) {
|
||||
let tmps = state.cacheTasks.filter(task => state.taskCompleteTemps.includes(task.id) && filterTask(task, false));
|
||||
if (tmps.length > 0) {
|
||||
tmpCount = tmps.length
|
||||
array = $A.cloneJSON(array)
|
||||
array.push(...tmps);
|
||||
}
|
||||
}
|
||||
const todayTasks = array.filter(task => {
|
||||
const start = $A.Date(task.start_at),
|
||||
end = $A.Date(task.end_at);
|
||||
return (start <= todayStart && todayStart <= end) || (start <= todayEnd && todayEnd <= end) || (start > todayStart && todayEnd > end);
|
||||
const end = $A.Date(task.end_at);
|
||||
return todayStart <= end && end <= todayEnd;
|
||||
})
|
||||
const overdueTasks = array.filter(task => {
|
||||
return task.end_at && $A.Date(task.end_at) <= todayNow;
|
||||
})
|
||||
|
||||
return {
|
||||
const result = {
|
||||
today: todayTasks,
|
||||
today_count: todayTasks.length,
|
||||
|
||||
overdue: overdueTasks,
|
||||
all: array
|
||||
overdue_count: overdueTasks.length,
|
||||
|
||||
all: array,
|
||||
all_count: array.length,
|
||||
};
|
||||
if (tmpCount > 0) {
|
||||
result.today_count -= todayTasks.filter(task => state.taskCompleteTemps.includes(task.id)).length
|
||||
result.overdue_count -= overdueTasks.filter(task => state.taskCompleteTemps.includes(task.id)).length
|
||||
result.all_count -= tmpCount
|
||||
}
|
||||
return result
|
||||
},
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user