独立显示完成项目

This commit is contained in:
kuaifan 2021-06-23 00:25:33 +08:00
parent 24345ef6c6
commit dd509d8140
4 changed files with 10 additions and 22 deletions

View File

@ -46,7 +46,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="showCompletedTask" @on-change="$store.dispatch('toggleBoolean', 'showCompletedTask')">{{$L('显示已完成')}}</Checkbox> <Checkbox :value="tablePanel('completedTask')" @on-change="$store.dispatch('toggleTablePanel', 'completedTask')">{{$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="iconfont">&#xe60c;</i></div> <div><i class="iconfont">&#xe60c;</i></div>
@ -407,8 +407,6 @@ export default {
'projectLoad', 'projectLoad',
'tasks', 'tasks',
'columns', 'columns',
'showCompletedTask',
]), ]),
...mapGetters(['projectData', 'tablePanel']), ...mapGetters(['projectData', 'tablePanel']),
@ -420,9 +418,9 @@ export default {
}, },
panelTask() { panelTask() {
const {searchText, showCompletedTask} = this; const {searchText} = this;
return function (list) { return function (list) {
if (!showCompletedTask) { if (!this.tablePanel('completedTask')) {
list = list.filter(({complete_at}) => { list = list.filter(({complete_at}) => {
return !complete_at; return !complete_at;
}); });
@ -437,12 +435,12 @@ export default {
}, },
myList() { myList() {
const {projectId, tasks, searchText, showCompletedTask, userId} = this; const {projectId, tasks, searchText, userId} = 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 (!showCompletedTask) { if (!this.tablePanel('completedTask')) {
if (task.complete_at) { if (task.complete_at) {
return false; return false;
} }
@ -466,12 +464,12 @@ export default {
}, },
undoneList() { undoneList() {
const {projectId, tasks, searchText, showCompletedTask} = this; const {projectId, tasks, searchText} = 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 (!showCompletedTask) { if (!this.tablePanel('completedTask')) {
if (task.complete_at) { if (task.complete_at) {
return false; return false;
} }
@ -935,8 +933,8 @@ export default {
taskIsHidden(task) { taskIsHidden(task) {
const {name, desc, complete_at} = task; const {name, desc, complete_at} = task;
const {searchText, showCompletedTask} = this; const {searchText} = this;
if (!showCompletedTask) { if (!this.tablePanel('completedTask')) {
if (complete_at) { if (complete_at) {
return true; return true;
} }

View File

@ -122,16 +122,6 @@ export default {
}) })
}, },
/**
* 切换Boolean变量
* @param state
* @param key
*/
toggleBoolean({state}, key) {
state[key] = !state[key]
state.method.setStorage("boolean:" + key, state[key]);
},
/** /**
* 切换面板变量 * 切换面板变量
* @param state * @param state

View File

@ -64,6 +64,7 @@ export default {
showMy: true, showMy: true,
showUndone: true, showUndone: true,
showCompleted: false, showCompleted: false,
completedTask: false,
} }
state.cacheTablePanel.push(cache); state.cacheTablePanel.push(cache);
} }

View File

@ -233,7 +233,6 @@ state.cacheColumns = state.method.getStorageArray("cacheColumns");
state.cacheTasks = state.method.getStorageArray("cacheTasks"); state.cacheTasks = state.method.getStorageArray("cacheTasks");
state.cacheTaskSubs = state.method.getStorageArray("cacheTaskSubs"); state.cacheTaskSubs = state.method.getStorageArray("cacheTaskSubs");
state.cacheTablePanel = state.method.getStorageArray("cacheTablePanel"); state.cacheTablePanel = state.method.getStorageArray("cacheTablePanel");
state.showCompletedTask = state.method.getStorageBoolean("showCompletedTask")
// Ajax // Ajax
state.ajaxLoadNum = 0; state.ajaxLoadNum = 0;