Commit 6e47c439 authored by zhengjinlei's avatar zhengjinlei

概览详情

parent 419ea0f7
# coding: utf-8 # coding: utf-8
from django.shortcuts import render from django.shortcuts import render
from django.db.models import Count from django.db.models import Count, Sum
from rest_framework import viewsets from rest_framework import viewsets
from rest_framework.decorators import action from rest_framework.decorators import action
from rest_framework.request import Request from rest_framework.request import Request
...@@ -299,12 +299,19 @@ class TasksApi(viewsets.ViewSet): ...@@ -299,12 +299,19 @@ class TasksApi(viewsets.ViewSet):
table_name = TABLE_PRE + k table_name = TABLE_PRE + k
tn = CheckSession.set_table(table_name) tn = CheckSession.set_table(table_name)
session_condition = {'taskId__in': v} session_condition = {'taskId__in': v}
checks = tn.objects.filter(**session_condition).values('violationRuleCount', 'score') # checks = tn.objects.filter(**session_condition).values('violationRuleCount', 'score')
for check in checks: # for check in checks:
total_score += check['score'] # total_score += check['score']
return_data['total_session'] += 1 # return_data['total_session'] += 1
if check['violationRuleCount'] > 0: # if check['violationRuleCount'] > 0:
return_data['validate_session'] += 1 # return_data['validate_session'] += 1
session_all = tn.objects.filter(**session_condition).aggregate(Count("id"))
score_all = tn.objects.filter(**session_condition).aggregate(Sum("score"))
session_condition['violationRuleCount__gt'] = 0
validate_all = tn.objects.filter(**session_condition).aggregate(Count("id"))
return_data['total_session'] += session_all['id__count']
return_data['validate_session'] += validate_all['id__count']
total_score += score_all['score__sum']
if return_data['total_session']: if return_data['total_session']:
return_data['ratio'] = round(return_data['validate_session']/return_data['total_session'], 2) return_data['ratio'] = round(return_data['validate_session']/return_data['total_session'], 2)
return_data['avg_score'] = round(total_score / return_data['total_session'], 2) return_data['avg_score'] = round(total_score / return_data['total_session'], 2)
......
...@@ -61,6 +61,13 @@ ...@@ -61,6 +61,13 @@
.el-dialog{ .el-dialog{
width: 700px width: 700px
} }
.is-fullscreen{
//z-index: 2222 !important;
}
#dialogDetail .el-table{
min-height: 500px ;
}
</style> </style>
</head> </head>
<body style='height:100%'> <body style='height:100%'>
...@@ -209,17 +216,15 @@ ...@@ -209,17 +216,15 @@
:total="total"> :total="total">
</el-pagination> </el-pagination>
</div> </div>
<el-dialog title="详情" :visible.sync="dialogTableVisible"> <el-dialog id='dialogDetail' v-loading='poploading' title="详情" :visible.sync="dialogTableVisible">
<el-table style='margin-top:-20px' :data="poptableData" max-height='500'> <el-table style='margin-top:-20px' :data="poptableData" max-height='500'>
<el-table-column prop="agentName" label="坐席id" width='190'></el-table-column> <el-table-column prop="agentName" label="坐席id" width='190'></el-table-column>
<el-table-column prop="customName" label="客户" width='190'></el-table-column> <el-table-column prop="customName" label="客户" width='190'></el-table-column>
<el-table-column prop="remainTime" label="通话时间(秒)"> <el-table-column prop="remainTime" label="通话时间(秒)">
{# <template slot-scope='scope'>#} {# <template slot-scope='scope'>#}
{# <span>{{formatSeconds(scope.row.remainTime)}}</span>#} {# <span>{{formatSeconds(scope.row.remainTime)}}</span>#}
{# </template>#} {# </template>#}
</el-table-column> </el-table-column>
<el-table-column prop="score" label="分数"></el-table-column> <el-table-column prop="score" label="分数"></el-table-column>
<el-table-column label="操作"> <el-table-column label="操作">
...@@ -228,6 +233,16 @@ ...@@ -228,6 +233,16 @@
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<el-pagination
@current-change='popCurrentChange'
style='margin: 0 auto;text-align:center;margin-bottom:20px;'
layout="prev, pager, next"
:current-page.sync='popcurrentPage'
background
:page-size="poppagesize"
:total="poptotal">
</el-pagination>
</el-dialog> </el-dialog>
<el-button v-if='isscrollTop' @click='backTop' id='backTop' type="warning" icon="el-icon-upload2" circle></el-button> <el-button v-if='isscrollTop' @click='backTop' id='backTop' type="warning" icon="el-icon-upload2" circle></el-button>
</div> </div>
......
...@@ -11,9 +11,16 @@ new Vue({ ...@@ -11,9 +11,16 @@ new Vue({
currentPage:1, currentPage:1,
pagesize: 10, pagesize: 10,
total: 10, total: 10,
poppage: 1,
poppagesize: 10,
poptotal: 10,
poprule: '',
poptables: '',
popcurrentPage: 1,
isHidePage: true, isHidePage: true,
scrollTop: 0, scrollTop: 0,
end_date:'', end_date:'',
poploading: false,
dialogTableVisible: false, dialogTableVisible: false,
takeList:[], takeList:[],
dateRange:[new Date(), new Date()], dateRange:[new Date(), new Date()],
...@@ -98,6 +105,10 @@ new Vue({ ...@@ -98,6 +105,10 @@ new Vue({
}, },
CurrentChange(page){ CurrentChange(page){
this.currentPage = page; this.currentPage = page;
},
popCurrentChange(page){
this.poppage = page;
this.getDetail(this.taskvalue,this.start_date,this.end_date,this.poptables,this.poprule, this.poppage, this.poppagesize);
}, },
getRule(task,start_date,end_date,agentName){ getRule(task,start_date,end_date,agentName){
let that = this; let that = this;
...@@ -151,10 +162,39 @@ new Vue({ ...@@ -151,10 +162,39 @@ new Vue({
return date.getFullYear() + "-" + (date.getMonth()+1) + "-" + date.getDate(); return date.getFullYear() + "-" + (date.getMonth()+1) + "-" + date.getDate();
}, },
rowDetail(index,tableData){ rowDetail(index,tableData){
console.log(tableData[index]); let data = tableData[index + (this.currentPage-1) * this.pagesize];
//console.log(tableData); console.log(data);
this.poptableData = tableData[index].details;
//this.poptableData = tableData[index].details;
this.poptables = data.tables;
this.poprule = data.rule;
this.popcurrentPage = 1;
this.poppage = 1;
this.getDetail(this.taskvalue,this.start_date,this.end_date,this.poptables,this.poprule, this.poppage, this.poppagesize);
this.dialogTableVisible = true; this.dialogTableVisible = true;
},
getDetail(task,start_date,end_date, tables, rule, page, page_size){
//this.getRule(this.taskvalue,this.start_date,this.end_date,this.takevalue); // 获取统计数据
let that = this;
//this.$loading({text:'数据加载中...'});
this.poploading = true;
RquestsPost('api/v1/tasks/rule_detail/',{task,end_date,start_date,tables,rule,page,page_size}).then(data => {
console.log(data.data);
if(data.code != 0){
that.$message(data.msg);
if(data.msg){
that.$message(data.msg);
}else{
that.$message('服务器错误')
}
}
//that.titleInfo = data.data;
that.poptotal = data.count;
that.poptableData = data.data;
//this.$loading().close();
this.poploading = false;
})
}, },
handleTableDetail(index, msg){ handleTableDetail(index, msg){
let url = "/quality/audio/check-detail/"+msg.sessionCollectionId+"/"+msg.taskId+"?from=checkTask&sessionId=" + msg.sessionId; let url = "/quality/audio/check-detail/"+msg.sessionCollectionId+"/"+msg.taskId+"?from=checkTask&sessionId=" + msg.sessionId;
......
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