Commit ab166ebc authored by lvshibao's avatar lvshibao

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

parent addb0f2d
......@@ -36,12 +36,14 @@ class TasksApi(viewsets.ViewSet):
return Response({'code': 0, 'msg': 'success', 'data': tasks})
@action(['get'], detail=False)
@get_account_info
def seat(self, req: Request):
"""
获取坐席列表
:param req:
:return:
"""
username = req.data.get('username', '')
task_id = req.GET.get('task', '')
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'))
......@@ -50,12 +52,14 @@ class TasksApi(viewsets.ViewSet):
session_condition = {'create_date__gte': q_start_date, 'create_date__lt': q_end_date}
if task_id:
session_condition['task'] = task_id
if username in name_list:
session_condition['task'] = username
seats = SeatStat.objects.filter(**session_condition).values('agentName')
return_data = []
for agent in seats:
if agent not in return_data:
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)
def rule(self, req: Request):
......@@ -405,12 +409,14 @@ class TasksApi(viewsets.ViewSet):
return Response({'code': 0, 'msg': 'success', 'count': total_count, 'data': return_data})
@action(['post'], detail=False)
@get_account_info
def seat_area(self, req: Request):
"""
地市坐席成绩分析
:param req:
:return:
"""
username = req.data.get('username', '')
task_id = req.data.get('task', '')
agent_name = req.data.get('agentName', '')
page = req.data.get('page', '1')
......@@ -423,6 +429,8 @@ class TasksApi(viewsets.ViewSet):
task_condition = {'create_date__gte': q_start_date, 'create_date__lt': q_end_date}
if task_id:
task_condition['task'] = task_id
if username in name_list:
task_condition['task'] = username
if agent_name:
task_condition['agentName'] = agent_name
# , 'total_session', 'validate_num', 'validate_session', 'validate_zero'
......
......@@ -16,7 +16,7 @@
display: inline-block;
}
#OneTime .el-input__icon {
line-height: 32px;
line-height: 32px;
}
#OneTime .el-input .el-input__inner {
padding-left: 30px;
......@@ -107,7 +107,7 @@
end-placeholder="结束日期"
:default-time="['00:00:00', '23:59:59']">
</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
v-for="item in taskList"
:key="item.id"
......
new Vue({
el: '#childApp',
data:function(){
return {
ss:'sas',
dateTime: '',
taskList:[],
taskvalue: '',
isscrollTop: false,
scrollTop: 0,
dateRange:[new Date(), new Date()],
start_date: '',
end_date:'',
takeList:[],
takevalue: '',
loading: true,
tableData: [],
poploading: false,
BASEURL: window_url,
start_date: '',
sortObj:{
name:'',
sort:'avg_score_bus',
},
currentPage:1,
page: 1,
page_size: 10,
pagesize: 10,
total: 10,
isHidePage: true,
dialogTableVisible: false,
poptableData: [],
popcurrentPage: 1,
poptables: '',
poppage: 1,
poppagesize: 10,
poptotal: 10,
poprule: '',
agentName: '',
}
},
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
el: '#childApp',
data: function () {
return {
ss: 'sas',
dateTime: '',
taskList: [],
taskvalue: '',
isscrollTop: false,
scrollTop: 0,
dateRange: [new Date(), new Date()],
start_date: '',
end_date: '',
takeList: [],
takevalue: '',
loading: true,
tableData: [],
poploading: false,
BASEURL: window_url,
start_date: '',
sortObj: {
name: '',
sort: 'avg_score_bus',
},
currentPage: 1,
page: 1,
page_size: 10,
pagesize: 10,
total: 10,
isHidePage: true,
dialogTableVisible: false,
poptableData: [],
popcurrentPage: 1,
poptables: '',
poppage: 1,
poppagesize: 10,
poptotal: 10,
poprule: '',
agentName: '',
sel_is_show: true,
}
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 => {
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]
}
}
mounted() {
window.addEventListener('scroll', this.scrollToTop)
},
dateFormat(date){
return date.getFullYear() + "-" + (date.getMonth()+1) + "-" + date.getDate();
},
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)
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) {
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则隐藏
scrollToTop () {
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);
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);
},
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); // 获取统计数据
if (data.code != 0) {
//that.takeList = [{agentName:'全部坐席'}]
} else {
that.takeList = data.data;
}
if (['合肥', '芜湖', '淮北', '安庆', '黄山', '滁州', '阜阳', '亳州', '宿州', '六安', '宣城', '巢湖', '池州', '淮南', '安徽省营业部', '蚌埠', '马鞍山', '铜陵'].indexOf(data.username) !== -1) {
that.sel_is_show = false;
that.taskvalue = data.username;
} else {
that.sel_is_show = true;
}
})
},
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) {
return date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate();
},
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)
},
// 为了计算距离顶部的高度,当高度大于60显示回顶部图标,小于60则隐藏
scrollToTop() {
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