Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
so-manage-ui
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
smart-operation
so-manage-ui
Commits
c1404046
Commit
c1404046
authored
Jul 21, 2023
by
张耀
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:
优化逻辑
parent
02731e6f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
25 deletions
+45
-25
src/page/main/forewarning/rule-set/detail/index.vue
src/page/main/forewarning/rule-set/detail/index.vue
+8
-9
src/page/main/forewarning/rule-set/modules/custom.vue
src/page/main/forewarning/rule-set/modules/custom.vue
+16
-6
src/page/main/forewarning/rule-set/modules/gateway.vue
src/page/main/forewarning/rule-set/modules/gateway.vue
+21
-10
No files found.
src/page/main/forewarning/rule-set/detail/index.vue
View file @
c1404046
...
...
@@ -226,27 +226,26 @@ const getInfoData = () => {
...
ruleHeaders
.
value
,
];
}
let
unit
=
ruleTypeOptions
.
value
[
data
.
alert_rule_type
]?.
unit
||
""
;
ruleRows
.
value
=
data
.
alert_condition
.
map
((
e
)
=>
{
let
min
=
e
.
thresholds_min
;
if
(
min
===
undefined
)
{
let
min
=
e
.
thresholds_min
+
unit
;
if
(
e
.
thresholds_
min
===
undefined
)
{
if
(
ruleTypeOptions
.
value
[
data
.
alert_rule_type
].
down
!==
""
)
{
min
=
ruleTypeOptions
.
value
[
data
.
alert_rule_type
].
down
;
min
=
ruleTypeOptions
.
value
[
data
.
alert_rule_type
].
down
+
unit
;
}
else
{
min
=
WIELESS_SMALL
;
}
}
let
max
=
e
.
thresholds_max
;
if
(
max
===
undefined
)
{
let
max
=
e
.
thresholds_max
+
unit
;
if
(
e
.
thresholds_
max
===
undefined
)
{
if
(
ruleTypeOptions
.
value
[
data
.
alert_rule_type
].
up
!==
""
)
{
max
=
ruleTypeOptions
.
value
[
data
.
alert_rule_type
].
up
;
max
=
ruleTypeOptions
.
value
[
data
.
alert_rule_type
].
up
+
unit
;
}
else
{
max
=
WIELESS_SMALL
;
}
}
return
{
warning_threshold
:
`
${
min
}${
ruleTypeOptions
.
value
[
data
.
alert_rule_type
]?.
unit
||
""
}
-
$
{
max
}
$
{
ruleTypeOptions
.
value
[
data
.
alert_rule_type
]?.
unit
||
""
}
`,
warning_threshold
:
`
${
min
}
-
${
max
}
`
,
risk_level
:
riskLevelOptions
[
e
.
risk_level
],
};
});
...
...
src/page/main/forewarning/rule-set/modules/custom.vue
View file @
c1404046
...
...
@@ -259,7 +259,7 @@ const inputNum = (index, key) => {
const
changeWarningThresholdFrom
=
(
index
)
=>
{
let
{
down
,
up
}
=
limit
.
value
;
let
{
from
,
to
}
=
state
.
form
.
ruleRows
[
index
];
if
(
to
!=
""
&&
from
>
+
to
)
{
if
(
to
!=
""
&&
from
!==
""
&&
from
>
+
to
)
{
ElMessage
.
error
(
`下限不能大于上限`
);
state
.
form
.
ruleRows
[
index
].
from
=
""
;
return
;
...
...
@@ -276,8 +276,13 @@ const changeWarningThresholdFrom = (index) => {
if
(
rows
.
length
==
0
)
return
;
try
{
rows
.
forEach
((
e
)
=>
{
if
(
e
.
up
!==
""
&&
e
.
down
!==
""
&&
+
e
.
up
>=
+
from
&&
+
from
>
+
e
.
down
)
{
throw
""
;
if
(
from
!==
""
)
{
if
(
i
==
0
&&
e
.
down
===
""
&&
+
from
<=
+
e
.
up
)
{
throw
""
;
}
if
(
e
.
up
!==
""
&&
e
.
down
!==
""
&&
+
e
.
up
>=
+
from
&&
+
from
>
+
e
.
down
)
{
throw
""
;
}
}
});
}
catch
(
e
)
{
...
...
@@ -288,7 +293,7 @@ const changeWarningThresholdFrom = (index) => {
const
changeWarningThresholdTo
=
(
index
)
=>
{
let
{
down
,
up
}
=
limit
.
value
;
let
{
from
,
to
}
=
state
.
form
.
ruleRows
[
index
];
if
(
from
!=
""
&&
from
>
+
to
)
{
if
(
from
!=
""
&&
from
!==
""
&&
from
>
+
to
)
{
ElMessage
.
error
(
`下限不能大于上限`
);
state
.
form
.
ruleRows
[
index
].
to
=
""
;
return
;
...
...
@@ -305,8 +310,13 @@ const changeWarningThresholdTo = (index) => {
if
(
rows
.
length
==
0
)
return
;
try
{
rows
.
forEach
((
e
)
=>
{
if
(
e
.
up
!==
""
&&
e
.
down
!==
""
&&
+
e
.
up
>
+
to
&&
+
to
>
+
e
.
down
)
{
throw
""
;
if
(
to
!==
""
)
{
if
(
i
==
rows
.
length
-
1
&&
e
.
up
===
""
&&
+
to
>
+
e
.
down
)
{
throw
""
;
}
if
(
e
.
up
!==
""
&&
e
.
down
!==
""
&&
+
e
.
up
>
+
to
&&
+
to
>
+
e
.
down
)
{
throw
""
;
}
}
});
}
catch
(
e
)
{
...
...
src/page/main/forewarning/rule-set/modules/gateway.vue
View file @
c1404046
...
...
@@ -198,8 +198,8 @@ const setLimits = (index) => {
return
(
rows
.
map
((
e
)
=>
{
return
{
down
:
+
e
.
from
,
up
:
+
e
.
to
,
down
:
e
.
from
,
up
:
e
.
to
,
};
})
||
[]
);
...
...
@@ -218,7 +218,7 @@ const limit = computed(() => {
const
changeWarningThresholdFrom
=
(
index
)
=>
{
let
{
down
,
up
}
=
limit
.
value
;
let
{
from
,
to
}
=
state
.
form
.
ruleRows
[
index
];
if
(
to
!=
""
&&
from
>
+
to
)
{
if
(
to
!=
=
""
&&
from
!==
""
&&
from
>
+
to
)
{
ElMessage
.
error
(
`下限不能大于上限`
);
state
.
form
.
ruleRows
[
index
].
from
=
""
;
return
;
...
...
@@ -234,9 +234,14 @@ const changeWarningThresholdFrom = (index) => {
let
rows
=
setLimits
(
index
);
if
(
rows
.
length
==
0
)
return
;
try
{
rows
.
forEach
((
e
)
=>
{
if
(
e
.
up
!==
""
&&
e
.
down
!==
""
&&
+
e
.
up
>=
+
from
&&
+
from
>
+
e
.
down
)
{
throw
""
;
rows
.
forEach
((
e
,
i
)
=>
{
if
(
from
!==
""
)
{
if
(
i
==
0
&&
e
.
down
===
""
&&
+
from
<=
+
e
.
up
)
{
throw
""
;
}
if
(
e
.
up
!==
""
&&
e
.
down
!==
""
&&
+
e
.
up
>=
+
from
&&
+
from
>
+
e
.
down
)
{
throw
""
;
}
}
});
}
catch
(
e
)
{
...
...
@@ -255,9 +260,10 @@ const inputNum = (index, key) => {
.
replace
(
/
(\d)\-
/g
,
"
$1
"
);
//过滤处于非开头的负号
};
const
changeWarningThresholdTo
=
(
index
)
=>
{
console
.
log
(
1
);
let
{
down
,
up
}
=
limit
.
value
;
let
{
from
,
to
}
=
state
.
form
.
ruleRows
[
index
];
if
(
from
!
=
""
&&
from
>
+
to
)
{
if
(
to
!==
""
&&
from
!=
=
""
&&
from
>
+
to
)
{
ElMessage
.
error
(
`下限不能大于上限`
);
state
.
form
.
ruleRows
[
index
].
to
=
""
;
return
;
...
...
@@ -273,9 +279,14 @@ const changeWarningThresholdTo = (index) => {
let
rows
=
setLimits
(
index
);
if
(
rows
.
length
==
0
)
return
;
try
{
rows
.
forEach
((
e
)
=>
{
if
(
e
.
up
!==
""
&&
e
.
down
!==
""
&&
+
e
.
up
>
+
to
&&
+
to
>
+
e
.
down
)
{
throw
""
;
rows
.
forEach
((
e
,
i
)
=>
{
if
(
to
!==
""
)
{
if
(
i
==
rows
.
length
-
1
&&
e
.
up
===
""
&&
+
to
>
+
e
.
down
)
{
throw
""
;
}
if
(
e
.
up
!==
""
&&
e
.
down
!==
""
&&
+
e
.
up
>
+
to
&&
+
to
>
+
e
.
down
)
{
throw
""
;
}
}
});
}
catch
(
e
)
{
...
...
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