perf: 领取任务流程

This commit is contained in:
kuaifan 2021-12-25 11:42:04 +08:00
parent ccf4c4bbb3
commit f7fc379e56
6 changed files with 45 additions and 18 deletions

View File

@ -182,7 +182,7 @@
<UserAvatar :userid="user.userid" size="32" :borderWitdh="2" :borderColor="item.color"/> <UserAvatar :userid="user.userid" size="32" :borderWitdh="2" :borderColor="item.color"/>
</li> </li>
<li v-if="ownerUser(item.task_user).length === 0" class="no-owner"> <li v-if="ownerUser(item.task_user).length === 0" class="no-owner">
<Button type="primary" size="small" ghost>{{$L('领取任务')}}</Button> <Button type="primary" size="small" ghost @click.stop="openTask(item, true)">{{$L('领取任务')}}</Button>
</li> </li>
</ul> </ul>
<div v-if="item.file_num > 0" class="task-icon">{{item.file_num}}<Icon type="ios-link-outline" /></div> <div v-if="item.file_num > 0" class="task-icon">{{item.file_num}}<Icon type="ios-link-outline" /></div>
@ -458,7 +458,7 @@ export default {
logShow: false, logShow: false,
archivedTaskShow: false, archivedTaskShow: false,
projectDialogsubscribe: null, projectDialogSubscribe: null,
} }
}, },
@ -467,7 +467,7 @@ export default {
this.nowTime = $A.Time(); this.nowTime = $A.Time();
}, 1000); }, 1000);
// //
this.projectDialogsubscribe = Store.subscribe('onProjectDialogBack', () => { this.projectDialogSubscribe = Store.subscribe('onProjectDialogBack', () => {
this.$store.dispatch('toggleTablePanel', 'chat'); this.$store.dispatch('toggleTablePanel', 'chat');
}); });
}, },
@ -475,9 +475,9 @@ export default {
destroyed() { destroyed() {
clearInterval(this.nowInterval); clearInterval(this.nowInterval);
// //
if (this.projectDialogsubscribe) { if (this.projectDialogSubscribe) {
this.projectDialogsubscribe.unsubscribe(); this.projectDialogSubscribe.unsubscribe();
this.projectDialogsubscribe = null; this.projectDialogSubscribe = null;
} }
}, },
@ -1117,12 +1117,18 @@ export default {
} }
}, },
openTask(task) { openTask(task, receive) {
if (task.parent_id > 0) { if (task.parent_id > 0) {
this.$store.dispatch("openTask", task.parent_id) this.$store.dispatch("openTask", task.parent_id)
} else { } else {
this.$store.dispatch("openTask", task.id) this.$store.dispatch("openTask", task.id)
} }
if (receive === true) {
//
setTimeout(() => {
Store.set('receiveTask', true);
}, 300)
}
}, },
taskIsHidden(task) { taskIsHidden(task) {

View File

@ -103,7 +103,7 @@
<Poptip <Poptip
v-if="getOwner.length === 0" v-if="getOwner.length === 0"
confirm confirm
ref="owner" ref="receive"
class="pick" class="pick"
:title="$L('你确认领取任务吗?')" :title="$L('你确认领取任务吗?')"
placement="bottom" placement="bottom"
@ -407,6 +407,7 @@ import UserInput from "../../../components/UserInput";
import TaskUpload from "./TaskUpload"; import TaskUpload from "./TaskUpload";
import DialogWrapper from "./DialogWrapper"; import DialogWrapper from "./DialogWrapper";
import ProjectLog from "./ProjectLog"; import ProjectLog from "./ProjectLog";
import {Store} from "le5le-store";
export default { export default {
name: "TaskDetail", name: "TaskDetail",
@ -477,6 +478,8 @@ export default {
valid_elements : 'a[href|target=_blank],em,strong/b,div[align],span[style],a,br,p,img[src|alt|witdh|height],pre[class],code', valid_elements : 'a[href|target=_blank],em,strong/b,div[align],span[style],a,br,p,img[src|alt|witdh|height],pre[class],code',
toolbar: 'uploadImages | uploadFiles | bold italic underline forecolor backcolor | codesample | preview screenload' toolbar: 'uploadImages | uploadFiles | bold italic underline forecolor backcolor | codesample | preview screenload'
}, },
receiveTaskSubscribe: null,
} }
}, },
@ -485,11 +488,20 @@ export default {
this.nowTime = $A.Time(); this.nowTime = $A.Time();
}, 1000); }, 1000);
window.addEventListener('resize', this.innerHeightListener); window.addEventListener('resize', this.innerHeightListener);
//
this.receiveTaskSubscribe = Store.subscribe('receiveTask', () => {
this.$refs.receive && this.$refs.receive.handleClick();
});
}, },
destroyed() { destroyed() {
clearInterval(this.nowInterval); clearInterval(this.nowInterval);
window.removeEventListener('resize', this.innerHeightListener); window.removeEventListener('resize', this.innerHeightListener);
//
if (this.receiveTaskSubscribe) {
this.receiveTaskSubscribe.unsubscribe();
this.receiveTaskSubscribe = null;
}
}, },
computed: { computed: {

View File

@ -109,7 +109,7 @@
<UserAvatar :userid="user.userid" size="32" :borderWitdh="2" :borderColor="item.color"/> <UserAvatar :userid="user.userid" size="32" :borderWitdh="2" :borderColor="item.color"/>
</li> </li>
<li v-if="ownerUser(item.task_user).length === 0" class="no-owner"> <li v-if="ownerUser(item.task_user).length === 0" class="no-owner">
<Button type="primary" size="small" @click="openTask(item)">{{$L('领取任务')}}</Button> <Button type="primary" size="small" @click.stop="openTask(item, true)">{{$L('领取任务')}}</Button>
</li> </li>
</ul> </ul>
</Col> </Col>
@ -139,6 +139,7 @@
import TaskPriority from "./TaskPriority"; import TaskPriority from "./TaskPriority";
import TaskAddSimple from "./TaskAddSimple"; import TaskAddSimple from "./TaskAddSimple";
import {mapState} from "vuex"; import {mapState} from "vuex";
import {Store} from "le5le-store";
export default { export default {
name: "TaskRow", name: "TaskRow",
@ -247,12 +248,18 @@ export default {
return this.columns.filter(({project_id}) => project_id == id); return this.columns.filter(({project_id}) => project_id == id);
}, },
openTask(task) { openTask(task, receive) {
if (task.parent_id > 0) { if (task.parent_id > 0) {
this.$store.dispatch("openTask", task.parent_id) this.$store.dispatch("openTask", task.parent_id)
} else { } else {
this.$store.dispatch("openTask", task.id) this.$store.dispatch("openTask", task.id)
} }
if (receive === true) {
//
setTimeout(() => {
Store.set('receiveTask', true);
}, 300)
}
}, },
ownerUser(list) { ownerUser(list) {

View File

@ -1,5 +1,4 @@
import {Store} from 'le5le-store'; import {Store} from 'le5le-store';
import state from "./state";
export default { export default {
/** /**

View File

@ -679,13 +679,7 @@
} }
} }
} }
&.row-column { &.row-column,
.task-column {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
&.row-priority { &.row-priority {
.el-dropdown { .el-dropdown {
display: flex; display: flex;
@ -693,6 +687,13 @@
overflow: hidden; overflow: hidden;
} }
} }
&.row-column {
.task-column {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
&.row-user { &.row-user {
padding: 8px; padding: 8px;
> ul { > ul {

View File

@ -161,6 +161,8 @@
margin-top: 1px; margin-top: 1px;
cursor: pointer; cursor: pointer;
.user-list { .user-list {
display: flex;
align-items: center;
> div { > div {
display: inline-block; display: inline-block;
margin-right: 6px; margin-right: 6px;