优化前端变量
This commit is contained in:
parent
533e8a3742
commit
b987be54bf
@ -293,8 +293,8 @@ export default {
|
|||||||
'userId',
|
'userId',
|
||||||
'userInfo',
|
'userInfo',
|
||||||
'userIsAdmin',
|
'userIsAdmin',
|
||||||
'dialogs',
|
'cacheDialogs',
|
||||||
'projects',
|
'cacheProjects',
|
||||||
'projectTotal',
|
'projectTotal',
|
||||||
'taskId',
|
'taskId',
|
||||||
'dialogMsgPush',
|
'dialogMsgPush',
|
||||||
@ -304,7 +304,7 @@ export default {
|
|||||||
|
|
||||||
msgAllUnread() {
|
msgAllUnread() {
|
||||||
let num = 0;
|
let num = 0;
|
||||||
this.dialogs.map(({unread}) => {
|
this.cacheDialogs.map(({unread}) => {
|
||||||
if (unread) {
|
if (unread) {
|
||||||
num += unread;
|
num += unread;
|
||||||
}
|
}
|
||||||
@ -344,8 +344,8 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
projectLists() {
|
projectLists() {
|
||||||
const {projectKeyValue, projects} = this;
|
const {projectKeyValue, cacheProjects} = this;
|
||||||
const data = projects.sort((a, b) => {
|
const data = cacheProjects.sort((a, b) => {
|
||||||
return b.id - a.id;
|
return b.id - a.id;
|
||||||
});
|
});
|
||||||
if (projectKeyValue) {
|
if (projectKeyValue) {
|
||||||
@ -412,7 +412,7 @@ export default {
|
|||||||
tag: "dialog",
|
tag: "dialog",
|
||||||
requireInteraction: true
|
requireInteraction: true
|
||||||
});
|
});
|
||||||
let dialog = this.dialogs.find((item) => item.id == dialog_id);
|
let dialog = this.cacheDialogs.find((item) => item.id == dialog_id);
|
||||||
if (dialog) {
|
if (dialog) {
|
||||||
this.notificationClass.replaceTitle(dialog.name);
|
this.notificationClass.replaceTitle(dialog.name);
|
||||||
this.notificationClass.userAgreed();
|
this.notificationClass.userAgreed();
|
||||||
|
@ -28,7 +28,6 @@
|
|||||||
:month="calendarMonth"
|
:month="calendarMonth"
|
||||||
:theme="calendarTheme"
|
:theme="calendarTheme"
|
||||||
:template="calendarTemplate"
|
:template="calendarTemplate"
|
||||||
:calendars="calendarList"
|
|
||||||
:schedules="list"
|
:schedules="list"
|
||||||
:taskView="false"
|
:taskView="false"
|
||||||
:useCreationPopup="false"
|
:useCreationPopup="false"
|
||||||
@ -64,7 +63,6 @@ export default {
|
|||||||
calendarMonth: {},
|
calendarMonth: {},
|
||||||
calendarTheme: {},
|
calendarTheme: {},
|
||||||
calendarTemplate: {},
|
calendarTemplate: {},
|
||||||
calendarList: [],
|
|
||||||
|
|
||||||
loadIng: 0,
|
loadIng: 0,
|
||||||
loadTimeout: null,
|
loadTimeout: null,
|
||||||
@ -77,12 +75,12 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(['userId', 'projects', 'tasks']),
|
...mapState(['userId', 'cacheTasks']),
|
||||||
|
|
||||||
...mapGetters(['transforTasks']),
|
...mapGetters(['transforTasks']),
|
||||||
|
|
||||||
list() {
|
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 !complete_at && owner && end_at;
|
||||||
}));
|
}));
|
||||||
return datas.map(data => {
|
return datas.map(data => {
|
||||||
@ -134,21 +132,6 @@ export default {
|
|||||||
rangeTime(time) {
|
rangeTime(time) {
|
||||||
this.getTask(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: {
|
methods: {
|
||||||
@ -299,7 +282,7 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
onBeforeClickSchedule({type, schedule}) {
|
onBeforeClickSchedule({type, schedule}) {
|
||||||
let data = this.tasks.find(({id}) => id === schedule.id);
|
let data = this.cacheTasks.find(({id}) => id === schedule.id);
|
||||||
if (!data) {
|
if (!data) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -343,7 +326,7 @@ export default {
|
|||||||
|
|
||||||
onBeforeUpdateSchedule(res) {
|
onBeforeUpdateSchedule(res) {
|
||||||
const {changes, schedule} = 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) {
|
if (!data) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -125,13 +125,13 @@ export default {
|
|||||||
computed: {
|
computed: {
|
||||||
...mapState([
|
...mapState([
|
||||||
'userId',
|
'userId',
|
||||||
'dialogs',
|
'cacheDialogs',
|
||||||
'dialogMsgs',
|
'dialogMsgs',
|
||||||
'dialogMsgPush',
|
'dialogMsgPush',
|
||||||
]),
|
]),
|
||||||
|
|
||||||
dialogData() {
|
dialogData() {
|
||||||
return this.dialogs.find(({id}) => id == this.dialogId) || {};
|
return this.cacheDialogs.find(({id}) => id == this.dialogId) || {};
|
||||||
},
|
},
|
||||||
|
|
||||||
dialogMsgList() {
|
dialogMsgList() {
|
||||||
|
@ -542,14 +542,14 @@ export default {
|
|||||||
'windowMax768',
|
'windowMax768',
|
||||||
|
|
||||||
'userId',
|
'userId',
|
||||||
'dialogs',
|
'cacheDialogs',
|
||||||
|
|
||||||
'taskPriority',
|
'taskPriority',
|
||||||
|
|
||||||
'projectId',
|
'projectId',
|
||||||
'projectLoad',
|
'projectLoad',
|
||||||
'tasks',
|
'cacheTasks',
|
||||||
'columns',
|
'cacheColumns',
|
||||||
]),
|
]),
|
||||||
|
|
||||||
...mapGetters(['projectData', 'projectParameter', 'transforTasks']),
|
...mapGetters(['projectData', 'projectParameter', 'transforTasks']),
|
||||||
@ -569,8 +569,8 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
msgUnread() {
|
msgUnread() {
|
||||||
const {dialogs, projectData} = this;
|
const {cacheDialogs, projectData} = this;
|
||||||
const dialog = dialogs.find(({id}) => id === projectData.dialog_id);
|
const dialog = cacheDialogs.find(({id}) => id === projectData.dialog_id);
|
||||||
return dialog ? dialog.unread : 0;
|
return dialog ? dialog.unread : 0;
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -604,8 +604,8 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
columnList() {
|
columnList() {
|
||||||
const {projectId, columns, tasks} = this;
|
const {projectId, cacheColumns, cacheTasks} = this;
|
||||||
const list = columns.filter(({project_id}) => {
|
const list = cacheColumns.filter(({project_id}) => {
|
||||||
return project_id == projectId
|
return project_id == projectId
|
||||||
}).sort((a, b) => {
|
}).sort((a, b) => {
|
||||||
if (a.sort != b.sort) {
|
if (a.sort != b.sort) {
|
||||||
@ -614,7 +614,7 @@ export default {
|
|||||||
return a.id - b.id;
|
return a.id - b.id;
|
||||||
});
|
});
|
||||||
list.forEach((column) => {
|
list.forEach((column) => {
|
||||||
column.tasks = this.transforTasks(tasks.filter((task) => {
|
column.tasks = this.transforTasks(cacheTasks.filter((task) => {
|
||||||
return task.column_id == column.id;
|
return task.column_id == column.id;
|
||||||
})).sort((a, b) => {
|
})).sort((a, b) => {
|
||||||
if (a.sort != b.sort) {
|
if (a.sort != b.sort) {
|
||||||
@ -627,8 +627,8 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
myList() {
|
myList() {
|
||||||
const {projectId, tasks, searchText, tempShowTasks, sortField, sortType} = this;
|
const {projectId, cacheTasks, searchText, tempShowTasks, sortField, sortType} = this;
|
||||||
const array = tasks.filter((task) => {
|
const array = cacheTasks.filter((task) => {
|
||||||
if (task.project_id != projectId) {
|
if (task.project_id != projectId) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -660,8 +660,8 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
helpList() {
|
helpList() {
|
||||||
const {projectId, tasks, searchText, tempShowTasks, userId, sortField, sortType} = this;
|
const {projectId, cacheTasks, searchText, tempShowTasks, userId, sortField, sortType} = this;
|
||||||
const array = tasks.filter((task) => {
|
const array = cacheTasks.filter((task) => {
|
||||||
if (task.project_id != projectId || task.parent_id > 0) {
|
if (task.project_id != projectId || task.parent_id > 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -693,8 +693,8 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
unList() {
|
unList() {
|
||||||
const {projectId, tasks, searchText, sortField, sortType} = this;
|
const {projectId, cacheTasks, searchText, sortField, sortType} = this;
|
||||||
const array = tasks.filter((task) => {
|
const array = cacheTasks.filter((task) => {
|
||||||
if (task.project_id != projectId || task.parent_id > 0) {
|
if (task.project_id != projectId || task.parent_id > 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -721,8 +721,8 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
completedList() {
|
completedList() {
|
||||||
const {projectId, tasks, searchText} = this;
|
const {projectId, cacheTasks, searchText} = this;
|
||||||
const array = tasks.filter((task) => {
|
const array = cacheTasks.filter((task) => {
|
||||||
if (task.project_id != projectId || task.parent_id > 0) {
|
if (task.project_id != projectId || task.parent_id > 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -741,8 +741,8 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
completedCount() {
|
completedCount() {
|
||||||
const {projectId, tasks} = this;
|
const {projectId, cacheTasks} = this;
|
||||||
return tasks.filter((task) => {
|
return cacheTasks.filter((task) => {
|
||||||
if (task.project_id != projectId || task.parent_id > 0) {
|
if (task.project_id != projectId || task.parent_id > 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -809,7 +809,7 @@ export default {
|
|||||||
sort = -1;
|
sort = -1;
|
||||||
upTask.push(...item.task.map(id => {
|
upTask.push(...item.task.map(id => {
|
||||||
sort++;
|
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 {
|
return {
|
||||||
id,
|
id,
|
||||||
sort,
|
sort,
|
||||||
|
@ -224,7 +224,7 @@ export default {
|
|||||||
|
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(['userId', 'projects', 'projectId', 'columns', 'taskPriority']),
|
...mapState(['userId', 'cacheProjects', 'projectId', 'cacheColumns', 'taskPriority']),
|
||||||
|
|
||||||
taskDays() {
|
taskDays() {
|
||||||
const {times} = this.addData;
|
const {times} = this.addData;
|
||||||
@ -324,8 +324,8 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
initCascaderData() {
|
initCascaderData() {
|
||||||
this.cascaderData = this.projects.map(project => {
|
this.cascaderData = this.cacheProjects.map(project => {
|
||||||
const children = this.columns.filter(({project_id}) => project_id == project.id).map(column => {
|
const children = this.cacheColumns.filter(({project_id}) => project_id == project.id).map(column => {
|
||||||
return {
|
return {
|
||||||
value: column.id,
|
value: column.id,
|
||||||
label: column.name
|
label: column.name
|
||||||
@ -346,7 +346,7 @@ export default {
|
|||||||
initProjectData() {
|
initProjectData() {
|
||||||
let column_id = this.addData.column_id;
|
let column_id = this.addData.column_id;
|
||||||
if (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) {
|
if (column) {
|
||||||
this.addData.project_id = column.project_id;
|
this.addData.project_id = column.project_id;
|
||||||
this.addData.column_id = column.id;
|
this.addData.column_id = column.id;
|
||||||
@ -354,19 +354,19 @@ export default {
|
|||||||
} else {
|
} else {
|
||||||
let cacheAddTaskProjectId = $A.getStorageInt("cacheAddTaskProjectId");
|
let cacheAddTaskProjectId = $A.getStorageInt("cacheAddTaskProjectId");
|
||||||
let cacheAddTaskColumnId = $A.getStorageInt("cacheAddTaskColumnId");
|
let cacheAddTaskColumnId = $A.getStorageInt("cacheAddTaskColumnId");
|
||||||
let project = this.projects.find(({id}) => id == this.projectId)
|
let project = this.cacheProjects.find(({id}) => id == this.projectId)
|
||||||
|| this.projects.find(({id}) => id == cacheAddTaskProjectId)
|
|| this.cacheProjects.find(({id}) => id == cacheAddTaskProjectId)
|
||||||
|| this.projects.find(({id}) => id > 0);
|
|| this.cacheProjects.find(({id}) => id > 0);
|
||||||
if (project) {
|
if (project) {
|
||||||
let column = this.columns.find(({project_id, id}) => project_id == project.id && id == cacheAddTaskColumnId)
|
let column = this.cacheColumns.find(({project_id, id}) => project_id == project.id && id == cacheAddTaskColumnId)
|
||||||
|| this.columns.find(({project_id}) => project_id == project.id);
|
|| this.cacheColumns.find(({project_id}) => project_id == project.id);
|
||||||
if (column) {
|
if (column) {
|
||||||
this.addData.project_id = column.project_id;
|
this.addData.project_id = column.project_id;
|
||||||
this.addData.column_id = column.id;
|
this.addData.column_id = column.id;
|
||||||
} else {
|
} else {
|
||||||
this.$store.dispatch("getColumns", project.id).then(() => {
|
this.$store.dispatch("getColumns", project.id).then(() => {
|
||||||
column = this.columns.find(({project_id, id}) => project_id == project.id && id == cacheAddTaskColumnId)
|
column = this.cacheColumns.find(({project_id, id}) => project_id == project.id && id == cacheAddTaskColumnId)
|
||||||
|| this.columns.find(({project_id}) => project_id == project.id);
|
|| this.cacheColumns.find(({project_id}) => project_id == project.id);
|
||||||
if (column) {
|
if (column) {
|
||||||
this.addData.project_id = column.project_id;
|
this.addData.project_id = column.project_id;
|
||||||
this.addData.column_id = column.id;
|
this.addData.column_id = column.id;
|
||||||
|
@ -519,9 +519,9 @@ export default {
|
|||||||
computed: {
|
computed: {
|
||||||
...mapState([
|
...mapState([
|
||||||
'userId',
|
'userId',
|
||||||
'projects',
|
'cacheProjects',
|
||||||
'columns',
|
'cacheColumns',
|
||||||
'tasks',
|
'cacheTasks',
|
||||||
'taskContents',
|
'taskContents',
|
||||||
'taskFiles',
|
'taskFiles',
|
||||||
'taskPriority',
|
'taskPriority',
|
||||||
@ -534,7 +534,7 @@ export default {
|
|||||||
if (this.taskDetail.project_name) {
|
if (this.taskDetail.project_name) {
|
||||||
return 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 : '';
|
return project ? project.name : '';
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -545,7 +545,7 @@ export default {
|
|||||||
if (this.taskDetail.column_name) {
|
if (this.taskDetail.column_name) {
|
||||||
return 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 : '';
|
return column ? column.name : '';
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -572,7 +572,7 @@ export default {
|
|||||||
if (!this.taskId) {
|
if (!this.taskId) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
return this.tasks.filter(({parent_id}) => {
|
return this.cacheTasks.filter(({parent_id}) => {
|
||||||
return parent_id == this.taskId
|
return parent_id == this.taskId
|
||||||
}).sort((a, b) => {
|
}).sort((a, b) => {
|
||||||
return a.id - b.id;
|
return a.id - b.id;
|
||||||
|
@ -193,11 +193,11 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(['tasks', 'taskPriority', 'columns']),
|
...mapState(['cacheTasks', 'taskPriority', 'cacheColumns']),
|
||||||
|
|
||||||
subTask() {
|
subTask() {
|
||||||
return function(task_id) {
|
return function(task_id) {
|
||||||
return this.tasks.filter(({parent_id}) => {
|
return this.cacheTasks.filter(({parent_id}) => {
|
||||||
return parent_id == task_id
|
return parent_id == task_id
|
||||||
}).sort((a, b) => {
|
}).sort((a, b) => {
|
||||||
return a.id - b.id;
|
return a.id - b.id;
|
||||||
@ -207,7 +207,7 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
columnName(column_id) {
|
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 : '';
|
return column ? column.name : '';
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -243,7 +243,7 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
columnList(id) {
|
columnList(id) {
|
||||||
return this.columns.filter(({project_id}) => project_id == id);
|
return this.cacheColumns.filter(({project_id}) => project_id == id);
|
||||||
},
|
},
|
||||||
|
|
||||||
openTask(task, receive) {
|
openTask(task, receive) {
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
<li>
|
<li>
|
||||||
<div class="block-title">{{$L('参与的项目')}}</div>
|
<div class="block-title">{{$L('参与的项目')}}</div>
|
||||||
<div class="block-data">
|
<div class="block-data">
|
||||||
<div class="block-num">{{projects.length}}</div>
|
<div class="block-num">{{cacheProjects.length}}</div>
|
||||||
<i class="taskfont"></i>
|
<i class="taskfont"></i>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
@ -139,7 +139,7 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(['userInfo', 'projects', 'tasks', 'taskId']),
|
...mapState(['userInfo', 'cacheProjects', 'taskId']),
|
||||||
|
|
||||||
...mapGetters(['dashboardTask', 'transforTasks']),
|
...mapGetters(['dashboardTask', 'transforTasks']),
|
||||||
|
|
||||||
|
@ -118,14 +118,14 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(['userId', 'dialogs', 'dialogOpenId']),
|
...mapState(['userId', 'cacheDialogs', 'dialogOpenId']),
|
||||||
|
|
||||||
dialogList() {
|
dialogList() {
|
||||||
const {dialogActive, dialogKey} = this;
|
const {dialogActive, dialogKey} = this;
|
||||||
if (dialogActive == '' && dialogKey == '') {
|
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) {
|
if (name === undefined) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -160,7 +160,7 @@ export default {
|
|||||||
msgUnread() {
|
msgUnread() {
|
||||||
return function (type) {
|
return function (type) {
|
||||||
let num = 0;
|
let num = 0;
|
||||||
this.dialogs.map((dialog) => {
|
this.cacheDialogs.map((dialog) => {
|
||||||
if (dialog.unread) {
|
if (dialog.unread) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 'project':
|
case 'project':
|
||||||
@ -233,7 +233,7 @@ export default {
|
|||||||
openDialogStorage() {
|
openDialogStorage() {
|
||||||
this.dialogId = $A.getStorageInt("messenger::dialogId")
|
this.dialogId = $A.getStorageInt("messenger::dialogId")
|
||||||
if (this.dialogId > 0) {
|
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);
|
dialog && this.openDialog(dialog, false);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -324,7 +324,7 @@ export default {
|
|||||||
scrollMode: 'if-needed',
|
scrollMode: 'if-needed',
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
let dialog = this.dialogs.find(({id}) => id == this.dialogId)
|
let dialog = this.cacheDialogs.find(({id}) => id == this.dialogId)
|
||||||
if (dialog && this.dialogActive) {
|
if (dialog && this.dialogActive) {
|
||||||
this.dialogActive = '';
|
this.dialogActive = '';
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {mapGetters} from "vuex";
|
import {mapState, mapGetters} from "vuex";
|
||||||
import ProjectList from "./components/ProjectList";
|
import ProjectList from "./components/ProjectList";
|
||||||
import ProjectDialog from "./components/ProjectDialog";
|
import ProjectDialog from "./components/ProjectDialog";
|
||||||
export default {
|
export default {
|
||||||
@ -22,6 +22,7 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
|
...mapState(['cacheProjects']),
|
||||||
...mapGetters(['projectParameter']),
|
...mapGetters(['projectParameter']),
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -40,7 +41,7 @@ export default {
|
|||||||
$A.modalWarning({
|
$A.modalWarning({
|
||||||
content: msg,
|
content: msg,
|
||||||
onOk: () => {
|
onOk: () => {
|
||||||
const project = this.$store.state.projects.find(({id}) => id);
|
const project = this.cacheProjects.find(({id}) => id);
|
||||||
if (project) {
|
if (project) {
|
||||||
$A.goForward({path: '/manage/project/' + project.id});
|
$A.goForward({path: '/manage/project/' + project.id});
|
||||||
} else {
|
} else {
|
||||||
|
130
resources/assets/js/store/actions.js
vendored
130
resources/assets/js/store/actions.js
vendored
@ -380,10 +380,10 @@ export default {
|
|||||||
window.localStorage.clear();
|
window.localStorage.clear();
|
||||||
//
|
//
|
||||||
state.cacheUserBasic = [];
|
state.cacheUserBasic = [];
|
||||||
state.cacheDialogs = state.dialogs = [];
|
state.cacheDialogs = [];
|
||||||
state.cacheProjects = state.projects = [];
|
state.cacheProjects = [];
|
||||||
state.cacheColumns = state.columns = [];
|
state.cacheColumns = [];
|
||||||
state.cacheTasks = state.tasks = [];
|
state.cacheTasks = [];
|
||||||
//
|
//
|
||||||
$A.setStorage("cacheProjectParameter", state.cacheProjectParameter);
|
$A.setStorage("cacheProjectParameter", state.cacheProjectParameter);
|
||||||
$A.setStorage("cacheServerUrl", state.cacheServerUrl);
|
$A.setStorage("cacheServerUrl", state.cacheServerUrl);
|
||||||
@ -517,17 +517,17 @@ export default {
|
|||||||
dispatch("saveColumn", data.project_column)
|
dispatch("saveColumn", data.project_column)
|
||||||
delete data.project_column;
|
delete data.project_column;
|
||||||
}
|
}
|
||||||
let index = state.projects.findIndex(({id}) => id == data.id);
|
let index = state.cacheProjects.findIndex(({id}) => id == data.id);
|
||||||
if (index > -1) {
|
if (index > -1) {
|
||||||
state.projects.splice(index, 1, Object.assign({}, state.projects[index], data));
|
state.cacheProjects.splice(index, 1, Object.assign({}, state.cacheProjects[index], data));
|
||||||
} else {
|
} else {
|
||||||
if (typeof data.project_user === "undefined") {
|
if (typeof data.project_user === "undefined") {
|
||||||
data.project_user = []
|
data.project_user = []
|
||||||
}
|
}
|
||||||
state.projects.push(data);
|
state.cacheProjects.push(data);
|
||||||
}
|
}
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
$A.setStorage("cacheProjects", state.cacheProjects = state.projects);
|
$A.setStorage("cacheProjects", state.cacheProjects);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -542,13 +542,13 @@ export default {
|
|||||||
//
|
//
|
||||||
let ids = $A.isArray(project_id) ? project_id : [project_id];
|
let ids = $A.isArray(project_id) ? project_id : [project_id];
|
||||||
ids.some(id => {
|
ids.some(id => {
|
||||||
let index = state.projects.findIndex(project => project.id == id);
|
let index = state.cacheProjects.findIndex(project => project.id == id);
|
||||||
if (index > -1) {
|
if (index > -1) {
|
||||||
state.projects.splice(index, 1);
|
state.cacheProjects.splice(index, 1);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
if (ids.includes(state.projectId)) {
|
if (ids.includes(state.projectId)) {
|
||||||
const project = state.projects.find(({id}) => id && id != project_id);
|
const project = state.cacheProjects.find(({id}) => id && id != project_id);
|
||||||
if (project) {
|
if (project) {
|
||||||
$A.goForward({path: '/manage/project/' + project.id});
|
$A.goForward({path: '/manage/project/' + project.id});
|
||||||
} else {
|
} else {
|
||||||
@ -556,7 +556,7 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
$A.setStorage("cacheProjects", state.cacheProjects = state.projects);
|
$A.setStorage("cacheProjects", state.cacheProjects);
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -570,13 +570,10 @@ export default {
|
|||||||
getProjects({state, dispatch}, data) {
|
getProjects({state, dispatch}, data) {
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
if (state.userId === 0) {
|
if (state.userId === 0) {
|
||||||
state.projects = [];
|
state.cacheProjects = [];
|
||||||
reject({msg: 'Parameter error'});
|
reject({msg: 'Parameter error'});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (state.projects.length === 0 && state.cacheProjects.length > 0) {
|
|
||||||
state.projects = state.cacheProjects;
|
|
||||||
}
|
|
||||||
dispatch("call", {
|
dispatch("call", {
|
||||||
url: 'project/lists',
|
url: 'project/lists',
|
||||||
data: data || {}
|
data: data || {}
|
||||||
@ -724,14 +721,14 @@ export default {
|
|||||||
dispatch("saveColumn", column)
|
dispatch("saveColumn", column)
|
||||||
});
|
});
|
||||||
} else if ($A.isJson(data)) {
|
} else if ($A.isJson(data)) {
|
||||||
let index = state.columns.findIndex(({id}) => id == data.id);
|
let index = state.cacheColumns.findIndex(({id}) => id == data.id);
|
||||||
if (index > -1) {
|
if (index > -1) {
|
||||||
state.columns.splice(index, 1, Object.assign({}, state.columns[index], data));
|
state.cacheColumns.splice(index, 1, Object.assign({}, state.cacheColumns[index], data));
|
||||||
} else {
|
} else {
|
||||||
state.columns.push(data);
|
state.cacheColumns.push(data);
|
||||||
}
|
}
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
$A.setStorage("cacheColumns", state.cacheColumns = state.columns);
|
$A.setStorage("cacheColumns", state.cacheColumns);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -748,17 +745,17 @@ export default {
|
|||||||
let ids = $A.isArray(column_id) ? column_id : [column_id];
|
let ids = $A.isArray(column_id) ? column_id : [column_id];
|
||||||
let project_ids = [];
|
let project_ids = [];
|
||||||
ids.some(id => {
|
ids.some(id => {
|
||||||
let index = state.columns.findIndex(column => column.id == id);
|
let index = state.cacheColumns.findIndex(column => column.id == id);
|
||||||
if (index > -1) {
|
if (index > -1) {
|
||||||
project_ids.push(state.columns[index].project_id)
|
project_ids.push(state.cacheColumns[index].project_id)
|
||||||
dispatch('getProjectOne', state.columns[index].project_id)
|
dispatch('getProjectOne', state.cacheColumns[index].project_id)
|
||||||
state.columns.splice(index, 1);
|
state.cacheColumns.splice(index, 1);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
Array.from(new Set(project_ids)).some(id => dispatch("getProjectOne", id))
|
Array.from(new Set(project_ids)).some(id => dispatch("getProjectOne", id))
|
||||||
//
|
//
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
$A.setStorage("cacheColumns", state.cacheColumns = state.columns);
|
$A.setStorage("cacheColumns", state.cacheColumns);
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -772,13 +769,10 @@ export default {
|
|||||||
getColumns({state, dispatch}, project_id) {
|
getColumns({state, dispatch}, project_id) {
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
if (state.userId === 0) {
|
if (state.userId === 0) {
|
||||||
state.columns = [];
|
state.cacheColumns = [];
|
||||||
reject({msg: 'Parameter error'})
|
reject({msg: 'Parameter error'})
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (state.columns.length === 0 && state.cacheColumns.length > 0) {
|
|
||||||
state.columns = state.cacheColumns;
|
|
||||||
}
|
|
||||||
state.projectLoad++;
|
state.projectLoad++;
|
||||||
dispatch("call", {
|
dispatch("call", {
|
||||||
url: 'project/column/lists',
|
url: 'project/column/lists',
|
||||||
@ -789,12 +783,12 @@ export default {
|
|||||||
state.projectLoad--;
|
state.projectLoad--;
|
||||||
//
|
//
|
||||||
const ids = data.data.map(({id}) => id)
|
const ids = data.data.map(({id}) => id)
|
||||||
state.columns = state.columns.filter((item) => item.project_id != project_id || ids.includes(item.id));
|
state.cacheColumns = state.cacheColumns.filter((item) => item.project_id != project_id || ids.includes(item.id));
|
||||||
//
|
//
|
||||||
dispatch("saveColumn", data.data);
|
dispatch("saveColumn", data.data);
|
||||||
resolve(data.data)
|
resolve(data.data)
|
||||||
// 判断只有1列的时候默认版面为表格模式
|
// 判断只有1列的时候默认版面为表格模式
|
||||||
if (state.columns.filter(item => item.project_id == project_id).length === 1) {
|
if (state.cacheColumns.filter(item => item.project_id == project_id).length === 1) {
|
||||||
const cache = state.cacheProjectParameter.find(item => item.project_id == project_id) || {};
|
const cache = state.cacheProjectParameter.find(item => item.project_id == project_id) || {};
|
||||||
if (typeof cache.cardInit === "undefined" || cache.cardInit === false) {
|
if (typeof cache.cardInit === "undefined" || cache.cardInit === false) {
|
||||||
dispatch("toggleProjectParameter", {
|
dispatch("toggleProjectParameter", {
|
||||||
@ -860,14 +854,14 @@ export default {
|
|||||||
});
|
});
|
||||||
} else if ($A.isJson(data)) {
|
} else if ($A.isJson(data)) {
|
||||||
data._time = $A.Time();
|
data._time = $A.Time();
|
||||||
let index = state.tasks.findIndex(({id}) => id == data.id);
|
let index = state.cacheTasks.findIndex(({id}) => id == data.id);
|
||||||
if (index > -1) {
|
if (index > -1) {
|
||||||
state.tasks.splice(index, 1, Object.assign({}, state.tasks[index], data));
|
state.cacheTasks.splice(index, 1, Object.assign({}, state.cacheTasks[index], data));
|
||||||
} else {
|
} else {
|
||||||
state.tasks.push(data);
|
state.cacheTasks.push(data);
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
if (data.parent_id > 0 && state.tasks.findIndex(({id}) => id == data.parent_id) === -1) {
|
if (data.parent_id > 0 && state.cacheTasks.findIndex(({id}) => id == data.parent_id) === -1) {
|
||||||
dispatch("getTaskOne", data.parent_id);
|
dispatch("getTaskOne", data.parent_id);
|
||||||
}
|
}
|
||||||
if (data.is_update_project) {
|
if (data.is_update_project) {
|
||||||
@ -884,7 +878,7 @@ export default {
|
|||||||
}
|
}
|
||||||
//
|
//
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
$A.setStorage("cacheTasks", state.cacheTasks = state.tasks);
|
$A.setStorage("cacheTasks", state.cacheTasks);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -902,13 +896,13 @@ export default {
|
|||||||
let parent_ids = [];
|
let parent_ids = [];
|
||||||
let project_ids = [];
|
let project_ids = [];
|
||||||
ids.some(id => {
|
ids.some(id => {
|
||||||
let index = state.tasks.findIndex(task => task.id == id);
|
let index = state.cacheTasks.findIndex(task => task.id == id);
|
||||||
if (index > -1) {
|
if (index > -1) {
|
||||||
if (state.tasks[index].parent_id) {
|
if (state.cacheTasks[index].parent_id) {
|
||||||
parent_ids.push(state.tasks[index].parent_id)
|
parent_ids.push(state.cacheTasks[index].parent_id)
|
||||||
}
|
}
|
||||||
project_ids.push(state.tasks[index].project_id)
|
project_ids.push(state.cacheTasks[index].project_id)
|
||||||
state.tasks.splice(index, 1);
|
state.cacheTasks.splice(index, 1);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
Array.from(new Set(parent_ids)).some(id => dispatch("getTaskOne", id))
|
Array.from(new Set(parent_ids)).some(id => dispatch("getTaskOne", id))
|
||||||
@ -918,7 +912,7 @@ export default {
|
|||||||
state.taskId = 0;
|
state.taskId = 0;
|
||||||
}
|
}
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
$A.setStorage("cacheTasks", state.cacheTasks = state.tasks);
|
$A.setStorage("cacheTasks", state.cacheTasks);
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -930,7 +924,7 @@ export default {
|
|||||||
increaseTaskMsgNum({state}, dialog_id) {
|
increaseTaskMsgNum({state}, dialog_id) {
|
||||||
$A.execMainDispatch("increaseTaskMsgNum", dialog_id)
|
$A.execMainDispatch("increaseTaskMsgNum", dialog_id)
|
||||||
//
|
//
|
||||||
const task = state.tasks.find(task => task.dialog_id === dialog_id);
|
const task = state.cacheTasks.find(task => task.dialog_id === dialog_id);
|
||||||
if (task) task.msg_num++;
|
if (task) task.msg_num++;
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -944,12 +938,12 @@ export default {
|
|||||||
getTasks({state, dispatch}, data) {
|
getTasks({state, dispatch}, data) {
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
if (state.userId === 0) {
|
if (state.userId === 0) {
|
||||||
state.tasks = [];
|
state.cacheTasks = [];
|
||||||
reject({msg: 'Parameter error'});
|
reject({msg: 'Parameter error'});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (state.tasks.length == 0 && state.cacheTasks.length > 0) {
|
if (state.cacheTasks.length == 0 && state.cacheTasks.length > 0) {
|
||||||
state.tasks = state.cacheTasks;
|
state.cacheTasks = state.cacheTasks;
|
||||||
}
|
}
|
||||||
if (data.project_id) {
|
if (data.project_id) {
|
||||||
state.projectLoad++;
|
state.projectLoad++;
|
||||||
@ -1083,10 +1077,10 @@ export default {
|
|||||||
getTaskForProject({state, dispatch}, project_id) {
|
getTaskForProject({state, dispatch}, project_id) {
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
const time = $A.Time()
|
const time = $A.Time()
|
||||||
const currentIds = state.tasks.filter(task => task.project_id == project_id).map(({id}) => id)
|
const currentIds = state.cacheTasks.filter(task => task.project_id == project_id).map(({id}) => id)
|
||||||
//
|
//
|
||||||
const call = () => {
|
const call = () => {
|
||||||
const newIds = state.tasks.filter(task => task.project_id == project_id && task._time >= time).map(({id}) => id)
|
const newIds = state.cacheTasks.filter(task => task.project_id == project_id && task._time >= time).map(({id}) => id)
|
||||||
dispatch("forgetTask", currentIds.filter(v => newIds.indexOf(v) == -1))
|
dispatch("forgetTask", currentIds.filter(v => newIds.indexOf(v) == -1))
|
||||||
}
|
}
|
||||||
dispatch("getTasks", {project_id}).then(() => {
|
dispatch("getTasks", {project_id}).then(() => {
|
||||||
@ -1109,10 +1103,10 @@ export default {
|
|||||||
getTaskForParent({state, dispatch}, parent_id) {
|
getTaskForParent({state, dispatch}, parent_id) {
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
const time = $A.Time()
|
const time = $A.Time()
|
||||||
const currentIds = state.tasks.filter(task => task.parent_id == parent_id).map(({id}) => id)
|
const currentIds = state.cacheTasks.filter(task => task.parent_id == parent_id).map(({id}) => id)
|
||||||
//
|
//
|
||||||
let call = () => {
|
let call = () => {
|
||||||
const newIds = state.tasks.filter(task => task.parent_id == parent_id && task._time >= time).map(({id}) => id)
|
const newIds = state.cacheTasks.filter(task => task.parent_id == parent_id && task._time >= time).map(({id}) => id)
|
||||||
dispatch("forgetTask", currentIds.filter(v => newIds.indexOf(v) == -1))
|
dispatch("forgetTask", currentIds.filter(v => newIds.indexOf(v) == -1))
|
||||||
}
|
}
|
||||||
dispatch("getTasks", {parent_id}).then(() => {
|
dispatch("getTasks", {parent_id}).then(() => {
|
||||||
@ -1428,14 +1422,14 @@ export default {
|
|||||||
dispatch("saveDialog", dialog)
|
dispatch("saveDialog", dialog)
|
||||||
});
|
});
|
||||||
} else if ($A.isJson(data)) {
|
} else if ($A.isJson(data)) {
|
||||||
let index = state.dialogs.findIndex(({id}) => id == data.id);
|
let index = state.cacheDialogs.findIndex(({id}) => id == data.id);
|
||||||
if (index > -1) {
|
if (index > -1) {
|
||||||
state.dialogs.splice(index, 1, Object.assign({}, state.dialogs[index], data));
|
state.cacheDialogs.splice(index, 1, Object.assign({}, state.cacheDialogs[index], data));
|
||||||
} else {
|
} else {
|
||||||
state.dialogs.push(data);
|
state.cacheDialogs.push(data);
|
||||||
}
|
}
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
$A.setStorage("cacheDialogs", state.cacheDialogs = state.dialogs);
|
$A.setStorage("cacheDialogs", state.cacheDialogs);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -1449,7 +1443,7 @@ export default {
|
|||||||
updateDialogLastMsg({state, dispatch}, data) {
|
updateDialogLastMsg({state, dispatch}, data) {
|
||||||
$A.execMainDispatch("updateDialogLastMsg", data)
|
$A.execMainDispatch("updateDialogLastMsg", data)
|
||||||
//
|
//
|
||||||
let dialog = state.dialogs.find(({id}) => id == data.dialog_id);
|
let dialog = state.cacheDialogs.find(({id}) => id == data.dialog_id);
|
||||||
if (dialog) {
|
if (dialog) {
|
||||||
dispatch("saveDialog", {
|
dispatch("saveDialog", {
|
||||||
id: data.dialog_id,
|
id: data.dialog_id,
|
||||||
@ -1468,7 +1462,7 @@ export default {
|
|||||||
*/
|
*/
|
||||||
getDialogs({state, dispatch}) {
|
getDialogs({state, dispatch}) {
|
||||||
if (state.userId === 0) {
|
if (state.userId === 0) {
|
||||||
state.dialogs = [];
|
state.cacheDialogs = [];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
dispatch("call", {
|
dispatch("call", {
|
||||||
@ -1545,11 +1539,11 @@ export default {
|
|||||||
moveDialogTop({state}, dialog_id) {
|
moveDialogTop({state}, dialog_id) {
|
||||||
$A.execMainDispatch("moveDialogTop", dialog_id)
|
$A.execMainDispatch("moveDialogTop", dialog_id)
|
||||||
//
|
//
|
||||||
const index = state.dialogs.findIndex(({id}) => id == dialog_id);
|
const index = state.cacheDialogs.findIndex(({id}) => id == dialog_id);
|
||||||
if (index > -1) {
|
if (index > -1) {
|
||||||
const tmp = $A.cloneJSON(state.dialogs[index]);
|
const tmp = $A.cloneJSON(state.cacheDialogs[index]);
|
||||||
state.dialogs.splice(index, 1);
|
state.cacheDialogs.splice(index, 1);
|
||||||
state.dialogs.unshift(tmp);
|
state.cacheDialogs.unshift(tmp);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -1563,9 +1557,9 @@ export default {
|
|||||||
//
|
//
|
||||||
let ids = $A.isArray(dialog_id) ? dialog_id : [dialog_id];
|
let ids = $A.isArray(dialog_id) ? dialog_id : [dialog_id];
|
||||||
ids.some(id => {
|
ids.some(id => {
|
||||||
let index = state.dialogs.findIndex(dialog => dialog.id == id);
|
let index = state.cacheDialogs.findIndex(dialog => dialog.id == id);
|
||||||
if (index > -1) {
|
if (index > -1) {
|
||||||
state.dialogs.splice(index, 1);
|
state.cacheDialogs.splice(index, 1);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
if (ids.includes($A.getStorageInt("messenger::dialogId"))) {
|
if (ids.includes($A.getStorageInt("messenger::dialogId"))) {
|
||||||
@ -1573,7 +1567,7 @@ export default {
|
|||||||
}
|
}
|
||||||
//
|
//
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
$A.setStorage("cacheDialogs", state.cacheDialogs = state.dialogs);
|
$A.setStorage("cacheDialogs", state.cacheDialogs);
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -1611,12 +1605,12 @@ export default {
|
|||||||
* @param dialog_id
|
* @param dialog_id
|
||||||
*/
|
*/
|
||||||
getDialogMsgs({state, dispatch}, dialog_id) {
|
getDialogMsgs({state, dispatch}, dialog_id) {
|
||||||
let dialog = state.dialogs.find(({id}) => id == dialog_id);
|
let dialog = state.cacheDialogs.find(({id}) => id == dialog_id);
|
||||||
if (!dialog) {
|
if (!dialog) {
|
||||||
dialog = {
|
dialog = {
|
||||||
id: dialog_id,
|
id: dialog_id,
|
||||||
};
|
};
|
||||||
state.dialogs.push(dialog);
|
state.cacheDialogs.push(dialog);
|
||||||
}
|
}
|
||||||
if (dialog.loading) {
|
if (dialog.loading) {
|
||||||
return;
|
return;
|
||||||
@ -1656,7 +1650,7 @@ export default {
|
|||||||
*/
|
*/
|
||||||
getDialogMoreMsgs({state, dispatch}, dialog_id) {
|
getDialogMoreMsgs({state, dispatch}, dialog_id) {
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
const dialog = state.dialogs.find(({id}) => id == dialog_id);
|
const dialog = state.cacheDialogs.find(({id}) => id == dialog_id);
|
||||||
if (!dialog) {
|
if (!dialog) {
|
||||||
reject({msg: 'Parameter error'});
|
reject({msg: 'Parameter error'});
|
||||||
return;
|
return;
|
||||||
@ -1703,7 +1697,7 @@ export default {
|
|||||||
if (data.is_read === true) return;
|
if (data.is_read === true) return;
|
||||||
data.is_read = true;
|
data.is_read = true;
|
||||||
//
|
//
|
||||||
let dialog = state.dialogs.find(({id}) => id == data.dialog_id);
|
let dialog = state.cacheDialogs.find(({id}) => id == data.dialog_id);
|
||||||
if (dialog && dialog.unread > 0) {
|
if (dialog && dialog.unread > 0) {
|
||||||
dialog.unread--
|
dialog.unread--
|
||||||
}
|
}
|
||||||
@ -1808,7 +1802,7 @@ export default {
|
|||||||
if (mode === "chat") {
|
if (mode === "chat") {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let dialog = state.dialogs.find(({id}) => id == data.dialog_id);
|
let dialog = state.cacheDialogs.find(({id}) => id == data.dialog_id);
|
||||||
// 更新对话列表
|
// 更新对话列表
|
||||||
if (dialog) {
|
if (dialog) {
|
||||||
// 新增未读数
|
// 新增未读数
|
||||||
|
8
resources/assets/js/store/getters.js
vendored
8
resources/assets/js/store/getters.js
vendored
@ -11,7 +11,7 @@ export default {
|
|||||||
}
|
}
|
||||||
if (projectId > 0) {
|
if (projectId > 0) {
|
||||||
window.__projectId = projectId;
|
window.__projectId = projectId;
|
||||||
const project = state.projects.find(({id}) => id == projectId);
|
const project = state.cacheProjects.find(({id}) => id == projectId);
|
||||||
if (project) {
|
if (project) {
|
||||||
return project;
|
return project;
|
||||||
}
|
}
|
||||||
@ -50,7 +50,7 @@ export default {
|
|||||||
}
|
}
|
||||||
if (taskId > 0) {
|
if (taskId > 0) {
|
||||||
window.__taskId = taskId;
|
window.__taskId = taskId;
|
||||||
const task = state.tasks.find(({id}) => id == taskId);
|
const task = state.cacheTasks.find(({id}) => id == taskId);
|
||||||
if (task) {
|
if (task) {
|
||||||
return task;
|
return task;
|
||||||
}
|
}
|
||||||
@ -74,7 +74,7 @@ export default {
|
|||||||
}).map(task => {
|
}).map(task => {
|
||||||
if (task.parent_id > 0) {
|
if (task.parent_id > 0) {
|
||||||
// 子任务
|
// 子任务
|
||||||
const data = state.tasks.find(({id}) => id == task.parent_id);
|
const data = state.cacheTasks.find(({id}) => id == task.parent_id);
|
||||||
if (data) {
|
if (data) {
|
||||||
return Object.assign({}, data, {
|
return Object.assign({}, data, {
|
||||||
id: task.id,
|
id: task.id,
|
||||||
@ -110,7 +110,7 @@ export default {
|
|||||||
* @returns {unknown[]}
|
* @returns {unknown[]}
|
||||||
*/
|
*/
|
||||||
ownerTasks(state) {
|
ownerTasks(state) {
|
||||||
return state.tasks.filter(({complete_at, owner}) => {
|
return state.cacheTasks.filter(({complete_at, owner}) => {
|
||||||
if (complete_at) {
|
if (complete_at) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
4
resources/assets/js/store/state.js
vendored
4
resources/assets/js/store/state.js
vendored
@ -51,7 +51,6 @@ state.userIsAdmin = $A.inArray("admin", state.userInfo.identity);
|
|||||||
state.userOnline = {};
|
state.userOnline = {};
|
||||||
|
|
||||||
// 会话聊天
|
// 会话聊天
|
||||||
state.dialogs = [];
|
|
||||||
state.dialogMsgs = [];
|
state.dialogMsgs = [];
|
||||||
state.dialogMsgPush = {};
|
state.dialogMsgPush = {};
|
||||||
state.dialogOpenId = 0;
|
state.dialogOpenId = 0;
|
||||||
@ -62,12 +61,9 @@ state.fileContent = {};
|
|||||||
|
|
||||||
// 项目任务
|
// 项目任务
|
||||||
state.projectId = 0;
|
state.projectId = 0;
|
||||||
state.projects = [];
|
|
||||||
state.projectTotal = 0;
|
state.projectTotal = 0;
|
||||||
state.projectLoad = 0;
|
state.projectLoad = 0;
|
||||||
state.columns = [];
|
|
||||||
state.taskId = 0;
|
state.taskId = 0;
|
||||||
state.tasks = [];
|
|
||||||
state.taskContents = [];
|
state.taskContents = [];
|
||||||
state.taskFiles = [];
|
state.taskFiles = [];
|
||||||
state.taskLogs = [];
|
state.taskLogs = [];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user