Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
inspect_report
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhengjinlei
inspect_report
Commits
75e0ac77
Commit
75e0ac77
authored
Dec 12, 2019
by
zhengjinlei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
分页查询
parent
7abc3100
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
46 additions
and
49 deletions
+46
-49
tasksapi.py
src/inspect_report/api/tasksapi.py
+24
-35
score.html
src/inspect_report/templates/inspect/score.html
+3
-3
all.js
static/inspect/js/all.js
+4
-4
score.js
static/inspect/js/score.js
+15
-7
No files found.
src/inspect_report/api/tasksapi.py
View file @
75e0ac77
# coding: utf-8
from
django.shortcuts
import
render
from
django.db.models
import
Count
,
Sum
from
django.db.models
import
Count
,
Sum
,
Avg
from
rest_framework
import
viewsets
from
rest_framework.decorators
import
action
from
rest_framework.request
import
Request
...
...
@@ -460,7 +460,7 @@ class TasksApi(viewsets.ViewSet):
f_name
=
extra
[
'filename'
]
if
extra
and
'filename'
in
extra
.
keys
()
else
''
detail
=
{
'id'
:
check
[
'id'
],
'sessionId'
:
check
[
'sessionId'
],
'createdAt'
:
check
[
'createdAt'
],
'area'
:
t_name
.
split
(
'_'
)[
0
],
'agentName'
:
check
[
'agentName'
],
'filename'
:
f_name
,
'remainTime'
:
check
[
'remainTime'
]}
'remainTime'
:
check
[
'remainTime'
]
,
'sessionCollectionId'
:
k
,
'taskId'
:
check
[
'taskId'
]
}
rule_detail
=
{
'fwyy'
:
10
,
'kcb'
:
10
,
'jsy'
:
5
,
'fwtd'
:
10
,
'yssb'
:
5
,
'jysb'
:
5
,
'yycl'
:
10
,
'ywcc'
:
15
,
'yyjlz'
:
15
,
'fwjs'
:
5
,
'wtgbj'
:
5
,
'wzyhfljs'
:
5
,
'wgzlf'
:
100
,
'mgc'
:
100
}
if
result
:
...
...
@@ -494,40 +494,30 @@ class TasksApi(viewsets.ViewSet):
"""
task_id
=
req
.
data
.
get
(
'task'
,
''
)
agent_name
=
req
.
data
.
get
(
'agentName'
,
''
)
page
=
req
.
data
.
get
(
'page'
,
'1'
)
page_size
=
req
.
data
.
get
(
'page_size'
,
'10'
)
start_date
=
req
.
data
.
get
(
'start_date'
,
(
datetime
.
now
()
+
timedelta
(
days
=-
1
))
.
strftime
(
'
%
Y-
%
m-
%
d'
))
end_date
=
req
.
data
.
get
(
'end_date'
,
datetime
.
now
()
.
strftime
(
'
%
Y-
%
m-
%
d'
))
task_condition
=
{
'hasCheck'
:
1
,
'createdAt__gte'
:
start_date
,
'createdAt__lt'
:
end_date
+
' 23:59:59'
}
q_start_date
=
datetime
.
strptime
(
start_date
,
'
%
Y-
%
m-
%
d'
)
.
date
()
q_end_date
=
(
datetime
.
strptime
(
end_date
,
'
%
Y-
%
m-
%
d'
)
+
+
timedelta
(
days
=
1
))
.
date
()
task_condition
=
{
'create_date__gte'
:
q_start_date
,
'create_date__lt'
:
q_end_date
}
if
task_id
:
task_condition
[
'name__startswith'
]
=
task_id
tasks
=
Tasks
.
objects
.
filter
(
**
task_condition
)
.
values
(
'id'
,
'name'
,
'sessionCollectionId'
)
task_dict
=
{}
task_name_dict
=
{}
for
t
in
tasks
:
task_name_dict
[
t
[
'id'
]]
=
t
[
'name'
]
if
t
[
'sessionCollectionId'
]
in
task_dict
.
keys
():
task_dict
[
t
[
'sessionCollectionId'
]]
.
append
(
t
[
'id'
])
else
:
task_dict
[
t
[
'sessionCollectionId'
]]
=
[
t
[
'id'
],
]
return_data
=
[]
detail
=
{}
for
k
,
v
in
task_dict
.
items
():
table_name
=
TABLE_PRE
+
k
tn
=
CheckSession
.
set_table
(
table_name
)
session_condition
=
{
'taskId__in'
:
v
}
if
agent_name
:
session_condition
[
'agentName'
]
=
agent_name
checks
=
tn
.
objects
.
filter
(
**
session_condition
)
.
values
(
'id'
,
'agentName'
,
'taskId'
,
'sessionId'
,
'score'
)
for
check
in
checks
:
if
check
[
'agentName'
]
in
detail
.
keys
():
pre_score
=
detail
[
check
[
'agentName'
]][
'avg_score'
]
detail
[
check
[
'agentName'
]][
'avg_score'
]
=
(
pre_score
+
check
[
'score'
])
/
2
else
:
area_name
=
task_name_dict
[
check
[
'taskId'
]]
.
split
(
'_'
)[
0
]
detail
[
check
[
'agentName'
]]
=
{
'area'
:
area_name
,
'avg_score'
:
check
[
'score'
]}
for
k
,
v
in
detail
.
items
():
v
[
'agentName'
]
=
k
return_data
.
append
(
v
)
return
Response
({
'code'
:
0
,
'msg'
:
'success'
,
'data'
:
return_data
})
task_condition
[
'task'
]
=
task_id
if
agent_name
:
task_condition
[
'agentName'
]
=
agent_name
rules
=
RulesStat
.
objects
.
filter
(
**
task_condition
)
.
extra
(
select
=
{
'area'
:
"task"
,
'agentName'
:
'agentName'
})
\
.
values
(
'area'
,
'agentName'
)
.
annotate
(
avg_score
=
Avg
(
'score'
))
.
order_by
(
'-avg_score'
)
paginator
=
Paginator
(
rules
,
page_size
)
total_count
=
paginator
.
count
try
:
seats
=
paginator
.
page
(
page
)
except
PageNotAnInteger
:
seats
=
paginator
.
page
(
1
)
except
EmptyPage
:
seats
=
paginator
.
page
(
paginator
.
num_pages
)
return
Response
({
'code'
:
0
,
'msg'
:
'success'
,
'count'
:
total_count
,
'data'
:
seats
.
object_list
})
@
action
([
'post'
],
detail
=
False
)
def
static_rule
(
self
,
req
:
Request
):
...
...
@@ -658,13 +648,12 @@ class TasksApi(viewsets.ViewSet):
table_list
=
json
.
loads
(
tables
)
else
:
table_list
=
tables
total_count
=
0
session_condition
=
{
'create_date__gte'
:
q_start_date
,
'create_date__lt'
:
q_end_date
,
'rule'
:
rule_name
,
'sessionCollectionId__in'
:
table_list
}
checks
=
RulesStat
.
objects
.
filter
(
**
session_condition
)
.
values
(
'agentName'
,
'customName'
,
'remainTime'
,
'score'
,
'sessionCollectionId'
,
'sessionId'
,
'taskId'
)
paginator
=
Paginator
(
checks
,
page_size
)
total_count
+
=
paginator
.
count
total_count
=
paginator
.
count
try
:
seats
=
paginator
.
page
(
page
)
except
PageNotAnInteger
:
...
...
src/inspect_report/templates/inspect/score.html
View file @
75e0ac77
...
...
@@ -132,19 +132,19 @@
<el-table
:data=
"tableData
.slice((currentPage-1)*pagesize,currentPage*pagesize)
"
:data=
"tableData"
id=
'mutiTable'
border
style=
"width: 100%"
>
<el-table-column
prop=
"area"
label=
"地市"
width=
"
1
50"
>
width=
"
2
50"
>
</el-table-column>
<el-table-column
prop=
"agentName"
label=
"工号"
width=
"
19
0"
>
width=
"
25
0"
>
</el-table-column>
<el-table-column
prop=
"avg_score"
...
...
static/inspect/js/all.js
View file @
75e0ac77
...
...
@@ -173,7 +173,7 @@ new Vue({
that
.
poprule
=
msg
.
data
[
0
];
that
.
popcurrentPage
=
1
;
that
.
poppage
=
1
;
that
.
getDetail
(
that
.
taskvalue
,
that
.
start_date
,
that
.
end_date
,
that
.
poptables
,
that
.
poprule
,
that
.
poppage
,
that
.
poppagesize
);
that
.
getDetail
(
that
.
taskvalue
,
that
.
start_date
,
that
.
end_date
,
that
.
poptables
,
that
.
poprule
,
that
.
poppage
,
that
.
poppagesize
,
that
.
takevalue
);
//that.tableData = msg.data[2];
that
.
dialogTableVisible
=
true
;
})
...
...
@@ -194,14 +194,14 @@ new Vue({
},
popCurrentChange
(
page
){
this
.
poppage
=
page
;
this
.
getDetail
(
this
.
taskvalue
,
this
.
start_date
,
this
.
end_date
,
this
.
poptables
,
this
.
poprule
,
this
.
poppage
,
this
.
poppagesize
);
this
.
getDetail
(
this
.
taskvalue
,
this
.
start_date
,
this
.
end_date
,
this
.
poptables
,
this
.
poprule
,
this
.
poppage
,
this
.
poppagesize
,
this
.
takevalue
);
},
getDetail
(
task
,
start_date
,
end_date
,
tables
,
rule
,
page
,
page_size
){
getDetail
(
task
,
start_date
,
end_date
,
tables
,
rule
,
page
,
page_size
,
agentName
){
//this.getRule(this.taskvalue,this.start_date,this.end_date,this.takevalue); // 获取统计数据
let
that
=
this
;
//this.$loading({text:'数据加载中...'});
this
.
poploading
=
true
;
RquestsPost
(
'
api/v1/tasks/rule_detail/
'
,{
task
,
end_date
,
start_date
,
tables
,
rule
,
page
,
page_size
}).
then
(
data
=>
{
RquestsPost
(
'
api/v1/tasks/rule_detail/
'
,{
task
,
end_date
,
start_date
,
tables
,
rule
,
page
,
page_size
,
agentName
}).
then
(
data
=>
{
console
.
log
(
data
.
data
);
if
(
data
.
code
!=
0
){
that
.
$message
(
data
.
msg
);
...
...
static/inspect/js/score.js
View file @
75e0ac77
...
...
@@ -16,6 +16,8 @@ new Vue({
loading
:
true
,
tableData
:
[],
currentPage
:
1
,
page
:
1
,
page_size
:
10
,
pagesize
:
10
,
total
:
10
,
isHidePage
:
true
,
...
...
@@ -31,16 +33,19 @@ new Vue({
changeRange
(
dateRange
){
this
.
start_date
=
dateRange
[
0
];
this
.
end_date
=
dateRange
[
1
];
this
.
getRule
(
this
.
taskvalue
,
this
.
start_date
,
this
.
end_date
,
this
.
takevalue
);
// 获取统计数据
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
.
getRule
(
this
.
taskvalue
,
this
.
start_date
,
this
.
end_date
,
this
.
takevalue
);
// 获取统计数据
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
.
getRule
(
this
.
taskvalue
,
this
.
start_date
,
this
.
end_date
,
this
.
takevalue
);
// 获取统计数据
this
.
page
=
1
;
this
.
getRule
(
this
.
taskvalue
,
this
.
start_date
,
this
.
end_date
,
this
.
takevalue
,
this
.
page
,
this
.
page_size
);
// 获取统计数据
},
getTask
(){
let
that
=
this
;
...
...
@@ -66,16 +71,17 @@ new Vue({
{
id
:
'
安徽省营业部
'
,
name
:
'
安徽省营业部
'
},
];
},
getRule
(
task
,
start_date
,
end_date
,
agentName
){
getRule
(
task
,
start_date
,
end_date
,
agentName
,
page
,
page_size
){
let
that
=
this
;
this
.
$loading
({
text
:
'
数据加载中...
'
});
RquestsPost
(
'
api/v1/tasks/seat_area/
'
,{
task
,
start_date
,
end_date
,
agentName
}).
then
(
data
=>
{
RquestsPost
(
'
api/v1/tasks/seat_area/
'
,{
task
,
start_date
,
end_date
,
agentName
,
page
,
page_size
}).
then
(
data
=>
{
if
(
data
.
code
!=
0
){
//that.takeList = [{agentName:'全部坐席'}]
}
else
{
that
.
tableData
=
data
.
data
;
this
.
total
=
data
.
data
.
length
;
this
.
total
=
data
.
count
;
this
.
isHidePage
=
!
(
data
.
data
.
length
>
0
);
}
that
.
$loading
().
close
();
...
...
@@ -131,6 +137,8 @@ new Vue({
},
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
);
// 获取统计数据
},
init
(){
this
.
dateRange
=
[
new
Date
(
new
Date
()
-
24
*
60
*
60
*
1000
),
new
Date
()];
...
...
@@ -138,7 +146,7 @@ new Vue({
this
.
end_date
=
this
.
dateFormat
(
new
Date
());
this
.
getTask
();
// 获取任务
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
,
this
.
page
,
this
.
page_size
);
// 获取统计数据
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment