支持查看已归档任务

This commit is contained in:
kuaifan 2022-01-23 19:23:18 +08:00
parent e6e58a03a6
commit 834dc9bec9
10 changed files with 165 additions and 105 deletions

View File

@ -334,7 +334,7 @@
}
if (dialog.group_info.deleted_at) {
tags.push({
color: 'error',
color: 'red',
text: '已删除'
})
} else if (dialog.group_info.archived_at) {
@ -346,6 +346,15 @@
}
}
return tags;
},
/**
* 对话完成
* @param dialog
* @returns {*[]}
*/
dialogCompleted(dialog) {
return this.dialogTags(dialog).find(({color}) => color == 'success');
}
});

View File

@ -6,9 +6,11 @@
@dragover.prevent="chatDragOver(true, $event)"
@dragleave.prevent="chatDragOver(false, $event)">
<slot name="head">
<div class="dialog-title">
<div class="dialog-title" :class="{completed:$A.dialogCompleted(dialogData)}">
<div class="main-title">
<Tag v-for="(tag, ti) in $A.dialogTags(dialogData)" :key="`tag_${ti}`" :color="tag.color">{{$L(tag.text)}}</Tag>
<template v-for="tag in $A.dialogTags(dialogData)" v-if="tag.color != 'success'">
<Tag :color="tag.color" :fade="false">{{$L(tag.text)}}</Tag>
</template>
<h2>{{dialogData.name}}</h2>
<em v-if="peopleNum > 0">({{peopleNum}})</em>
</div>

View File

