perf: 已完成任务的显示
This commit is contained in:
parent
834c8cc7d5
commit
a11adad23f
@ -52,7 +52,7 @@
|
|||||||
<div v-if="projectData.desc" class="project-subtitle">{{projectData.desc}}</div>
|
<div v-if="projectData.desc" class="project-subtitle">{{projectData.desc}}</div>
|
||||||
<div class="project-switch">
|
<div class="project-switch">
|
||||||
<div v-if="completedCount > 0" class="project-checkbox">
|
<div v-if="completedCount > 0" class="project-checkbox">
|
||||||
<Checkbox :value="tablePanel('completedTask')" @on-change="$store.dispatch('toggleTablePanel', 'completedTask')">{{$L('显示已完成')}}</Checkbox>
|
<Checkbox :value="tablePanel('completedTask')" @on-change="toggleCompleted">{{$L('显示已完成')}}</Checkbox>
|
||||||
</div>
|
</div>
|
||||||
<div :class="['project-switch-button', !tablePanel('card') ? 'menu' : '']" @click="$store.dispatch('toggleTablePanel', 'card')">
|
<div :class="['project-switch-button', !tablePanel('card') ? 'menu' : '']" @click="$store.dispatch('toggleTablePanel', 'card')">
|
||||||
<div><i class="taskfont"></i></div>
|
<div><i class="taskfont"></i></div>
|
||||||
@ -423,6 +423,8 @@ export default {
|
|||||||
columnTopShow: {},
|
columnTopShow: {},
|
||||||
taskLoad: {},
|
taskLoad: {},
|
||||||
|
|
||||||
|
completeJust: [],
|
||||||
|
|
||||||
searchText: '',
|
searchText: '',
|
||||||
|
|
||||||
addShow: false,
|
addShow: false,
|
||||||
@ -511,13 +513,13 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
myList() {
|
myList() {
|
||||||
const {projectId, tasks, searchText, userId} = this;
|
const {projectId, tasks, searchText, userId, completeJust} = this;
|
||||||
const array = tasks.filter((task) => {
|
const array = tasks.filter((task) => {
|
||||||
if (task.project_id != projectId) {
|
if (task.project_id != projectId) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!this.tablePanel('completedTask')) {
|
if (!this.tablePanel('completedTask')) {
|
||||||
if (task.complete_at) {
|
if (task.complete_at && !completeJust.find(id => id == task.id)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -539,13 +541,13 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
helpList() {
|
helpList() {
|
||||||
const {projectId, tasks, searchText, userId} = this;
|
const {projectId, tasks, searchText, userId, completeJust} = this;
|
||||||
const array = tasks.filter((task) => {
|
const array = tasks.filter((task) => {
|
||||||
if (task.project_id != projectId) {
|
if (task.project_id != projectId) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!this.tablePanel('completedTask')) {
|
if (!this.tablePanel('completedTask')) {
|
||||||
if (task.complete_at) {
|
if (task.complete_at && !completeJust.find(id => id == task.id)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -567,13 +569,13 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
undoneList() {
|
undoneList() {
|
||||||
const {projectId, tasks, searchText} = this;
|
const {projectId, tasks, searchText, completeJust} = this;
|
||||||
const array = tasks.filter((task) => {
|
const array = tasks.filter((task) => {
|
||||||
if (task.project_id != projectId) {
|
if (task.project_id != projectId) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!this.tablePanel('completedTask')) {
|
if (!this.tablePanel('completedTask')) {
|
||||||
if (task.complete_at) {
|
if (task.complete_at && !completeJust.find(id => id == task.id)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -582,7 +584,7 @@ export default {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return !task.complete_at;
|
return !task.complete_at || completeJust.find(id => id == task.id);
|
||||||
});
|
});
|
||||||
return array.sort((a, b) => {
|
return array.sort((a, b) => {
|
||||||
if (a.p_level != b.p_level) {
|
if (a.p_level != b.p_level) {
|
||||||
@ -641,6 +643,9 @@ export default {
|
|||||||
watch: {
|
watch: {
|
||||||
projectData() {
|
projectData() {
|
||||||
this.sortData = this.getSort();
|
this.sortData = this.getSort();
|
||||||
|
},
|
||||||
|
'$route'() {
|
||||||
|
this.completeJust = [];
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -863,6 +868,7 @@ export default {
|
|||||||
this.updateTask(task, {
|
this.updateTask(task, {
|
||||||
complete_at: $A.formatDate("Y-m-d H:i:s")
|
complete_at: $A.formatDate("Y-m-d H:i:s")
|
||||||
})
|
})
|
||||||
|
this.completeJust.push(task.id)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'uncomplete':
|
case 'uncomplete':
|
||||||
@ -1108,6 +1114,11 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
toggleCompleted() {
|
||||||
|
this.$store.dispatch('toggleTablePanel', 'completedTask');
|
||||||
|
this.completeJust = [];
|
||||||
|
},
|
||||||
|
|
||||||
formatTime(date) {
|
formatTime(date) {
|
||||||
let time = Math.round($A.Date(date).getTime() / 1000),
|
let time = Math.round($A.Date(date).getTime() / 1000),
|
||||||
string = '';
|
string = '';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user