Commit 02673992 authored by zhengjinlei's avatar zhengjinlei

跳转详情

parent 414a0598
......@@ -100,10 +100,14 @@ class TasksApi(viewsets.ViewSet):
session_condition = {'taskId__in': v}
if agent_name:
session_condition['agentName'] = agent_name
checks = tn.objects.filter(**session_condition).values('id', 'checkResult')
checks = tn.objects.filter(**session_condition).values('id', 'checkResult', 'agentName', 'customName',
'remainTime', 'score', 'sessionId', 'taskId')
# checks = tn.objects.filter(**session_condition).values('id', 'checkResult')
for check in checks:
result = check['checkResult']
detail = {'agentName': check['agentName'], 'customName': check['customName'],
'remainTime': check['remainTime'], 'score': check['score'], 'sessionId': check['sessionId'],
'sessionCollectionId': k, 'taskId': check['taskId']}
# session_id = check['id']
if result:
data = json.loads(result)
......@@ -112,9 +116,10 @@ class TasksApi(viewsets.ViewSet):
name = d['rule']['name']
if name in return_data.keys():
return_data[name]['count'] += 1
return_data[name]['details'].append(detail)
# return_data[name]['ids'].append(session_id)
else:
return_data[name] = {'count': 1}
return_data[name] = {'count': 1, 'details': [detail, ]}
# return_data[name] = {'count': 1, 'ids': [session_id, ]}
data_sort = []
for k, v in return_data.items():
......
......@@ -50,6 +50,24 @@
</el-select>
</div>
<div id='main' style='width:80%;height:600px' v-loading='true'></div>
<el-dialog title="详情" :visible.sync="dialogTableVisible">
<el-table style='margin-top:-20px' :data="tableData" max-height='500'>
<el-table-column prop="agentName" label="坐席id"></el-table-column>
<el-table-column prop="customName" label="客户" ></el-table-column>
<el-table-column prop="remainTime" label="通话时间(秒)">
{# <template slot-scope='scope'>#}
{# <span>{{scope.row.remainTime}}秒</span>#}
{# </template>#}
</el-table-column>
<el-table-column prop="score" label="分数"></el-table-column>
<el-table-column label="操作">
<template slot-scope='scope'>
<el-button type='text' size="mini" @click="handleTableDetail(scope.$index, scope.row)">详情</el-button>
</template>
</el-table-column>
</el-table>
</el-dialog>
</div>
<script type="text/javascript">
window.onload = function(){
......
......@@ -8,20 +8,20 @@ new Vue({
taskvalue: '',
start_date: '',
end_date:'',
dialogTableVisible: false,
takeList:[],
takevalue: '',
loading: true,
tableData: [],
}
},
methods: {
changeRange(dateRange){
console.log(dateRange);
this.start_date = dateRange[0];
this.end_date = dateRange[1];
this.getRule(this.taskvalue,this.start_date,this.end_date,this.takevalue); // 获取统计数据
},
changeTask(msg){
console.log(msg);
this.taskvalue = msg;
this.getTake()
this.getRule(this.taskvalue,this.start_date,this.end_date,this.takevalue); // 获取统计数据
......@@ -29,7 +29,6 @@ new Vue({
changeTake(msg){
this.takevalue = msg;
this.getRule(this.taskvalue,this.start_date,this.end_date,this.takevalue); // 获取统计数据
console.log(msg);
},
getTask(){
let that = this;
......@@ -79,13 +78,12 @@ new Vue({
Charts(msg){
let msgLen = msg.length;
let msgArr = [];
let that = this;
for(let key in msg){
console.log(key) ;
console.log(msg[key]) ;
msgArr.unshift([msg[key].rule, msg[key].count])
msgArr.unshift([msg[key].rule, msg[key].count , msg[key].details])
}
let sourceArr = [
[ 'product', 'amount'],
[ 'product', 'amount', 'detail'],
].concat(msgArr);
var option = {
dataZoom : [
......@@ -162,7 +160,11 @@ new Vue({
};
var myChart = echarts.init(document.getElementById('main'));
myChart.setOption(option)
myChart.setOption(option);
myChart.on('click',function(msg){
that.tableData = msg.data[2];
that.dialogTableVisible = true;
})
if(msg.length == 0){
myChart.showLoading({
text: '暂无数据',
......@@ -185,7 +187,6 @@ new Vue({
let arr = [];
this.$loading({text:'数据加载中...'});
RquestsPost('api/v1/tasks/rule/',{task,start_date,end_date,agentName}).then(data => {
console.log(data.data);
if(data.code != 0){
that.$message(data.msg);
if(data.msg){
......@@ -206,9 +207,45 @@ new Vue({
that.Charts(data.data);
this.$loading().close();
})
},
formatSeconds(value) {
    var theTime = parseInt(value);// 秒
    var middle= 0;// 分
    var hour= 0;// 小时
    if(theTime > 60) {
        middle= parseInt(theTime/60);
        theTime = parseInt(theTime%60);
        if(middle> 60) {
            hour= parseInt(middle/60);
            middle= parseInt(middle%60);
        }
    }
    var result = ""+parseInt(theTime)+"";
    if(middle > 0) {
        result = ""+parseInt(middle)+""+result;
    }
    if(hour> 0) {
        result = ""+parseInt(hour)+"小时"+result;
    }
    return result;
},
dateFormat(date){
return date.getFullYear() + "-" + (date.getMonth()+1) + "-" + date.getDate();
},
handleTableDetail(index, msg){
console.log('hehhe')
console.log(msg);
let url = "/quality/audio/check-detail/"+msg.sessionCollectionId+"/"+msg.taskId+"?from=checkTask&sessionId=" + msg.sessionId;
let autoMessage = {
//id: msg.id
// sessionCollectionId: msg.sessionCollectionId,
// sessionId: msg.sessionId,
// taskId: msg.taskId
jumplink: url
};
console.log(autoMessage)
window.parent.postMessage(autoMessage,'*');
},
init(){
this.dateRange = [new Date(new Date()-24*60*60*1000), new Date()];
......@@ -217,7 +254,6 @@ new Vue({
this.getTask(); // 获取任务
//this.getTake(); // 获取坐席
console.log(this.dateRange);
this.getRule(this.taskvalue,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