Commit 1a1b1120 authored by lvshibao's avatar lvshibao

rule页面修改

parent a2b72d45
...@@ -3,7 +3,10 @@ from django.db.models import Q ...@@ -3,7 +3,10 @@ from django.db.models import Q
from inspect_report.models import Team, Country from inspect_report.models import Team, Country
def get_team_names(city_id, country_id): def get_team_names(city_id, country_id, team_id=None):
if team_id is not None and team_id != '':
team_names = Team.objects.filter(id=team_id).values_list('name')
else:
# # 获取坐席团队关系 # # 获取坐席团队关系
team_names = list() team_names = list()
if city_id and country_id: if city_id and country_id:
......
...@@ -77,3 +77,25 @@ class AgencyApi(viewsets.ViewSet): ...@@ -77,3 +77,25 @@ class AgencyApi(viewsets.ViewSet):
return Response({'code': 0, 'msg': 'success', 'data': {'country_list': country_list}}) return Response({'code': 0, 'msg': 'success', 'data': {'country_list': country_list}})
else: else:
return Response({'code': -1, 'msg': '未找到对应的县市'}) return Response({'code': -1, 'msg': '未找到对应的县市'})
@action(['get'], detail=False)
def team(self, req: Request):
"""
查询任务列表
:param req:
:return:
"""
city_id = req.GET.get('city_id', '')
country_id = req.GET.get('country_id', '')
team_list = list()
top = Country.objects.filter(id=city_id).first()
if top is not None:
if top.parent is None:
pass
elif country_id is None or country_id == '':
team_list = Team.objects.filter(country_id=city_id).values('id', 'name')
else:
team_list = Team.objects.filter(country_id=country_id).values('id', 'name')
return Response({'code': 0, 'msg': 'success', 'data': {'team_list': team_list}})
else:
return Response({'code': -1, 'msg': '未找到对应的县市'})
...@@ -76,9 +76,10 @@ class DataApi(viewsets.ViewSet): ...@@ -76,9 +76,10 @@ class DataApi(viewsets.ViewSet):
""" """
city_id = req.GET.get('city', None) city_id = req.GET.get('city', None)
country_id = req.GET.get('country', None) country_id = req.GET.get('country', None)
team_id = req.GET.get('country', None)
task_condition = req.data.get('date_condition', {}) task_condition = req.data.get('date_condition', {})
team_names = get_team_names(city_id, country_id) team_names = get_team_names(city_id, country_id, team_id)
task_condition['task__in'] = team_names task_condition['task__in'] = team_names
......
...@@ -466,8 +466,9 @@ class TasksApi(viewsets.ViewSet): ...@@ -466,8 +466,9 @@ class TasksApi(viewsets.ViewSet):
city_id = req.data.get('city', None) city_id = req.data.get('city', None)
country_id = req.data.get('country', None) country_id = req.data.get('country', None)
team_id = req.data.get('team', None)
team_names = get_team_names(city_id, country_id) team_names = get_team_names(city_id, country_id, team_id)
task_condition = req.data.get('date_condition', {}) task_condition = req.data.get('date_condition', {})
...@@ -509,6 +510,7 @@ class TasksApi(viewsets.ViewSet): ...@@ -509,6 +510,7 @@ class TasksApi(viewsets.ViewSet):
""" """
city_id = req.data.get('city', None) city_id = req.data.get('city', None)
country_id = req.data.get('country', None) country_id = req.data.get('country', None)
team_id = req.data.get('team', None)
tables = req.data.get('tables', '') tables = req.data.get('tables', '')
rule_name = req.data.get('rule', '') rule_name = req.data.get('rule', '')
page = req.data.get('page', '1') page = req.data.get('page', '1')
...@@ -520,7 +522,7 @@ class TasksApi(viewsets.ViewSet): ...@@ -520,7 +522,7 @@ class TasksApi(viewsets.ViewSet):
session_condition = req.data.get('date_condition', {}) session_condition = req.data.get('date_condition', {})
session_condition['rule'] = rule_name session_condition['rule'] = rule_name
session_condition['sessionCollectionId__in'] = table_list session_condition['sessionCollectionId__in'] = table_list
session_condition['task__in'] = get_team_names(city_id, country_id) session_condition['task__in'] = get_team_names(city_id, country_id, team_id)
checks = RulesStat.objects.filter(**session_condition).values('agentName', 'customName', 'remainTime', 'score', checks = RulesStat.objects.filter(**session_condition).values('agentName', 'customName', 'remainTime', 'score',
'sessionCollectionId', 'sessionId', 'taskId') 'sessionCollectionId', 'sessionId', 'taskId')
paginator = Paginator(checks, page_size) paginator = Paginator(checks, page_size)
......
...@@ -107,12 +107,25 @@ ...@@ -107,12 +107,25 @@
:value="item.id"> :value="item.id">
</el-option> </el-option>
</el-select> </el-select>
<el-select v-model="teamvalue" v-if="team_show == true" filterable placeholder="请选择团队" @change="changeTeam">
<el-option
label="全部县"
value="">
</el-option>
<el-option
v-for="item in teamList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
<el-button type='primary' size='mini' style='height:30px;' @click='loadData()'> <el-button type='primary' size='mini' style='height:30px;' @click='loadData()'>
导出数据 导出数据
</el-button> </el-button>
<form ref="loadModal" :action="`${BASEURL}api/v1/data/static_rule_export/`" method="get"> <form ref="loadModal" :action="`${BASEURL}api/v1/data/static_rule_export/`" method="get">
<input type="hidden" name="city" :value="cityvalue"> <input type="hidden" name="city" :value="cityvalue">
<input type="hidden" name="country" :value="countryvalue"> <input type="hidden" name="country" :value="countryvalue">
<input type="hidden" name="team" :value="teamvalue">
<input type="hidden" name="start_date" :value="start_date"> <input type="hidden" name="start_date" :value="start_date">
<input type="hidden" name="end_date" :value="end_date"> <input type="hidden" name="end_date" :value="end_date">
</form> </form>
......
...@@ -6,9 +6,12 @@ new Vue({ ...@@ -6,9 +6,12 @@ new Vue({
dateTime: '', dateTime: '',
cityList:[], cityList:[],
countryList:[], countryList:[],
teamList:[],
cityvalue: null, cityvalue: null,
countryvalue: null, countryvalue: null,
teamvalue: null,
country_show: false, country_show: false,
team_show: true,
start_date: '', start_date: '',
isscrollTop: false, isscrollTop: false,
currentPage:1, currentPage:1,
...@@ -58,13 +61,39 @@ new Vue({ ...@@ -58,13 +61,39 @@ new Vue({
console.log(msg); console.log(msg);
this.cityvalue = msg; this.cityvalue = msg;
this.countryvalue = null; this.countryvalue = null;
this.getCountry(this.cityvalue); this.teamvalue = null;
this.getRule(this.cityvalue,this.countryvalue,this.start_date,this.end_date,this.takevalue); // 获取统计数据 this.getCountry();
this.getTeam();
this.getRule(this.cityvalue,this.countryvalue,this.teamvalue,this.start_date,this.end_date,this.takevalue); // 获取统计数据
}, },
changeCountry(msg){ changeCountry(msg){
console.log(msg); console.log(msg);
this.countryvalue = msg; this.countryvalue = msg;
this.getRule(this.cityvalue,this.countryvalue,this.start_date,this.end_date,this.takevalue); // 获取统计数据 this.teamvalue = null;
this.getTeam();
this.getRule(this.cityvalue,this.countryvalue,this.teamvalue,this.start_date,this.end_date,this.takevalue); // 获取统计数据
},
changeTeam(msg){
console.log(msg);
this.teamvalue = msg;
this.getRule(this.cityvalue,this.countryvalue,this.teamvalue,this.start_date,this.end_date,this.takevalue); // 获取统计数据
},
getTeam() {
let that = this;
RquestsGet('api/v1/agency/team/?country_id=' + this.countryvalue + '&city_id=' + this.cityvalue).then(data => {
//console.log(data);
if (data.code != 0) {
that.$message('服务器错误')
} else {
that.teamList = data.data.team_list;
if (that.teamList.length > 0) {
that.team_show = true;
} else {
that.team_show = false;
};
}
})
}, },
getCountry() { getCountry() {
let that = this; let that = this;
...@@ -111,15 +140,6 @@ new Vue({ ...@@ -111,15 +140,6 @@ new Vue({
} else { } else {
that.$message('服务器错误'); that.$message('服务器错误');
} }
//RquestsGet('api/v1/tasks/obtain/').then(data => {
// //console.log(data);
// if(data.code != 0){
// that.taskList = [{id:'',name:'全部任务'}];
// }else{
// that.taskList = [{id:'',name:'全部任务'}].concat(data.data);
// that.getTake()
// }
//})
}, },
CurrentChange(page){ CurrentChange(page){
this.currentPage = page; this.currentPage = page;
...@@ -128,13 +148,13 @@ new Vue({ ...@@ -128,13 +148,13 @@ new Vue({
this.poppage = page; this.poppage = page;
this.getDetail(this.cityvalue,this.countryvalue,this.start_date,this.end_date,this.poptables,this.poprule, this.poppage, this.poppagesize); this.getDetail(this.cityvalue,this.countryvalue,this.start_date,this.end_date,this.poptables,this.poprule, this.poppage, this.poppagesize);
}, },
getRule(city,country,start_date,end_date,agentName){ getRule(city,country,team,start_date,end_date,agentName){
let that = this; let that = this;
console.log(start_date,end_date); console.log(start_date,end_date);
let arr = []; let arr = [];
this.$loading({text:'数据加载中...'}); this.$loading({text:'数据加载中...'});
RquestsPost('api/v1/tasks/static_rule/',{city,country,end_date,start_date,agentName}).then(data => { RquestsPost('api/v1/tasks/static_rule/',{city,country,team,end_date,start_date,agentName}).then(data => {
console.log(data.data); console.log(data.data);
if(data.code != 0){ if(data.code != 0){
that.$message(data.msg); that.$message(data.msg);
...@@ -189,15 +209,15 @@ new Vue({ ...@@ -189,15 +209,15 @@ new Vue({
this.popcurrentPage = 1; this.popcurrentPage = 1;
this.poppage = 1; this.poppage = 1;
//this.taskvalue = tableData.area; //this.taskvalue = tableData.area;
this.getDetail(this.cityvalue,this.countryvalue,this.start_date,this.end_date,this.poptables,this.poprule, this.poppage, this.poppagesize); this.getDetail(this.cityvalue,this.countryvalue,this.teamvalue,this.start_date,this.end_date,this.poptables,this.poprule, this.poppage, this.poppagesize);
}, },
getDetail(city,country,start_date,end_date, tables, rule, page, page_size){ getDetail(city,country,team,start_date,end_date, tables, rule, page, page_size){
//this.getRule(this.taskvalue,this.start_date,this.end_date,this.takevalue); // 获取统计数据 //this.getRule(this.taskvalue,this.start_date,this.end_date,this.takevalue); // 获取统计数据
let that = this; let that = this;
this.$loading({text:'数据加载中...'}); this.$loading({text:'数据加载中...'});
this.poploading = true; this.poploading = true;
RquestsPost('api/v1/tasks/rule_detail/',{city,country,end_date,start_date,tables,rule,page,page_size}).then(data => { RquestsPost('api/v1/tasks/rule_detail/',{city,country,team,end_date,start_date,tables,rule,page,page_size}).then(data => {
console.log(data.data); console.log(data.data);
this.$loading().close(); this.$loading().close();
this.dialogTableVisible = true; this.dialogTableVisible = true;
...@@ -251,9 +271,10 @@ new Vue({ ...@@ -251,9 +271,10 @@ new Vue({
this.start_date = this.dateFormat(new Date(new Date()-24*60*60*1000)); this.start_date = this.dateFormat(new Date(new Date()-24*60*60*1000));
this.end_date = this.dateFormat(new Date()); this.end_date = this.dateFormat(new Date());
this.getCity(); // 获取任务 this.getCity(); // 获取任务
this.getTeam();
//this.getTake(); // 获取坐席 //this.getTake(); // 获取坐席
this.getRule(this.cityvalue,this.countryvalue,this.start_date,this.end_date,this.takevalue); // 获取统计数据 this.getRule(this.cityvalue,this.countryvalue,this.teamvalue,this.start_date,this.end_date,this.takevalue); // 获取统计数据
} }
}, },
......
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