Commit be522eb1 authored by lvshibao's avatar lvshibao

group页面修改

parent fb1cff9b
...@@ -5,6 +5,7 @@ from rest_framework.decorators import action ...@@ -5,6 +5,7 @@ from rest_framework.decorators import action
from rest_framework.request import Request from rest_framework.request import Request
from before_request import before_request from before_request import before_request
from inspect_report.agency import get_team_names
from inspect_report.models import Tasks, CheckSession, RulesStat, SeatStat, ScoreStat, Round from inspect_report.models import Tasks, CheckSession, RulesStat, SeatStat, ScoreStat, Round
import json import json
from datetime import datetime, timedelta from datetime import datetime, timedelta
...@@ -31,14 +32,15 @@ class DataApi(viewsets.ViewSet): ...@@ -31,14 +32,15 @@ class DataApi(viewsets.ViewSet):
:param req: :param req:
:return: :return:
""" """
username = req.data.get('username', '') city_id = req.data.get('city', None)
task_id = req.GET.get('task', '') country_id = req.data.get('country', None)
sort = req.GET.get('sort', '-avg_score') sort = req.GET.get('sort', '-avg_score')
task_condition = req.data.get('date_condition', {}) task_condition = req.data.get('date_condition', {})
if task_id:
task_condition['task'] = task_id team_names = get_team_names(city_id, country_id)
if username in name_list:
task_condition['task'] = username task_condition['task__in'] = team_names
rules = ScoreStat.objects.filter(**task_condition).extra(select={'area': "task"}) \ rules = ScoreStat.objects.filter(**task_condition).extra(select={'area': "task"}) \
.values('area').annotate(avg_score_svc=Round(Avg('service_score'), 2), .values('area').annotate(avg_score_svc=Round(Avg('service_score'), 2),
avg_score_bus=Round(Avg('business_score'), 2), avg_score_bus=Round(Avg('business_score'), 2),
......
...@@ -70,7 +70,7 @@ new Vue({ ...@@ -70,7 +70,7 @@ new Vue({
name: item.prop, name: item.prop,
sort: order sort: order
} }
this.getRule(this.taskvalue,this.start_date,this.end_date,this.takevalue); // 获取统计数据 this.getRule(this.cityvalue,this.countryvalue,this.start_date,this.end_date,this.takevalue); // 获取统计数据
}, },
changeRange(dateRange){ changeRange(dateRange){
this.start_date = dateRange[0]; this.start_date = dateRange[0];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment