diff --git a/resources/assets/js/pages/manage/components/ProjectList.vue b/resources/assets/js/pages/manage/components/ProjectList.vue
index 6768765c..79dbe10d 100644
--- a/resources/assets/js/pages/manage/components/ProjectList.vue
+++ b/resources/assets/js/pages/manage/components/ProjectList.vue
@@ -23,7 +23,7 @@
-
+
@@ -46,15 +46,15 @@
{{projectData.desc}}
- {{$L('显示已完成')}}
+ {{$L('显示已完成')}}
-
-
+
-
+
-
+
{{$L('我的任务')}}
({{myList.length}})
@@ -244,10 +244,10 @@
-
+
-
+
{{$L('未完成任务')}}
({{undoneList.length}})
@@ -259,10 +259,10 @@
-
+
-
+
{{$L('已完成任务')}}
({{completedList.length}})
@@ -408,15 +408,10 @@ export default {
'columns',
'projectChatShow',
- 'projectTablePanel',
'projectCompleteShow',
-
- 'taskMyShow',
- 'taskUndoneShow',
- 'taskCompletedShow'
]),
- ...mapGetters(['projectData']),
+ ...mapGetters(['projectData', 'tablePanel']),
msgUnread() {
const {dialogList, projectData} = this;
@@ -938,10 +933,6 @@ export default {
}
},
- toggleBoolean(type) {
- this.$store.dispatch("toggleBoolean", type);
- },
-
taskIsHidden(task) {
const {name, desc, complete_at} = task;
const {searchText, projectCompleteShow} = this;
diff --git a/resources/assets/js/store/actions.js b/resources/assets/js/store/actions.js
index 7654402d..81790b4e 100644
--- a/resources/assets/js/store/actions.js
+++ b/resources/assets/js/store/actions.js
@@ -1,3 +1,5 @@
+import state from "./state";
+
export default {
/**
* 访问接口
@@ -132,6 +134,28 @@ export default {
state.method.setStorage("boolean:" + key, state[key]);
},
+ /**
+ * 切换面板变量
+ * @param state
+ * @param key
+ */
+ toggleTablePanel({state}, key) {
+ if (state.projectId) {
+ let index = state.cacheTablePanel.findIndex(({project_id}) => project_id == state.projectId)
+ if (index === -1) {
+ state.cacheTablePanel.push({
+ project_id: state.projectId,
+ });
+ index = state.cacheTablePanel.findIndex(({project_id}) => project_id == state.projectId)
+ }
+ const cache = state.cacheTablePanel[index];
+ state.cacheTablePanel.splice(index, 1, Object.assign(cache, {
+ [key]: !cache[key]
+ }))
+ state.method.setStorage("cacheTablePanel", state.cacheTablePanel);
+ }
+ },
+
/**
* 获取/更新会员信息
* @param dispatch
diff --git a/resources/assets/js/store/getters.js b/resources/assets/js/store/getters.js
index 4b76f70e..1b66ea3f 100644
--- a/resources/assets/js/store/getters.js
+++ b/resources/assets/js/store/getters.js
@@ -48,4 +48,24 @@ export default {
}
return {};
},
+
+ tablePanel(state) {
+ return function (key) {
+ if (!state.projectId) {
+ return false;
+ }
+ let cache = state.cacheTablePanel.find(({project_id}) => project_id == state.projectId);
+ if (!cache) {
+ cache = {
+ project_id: state.projectId,
+ card: true,
+ showMy: true,
+ showUndone: true,
+ showCompleted: false,
+ }
+ state.cacheTablePanel.push(cache);
+ }
+ return cache && !!cache[key];
+ }
+ }
}
diff --git a/resources/assets/js/store/state.js b/resources/assets/js/store/state.js
index 95d67d53..9bd7bde0 100644
--- a/resources/assets/js/store/state.js
+++ b/resources/assets/js/store/state.js
@@ -226,23 +226,6 @@ const method = {
// 方法类
const state = { method };
-// 变量缓存
-[
- 'projectTablePanel', // 项目面板显示类型
- 'taskMyShow', // 项目面板显示我的任务
- 'taskUndoneShow', // 项目面板显示未完成任务
-].forEach((key) => {
- state[key] = state.method.getStorageBoolean("boolean:" + key, true)
-});
-
-[
- 'projectChatShow', // 项目聊天显示
- 'taskCompletedShow', // 项目面板显示已完成任务
- 'projectCompleteShow' // 项目面板显示已完成列表
-].forEach((key) => {
- state[key] = state.method.getStorageBoolean("boolean:" + key, false)
-});
-
// ajax
state.ajaxLoadNum = 0;
state.ajaxWsReady = false;
@@ -255,6 +238,9 @@ state.cacheProjects = state.method.getStorageArray("cacheProjects");
state.cacheColumns = state.method.getStorageArray("cacheColumns");
state.cacheTasks = state.method.getStorageArray("cacheTasks");
state.cacheTaskSubs = state.method.getStorageArray("cacheTaskSubs");
+state.cacheTablePanel = state.method.getStorageArray("cacheTablePanel");
+state.projectChatShow = state.method.getStorageBoolean("boolean:projectChatShow", false)
+state.projectCompleteShow = state.method.getStorageBoolean("boolean:projectCompleteShow", false)
// 会员信息
state.userInfo = state.method.getStorageJson("userInfo");