+
-
+
{{$L('未完成任务')}}
- ({{undoneList.length}})
+ ({{unList.length}})
-
+
-
+
-
+
{{$L('已完成任务')}}
({{completedList.length}})
@@ -312,7 +312,7 @@
-
+
@@ -504,7 +504,7 @@ export default {
}, 1000);
//
this.projectDialogSubscribe = Store.subscribe('onProjectDialogBack', () => {
- this.$store.dispatch('toggleTablePanel', 'chat');
+ this.$store.dispatch('toggleProjectParameters', 'chat');
});
},
@@ -530,9 +530,7 @@ export default {
'columns',
]),
- ...mapGetters(['projectData', 'tablePanel']),
-
- ...mapGetters(['myTask']),
+ ...mapGetters(['projectData', 'projectParameters', 'myTasks', 'transforTasks']),
userWaitRemove() {
const {userids, useridbak} = this.userData;
@@ -557,7 +555,7 @@ export default {
panelTask() {
const {searchText} = this;
return function (list) {
- if (!this.tablePanel('completedTask')) {
+ if (!this.projectParameters('completedTask')) {
list = list.filter(({complete_at}) => {
return !complete_at;
});
@@ -571,13 +569,36 @@ export default {
}
},
+ columnList() {
+ const {projectId, columns, tasks} = this;
+ let list = $A.cloneJSON(columns.filter(({project_id}) => {
+ return project_id == projectId
+ })).sort((a, b) => {
+ if (a.sort != b.sort) {
+ return a.sort - b.sort;
+ }
+ return a.id - b.id;
+ });
+ list.forEach((column) => {
+ column.tasks = this.transforTasks(tasks.filter((task) => {
+ return task.column_id == column.id;
+ })).sort((a, b) => {
+ if (a.sort != b.sort) {
+ return a.sort - b.sort;
+ }
+ return a.id - b.id;
+ });
+ })
+ return Object.freeze(list);
+ },
+
myList() {
- const {projectId, myTask, searchText, completeTask, sortField, sortType} = this;
- const array = myTask.filter((task) => {
+ const {projectId, myTasks, searchText, completeTask, sortField, sortType} = this;
+ const array = myTasks.filter((task) => {
if (task.project_id != projectId) {
return false;
}
- if (!this.tablePanel('completedTask')) {
+ if (!this.projectParameters('completedTask')) {
if (task.complete_at && !completeTask.find(id => id == task.id)) {
return false;
}
@@ -610,7 +631,7 @@ export default {
if (task.project_id != projectId || task.parent_id > 0) {
return false;
}
- if (!this.tablePanel('completedTask')) {
+ if (!this.projectParameters('completedTask')) {
if (task.complete_at && !completeTask.find(id => id == task.id)) {
return false;
}
@@ -637,13 +658,13 @@ export default {
});
},
- undoneList() {
+ unList() {
const {projectId, tasks, searchText, completeTask, sortField, sortType} = this;
const array = tasks.filter((task) => {
if (task.project_id != projectId || task.parent_id > 0) {
return false;
}
- if (!this.tablePanel('completedTask')) {
+ if (!this.projectParameters('completedTask')) {
if (task.complete_at && !completeTask.find(id => id == task.id)) {
return false;
}
@@ -670,16 +691,6 @@ export default {
});
},
- completedCount() {
- const {projectId, tasks} = this;
- return tasks.filter((task) => {
- if (task.project_id != projectId || task.parent_id > 0) {
- return false;
- }
- return task.complete_at;
- }).length;
- },
-
completedList() {
const {projectId, tasks, searchText} = this;
const array = tasks.filter((task) => {
@@ -700,17 +711,14 @@ export default {
});
},
- expiresFormat() {
- const {nowTime} = this;
- return function (date) {
- let time = Math.round($A.Date(date).getTime() / 1000) - nowTime;
- if (time < 86400 * 7 && time > 0 ) {
- return this.formatSeconds(time);
- } else if (time <= 0) {
- return '-' + this.formatSeconds(time * -1);
+ completedCount() {
+ const {projectId, tasks} = this;
+ return tasks.filter((task) => {
+ if (task.project_id != projectId || task.parent_id > 0) {
+ return false;
}
- return this.formatTime(date)
- }
+ return task.complete_at;
+ }).length;
},
},
@@ -726,7 +734,7 @@ export default {
methods: {
getSort() {
const sortData = [];
- this.projectData.columns.forEach((column) => {
+ this.columnList.forEach((column) => {
sortData.push({
id: column.id,
task: column.tasks.map(({id}) => id)
@@ -1168,7 +1176,7 @@ export default {
taskIsHidden(task) {
const {name, desc, complete_at} = task;
const {searchText} = this;
- if (!this.tablePanel('completedTask')) {
+ if (!this.projectParameters('completedTask')) {
if (complete_at) {
return true;
}
@@ -1221,7 +1229,7 @@ export default {
},
toggleCompleted() {
- this.$store.dispatch('toggleTablePanel', 'completedTask');
+ this.$store.dispatch('toggleProjectParameters', 'completedTask');
this.completeTask = [];
},
@@ -1260,6 +1268,16 @@ export default {
else if (seconds > 0) duration = this.formatBit(seconds) + "s";
return duration;
},
+
+ expiresFormat(date) {
+ let time = Math.round($A.Date(date).getTime() / 1000) - this.nowTime;
+ if (time < 86400 * 7 && time > 0 ) {
+ return this.formatSeconds(time);
+ } else if (time <= 0) {
+ return '-' + this.formatSeconds(time * -1);
+ }
+ return this.formatTime(date)
+ }
}
}
diff --git a/resources/assets/js/pages/manage/components/TaskDetail.vue b/resources/assets/js/pages/manage/components/TaskDetail.vue
index 130f5585..713794da 100644
--- a/resources/assets/js/pages/manage/components/TaskDetail.vue
+++ b/resources/assets/js/pages/manage/components/TaskDetail.vue
@@ -595,19 +595,6 @@ export default {
}
},
- expiresFormat() {
- const {nowTime} = this;
- return function (date) {
- let time = Math.round($A.Date(date).getTime() / 1000) - nowTime;
- if (time < 86400 * 7 && time > 0 ) {
- return this.formatSeconds(time);
- } else if (time <= 0) {
- return '-' + this.formatSeconds(time * -1);
- }
- return this.formatTime(date)
- }
- },
-
cutTime() {
const {nowTime, taskDetail} = this;
let string = "";
@@ -800,6 +787,16 @@ export default {
return duration;
},
+ expiresFormat(date) {
+ let time = Math.round($A.Date(date).getTime() / 1000) - this.nowTime;
+ if (time < 86400 * 7 && time > 0 ) {
+ return this.formatSeconds(time);
+ } else if (time <= 0) {
+ return '-' + this.formatSeconds(time * -1);
+ }
+ return this.formatTime(date)
+ },
+
onNameKeydown(e) {
if (e.keyCode === 13) {
if (e.shiftKey) {
diff --git a/resources/assets/js/pages/manage/components/TaskRow.vue b/resources/assets/js/pages/manage/components/TaskRow.vue
index c55925a3..2214f232 100644
--- a/resources/assets/js/pages/manage/components/TaskRow.vue
+++ b/resources/assets/js/pages/manage/components/TaskRow.vue
@@ -2,10 +2,10 @@
-
+
@@ -50,7 +50,11 @@
- {{$L('子任务')}}{{item.name}}
+
+ {{$L('子任务')}}
+ +{{item.sub_my.length}}
+ {{item.name}}
+
@@ -71,11 +75,10 @@
{{columnName(item.column_id)}}
@@ -87,11 +90,10 @@
{{item.p_name}}
@@ -197,25 +199,8 @@ export default {
});
}
},
-
- expiresFormat() {
- const {nowTime} = this;
- return function (date) {
- let time = Math.round($A.Date(date).getTime() / 1000) - nowTime;
- if (time < 86400 * 7 && time > 0 ) {
- return this.formatSeconds(time);
- } else if (time <= 0) {
- return '-' + this.formatSeconds(time * -1);
- }
- return this.formatTime(date)
- }
- },
},
methods: {
- isTopTask(item) {
- return item.parent_id === 0 || item.top_task === true
- },
-
columnName(column_id) {
const column = this.columns.find(({id}) => id == column_id)
return column ? column.name : '';
@@ -230,6 +215,10 @@ export default {
},
getSublist(task) {
+ if (task.sub_top === true) {
+ this.openTask(task);
+ return;
+ }
if (this.taskOpen[task.id] === true) {
this.$set(this.taskOpen, task.id, false);
return;
@@ -304,7 +293,17 @@ export default {
else if (minutes > 0) duration = this.formatBit(minutes) + ":" + this.formatBit(seconds);
else if (seconds > 0) duration = this.formatBit(seconds) + "s";
return duration;
- }
+ },
+
+ expiresFormat(date) {
+ let time = Math.round($A.Date(date).getTime() / 1000) - this.nowTime;
+ if (time < 86400 * 7 && time > 0 ) {
+ return this.formatSeconds(time);
+ } else if (time <= 0) {
+ return '-' + this.formatSeconds(time * -1);
+ }
+ return this.formatTime(date)
+ },
}
}
diff --git a/resources/assets/js/pages/manage/dashboard.vue b/resources/assets/js/pages/manage/dashboard.vue
index e1e3e61f..655a5ea9 100644
--- a/resources/assets/js/pages/manage/dashboard.vue
+++ b/resources/assets/js/pages/manage/dashboard.vue
@@ -79,7 +79,11 @@
- {{$L('子任务')}}{{item.name}}
+
+ {{$L('子任务')}}
+ +{{item.sub_my.length}}
+ {{item.name}}
+
@@ -137,7 +141,7 @@ export default {
computed: {
...mapState(['userInfo', 'projects', 'tasks', 'taskId']),
- ...mapGetters(['dashboardTask']),
+ ...mapGetters(['dashboardTask', 'transforTasks']),
title() {
const {dashboard} = this;
@@ -156,10 +160,10 @@ export default {
let data = [];
switch (dashboard) {
case 'today':
- data = $A.cloneJSON(this.dashboardTask.today);
+ data = this.transforTasks(this.dashboardTask.today);
break
case 'overdue':
- data = $A.cloneJSON(this.dashboardTask.overdue);
+ data = this.transforTasks(this.dashboardTask.overdue);
break
}
if (completeTask.length > 0) {
@@ -173,19 +177,6 @@ export default {
return $A.Date(a.end_at) - $A.Date(b.end_at);
});
},
-
- expiresFormat() {
- const {nowTime} = this;
- return function (date) {
- let time = Math.round($A.Date(date).getTime() / 1000) - nowTime;
- if (time < 86400 * 7 && time > 0 ) {
- return this.formatSeconds(time);
- } else if (time <= 0) {
- return '-' + this.formatSeconds(time * -1);
- }
- return this.formatTime(date)
- }
- },
},
watch: {
@@ -323,6 +314,16 @@ export default {
else if (seconds > 0) duration = this.formatBit(seconds) + "s";
return duration;
},
+
+ expiresFormat(date) {
+ let time = Math.round($A.Date(date).getTime() / 1000) - this.nowTime;
+ if (time < 86400 * 7 && time > 0 ) {
+ return this.formatSeconds(time);
+ } else if (time <= 0) {
+ return '-' + this.formatSeconds(time * -1);
+ }
+ return this.formatTime(date)
+ }
}
}
diff --git a/resources/assets/js/pages/manage/project.vue b/resources/assets/js/pages/manage/project.vue
index 7306fe71..bd80cc19 100644
--- a/resources/assets/js/pages/manage/project.vue
+++ b/resources/assets/js/pages/manage/project.vue
@@ -1,7 +1,7 @@
@@ -22,7 +22,7 @@ export default {
},
computed: {
- ...mapGetters(['tablePanel']),
+ ...mapGetters(['projectParameters']),
},
watch: {
diff --git a/resources/assets/js/store/actions.js b/resources/assets/js/store/actions.js
index 1025d5e2..738aec58 100644
--- a/resources/assets/js/store/actions.js
+++ b/resources/assets/js/store/actions.js
@@ -138,8 +138,8 @@ export default {
* @param state
* @param data|{key, project_id}
*/
- toggleTablePanel({state}, data) {
- $A.execMainDispatch("toggleTablePanel", data)
+ toggleProjectParameters({state}, data) {
+ $A.execMainDispatch("toggleProjectParameters", data)
//
let key = data;
let project_id = state.projectId;
@@ -148,9 +148,9 @@ export default {
project_id = data.project_id;
}
if (project_id) {
- let index = state.cacheTablePanel.findIndex(item => item.project_id == project_id)
+ let index = state.cacheProjectParameters.findIndex(item => item.project_id == project_id)
if (index === -1) {
- state.cacheTablePanel.push({
+ state.cacheProjectParameters.push({
project_id,
card: true,
cardInit: false,
@@ -161,15 +161,15 @@ export default {
showCompleted: false,
completedTask: false,
});
- index = state.cacheTablePanel.findIndex(item => item.project_id == project_id)
+ index = state.cacheProjectParameters.findIndex(item => item.project_id == project_id)
}
- const cache = state.cacheTablePanel[index];
+ const cache = state.cacheProjectParameters[index];
if (!state.method.isJson(key)) {
key = {[key]: !cache[key]};
}
- state.cacheTablePanel.splice(index, 1, Object.assign(cache, key))
+ state.cacheProjectParameters.splice(index, 1, Object.assign(cache, key))
setTimeout(() => {
- state.method.setStorage("cacheTablePanel", state.cacheTablePanel);
+ state.method.setStorage("cacheProjectParameters", state.cacheProjectParameters);
});
}
},
@@ -395,7 +395,7 @@ export default {
state.cacheColumns = state.columns = [];
state.cacheTasks = state.tasks = [];
//
- state.method.setStorage("cacheTablePanel", state.cacheTablePanel);
+ state.method.setStorage("cacheProjectParameters", state.cacheProjectParameters);
state.method.setStorage("cacheServerUrl", state.cacheServerUrl);
state.method.setStorage("cacheLoginEmail", cacheLoginEmail);
dispatch("saveUserInfo", state.method.isJson(userInfo) ? userInfo : state.userInfo);
@@ -787,9 +787,9 @@ export default {
dispatch("saveColumn", data.data);
// 判断只有1列的时候默认版面为表格模式
if (state.columns.filter(item => item.project_id == project_id).length === 1) {
- const cache = state.cacheTablePanel.find(item => item.project_id == project_id) || {};
+ const cache = state.cacheProjectParameters.find(item => item.project_id == project_id) || {};
if (typeof cache.cardInit === "undefined" || cache.cardInit === false) {
- dispatch("toggleTablePanel", {
+ dispatch("toggleProjectParameters", {
project_id,
key: {
card: false,
@@ -942,14 +942,14 @@ export default {
if (data.project_id) {
state.projectLoad--;
}
+ //
const resData = result.data;
- const ids = resData.data.map(({id}) => id)
- if (ids.length > 0) {
- if (data.project_id) {
+ if (data.project_id && resData.current_page == 1) {
+ const ids = resData.data.map(({id}) => id)
+ if (ids.length > 0) {
state.tasks = state.tasks.filter((item) => item.project_id != data.project_id || ids.includes(item.id));
}
}
- dispatch("saveTask", resData.data);
//
if (resData.next_page_url) {
const nextData = Object.assign(data, {
@@ -966,6 +966,8 @@ export default {
dispatch("getTasks", nextData)
}
}
+ //
+ dispatch("saveTask", resData.data);
}).catch(e => {
console.error(e);
if (data.project_id) {
@@ -1559,6 +1561,7 @@ export default {
if (ids.length > 0) {
state.dialogMsgs = state.dialogMsgs.filter((item) => item.dialog_id != dialog_id || ids.includes(item.id));
}
+ //
dispatch("saveDialog", result.data.dialog);
dispatch("saveDialogMsg", result.data.data);
}).catch(e => {
@@ -1568,12 +1571,12 @@ export default {
},
/**
- * 获取下一页会话消息
+ * 获取更多(下一页)会话消息
* @param state
* @param dispatch
* @param dialog_id
*/
- getDialogMsgNextPage({state, dispatch}, dialog_id) {
+ getDialogMoreMsgs({state, dispatch}, dialog_id) {
return new Promise(function (resolve, reject) {
const dialog = state.dialogs.find(({id}) => id == dialog_id);
if (!dialog) {
diff --git a/resources/assets/js/store/getters.js b/resources/assets/js/store/getters.js
index b77595f2..5f33d460 100644
--- a/resources/assets/js/store/getters.js
+++ b/resources/assets/js/store/getters.js
@@ -2,7 +2,7 @@ export default {
/**
* 当前打开的项目
* @param state
- * @returns {unknown[]|{project_user: *[], columns: *[]}}
+ * @returns {{}|{readonly id?: *}}
*/
projectData(state) {
let projectId = state.projectId;
@@ -11,33 +11,41 @@ export default {
}
if (projectId > 0) {
window.__projectId = projectId;
- const project = state.method.cloneJSON(state.projects.find(({id}) => id == projectId));
+ const project = state.projects.find(({id}) => id == projectId);
if (project) {
- project.columns = state.method.cloneJSON(state.columns.filter(({project_id}) => {
- return project_id == project.id
- })).sort((a, b) => {
- if (a.sort != b.sort) {
- return a.sort - b.sort;
- }
- return a.id - b.id;
- });
- project.columns.forEach((column) => {
- column.tasks = state.method.cloneJSON(state.tasks.filter((task) => {
- return task.column_id == column.id && task.parent_id == 0;
- })).sort((a, b) => {
- if (a.sort != b.sort) {
- return a.sort - b.sort;
- }
- return a.id - b.id;
- });
- })
- return Object.freeze(project);
+ return project;
}
}
- return {
- columns: [],
- project_user: []
- };
+ return {};
+ },
+
+ /**
+ * 当前打开的项目面板参数
+ * @param state
+ * @returns {(function(*): (boolean|*))|*}
+ */
+ projectParameters(state) {
+ return function (key) {
+ if (!state.projectId) {
+ return false;
+ }
+ let cache = state.cacheProjectParameters.find(({project_id}) => project_id == state.projectId);
+ if (!cache) {
+ cache = {
+ project_id: state.projectId,
+ card: true,
+ cardInit: false,
+ chat: false,
+ showMy: true,
+ showHelp: true,
+ showUndone: true,
+ showCompleted: false,
+ completedTask: false,
+ }
+ state.cacheProjectParameters.push(cache);
+ }
+ return cache && !!cache[key];
+ }
},
/**
@@ -60,79 +68,65 @@ export default {
return {};
},
- /**
- * 项目面板设置
- * @param state
- * @returns {(function(*): (boolean|*))|*}
- */
- 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,
- cardInit: false,
- chat: false,
- showMy: true,
- showHelp: true,
- showUndone: true,
- showCompleted: false,
- completedTask: false,
- }
- state.cacheTablePanel.push(cache);
- }
- return cache && !!cache[key];
- }
- },
-
/**
* 我所有的任务(未完成)
* @param state
* @returns {unknown[]}
*/
- myTask(state) {
- return state.tasks.filter(({complete_at, parent_id, end_at, owner}) => {
- if (parent_id > 0) {
- const index = state.tasks.findIndex(data => {
- if (data.id != parent_id) {
- return false;
- }
- if (data.complete_at) {
- return false;
- }
- return data.owner;
- });
- if (index > -1) {
- return false;
- }
- }
+ myTasks(state) {
+ return state.tasks.filter(({complete_at, owner}) => {
if (complete_at) {
return false;
}
return owner;
- }).map(task => {
- if (task.parent_id > 0) {
- const tmp = state.tasks.find(({id}) => id == task.parent_id);
- if (tmp) {
- return Object.assign({}, tmp, {
- id: task.id,
- parent_id: task.parent_id,
- name: task.name,
- start_at: task.start_at,
- end_at: task.end_at,
- sub_num: 0,
- top_task: true,
- });
- }
- }
- return task;
})
},
+ /**
+ * 转换任务列表
+ * @returns {function(*): *}
+ */
+ transforTasks(state) {
+ return function (list) {
+ return list.filter(({parent_id}) => {
+ if (parent_id > 0) {
+ if (list.find(({id}) => id == parent_id)) {
+ return false;
+ }
+ }
+ return true;
+ }).map(task => {
+ if (task.parent_id <= 0) {
+ // 主任务
+ return Object.assign({}, task, {
+ sub_top: false,
+ sub_my: list.filter(({parent_id}) => parent_id == task.id),
+ });
+ } else {
+ // 子任务
+ const data = state.tasks.find(({id}) => id == task.parent_id);
+ if (data) {
+ return Object.assign({}, data, {
+ id: task.id,
+ parent_id: task.parent_id,
+ name: task.name,
+ start_at: task.start_at,
+ end_at: task.end_at,
+
+ sub_top: true,
+ sub_my: [],
+ });
+ } else {
+ return Object.assign({}, task, {
+ sub_top: true,
+ sub_my: [],
+ });
+ }
+ }
+ })
+ }
+ },
+
/**
* 仪表盘任务数据
* @param state
@@ -143,7 +137,7 @@ export default {
const todayStart = $A.Date($A.formatDate("Y-m-d 00:00:00")),
todayEnd = $A.Date($A.formatDate("Y-m-d 23:59:59")),
todayNow = $A.Date($A.formatDate("Y-m-d H:i:s"));
- const todayTasks = getters.myTask.filter(task => {
+ const todayTasks = getters.myTasks.filter(task => {
if (!task.end_at) {
return false;
}
@@ -151,7 +145,7 @@ export default {
end = $A.Date(task.end_at);
return (start <= todayStart && todayStart <= end) || (start <= todayEnd && todayEnd <= end) || (start > todayStart && todayEnd > end);
})
- const overdueTasks = getters.myTask.filter(task => {
+ const overdueTasks = getters.myTasks.filter(task => {
if (!task.end_at) {
return false;
}
@@ -161,5 +155,5 @@ export default {
today: todayTasks,
overdue: overdueTasks,
}
- }
+ },
}
diff --git a/resources/assets/js/store/state.js b/resources/assets/js/store/state.js
index c6dc0291..5241f853 100644
--- a/resources/assets/js/store/state.js
+++ b/resources/assets/js/store/state.js
@@ -266,8 +266,7 @@ state.cacheDialogs = state.method.getStorageArray("cacheDialogs");
state.cacheProjects = state.method.getStorageArray("cacheProjects");
state.cacheColumns = state.method.getStorageArray("cacheColumns");
state.cacheTasks = state.method.getStorageArray("cacheTasks");
-// TablePanel
-state.cacheTablePanel = state.method.getStorageArray("cacheTablePanel");
+state.cacheProjectParameters = state.method.getStorageArray("cacheProjectParameters");
// ServerUrl
state.cacheServerUrl = state.method.getStorageString("cacheServerUrl")
if (state.cacheServerUrl && window.systemInformation) {
diff --git a/resources/assets/sass/pages/components/project-list.scss b/resources/assets/sass/pages/components/project-list.scss
index ecaa4741..afb8064a 100644
--- a/resources/assets/sass/pages/components/project-list.scss
+++ b/resources/assets/sass/pages/components/project-list.scss
@@ -671,7 +671,7 @@
display: inline-block;
vertical-align: top;
margin-top: 3px;
- margin-right: 4px;
+ margin-right: 3px;
}
}
.item-icons {
@@ -773,6 +773,9 @@
}
.task-row {
background-color: #fcfcfd;
+ .priority-color {
+ display: none;
+ }
> div {
&.row-name {
padding-left: 56px;
@@ -780,6 +783,12 @@
color: #6C7D8C;
}
}
+ &.row-column,
+ &.row-priority {
+ > div {
+ display: none;
+ }
+ }
}
}
.task-add-row {
diff --git a/resources/assets/sass/pages/page-dashboard.scss b/resources/assets/sass/pages/page-dashboard.scss
index 0215e99c..64d9069a 100644
--- a/resources/assets/sass/pages/page-dashboard.scss
+++ b/resources/assets/sass/pages/page-dashboard.scss
@@ -145,7 +145,7 @@
display: inline-block;
vertical-align: top;
margin-top: 2px;
- margin-right: 4px;
+ margin-right: 2px;
}
}
.item-icon {