diff --git a/client/src/views/supervision/task.vue b/client/src/views/supervision/task.vue index fa021c0..9030186 100644 --- a/client/src/views/supervision/task.vue +++ b/client/src/views/supervision/task.vue @@ -46,7 +46,9 @@ - {{scope.row.state}} + {{scope.row.state}} + {{scope.row.state}} + {{scope.row.state}} @@ -216,7 +218,7 @@ export default { }); }, handleDelete(scope) { - this.$confirm("确认删除?", "警告", { + this.$confirm("确认删除?该操作将删除该任务所有上报记录!", "警告", { confirmButtonText: "确认", cancelButtonText: "取消", type: "error", diff --git a/client/src/views/supervision/taskdo.vue b/client/src/views/supervision/taskdo.vue index b4d045c..46aac18 100644 --- a/client/src/views/supervision/taskdo.vue +++ b/client/src/views/supervision/taskdo.vue @@ -32,7 +32,11 @@ 任务状态 - {{ task.state }} + + {{task.state}} + {{task.state}} + {{task.state}} + @@ -434,7 +438,7 @@ export default { this.gettask() if(this.activeName == 'contenttab'){ this.chosecontent(this.nowcontent) - }else if(activeName == 'depttab'){ + }else if(this.activeName == 'depttab'){ this.chosedept(this.nowdept) } }, diff --git a/server/apps/supervision/views.py b/server/apps/supervision/views.py index a4f5c92..ffd7de5 100644 --- a/server/apps/supervision/views.py +++ b/server/apps/supervision/views.py @@ -46,6 +46,12 @@ class TaskViewSet(CreateUpdateCustomMixin, ModelViewSet): return TaksDetailSerializer return TaskListSerializer + def destroy(self, request, *args, **kwargs): + instance = self.get_object() + instance.delete() + Record.objects.filter(task=instance).delete() + return Response(status=status.HTTP_204_NO_CONTENT) + @action(methods=['post'], detail=True, perms_map = {'post':'task_init'}) def init(self, request, *args, **kwargs): """ @@ -100,6 +106,8 @@ def cal_task_rate(task): confirm_rate = objs.filter(state='已确认').count()/count task.up_rate = int(up_rate*100) task.confirm_rate = int(confirm_rate*100) + if task.confirm_rate == 100: + task.state ='已完成' task.save() class RecordViewSet(RbacFilterSet, PageOrNot, CreateUpdateCustomMixin, ModelViewSet):