Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
event-analysis
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
崔义雄
event-analysis
Commits
b31c1235
Commit
b31c1235
authored
May 12, 2020
by
Kerwin_Cui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新
parent
1d883036
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
98 additions
and
52 deletions
+98
-52
event_analysis/models.py
event_analysis/models.py
+1
-0
event_analysis/views.py
event_analysis/views.py
+37
-8
templates/event_analysis/alarm_edit.html
templates/event_analysis/alarm_edit.html
+57
-44
templates/event_analysis/error_alarm.html
templates/event_analysis/error_alarm.html
+3
-0
No files found.
event_analysis/models.py
View file @
b31c1235
...
@@ -288,6 +288,7 @@ class Error_alarm(models.Model):
...
@@ -288,6 +288,7 @@ class Error_alarm(models.Model):
monitor_name
=
models
.
CharField
(
null
=
True
,
max_length
=
100
,
verbose_name
=
"监控名称"
)
monitor_name
=
models
.
CharField
(
null
=
True
,
max_length
=
100
,
verbose_name
=
"监控名称"
)
if_icube
=
models
.
CharField
(
null
=
True
,
max_length
=
100
,
verbose_name
=
"是否来自一体化平台"
)
if_icube
=
models
.
CharField
(
null
=
True
,
max_length
=
100
,
verbose_name
=
"是否来自一体化平台"
)
user
=
models
.
CharField
(
null
=
True
,
max_length
=
100
,
verbose_name
=
"处理人"
)
user
=
models
.
CharField
(
null
=
True
,
max_length
=
100
,
verbose_name
=
"处理人"
)
cant_auto_info
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"不可自动化信息"
)
def
toDic
(
self
):
def
toDic
(
self
):
return
dict
([(
attr
,
getattr
(
self
,
attr
))
for
attr
in
[
f
.
name
for
f
in
self
.
_meta
.
fields
]])
return
dict
([(
attr
,
getattr
(
self
,
attr
))
for
attr
in
[
f
.
name
for
f
in
self
.
_meta
.
fields
]])
...
...
event_analysis/views.py
View file @
b31c1235
...
@@ -2197,6 +2197,7 @@ def create_alarm(request):
...
@@ -2197,6 +2197,7 @@ def create_alarm(request):
if_auto
=
data
[
'if_auto'
]
if_auto
=
data
[
'if_auto'
]
auto_sysname
=
data
[
'auto_sysname'
]
auto_sysname
=
data
[
'auto_sysname'
]
auto_name
=
data
[
'auto_name'
]
auto_name
=
data
[
'auto_name'
]
cant_auto_info
=
data
[
'cantautoinfo'
]
other_autoname
=
data
[
'other_autoname'
]
other_autoname
=
data
[
'other_autoname'
]
monitor_name
=
data
[
'monitor_name'
]
monitor_name
=
data
[
'monitor_name'
]
if_icube
=
data
[
'if_icube'
]
if_icube
=
data
[
'if_icube'
]
...
@@ -2244,6 +2245,7 @@ def create_alarm(request):
...
@@ -2244,6 +2245,7 @@ def create_alarm(request):
other_autoname
=
other_autoname
,
other_autoname
=
other_autoname
,
monitor_name
=
monitor_name
,
monitor_name
=
monitor_name
,
if_icube
=
if_icube
,
if_icube
=
if_icube
,
cant_auto_info
=
cant_auto_info
,
user
=
login_person
user
=
login_person
)
)
error_alarm
.
save
()
error_alarm
.
save
()
...
@@ -2287,16 +2289,17 @@ def edit_alarm_display(request):
...
@@ -2287,16 +2289,17 @@ def edit_alarm_display(request):
'alarm_time'
:
alarm
.
alarm_happen_time
.
strftime
(
'
%
Y-
%
m-
%
d
%
H:
%
M:
%
S'
)
if
alarm
.
alarm_happen_time
else
''
,
'alarm_time'
:
alarm
.
alarm_happen_time
.
strftime
(
'
%
Y-
%
m-
%
d
%
H:
%
M:
%
S'
)
if
alarm
.
alarm_happen_time
else
''
,
'recover_time'
:
alarm
.
alarm_recover_time
.
strftime
(
'
%
Y-
%
m-
%
d
%
H:
%
M:
%
S'
)
if
alarm
.
alarm_recover_time
else
''
,
'recover_time'
:
alarm
.
alarm_recover_time
.
strftime
(
'
%
Y-
%
m-
%
d
%
H:
%
M:
%
S'
)
if
alarm
.
alarm_recover_time
else
''
,
'alarm_summary'
:
alarm
.
alarm_summary
if
alarm
.
alarm_summary
else
''
,
'alarm_summary'
:
alarm
.
alarm_summary
if
alarm
.
alarm_summary
else
''
,
'if_interpose'
:
alarm
.
if_interpose
if
alarm
.
if_interpose
else
''
,
'if_interpose'
:
int
(
alarm
.
if_interpose
)
if
alarm
.
if_interpose
else
''
,
'solve_process'
:
alarm
.
solve_process
if
alarm
.
solve_process
else
''
,
'solve_process'
:
alarm
.
solve_process
if
alarm
.
solve_process
else
''
,
'if_workday'
:
alarm
.
if_workday
if
alarm
.
if_workday
else
''
,
'if_workday'
:
int
(
alarm
.
if_workday
)
if
alarm
.
if_workday
else
''
,
'if_auto'
:
alarm
.
if_auto
if
alarm
.
if_auto
else
''
,
'if_auto'
:
int
(
alarm
.
if_auto
)
if
alarm
.
if_auto
else
''
,
'auto_sysname'
:
alarm
.
auto_sysname
if
alarm
.
auto_sysname
else
''
,
'auto_sysname'
:
alarm
.
auto_sysname
if
alarm
.
auto_sysname
else
''
,
'auto_name'
:
alarm
.
auto_name
if
alarm
.
auto_name
else
''
,
'auto_name'
:
alarm
.
auto_name
if
alarm
.
auto_name
else
''
,
'other_autoname'
:
alarm
.
other_autoname
if
alarm
.
other_autoname
else
''
,
'other_autoname'
:
alarm
.
other_autoname
if
alarm
.
other_autoname
else
''
,
'monitor_name'
:
alarm
.
monitor_name
if
alarm
.
monitor_name
else
''
,
'monitor_name'
:
alarm
.
monitor_name
if
alarm
.
monitor_name
else
''
,
'if_icube'
:
alarm
.
if_icube
if
alarm
.
if_icube
else
''
,
'if_icube'
:
int
(
alarm
.
if_icube
)
if
alarm
.
if_icube
else
''
,
'show_src'
:
show_src
'show_src'
:
show_src
,
'cantautoinfo'
:
alarm
.
cant_auto_info
if
alarm
.
cant_auto_info
else
''
}
}
return
render_json
(
return
render_json
(
{
{
...
@@ -2319,7 +2322,9 @@ def edit_alarm_display(request):
...
@@ -2319,7 +2322,9 @@ def edit_alarm_display(request):
def
edit_alarm
(
request
):
def
edit_alarm
(
request
):
try
:
try
:
data
=
json
.
loads
(
request
.
body
)
req
=
json
.
loads
(
request
.
body
)
data
=
req
[
'info'
]
alarm_number
=
req
[
'number'
]
alarm_type
=
data
[
'alarm_type'
]
alarm_type
=
data
[
'alarm_type'
]
alarm_system
=
data
[
'alarm_system'
]
alarm_system
=
data
[
'alarm_system'
]
alarm_time
=
data
[
'alarm_time'
]
alarm_time
=
data
[
'alarm_time'
]
...
@@ -2335,13 +2340,37 @@ def edit_alarm(request):
...
@@ -2335,13 +2340,37 @@ def edit_alarm(request):
monitor_name
=
data
[
'monitor_name'
]
monitor_name
=
data
[
'monitor_name'
]
if_icube
=
data
[
'if_icube'
]
if_icube
=
data
[
'if_icube'
]
alarm_time
=
alarm_time
.
replace
(
'T'
,
' '
)
alarm_time
=
alarm_time
.
replace
(
'T'
,
' '
)
alarm_time
=
alarm_time
[
0
:
-
5
]
#
alarm_time = alarm_time[0:-5]
alarm_time
=
datetime
.
datetime
.
strptime
(
alarm_time
,
"
%
Y-
%
m-
%
d
%
H:
%
M:
%
S"
)
alarm_time
=
datetime
.
datetime
.
strptime
(
alarm_time
,
"
%
Y-
%
m-
%
d
%
H:
%
M:
%
S"
)
alarm_time
=
(
alarm_time
+
datetime
.
timedelta
(
hours
=
8
))
alarm_time
=
(
alarm_time
+
datetime
.
timedelta
(
hours
=
8
))
recover_time
=
recover_time
.
replace
(
'T'
,
' '
)
recover_time
=
recover_time
.
replace
(
'T'
,
' '
)
recover_time
=
recover_time
[
0
:
-
5
]
#
recover_time = recover_time[0:-5]
recover_time
=
datetime
.
datetime
.
strptime
(
recover_time
,
"
%
Y-
%
m-
%
d
%
H:
%
M:
%
S"
)
recover_time
=
datetime
.
datetime
.
strptime
(
recover_time
,
"
%
Y-
%
m-
%
d
%
H:
%
M:
%
S"
)
recover_time
=
(
recover_time
+
datetime
.
timedelta
(
hours
=
8
))
recover_time
=
(
recover_time
+
datetime
.
timedelta
(
hours
=
8
))
alarm
=
Error_alarm
.
objects
.
get
(
alarm_number
=
alarm_number
)
alarm
.
alarm_number
=
alarm_number
alarm
.
alarm_level
=
alarm_type
alarm
.
alarm_system
=
alarm_system
alarm
.
alarm_happen_time
=
alarm_time
alarm
.
alarm_recover_time
=
recover_time
alarm
.
alarm_summary
=
alarm_summary
alarm
.
if_interpose
=
if_interpose
alarm
.
solve_process
=
solve_process
alarm
.
if_workday
=
if_workday
alarm
.
if_auto
=
if_auto
alarm
.
auto_sysname
=
auto_sysname
alarm
.
auto_name
=
auto_name
alarm
.
other_autoname
=
other_autoname
alarm
.
monitor_name
=
monitor_name
alarm
.
if_icube
=
if_icube
alarm
.
save
()
return
render_json
(
{
"result"
:
True
,
"code"
:
0
,
"message"
:
u"编辑成功!"
,
"data"
:
''
})
except
Exception
as
e
:
except
Exception
as
e
:
return
render_json
(
return
render_json
(
{
{
...
...
templates/event_analysis/alarm_edit.html
View file @
b31c1235
This diff is collapsed.
Click to expand it.
templates/event_analysis/error_alarm.html
View file @
b31c1235
...
@@ -460,6 +460,8 @@
...
@@ -460,6 +460,8 @@
}
}
},
},
createNewAlarm
()
{
createNewAlarm
()
{
window
.
localStorage
.
setItem
(
"
alarm_info
"
,
''
);
window
.
localStorage
.
setItem
(
"
alarm_number
"
,
''
);
window
.
location
.
href
=
"
${SITE_URL}alarm_edit
"
window
.
location
.
href
=
"
${SITE_URL}alarm_edit
"
},
},
createNewTask
()
{
createNewTask
()
{
...
@@ -534,6 +536,7 @@
...
@@ -534,6 +536,7 @@
//编辑模板
//编辑模板
readRow
(
row
)
{
readRow
(
row
)
{
let
data
=
{
alarm_number
:
row
.
alarm_number
};
let
data
=
{
alarm_number
:
row
.
alarm_number
};
window
.
localStorage
.
setItem
(
"
alarm_number
"
,
row
.
alarm_number
);
axios
.
post
(
"
${SITE_URL}edit_alarm_display/
"
,
data
).
then
(
res
=>
{
axios
.
post
(
"
${SITE_URL}edit_alarm_display/
"
,
data
).
then
(
res
=>
{
window
.
localStorage
.
setItem
(
"
alarm_info
"
,
JSON
.
stringify
(
res
.
results
));
window
.
localStorage
.
setItem
(
"
alarm_info
"
,
JSON
.
stringify
(
res
.
results
));
window
.
location
.
href
=
"
${SITE_URL}alarm_edit
"
window
.
location
.
href
=
"
${SITE_URL}alarm_edit
"
...
...
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