Commit 02673992 authored by zhengjinlei's avatar zhengjinlei

跳转详情

parent 414a0598
...@@ -100,10 +100,14 @@ class TasksApi(viewsets.ViewSet): ...@@ -100,10 +100,14 @@ class TasksApi(viewsets.ViewSet):
session_condition = {'taskId__in': v} session_condition = {'taskId__in': v}
if agent_name: if agent_name:
session_condition['agentName'] = 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') # checks = tn.objects.filter(**session_condition).values('id', 'checkResult')
for check in checks: for check in checks:
result = check['checkResult'] 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'] # session_id = check['id']
if result: if result:
data = json.loads(result) data = json.loads(result)
...@@ -112,9 +116,10 @@ class TasksApi(viewsets.ViewSet): ...@@ -112,9 +116,10 @@ class TasksApi(viewsets.ViewSet):
name = d['rule']['name'] name = d['rule']['name']
if name in return_data.keys(): if name in return_data.keys():
return_data[name]['count'] += 1 return_data[name]['count'] += 1
return_data[name]['details'].append(detail)
# return_data[name]['ids'].append(session_id) # return_data[name]['ids'].append(session_id)
else: else:
return_data[name] = {'count': 1} return_data[name] = {'count': 1, 'details': [detail, ]}
# return_data[name] = {'count': 1, 'ids': [session_id, ]} # return_data[name] = {'count': 1, 'ids': [session_id, ]}
data_sort = [] data_sort = []
for k, v in return_data.items(): for k, v in return_data.items():
......
...@@ -50,6 +50,24 @@ ...@@ -50,6 +50,24 @@
</el-select> </el-select>
</div> </div>
<div id='main' style='width:80%;height:600px' v-loading='true'></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> </div>
<script type="text/javascript"> <script type="text/javascript">
window.onload = function(){ window.onload = function(){
......
...@@ -8,20 +8,20 @@ new Vue({ ...@@ -8,20 +8,20 @@ new Vue({
taskvalue: '', taskvalue: '',
start_date: '', start_date: '',
end_date:'', end_date:'',
dialogTableVisible: false,
takeList:[], takeList:[],
takevalue: '', takevalue: '',
loading: true, loading: true,
tableData: [],
} }
}, },
methods: { methods: {
changeRange(dateRange){ changeRange(dateRange){
console.log(dateRange);
this.start_date = dateRange[0]; this.start_date = dateRange[0];
this.end_date = dateRange[1]; this.end_date = dateRange[1];
this.getRule(this.taskvalue,this.start_date,this.end_date,this.takevalue); // 获取统计数据 this.getRule(this.taskvalue,this.start_date,this.end_date,this.takevalue); // 获取统计数据
}, },
changeTask(msg){ changeTask(msg){
console.log(msg);
this.taskvalue = msg; this.taskvalue = msg;
this.getTake() this.getTake()
this.getRule(this.taskvalue,this.start_date,this.end_date,this.takevalue); // 获取统计数据 this.getRule(this.taskvalue,this.start_date,this.end_date,this.takevalue); // 获取统计数据
...@@ -29,7 +29,6 @@ new Vue({ ...@@ -29,7 +29,6 @@ new Vue({
changeTake(msg){ changeTake(msg){
this.takevalue = msg; this.takevalue = msg;
this.getRule(this.taskvalue,this.start_date,this.end_date,this.takevalue); // 获取统计数据 this.getRule(this.taskvalue,this.start_date,this.end_date,this.takevalue); // 获取统计数据
console.log(msg);
}, },
getTask(){ getTask(){
let that = this; let that = this;
...@@ -79,13 +78,12 @@ new Vue({ ...@@ -79,13 +78,12 @@ new Vue({
Charts(msg){ Charts(msg){
let msgLen = msg.length; let msgLen = msg.length;
let msgArr = []; let msgArr = [];
let that = this;
for(let key in msg){ for(let key in msg){
console.log(key) ; msgArr.unshift([msg[key].rule, msg[key].count , msg[key].details])
console.log(msg[key]) ;
msgArr.unshift([msg[key].rule, msg[key].count])
} }
let sourceArr = [ let sourceArr = [
[ 'product', 'amount'], [ 'product', 'amount', 'detail'],
].concat(msgArr); ].concat(msgArr);
var option = { var option = {
dataZoom : [ dataZoom : [
...@@ -162,7 +160,11 @@ new Vue({ ...@@ -162,7 +160,11 @@ new Vue({
}; };
var myChart = echarts.init(document.getElementById('main')); 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){ if(msg.length == 0){
myChart.showLoading({ myChart.showLoading({
text: '暂无数据', text: '暂无数据',
...@@ -185,7 +187,6 @@ new Vue({ ...@@ -185,7 +187,6 @@ new Vue({
let arr = []; let arr = [];
this.$loading({text:'数据加载中...'}); this.$loading({text:'数据加载中...'});
RquestsPost('api/v1/tasks/rule/',{task,start_date,end_date,agentName}).then(data => { RquestsPost('api/v1/tasks/rule/',{task,start_date,end_date,agentName}).then(data => {
console.log(data.data);
if(data.code != 0){ if(data.code != 0){
that.$message(data.msg); that.$message(data.msg);
if(data.msg){ if(data.msg){
...@@ -206,10 +207,46 @@ new Vue({ ...@@ -206,10 +207,46 @@ new Vue({
that.Charts(data.data); that.Charts(data.data);
this.$loading().close(); 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){ dateFormat(date){
return date.getFullYear() + "-" + (date.getMonth()+1) + "-" + date.getDate(); 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(){ init(){
this.dateRange = [new Date(new Date()-24*60*60*1000), new Date()]; this.dateRange = [new Date(new Date()-24*60*60*1000), new Date()];
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));
...@@ -217,7 +254,6 @@ new Vue({ ...@@ -217,7 +254,6 @@ new Vue({
this.getTask(); // 获取任务 this.getTask(); // 获取任务
//this.getTake(); // 获取坐席 //this.getTake(); // 获取坐席
console.log(this.dateRange);
this.getRule(this.taskvalue,this.start_date,this.end_date,this.takevalue); // 获取统计数据 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