@ -140,51 +140,63 @@ export default {
align: 'center',
width: 100,
render: (h, params) => {
const recoveryNode = h('Poptip', {
props: {
title: this.$L('你确定要还原归档吗?'),
confirm: true,
transfer: true,
placement: 'left',
},
style: {
fontSize: '13px',
cursor: 'pointer',
color: '#8bcf70',
},
on: {
'on-ok': () => {
this.recovery(params.row);
}
},
}, this.$L('还原'));
const deleteNode = h('Poptip', {
props: {
title: this.$L('你确定要删除任务吗?'),
confirm: true,
transfer: true,
placement: 'left',
},
style: {
marginLeft: '6px',
fontSize: '13px',
cursor: 'pointer',
color: '#f00',
},
on: {
'on-ok': () => {
this.delete(params.row);
}
},
}, this.$L('删除'));
const vNodes = [
h('span', {
style: {
fontSize: '13px',
cursor: 'pointer',
color: '#8bcf70',
},
on: {
'click': () => {
this.$store.dispatch("openTask", params.row);
}
},
}, this.$L('查看')),
h('Poptip', {
props: {
title: this.$L('你确定要还原归档吗?'),
confirm: true,
transfer: true,
placement: 'left',
},
style: {
marginLeft: '6px',
fontSize: '13px',
cursor: 'pointer',
color: '#8bcf70',
},
on: {
'on-ok': () => {
this.recovery(params.row);
}
},
}, this.$L('还原')),
h('Poptip', {
props: {
title: this.$L('你确定要删除任务吗?'),
confirm: true,
transfer: true,
placement: 'left',
},
style: {
marginLeft: '6px',
fontSize: '13px',
cursor: 'pointer',
color: '#f00',
},
on: {
'on-ok': () => {
this.delete(params.row);
}
},
}, this.$L('删除'))
];
return h('TableAction', {
props: {
column: params.column
}
}, [
recoveryNode,
deleteNode,
]);
}, vNodes);
}
}
]
@ -239,12 +251,9 @@ export default {
recovery(row) {
this.list = this.list.filter(({id}) => id != row.id);
this.loadIng++;
this.$store.dispatch("call", {
url: 'project/task/archived',
data: {
task_id: row.id,
type: 'recovery'
},
this.$store.dispatch("archivedTask", {
task_id: row.id,
type: 'recovery'
}).then(({msg}) => {
$A.messageSuccess(msg);
this.loadIng--;

View File

@ -79,6 +79,9 @@
<div v-if="taskDetail.flow_item_name" class="flow">
<span :class="taskDetail.flow_item_status" @click.stop="openMenu(taskDetail)">{{taskDetail.flow_item_name}}</span>
</div>
<div v-if="taskDetail.archived_at" class="flow">
<span class="archived" @click.stop="openMenu(taskDetail)">{{$L('已归档')}}</span>
</div>
<div class="nav">
<p v-if="projectName"><span>{{projectName}}</span></p>
<p v-if="columnName"><span>{{columnName}}</span></p>
@ -762,31 +765,6 @@ export default {
})
},
archivedOrRemoveTask(type) {
let typeDispatch = type == 'remove' ? 'removeTask' : 'archivedTask';
let typeName = type == 'remove' ? '删除' : '归档';
let typeTask = this.taskDetail.parent_id > 0 ? '子任务' : '任务';
$A.modalConfirm({
title: typeName + typeTask,
content: '你确定要' + typeName + typeTask + '【' + this.taskDetail.name + '】吗?',
loading: true,
onOk: () => {
if (this.taskDetail.loading === true) {
this.$Modal.remove();
return;
}
this.$set(this.taskDetail, 'loading', true);
this.$store.dispatch(typeDispatch, this.taskDetail.id).then(({msg}) => {
$A.messageSuccess(msg);
this.$Modal.remove();
}).catch(({msg}) => {
$A.modalError(msg, 301);
this.$Modal.remove();
});
}
});
},
openOwner() {
const list = this.getOwner.map(({userid}) => userid)
this.$set(this.taskDetail, 'owner_userid', list)

View File

@ -48,7 +48,7 @@
<template v-if="task.parent_id === 0">
<EDropdownItem :divided="turns.length > 0" command="archived">
<div class="item">
<Icon type="ios-filing" />{{$L('归档')}}
<Icon type="ios-filing" />{{$L(task.archived_at ? '还原归档' : '归档')}}
</div>
</EDropdownItem>
<EDropdownItem command="remove">
@ -246,9 +246,21 @@ export default {
},
archivedOrRemoveTask(type) {
let typeDispatch = type == 'remove' ? 'removeTask' : 'archivedTask';
let typeName = type == 'remove' ? '删除' : '归档';
let typeDispatch = 'removeTask';
let typeName = '删除';
let typeData = this.task.id;
let typeTask = this.task.parent_id > 0 ? '子任务' : '任务';
if (type == 'archived') {
typeDispatch = 'archivedTask'
typeName = '归档'
if (this.task.archived_at) {
typeName = '还原归档'
typeData = {
task_id: this.task.id,
type: 'recovery'
}
}
}
$A.modalConfirm({
title: typeName + typeTask,
content: '你确定要' + typeName + typeTask + '【' + this.task.name + '】吗?',
@ -258,7 +270,7 @@ export default {
this.$Modal.remove();
return;
}
this.$store.dispatch(typeDispatch, this.task.id).then(({msg}) => {
this.$store.dispatch(typeDispatch, typeData).then(({msg}) => {
$A.messageSuccess(msg);
this.$Modal.remove();
}).catch(({msg}) => {

View File

@ -33,14 +33,16 @@
@click="openDialog(dialog, true)">
<template v-if="dialog.type=='group'">
<i v-if="dialog.group_type=='project'" class="taskfont icon-avatar project">&#xe6f9;</i>
<i v-else-if="dialog.group_type=='task'" class="taskfont icon-avatar task">&#xe6f4;</i>
<i v-else-if="dialog.group_type=='task'" class="taskfont icon-avatar task" :class="{completed:$A.dialogCompleted(dialog)}">&#xe6f4;</i>
<Icon v-else class="icon-avatar" type="ios-people" />
</template>
<div v-else-if="dialog.dialog_user" class="user-avatar"><UserAvatar :userid="dialog.dialog_user.userid" :size="42"/></div>
<Icon v-else class="icon-avatar" type="md-person" />
<div class="dialog-box">
<div class="dialog-title">
<Tag v-for="(tag, ti) in $A.dialogTags(dialog)" :key="`tag_${ti}`" :color="tag.color">{{$L(tag.text)}}</Tag>
<template v-for="tag in $A.dialogTags(dialog)" v-if="tag.color != 'success'">
<Tag :color="tag.color" :fade="false">{{$L(tag.text)}}</Tag>
</template>
<span>{{dialog.name}}</span>
<Icon v-if="dialog.type == 'user' && lastMsgReadDone(dialog.last_msg)" :type="lastMsgReadDone(dialog.last_msg)"/>
<em v-if="dialog.last_at">{{$A.formatTime(dialog.last_at)}}</em>
@ -289,16 +291,16 @@ export default {
}
}
if (dialog.group_info.deleted_at) {
// 3
// 2
let time = Math.max($A.Date(dialog.last_at, true), $A.Date(dialog.group_info.deleted_at, true))
if (3 * 86400 + time < $A.Time()) {
if (2 * 86400 + time < $A.Time()) {
return false
}
}
if (dialog.group_info.archived_at) {
// 7
// 3
let time = Math.max($A.Date(dialog.last_at, true), $A.Date(dialog.group_info.archived_at, true))
if (7 * 86400 + time < $A.Time()) {
if (3 * 86400 + time < $A.Time()) {
return false
}
}

View File

@ -1197,32 +1197,33 @@ export default {
},
/**
* 归档任务
* 归档还原任务
* @param state
* @param dispatch
* @param task_id
* @param data Number|JSONObject{task_id, ?archived_at}
* @returns {Promise<unknown>}
*/
archivedTask({state, dispatch}, task_id) {
archivedTask({state, dispatch}, data) {
return new Promise(function (resolve, reject) {
if ($A.runNum(task_id) === 0) {
if (/^\d+$/.test(data)) {
data = {task_id: data}
}
if ($A.runNum(data.task_id) === 0) {
reject({msg: 'Parameter error'});
return;
}
dispatch("taskLoadStart", task_id)
dispatch("taskLoadStart", data.task_id)
dispatch("call", {
url: 'project/task/archived',
data: {
task_id: task_id,
},
data,
}).then(result => {
dispatch("saveTask", result.data)
dispatch("taskLoadEnd", task_id)
dispatch("taskLoadEnd", data.task_id)
resolve(result)
}).catch(e => {
console.warn(e);
dispatch("getTaskOne", task_id).catch(() => {})
dispatch("taskLoadEnd", task_id)
dispatch("getTaskOne", data.task_id).catch(() => {})
dispatch("taskLoadEnd", data.task_id)
reject(e)
});
});

View File

@ -15,7 +15,7 @@
padding: 0 30px;
height: 68px;
position: relative;
&:after {
&:before {
content: "";
position: absolute;
left: 0;
@ -24,11 +24,41 @@
height: 1px;
background-color: #f4f5f5;
}
&.completed {
&:after {
content: "\f373";
font-family: Ionicons, serif;
pointer-events: none;
position: absolute;
top: 50%;
right: 24px;
transform: translateY(-50%);
font-size: 52px;
color: #19be6b;
opacity: .2;
z-index: 1;
}
}
.main-title {
display: flex;
align-items: center;
line-height: 22px;
max-width: 100%;
.ivu-tag {
margin: 0 6px 0 0;
padding: 0 5px;
&.ivu-tag-success {
padding: 0 6px;
}
}
.ivu-icon {
font-size: 18px;
margin-right: 6px;
&.completed {
color: $primary-color;
}
}
> h2 {
font-size: 17px;
font-weight: 600;

View File

@ -27,6 +27,7 @@
background-color: #f4f5f5;
}
.icon {
margin-right: 18px;
.task-menu-icon {
display: flex;
align-items: center;
@ -47,8 +48,7 @@
}
}
.flow {
margin-left: 18px;
margin-right: -3px;
margin-right: 10px;
> span {
font-size: 14px;
height: 26px;
@ -60,7 +60,8 @@
display: inline-block;
text-align: center;
cursor: pointer;
&.start {
&.start,
&.archived {
background-color: rgba(38, 38, 38, 0.05);
border-color: rgba(38, 38, 38, 0.05);
color: #595959;
@ -81,7 +82,6 @@
flex: 1;
display: flex;
align-items: center;
margin-left: 18px;
font-size: 12px;
width: 0;
height: 40px;

View File

@ -111,6 +111,20 @@
background-color: #9B96DF;
font-size: 24px;
}
&.completed {
&:after {
content: "\f373";
font-family: Ionicons, serif;
pointer-events: none;
position: absolute;
bottom: 0;
right: 12px;
font-size: 32px;
color: #19be6b;
opacity: .2;
z-index: 1;
}
}
}
.dialog-box {
flex: 1;
@ -125,11 +139,9 @@
justify-content: space-between;
line-height: 24px;
.ivu-tag {
margin: 0 4px 0 0;
padding: 0 5px;
&.ivu-tag-error,
&.ivu-tag-primary,
&.ivu-tag-success,
&.ivu-tag-warning {
&.ivu-tag-success {
padding: 0 6px;
}
}
@ -147,6 +159,11 @@
transform: scale(0.9);
font-size: 12px;
color: $primary-color;
&.completed {
font-size: 18px;
margin: 0 4px 0 0;
transform: scale(1);
}
}
> em {
flex-shrink: 0;