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'
......
...@@ -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,
...@@ -37,85 +37,94 @@ new Vue({ ...@@ -37,85 +37,94 @@ new Vue({
poptotal: 10, poptotal: 10,
poprule: '', poprule: '',
agentName: '', agentName: '',
sel_is_show: true,
} }
}, },
mounted () { mounted() {
window.addEventListener('scroll', this.scrollToTop) window.addEventListener('scroll', this.scrollToTop)
}, },
destroyed () { destroyed() {
window.removeEventListener('scroll', this.scrollToTop) window.removeEventListener('scroll', this.scrollToTop)
}, },
methods: { methods: {
loadData(){ loadData() {
this.$refs.loadModal.submit(); this.$refs.loadModal.submit();
this.$message('文件下载中请稍后...'); this.$message('文件下载中请稍后...');
}, },
sortChange(item){ sortChange(item) {
console.log(item); console.log(item);
let order; let order;
if(item.order == 'descending'){ if (item.order == 'descending') {
order = item.prop; order = item.prop;
}else if(item.order == 'ascending'){ } else if (item.order == 'ascending') {
order = '-' + item.prop; order = '-' + item.prop;
}else{ } else {
order = null; order = null;
} }
this.sortObj = { this.sortObj = {
name: item.prop, name: item.prop,
sort: order sort: order
} }
this.getRule(this.taskvalue,this.start_date,this.end_date,this.takevalue,this.page,this.page_size); // 获取统计数据 this.getRule(this.taskvalue, this.start_date, this.end_date, this.takevalue, this.page, this.page_size); // 获取统计数据
}, },
changeRange(dateRange){ changeRange(dateRange) {
this.start_date = dateRange[0]; this.start_date = dateRange[0];
this.end_date = dateRange[1]; this.end_date = dateRange[1];
this.page = 1; this.page = 1;
this.getRule(this.taskvalue,this.start_date,this.end_date,this.takevalue,this.page,this.page_size); // 获取统计数据 this.getRule(this.taskvalue, this.start_date, this.end_date, this.takevalue, this.page, this.page_size); // 获取统计数据
}, },
changeTask(msg){ changeTask(msg) {
this.taskvalue = msg; this.taskvalue = msg;
this.getTake() this.getTake()
this.page = 1; this.page = 1;
this.getRule(this.taskvalue,this.start_date,this.end_date,this.takevalue,this.page,this.page_size); // 获取统计数据 this.getRule(this.taskvalue, this.start_date, this.end_date, this.takevalue, this.page, this.page_size); // 获取统计数据
}, },
changeTake(msg){ changeTake(msg) {
this.takevalue = msg; this.takevalue = msg;
this.page = 1; this.page = 1;
this.getRule(this.taskvalue,this.start_date,this.end_date,this.takevalue,this.page,this.page_size); // 获取统计数据 this.getRule(this.taskvalue, this.start_date, this.end_date, this.takevalue, this.page, this.page_size); // 获取统计数据
}, },
getTask(){ getTask() {
let that = this; let that = this;
that.taskList = [ 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:'黄山'}, {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){ getRule(task, start_date, end_date, agentName, page, page_size) {
let that = this; let that = this;
// 获取表格数据 // 获取表格数据
let sort = this.sortObj.sort; let sort = this.sortObj.sort;
this.$loading({text:'数据加载中...'}); this.$loading({text: '数据加载中...'});
RquestsPost('api/v1/tasks/seat_area/',{task,start_date,end_date,agentName,page,page_size,sort}).then(data => { RquestsPost('api/v1/tasks/seat_area/', {
task,
start_date,
end_date,
agentName,
page,
page_size,
sort
}).then(data => {
if(data.code != 0){ if (data.code != 0) {
}else{ } else {
that.tableData = data.data; that.tableData = data.data;
this.total = data.count; this.total = data.count;
this.isHidePage = !(data.data.length > 0); this.isHidePage = !(data.data.length > 0);
...@@ -123,19 +132,27 @@ new Vue({ ...@@ -123,19 +132,27 @@ new Vue({
that.$loading().close(); that.$loading().close();
}) })
}, },
getTake(){ getTake() {
let that = this; let that = this;
RquestsGet('api/v1/tasks/seat/?task=' + that.taskvalue+'&start_date='+this.start_date+'&end_date='+this.end_date).then(data => { RquestsGet('api/v1/tasks/seat/?task=' + that.taskvalue + '&start_date=' + this.start_date + '&end_date=' + this.end_date).then(data => {
//console.log(data); //console.log(data);
if(data.code != 0){ if (data.code != 0) {
//that.takeList = [{agentName:'全部坐席'}] //that.takeList = [{agentName:'全部坐席'}]
}else{ } else {
that.takeList = data.data; 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 }) { arraySpanMethod({row, column, rowIndex, columnIndex}) {
if (rowIndex === 0 || rowIndex === 1) { // 在这里多加一个行的判断就行 if (rowIndex === 0 || rowIndex === 1) { // 在这里多加一个行的判断就行
// 合并第二行 // 合并第二行
if (columnIndex === 0) { if (columnIndex === 0) {
...@@ -146,10 +163,10 @@ new Vue({ ...@@ -146,10 +163,10 @@ new Vue({
} }
} }
}, },
dateFormat(date){ dateFormat(date) {
return date.getFullYear() + "-" + (date.getMonth()+1) + "-" + date.getDate(); return date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate();
}, },
backTop () { backTop() {
const that = this const that = this
let timer = setInterval(() => { let timer = setInterval(() => {
let ispeed = Math.floor(-that.scrollTop / 5) let ispeed = Math.floor(-that.scrollTop / 5)
...@@ -161,7 +178,7 @@ new Vue({ ...@@ -161,7 +178,7 @@ new Vue({
}, },
// 为了计算距离顶部的高度,当高度大于60显示回顶部图标,小于60则隐藏 // 为了计算距离顶部的高度,当高度大于60显示回顶部图标,小于60则隐藏
scrollToTop () { scrollToTop() {
const that = this const that = this
let scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop let scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop
that.scrollTop = scrollTop that.scrollTop = scrollTop
...@@ -171,34 +188,43 @@ new Vue({ ...@@ -171,34 +188,43 @@ new Vue({
that.isscrollTop = false that.isscrollTop = false
} }
}, },
CurrentChange(page){ CurrentChange(page) {
this.currentPage = page; this.currentPage = page;
this.page = page; this.page = page;
this.getRule(this.taskvalue,this.start_date,this.end_date,this.takevalue,this.page,this.page_size); // 获取统计数据 this.getRule(this.taskvalue, this.start_date, this.end_date, this.takevalue, this.page, this.page_size); // 获取统计数据
}, },
rowDetail(index,tableData){ rowDetail(index, tableData) {
this.agentName = tableData.agentName; this.agentName = tableData.agentName;
this.taskvalue = tableData.area; this.taskvalue = tableData.area;
this.getDetail(this.taskvalue,this.start_date,this.end_date,this.poptables,this.poprule, this.poppage, this.poppagesize, this.agentName); this.getDetail(this.taskvalue, this.start_date, this.end_date, this.poptables, this.poprule, this.poppage, this.poppagesize, this.agentName);
}, },
popCurrentChange(page){ popCurrentChange(page) {
this.poppage = page; this.poppage = page;
this.getDetail(this.taskvalue,this.start_date,this.end_date,this.poptables,this.poprule, this.poppage, this.poppagesize, this.agentName); 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){ getDetail(task, start_date, end_date, tables, rule, page, page_size, agentName) {
let that = this; let that = this;
this.$loading({text:'数据加载中...'}); this.$loading({text: '数据加载中...'});
this.poploading = true; this.poploading = true;
RquestsPost('api/v1/tasks/score_detail/',{task,end_date,start_date,tables,rule,page,page_size, agentName}).then(data => { RquestsPost('api/v1/tasks/score_detail/', {
task,
end_date,
start_date,
tables,
rule,
page,
page_size,
agentName
}).then(data => {
console.log(data.data); console.log(data.data);
this.dialogTableVisible = true; this.dialogTableVisible = true;
this.$loading().close(); this.$loading().close();
if(data.code != 0){ if (data.code != 0) {
that.$message(data.msg); that.$message(data.msg);
if(data.msg){ if (data.msg) {
that.$message(data.msg); that.$message(data.msg);
}else{ } else {
that.$message('服务器错误') that.$message('服务器错误')
} }
} }
...@@ -209,26 +235,26 @@ new Vue({ ...@@ -209,26 +235,26 @@ new Vue({
this.poploading = false; 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;
console.log(url); console.log(url);
let autoMessage = { let autoMessage = {
jumplink: url jumplink: url
}; };
window.parent.postMessage(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));
this.end_date = this.dateFormat(new Date()); this.end_date = this.dateFormat(new Date());
this.getTask(); // 获取任务 this.getTask(); // 获取任务
this.getTake(); // 获取坐席 this.getTake(); // 获取坐席
this.getRule(this.taskvalue,this.start_date,this.end_date,this.takevalue,this.page,this.page_size); // 获取统计数据 this.getRule(this.taskvalue, this.start_date, this.end_date, this.takevalue, this.page, this.page_size); // 获取统计数据
} }
}, },
created(){ created() {
this.init() 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