Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
CivManage
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
ReactWeb5
CivManage
Commits
9a436d7b
Commit
9a436d7b
authored
May 11, 2021
by
shaoan123
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化人工智能下的策略下发和预测方案
parent
d8b9fe8f
Pipeline
#27385
skipped with stages
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
83 additions
and
66 deletions
+83
-66
AddModal.jsx
...s/artificial/policiesIssued/predictionConfig/AddModal.jsx
+39
-22
predictionConfig.jsx
...cial/policiesIssued/predictionConfig/predictionConfig.jsx
+6
-0
AddModal.jsx
...ges/artificial/policiesIssued/strategyConfig/AddModal.jsx
+38
-44
No files found.
src/pages/artificial/policiesIssued/predictionConfig/AddModal.jsx
View file @
9a436d7b
...
...
@@ -37,6 +37,8 @@ const AddModal = props => {
let
obj
=
form
.
getFieldsValue
();
let
DateFrom
=
moment
(
obj
.
time
[
0
]).
format
(
'YYYY-MM-DD'
)
let
DateTo
=
moment
(
obj
.
time
[
1
]).
format
(
'YYYY-MM-DD'
)
let
PredictDateFrom
=
moment
(
obj
.
PredictTime
[
0
]).
format
(
'YYYY-MM-DD'
)
let
PredictDateTo
=
moment
(
obj
.
PredictTime
[
1
]).
format
(
'YYYY-MM-DD'
)
let
api
=
addPredictOptions
let
query
=
{
SceneName
:
obj
.
SceneName
,
...
...
@@ -45,8 +47,8 @@ const AddModal = props => {
DateFrom
:
DateFrom
,
DateTo
:
DateTo
,
DeviceType
:
obj
.
DeviceType
,
PredictDateFrom
:
""
,
PredictDateTo
:
""
,
PredictDateFrom
,
PredictDateTo
,
PredictName
:
obj
.
PredictName
,
Remarks
:
obj
.
Remarks
,
DeviceDetails
:
card
...
...
@@ -102,13 +104,13 @@ const AddModal = props => {
if
(
type
===
'add'
)
{
form
.
resetFields
();
setCycleValue
(
''
);
setIntervalType
(
''
);
setIntervalType
(
'
小时
'
);
setCard
([])
setDeviceList
([])
}
else
{
setDeviceList
([])
form
.
setFieldsValue
({
time
:
[
moment
(
formObj
.
DateFrom
,
"YYYYMMDD"
),
moment
(
formObj
.
DateTo
,
"YYYYMMDD"
)],
...
formObj
});
form
.
setFieldsValue
({
time
:
[
moment
(
formObj
.
DateFrom
,
"YYYYMMDD"
),
moment
(
formObj
.
DateTo
,
"YYYYMMDD"
)],
PredictTime
:
[
moment
(
formObj
.
PredictDateFrom
,
"YYYYMMDD"
),
moment
(
formObj
.
PredictDateTo
,
"YYYYMMDD"
)],
...
formObj
});
setCycleValue
(
formObj
.
CycleValue
);
setIntervalType
(
formObj
.
Cycle
);
if
(
formObj
.
DeviceDetails
.
length
)
{
...
...
@@ -148,13 +150,9 @@ const AddModal = props => {
arr
.
map
((
item
,
index
)
=>
{
arr
[
index
].
code
=
respone
.
getMe
.
length
?
respone
.
getMe
[
0
].
DeviceList
:
[]
arr
[
index
].
indexStr
=
''
form
.
setFieldsValue
({
[
`deviceCode
${
index
}
`
]:
''
,
[
`indextr
${
index
}
`
]:
''
,
[
`max
${
index
}
`
]:
''
,
[
`min
${
index
}
`
]:
''
})
clearInput
(
index
)
})
setDeviceList
(
arr
)
}
setLoading
(
false
)
...
...
@@ -232,10 +230,19 @@ const AddModal = props => {
const
deleteDevice
=
(
index
)
=>
{
let
cardList
=
[...
card
]
let
arr
=
[...
deviceList
]
let
newCardList
=
cardList
.
splice
(
0
,
1
)
let
newArr
=
arr
.
splice
(
0
,
1
)
setCard
(
index
==
0
?
[]
:
newCardList
)
setDeviceList
(
index
==
0
?
[]
:
newArr
)
cardList
.
splice
(
index
,
1
);
arr
.
splice
(
index
,
1
);
clearInput
(
index
)
setCard
(
cardList
)
setDeviceList
(
arr
)
}
const
clearInput
=
(
index
)
=>
{
form
.
setFieldsValue
({
[
`deviceCode
${
index
}
`
]:
undefined
,
[
`indextr
${
index
}
`
]:
undefined
,
[
`max
${
index
}
`
]:
undefined
,
[
`min
${
index
}
`
]:
undefined
})
}
//选择小时,分,天
const
selectCycleValue
=
(
e
)
=>
{
...
...
@@ -294,15 +301,27 @@ const AddModal = props => {
<
RangePicker
locale=
{
locale
}
style=
{
{
width
:
'100%'
}
}
/>
</
Item
>
<
Item
label=
"首次计算时间"
name=
"PredictTime"
rules=
{
[{
required
:
true
,
message
:
'请选择首次执行时间'
}]
}
>
<
RangePicker
locale=
{
locale
}
style=
{
{
width
:
'100%'
}
}
/>
</
Item
>
<
Item
label=
"预测间隔"
name=
"Cycle"
rules=
{
[{
required
:
true
,
message
:
'请输入预测间隔'
}]
}
>
<
div
className=
{
styles
.
predict
}
></
div
>
<
Input
style=
{
{
width
:
'70%'
}
}
placeholder=
"请输入预测间隔"
value=
{
CycleValue
}
onChange=
{
(
value
)
=>
selectCycleValue
(
value
)
}
allowClear
/>
<
Select
style=
{
{
marginLeft
:
'0.5rem'
,
width
:
'28%'
}
}
onChange=
{
handleIntervalType
}
value=
{
intervalType
}
>
{
timeType
.
length
?
timeType
.
map
((
item
,
index
)
=>
{
return
<
Select
.
Option
key=
{
index
}
value=
{
item
}
>
{
item
}
</
Select
.
Option
>
})
:
''
}
</
Select
>
<
div
>
<
div
className=
{
styles
.
predict
}
></
div
>
<
Input
style=
{
{
width
:
'70%'
}
}
placeholder=
"请输入预测间隔"
value=
{
CycleValue
}
onChange=
{
(
value
)
=>
selectCycleValue
(
value
)
}
allowClear
/>
<
Select
style=
{
{
marginLeft
:
'0.5rem'
,
width
:
'28%'
}
}
onChange=
{
handleIntervalType
}
value=
{
intervalType
}
>
{
timeType
.
length
?
timeType
.
map
((
item
,
index
)
=>
{
return
<
Select
.
Option
key=
{
index
}
value=
{
item
}
>
{
item
}
</
Select
.
Option
>
})
:
''
}
</
Select
>
</
div
>
</
Item
>
<
Item
...
...
@@ -352,16 +371,14 @@ const AddModal = props => {
<
Item
label=
"最小值"
name=
{
'min'
+
index
}
rules=
{
[{
required
:
true
,
message
:
'请输入最小值'
}]
}
>
<
Input
placeholder=
"请输入最小值"
onChange=
{
(
value
)
=>
inputMin
(
value
,
index
)
}
index=
{
index
}
allowClear
/>
<
Input
placeholder=
"请输入最小值"
style=
{
{
width
:
'98%'
}
}
onChange=
{
(
value
)
=>
inputMin
(
value
,
index
)
}
index=
{
index
}
allowClear
/>
</
Item
>
</
Col
>
<
Col
span=
{
12
}
>
<
Item
label=
"最大值"
name=
{
'max'
+
index
}
rules=
{
[{
required
:
true
,
message
:
'请输入最大值'
}]
}
>
<
Input
style=
{
{
width
:
'98%'
}
}
placeholder=
"请输入最大值"
onChange=
{
(
value
)
=>
inputMax
(
value
,
index
)
}
index=
{
index
}
allowClear
/>
</
Item
>
...
...
src/pages/artificial/policiesIssued/predictionConfig/predictionConfig.jsx
View file @
9a436d7b
...
...
@@ -59,6 +59,12 @@ const VectorData = props => {
key
:
'DateFrom'
,
align
:
'center'
},
{
title
:
'首次计算时间'
,
dataIndex
:
'PredictDateFrom'
,
key
:
'PredictDateFrom'
,
align
:
'center'
},
{
title
:
'描述'
,
dataIndex
:
'Remarks'
,
...
...
src/pages/artificial/policiesIssued/strategyConfig/AddModal.jsx
View file @
9a436d7b
...
...
@@ -10,7 +10,7 @@ import locale from 'antd/lib/date-picker/locale/zh_CN'
import
'moment/locale/zh-cn'
moment
.
locale
(
'zh-cn'
)
import
{
getEquipmentInfo
,
getQutaList
,
getSceneNameInfo
,
addStrategyOptions
,
editStrategyOptions
,
getPredictDevice
,
getPredictDevicePoint
getEquipmentInfo
,
getQutaList
,
addStrategyOptions
,
editStrategyOptions
,
getPredictDevice
,
getPredictDevicePoint
,
getPredictInfo
}
from
'@/services/intelligence/api'
;
import
{
DeleteOutlined
}
from
'@ant-design/icons'
;
...
...
@@ -25,7 +25,8 @@ const AddModal = props => {
const
[
predictCode
,
setPredictCode
]
=
useState
([]);
//预测编码列表
const
[
deviceList
,
setDeviceList
]
=
useState
([]);
//设备列表
const
[
card
,
setCard
]
=
useState
([]);
//卡片列表值
const
[
sceneList
,
setSceneList
]
=
useState
([])
const
[
source
,
setSource
]
=
useState
([])
const
[
PredictID
,
setPredictID
]
=
useState
()
const
[
form
]
=
Form
.
useForm
();
const
{
Item
}
=
Form
;
// 提交
...
...
@@ -40,7 +41,8 @@ const AddModal = props => {
StrategyName
:
obj
.
StrategyName
,
StrategyType
:
obj
.
StrategyType
,
DetailInfos
:
card
,
CreateTime
:
moment
(
obj
.
time
).
format
(
'YYYY-MM-DD HH:mm:ss'
)
CreateTime
:
moment
(
new
Date
()).
format
(
'YYYY-MM-DD HH:mm:ss'
),
PredictID
}
type
===
'edit'
?
(
query
.
ID
=
formObj
.
ID
)
&&
(
api
=
editStrategyOptions
)
:
delete
query
.
ID
&&
(
api
=
addStrategyOptions
)
setLoading
(
true
);
...
...
@@ -91,6 +93,9 @@ const AddModal = props => {
//页面初始化
const
initData
=
()
=>
{
getPredictInfo
().
then
(
res
=>
{
res
.
getMe
&&
res
.
getMe
.
length
&&
setSource
(
res
.
getMe
)
})
if
(
type
===
'add'
)
{
form
.
resetFields
();
setCard
([])
...
...
@@ -126,9 +131,6 @@ const AddModal = props => {
}
getSceneNameInfo
().
then
(
res
=>
{
res
.
getMe
.
length
&&
setSceneList
(
res
.
getMe
)
})
}
//获取设备编码
const
getDeviceCode
=
()
=>
{
...
...
@@ -146,12 +148,7 @@ const AddModal = props => {
arr
[
index
].
predictCode
=
respone
[
1
].
getMe
.
length
?
respone
[
1
].
getMe
:
[]
arr
[
index
].
indexStr
=
''
arr
[
index
].
predictStr
=
''
form
.
setFieldsValue
({
[
`deviceCode
${
index
}
`
]:
''
,
[
`indextr
${
index
}
`
]:
''
,
[
`max
${
index
}
`
]:
''
,
[
`min
${
index
}
`
]:
''
})
clearInput
(
index
)
})
setDeviceList
(
arr
)
}
...
...
@@ -214,20 +211,7 @@ const AddModal = props => {
cardList
[
+
option
.
index
].
PredictPoint
=
value
setCard
(
cardList
)
}
//最大值
const
inputMax
=
(
e
,
option
)
=>
{
e
.
persist
();
let
cardList
=
[...
card
]
cardList
[
option
].
MaxValue
=
e
.
target
.
value
setCard
(
cardList
)
}
//最小值
const
inputMin
=
(
e
,
option
)
=>
{
e
.
persist
();
let
cardList
=
[...
card
]
cardList
[
option
].
MinValue
=
e
.
target
.
value
setCard
(
cardList
)
}
const
add
=
()
=>
{
let
obj
=
form
.
getFieldsValue
();
if
(
!
obj
.
DeviceType
)
{
...
...
@@ -245,14 +229,27 @@ const AddModal = props => {
setDeviceList
(
arr
)
}
}
//清除卡片删除一项的值
const
clearInput
=
(
index
)
=>
{
form
.
setFieldsValue
({
[
`deviceCode
${
index
}
`
]:
undefined
,
[
`indextr
${
index
}
`
]:
undefined
,
[
`max
${
index
}
`
]:
undefined
,
[
`min
${
index
}
`
]:
undefined
})
}
//删除卡片
const
deleteDevice
=
(
index
)
=>
{
let
cardList
=
[...
card
]
let
arr
=
[...
deviceList
]
let
newCardList
=
cardList
.
splice
(
0
,
1
)
let
newArr
=
arr
.
splice
(
0
,
1
)
setCard
(
index
==
0
?
[]
:
newCardList
)
setDeviceList
(
index
==
0
?
[]
:
newArr
)
cardList
.
splice
(
index
,
1
)
arr
.
splice
(
index
,
1
)
clearInput
(
index
)
setCard
(
cardList
)
setDeviceList
(
arr
)
}
const
handleOrgin
=
(
value
,
option
)
=>
{
setPredictID
(
option
.
id
)
}
return
(
...
...
@@ -277,14 +274,14 @@ const AddModal = props => {
<
Item
label=
"策略名称"
name=
"StrategyName"
rules=
{
[{
required
:
true
,
message
:
'请输入
方案
名称'
}]
}
rules=
{
[{
required
:
true
,
message
:
'请输入
策略
名称'
}]
}
>
<
Input
placeholder=
"请输入任务名称"
allowClear
/>
</
Item
>
<
Item
label=
"策略类型"
name=
"StrategyType"
rules=
{
[{
required
:
true
,
message
:
'请
输入算法名称
'
}]
}
rules=
{
[{
required
:
true
,
message
:
'请
选择策略类型
'
}]
}
>
<
Select
>
<
Select
.
Option
value=
'实时控制'
>
实时控制
</
Select
.
Option
>
...
...
@@ -292,6 +289,15 @@ const AddModal = props => {
</
Select
>
</
Item
>
<
Item
label=
"数据来源"
name=
"PredictName"
rules=
{
[{
required
:
true
,
message
:
'请选择数据来源'
}]
}
>
<
Select
onChange=
{
(
value
,
option
)
=>
handleOrgin
(
value
,
option
)
}
>
{
source
.
length
?
source
.
map
((
item
,
index
)
=>
{
return
<
Select
.
Option
key=
{
index
}
id=
{
item
.
ID
}
value=
{
item
.
PredictName
}
>
{
item
.
PredictName
}
</
Select
.
Option
>
})
:
''
}
</
Select
>
</
Item
>
<
Item
label=
"设备类型"
name=
"DeviceType"
...
...
@@ -300,18 +306,6 @@ const AddModal = props => {
{
deviceType
.
length
?
deviceType
.
map
((
item
,
index
)
=>
{
return
<
Select
.
Option
key=
{
index
}
value=
{
item
.
DeviceType
}
>
{
item
.
DeviceType
}
</
Select
.
Option
>
})
:
''
}
</
Select
>
</
Item
>
<
Item
label=
"创建时间"
name=
"time"
rules=
{
[{
required
:
true
,
message
:
'请选择创建时间'
}]
}
>
<
DatePicker
locale=
{
locale
}
showTime=
{
{
format
:
'HH:mm:ss'
}
}
format=
"YYYY-MM-DD HH:mm:ss"
style=
{
{
width
:
'100%'
}
}
/>
</
Item
>
<
Item
label=
"描述"
name=
"StrategyDes"
...
...
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