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
d72a8084
Commit
d72a8084
authored
Apr 24, 2020
by
lvshibao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
seat页面修改
parent
5f847f30
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
61 additions
and
66 deletions
+61
-66
tasksapi.py
src/inspect_report/api/tasksapi.py
+24
-14
seat.html
src/inspect_report/templates/inspect/seat.html
+0
-1
seat_check.html
src/inspect_report/templates/inspect/seat_check.html
+0
-1
seat.js
static/inspect/js/seat.js
+37
-50
No files found.
src/inspect_report/api/tasksapi.py
View file @
d72a8084
...
...
@@ -186,17 +186,18 @@ class TasksApi(viewsets.ViewSet):
:param req:
:return:
"""
username
=
req
.
data
.
get
(
'username'
,
''
)
task_id
=
req
.
data
.
get
(
'task'
,
''
)
city_id
=
req
.
GET
.
get
(
'city'
,
None
)
country_id
=
req
.
GET
.
get
(
'country'
,
None
)
agent_name
=
req
.
data
.
get
(
'agentName'
,
''
)
sort
=
req
.
data
.
get
(
'sort'
,
'des'
)
page
=
req
.
data
.
get
(
'page'
,
'1'
)
page_size
=
req
.
data
.
get
(
'page_size'
,
'10'
)
task_condition
=
req
.
data
.
get
(
'date_condition'
,
{})
if
task_id
:
task_condition
[
'task'
]
=
task_id
if
username
in
name_list
:
task_condition
[
'task'
]
=
username
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'
:
...
...
@@ -217,22 +218,30 @@ class TasksApi(viewsets.ViewSet):
except
EmptyPage
:
seats
=
paginator
.
page
(
paginator
.
num_pages
)
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
)}
agent_name_set
.
add
(
s
[
'agentName'
])
return_data
.
append
(
detail
)
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
][
'ranking'
]
=
total_count
-
(
int
(
page
)
-
1
)
*
int
(
page_size
)
-
i
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
][
'ranking'
]
=
(
int
(
page
)
-
1
)
*
int
(
page_size
)
+
i
+
1
data_sort
[
i
][
'ratio'
]
=
'{0}
%
'
.
format
(
int
(
data_sort
[
i
][
'ratio'
]
*
100
))
return
Response
({
'code'
:
0
,
'msg'
:
'success'
,
'count'
:
total_count
,
'data'
:
data_sort
,
'username'
:
username
})
data_sort
[
i
][
'seatName'
]
=
seat_code_name_dict
.
get
(
data_sort
[
i
][
'agentName'
],
data_sort
[
i
][
'agentName'
])
return
Response
({
'code'
:
0
,
'msg'
:
'success'
,
'count'
:
total_count
,
'data'
:
data_sort
})
@
action
([
'post'
],
detail
=
False
)
@
before_request
...
...
@@ -427,13 +436,6 @@ class TasksApi(viewsets.ViewSet):
avg_score
=
Round
(
Avg
(
'score'
),
2
),
total_session
=
Sum
(
'total_session'
),
validate_num
=
Sum
(
'validate_num'
),
validate_zero
=
Sum
(
'validate_zero'
))
\
.
order_by
(
sort
)
agent_names
=
[
x
[
'agentName'
]
for
x
in
rules
]
seats_code_name_list
=
Seat
.
objects
.
filter
(
code__in
=
agent_names
)
.
values
(
'code'
,
'name'
)
seats_code_name
=
dict
()
for
seat_code_name
in
seats_code_name_list
:
seats_code_name
[
seat_code_name
[
'code'
]]
=
seat_code_name
[
'name'
]
for
rule_dict
in
rules
:
rule_dict
[
'seatName'
]
=
seats_code_name
.
get
(
rule_dict
[
'agentName'
],
rule_dict
[
'agentName'
])
paginator
=
Paginator
(
rules
,
page_size
)
total_count
=
paginator
.
count
try
:
...
...
@@ -443,6 +445,14 @@ class TasksApi(viewsets.ViewSet):
except
EmptyPage
:
seats
=
paginator
.
page
(
paginator
.
num_pages
)
agent_names
=
[
x
[
'agentName'
]
for
x
in
seats
]
seats_code_name_list
=
Seat
.
objects
.
filter
(
code__in
=
agent_names
)
.
values
(
'code'
,
'name'
)
seats_code_name
=
dict
()
for
seat_code_name
in
seats_code_name_list
:
seats_code_name
[
seat_code_name
[
'code'
]]
=
seat_code_name
[
'name'
]
for
rule_dict
in
seats
:
rule_dict
[
'seatName'
]
=
seats_code_name
.
get
(
rule_dict
[
'agentName'
],
rule_dict
[
'agentName'
])
return
Response
({
'code'
:
0
,
'msg'
:
'success'
,
'count'
:
total_count
,
'data'
:
seats
.
object_list
})
@
action
([
'post'
],
detail
=
False
)
...
...
src/inspect_report/templates/inspect/seat.html
View file @
d72a8084
...
...
@@ -117,7 +117,6 @@
<script
src=
"{% static "
inspect
/
js
/
vue
.
min
.
js
"
%}"
></script>
<script
src=
"{% static "
inspect
/
js
/
element
.
js
"
%}"
></script>
<script
src=
"{% static "
inspect
/
js
/
echarts
.
js
"
%}"
></script>
<script
type=
"text/javascript"
src=
"{% static "
inspect
/
js
/
config
.
js
"
%}"
></script>
<script
type=
"text/javascript"
src=
"{% static "
inspect
/
js
/
http
.
js
"
%}"
></script>
<script
type=
"text/javascript"
src=
"{% static "
inspect
/
js
/
seat
.
js
"
%}"
></script>
...
...
src/inspect_report/templates/inspect/seat_check.html
View file @
d72a8084
...
...
@@ -304,7 +304,6 @@
<script
src=
"{% static "
inspect
/
js
/
vue
.
min
.
js
"
%}"
></script>
<script
src=
"{% static "
inspect
/
js
/
element
.
js
"
%}"
></script>
<script
src=
"{% static "
inspect
/
js
/
http
.
js
"
%}"
></script>
<script
type=
"text/javascript"
src=
"{% static "
inspect
/
js
/
config
.
js
"
%}"
></script>
<script
type=
"text/javascript"
src=
"{% static "
inspect
/
js
/
seat_check
.
js
"
%}"
></script>
</body>
</html>
static/inspect/js/seat.js
View file @
d72a8084
...
...
@@ -4,12 +4,14 @@ new Vue({
return
{
ss
:
'
sas
'
,
dateRange
:
[
new
Date
(),
new
Date
()],
taskList
:
[],
taskvalue
:
''
,
cityList
:
[],
countryList
:
[],
cityvalue
:
''
,
countryvalue
:
''
,
start_date
:
''
,
end_date
:
''
,
take
List
:
[],
take
value
:
''
,
seat
List
:
[],
seat
value
:
''
,
loading
:
true
,
tableData
:
[],
sortObj
:
{
...
...
@@ -50,48 +52,39 @@ new Vue({
this
.
getRule
(
this
.
taskvalue
,
this
.
start_date
,
this
.
end_date
,
this
.
takevalue
);
// 获取统计数据
console
.
log
(
msg
);
},
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
:
'
安徽省营业部
'
},
];
//RquestsGet('api/v1/tasks/obtain/').then(data => {
// //console.log(data);
// if(data.code != 0){
// that.taskList = [{id:'',name:'全部任务'}];
// }else{
// that.taskList = [{id:'',name:'全部任务'}].concat(data.data);
// that.getTake()
// }
//})
},
getCity
(){
let
that
=
this
;
var
request
=
new
XMLHttpRequest
();
let
uri
=
window_url
+
'
api/v1/agency/city/
'
;
request
.
open
(
'
GET
'
,
uri
,
false
);
request
.
send
(
null
);
if
(
request
.
status
===
200
)
{
data
=
JSON
.
parse
(
request
.
response
);
console
.
log
(
data
.
code
);
if
(
data
.
code
!=
0
){
that
.
$message
(
'
服务器错误
'
);
}
else
{
that
.
cityList
=
data
.
data
.
city_list
;
that
.
countryList
=
data
.
data
.
country_list
;
that
.
cityvalue
=
data
.
data
.
city_id
;
console
.
log
(
that
.
cityvalue
);
that
.
init_simple
=
true
;
}
}
else
{
that
.
$message
(
'
服务器错误
'
);
}
},
getTake
()
{
let
that
=
this
;
RquestsGet
(
'
api/v1/tasks/seat/?
task=
'
+
that
.
task
value
+
'
&start_date=
'
+
this
.
start_date
+
'
&end_date=
'
+
this
.
end_date
).
then
(
data
=>
{
RquestsGet
(
'
api/v1/tasks/seat/?
city=
'
+
that
.
cityvalue
+
'
country=
'
+
this
.
country
value
+
'
&start_date=
'
+
this
.
start_date
+
'
&end_date=
'
+
this
.
end_date
).
then
(
data
=>
{
//console.log(data);
if
(
data
.
code
!=
0
)
{
//that.takeList = [{agentName:'全部坐席'}]
}
else
{
that
.
take
List
=
data
.
data
;
that
.
seat
List
=
data
.
data
;
}
})
},
...
...
@@ -111,13 +104,13 @@ new Vue({
}
this
.
getRule
(
this
.
taskvalue
,
this
.
start_date
,
this
.
end_date
,
this
.
takevalue
);
// 获取统计数据
},
getRule
(
task
,
start_date
,
end_date
,
agentName
)
{
getRule
(
city
,
country
,
start_date
,
end_date
,
agentName
)
{
let
that
=
this
;
let
page
=
this
.
currentPage
;
let
arr
=
[];
this
.
$loading
({
text
:
'
数据加载中...
'
});
let
sort
=
this
.
sortObj
.
sort
;
RquestsPost
(
'
api/v1/tasks/seat_rule/
'
,
{
task
,
start_date
,
end_date
,
agentName
,
page
,
sort
}).
then
(
data
=>
{
RquestsPost
(
'
api/v1/tasks/seat_rule/
'
,
{
city
,
country
,
start_date
,
end_date
,
agentName
,
page
,
sort
}).
then
(
data
=>
{
console
.
log
(
data
.
data
);
if
(
data
.
code
!=
0
)
{
that
.
$message
(
data
.
msg
);
...
...
@@ -127,12 +120,6 @@ new Vue({
that
.
$message
(
'
服务器错误
'
)
}
}
if
(
name_list
.
indexOf
(
data
.
username
)
!==
-
1
)
{
that
.
sel_is_show
=
false
;
that
.
taskvalue
=
data
.
username
;
}
else
{
that
.
sel_is_show
=
true
;
}
this
.
tableData
=
data
.
data
;
this
.
total
=
data
.
count
;
this
.
isHidePage
=
!
(
data
.
data
.
length
>
0
);
...
...
@@ -161,11 +148,11 @@ new Vue({
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
.
get
Task
();
// 获取任务
//
this.getTake(); // 获取坐席
this
.
get
City
();
// 获取任务
this
.
getTake
();
// 获取坐席
console
.
log
(
this
.
dateRange
);
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
);
// 获取统计数据
}
},
...
...
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