0.6.2 接取任务改为手动

This commit is contained in:
磷叶 2025-03-07 17:40:29 +08:00
parent d45d98661c
commit 5f98cc660d
5 changed files with 83 additions and 5 deletions

View File

@ -69,3 +69,11 @@ export function passTask(id) {
method: 'put'
})
}
// 接取任务
export function receiveTask(id) {
return request({
url: '/bst/task/receive/' + id,
method: 'put'
})
}

View File

@ -14,7 +14,6 @@ export const TaskStatus = {
PASS: "4", // 通过
REJECT: "5", // 驳回(停用)
CANCEL: "6", // 取消
// 获取可以提交的任务状态
canSubmit() {
return [this.PROCESSING]
@ -29,7 +28,7 @@ export const TaskStatus = {
},
// 获取可以开始的任务状态
canStart() {
return [this.WAIT_RECEIVE, this.CANCEL]
return [this.WAIT_RECEIVE, this.CANCEL, this.PASS]
},
// 获取未完成任务状态
unComplete() {
@ -164,3 +163,40 @@ export const ProjectMemberRole = {
QA: "QA", // 测试
NORMAL: "NORMAL", // 普通成员
}
// 任务成员状态
// 任务成员状态
export const TaskMemberStatus = {
WAIT_RECEIVE: "WAIT_RECEIVE", // 待接收
PROCESSING: "PROCESSING", // 进行中
SUBMITED: "SUBMITED", // 已提交
REJECTED: "REJECTED", // 已驳回
CANCELED: "CANCELED", // 已取消
// 允许接收的成员状态
canReceive() {
return [this.WAIT_RECEIVE]
},
// 未提交的成员状态
unSubmit() {
return [
this.WAIT_RECEIVE,
this.PROCESSING,
this.REJECTED,
this.CANCELED
]
},
// 已提交的成员状态
submited() {
return [this.SUBMITED]
},
// 已读的成员状态
received() {
return [
this.PROCESSING,
this.SUBMITED,
this.REJECTED,
this.CANCELED
]
}
}

View File

@ -19,7 +19,7 @@
<task :hide-columns="taskHideColumns" :init-show-search="false"/>
</el-tab-pane>
<el-tab-pane label="今日完成任务" lazy v-if="checkPermi(['bst:task:list'])">
<task :hide-columns="taskHideColumns" :query="{passDateRange: [today, today], status: TaskStatus.PASS}" :init-show-search="false"/>
<task :hide-columns="taskHideColumns" :query="{passDateRange: [today, today], statusList: TaskStatus.complete()}" :init-show-search="false"/>
</el-tab-pane>
<el-tab-pane label="今日新增客户" lazy v-if="checkPermi(['bst:customer:list'])">
<customer :hide-columns="customerHideColumns" :query="{createDate: today}" :init-show-search="false"/>

View File

@ -158,6 +158,13 @@
v-has-permi="['bst:task:query']"
@click="handleView(scope.row)"
>详情</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-check"
v-if="canReceive(scope.row)"
@click="handleReceive(scope.row)"
>接取</el-button>
<el-button
size="mini"
type="text"
@ -202,7 +209,7 @@
</template>
<script>
import { listTask,delTask } from "@/api/bst/task";
import { listTask,delTask, receiveTask } from "@/api/bst/task";
import { $showColumns } from '@/utils/mixins';
import FormCol from "@/components/FormCol/index.vue";
import TaskEditDialog from '@/views/bst/task/components/TaskEditDialog.vue';
@ -309,6 +316,18 @@ export default {
this.getList();
},
methods: {
handleReceive(row) {
this.$confirm('是否确认接取该任务?', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
receiveTask(row.id).then(() => {
this.getList();
this.$modal.msgSuccess("接取成功");
})
})
},
handleView(row) {
this.row = row;
this.showViewDialog = true;

View File

@ -1,4 +1,4 @@
import { Role, TaskStatus } from '@/utils/enums';
import { Role, TaskMemberStatus, TaskStatus } from '@/utils/enums';
import { checkPermi, checkRole } from '@/utils/permission';
import { mapGetters } from 'vuex';
export const $task = {
@ -47,6 +47,21 @@ export const $task = {
return (row) => {
return row.createId === this.userId;
}
},
// 是否可以接取
canReceive() {
return (row) => {
if (row.memberList == null) {
return false;
}
// 当前成员信息
let member = row.memberList.find(item => item.userId === this.userId);
if (member == null) {
return false;
}
return checkPermi(['bst:task:receive']) && TaskMemberStatus.canReceive().includes(member.status);
}
}
}
}