mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-12 11:19:56 +00:00
perf: 仪表盘当前激活的卡片不明显优化
This commit is contained in:
parent
1551e6c640
commit
a9e1dc3cd5
104
resources/assets/js/pages/manage/components/TaskDashboard.vue
Normal file
104
resources/assets/js/pages/manage/components/TaskDashboard.vue
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
<template>
|
||||||
|
<ul class="dashboard-list overlay-y">
|
||||||
|
<li
|
||||||
|
v-for="(item, index) in list"
|
||||||
|
:key="index"
|
||||||
|
:class="{complete: item.complete_at}"
|
||||||
|
:style="item.color ? {backgroundColor: item.color} : {}"
|
||||||
|
@click="openTask(item)">
|
||||||
|
<em
|
||||||
|
v-if="item.p_name"
|
||||||
|
class="priority-color"
|
||||||
|
:style="{backgroundColor:item.p_color}"></em>
|
||||||
|
<TaskMenu :ref="`taskMenu_${item.id}`" :task="item">
|
||||||
|
<div slot="icon" class="drop-icon" @click.stop="">
|
||||||
|
<i class="taskfont" v-html="item.complete_at ? '' : ''"></i>
|
||||||
|
</div>
|
||||||
|
</TaskMenu>
|
||||||
|
<div class="item-title">
|
||||||
|
<!--工作流状态-->
|
||||||
|
<span v-if="item.flow_item_name" :class="item.flow_item_status"
|
||||||
|
@click.stop="openMenu(item)">{{ item.flow_item_name }}</span>
|
||||||
|
<!--是否子任务-->
|
||||||
|
<span v-if="item.sub_top === true">{{ $L('子任务') }}</span>
|
||||||
|
<!--有多少个子任务-->
|
||||||
|
<span v-if="item.sub_my && item.sub_my.length > 0">+{{ item.sub_my.length }}</span>
|
||||||
|
<!--任务描述-->
|
||||||
|
{{ item.name }}
|
||||||
|
</div>
|
||||||
|
<div v-if="item.desc" class="item-icon">
|
||||||
|
<i class="taskfont"></i>
|
||||||
|
</div>
|
||||||
|
<div v-if="item.sub_num > 0" class="item-icon">
|
||||||
|
<i class="taskfont"></i>
|
||||||
|
<em>{{ item.sub_complete }}/{{ item.sub_num }}</em>
|
||||||
|
</div>
|
||||||
|
<ETooltip v-if="item.end_at" :content="item.end_at" placement="right">
|
||||||
|
<div :class="['item-icon', item.today ? 'today' : '', item.overdue ? 'overdue' : '']">
|
||||||
|
<i class="taskfont"></i>
|
||||||
|
<em>{{ expiresFormat(item.end_at) }}</em>
|
||||||
|
</div>
|
||||||
|
</ETooltip>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import TaskMenu from "../components/TaskMenu";
|
||||||
|
import {mapGetters, mapState} from "vuex";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: {TaskMenu},
|
||||||
|
name: "TaskDashboard",
|
||||||
|
props: {
|
||||||
|
list: {
|
||||||
|
default: {}
|
||||||
|
},
|
||||||
|
title: {
|
||||||
|
default: null
|
||||||
|
},
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
nowTime: $A.Time(),
|
||||||
|
nowInterval: null,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.nowInterval = setInterval(() => {
|
||||||
|
this.nowTime = $A.Time();
|
||||||
|
}, 1000)
|
||||||
|
},
|
||||||
|
destroyed() {
|
||||||
|
clearInterval(this.nowInterval)
|
||||||
|
},
|
||||||
|
|
||||||
|
activated() {
|
||||||
|
this.$store.dispatch("getTaskForDashboard");
|
||||||
|
},
|
||||||
|
|
||||||
|
deactivated() {
|
||||||
|
this.$store.dispatch("forgetTaskCompleteTemp", true);
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
openTask(task) {
|
||||||
|
this.$store.dispatch("openTask", task)
|
||||||
|
},
|
||||||
|
|
||||||
|
openMenu(task) {
|
||||||
|
const el = this.$refs[`taskMenu_${task.id}`];
|
||||||
|
if (el) {
|
||||||
|
el[0].handleClick()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
expiresFormat(date) {
|
||||||
|
return $A.countDownFormat(date, this.nowTime)
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
||||||
@ -27,60 +27,27 @@
|
|||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<template v-if="list.length > 0">
|
<Tabs v-model="dashboard" style="margin-top: 50px;">
|
||||||
<div class="dashboard-title">{{title}}</div>
|
<TabPane :label="$L('今日待完成')" name="today" @click="dashboard='today'">
|
||||||
<ul class="dashboard-list overlay-y">
|
<TaskDashboard :list="list" />
|
||||||
<li
|
</TabPane>
|
||||||
v-for="(item, index) in list"
|
<TabPane :label="$L('超期未完成')" name="overdue" @click="dashboard='overdue'">
|
||||||
:key="index"
|
<TaskDashboard :list="list" />
|
||||||
:class="{complete: item.complete_at}"
|
</TabPane>
|
||||||
:style="item.color ? {backgroundColor: item.color} : {}"
|
<TabPane :label="$L('待完成任务')" name="all" @click="dashboard='all'">
|
||||||
@click="openTask(item)">
|
<TaskDashboard :list="list" />
|
||||||
<em
|
</TabPane>
|
||||||
v-if="item.p_name"
|
</Tabs>
|
||||||
class="priority-color"
|
|
||||||
:style="{backgroundColor:item.p_color}"></em>
|
|
||||||
<TaskMenu :ref="`taskMenu_${item.id}`" :task="item">
|
|
||||||
<div slot="icon" class="drop-icon" @click.stop="">
|
|
||||||
<i class="taskfont" v-html="item.complete_at ? '' : ''"></i>
|
|
||||||
</div>
|
|
||||||
</TaskMenu>
|
|
||||||
<div class="item-title">
|
|
||||||
<!--工作流状态-->
|
|
||||||
<span v-if="item.flow_item_name" :class="item.flow_item_status" @click.stop="openMenu(item)">{{item.flow_item_name}}</span>
|
|
||||||
<!--是否子任务-->
|
|
||||||
<span v-if="item.sub_top === true">{{$L('子任务')}}</span>
|
|
||||||
<!--有多少个子任务-->
|
|
||||||
<span v-if="item.sub_my && item.sub_my.length > 0">+{{item.sub_my.length}}</span>
|
|
||||||
<!--任务描述-->
|
|
||||||
{{item.name}}
|
|
||||||
</div>
|
|
||||||
<div v-if="item.desc" class="item-icon">
|
|
||||||
<i class="taskfont"></i>
|
|
||||||
</div>
|
|
||||||
<div v-if="item.sub_num > 0" class="item-icon">
|
|
||||||
<i class="taskfont"></i>
|
|
||||||
<em>{{item.sub_complete}}/{{item.sub_num}}</em>
|
|
||||||
</div>
|
|
||||||
<ETooltip v-if="item.end_at" :content="item.end_at" placement="right">
|
|
||||||
<div :class="['item-icon', item.today ? 'today' : '', item.overdue ? 'overdue' : '']">
|
|
||||||
<i class="taskfont"></i>
|
|
||||||
<em>{{expiresFormat(item.end_at)}}</em>
|
|
||||||
</div>
|
|
||||||
</ETooltip>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</template>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {mapGetters, mapState} from "vuex";
|
import {mapGetters, mapState} from "vuex";
|
||||||
import TaskMenu from "./components/TaskMenu";
|
import TaskDashboard from "./components/TaskDashboard";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {TaskMenu},
|
components: {TaskDashboard},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
nowTime: $A.Time(),
|
nowTime: $A.Time(),
|
||||||
|
|||||||
@ -188,6 +188,15 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.ivu-tabs-tab {
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ivu-tabs-bar {
|
||||||
|
border-bottom: none;
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.nopage {
|
.nopage {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user