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
2147ea60
Commit
2147ea60
authored
Apr 23, 2020
by
lvshibao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
group页面修改,model的添加
parent
93ddb338
Changes
12
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
359 additions
and
185 deletions
+359
-185
Makefile
Makefile
+2
-2
account.py
src/account.py
+12
-13
before_request.py
src/before_request.py
+39
-0
__init__.py
src/inspect_report/api/__init__.py
+1
-0
agencyapi.py
src/inspect_report/api/agencyapi.py
+82
-0
dataapi.py
src/inspect_report/api/dataapi.py
+4
-8
tasksapi.py
src/inspect_report/api/tasksapi.py
+71
-85
cron.py
src/inspect_report/cron.py
+25
-9
models.py
src/inspect_report/models.py
+53
-6
group.html
src/inspect_report/templates/inspect/group.html
+12
-4
urls_api_v1.py
src/inspect_report/urls_api_v1.py
+1
-0
group.js
static/inspect/js/group.js
+57
-58
No files found.
Makefile
View file @
2147ea60
...
...
@@ -10,9 +10,9 @@ init: ## 初始化python环境,并加载测试数据
stop
:
##
停止 make prd/ make run 启动的服务
-
lsof
-i
:8099 |
awk
'NR==2{print $$2}'
| xargs
kill
run
:
stop
##
运行后端服务(front)
env
/bin/python3 src/manage.py runserver 8099
e
xport
DEBUG
=
True
&&
e
nv
/bin/python3 src/manage.py runserver 8099
prd
:
stop
##
生产环境运行(backend)
nohup env
/bin/python3 src/manage.py runserver 8099 2>&1 &
...
...
src/
inspect_report/utils/
account.py
→
src/account.py
View file @
2147ea60
import
json
#
import json
import
logging
import
os
import
requests
from
requests.cookies
import
RequestsCookieJar
from
functools
import
wraps
from
rest_framework.request
import
Request
#
from functools import wraps
#
from rest_framework.request import Request
from
rest_framework.response
import
Response
from
config.config
import
USER_INFO_URL
...
...
@@ -26,14 +27,13 @@ def transfer_cookie(cookies):
return
cookie_jar
def
get_account_info
(
func
):
def
get_account_info
(
req
):
"""
装饰器,对请求进行权限验证
:param
func
:
获取用户的账户信息
:param
req
:
:return:
"""
@
wraps
(
func
)
def
account_info
(
obj
,
req
:
Request
,
*
args
,
**
kw
):
if
not
(
os
.
environ
.
get
(
'DEBUG'
,
False
)
==
"True"
):
# logger.info('req中的data为: ' + json.dumps(req.COOKIES))
cookie_jar
=
transfer_cookie
(
req
.
COOKIES
)
info
=
requests
.
get
(
USER_INFO_URL
,
cookies
=
cookie_jar
)
...
...
@@ -42,12 +42,11 @@ def get_account_info(func):
if
info
.
json
()[
'code'
]
!=
200
:
logger
.
info
(
'未能获取用户信息: '
+
info
.
text
)
return
Response
({
'code'
:
-
1
,
'msg'
:
'未能获取用户信息'
})
except
Exception
:
logger
.
info
(
'未能获取用户信息: '
+
info
.
text
)
except
RuntimeError
:
logger
.
exception
(
'未能获取用户信息: '
+
info
.
text
)
return
Response
({
'code'
:
-
1
,
'msg'
:
'未能获取用户信息'
})
req
.
data
[
'username'
]
=
info
.
json
()[
'data'
][
'userInfo'
][
'name'
]
return
func
(
obj
,
req
,
*
args
,
**
kw
)
return
account_info
return
req
return
req
# get_account_info()
src/before_request.py
0 → 100644
View file @
2147ea60
from
datetime
import
datetime
,
timedelta
from
functools
import
wraps
from
rest_framework.request
import
Request
from
account
import
get_account_info
from
config.config
import
name_list
def
before_request
(
func
):
"""
对请求参数进行集中处理
:param func:
:return:
"""
@
wraps
(
func
)
def
request_to_session_condition
(
obj
,
req
:
Request
,
*
args
,
**
kw
):
req
=
get_account_info
(
req
)
if
req
.
method
==
"GET"
:
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'
))
else
:
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'
))
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
()
date_condition
=
{
'create_date__gte'
:
q_start_date
,
'create_date__lt'
:
q_end_date
}
at_condition
=
{
'createdAt__gte'
:
start_date
,
'createdAt__lt'
:
end_date
+
' 23:59:59'
}
req
.
data
[
'date_condition'
]
=
date_condition
req
.
data
[
'at_condition'
]
=
at_condition
return
func
(
obj
,
req
,
*
args
,
**
kw
)
return
request_to_session_condition
src/inspect_report/api/__init__.py
View file @
2147ea60
...
...
@@ -3,3 +3,4 @@
from
.toolapi
import
ToolsApi
from
.tasksapi
import
TasksApi
from
.dataapi
import
DataApi
from
.agencyapi
import
AgencyApi
src/inspect_report/api/agencyapi.py
0 → 100644
View file @
2147ea60
from
rest_framework
import
viewsets
from
rest_framework.decorators
import
action
from
rest_framework.request
import
Request
from
rest_framework.response
import
Response
from
before_request
import
before_request
from
inspect_report.models
import
Country
,
Team
class
AgencyApi
(
viewsets
.
ViewSet
):
authentication_classes
=
()
permission_classes
=
()
# permission_classes = (permissions.ValidateToken, )
@
action
([
'get'
],
detail
=
False
)
@
before_request
def
city
(
self
,
req
:
Request
):
"""
加载城市列表
:param req:
:return:
"""
username
=
req
.
data
.
get
(
'username'
,
''
)
city_list
=
list
()
country_list
=
list
()
top
=
Country
.
objects
.
filter
(
name
=
username
)
.
first
()
if
top
is
not
None
:
if
top
.
parent
is
None
:
cities
=
Country
.
objects
.
filter
(
parent
=
top
.
id
)
.
all
()
else
:
cities
=
None
city_id
=
top
.
id
else
:
top
=
Country
.
objects
.
filter
(
parent
=
None
)
.
first
()
cities
=
Country
.
objects
.
filter
(
parent
=
top
.
id
)
.
all
()
city_id
=
top
.
id
if
cities
is
not
None
:
city_list
.
append
({
'id'
:
top
.
id
,
'name'
:
top
.
name
})
for
city
in
cities
:
city_list
.
append
({
'id'
:
city
.
id
,
'name'
:
city
.
name
})
else
:
city_list
.
append
({
'id'
:
top
.
id
,
'name'
:
top
.
name
})
countries
=
Country
.
objects
.
filter
(
parent
=
top
.
id
)
.
all
()
country_id_list
=
list
()
if
len
(
countries
)
>
0
:
for
country
in
countries
:
print
(
country
.
name
)
if
len
(
Team
.
objects
.
filter
(
country
=
country
.
id
)
.
all
())
>
0
:
country_list
.
append
({
'id'
:
country
.
id
,
'name'
:
country
.
name
})
country_id_list
.
append
(
country
.
id
)
return_data
=
{
'city_list'
:
city_list
,
'country_list'
:
country_list
,
'city_id'
:
city_id
}
return
Response
({
'code'
:
0
,
'msg'
:
'success'
,
'data'
:
return_data
})
@
action
([
'get'
],
detail
=
False
)
def
country
(
self
,
req
:
Request
):
"""
查询任务列表
:param req:
:return:
"""
city_id
=
req
.
GET
.
get
(
'city_id'
,
''
)
country_list
=
list
()
top
=
Country
.
objects
.
filter
(
id
=
city_id
)
.
first
()
if
top
is
not
None
:
if
top
.
parent
is
None
:
pass
else
:
countries
=
Country
.
objects
.
filter
(
parent
=
city_id
)
.
all
()
for
country
in
countries
:
country_list
.
append
({
'id'
:
country
.
id
,
'name'
:
country
.
name
})
return
Response
({
'code'
:
0
,
'msg'
:
'success'
,
'data'
:
{
'country_list'
:
country_list
}})
else
:
return
Response
({
'code'
:
-
1
,
'msg'
:
'未找到对应的县市'
})
src/inspect_report/api/dataapi.py
View file @
2147ea60
...
...
@@ -3,6 +3,8 @@ 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
from
before_request
import
before_request
from
inspect_report.models
import
Tasks
,
CheckSession
,
RulesStat
,
SeatStat
,
ScoreStat
,
Round
import
json
from
datetime
import
datetime
,
timedelta
...
...
@@ -14,8 +16,6 @@ import csv
import
codecs
from
django.utils.http
import
urlquote
from
inspect_report.utils.account
import
get_account_info
logger
=
logging
.
getLogger
(
__name__
)
...
...
@@ -24,7 +24,7 @@ class DataApi(viewsets.ViewSet):
permission_classes
=
()
@
action
([
'get'
],
detail
=
False
)
@
get_account_info
@
before_request
def
static_score_export
(
self
,
req
:
Request
):
"""
概览-地市得分统计-导出
...
...
@@ -34,11 +34,7 @@ class DataApi(viewsets.ViewSet):
username
=
req
.
data
.
get
(
'username'
,
''
)
task_id
=
req
.
GET
.
get
(
'task'
,
''
)
sort
=
req
.
GET
.
get
(
'sort'
,
'-avg_score'
)
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
}
task_condition
=
req
.
data
.
get
(
'date_condition'
,
{})
if
task_id
:
task_condition
[
'task'
]
=
task_id
if
username
in
name_list
:
...
...
src/inspect_report/api/tasksapi.py
View file @
2147ea60
This diff is collapsed.
Click to expand it.
src/inspect_report/cron.py
View file @
2147ea60
# coding: utf-8
from
inspect_report.models
import
Tasks
,
CheckSession
,
RulesStat
,
SeatStat
,
ScoreStat
from
inspect_report.models
import
Tasks
,
CheckSession
,
RulesStat
,
SeatStat
,
ScoreStat
,
Team
,
Seat
from
config.config
import
TABLE_PRE
import
json
import
logging
import
kronos
from
datetime
import
datetime
,
timedelta
"""定时任务
参考:https://github.com/jgorset/django-kronos
...
...
@@ -15,12 +16,21 @@ score_item_service = {'服务用语': 15, '开场白': 5, '结束语': 3, '服
score_item_business
=
{
'异议处理'
:
10
,
'业务促成'
:
10
,
'预约及流转'
:
10
,
'服务介绍'
:
10
,
'未提供报价'
:
2
,
'成功件信息核实'
:
20
}
def
team_seat
():
teams
=
Team
.
objects
.
values_list
(
'id'
,
'name'
)
team_id_name
=
{
team
[
0
]:
team
[
1
]
for
team
in
teams
}
seats
=
Seat
.
objects
.
values_list
(
'code'
,
'team_id'
)
seat_code_team_name
=
{
seat
[
0
]:
team_id_name
[
seat
[
1
]]
for
seat
in
seats
}
return
seat_code_team_name
@
kronos
.
register
(
'30 1,8,12 * * *'
)
def
rule_stat
(
start_date
=
None
,
end_date
=
None
):
"""
首页概述-违规项统计
:return:
"""
seat_code_team_name
=
team_seat
()
if
not
start_date
and
not
end_date
:
start_date
=
(
datetime
.
now
()
+
timedelta
(
days
=-
1
))
.
strftime
(
'
%
Y-
%
m-
%
d'
)
end_date
=
datetime
.
now
()
.
strftime
(
'
%
Y-
%
m-
%
d'
)
...
...
@@ -48,10 +58,12 @@ def rule_stat(start_date=None, end_date=None):
start
=
datetime
.
strptime
(
check
[
'startTime'
],
'
%
Y-
%
m-
%
d
%
H:
%
M:
%
S'
)
.
timestamp
()
close
=
datetime
.
strptime
(
check
[
'closeTime'
],
'
%
Y-
%
m-
%
d
%
H:
%
M:
%
S'
)
.
timestamp
()
remain
=
int
(
close
-
start
)
if
'isViolation'
in
d
.
keys
()
and
d
[
'isViolation'
]
and
'rule'
in
d
.
keys
()
and
'name'
in
d
[
'rule'
]
.
keys
():
if
'isViolation'
in
d
.
keys
()
and
d
[
'isViolation'
]
and
'rule'
in
d
.
keys
()
and
'name'
in
d
[
'rule'
]
.
keys
():
name
=
d
[
'rule'
][
'name'
]
rule_obj
=
{
'create_date'
:
start_date
,
'sessionCollectionId'
:
t
[
'sessionCollectionId'
],
'rule'
:
name
,
'rule_num'
:
1
,
'task'
:
t
[
'name'
]
.
split
(
'_'
)[
0
],
'rule'
:
name
,
'rule_num'
:
1
,
'task'
:
seat_code_team_name
.
get
(
check
[
'agentName'
],
'未找到团队'
),
'agentName'
:
check
[
'agentName'
],
'customName'
:
check
[
'customName'
],
'score'
:
check
[
'score'
],
'remainTime'
:
remain
,
'taskId'
:
check
[
'taskId'
],
'sessionId'
:
check
[
'sessionId'
],
...
...
@@ -70,6 +82,7 @@ def seat_stat(start_date=None, end_date=None):
首页概述-违规坐席统计
:return:
"""
seat_code_team_name
=
team_seat
()
if
not
start_date
and
not
end_date
:
start_date
=
(
datetime
.
now
()
+
timedelta
(
days
=-
1
))
.
strftime
(
'
%
Y-
%
m-
%
d'
)
end_date
=
datetime
.
now
()
.
strftime
(
'
%
Y-
%
m-
%
d'
)
...
...
@@ -101,7 +114,8 @@ def seat_stat(start_date=None, end_date=None):
seat
[
'validate_session'
]
+=
1
if
check
[
'violationRuleCount'
]
>
0
else
0
else
:
seat_dict
[
check
[
'agentName'
]]
=
{
'create_date'
:
start_date
,
'agentName'
:
check
[
'agentName'
],
'taskId'
:
check
[
'taskId'
],
'task'
:
t
[
'name'
]
.
split
(
'_'
)[
0
],
'taskId'
:
check
[
'taskId'
],
'task'
:
seat_code_team_name
.
get
(
check
[
'agentName'
],
'未找到团队'
),
'sessionCollectionId'
:
t
[
'sessionCollectionId'
],
'total_session'
:
1
}
seat_dict
[
check
[
'agentName'
]][
'validate_session'
]
=
1
if
check
[
'violationRuleCount'
]
>
0
else
0
seat_dict
[
check
[
'agentName'
]][
'remainTime'
]
=
remain
...
...
@@ -120,6 +134,7 @@ def score_stat(start_date=None, end_date=None):
坐席得分统计
:return:
"""
seat_code_team_name
=
team_seat
()
if
not
start_date
and
not
end_date
:
start_date
=
(
datetime
.
now
()
+
timedelta
(
days
=-
1
))
.
strftime
(
'
%
Y-
%
m-
%
d'
)
end_date
=
datetime
.
now
()
.
strftime
(
'
%
Y-
%
m-
%
d'
)
...
...
@@ -160,12 +175,13 @@ def score_stat(start_date=None, end_date=None):
seat
[
'total_session'
]
+=
1
seat
[
'validate_session'
]
+=
1
if
check
[
'violationRuleCount'
]
>
0
else
0
seat
[
'validate_num'
]
+=
len
(
score_item
)
seat
[
'score'
]
=
round
((
seat
[
'score'
]
+
score
)
/
2
,
2
)
seat
[
'service_score'
]
=
round
((
seat
[
'service_score'
]
+
service_score
)
/
2
,
2
)
seat
[
'business_score'
]
=
round
((
seat
[
'business_score'
]
+
business_score
)
/
2
,
2
)
seat
[
'score'
]
=
round
((
seat
[
'score'
]
+
score
)
/
2
,
2
)
seat
[
'service_score'
]
=
round
((
seat
[
'service_score'
]
+
service_score
)
/
2
,
2
)
seat
[
'business_score'
]
=
round
((
seat
[
'business_score'
]
+
business_score
)
/
2
,
2
)
else
:
seat_dict
[
check
[
'agentName'
]]
=
{
'create_date'
:
start_date
,
'agentName'
:
check
[
'agentName'
],
'taskId'
:
check
[
'taskId'
],
'task'
:
t
[
'name'
]
.
split
(
'_'
)[
0
],
'taskId'
:
check
[
'taskId'
],
'task'
:
seat_code_team_name
.
get
(
check
[
'agentName'
],
'未找到团队'
),
'sessionCollectionId'
:
t
[
'sessionCollectionId'
],
'total_session'
:
1
,
'score'
:
score
,
'service_score'
:
service_score
,
'business_score'
:
business_score
,
'validate_zero'
:
validate_zero
}
...
...
@@ -208,7 +224,7 @@ def seat_time_stat(start_date=None, end_date=None):
t
.
remainTime
=
remain
t
.
save
(
update_fields
=
[
'remainTime'
])
"""
坐席统计
坐席统计
seats = SeatStat.objects.filter(**task_condition)
stat_count = 0
for t in seats:
...
...
src/inspect_report/models.py
View file @
2147ea60
...
...
@@ -30,7 +30,7 @@ class RulesStat(models.Model):
rule
=
models
.
CharField
(
'违规名称'
,
null
=
True
,
max_length
=
64
,
db_index
=
True
)
sessionCollectionId
=
models
.
CharField
(
'所在表'
,
null
=
True
,
max_length
=
32
)
rule_num
=
models
.
IntegerField
(
'违规数量'
,
default
=
0
)
task
=
models
.
CharField
(
'所在
地市
'
,
null
=
True
,
max_length
=
24
)
task
=
models
.
CharField
(
'所在
团队
'
,
null
=
True
,
max_length
=
24
)
create_date
=
models
.
DateField
(
'统计日期'
,
null
=
True
)
agentName
=
models
.
CharField
(
'坐席名称'
,
null
=
True
,
max_length
=
64
)
customName
=
models
.
CharField
(
'客户名称'
,
null
=
True
,
max_length
=
64
)
...
...
@@ -51,7 +51,7 @@ class SeatStat(models.Model):
sessionCollectionId
=
models
.
CharField
(
'所在表'
,
null
=
True
,
max_length
=
32
)
validate_session
=
models
.
IntegerField
(
'违规会话数量'
,
default
=
0
)
total_session
=
models
.
IntegerField
(
'会话数量'
,
default
=
0
)
task
=
models
.
CharField
(
'所在
地市
'
,
null
=
True
,
max_length
=
24
)
task
=
models
.
CharField
(
'所在
团队
'
,
null
=
True
,
max_length
=
24
)
create_date
=
models
.
DateField
(
'统计日期'
,
null
=
True
)
agentName
=
models
.
CharField
(
'坐席名称'
,
null
=
True
,
max_length
=
64
)
taskId
=
models
.
IntegerField
(
'质检任务标识'
)
...
...
@@ -69,7 +69,7 @@ class ScoreStat(models.Model):
validate_session
=
models
.
IntegerField
(
'违规会话数量'
,
default
=
0
)
validate_num
=
models
.
IntegerField
(
'违规次数'
,
default
=
0
)
total_session
=
models
.
IntegerField
(
'会话数量'
,
default
=
0
)
task
=
models
.
CharField
(
'所在
地市
'
,
null
=
True
,
max_length
=
24
)
task
=
models
.
CharField
(
'所在
团队
'
,
null
=
True
,
max_length
=
24
)
create_date
=
models
.
DateField
(
'统计日期'
,
null
=
True
)
start_time
=
models
.
DateTimeField
(
'会话日期'
,
null
=
True
)
agentName
=
models
.
CharField
(
'坐席名称'
,
null
=
True
,
max_length
=
64
)
...
...
@@ -123,15 +123,15 @@ class CheckSession(models.Model):
abstract
=
True
@
classmethod
def
set_table
(
Clas
s
,
table_name
):
def
set_table
(
cl
s
,
table_name
):
class
Meta
:
db_table
=
table_name
attrs
=
{
'__module__'
:
Clas
s
.
__module__
,
'__module__'
:
cl
s
.
__module__
,
'Meta'
:
Meta
}
return
type
(
table_name
,
(
Clas
s
,),
attrs
)
return
type
(
table_name
,
(
cl
s
,),
attrs
)
class
ScheduleTaskOptions
(
models
.
Model
):
...
...
@@ -158,6 +158,53 @@ class ScheduleTaskOptions(models.Model):
# name_list = [name[0] for name in names]
class
Country
(
models
.
Model
):
code
=
models
.
CharField
(
'机构代码'
,
max_length
=
190
,
blank
=
False
)
name
=
models
.
CharField
(
'机构名称'
,
max_length
=
190
,
blank
=
False
)
user_email
=
models
.
CharField
(
'用户email'
,
max_length
=
190
)
parent
=
models
.
IntegerField
(
'父机构id'
,
default
=
None
)
in_use
=
models
.
IntegerField
(
'是否在用'
,
default
=
1
,
blank
=
False
)
createdAt
=
models
.
DateTimeField
(
'创建时间'
)
updatedAt
=
models
.
DateTimeField
(
'更新时间'
)
def
__str__
(
self
):
return
self
.
name
class
Meta
:
db_table
=
'country'
class
Team
(
models
.
Model
):
code
=
models
.
CharField
(
'团队代码'
,
max_length
=
190
,
blank
=
False
)
name
=
models
.
CharField
(
'团队名称'
,
max_length
=
190
,
blank
=
False
)
country
=
models
.
ForeignKey
(
Country
,
blank
=
True
,
on_delete
=
models
.
CASCADE
)
parent
=
models
.
IntegerField
(
'父机构id'
,
default
=
None
)
in_use
=
models
.
IntegerField
(
'是否在用'
,
default
=
1
,
blank
=
False
)
createdAt
=
models
.
DateTimeField
(
'创建时间'
)
updatedAt
=
models
.
DateTimeField
(
'更新时间'
)
def
__str__
(
self
):
return
self
.
name
class
Meta
:
db_table
=
'team'
class
Seat
(
models
.
Model
):
__tablename__
=
'seat'
code
=
models
.
CharField
(
'坐席代码'
,
max_length
=
190
,
blank
=
False
)
name
=
models
.
CharField
(
'坐席名'
,
max_length
=
190
,
blank
=
False
)
team
=
models
.
ForeignKey
(
Team
,
blank
=
True
,
on_delete
=
models
.
CASCADE
)
in_use
=
models
.
IntegerField
(
'是否在用'
,
default
=
1
,
blank
=
False
)
createdAt
=
models
.
DateTimeField
(
'创建时间'
)
updatedAt
=
models
.
DateTimeField
(
'更新时间'
)
def
__str__
(
self
):
return
self
.
name
class
Meta
:
db_table
=
'seat'
class
Round
(
Func
):
function
=
'ROUND'
...
...
src/inspect_report/templates/inspect/group.html
View file @
2147ea60
...
...
@@ -87,9 +87,17 @@
end-placeholder=
"结束日期"
:default-time=
"['00:00:00', '23:59:59']"
>
</el-date-picker>
<el-select
v-
if=
"sel_is_show == true"
v-model=
"taskvalue"
filterable
placeholder=
"请选择"
@
change=
"changeTask
"
>
<el-select
v-
model=
"cityvalue"
filterable
placeholder=
"请选择"
@
change=
"changeCity
"
>
<el-option
v-for=
"item in taskList"
v-for=
"item in cityList"
:key=
"item.id"
:label=
"item.name"
:value=
"item.id"
>
</el-option>
</el-select>
<el-select
v-model=
"countryvalue"
filterable
placeholder=
"请选择"
@
change=
"changeCountry"
>
<el-option
v-for=
"item in countryList"
:key=
"item.id"
:label=
"item.name"
:value=
"item.id"
>
...
...
@@ -101,7 +109,8 @@
<form
ref=
"loadModal"
:action=
"`${BASEURL}api/v1/data/static_score_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=
"city"
:value=
"cityvalue"
>
<input
type=
"hidden"
name=
"country"
:value=
"countryvalue"
>
<input
type=
"hidden"
name=
"sort"
:value=
"sortObj.sort"
>
</form>
<!--
...
...
@@ -287,7 +296,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
/
group
.
js
"
%}"
></script>
</body>
</html>
src/inspect_report/urls_api_v1.py
View file @
2147ea60
...
...
@@ -23,6 +23,7 @@ router = routers.DefaultRouter()
router
.
register
(
r'tools'
,
api
.
ToolsApi
,
base_name
=
'tools'
)
router
.
register
(
r'tasks'
,
api
.
TasksApi
,
base_name
=
'tasks'
)
router
.
register
(
r'data'
,
api
.
DataApi
,
base_name
=
'data'
)
router
.
register
(
r'agency'
,
api
.
AgencyApi
,
base_name
=
'data'
)
# Wire up our API using automatic URL routing.
# Additionally, we include login URLs for the browsable API.
...
...
static/inspect/js/group.js
View file @
2147ea60
...
...
@@ -4,9 +4,13 @@ new Vue({
return
{
ss
:
'
sas
'
,
dateTime
:
''
,
taskList
:[],
taskvalue
:
''
,
cityvalue
:
null
,
countryvalue
:
null
,
teamvalue
:
null
,
start_date
:
''
,
init_simple
:
false
,
cityList
:[],
countryList
:[],
isscrollTop
:
false
,
currentPage
:
1
,
pagesize
:
10
,
...
...
@@ -71,42 +75,55 @@ new Vue({
changeRange
(
dateRange
){
this
.
start_date
=
dateRange
[
0
];
this
.
end_date
=
dateRange
[
1
];
this
.
getRule
(
this
.
task
value
,
this
.
start_date
,
this
.
end_date
,
this
.
takevalue
,
this
.
currentPage
,
10
);
// 获取统计数据
this
.
getRule
(
this
.
cityvalue
,
this
.
country
value
,
this
.
start_date
,
this
.
end_date
,
this
.
takevalue
,
this
.
currentPage
,
10
);
// 获取统计数据
},
change
Task
(
msg
){
change
City
(
msg
){
console
.
log
(
msg
);
this
.
taskvalue
=
msg
;
this
.
getTake
()
this
.
getRule
(
this
.
taskvalue
,
this
.
start_date
,
this
.
end_date
,
this
.
takevalue
,
this
.
currentPage
,
10
);
// 获取统计数据
this
.
cityvalue
=
msg
;
this
.
countryvalue
=
null
;
this
.
getCountry
(
this
.
cityvalue
);
this
.
getRule
(
this
.
cityvalue
,
this
.
countryvalue
,
this
.
start_date
,
this
.
end_date
,
this
.
takevalue
,
this
.
currentPage
,
10
);
// 获取统计数据
},
changeTake
(
msg
){
this
.
takevalue
=
msg
;
this
.
getRule
(
this
.
taskvalue
,
this
.
start_date
,
this
.
end_date
,
this
.
takevalue
,
this
.
currentPage
,
10
);
// 获取统计数据
changeCountry
(
msg
){
console
.
log
(
msg
);
this
.
countryvalue
=
msg
;
this
.
getRule
(
this
.
cityvalue
,
this
.
countryvalue
,
this
.
start_date
,
this
.
end_date
,
this
.
takevalue
,
this
.
currentPage
,
10
);
// 获取统计数据
},
getTask
(){
getCountry
()
{
let
that
=
this
;
RquestsGet
(
'
api/v1/agency/country/?city_id=
'
+
this
.
cityvalue
).
then
(
data
=>
{
//console.log(data);
if
(
data
.
code
!=
0
)
{
that
.
$message
(
'
服务器错误
'
)
}
else
{
that
.
countryList
=
data
.
data
.
country_list
;
}
})
},
getCity
(){
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
:
'
安徽省营业部
'
},
];
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
(
'
服务器错误
'
);
}
//RquestsGet('api/v1/tasks/obtain/').then(data => {
// //console.log(data);
// if(data.code != 0){
...
...
@@ -117,35 +134,23 @@ new Vue({
// }
//})
},
getTake
(){
let
that
=
this
;
RquestsGet
(
'
api/v1/tasks/seat/?task=
'
+
that
.
taskvalue
).
then
(
data
=>
{
//console.log(data);
if
(
data
.
code
!=
0
){
//that.takeList = [{agentName:'全部坐席'}]
}
else
{
that
.
takeList
=
data
.
data
;
}
})
},
CurrentChange
(
page
){
this
.
currentPage
=
page
;
this
.
getRule
(
this
.
task
value
,
this
.
start_date
,
this
.
end_date
,
this
.
takevalue
,
this
.
currentPage
,
10
);
// 获取统计数据
this
.
getRule
(
this
.
cityvalue
,
this
.
country
value
,
this
.
start_date
,
this
.
end_date
,
this
.
takevalue
,
this
.
currentPage
,
10
);
// 获取统计数据
},
popCurrentChange
(
page
){
this
.
poppage
=
page
;
this
.
getDetail
(
this
.
task
value
,
this
.
start_date
,
this
.
end_date
,
this
.
poptables
,
this
.
poprule
,
this
.
poppage
,
this
.
poppagesize
);
this
.
getDetail
(
this
.
cityvalue
,
this
.
country
value
,
this
.
start_date
,
this
.
end_date
,
this
.
poptables
,
this
.
poprule
,
this
.
poppage
,
this
.
poppagesize
);
},
getRule
(
task
,
start_date
,
end_date
,
agentName
,
page
,
page_size
){
getRule
(
city
,
country
,
start_date
,
end_date
,
agentName
,
page
,
page_size
){
let
that
=
this
;
console
.
log
(
start_date
,
end_date
);
let
arr
=
[];
this
.
$loading
({
text
:
'
数据加载中...
'
});
let
sort
=
this
.
sortObj
.
sort
;
RquestsPost
(
'
api/v1/tasks/static_score/
'
,{
task
,
end_date
,
start_date
,
agentName
,
page
,
page_size
,
sort
}).
then
(
data
=>
{
RquestsPost
(
'
api/v1/tasks/static_score/
'
,{
city
,
country
,
end_date
,
start_date
,
agentName
,
page
,
page_size
,
sort
}).
then
(
data
=>
{
console
.
log
(
data
.
data
);
if
(
data
.
code
!=
0
){
that
.
$message
(
data
.
msg
);
...
...
@@ -168,7 +173,7 @@ new Vue({
this
.
isHidePage
=
!
(
data
.
data
.
length
>
0
);
this
.
$loading
().
close
();
})
RquestsPost
(
'
api/v1/tasks/static/
'
,{
task
,
end_date
,
start_date
,
agentName
}).
then
(
data
=>
{
RquestsPost
(
'
api/v1/tasks/static/
'
,{
city
,
country
,
end_date
,
start_date
,
agentName
}).
then
(
data
=>
{
console
.
log
(
data
.
data
);
if
(
data
.
code
!=
0
){
that
.
$message
(
data
.
msg
);
...
...
@@ -184,12 +189,6 @@ new Vue({
return
false
;
}
that
.
titleInfo
=
data
.
data
;
if
(
name_list
.
indexOf
(
data
.
username
)
!==
-
1
)
{
that
.
sel_is_show
=
false
;
that
.
taskvalue
=
data
.
username
;
}
else
{
that
.
sel_is_show
=
true
;
}
//this.$loading().close();
})
},
...
...
@@ -206,7 +205,7 @@ new Vue({
this
.
popcurrentPage
=
1
;
this
.
poppage
=
1
;
this
.
taskvalue
=
tableData
.
area
;
this
.
getDetail
(
this
.
t
ask
value
,
this
.
start_date
,
this
.
end_date
,
this
.
poptables
,
this
.
poprule
,
this
.
poppage
,
this
.
poppagesize
);
this
.
getDetail
(
this
.
t
eam
value
,
this
.
start_date
,
this
.
end_date
,
this
.
poptables
,
this
.
poprule
,
this
.
poppage
,
this
.
poppagesize
);
this
.
dialogTableVisible
=
true
;
},
...
...
@@ -266,10 +265,10 @@ 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
.
get
City
();
// 获取市县机构信息
//this.getTake(); // 获取坐席
this
.
getRule
(
this
.
task
value
,
this
.
start_date
,
this
.
end_date
,
this
.
takevalue
,
this
.
currentPage
,
10
);
// 获取统计数据
this
.
getRule
(
this
.
cityvalue
,
this
.
country
value
,
this
.
start_date
,
this
.
end_date
,
this
.
takevalue
,
this
.
currentPage
,
10
);
// 获取统计数据
}
},
...
...
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