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
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
78 additions
and
61 deletions
+78
-61
AddModal.jsx
...s/artificial/policiesIssued/predictionConfig/AddModal.jsx
+34
-17
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 => {
...
@@ -37,6 +37,8 @@ const AddModal = props => {
let
obj
=
form
.
getFieldsValue
();
let
obj
=
form
.
getFieldsValue
();
let
DateFrom
=
moment
(
obj
.
time
[
0
]).
format
(
'YYYY-MM-DD'
)
let
DateFrom
=
moment
(
obj
.
time
[
0
]).
format
(
'YYYY-MM-DD'
)
let
DateTo
=
moment
(
obj
.
time
[
1
]).
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
api
=
addPredictOptions
let
query
=
{
let
query
=
{
SceneName
:
obj
.
SceneName
,
SceneName
:
obj
.
SceneName
,
...
@@ -45,8 +47,8 @@ const AddModal = props => {
...
@@ -45,8 +47,8 @@ const AddModal = props => {
DateFrom
:
DateFrom
,
DateFrom
:
DateFrom
,
DateTo
:
DateTo
,
DateTo
:
DateTo
,
DeviceType
:
obj
.
DeviceType
,
DeviceType
:
obj
.
DeviceType
,
PredictDateFrom
:
""
,
PredictDateFrom
,
PredictDateTo
:
""
,
PredictDateTo
,
PredictName
:
obj
.
PredictName
,
PredictName
:
obj
.
PredictName
,
Remarks
:
obj
.
Remarks
,
Remarks
:
obj
.
Remarks
,
DeviceDetails
:
card
DeviceDetails
:
card
...
@@ -102,13 +104,13 @@ const AddModal = props => {
...
@@ -102,13 +104,13 @@ const AddModal = props => {
if
(
type
===
'add'
)
{
if
(
type
===
'add'
)
{
form
.
resetFields
();
form
.
resetFields
();
setCycleValue
(
''
);
setCycleValue
(
''
);
setIntervalType
(
''
);
setIntervalType
(
'
小时
'
);
setCard
([])
setCard
([])
setDeviceList
([])
setDeviceList
([])
}
}
else
{
else
{
setDeviceList
([])
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
);
setCycleValue
(
formObj
.
CycleValue
);
setIntervalType
(
formObj
.
Cycle
);
setIntervalType
(
formObj
.
Cycle
);
if
(
formObj
.
DeviceDetails
.
length
)
{
if
(
formObj
.
DeviceDetails
.
length
)
{
...
@@ -148,13 +150,9 @@ const AddModal = props => {
...
@@ -148,13 +150,9 @@ const AddModal = props => {
arr
.
map
((
item
,
index
)
=>
{
arr
.
map
((
item
,
index
)
=>
{
arr
[
index
].
code
=
respone
.
getMe
.
length
?
respone
.
getMe
[
0
].
DeviceList
:
[]
arr
[
index
].
code
=
respone
.
getMe
.
length
?
respone
.
getMe
[
0
].
DeviceList
:
[]
arr
[
index
].
indexStr
=
''
arr
[
index
].
indexStr
=
''
form
.
setFieldsValue
({
clearInput
(
index
)
[
`deviceCode
${
index
}
`
]:
''
,
[
`indextr
${
index
}
`
]:
''
,
[
`max
${
index
}
`
]:
''
,
[
`min
${
index
}
`
]:
''
})
})
})
setDeviceList
(
arr
)
setDeviceList
(
arr
)
}
}
setLoading
(
false
)
setLoading
(
false
)
...
@@ -232,10 +230,19 @@ const AddModal = props => {
...
@@ -232,10 +230,19 @@ const AddModal = props => {
const
deleteDevice
=
(
index
)
=>
{
const
deleteDevice
=
(
index
)
=>
{
let
cardList
=
[...
card
]
let
cardList
=
[...
card
]
let
arr
=
[...
deviceList
]
let
arr
=
[...
deviceList
]
let
newCardList
=
cardList
.
splice
(
0
,
1
)
cardList
.
splice
(
index
,
1
);
let
newArr
=
arr
.
splice
(
0
,
1
)
arr
.
splice
(
index
,
1
);
setCard
(
index
==
0
?
[]
:
newCardList
)
clearInput
(
index
)
setDeviceList
(
index
==
0
?
[]
:
newArr
)
setCard
(
cardList
)
setDeviceList
(
arr
)
}
const
clearInput
=
(
index
)
=>
{
form
.
setFieldsValue
({
[
`deviceCode
${
index
}
`
]:
undefined
,
[
`indextr
${
index
}
`
]:
undefined
,
[
`max
${
index
}
`
]:
undefined
,
[
`min
${
index
}
`
]:
undefined
})
}
}
//选择小时,分,天
//选择小时,分,天
const
selectCycleValue
=
(
e
)
=>
{
const
selectCycleValue
=
(
e
)
=>
{
...
@@ -294,15 +301,27 @@ const AddModal = props => {
...
@@ -294,15 +301,27 @@ const AddModal = props => {
<
RangePicker
locale=
{
locale
}
<
RangePicker
locale=
{
locale
}
style=
{
{
width
:
'100%'
}
}
/>
style=
{
{
width
:
'100%'
}
}
/>
</
Item
>
</
Item
>
<
Item
label=
"首次计算时间"
name=
"PredictTime"
rules=
{
[{
required
:
true
,
message
:
'请选择首次执行时间'
}]
}
>
<
RangePicker
locale=
{
locale
}
style=
{
{
width
:
'100%'
}
}
/>
</
Item
>
<
Item
<
Item
label=
"预测间隔"
label=
"预测间隔"
name=
"Cycle"
rules=
{
[{
required
:
true
,
message
:
'请输入预测间隔'
}]
}
rules=
{
[{
required
:
true
,
message
:
'请输入预测间隔'
}]
}
>
>
<
div
>
<
div
className=
{
styles
.
predict
}
></
div
>
<
div
className=
{
styles
.
predict
}
></
div
>
<
Input
style=
{
{
width
:
'70%'
}
}
placeholder=
"请输入预测间隔"
value=
{
CycleValue
}
onChange=
{
(
value
)
=>
selectCycleValue
(
value
)
}
allowClear
/>
<
Input
style=
{
{
width
:
'70%'
}
}
placeholder=
"请输入预测间隔"
value=
{
CycleValue
}
onChange=
{
(
value
)
=>
selectCycleValue
(
value
)
}
allowClear
/>
<
Select
style=
{
{
marginLeft
:
'0.5rem'
,
width
:
'28%'
}
}
onChange=
{
handleIntervalType
}
value=
{
intervalType
}
>
<
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
>
})
:
''
}
{
timeType
.
length
?
timeType
.
map
((
item
,
index
)
=>
{
return
<
Select
.
Option
key=
{
index
}
value=
{
item
}
>
{
item
}
</
Select
.
Option
>
})
:
''
}
</
Select
>
</
Select
>
</
div
>
</
Item
>
</
Item
>
<
Item
<
Item
...
@@ -352,16 +371,14 @@ const AddModal = props => {
...
@@ -352,16 +371,14 @@ const AddModal = props => {
<
Item
<
Item
label=
"最小值"
label=
"最小值"
name=
{
'min'
+
index
}
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
>
</
Item
>
</
Col
>
</
Col
>
<
Col
span=
{
12
}
>
<
Col
span=
{
12
}
>
<
Item
<
Item
label=
"最大值"
label=
"最大值"
name=
{
'max'
+
index
}
name=
{
'max'
+
index
}
rules=
{
[{
required
:
true
,
message
:
'请输入最大值'
}]
}
>
>
<
Input
style=
{
{
width
:
'98%'
}
}
placeholder=
"请输入最大值"
onChange=
{
(
value
)
=>
inputMax
(
value
,
index
)
}
index=
{
index
}
allowClear
/>
<
Input
style=
{
{
width
:
'98%'
}
}
placeholder=
"请输入最大值"
onChange=
{
(
value
)
=>
inputMax
(
value
,
index
)
}
index=
{
index
}
allowClear
/>
</
Item
>
</
Item
>
...
...
src/pages/artificial/policiesIssued/predictionConfig/predictionConfig.jsx
View file @
9a436d7b
...
@@ -59,6 +59,12 @@ const VectorData = props => {
...
@@ -59,6 +59,12 @@ const VectorData = props => {
key
:
'DateFrom'
,
key
:
'DateFrom'
,
align
:
'center'
align
:
'center'
},
},
{
title
:
'首次计算时间'
,
dataIndex
:
'PredictDateFrom'
,
key
:
'PredictDateFrom'
,
align
:
'center'
},
{
{
title
:
'描述'
,
title
:
'描述'
,
dataIndex
:
'Remarks'
,
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'
...
@@ -10,7 +10,7 @@ import locale from 'antd/lib/date-picker/locale/zh_CN'
import
'moment/locale/zh-cn'
import
'moment/locale/zh-cn'
moment
.
locale
(
'zh-cn'
)
moment
.
locale
(
'zh-cn'
)
import
{
import
{
getEquipmentInfo
,
getQutaList
,
getSceneNameInfo
,
addStrategyOptions
,
editStrategyOptions
,
getPredictDevice
,
getPredictDevicePoint
getEquipmentInfo
,
getQutaList
,
addStrategyOptions
,
editStrategyOptions
,
getPredictDevice
,
getPredictDevicePoint
,
getPredictInfo
}
from
'@/services/intelligence/api'
;
}
from
'@/services/intelligence/api'
;
import
{
DeleteOutlined
}
from
'@ant-design/icons'
;
import
{
DeleteOutlined
}
from
'@ant-design/icons'
;
...
@@ -25,7 +25,8 @@ const AddModal = props => {
...
@@ -25,7 +25,8 @@ const AddModal = props => {
const
[
predictCode
,
setPredictCode
]
=
useState
([]);
//预测编码列表
const
[
predictCode
,
setPredictCode
]
=
useState
([]);
//预测编码列表
const
[
deviceList
,
setDeviceList
]
=
useState
([]);
//设备列表
const
[
deviceList
,
setDeviceList
]
=
useState
([]);
//设备列表
const
[
card
,
setCard
]
=
useState
([]);
//卡片列表值
const
[
card
,
setCard
]
=
useState
([]);
//卡片列表值
const
[
sceneList
,
setSceneList
]
=
useState
([])
const
[
source
,
setSource
]
=
useState
([])
const
[
PredictID
,
setPredictID
]
=
useState
()
const
[
form
]
=
Form
.
useForm
();
const
[
form
]
=
Form
.
useForm
();
const
{
Item
}
=
Form
;
const
{
Item
}
=
Form
;
// 提交
// 提交
...
@@ -40,7 +41,8 @@ const AddModal = props => {
...
@@ -40,7 +41,8 @@ const AddModal = props => {
StrategyName
:
obj
.
StrategyName
,
StrategyName
:
obj
.
StrategyName
,
StrategyType
:
obj
.
StrategyType
,
StrategyType
:
obj
.
StrategyType
,
DetailInfos
:
card
,
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
)
type
===
'edit'
?
(
query
.
ID
=
formObj
.
ID
)
&&
(
api
=
editStrategyOptions
)
:
delete
query
.
ID
&&
(
api
=
addStrategyOptions
)
setLoading
(
true
);
setLoading
(
true
);
...
@@ -91,6 +93,9 @@ const AddModal = props => {
...
@@ -91,6 +93,9 @@ const AddModal = props => {
//页面初始化
//页面初始化
const
initData
=
()
=>
{
const
initData
=
()
=>
{
getPredictInfo
().
then
(
res
=>
{
res
.
getMe
&&
res
.
getMe
.
length
&&
setSource
(
res
.
getMe
)
})
if
(
type
===
'add'
)
{
if
(
type
===
'add'
)
{
form
.
resetFields
();
form
.
resetFields
();
setCard
([])
setCard
([])
...
@@ -126,9 +131,6 @@ const AddModal = props => {
...
@@ -126,9 +131,6 @@ const AddModal = props => {
}
}
getSceneNameInfo
().
then
(
res
=>
{
res
.
getMe
.
length
&&
setSceneList
(
res
.
getMe
)
})
}
}
//获取设备编码
//获取设备编码
const
getDeviceCode
=
()
=>
{
const
getDeviceCode
=
()
=>
{
...
@@ -146,12 +148,7 @@ const AddModal = props => {
...
@@ -146,12 +148,7 @@ const AddModal = props => {
arr
[
index
].
predictCode
=
respone
[
1
].
getMe
.
length
?
respone
[
1
].
getMe
:
[]
arr
[
index
].
predictCode
=
respone
[
1
].
getMe
.
length
?
respone
[
1
].
getMe
:
[]
arr
[
index
].
indexStr
=
''
arr
[
index
].
indexStr
=
''
arr
[
index
].
predictStr
=
''
arr
[
index
].
predictStr
=
''
form
.
setFieldsValue
({
clearInput
(
index
)
[
`deviceCode
${
index
}
`
]:
''
,
[
`indextr
${
index
}
`
]:
''
,
[
`max
${
index
}
`
]:
''
,
[
`min
${
index
}
`
]:
''
})
})
})
setDeviceList
(
arr
)
setDeviceList
(
arr
)
}
}
...
@@ -214,20 +211,7 @@ const AddModal = props => {
...
@@ -214,20 +211,7 @@ const AddModal = props => {
cardList
[
+
option
.
index
].
PredictPoint
=
value
cardList
[
+
option
.
index
].
PredictPoint
=
value
setCard
(
cardList
)
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
=
()
=>
{
const
add
=
()
=>
{
let
obj
=
form
.
getFieldsValue
();
let
obj
=
form
.
getFieldsValue
();
if
(
!
obj
.
DeviceType
)
{
if
(
!
obj
.
DeviceType
)
{
...
@@ -245,14 +229,27 @@ const AddModal = props => {
...
@@ -245,14 +229,27 @@ const AddModal = props => {
setDeviceList
(
arr
)
setDeviceList
(
arr
)
}
}
}
}
//清除卡片删除一项的值
const
clearInput
=
(
index
)
=>
{
form
.
setFieldsValue
({
[
`deviceCode
${
index
}
`
]:
undefined
,
[
`indextr
${
index
}
`
]:
undefined
,
[
`max
${
index
}
`
]:
undefined
,
[
`min
${
index
}
`
]:
undefined
})
}
//删除卡片
//删除卡片
const
deleteDevice
=
(
index
)
=>
{
const
deleteDevice
=
(
index
)
=>
{
let
cardList
=
[...
card
]
let
cardList
=
[...
card
]
let
arr
=
[...
deviceList
]
let
arr
=
[...
deviceList
]
let
newCardList
=
cardList
.
splice
(
0
,
1
)
cardList
.
splice
(
index
,
1
)
let
newArr
=
arr
.
splice
(
0
,
1
)
arr
.
splice
(
index
,
1
)
setCard
(
index
==
0
?
[]
:
newCardList
)
clearInput
(
index
)
setDeviceList
(
index
==
0
?
[]
:
newArr
)
setCard
(
cardList
)
setDeviceList
(
arr
)
}
const
handleOrgin
=
(
value
,
option
)
=>
{
setPredictID
(
option
.
id
)
}
}
return
(
return
(
...
@@ -277,14 +274,14 @@ const AddModal = props => {
...
@@ -277,14 +274,14 @@ const AddModal = props => {
<
Item
<
Item
label=
"策略名称"
label=
"策略名称"
name=
"StrategyName"
name=
"StrategyName"
rules=
{
[{
required
:
true
,
message
:
'请输入
方案
名称'
}]
}
rules=
{
[{
required
:
true
,
message
:
'请输入
策略
名称'
}]
}
>
>
<
Input
placeholder=
"请输入任务名称"
allowClear
/>
<
Input
placeholder=
"请输入任务名称"
allowClear
/>
</
Item
>
</
Item
>
<
Item
<
Item
label=
"策略类型"
label=
"策略类型"
name=
"StrategyType"
name=
"StrategyType"
rules=
{
[{
required
:
true
,
message
:
'请
输入算法名称
'
}]
}
rules=
{
[{
required
:
true
,
message
:
'请
选择策略类型
'
}]
}
>
>
<
Select
>
<
Select
>
<
Select
.
Option
value=
'实时控制'
>
实时控制
</
Select
.
Option
>
<
Select
.
Option
value=
'实时控制'
>
实时控制
</
Select
.
Option
>
...
@@ -292,6 +289,15 @@ const AddModal = props => {
...
@@ -292,6 +289,15 @@ const AddModal = props => {
</
Select
>
</
Select
>
</
Item
>
</
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
<
Item
label=
"设备类型"
label=
"设备类型"
name=
"DeviceType"
name=
"DeviceType"
...
@@ -300,18 +306,6 @@ const AddModal = props => {
...
@@ -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
>
})
:
''
}
{
deviceType
.
length
?
deviceType
.
map
((
item
,
index
)
=>
{
return
<
Select
.
Option
key=
{
index
}
value=
{
item
.
DeviceType
}
>
{
item
.
DeviceType
}
</
Select
.
Option
>
})
:
''
}
</
Select
>
</
Select
>
</
Item
>
</
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
<
Item
label=
"描述"
label=
"描述"
name=
"StrategyDes"
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