Commit ab166ebc authored by lvshibao's avatar lvshibao

数据分析-地市质检成绩分析

parent addb0f2d
...@@ -36,12 +36,14 @@ class TasksApi(viewsets.ViewSet): ...@@ -36,12 +36,14 @@ class TasksApi(viewsets.ViewSet):
return Response({'code': 0, 'msg': 'success', 'data': tasks}) return Response({'code': 0, 'msg': 'success', 'data': tasks})
@action(['get'], detail=False) @action(['get'], detail=False)
@get_account_info
def seat(self, req: Request): def seat(self, req: Request):
""" """
获取坐席列表 获取坐席列表
:param req: :param req:
:return: :return:
""" """
username = req.data.get('username', '')
task_id = req.GET.get('task', '') task_id = req.GET.get('task', '')
start_date = req.GET.get('start_date', (datetime.now() + timedelta(days=-1)).strftime('%Y-%m-%d')) start_date = req.GET.get('start_date', (datetime.now() + timedelta(days=-1)).strftime('%Y-%m-%d'))
end_date = req.GET.get('end_date', datetime.now().strftime('%Y-%m-%d')) end_date = req.GET.get('end_date', datetime.now().strftime('%Y-%m-%d'))
...@@ -50,12 +52,14 @@ class TasksApi(viewsets.ViewSet): ...@@ -50,12 +52,14 @@ class TasksApi(viewsets.ViewSet):
session_condition = {'create_date__gte': q_start_date, 'create_date__lt': q_end_date} session_condition = {'create_date__gte': q_start_date, 'create_date__lt': q_end_date}
if task_id: if task_id:
session_condition['task'] = task_id session_condition['task'] = task_id
if username in name_list:
session_condition['task'] = username
seats = SeatStat.objects.filter(**session_condition).values('agentName') seats = SeatStat.objects.filter(**session_condition).values('agentName')
return_data = [] return_data = []
for agent in seats: for agent in seats:
if agent not in return_data: if agent not in return_data:
return_data.append(agent) return_data.append(agent)
return Response({'code': 0, 'msg': 'success', 'data': return_data}) return Response({'code': 0, 'msg': 'success', 'data': return_data, 'username': username})
@action(['post'], detail=False) @action(['post'], detail=False)
def rule(self, req: Request): def rule(self, req: Request):
...@@ -405,12 +409,14 @@ class TasksApi(viewsets.ViewSet): ...@@ -405,12 +409,14 @@ class TasksApi(viewsets.ViewSet):
return Response({'code': 0, 'msg': 'success', 'count': total_count, 'data': return_data}) return Response({'code': 0, 'msg': 'success', 'count': total_count, 'data': return_data})
@action(['post'], detail=False) @action(['post'], detail=False)
@get_account_info
def seat_area(self, req: Request): def seat_area(self, req: Request):
""" """
地市坐席成绩分析 地市坐席成绩分析
:param req: :param req:
:return: :return:
""" """
username = req.data.get('username', '')
task_id = req.data.get('task', '') task_id = req.data.get('task', '')
agent_name = req.data.get('agentName', '') agent_name = req.data.get('agentName', '')
page = req.data.get('page', '1') page = req.data.get('page', '1')
...@@ -423,6 +429,8 @@ class TasksApi(viewsets.ViewSet): ...@@ -423,6 +429,8 @@ class TasksApi(viewsets.ViewSet):
task_condition = {'create_date__gte': q_start_date, 'create_date__lt': q_end_date} task_condition = {'create_date__gte': q_start_date, 'create_date__lt': q_end_date}
if task_id: if task_id:
task_condition['task'] = task_id task_condition['task'] = task_id
if username in name_list:
task_condition['task'] = username
if agent_name: if agent_name:
task_condition['agentName'] = agent_name task_condition['agentName'] = agent_name
# , 'total_session', 'validate_num', 'validate_session', 'validate_zero' # , 'total_session', 'validate_num', 'validate_session', 'validate_zero'
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
display: inline-block; display: inline-block;
} }
#OneTime .el-input__icon { #OneTime .el-input__icon {
line-height: 32px; line-height: 32px;
} }
#OneTime .el-input .el-input__inner { #OneTime .el-input .el-input__inner {
padding-left: 30px; padding-left: 30px;
...@@ -107,7 +107,7 @@ ...@@ -107,7 +107,7 @@
end-placeholder="结束日期" end-placeholder="结束日期"
:default-time="['00:00:00', '23:59:59']"> :default-time="['00:00:00', '23:59:59']">
</el-date-picker> </el-date-picker>
<el-select v-model="taskvalue" filterable placeholder="请选择" @change="changeTask"> <el-select v-if="sel_is_show == true" v-model="taskvalue" filterable placeholder="请选择" @change="changeTask">
<el-option <el-option
v-for="item in taskList" v-for="item in taskList"
:key="item.id" :key="item.id"
......
new Vue({ new Vue({
el: '#childApp', el: '#childApp',
data:function(){ data: function () {
return { return {
ss:'sas', ss: 'sas',
dateTime: '', dateTime: '',
taskList:[], taskList: [],
taskvalue: '', taskvalue: '',
isscrollTop: false, isscrollTop: false,
scrollTop: 0, scrollTop: 0,
dateRange:[new Date(), new Date()], dateRange: [new Date(), new Date()],
start_date: '', start_date: '',
end_date:'', end_date: '',
takeList:[], takeList: [],
takevalue: '', takevalue: '',
loading: true, loading: true,
tableData: [], tableData: [],
poploading: false, poploading: false,
BASEURL: window_url, BASEURL: window_url,
start_date: '', start_date: '',
sortObj:{ sortObj: {
name:'', name: '',
sort:'avg_score_bus', sort: 'avg_score_bus',
}, },
currentPage:1, currentPage: 1,
page: 1, page: 1,
page_size: 10, page_size: 10,
pagesize: 10, pagesize: 10,
total: 10, total: 10,
isHidePage: true, isHidePage: true,
dialogTableVisible: false, dialogTableVisible: false,
poptableData: [], poptableData: [],
popcurrentPage: 1, popcurrentPage: 1,
poptables: '', poptables: '',
poppage: 1, poppage: 1,
poppagesize: 10, poppagesize: 10,
poptotal: 10, poptotal: 10,
poprule: '', poprule: '',
agentName: '', agentName: '',
} sel_is_show: true,
},
mounted () {
window.addEventListener('scroll', this.scrollToTop)
},
destroyed () {
window.removeEventListener('scroll', this.scrollToTop)
},
methods: {
loadData(){
this.$refs.loadModal.submit();
this.$message('文件下载中请稍后...');
},
sortChange(item){
console.log(item);
let order;
if(item.order == 'descending'){
order = item.prop;
}else if(item.order == 'ascending'){
order = '-' + item.prop;
}else{
order = null;
}
this.sortObj = {
name: item.prop,
sort: order
} }
this.getRule(this.taskvalue,this.start_date,this.end_date,this.takevalue,this.page,this.page_size); // 获取统计数据
}, },
changeRange(dateRange){ mounted() {
this.start_date = dateRange[0]; window.addEventListener('scroll', this.scrollToTop)
this.end_date = dateRange[1];
this.page = 1;
this.getRule(this.taskvalue,this.start_date,this.end_date,this.takevalue,this.page,this.page_size); // 获取统计数据
},
changeTask(msg){
this.taskvalue = msg;
this.getTake()
this.page = 1;
this.getRule(this.taskvalue,this.start_date,this.end_date,this.takevalue,this.page,this.page_size); // 获取统计数据
},
changeTake(msg){
this.takevalue = msg;
this.page = 1;
this.getRule(this.taskvalue,this.start_date,this.end_date,this.takevalue,this.page,this.page_size); // 获取统计数据
},
getTask(){
let that = this;
that.taskList = [
{id:'',name:'全省'},
{id:'合肥',name:'合肥'},
{id:'芜湖',name:'芜湖'},
{id:'蚌埠',name:'蚌埠'},
{id:'淮南',name:'淮南'},
{id:'马鞍山',name:'马鞍山'},
{id:'淮北',name:'淮北'},
{id:'铜陵',name:'铜陵'},
{id:'安庆',name:'安庆'},
{id:'黄山',name:'黄山'},
{id:'滁州',name:'滁州'},
{id:'阜阳',name:'阜阳'},
{id:'亳州',name:'亳州'},
{id:'宿州',name:'宿州'},
{id:'六安',name:'六安'},
{id:'宣城',name:'宣城'},
{id:'巢湖',name:'巢湖'},
{id:'池州',name:'池州'},
{id:'安徽省营业部',name:'安徽省营业部'},
];
},
getRule(task,start_date,end_date,agentName,page,page_size){
let that = this;
// 获取表格数据
let sort = this.sortObj.sort;
this.$loading({text:'数据加载中...'});
RquestsPost('api/v1/tasks/seat_area/',{task,start_date,end_date,agentName,page,page_size,sort}).then(data => {
if(data.code != 0){
}else{
that.tableData = data.data;
this.total = data.count;
this.isHidePage = !(data.data.length > 0);
}
that.$loading().close();
})
},
getTake(){
let that = this;
RquestsGet('api/v1/tasks/seat/?task=' + that.taskvalue+'&start_date='+this.start_date+'&end_date='+this.end_date).then(data => {
//console.log(data);
if(data.code != 0){
//that.takeList = [{agentName:'全部坐席'}]
}else{
that.takeList = data.data;
}
})
},
arraySpanMethod({ row, column, rowIndex, columnIndex }) {
if (rowIndex === 0 || rowIndex === 1) { // 在这里多加一个行的判断就行
// 合并第二行
if (columnIndex === 0) {
// 从第二列开始
return [1, 6]
} else if (columnIndex === 2 || columnIndex === 3 || columnIndex === 4 || columnIndex === 5 || columnIndex === 6) {
return [0, 0]
}
}
}, },
dateFormat(date){ destroyed() {
return date.getFullYear() + "-" + (date.getMonth()+1) + "-" + date.getDate(); window.removeEventListener('scroll', this.scrollToTop)
},
backTop () {
const that = this
let timer = setInterval(() => {
let ispeed = Math.floor(-that.scrollTop / 5)
document.documentElement.scrollTop = document.body.scrollTop = that.scrollTop + ispeed
if (that.scrollTop === 0) {
clearInterval(timer)
}
}, 16)
}, },
methods: {
loadData() {
this.$refs.loadModal.submit();
this.$message('文件下载中请稍后...');
},
sortChange(item) {
console.log(item);
let order;
if (item.order == 'descending') {
order = item.prop;
} else if (item.order == 'ascending') {
order = '-' + item.prop;
} else {
order = null;
}
this.sortObj = {
name: item.prop,
sort: order
}
this.getRule(this.taskvalue, this.start_date, this.end_date, this.takevalue, this.page, this.page_size); // 获取统计数据
},
changeRange(dateRange) {
this.start_date = dateRange[0];
this.end_date = dateRange[1];
this.page = 1;
this.getRule(this.taskvalue, this.start_date, this.end_date, this.takevalue, this.page, this.page_size); // 获取统计数据
},
changeTask(msg) {
this.taskvalue = msg;
this.getTake()
this.page = 1;
this.getRule(this.taskvalue, this.start_date, this.end_date, this.takevalue, this.page, this.page_size); // 获取统计数据
},
changeTake(msg) {
this.takevalue = msg;
this.page = 1;
this.getRule(this.taskvalue, this.start_date, this.end_date, this.takevalue, this.page, this.page_size); // 获取统计数据
},
getTask() {
let that = this;
that.taskList = [
{id: '', name: '全省'},
{id: '合肥', name: '合肥'},
{id: '芜湖', name: '芜湖'},
{id: '蚌埠', name: '蚌埠'},
{id: '淮南', name: '淮南'},
{id: '马鞍山', name: '马鞍山'},
{id: '淮北', name: '淮北'},
{id: '铜陵', name: '铜陵'},
{id: '安庆', name: '安庆'},
{id: '黄山', name: '黄山'},
{id: '滁州', name: '滁州'},
{id: '阜阳', name: '阜阳'},
{id: '亳州', name: '亳州'},
{id: '宿州', name: '宿州'},
{id: '六安', name: '六安'},
{id: '宣城', name: '宣城'},
{id: '巢湖', name: '巢湖'},
{id: '池州', name: '池州'},
{id: '安徽省营业部', name: '安徽省营业部'},
];
},
getRule(task, start_date, end_date, agentName, page, page_size) {
let that = this;
// 获取表格数据
let sort = this.sortObj.sort;
this.$loading({text: '数据加载中...'});
RquestsPost('api/v1/tasks/seat_area/', {
task,
start_date,
end_date,
agentName,
page,
page_size,
sort
}).then(data => {
// 为了计算距离顶部的高度,当高度大于60显示回顶部图标,小于60则隐藏 if (data.code != 0) {
scrollToTop () { } else {
const that = this that.tableData = data.data;
let scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop this.total = data.count;
that.scrollTop = scrollTop this.isHidePage = !(data.data.length > 0);
if (that.scrollTop > 60) { }
that.isscrollTop = true that.$loading().close();
} else { })
that.isscrollTop = false },
} getTake() {
}, let that = this;
CurrentChange(page){ RquestsGet('api/v1/tasks/seat/?task=' + that.taskvalue + '&start_date=' + this.start_date + '&end_date=' + this.end_date).then(data => {
this.currentPage = page; //console.log(data);
this.page = page;
this.getRule(this.taskvalue,this.start_date,this.end_date,this.takevalue,this.page,this.page_size); // 获取统计数据
},
rowDetail(index,tableData){
this.agentName = tableData.agentName;
this.taskvalue = tableData.area;
this.getDetail(this.taskvalue,this.start_date,this.end_date,this.poptables,this.poprule, this.poppage, this.poppagesize, this.agentName);
}, if (data.code != 0) {
popCurrentChange(page){ //that.takeList = [{agentName:'全部坐席'}]
this.poppage = page; } else {
this.getDetail(this.taskvalue,this.start_date,this.end_date,this.poptables,this.poprule, this.poppage, this.poppagesize, this.agentName); that.takeList = data.data;
}, }
getDetail(task,start_date,end_date, tables, rule, page, page_size, agentName){
let that = this; if (['合肥', '芜湖', '淮北', '安庆', '黄山', '滁州', '阜阳', '亳州', '宿州', '六安', '宣城', '巢湖', '池州', '淮南', '安徽省营业部', '蚌埠', '马鞍山', '铜陵'].indexOf(data.username) !== -1) {
this.$loading({text:'数据加载中...'}); that.sel_is_show = false;
this.poploading = true; that.taskvalue = data.username;
RquestsPost('api/v1/tasks/score_detail/',{task,end_date,start_date,tables,rule,page,page_size, agentName}).then(data => { } else {
console.log(data.data); that.sel_is_show = true;
this.dialogTableVisible = true; }
this.$loading().close();
if(data.code != 0){ })
that.$message(data.msg); },
if(data.msg){ arraySpanMethod({row, column, rowIndex, columnIndex}) {
that.$message(data.msg); if (rowIndex === 0 || rowIndex === 1) { // 在这里多加一个行的判断就行
}else{ // 合并第二行
that.$message('服务器错误') if (columnIndex === 0) {
} // 从第二列开始
} return [1, 6]
//that.titleInfo = data.data; } else if (columnIndex === 2 || columnIndex === 3 || columnIndex === 4 || columnIndex === 5 || columnIndex === 6) {
that.poptotal = data.count; return [0, 0]
that.poptableData = data.data; }
//this.$loading().close(); }
this.poploading = false; },
}) dateFormat(date) {
}, return date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate();
handleTableDetail(index, msg){ },
let url = "/quality/audio/check-detail/"+msg.sessionCollectionId+"/"+msg.taskId+"?from=checkTask&sessionId=" + msg.sessionId; backTop() {
console.log(url); const that = this
let autoMessage = { let timer = setInterval(() => {
jumplink: url let ispeed = Math.floor(-that.scrollTop / 5)
}; document.documentElement.scrollTop = document.body.scrollTop = that.scrollTop + ispeed
window.parent.postMessage(autoMessage,'*'); if (that.scrollTop === 0) {
}, clearInterval(timer)
init(){ }
this.dateRange = [new Date(new Date()-24*60*60*1000), new Date()]; }, 16)
this.start_date = this.dateFormat(new Date(new Date()-24*60*60*1000)); },
this.end_date = this.dateFormat(new Date());
this.getTask(); // 获取任务 // 为了计算距离顶部的高度,当高度大于60显示回顶部图标,小于60则隐藏
this.getTake(); // 获取坐席 scrollToTop() {
this.getRule(this.taskvalue,this.start_date,this.end_date,this.takevalue,this.page,this.page_size); // 获取统计数据 const that = this
let scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop
that.scrollTop = scrollTop
if (that.scrollTop > 60) {
that.isscrollTop = true
} else {
that.isscrollTop = false
}
},
CurrentChange(page) {
this.currentPage = page;
this.page = page;
this.getRule(this.taskvalue, this.start_date, this.end_date, this.takevalue, this.page, this.page_size); // 获取统计数据
},
rowDetail(index, tableData) {
this.agentName = tableData.agentName;
this.taskvalue = tableData.area;
this.getDetail(this.taskvalue, this.start_date, this.end_date, this.poptables, this.poprule, this.poppage, this.poppagesize, this.agentName);
},
popCurrentChange(page) {
this.poppage = page;
this.getDetail(this.taskvalue, this.start_date, this.end_date, this.poptables, this.poprule, this.poppage, this.poppagesize, this.agentName);
},
getDetail(task, start_date, end_date, tables, rule, page, page_size, agentName) {
let that = this;
this.$loading({text: '数据加载中...'});
this.poploading = true;
RquestsPost('api/v1/tasks/score_detail/', {
task,
end_date,
start_date,
tables,
rule,
page,
page_size,
agentName
}).then(data => {
console.log(data.data);
this.dialogTableVisible = true;
this.$loading().close();
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) {
let url = "/quality/audio/check-detail/" + msg.sessionCollectionId + "/" + msg.taskId + "?from=checkTask&sessionId=" + msg.sessionId;
console.log(url);
let autoMessage = {
jumplink: url
};
window.parent.postMessage(autoMessage, '*');
},
init() {
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.end_date = this.dateFormat(new Date());
this.getTask(); // 获取任务
this.getTake(); // 获取坐席
this.getRule(this.taskvalue, this.start_date, this.end_date, this.takevalue, this.page, this.page_size); // 获取统计数据
}
}, }
created(){ },
this.init() created() {
}, this.init()
},
}) })
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