diff --git a/resources/assets/js/pages/manage.vue b/resources/assets/js/pages/manage.vue index f018c572..32cf95b4 100644 --- a/resources/assets/js/pages/manage.vue +++ b/resources/assets/js/pages/manage.vue @@ -293,8 +293,8 @@ export default { 'userId', 'userInfo', 'userIsAdmin', - 'dialogs', - 'projects', + 'cacheDialogs', + 'cacheProjects', 'projectTotal', 'taskId', 'dialogMsgPush', @@ -304,7 +304,7 @@ export default { msgAllUnread() { let num = 0; - this.dialogs.map(({unread}) => { + this.cacheDialogs.map(({unread}) => { if (unread) { num += unread; } @@ -344,8 +344,8 @@ export default { }, projectLists() { - const {projectKeyValue, projects} = this; - const data = projects.sort((a, b) => { + const {projectKeyValue, cacheProjects} = this; + const data = cacheProjects.sort((a, b) => { return b.id - a.id; }); if (projectKeyValue) { @@ -412,7 +412,7 @@ export default { tag: "dialog", requireInteraction: true }); - let dialog = this.dialogs.find((item) => item.id == dialog_id); + let dialog = this.cacheDialogs.find((item) => item.id == dialog_id); if (dialog) { this.notificationClass.replaceTitle(dialog.name); this.notificationClass.userAgreed(); diff --git a/resources/assets/js/pages/manage/calendar.vue b/resources/assets/js/pages/manage/calendar.vue index f3ceb014..ac02e25b 100644 --- a/resources/assets/js/pages/manage/calendar.vue +++ b/resources/assets/js/pages/manage/calendar.vue @@ -28,7 +28,6 @@ :month="calendarMonth" :theme="calendarTheme" :template="calendarTemplate" - :calendars="calendarList" :schedules="list" :taskView="false" :useCreationPopup="false" @@ -64,7 +63,6 @@ export default { calendarMonth: {}, calendarTheme: {}, calendarTemplate: {}, - calendarList: [], loadIng: 0, loadTimeout: null, @@ -77,12 +75,12 @@ export default { }, computed: { - ...mapState(['userId', 'projects', 'tasks']), + ...mapState(['userId', 'cacheTasks']), ...mapGetters(['transforTasks']), list() { - const datas = this.transforTasks(this.tasks.filter(({complete_at, owner, end_at}) => { + const datas = this.transforTasks(this.cacheTasks.filter(({complete_at, owner, end_at}) => { return !complete_at && owner && end_at; })); return datas.map(data => { @@ -134,21 +132,6 @@ export default { rangeTime(time) { this.getTask(time); }, - - projects: { - handler(data) { - const list = data.map((project) => { - return { - id: String(project.id), - name: project.name, - } - }); - if (JSON.stringify(list) != JSON.stringify(this.calendarList)) { - this.calendarList = list; - } - }, - immediate: true, - }, }, methods: { @@ -299,7 +282,7 @@ export default { }, onBeforeClickSchedule({type, schedule}) { - let data = this.tasks.find(({id}) => id === schedule.id); + let data = this.cacheTasks.find(({id}) => id === schedule.id); if (!data) { return; } @@ -343,7 +326,7 @@ export default { onBeforeUpdateSchedule(res) { const {changes, schedule} = res; - let data = this.tasks.find(({id}) => id === schedule.id); + let data = this.cacheTasks.find(({id}) => id === schedule.id); if (!data) { return; } diff --git a/resources/assets/js/pages/manage/components/DialogWrapper.vue b/resources/assets/js/pages/manage/components/DialogWrapper.vue index ecaeaa41..b19f9392 100644 --- a/resources/assets/js/pages/manage/components/DialogWrapper.vue +++ b/resources/assets/js/pages/manage/components/DialogWrapper.vue @@ -125,13 +125,13 @@ export default { computed: { ...mapState([ 'userId', - 'dialogs', + 'cacheDialogs', 'dialogMsgs', 'dialogMsgPush', ]), dialogData() { - return this.dialogs.find(({id}) => id == this.dialogId) || {}; + return this.cacheDialogs.find(({id}) => id == this.dialogId) || {}; }, dialogMsgList() { diff --git a/resources/assets/js/pages/manage/components/ProjectList.vue b/resources/assets/js/pages/manage/components/ProjectList.vue index a2cf6fb4..07484243 100644 --- a/resources/assets/js/pages/manage/components/ProjectList.vue +++ b/resources/assets/js/pages/manage/components/ProjectList.vue @@ -542,14 +542,14 @@ export default { 'windowMax768', 'userId', - 'dialogs', + 'cacheDialogs', 'taskPriority', 'projectId', 'projectLoad', - 'tasks', - 'columns', + 'cacheTasks', + 'cacheColumns', ]), ...mapGetters(['projectData', 'projectParameter', 'transforTasks']), @@ -569,8 +569,8 @@ export default { }, msgUnread() { - const {dialogs, projectData} = this; - const dialog = dialogs.find(({id}) => id === projectData.dialog_id); + const {cacheDialogs, projectData} = this; + const dialog = cacheDialogs.find(({id}) => id === projectData.dialog_id); return dialog ? dialog.unread : 0; }, @@ -604,8 +604,8 @@ export default { }, columnList() { - const {projectId, columns, tasks} = this; - const list = columns.filter(({project_id}) => { + const {projectId, cacheColumns, cacheTasks} = this; + const list = cacheColumns.filter(({project_id}) => { return project_id == projectId }).sort((a, b) => { if (a.sort != b.sort) { @@ -614,7 +614,7 @@ export default { return a.id - b.id; }); list.forEach((column) => { - column.tasks = this.transforTasks(tasks.filter((task) => { + column.tasks = this.transforTasks(cacheTasks.filter((task) => { return task.column_id == column.id; })).sort((a, b) => { if (a.sort != b.sort) { @@ -627,8 +627,8 @@ export default { }, myList() { - const {projectId, tasks, searchText, tempShowTasks, sortField, sortType} = this; - const array = tasks.filter((task) => { + const {projectId, cacheTasks, searchText, tempShowTasks, sortField, sortType} = this; + const array = cacheTasks.filter((task) => { if (task.project_id != projectId) { return false; } @@ -660,8 +660,8 @@ export default { }, helpList() { - const {projectId, tasks, searchText, tempShowTasks, userId, sortField, sortType} = this; - const array = tasks.filter((task) => { + const {projectId, cacheTasks, searchText, tempShowTasks, userId, sortField, sortType} = this; + const array = cacheTasks.filter((task) => { if (task.project_id != projectId || task.parent_id > 0) { return false; } @@ -693,8 +693,8 @@ export default { }, unList() { - const {projectId, tasks, searchText, sortField, sortType} = this; - const array = tasks.filter((task) => { + const {projectId, cacheTasks, searchText, sortField, sortType} = this; + const array = cacheTasks.filter((task) => { if (task.project_id != projectId || task.parent_id > 0) { return false; } @@ -721,8 +721,8 @@ export default { }, completedList() { - const {projectId, tasks, searchText} = this; - const array = tasks.filter((task) => { + const {projectId, cacheTasks, searchText} = this; + const array = cacheTasks.filter((task) => { if (task.project_id != projectId || task.parent_id > 0) { return false; } @@ -741,8 +741,8 @@ export default { }, completedCount() { - const {projectId, tasks} = this; - return tasks.filter((task) => { + const {projectId, cacheTasks} = this; + return cacheTasks.filter((task) => { if (task.project_id != projectId || task.parent_id > 0) { return false; } @@ -809,7 +809,7 @@ export default { sort = -1; upTask.push(...item.task.map(id => { sort++; - upTask.push(...this.tasks.filter(({parent_id}) => parent_id == id).map(({id}) => { + upTask.push(...this.cacheTasks.filter(({parent_id}) => parent_id == id).map(({id}) => { return { id, sort, diff --git a/resources/assets/js/pages/manage/components/TaskAdd.vue b/resources/assets/js/pages/manage/components/TaskAdd.vue index 5a48d7c8..cbe821a7 100644 --- a/resources/assets/js/pages/manage/components/TaskAdd.vue +++ b/resources/assets/js/pages/manage/components/TaskAdd.vue @@ -224,7 +224,7 @@ export default { }, computed: { - ...mapState(['userId', 'projects', 'projectId', 'columns', 'taskPriority']), + ...mapState(['userId', 'cacheProjects', 'projectId', 'cacheColumns', 'taskPriority']), taskDays() { const {times} = this.addData; @@ -324,8 +324,8 @@ export default { }, initCascaderData() { - this.cascaderData = this.projects.map(project => { - const children = this.columns.filter(({project_id}) => project_id == project.id).map(column => { + this.cascaderData = this.cacheProjects.map(project => { + const children = this.cacheColumns.filter(({project_id}) => project_id == project.id).map(column => { return { value: column.id, label: column.name @@ -346,7 +346,7 @@ export default { initProjectData() { let column_id = this.addData.column_id; if (column_id) { - let column = this.columns.find(({id}) => id == column_id); + let column = this.cacheColumns.find(({id}) => id == column_id); if (column) { this.addData.project_id = column.project_id; this.addData.column_id = column.id; @@ -354,19 +354,19 @@ export default { } else { let cacheAddTaskProjectId = $A.getStorageInt("cacheAddTaskProjectId"); let cacheAddTaskColumnId = $A.getStorageInt("cacheAddTaskColumnId"); - let project = this.projects.find(({id}) => id == this.projectId) - || this.projects.find(({id}) => id == cacheAddTaskProjectId) - || this.projects.find(({id}) => id > 0); + let project = this.cacheProjects.find(({id}) => id == this.projectId) + || this.cacheProjects.find(({id}) => id == cacheAddTaskProjectId) + || this.cacheProjects.find(({id}) => id > 0); if (project) { - let column = this.columns.find(({project_id, id}) => project_id == project.id && id == cacheAddTaskColumnId) - || this.columns.find(({project_id}) => project_id == project.id); + let column = this.cacheColumns.find(({project_id, id}) => project_id == project.id && id == cacheAddTaskColumnId) + || this.cacheColumns.find(({project_id}) => project_id == project.id); if (column) { this.addData.project_id = column.project_id; this.addData.column_id = column.id; } else { this.$store.dispatch("getColumns", project.id).then(() => { - column = this.columns.find(({project_id, id}) => project_id == project.id && id == cacheAddTaskColumnId) - || this.columns.find(({project_id}) => project_id == project.id); + column = this.cacheColumns.find(({project_id, id}) => project_id == project.id && id == cacheAddTaskColumnId) + || this.cacheColumns.find(({project_id}) => project_id == project.id); if (column) { this.addData.project_id = column.project_id; this.addData.column_id = column.id; diff --git a/resources/assets/js/pages/manage/components/TaskDetail.vue b/resources/assets/js/pages/manage/components/TaskDetail.vue index 3eb70990..aa4953a9 100644 --- a/resources/assets/js/pages/manage/components/TaskDetail.vue +++ b/resources/assets/js/pages/manage/components/TaskDetail.vue @@ -519,9 +519,9 @@ export default { computed: { ...mapState([ 'userId', - 'projects', - 'columns', - 'tasks', + 'cacheProjects', + 'cacheColumns', + 'cacheTasks', 'taskContents', 'taskFiles', 'taskPriority', @@ -534,7 +534,7 @@ export default { if (this.taskDetail.project_name) { return this.taskDetail.project_name; } - const project = this.projects.find(({id}) => id == this.taskDetail.project_id) + const project = this.cacheProjects.find(({id}) => id == this.taskDetail.project_id) return project ? project.name : ''; }, @@ -545,7 +545,7 @@ export default { if (this.taskDetail.column_name) { return this.taskDetail.column_name; } - const column = this.columns.find(({id}) => id == this.taskDetail.column_id) + const column = this.cacheColumns.find(({id}) => id == this.taskDetail.column_id) return column ? column.name : ''; }, @@ -572,7 +572,7 @@ export default { if (!this.taskId) { return []; } - return this.tasks.filter(({parent_id}) => { + return this.cacheTasks.filter(({parent_id}) => { return parent_id == this.taskId }).sort((a, b) => { return a.id - b.id; diff --git a/resources/assets/js/pages/manage/components/TaskRow.vue b/resources/assets/js/pages/manage/components/TaskRow.vue index 3e3ed726..59b54271 100644 --- a/resources/assets/js/pages/manage/components/TaskRow.vue +++ b/resources/assets/js/pages/manage/components/TaskRow.vue @@ -193,11 +193,11 @@ export default { }, computed: { - ...mapState(['tasks', 'taskPriority', 'columns']), + ...mapState(['cacheTasks', 'taskPriority', 'cacheColumns']), subTask() { return function(task_id) { - return this.tasks.filter(({parent_id}) => { + return this.cacheTasks.filter(({parent_id}) => { return parent_id == task_id }).sort((a, b) => { return a.id - b.id; @@ -207,7 +207,7 @@ export default { }, methods: { columnName(column_id) { - const column = this.columns.find(({id}) => id == column_id) + const column = this.cacheColumns.find(({id}) => id == column_id) return column ? column.name : ''; }, @@ -243,7 +243,7 @@ export default { }, columnList(id) { - return this.columns.filter(({project_id}) => project_id == id); + return this.cacheColumns.filter(({project_id}) => project_id == id); }, openTask(task, receive) { diff --git a/resources/assets/js/pages/manage/dashboard.vue b/resources/assets/js/pages/manage/dashboard.vue index bafb00e9..fe91974e 100644 --- a/resources/assets/js/pages/manage/dashboard.vue +++ b/resources/assets/js/pages/manage/dashboard.vue @@ -22,7 +22,7 @@
  • {{$L('参与的项目')}}
    -
    {{projects.length}}
    +
    {{cacheProjects.length}}
  • @@ -139,7 +139,7 @@ export default { }, computed: { - ...mapState(['userInfo', 'projects', 'tasks', 'taskId']), + ...mapState(['userInfo', 'cacheProjects', 'taskId']), ...mapGetters(['dashboardTask', 'transforTasks']), diff --git a/resources/assets/js/pages/manage/messenger.vue b/resources/assets/js/pages/manage/messenger.vue index eea66fa4..fca5c37f 100644 --- a/resources/assets/js/pages/manage/messenger.vue +++ b/resources/assets/js/pages/manage/messenger.vue @@ -118,14 +118,14 @@ export default { }, computed: { - ...mapState(['userId', 'dialogs', 'dialogOpenId']), + ...mapState(['userId', 'cacheDialogs', 'dialogOpenId']), dialogList() { const {dialogActive, dialogKey} = this; if (dialogActive == '' && dialogKey == '') { - return this.dialogs.filter(({name}) => name !== undefined); + return this.cacheDialogs.filter(({name}) => name !== undefined); } - return this.dialogs.filter(({name, type, group_type, last_msg}) => { + return this.cacheDialogs.filter(({name, type, group_type, last_msg}) => { if (name === undefined) { return false; } @@ -160,7 +160,7 @@ export default { msgUnread() { return function (type) { let num = 0; - this.dialogs.map((dialog) => { + this.cacheDialogs.map((dialog) => { if (dialog.unread) { switch (type) { case 'project': @@ -233,7 +233,7 @@ export default { openDialogStorage() { this.dialogId = $A.getStorageInt("messenger::dialogId") if (this.dialogId > 0) { - const dialog = this.dialogs.find(({id}) => id === this.dialogId); + const dialog = this.cacheDialogs.find(({id}) => id === this.dialogId); dialog && this.openDialog(dialog, false); } }, @@ -324,7 +324,7 @@ export default { scrollMode: 'if-needed', }); } else { - let dialog = this.dialogs.find(({id}) => id == this.dialogId) + let dialog = this.cacheDialogs.find(({id}) => id == this.dialogId) if (dialog && this.dialogActive) { this.dialogActive = ''; this.$nextTick(() => { diff --git a/resources/assets/js/pages/manage/project.vue b/resources/assets/js/pages/manage/project.vue index efca05b9..5dacc3f5 100644 --- a/resources/assets/js/pages/manage/project.vue +++ b/resources/assets/js/pages/manage/project.vue @@ -6,7 +6,7 @@