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
43d69214
Commit
43d69214
authored
Apr 27, 2021
by
shaoan123
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
将任务调度相关接口加入新运维
parent
fbe4558f
Pipeline
#26743
skipped with stages
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
186 additions
and
145 deletions
+186
-145
AddModal.jsx
src/pages/artificial/taskScheduling/AddModal.jsx
+123
-119
taskScheduling.jsx
src/pages/artificial/taskScheduling/taskScheduling.jsx
+33
-23
taskScheduling.less
src/pages/artificial/taskScheduling/taskScheduling.less
+10
-0
api.js
src/services/intelligence/api.js
+20
-3
No files found.
src/pages/artificial/taskScheduling/AddModal.jsx
View file @
43d69214
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
{
Form
,
Modal
,
Input
,
Select
,
notification
,
DatePicker
}
from
'antd'
;
import
{
Form
,
Modal
,
Input
,
Select
,
notification
,
DatePicker
,
Spin
}
from
'antd'
;
import
styles
from
'./taskScheduling.less'
import
{
ConfigProvider
}
from
'antd'
;
// import moment from 'moment';
// import locale from 'antd/es/date-picker/locale/zh_CN';
// import 'moment/locale/zh-cn';
...
...
@@ -11,34 +9,32 @@ import moment from 'moment'
import
locale
from
'antd/lib/date-picker/locale/zh_CN'
import
'moment/locale/zh-cn'
moment
.
locale
(
'zh-cn'
)
import
{
get
IotDeviceType
,
algorithmList
,
get
EquipmentInfo
getEquipmentInfo
}
from
'@/services/intelligence/api'
;
const
{
RangePicker
}
=
DatePicker
;
const
{
TextArea
}
=
Input
;
const
AddModal
=
props
=>
{
const
{
callBackSubmit
=
()
=>
{
},
type
,
formObj
,
visible
,
solutionNames
}
=
props
;
const
{
callBackSubmit
=
()
=>
{
},
type
,
formObj
,
visible
,
deviceType
}
=
props
;
const
[
loading
,
setLoading
]
=
useState
(
false
);
const
[
workSpace
,
setWorkSpace
]
=
useState
(
''
);
//
const
[
workList
,
setWorkList
]
=
useState
([]);
//设备类型列表
const
[
deviceType
,
setDeviceType
]
=
useState
([]);
//设备类型列表
const
[
deviceCode
,
setDeviceCode
]
=
useState
([]);
//设备编码列表
const
[
isloading
,
setIsLoading
]
=
useState
(
false
);
const
[
deviceCodes
,
setDeviceCode
]
=
useState
([]);
//设备编码列表
const
[
timeType
,
setTimeType
]
=
useState
([
'分钟'
,
'小时'
,
'天'
]);
const
[
intervalType
,
setIntervalType
]
=
useState
(
'分钟'
)
const
[
gsIp
,
setGsIp
]
=
useState
([]);
const
[
form
]
=
Form
.
useForm
();
const
{
Item
}
=
Form
;
// 提交
const
onSubmit
=
()
=>
{
form
.
validateFields
().
then
(
validate
=>
{
if
(
validate
)
{
setLoading
(
true
);
let
obj
=
form
.
getFieldsValue
();
if
(
type
===
'add'
)
{
let
DateFrom
=
moment
(
obj
.
Date
[
0
]).
format
(
'YYYY-MM-DD'
)
let
DateTo
=
moment
(
obj
.
Date
[
1
]).
format
(
'YYYY-MM-DD'
)
setLoading
(
true
);
if
(
type
===
'add'
)
{
}
else
if
(
type
===
'edit'
)
{
handleEdit
();
...
...
@@ -79,7 +75,7 @@ const AddModal = props => {
useEffect
(()
=>
{
switch
(
type
)
{
case
'add'
:
getDeviceInfo
(
)
deviceType
.
length
&&
getDeviceCode
(
deviceType
[
0
].
DeviceType
)
break
;
case
'edit'
:
form
.
setFieldsValue
({
...
formObj
});
...
...
@@ -90,17 +86,16 @@ const AddModal = props => {
},
[
visible
]);
const
getDeviceInfo
=
()
=>
{
const
getIotDevice
=
getIotDeviceType
()
const
algorithm
=
algorithmList
()
Promise
.
all
([
getIotDevice
,
algorithm
]).
then
(
res
=>
{
if
(
res
[
0
].
getMe
.
length
)
{
setDeviceType
(
res
[
0
].
getMe
)
getEquipmentInfo
(
res
[
0
].
getMe
[
0
].
DeviceType
).
then
(
respone
=>
{
respone
.
getMe
[
0
].
DeviceList
.
length
&&
setDeviceCode
(
respone
.
getMe
[
0
].
DeviceList
)
form
.
setFieldsValue
({
deviceType
:
res
[
0
].
getMe
[
0
].
DeviceType
,
deviceCode
:
respone
.
getMe
[
0
].
DeviceList
[
0
].
Code
});
})
}
const
getDeviceCode
=
(
type
)
=>
{
setLoading
(
false
)
getEquipmentInfo
(
type
).
then
(
respone
=>
{
respone
.
getMe
[
0
].
DeviceList
.
length
&&
setDeviceCode
(
respone
.
getMe
[
0
].
DeviceList
)
form
.
setFieldsValue
({
deviceType
:
deviceType
[
0
].
DeviceType
,
deviceCode
:
respone
.
getMe
[
0
].
DeviceList
[
0
].
Code
});
setLoading
(
false
)
})
}
const
layout
=
{
...
...
@@ -112,13 +107,16 @@ const AddModal = props => {
span
:
16
,
},
};
const
handleWorkspace
=
()
=>
{
}
//选择设备类型
const
handleDeviceType
=
(
value
)
=>
{
getDeviceCode
(
value
)
}
const
handleIntervalType
=
(
value
)
=>
{
setIntervalType
(
value
)
}
return
(
<
Modal
title=
{
`${type === 'add' ? '元数据发布' : '编辑'}`
}
bodyStyle=
{
{
width
:
'100%'
,
minHeight
:
'100px'
}
}
...
...
@@ -134,98 +132,104 @@ const AddModal = props => {
forceRender=
{
true
}
getContainer=
{
false
}
>
{
visible
&&
(
<
Form
form=
{
form
}
{
...
layout
}
onFinish=
{
onFinish
}
>
<
Item
label=
"任务名称"
name=
"TaskName"
rules=
{
[{
required
:
true
,
message
:
'请输入任务名称'
}]
}
>
<
Input
placeholder=
"请输入任务名称"
allowClear
/>
</
Item
>
<
Item
label=
"场景"
name=
"scene"
rules=
{
[{
required
:
true
,
message
:
'请选择场景'
}]
}
>
<
Select
onChange=
{
handleWorkspace
}
>
{
/* {workList.length ? workList.map((item, index) => { return <Option key={index} value={item.name}>{item.name}</Option> }) : ''} */
}
</
Select
>
</
Item
>
<
Item
label=
"策略名称"
name=
"strategy"
rules=
{
[{
required
:
true
,
message
:
'请选择策略名称'
}]
}
>
<
Select
onChange=
{
handleWorkspace
}
>
{
/* {workList.length ? workList.map((item, index) => { return <Option key={index} value={item.name}>{item.name}</Option> }) : ''} */
}
</
Select
>
</
Item
>
<
Item
label=
"类型"
name=
"type"
rules=
{
[{
required
:
true
,
message
:
'请选择类型'
}]
}
>
<
Select
onChange=
{
handleWorkspace
}
>
<
Select
.
Option
value=
'水龄预测'
>
水龄预测
</
Select
.
Option
>
<
Select
.
Option
value=
'二供泵房'
>
二供泵房
</
Select
.
Option
>
</
Select
>
</
Item
>
<
Item
label=
"设备类型"
name=
"deviceType"
rules=
{
[{
required
:
true
,
message
:
'请输入设备类型'
}]
}
>
<
Select
onChange=
{
handleWorkspace
}
>
{
deviceType
.
length
?
deviceType
.
map
((
item
,
index
)
=>
{
return
<
Select
.
Option
key=
{
index
}
value=
{
item
.
DeviceType
}
>
{
item
.
DeviceType
}
</
Select
.
Option
>
})
:
''
}
</
Select
>
</
Item
>
<
Item
label=
"设备编码"
name=
"deviceCode"
rules=
{
[{
required
:
true
,
message
:
'请选择设备编码'
}]
}
>
<
Select
onChange=
{
handleWorkspace
}
>
{
deviceCode
.
length
?
deviceCode
.
map
((
item
,
index
)
=>
{
return
<
Select
.
Option
key=
{
index
}
value=
{
item
.
PointAddressID
}
>
{
item
.
Code
}
</
Select
.
Option
>
})
:
''
}
</
Select
>
</
Item
>
<
Item
label=
"间隔(Cron)"
name=
"Interval"
rules=
{
[{
required
:
true
,
message
:
'请输入间隔'
}]
}
>
<
Input
placeholder=
"请输入间隔"
allowClear
/>
</
Item
>
<
Item
label=
"首次预测时间"
name=
"Date"
rules=
{
[{
required
:
true
,
message
:
'请选择首次预测时间'
}]
}
>
<
RangePicker
locale=
{
locale
}
style=
{
{
width
:
'100%'
}
}
/>
</
Item
>
<
Item
label=
"预测间隔"
rules=
{
[{
required
:
true
,
message
:
'请输入预测间隔'
}]
}
>
<
div
className=
{
styles
.
predict
}
></
div
>
<
Input
style=
{
{
width
:
'70%'
}
}
placeholder=
"请输入预测间隔"
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
>
</
Item
>
<
Item
label=
"描述"
name=
"des"
>
<
TextArea
placeholder=
"可输入描述信息"
rows=
{
4
}
allowClear
/>
</
Item
>
</
Form
>
)
}
<
Spin
spinning=
{
isloading
}
delay=
{
300
}
>
{
visible
&&
(
<
Form
form=
{
form
}
{
...
layout
}
onFinish=
{
onFinish
}
>
<
Item
label=
"任务名称"
name=
"TaskName"
rules=
{
[{
required
:
true
,
message
:
'请输入任务名称'
}]
}
>
<
Input
placeholder=
"请输入任务名称"
allowClear
/>
</
Item
>
<
Item
label=
"场景"
name=
"scene"
rules=
{
[{
required
:
true
,
message
:
'请选择场景'
}]
}
>
<
Select
>
{
/* {workList.length ? workList.map((item, index) => { return <Option key={index} value={item.name}>{item.name}</Option> }) : ''} */
}
</
Select
>
</
Item
>
<
Item
label=
"策略名称"
name=
"strategy"
// rules=
{[{
required
:
true
,
message
:
'请选择策略名称'
}]}
>
<
Select
>
{
/* {workList.length ? workList.map((item, index) => { return <Option key={index} value={item.name}>{item.name}</Option> }) : ''} */
}
</
Select
>
</
Item
>
<
Item
label=
"类型"
name=
"type"
rules=
{
[{
required
:
true
,
message
:
'请选择类型'
}]
}
>
<
Select
>
<
Select
.
Option
value=
'水龄预测'
>
水龄预测
</
Select
.
Option
>
<
Select
.
Option
value=
'二供泵房'
>
二供泵房
</
Select
.
Option
>
</
Select
>
</
Item
>
<
Item
label=
"设备类型"
name=
"deviceType"
rules=
{
[{
required
:
true
,
message
:
'请输入设备类型'
}]
}
>
<
Select
onChange=
{
handleDeviceType
}
>
{
deviceType
.
length
?
deviceType
.
map
((
item
,
index
)
=>
{
return
<
Select
.
Option
key=
{
index
}
value=
{
item
.
DeviceType
}
>
{
item
.
DeviceType
}
</
Select
.
Option
>
})
:
''
}
</
Select
>
</
Item
>
<
Item
label=
"设备编码"
name=
"deviceCode"
rules=
{
[{
required
:
true
,
message
:
'请选择设备编码'
}]
}
>
<
Select
>
{
deviceCodes
.
length
?
deviceCodes
.
map
((
item
,
index
)
=>
{
return
<
Select
.
Option
key=
{
index
}
value=
{
item
.
PointAddressID
}
>
{
item
.
Code
}
</
Select
.
Option
>
})
:
''
}
</
Select
>
</
Item
>
<
Item
label=
"间隔(Cron)"
name=
"Interval"
rules=
{
[{
required
:
true
,
message
:
'请输入间隔'
}]
}
>
<
div
className=
{
styles
.
predict
}
>
<
Input
placeholder=
"请输入间隔"
allowClear
/>
<
a
className=
{
styles
.
corn
}
target=
"view_window"
href=
"https://cron.qqe2.com/"
>
cron在线生成
</
a
>
</
div
>
</
Item
>
<
Item
label=
"首次预测时间"
name=
"Date"
rules=
{
[{
required
:
true
,
message
:
'请选择首次预测时间'
}]
}
>
<
RangePicker
locale=
{
locale
}
style=
{
{
width
:
'100%'
}
}
/>
</
Item
>
<
Item
label=
"预测间隔"
rules=
{
[{
required
:
true
,
message
:
'请输入预测间隔'
}]
}
>
<
div
className=
{
styles
.
predict
}
></
div
>
<
Input
style=
{
{
width
:
'70%'
}
}
placeholder=
"请输入预测间隔"
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
>
</
Item
>
<
Item
label=
"描述"
name=
"dec"
>
<
TextArea
placeholder=
"可输入描述信息"
rows=
{
4
}
allowClear
/>
</
Item
>
</
Form
>
)
}
</
Spin
>
</
Modal
>
);
};
...
...
src/pages/artificial/taskScheduling/taskScheduling.jsx
View file @
43d69214
...
...
@@ -2,20 +2,20 @@ import { Space, Table, Button, Popconfirm, notification } from 'antd';
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
styles
from
'./taskScheduling.less'
import
{
GetVectorService
,
deleteVectorService
,
getSolutionList
,
updatePublishedMetaData
}
from
'@/services/
webConfig
/api'
;
deleteTaskOptions
,
taskOptionsList
,
getIotDeviceType
,
algorithmList
,
getEquipmentInfo
}
from
'@/services/
intelligence
/api'
;
import
AddModal
from
'./AddModal'
const
VectorData
=
props
=>
{
const
[
treeLoading
,
setTreeLoading
]
=
useState
(
false
);
// 弹窗显示
const
[
tileData
,
setTileData
]
=
useState
([]);
// table表格数据
const
[
visible
,
setVisible
]
=
useState
(
false
);
// 弹窗
const
[
previewVisible
,
setPreviewVisible
]
=
useState
(
false
);
// 预览弹窗
const
[
deviceType
,
setDeviceType
]
=
useState
([]);
//设备类型列表
const
[
flag
,
setFlag
]
=
useState
(
0
);
// 更新list
const
[
loading
,
setLoading
]
=
useState
([]);
// 更新状态
const
[
type
,
setType
]
=
useState
(
''
);
// 弹窗类型
const
[
solutionNames
,
setSolutionNames
]
=
useState
(
''
);
const
[
formObj
,
setFormObj
]
=
useState
({
user
:
'admin'
,
password
:
'geoserver'
});
const
[
currentMetaData
,
setCurrentMetaData
]
=
useState
(
null
)
const
[
currentMetaData
,
setCurrentMetaData
]
=
useState
(
null
)
const
columns
=
[
{
title
:
'序号'
,
...
...
@@ -25,26 +25,26 @@ const VectorData = props => {
},
{
title
:
'场景名称'
,
dataIndex
:
'
GISServerIP
'
,
key
:
'
GISServerIP
'
,
dataIndex
:
'
AlgorithmName
'
,
key
:
'
AlgorithmName
'
,
align
:
'center'
},
{
title
:
'任务名称'
,
dataIndex
:
'
GISServerPort
'
,
key
:
'
GISServerPort
'
,
dataIndex
:
'
TaskName
'
,
key
:
'
TaskName
'
,
align
:
'center'
},
{
title
:
'状态'
,
dataIndex
:
'
GISServerProjectName
'
,
key
:
'
GISServerProjectName
'
,
dataIndex
:
'
Status
'
,
key
:
'
Status
'
,
align
:
'center'
},
{
title
:
'任务类型'
,
dataIndex
:
'
publishTim
e'
,
key
:
'
publishTim
e'
,
dataIndex
:
'
TaskTyp
e'
,
key
:
'
TaskTyp
e'
,
align
:
'center'
},
{
...
...
@@ -55,14 +55,14 @@ const VectorData = props => {
},
{
title
:
'描述'
,
dataIndex
:
'
publishTim
e'
,
key
:
'
publishTim
e'
,
dataIndex
:
'
Describ
e'
,
key
:
'
Describ
e'
,
align
:
'center'
},
{
title
:
'访问方式'
,
dataIndex
:
'
publishTim
e'
,
key
:
'
publishTim
e'
,
dataIndex
:
'
RequestTyp
e'
,
key
:
'
RequestTyp
e'
,
align
:
'center'
},
{
...
...
@@ -70,7 +70,7 @@ const VectorData = props => {
align
:
'center'
,
render
:
(
text
,
record
,
index
)
=>
(
<
Space
>
<
div
onClick=
{
e
=>
e
.
stopPropagation
()
}
>
<
Popconfirm
title=
"是否删除该矢量数据?"
...
...
@@ -92,10 +92,10 @@ const VectorData = props => {
];
const
onSubmit
=
prop
=>
{
setVisible
(
false
);
setFlag
(
flag
+
1
)
setFlag
(
flag
+
1
)
};
const
delConfirm
=
(
record
)
=>
{
let
query
=
{
...
...
@@ -127,11 +127,20 @@ const VectorData = props => {
useEffect
(()
=>
{
renderTile
();
},
[
flag
]);
// 获取
瓦片数据配置
数据
// 获取
任务列表及设备类型及编码
数据
const
renderTile
=
()
=>
{
};
setTreeLoading
(
true
)
const
getIotDevice
=
getIotDeviceType
()
const
algorithm
=
algorithmList
()
const
taskOption
=
taskOptionsList
()
Promise
.
all
([
getIotDevice
,
algorithm
,
taskOption
]).
then
(
res
=>
{
res
[
0
].
getMe
&&
res
[
0
].
getMe
.
length
&&
setDeviceType
(
res
[
0
].
getMe
)
res
[
2
].
getMe
&&
res
[
2
].
getMe
.
length
&&
setDeviceType
(
res
[
2
].
getMe
)
setTreeLoading
(
false
)
}).
catch
(
err
=>
{
setTreeLoading
(
false
)
})
}
return
(
...
...
@@ -161,6 +170,7 @@ const VectorData = props => {
onCancel=
{
()
=>
setVisible
(
false
)
}
callBackSubmit=
{
onSubmit
}
type=
{
type
}
deviceType=
{
deviceType
}
formObj=
{
formObj
}
solutionNames=
{
solutionNames
}
/>
...
...
src/pages/artificial/taskScheduling/taskScheduling.less
View file @
43d69214
.predict{
display: flex;
align-items: flex-end;
justify-content: space-between;
width: 100%;
}
.tileBtn{
display: flex;
justify-content: flex-end;
width: 100%;
padding: 0 0 2rem
}
.corn{
cursor: pointer;
margin-left:1rem;
text-decoration: underline;
width: 8rem;
}
\ No newline at end of file
src/services/intelligence/api.js
View file @
43d69214
...
...
@@ -2,16 +2,33 @@ import qs from 'qs';
import
{
CITY_SERVICE
,
get
,
PUBLISH_SERVICE
,
post
,
postForm
}
from
'../index'
;
//获取任务列表
export
const
taskOptionsList
=
()
=>
get
(
`
${
CITY_SERVICE
}
/IOTPlatform.svc/WaterAge/TaskOptionsList`
);
//获取设备类型
export
const
getIotDeviceType
=
()
=>
get
(
`
${
CITY_SERVICE
}
/IOTPlatform.svc/WaterAge/GetIotDeviceType`
);
get
(
`
${
CITY_SERVICE
}
/IOTPlatform.svc/WaterAge/GetIotDeviceType`
);
//获取场景列表
export
const
algorithmList
=
()
=>
get
(
`
${
CITY_SERVICE
}
/IOTPlatform.svc/WaterAge/AlgorithmList`
);
get
(
`
${
CITY_SERVICE
}
/IOTPlatform.svc/WaterAge/AlgorithmList`
);
//获取设备列表
export
const
getEquipmentInfo
=
(
query
)
=>
get
(
`
${
CITY_SERVICE
}
/IOTPlatform.svc/AcrossTable/GetEquipmentInfo?equipType=
${
query
}
`
);
get
(
`
${
CITY_SERVICE
}
/IOTPlatform.svc/AcrossTable/GetEquipmentInfo?equipType=
${
query
}
`
);
//任务添加
export
const
addTaskOptions
=
(
params
)
=>
post
(
`
${
CITY_SERVICE
}
/IOTPlatform.svc/WaterAge/AddTaskOptions`
,
params
);
//任务编辑
export
const
updateTaskOptions
=
(
params
)
=>
post
(
`
${
CITY_SERVICE
}
/IOTPlatform.svc/WaterAge/UpdateTaskOptions`
,
params
);
//任务删除
export
const
deleteTaskOptions
=
(
params
)
=>
post
(
`
${
CITY_SERVICE
}
/IOTPlatform.svc/WaterAge/DeleteTaskOptions`
,
params
);
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