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):
...
@@ -186,17 +186,18 @@ class TasksApi(viewsets.ViewSet):
:param req:
:param req:
:return:
:return:
"""
"""
username
=
req
.
data
.
get
(
'username'
,
''
)
city_id
=
req
.
GET
.
get
(
'city'
,
None
)
task_id
=
req
.
data
.
get
(
'task'
,
''
)
country_id
=
req
.
GET
.
get
(
'country'
,
None
)
agent_name
=
req
.
data
.
get
(
'agentName'
,
''
)
agent_name
=
req
.
data
.
get
(
'agentName'
,
''
)
sort
=
req
.
data
.
get
(
'sort'
,
'des'
)
sort
=
req
.
data
.
get
(
'sort'
,
'des'
)
page
=
req
.
data
.
get
(
'page'
,
'1'
)
page
=
req
.
data
.
get
(
'page'
,
'1'
)
page_size
=
req
.
data
.
get
(
'page_size'
,
'10'
)
page_size
=
req
.
data
.
get
(
'page_size'
,
'10'
)
task_condition
=
req
.
data
.
get
(
'date_condition'
,
{})
task_condition
=
req
.
data
.
get
(
'date_condition'
,
{})
if
task_id
:
task_condition
[
'task'
]
=
task_id
team_names
=
get_team_names
(
city_id
,
country_id
)
if
username
in
name_list
:
task_condition
[
'task'
]
=
username
task_condition
[
'task__in'
]
=
team_names
if
agent_name
:
if
agent_name
:
task_condition
[
'agentName'
]
=
agent_name
task_condition
[
'agentName'
]
=
agent_name
if
sort
==
'des'
:
if
sort
==
'des'
:
...
@@ -217,22 +218,30 @@ class TasksApi(viewsets.ViewSet):
...
@@ -217,22 +218,30 @@ class TasksApi(viewsets.ViewSet):
except
EmptyPage
:
except
EmptyPage
:
seats
=
paginator
.
page
(
paginator
.
num_pages
)
seats
=
paginator
.
page
(
paginator
.
num_pages
)
return_data
=
[]
return_data
=
[]
agent_name_set
=
set
()
for
s
in
seats
:
for
s
in
seats
:
detail
=
{
'agentName'
:
s
[
'agentName'
],
'validate_session'
:
s
[
'validate_session'
],
detail
=
{
'agentName'
:
s
[
'agentName'
],
'validate_session'
:
s
[
'validate_session'
],
'remainTime'
:
s
[
'remainTime'
],
'total_session'
:
s
[
'total_session'
],
'remainTime'
:
s
[
'remainTime'
],
'total_session'
:
s
[
'total_session'
],
'ratio'
:
round
(
s
[
'validate_session'
]
/
s
[
'total_session'
],
2
)}
'ratio'
:
round
(
s
[
'validate_session'
]
/
s
[
'total_session'
],
2
)}
agent_name_set
.
add
(
s
[
'agentName'
])
return_data
.
append
(
detail
)
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'
:
if
sort
==
'asc'
:
data_sort
=
sorted
(
return_data
,
key
=
lambda
x
:
x
[
'ratio'
])
data_sort
=
sorted
(
return_data
,
key
=
lambda
x
:
x
[
'ratio'
])
for
i
in
range
(
len
(
data_sort
)):
for
i
in
range
(
len
(
data_sort
)):
data_sort
[
i
][
'ranking'
]
=
total_count
-
(
int
(
page
)
-
1
)
*
int
(
page_size
)
-
i
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
][
'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
:
else
:
data_sort
=
sorted
(
return_data
,
key
=
lambda
x
:
x
[
'ratio'
],
reverse
=
True
)
data_sort
=
sorted
(
return_data
,
key
=
lambda
x
:
x
[
'ratio'
],
reverse
=
True
)
for
i
in
range
(
len
(
data_sort
)):
for
i
in
range
(
len
(
data_sort
)):
data_sort
[
i
][
'ranking'
]
=
(
int
(
page
)
-
1
)
*
int
(
page_size
)
+
i
+
1
data_sort
[
i
][
'ranking'
]
=
(
int
(
page
)
-
1
)
*
int
(
page_size
)
+
i
+
1
data_sort
[
i
][
'ratio'
]
=
'{0}
%
'
.
format
(
int
(
data_sort
[
i
][
'ratio'
]
*
100
))
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
)
@
action
([
'post'
],
detail
=
False
)
@
before_request
@
before_request
...
@@ -427,13 +436,6 @@ class TasksApi(viewsets.ViewSet):
...
@@ -427,13 +436,6 @@ class TasksApi(viewsets.ViewSet):
avg_score
=
Round
(
Avg
(
'score'
),
2
),
total_session
=
Sum
(
'total_session'
),
avg_score
=
Round
(
Avg
(
'score'
),
2
),
total_session
=
Sum
(
'total_session'
),
validate_num
=
Sum
(
'validate_num'
),
validate_zero
=
Sum
(
'validate_zero'
))
\
validate_num
=
Sum
(
'validate_num'
),
validate_zero
=
Sum
(
'validate_zero'
))
\
.
order_by
(
sort
)
.
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
)
paginator
=
Paginator
(
rules
,
page_size
)
total_count
=
paginator
.
count
total_count
=
paginator
.
count
try
:
try
:
...
@@ -443,6 +445,14 @@ class TasksApi(viewsets.ViewSet):
...
@@ -443,6 +445,14 @@ class TasksApi(viewsets.ViewSet):
except
EmptyPage
:
except
EmptyPage
:
seats
=
paginator
.
page
(
paginator
.
num_pages
)
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
})
return
Response
({
'code'
:
0
,
'msg'
:
'success'
,
'count'
:
total_count
,
'data'
:
seats
.
object_list
})
@
action
([
'post'
],
detail
=
False
)
@
action
([
'post'
],
detail
=
False
)
...
...
src/inspect_report/templates/inspect/seat.html
View file @
d72a8084
...
@@ -117,7 +117,6 @@
...
@@ -117,7 +117,6 @@
<script
src=
"{% static "
inspect
/
js
/
vue
.
min
.
js
"
%}"
></script>
<script
src=
"{% static "
inspect
/
js
/
vue
.
min
.
js
"
%}"
></script>
<script
src=
"{% static "
inspect
/
js
/
element
.
js
"
%}"
></script>
<script
src=
"{% static "
inspect
/
js
/
element
.
js
"
%}"
></script>
<script
src=
"{% static "
inspect
/
js
/
echarts
.
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
/
http
.
js
"
%}"
></script>
<script
type=
"text/javascript"
src=
"{% static "
inspect
/
js
/
seat
.
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 @@
...
@@ -304,7 +304,6 @@
<script
src=
"{% static "
inspect
/
js
/
vue
.
min
.
js
"
%}"
></script>
<script
src=
"{% static "
inspect
/
js
/
vue
.
min
.
js
"
%}"
></script>
<script
src=
"{% static "
inspect
/
js
/
element
.
js
"
%}"
></script>
<script
src=
"{% static "
inspect
/
js
/
element
.
js
"
%}"
></script>
<script
src=
"{% static "
inspect
/
js
/
http
.
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>
<script
type=
"text/javascript"
src=
"{% static "
inspect
/
js
/
seat_check
.
js
"
%}"
></script>
</body>
</body>
</html>
</html>
static/inspect/js/seat.js
View file @
d72a8084
...
@@ -4,12 +4,14 @@ new Vue({
...
@@ -4,12 +4,14 @@ new Vue({
return
{
return
{
ss
:
'
sas
'
,
ss
:
'
sas
'
,
dateRange
:
[
new
Date
(),
new
Date
()],
dateRange
:
[
new
Date
(),
new
Date
()],
taskList
:
[],
cityList
:
[],
taskvalue
:
''
,
countryList
:
[],
cityvalue
:
''
,
countryvalue
:
''
,
start_date
:
''
,
start_date
:
''
,
end_date
:
''
,
end_date
:
''
,
take
List
:
[],
seat
List
:
[],
take
value
:
''
,
seat
value
:
''
,
loading
:
true
,
loading
:
true
,
tableData
:
[],
tableData
:
[],
sortObj
:
{
sortObj
:
{
...
@@ -50,48 +52,39 @@ new Vue({
...
@@ -50,48 +52,39 @@ new Vue({
this
.
getRule
(
this
.
taskvalue
,
this
.
start_date
,
this
.
end_date
,
this
.
takevalue
);
// 获取统计数据
this
.
getRule
(
this
.
taskvalue
,
this
.
start_date
,
this
.
end_date
,
this
.
takevalue
);
// 获取统计数据
console
.
log
(
msg
);
console
.
log
(
msg
);
},
},
getTask
()
{
getCity
(){
let
that
=
this
;
let
that
=
this
;
that
.
taskList
=
[
var
request
=
new
XMLHttpRequest
();
{
id
:
''
,
name
:
'
全省
'
},
{
id
:
'
合肥
'
,
name
:
'
合肥
'
},
let
uri
=
window_url
+
'
api/v1/agency/city/
'
;
{
id
:
'
芜湖
'
,
name
:
'
芜湖
'
},
{
id
:
'
蚌埠
'
,
name
:
'
蚌埠
'
},
request
.
open
(
'
GET
'
,
uri
,
false
);
{
id
:
'
淮南
'
,
name
:
'
淮南
'
},
request
.
send
(
null
);
{
id
:
'
马鞍山
'
,
name
:
'
马鞍山
'
},
if
(
request
.
status
===
200
)
{
{
id
:
'
淮北
'
,
name
:
'
淮北
'
},
data
=
JSON
.
parse
(
request
.
response
);
{
id
:
'
铜陵
'
,
name
:
'
铜陵
'
},
console
.
log
(
data
.
code
);
{
id
:
'
安庆
'
,
name
:
'
安庆
'
},
if
(
data
.
code
!=
0
){
{
id
:
'
黄山
'
,
name
:
'
黄山
'
},
that
.
$message
(
'
服务器错误
'
);
{
id
:
'
滁州
'
,
name
:
'
滁州
'
},
}
else
{
{
id
:
'
阜阳
'
,
name
:
'
阜阳
'
},
that
.
cityList
=
data
.
data
.
city_list
;
{
id
:
'
亳州
'
,
name
:
'
亳州
'
},
that
.
countryList
=
data
.
data
.
country_list
;
{
id
:
'
宿州
'
,
name
:
'
宿州
'
},
that
.
cityvalue
=
data
.
data
.
city_id
;
{
id
:
'
六安
'
,
name
:
'
六安
'
},
console
.
log
(
that
.
cityvalue
);
{
id
:
'
宣城
'
,
name
:
'
宣城
'
},
that
.
init_simple
=
true
;
{
id
:
'
巢湖
'
,
name
:
'
巢湖
'
},
}
{
id
:
'
池州
'
,
name
:
'
池州
'
},
}
else
{
{
id
:
'
安徽省营业部
'
,
name
:
'
安徽省营业部
'
},
that
.
$message
(
'
服务器错误
'
);
];
}
//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()
// }
//})
},
getTake
()
{
getTake
()
{
let
that
=
this
;
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);
//console.log(data);
if
(
data
.
code
!=
0
)
{
if
(
data
.
code
!=
0
)
{
//that.takeList = [{agentName:'全部坐席'}]
//that.takeList = [{agentName:'全部坐席'}]
}
else
{
}
else
{
that
.
take
List
=
data
.
data
;
that
.
seat
List
=
data
.
data
;
}
}
})
})
},
},
...
@@ -111,13 +104,13 @@ new Vue({
...
@@ -111,13 +104,13 @@ new Vue({
}
}
this
.
getRule
(
this
.
taskvalue
,
this
.
start_date
,
this
.
end_date
,
this
.
takevalue
);
// 获取统计数据
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
that
=
this
;
let
page
=
this
.
currentPage
;
let
page
=
this
.
currentPage
;
let
arr
=
[];
let
arr
=
[];
this
.
$loading
({
text
:
'
数据加载中...
'
});
this
.
$loading
({
text
:
'
数据加载中...
'
});
let
sort
=
this
.
sortObj
.
sort
;
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
);
console
.
log
(
data
.
data
);
if
(
data
.
code
!=
0
)
{
if
(
data
.
code
!=
0
)
{
that
.
$message
(
data
.
msg
);
that
.
$message
(
data
.
msg
);
...
@@ -127,12 +120,6 @@ new Vue({
...
@@ -127,12 +120,6 @@ new Vue({
that
.
$message
(
'
服务器错误
'
)
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
.
tableData
=
data
.
data
;
this
.
total
=
data
.
count
;
this
.
total
=
data
.
count
;
this
.
isHidePage
=
!
(
data
.
data
.
length
>
0
);
this
.
isHidePage
=
!
(
data
.
data
.
length
>
0
);
...
@@ -161,11 +148,11 @@ new Vue({
...
@@ -161,11 +148,11 @@ new Vue({
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
.
get
Task
();
// 获取任务
this
.
get
City
();
// 获取任务
//
this.getTake(); // 获取坐席
this
.
getTake
();
// 获取坐席
console
.
log
(
this
.
dateRange
);
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