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
363da0c6
Commit
363da0c6
authored
Apr 24, 2020
by
lvshibao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
seat页面修改
parent
787a5de8
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
47 additions
and
21 deletions
+47
-21
dataapi.py
src/inspect_report/api/dataapi.py
+17
-9
seat.html
src/inspect_report/templates/inspect/seat.html
+9
-3
score.js
static/inspect/js/score.js
+1
-0
seat.js
static/inspect/js/seat.js
+20
-9
No files found.
src/inspect_report/api/dataapi.py
View file @
363da0c6
...
...
@@ -125,22 +125,22 @@ class DataApi(viewsets.ViewSet):
return
response
@
action
([
'get'
],
detail
=
False
)
@
before_request
def
seat_rule_export
(
self
,
req
:
Request
):
"""
坐席违规分析-按照得分-导出
:param req:
:return:
"""
task_id
=
req
.
GET
.
get
(
'task'
,
''
)
agent_name
=
req
.
GET
.
get
(
'agentName'
,
''
)
city_id
=
req
.
GET
.
get
(
'city'
,
None
)
country_id
=
req
.
GET
.
get
(
'country'
,
None
)
agent_name
=
req
.
GET
.
get
(
'seat'
,
''
)
sort
=
req
.
GET
.
get
(
'sort'
,
'des'
)
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'
))
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
[
'task'
]
=
task_id
task_condition
=
req
.
data
.
get
(
'date_condition'
,
''
)
team_names
=
get_team_names
(
city_id
,
country_id
)
task_condition
[
'task__in'
]
=
team_names
if
agent_name
:
task_condition
[
'agentName'
]
=
agent_name
if
sort
==
'des'
:
...
...
@@ -153,19 +153,27 @@ class DataApi(viewsets.ViewSet):
.
values
(
'agentName'
)
.
annotate
(
remainTime
=
Sum
(
'remainTime'
),
validate_session
=
Sum
(
'validate_session'
),
total_session
=
Sum
(
'total_session'
))
.
order_by
(
'validate_session'
)
return_data
=
[]
agent_name_set
=
set
()
for
s
in
seats
:
detail
=
{
'agentName'
:
s
[
'agentName'
],
'validate_session'
:
s
[
'validate_session'
],
'remainTime'
:
s
[
'remainTime'
],
'total_session'
:
s
[
'total_session'
],
'ratio'
:
round
(
s
[
'validate_session'
]
/
s
[
'total_session'
],
2
)}
return_data
.
append
(
detail
)
agent_name_set
.
add
(
s
[
'agentName'
])
seat_code_name_lists
=
Seat
.
objects
.
filter
(
code__in
=
agent_name_set
)
.
values
(
'code'
,
'name'
)
seat_code_name_dict
=
dict
()
for
seat_code_name
in
seat_code_name_lists
:
seat_code_name_dict
[
seat_code_name
[
'code'
]]
=
seat_code_name
[
'name'
]
if
sort
==
'asc'
:
data_sort
=
sorted
(
return_data
,
key
=
lambda
x
:
x
[
'ratio'
])
for
i
in
range
(
len
(
data_sort
)):
data_sort
[
i
][
'ratio'
]
=
'{0}
%
'
.
format
(
int
(
data_sort
[
i
][
'ratio'
]
*
100
))
data_sort
[
i
][
'seatName'
]
=
seat_code_name_dict
.
get
(
data_sort
[
i
][
'agentName'
],
data_sort
[
i
][
'agentName'
])
else
:
data_sort
=
sorted
(
return_data
,
key
=
lambda
x
:
x
[
'ratio'
],
reverse
=
True
)
for
i
in
range
(
len
(
data_sort
)):
data_sort
[
i
][
'ratio'
]
=
'{0}
%
'
.
format
(
int
(
data_sort
[
i
][
'ratio'
]
*
100
))
data_sort
[
i
][
'seatName'
]
=
seat_code_name_dict
.
get
(
data_sort
[
i
][
'agentName'
],
data_sort
[
i
][
'agentName'
])
response
=
HttpResponse
(
content_type
=
'text/csv'
)
file_name
=
'坐席违规_'
+
datetime
.
now
()
.
strftime
(
'
%
Y
%
m
%
d
%
H
%
M
%
S'
)
+
'.csv'
response
[
'Content-Type'
]
=
'application/octet-stream'
...
...
src/inspect_report/templates/inspect/seat.html
View file @
363da0c6
...
...
@@ -62,8 +62,9 @@
<form
ref=
"loadModal"
:action=
"`${BASEURL}api/v1/data/seat_rule_export/`"
method=
"get"
>
<input
type=
"hidden"
name=
"start_date"
:value=
"start_date"
>
<input
type=
"hidden"
name=
"end_date"
:value=
"end_date"
>
<input
type=
"hidden"
name=
"task"
:value=
"taskvalue"
>
<input
type=
"hidden"
name=
"agentName"
:value=
"takevalue"
>
<input
type=
"hidden"
name=
"city"
:value=
"cityvalue"
>
<input
type=
"hidden"
name=
"country"
:value=
"countryvalue"
>
<input
type=
"hidden"
name=
"seat"
:value=
"seatvalue"
>
<input
type=
"hidden"
name=
"sort"
:value=
"sortObj.sort"
>
</form>
</div>
...
...
@@ -77,7 +78,12 @@
style=
"width: 100%"
>
<el-table-column
prop=
"agentName"
label=
"坐席"
label=
"坐席id"
width=
"180"
>
<el-table-column
prop=
"seatName"
label=
"坐席姓名"
width=
"180"
>
</el-table-column>
...
...
static/inspect/js/score.js
View file @
363da0c6
...
...
@@ -76,6 +76,7 @@ new Vue({
changeRange
(
dateRange
)
{
this
.
start_date
=
dateRange
[
0
];
this
.
end_date
=
dateRange
[
1
];
this
.
seatvalue
=
null
;
this
.
page
=
1
;
this
.
getTake
();
this
.
getRule
(
this
.
cityvalue
,
this
.
countryvalue
,
this
.
start_date
,
this
.
end_date
,
this
.
seatvalue
,
this
.
page
,
this
.
page_size
);
// 获取统计数据
...
...
static/inspect/js/seat.js
View file @
363da0c6
...
...
@@ -36,21 +36,32 @@ new Vue({
console
.
log
(
dateRange
);
this
.
start_date
=
dateRange
[
0
];
this
.
end_date
=
dateRange
[
1
];
this
.
seatvalue
=
null
;
this
.
currentPage
=
1
;
this
.
getTake
();
this
.
getRule
(
this
.
taskvalue
,
this
.
start_date
,
this
.
end_date
,
this
.
take
value
);
// 获取统计数据
this
.
getRule
(
this
.
cityvalue
,
this
.
countryvalue
,
this
.
start_date
,
this
.
end_date
,
this
.
seat
value
);
// 获取统计数据
},
change
Task
(
msg
)
{
change
City
(
msg
)
{
console
.
log
(
msg
);
this
.
currentPage
=
1
;
this
.
taskvalue
=
msg
;
this
.
cityvalue
=
msg
;
this
.
countryvalue
=
''
;
this
.
seatvalue
=
null
;
this
.
getCountry
();
this
.
getTake
();
this
.
getRule
(
this
.
taskvalue
,
this
.
start_date
,
this
.
end_date
,
this
.
take
value
);
// 获取统计数据
this
.
getRule
(
this
.
cityvalue
,
this
.
countryvalue
,
this
.
start_date
,
this
.
end_date
,
this
.
seat
value
);
// 获取统计数据
},
changeTake
(
msg
)
{
changeCountry
(
msg
)
{
this
.
countryvalue
=
msg
;
this
.
seatvalue
=
null
;
this
.
getTake
();
this
.
currentPage
=
1
;
this
.
takevalue
=
msg
;
this
.
getRule
(
this
.
taskvalue
,
this
.
start_date
,
this
.
end_date
,
this
.
takevalue
);
// 获取统计数据
this
.
getRule
(
this
.
cityvalue
,
this
.
countryvalue
,
this
.
start_date
,
this
.
end_date
,
this
.
seatvalue
);
// 获取统计数据
},
changeSeat
(
msg
)
{
this
.
currentPage
=
1
;
this
.
seatvalue
=
msg
;
this
.
getRule
(
this
.
cityvalue
,
this
.
countryvalue
,
this
.
start_date
,
this
.
end_date
,
this
.
seatvalue
);
// 获取统计数据
console
.
log
(
msg
);
},
getCity
(){
...
...
@@ -114,7 +125,7 @@ new Vue({
name
:
item
.
prop
,
sort
:
order
}
this
.
getRule
(
this
.
taskvalue
,
this
.
start_date
,
this
.
end_date
,
this
.
take
value
);
// 获取统计数据
this
.
getRule
(
this
.
cityvalue
,
this
.
countryvalue
,
this
.
start_date
,
this
.
end_date
,
this
.
seat
value
);
// 获取统计数据
},
getRule
(
city
,
country
,
start_date
,
end_date
,
agentName
)
{
let
that
=
this
;
...
...
@@ -150,7 +161,7 @@ new Vue({
CurrentChange
(
page
)
{
this
.
currentPage
=
page
;
//this.tableData = this.basearr.concat(this.allData.slice((page-1)*this.pagesize,page*this.pagesize));
this
.
getRule
(
this
.
taskvalue
,
this
.
start_date
,
this
.
end_date
,
this
.
take
value
);
// 获取统计数据
this
.
getRule
(
this
.
cityvalue
,
this
.
countryvalue
,
this
.
start_date
,
this
.
end_date
,
this
.
seat
value
);
// 获取统计数据
//that.allData = data.data;
},
dateFormat
(
date
)
{
...
...
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