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
56454852
Commit
56454852
authored
Apr 20, 2021
by
mayongxin
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://g.civnet.cn:8443/ReactWeb5/maintenance
parents
a6658244
73376714
Pipeline
#26266
passed with stages
in 45 minutes 0 seconds
Changes
9
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
701 additions
and
102 deletions
+701
-102
SchemeConfig.jsx
src/pages/platformCenter/schemeConfig/SchemeConfig.jsx
+3
-1
SchemeConfig.less
src/pages/platformCenter/schemeConfig/SchemeConfig.less
+8
-2
AddModal.jsx
...pages/platformCenter/schemeConfig/VectorData/AddModal.jsx
+22
-8
VectorData.jsx
...ges/platformCenter/schemeConfig/VectorData/VectorData.jsx
+1
-1
AddModal.jsx
...s/platformCenter/schemeConfig/projectMessage/AddModal.jsx
+129
-73
projectMessage.jsx
...formCenter/schemeConfig/projectMessage/projectMessage.jsx
+56
-15
AddModal.jsx
...s/platformCenter/schemeConfig/solutionConfig/AddModal.jsx
+305
-0
solutionConfig.jsx
...formCenter/schemeConfig/solutionConfig/solutionConfig.jsx
+163
-0
api.js
src/services/webConfig/api.js
+14
-2
No files found.
src/pages/platformCenter/schemeConfig/SchemeConfig.jsx
View file @
56454852
...
...
@@ -5,6 +5,8 @@ import styles from './SchemeConfig.less'
import
TileConfig
from
'./TileConfig/TileConfig'
;
import
VectorData
from
'./VectorData/VectorData'
;
import
ProjectMessage
from
'./projectMessage/projectMessage'
;
import
SolutionConfig
from
'./solutionConfig/solutionConfig'
;
const
{
TabPane
}
=
Tabs
;
const
SchemeConfig
=
()
=>
{
...
...
@@ -27,7 +29,7 @@ const SchemeConfig = () => {
<
ProjectMessage
/>
</
TabPane
>
<
TabPane
tab=
"方案配置"
key=
"4"
>
<
SolutionConfig
/>
</
TabPane
>
</
Tabs
>
</
div
>
...
...
src/pages/platformCenter/schemeConfig/SchemeConfig.less
View file @
56454852
...
...
@@ -69,4 +69,11 @@
}
.activeTile{
background-color: #4699f4
}
\ No newline at end of file
}
.dropList {
position: absolute;
right: 2%;
top: 25%;
color: rgba(0, 0, 0, 0.25);
z-index: 99;
}
src/pages/platformCenter/schemeConfig/VectorData/AddModal.jsx
View file @
56454852
...
...
@@ -18,6 +18,7 @@ const AddModal = props => {
item
:
'geoserver'
}]);
const
[
workList
,
setWorkList
]
=
useState
([]);
const
[
gsIp
,
setGsIp
]
=
useState
([]);
const
[
form
]
=
Form
.
useForm
();
const
{
Item
}
=
Form
;
// 提交
...
...
@@ -38,10 +39,8 @@ const AddModal = props => {
serviceName
:
obj
.
name
,
solution
:
solutionNames
,
}
let
timeout
=
120000
publisService
(
query
,
timeout
)
publisService
(
query
,{
timeout
:
120000
})
.
then
(
res
=>
{
console
.
log
(
'res'
,
res
)
setLoading
(
false
);
if
(
res
.
success
)
{
form
.
resetFields
();
...
...
@@ -49,21 +48,25 @@ const AddModal = props => {
notification
.
success
({
message
:
'提示'
,
duration
:
3
,
description
:
res
.
message
||
'新增成功'
,
description
:
'新增成功'
,
});
setWorkList
([])
handlelocalStorage
(
'add'
,
obj
.
serviceadress
,
obj
.
servicename
)
}
else
{
notification
.
error
({
message
:
'提示'
,
duration
:
3
,
description
:
res
.
message
||
'新增失败'
,
description
:
'新增失败'
,
});
}
})
.
catch
(
err
=>
{
console
.
log
(
err
);
notification
.
error
({
message
:
'提示'
,
duration
:
3
,
description
:
'新增失败'
,
});
setLoading
(
false
);
});
}
else
if
(
type
===
'edit'
)
{
handleEdit
();
...
...
@@ -112,6 +115,7 @@ const AddModal = props => {
item
:
item
.
gsIp
}));
}
setGsIp
(
gsIp
)
let
localIps
=
[
'192.168.12.7'
,
'192.168.19.100'
]
let
port
=
localIps
.
includes
(
gsIp
)
?
8080
:
8088
form
.
setFieldsValue
({
servicename
:
serviceName
[
0
].
value
,
port
,
...
formObj
});
...
...
@@ -207,6 +211,12 @@ const AddModal = props => {
})
setWorkSpace
(
value
)
}
const
selectIp
=
(
value
)
=>
{
let
localIps
=
[
'192.168.12.7'
,
'192.168.19.100'
]
let
port
=
localIps
.
includes
(
value
)
?
8080
:
8088
form
.
setFieldsValue
({
port
,
serviceadress
:
value
});
}
return
(
<
Modal
title=
{
`${type === 'add' ? '元数据发布' : '编辑'}`
}
...
...
@@ -230,7 +240,11 @@ const AddModal = props => {
name=
"serviceadress"
rules=
{
[{
required
:
true
,
message
:
'请选择服务名'
}]
}
>
<
Input
placeholder=
"请输入gis服务器地址"
allowClear
/>
<
AutoComplete
placeholder=
"请输入GIS服务器地址"
options=
{
gsIp
}
onSelect=
{
selectIp
}
/>
</
Item
>
<
Item
label=
"GIS服务器端口"
...
...
src/pages/platformCenter/schemeConfig/VectorData/VectorData.jsx
View file @
56454852
...
...
@@ -128,7 +128,7 @@ const VectorData = props => {
}
const
onSubmit
=
prop
=>
{
setVisible
(
false
);
setFlag
(
flag
+
1
)
};
const
delConfirm
=
(
record
)
=>
{
let
query
=
{
...
...
src/pages/platformCenter/schemeConfig/projectMessage/AddModal.jsx
View file @
56454852
...
...
@@ -3,12 +3,11 @@ import { Form, Modal, Input, Select, notification, Button } from 'antd';
import
styles
from
'../SchemeConfig.less'
import
{
GetAllConfig
,
GetVectorService
,
SetServiceConfig
,
bindSchemeBaseMap
}
from
'@/services/webConfig/api'
;
import
{
addMySQLConnString
,
editMySQLConnString
,
}
from
'@/services/database/api'
;
import
{
number
}
from
'prop-types'
;
const
{
Item
}
=
Form
;
const
{
Option
}
=
Select
;
...
...
@@ -17,93 +16,142 @@ const AddModal = props => {
const
[
loading
,
setLoading
]
=
useState
(
false
);
const
[
mapType
,
setMapType
]
=
useState
(
0
);
const
[
ImgIndex
,
setImgIndex
]
=
useState
(
''
);
const
[
baseMaplist
,
setBaseMaplist
]
=
useState
([]);
const
[
baseMap
,
setBaseMap
]
=
useState
([]);
const
[
pipeArr
,
setPipeArr
]
=
useState
([]);
const
[
serviceList
,
setServiceList
]
=
useState
([]);
const
[
form
]
=
Form
.
useForm
();
// 提交
const
onSubmit
=
()
=>
{
form
.
validateFields
().
then
(
validate
=>
{
if
(
validate
)
{
// setLoading(true);
// let obj = form.getFieldsValue();
// if (type === 'add') {
// addMySQLConnString({
// _version: 9999,
// _dc: Date.now(),
// ...obj,
// })
// .then(res => {
// setLoading(false);
// if (res.success) {
// form.resetFields();
// callBackSubmit();
// notification.success({
// message: '提示',
// duration: 3,
// description: res.message || '新增成功',
// });
// } else {
// notification.error({
// message: '提示',
// duration: 3,
// description: res.message || '新增失败',
// });
// }
// })
// .catch(err => {
// setLoading(false);
// console.error(err);
// });
// } else if (type === 'edit') {
// handleEdit();
// }
setLoading
(
true
);
let
obj
=
form
.
getFieldsValue
();
if
(
type
===
'add'
)
{
bindSchemeBaseMap
({
schemename
:
formObj
.
schemename
,
basemapName
:
obj
.
serverName
}).
then
(
res
=>
{
setLoading
(
false
);
if
(
res
.
IsSuccess
){
form
.
resetFields
();
callBackSubmit
();
prompt
(
'success'
,
'瓦片新增成功'
)
}
else
{
prompt
(
'fail'
,
'瓦片新增失败'
)
}
})
}
else
{
handleEdit
();
}
}
});
};
const
prompt
=
(
type
,
content
)
=>
{
if
(
type
==
'success'
){
notification
.
success
({
message
:
'提示'
,
duration
:
3
,
description
:
content
,
});
}
else
{
notification
.
error
({
message
:
'提示'
,
duration
:
3
,
description
:
content
,
});
}
}
const
handleEdit
=
()
=>
{
// let obj = form.getFieldsValue();
// SetServiceConfig({
// servicename: serviceName,
// terminalType: 'base',
// isBaseMap: true,
// jsonCfg: JSON.stringify(query)
// })
// .then(res => {
// setLoading(false);
// if (res.success) {
// form.resetFields();
// callBackSubmit();
// notification.success({
// message: '提示',
// duration: 3,
// description: res.message || '编辑成功',
// });
// } else {
// notification.error({
// message: '提示',
// duration: 3,
// description: res.message || '编辑失败',
// });
// }
// })
// .catch(err => setLoading(false));
let
obj
=
form
.
getFieldsValue
();
let
query
=
{
schemename
:
obj
.
schemename
,
terminalType
:
'scheme'
,
isBaseMap
:
'false'
,
jsonCfg
:
JSON
.
stringify
({
baseMap
:
[
obj
.
baseMap
],
servicename
:
obj
.
servicename
,
label
:
obj
.
label
,
url
:
obj
.
url
,
alpha
:
1
,
})
}
SetServiceConfig
(
query
)
.
then
(
res
=>
{
setLoading
(
false
);
if
(
res
.
IsSuccess
)
{
form
.
resetFields
();
callBackSubmit
();
prompt
(
'success'
,
'方案新增成功'
)
}
else
{
prompt
(
'fail'
,
'方案新增失败'
)
}
})
.
catch
(
err
=>
{
setLoading
(
false
);
});
};
const
onFinish
=
value
=>
{
};
useEffect
(()
=>
{
switch
(
type
)
{
case
'add'
:
form
.
resetFields
();
addTile
()
break
;
case
'edit'
:
form
.
setFieldsValue
({
...
formObj
});
case
'schemeAdd'
:
pipeNetwork
()
break
;
default
:
break
;
}
},
[
visible
]);
//添加瓦片
const
addTile
=
()
=>
{
let
serverList
=
[]
if
(
JSON
.
stringify
(
formObj
)
!=
"{}"
)
{
GetAllConfig
({
terminalType
:
'base'
,
isBaseMap
:
true
}).
then
(
res
=>
{
console
.
log
(
'res'
,
res
)
if
(
res
.
Result
&&
res
.
Result
.
length
)
{
res
.
Result
.
map
(
item
=>
{
if
(
formObj
.
baseMap
.
indexOf
(
item
.
servicename
)
==
-
1
)
{
serverList
.
push
(
item
.
servicename
)
}
})
setServiceList
(
serverList
)
form
.
setFieldsValue
({
serverName
:
serverList
[
0
]
})
}
})
}
}
//获取管网及默认底图
const
pipeNetwork
=
()
=>
{
form
.
resetFields
();
let
req1
=
GetAllConfig
({
terminalType
:
'base'
,
isBaseMap
:
true
})
let
req2
=
GetVectorService
()
let
pipeArr
=
[],
baseMap
=
[];
Promise
.
all
([
req1
,
req2
]).
then
(
res
=>
{
if
(
res
[
0
].
Result
&&
res
[
0
].
Result
.
length
)
{
res
[
0
].
Result
.
map
(
item
=>
{
baseMap
.
push
(
item
.
servicename
)
})
}
if
(
res
[
1
]
&&
res
[
1
].
length
)
{
res
[
1
].
map
(
item
=>
{
pipeArr
.
push
(
item
.
serviceName
)
})
}
setPipeArr
(
pipeArr
)
setBaseMap
(
baseMap
)
form
.
setFieldsValue
({
baseMap
:
baseMap
[
0
]
})
})
}
const
layout
=
{
layout
:
'horizontal'
,
labelCol
:
{
...
...
@@ -117,9 +165,14 @@ const AddModal = props => {
//选择服务名
const
handleChange
=
()
=>
{
}
//选择管网
const
handleService
=
()
=>
{
}
const
handleService
=
(
value
)
=>
{
form
.
setFieldsValue
({
label
:
value
,
url
:
`http://{IP}/CityInterface/rest/services/MapServer.svc/
${
value
}
`
})
}
//选择底图
const
handleBaseMap
=
()
=>
{
}
const
handleBaseMap
=
()
=>
{
}
return
(
<
Modal
title=
{
`${type === 'add' ? '添加底图' : '添加方案'}`
}
...
...
@@ -140,9 +193,10 @@ const AddModal = props => {
<
Form
form=
{
form
}
{
...
layout
}
onFinish=
{
onFinish
}
>
{
type
===
'add'
?
<
Item
label=
"服务名"
name=
"
password
"
name=
"
serverName
"
>
<
Select
onChange=
{
handleChange
}
>
{
serviceList
.
length
?
serviceList
.
map
((
item
,
index
)
=>
{
return
<
Option
key=
{
index
}
value=
{
item
}
>
{
item
}
</
Option
>
})
:
''
}
</
Select
>
</
Item
>
:
<>
...
...
@@ -158,6 +212,7 @@ const AddModal = props => {
name=
"servicename"
>
<
Select
onChange=
{
handleService
}
>
{
pipeArr
.
length
?
pipeArr
.
map
((
item
,
index
)
=>
{
return
<
Option
key=
{
index
}
value=
{
item
}
>
{
item
}
</
Option
>
})
:
''
}
</
Select
>
</
Item
>
<
Item
...
...
@@ -174,10 +229,11 @@ const AddModal = props => {
</
Item
>
<
Item
label=
"默认底图"
name=
"
servicename
"
name=
"
baseMap
"
rules=
{
[{
required
:
true
,
message
:
'请选择底图'
}]
}
>
<
Select
onChange=
{
handleBaseMap
}
>
{
baseMap
.
length
?
baseMap
.
map
((
item
,
index
)
=>
{
return
<
Option
key=
{
index
}
value=
{
item
}
>
{
item
}
</
Option
>
})
:
''
}
</
Select
>
</
Item
>
</>
...
...
src/pages/platformCenter/schemeConfig/projectMessage/projectMessage.jsx
View file @
56454852
...
...
@@ -3,7 +3,7 @@ import React, { useState, useEffect } from 'react';
import
classnames
from
'classnames'
import
styles
from
'../SchemeConfig.less'
import
{
GetAllConfig
,
GetAllConfig
,
deleteConfig
,
unbindSchemeBaseMap
}
from
'@/services/webConfig/api'
;
import
{
CloseOutlined
,
PlusOutlined
...
...
@@ -13,6 +13,7 @@ const VectorData = props => {
const
[
treeLoading
,
setTreeLoading
]
=
useState
(
false
);
// 弹窗显示
const
[
tileData
,
setTileData
]
=
useState
([]);
// 页面初始化数据
const
[
visible
,
setVisible
]
=
useState
(
false
);
// 弹窗
const
[
flag
,
setFlag
]
=
useState
(
0
);
// 状态更新
const
[
type
,
setType
]
=
useState
(
'add'
);
// 弹窗类型
const
[
formObj
,
setFormObj
]
=
useState
({});
...
...
@@ -29,7 +30,7 @@ const VectorData = props => {
}
useEffect
(()
=>
{
renderTile
();
},
[]);
},
[
visible
,
flag
]);
// 获取瓦片数据配置数据
const
renderTile
=
()
=>
{
setTreeLoading
(
true
);
...
...
@@ -38,29 +39,67 @@ const VectorData = props => {
isBaseMap
:
false
}).
then
(
res
=>
{
console
.
log
(
'res'
,
res
.
Result
)
if
(
res
&&
res
.
Result
.
length
>
0
)
{
setTreeLoading
(
false
);
setTileData
(
res
.
Result
);
}
else
{
setTreeLoading
(
false
);
notification
.
error
({
message
:
'获取失败'
,
description
:
res
.
message
,
});
}
}
)
};
//增加瓦片
const
addTile
=
(
item
,
index
)
=>
{
const
addTile
=
(
item
)
=>
{
console
.
log
(
'item'
,
item
);
setFormObj
(
item
);
setType
(
'add'
);
setVisible
(
true
);
}
//删除方案
const
deleteTile
=
(
item
)
=>
{
deleteConfig
({
schemename
:
item
.
schemename
,
terminalType
:
'scheme'
,
isBaseMap
:
false
}).
then
(
res
=>
{
if
(
res
.
IsSuccess
)
{
notification
.
success
({
message
:
'提示'
,
duration
:
3
,
description
:
'方案删除成功'
,
});
setFlag
(
flag
+
1
)
}
else
{
notification
.
error
({
message
:
'提示'
,
duration
:
3
,
description
:
'方案删除失败'
,
});
}
})
}
//删除瓦片
const
deleteTile
=
(
item
,
index
)
=>
{
const
deletebaseMap
=
(
item
,
baseMapItem
)
=>
{
unbindSchemeBaseMap
({
schemename
:
item
.
schemename
,
basemapName
:
baseMapItem
}).
then
(
res
=>
{
if
(
res
.
IsSuccess
)
{
notification
.
success
({
message
:
'提示'
,
duration
:
3
,
description
:
'底图删除成功'
,
});
setFlag
(
flag
+
1
)
}
else
{
notification
.
error
({
message
:
'提示'
,
duration
:
3
,
description
:
'底图删除失败'
,
});
}
})
}
return
(
<>
...
...
@@ -72,24 +111,25 @@ const VectorData = props => {
新增
</
Button
>
</
div
>
<
Row
>
<
Row
>
{
tileData
&&
tileData
.
length
?
tileData
.
map
((
item
,
index
)
=>
{
return
<
Col
key=
{
index
}
span=
{
5
}
>
<
Card
title=
{
<
div
><
span
className=
{
styles
.
schemeName
}
>
方案名
</
span
>
{
item
.
schemename
}
</
div
>
}
extra=
{
<
a
href=
"#"
>
return
<
Col
key=
{
index
}
span=
{
5
}
style=
{
{
marginBottom
:
'1rem'
}
}
>
<
Card
title=
{
<
div
><
span
className=
{
styles
.
schemeName
}
>
方案名
</
span
>
{
item
.
schemename
}
</
div
>
}
extra=
{
<
a
href=
"#"
>
<
Popconfirm
title=
"是否删除该方案?"
okText=
"确认"
cancelText=
"取消"
onConfirm=
{
()
=>
{
deleteTile
(
record
);
deleteTile
(
item
);
}
}
>
<
CloseOutlined
/>
</
Popconfirm
>
</
a
>
}
style=
{
{
width
:
300
}
}
>
<
p
><
span
className=
{
styles
.
schemeName
}
>
矢量
</
span
>
{
item
.
servicename
}
</
p
>
<
div
className=
{
styles
.
schemeItem
}
><
span
className=
{
styles
.
schemeName
}
>
瓦片
</
span
>
<
Button
className=
{
styles
.
schemeBtn
}
onClick=
{
()
=>
addTile
(
item
,
index
)
}
>
<
PlusOutlined
/>
添加瓦片
</
Button
>
<
Button
className=
{
styles
.
schemeBtn
}
onClick=
{
()
=>
addTile
(
item
)
}
>
<
PlusOutlined
/>
添加瓦片
</
Button
>
</
div
>
<
div
style=
{
{
overflowY
:
'scroll'
,
height
:
'5.5rem'
}
}
>
{
item
.
baseMap
&&
item
.
baseMap
.
length
?
item
.
baseMap
.
map
((
baseMapItem
,
baseindex
)
=>
{
return
<
div
key=
{
baseindex
}
className=
{
styles
.
mapItem
}
>
<
div
className=
{
classnames
({
...
...
@@ -103,13 +143,14 @@ const VectorData = props => {
okText=
"确认"
cancelText=
"取消"
onConfirm=
{
()
=>
{
delete
Tile
(
record
);
delete
baseMap
(
item
,
baseMapItem
);
}
}
>
<
CloseOutlined
/>
</
Popconfirm
>
</
div
>
</
div
>
})
:
''
}
</
div
>
</
Card
>
</
Col
>
})
:
''
}
...
...
src/pages/platformCenter/schemeConfig/solutionConfig/AddModal.jsx
0 → 100644
View file @
56454852
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
{
Form
,
Modal
,
Input
,
Select
,
AutoComplete
,
Button
,
notification
}
from
'antd'
;
import
styles
from
'../SchemeConfig.less'
import
{
GetGISServerMapList
,
publisService
}
from
'@/services/webConfig/api'
;
const
{
Option
}
=
Select
;
const
AddModal
=
props
=>
{
const
{
callBackSubmit
=
()
=>
{
},
type
,
formObj
,
visible
,
solutionNames
}
=
props
;
const
[
loading
,
setLoading
]
=
useState
(
false
);
const
[
workSpace
,
setWorkSpace
]
=
useState
(
''
);
const
[
serviceName
,
setServicename
]
=
useState
([{
value
:
'geoserver'
,
item
:
'geoserver'
}]);
const
[
workList
,
setWorkList
]
=
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
query
=
{
_version
:
9999
,
gsIP
:
obj
.
serviceadress
,
gsPort
:
obj
.
port
,
gsAppName
:
obj
.
servicename
,
gsUser
:
obj
.
user
,
gsWorkspaceName
:
obj
.
workname
,
gsPwd
:
obj
.
password
,
serviceName
:
obj
.
name
,
solution
:
solutionNames
,
}
publisService
(
query
,{
timeout
:
120000
})
.
then
(
res
=>
{
setLoading
(
false
);
if
(
res
.
success
)
{
form
.
resetFields
();
callBackSubmit
();
notification
.
success
({
message
:
'提示'
,
duration
:
3
,
description
:
'新增成功'
,
});
setWorkList
([])
handlelocalStorage
(
'add'
,
obj
.
serviceadress
,
obj
.
servicename
)
}
else
{
notification
.
error
({
message
:
'提示'
,
duration
:
3
,
description
:
'新增失败'
,
});
}
})
.
catch
(
err
=>
{
notification
.
error
({
message
:
'提示'
,
duration
:
3
,
description
:
'新增失败'
,
});
setLoading
(
false
);
});
}
else
if
(
type
===
'edit'
)
{
handleEdit
();
}
}
});
};
const
handleEdit
=
()
=>
{
// SetServiceConfig({
// servicename: serviceName,
// terminalType: 'base',
// isBaseMap: true,
// jsonCfg: JSON.stringify(query)
// })
// .then(res => {
// setLoading(false);
// if (res.success) {
// form.resetFields();
// callBackSubmit();
// notification.success({
// message: '提示',
// duration: 3,
// description: res.message || '编辑成功',
// });
// } else {
// notification.error({
// message: '提示',
// duration: 3,
// description: res.message || '编辑失败',
// });
// }
// })
// .catch(err => setLoading(false));
};
const
onFinish
=
value
=>
{
};
useEffect
(()
=>
{
switch
(
type
)
{
case
'add'
:
let
gsIp
=
[];
let
localStorageData
=
handlelocalStorage
(
'get'
);
if
(
localStorageData
)
{
gsIp
=
localStorageData
.
map
(
item
=>
({
value
:
item
.
gsIp
,
item
:
item
.
gsIp
}));
}
setGsIp
(
gsIp
)
let
localIps
=
[
'192.168.12.7'
,
'192.168.19.100'
]
let
port
=
localIps
.
includes
(
gsIp
)
?
8080
:
8088
form
.
setFieldsValue
({
servicename
:
serviceName
[
0
].
value
,
port
,
...
formObj
});
break
;
case
'edit'
:
form
.
setFieldsValue
({
...
formObj
});
break
;
default
:
break
;
}
},
[
visible
]);
//存储到localstorage
const
handlelocalStorage
=
(
type
,
gsIp
,
gisAppName
)
=>
{
if
(
!
localStorage
)
return
null
;
let
result
=
JSON
.
parse
(
localStorage
.
getItem
(
'metaData'
))
if
(
type
==
'get'
)
{
return
result
;
}
if
(
!
result
||
!
result
.
find
(
item
=>
item
.
gsIp
==
gsIp
))
{
if
(
!
result
)
result
=
[];
result
.
push
({
gsIp
,
gisAppName
:
[{
value
:
gisAppName
,
item
:
gisAppName
}]
})
localStorage
.
setItem
(
'metaData'
,
JSON
.
stringify
(
result
))
return
}
let
data
=
result
.
find
(
item
=>
item
.
gsIp
==
gsIp
)
let
isHasGisAppName
=
data
.
gisAppName
.
find
(
item
=>
item
.
value
==
gisAppName
);
if
(
isHasGisAppName
)
return
;
data
.
gisAppName
.
push
({
value
:
gisAppName
,
item
:
gisAppName
})
localStorage
.
setItem
(
'metaData'
,
JSON
.
stringify
(
result
))
};
const
layout
=
{
layout
:
'horizontal'
,
labelCol
:
{
span
:
4
,
},
wrapperCol
:
{
span
:
16
,
},
};
const
handleChange
=
()
=>
{
}
//选择工作空间
const
selectWorkspace
=
()
=>
{
let
obj
=
form
.
getFieldsValue
();
form
.
validateFields
([
'serviceadress'
,
'port'
,
'servicename'
,
'user'
,
'password'
]).
then
(
validate
=>
{
if
(
validate
)
{
let
query
=
{
GISServerIP
:
obj
.
serviceadress
,
GISServerPort
:
obj
.
port
,
gsAppName
:
obj
.
servicename
,
gsUser
:
obj
.
user
,
gsPwd
:
obj
.
password
,
isGeoServer
:
true
,
_version
:
9999
,
}
GetGISServerMapList
(
query
).
then
(
res
=>
{
if
(
Array
.
isArray
(
res
))
{
const
defaultValue
=
res
[
0
].
name
||
''
form
.
setFieldsValue
({
name
:
defaultValue
,
workname
:
defaultValue
});
setWorkList
(
res
)
setWorkSpace
(
defaultValue
)
}
else
{
notification
.
error
({
message
:
'提示'
,
duration
:
3
,
description
:
'获取工作空间失败'
,
});
}
})
}
})
};
//选择工作空间
const
handleWorkspace
=
(
value
)
=>
{
form
.
setFieldsValue
({
workname
:
value
,
name
:
value
})
setWorkSpace
(
value
)
}
const
selectIp
=
(
value
)
=>
{
let
localIps
=
[
'192.168.12.7'
,
'192.168.19.100'
]
let
port
=
localIps
.
includes
(
value
)
?
8080
:
8088
form
.
setFieldsValue
({
port
,
serviceadress
:
value
});
}
return
(
<
Modal
title=
{
`${type === 'add' ? '元数据发布' : '编辑'}`
}
bodyStyle=
{
{
width
:
'100%'
,
minHeight
:
'100px'
}
}
style=
{
{
top
:
'150px'
}
}
width=
"700px"
destroyOnClose
maskClosable=
{
false
}
cancelText=
"取消"
okText=
"确认"
{
...
props
}
onOk=
{
()
=>
onSubmit
()
}
confirmLoading=
{
loading
}
forceRender=
{
true
}
getContainer=
{
false
}
>
{
visible
&&
(
<
Form
form=
{
form
}
{
...
layout
}
onFinish=
{
onFinish
}
>
<
Item
label=
"GIS服务器地址"
name=
"serviceadress"
rules=
{
[{
required
:
true
,
message
:
'请选择服务名'
}]
}
>
<
AutoComplete
placeholder=
"请输入GIS服务器地址"
options=
{
gsIp
}
onSelect=
{
selectIp
}
/>
</
Item
>
<
Item
label=
"GIS服务器端口"
name=
"port"
rules=
{
[{
required
:
true
,
message
:
'请输入GIS服务器端口'
}]
}
>
<
Input
placeholder=
"请输入GIS服务器端口"
allowClear
/>
</
Item
>
<
Item
label=
"GIS服务器名"
name=
"servicename"
rules=
{
[{
required
:
true
,
message
:
'请输入GIS服务器名'
}]
}
>
<
AutoComplete
placeholder=
"Email"
options=
{
serviceName
}
/>
</
Item
>
<
Item
label=
"用户名称"
name=
"user"
rules=
{
[{
required
:
true
,
message
:
'请输入用户名称'
}]
}
>
<
Input
placeholder=
"请输入用户名称"
allowClear
/>
</
Item
>
<
Item
label=
"用户密码"
name=
"password"
rules=
{
[{
required
:
true
,
message
:
'请输入用户密码'
}]
}
>
<
Input
.
Password
placeholder=
"请输入用户密码"
allowClear
/>
</
Item
>
<
Item
label=
"工作空间名称"
name=
"workname"
rules=
{
[{
required
:
true
,
message
:
'请选择工作空间名称'
}]
}
>
<
div
className=
{
styles
.
imgList
}
>
<
Select
onChange=
{
handleWorkspace
}
value
={
workSpace
}
>
{
workList
.
length
?
workList
.
map
((
item
,
index
)
=>
{
return
<
Option
key=
{
index
}
value=
{
item
.
name
}
>
{
item
.
name
}
</
Option
>
})
:
''
}
</
Select
>
<
Button
style=
{
{
marginLeft
:
'0.5rem'
}
}
onClick=
{
()
=>
{
selectWorkspace
()
}
}
>
选择工作空间
</
Button
>
</
div
>
</
Item
>
<
Item
label=
"服务名称"
name=
"name"
rules=
{
[{
required
:
true
,
message
:
'请输入服务名称'
}]
}
>
<
Input
placeholder=
"请输入服务名称"
allowClear
/>
</
Item
>
</
Form
>
)
}
</
Modal
>
);
};
export
default
AddModal
;
src/pages/platformCenter/schemeConfig/solutionConfig/solutionConfig.jsx
0 → 100644
View file @
56454852
import
{
Space
,
Table
,
Button
,
Popconfirm
,
notification
,
Divider
,
Radio
}
from
'antd'
;
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
styles
from
'../SchemeConfig.less'
import
{
GetVectorService
,
deleteVectorService
,
GetAllConfig
}
from
'@/services/webConfig/api'
;
import
{
UserAddOutlined
}
from
'@ant-design/icons'
;
import
AddModal
from
'./AddModal'
const
VectorData
=
props
=>
{
const
[
treeLoading
,
setTreeLoading
]
=
useState
(
false
);
// 弹窗显示
const
[
webData
,
setWebData
]
=
useState
([]);
// web数据
const
[
handData
,
setHandData
]
=
useState
([]);
//手持数据
const
[
visible
,
setVisible
]
=
useState
(
false
);
// 弹窗
const
[
flag
,
setFlag
]
=
useState
(
0
);
// 更新list
const
[
loading
,
setLoading
]
=
useState
([]);
// 更新状态
const
[
type
,
setType
]
=
useState
(
'add'
);
// 弹窗类型
const
[
solutionNames
,
setSolutionNames
]
=
useState
(
''
);
const
[
formObj
,
setFormObj
]
=
useState
({
user
:
'admin'
,
password
:
'geoserver'
});
const
columns
=
[
{
title
:
'默认方案'
,
align
:
'center'
,
key
:
'url'
,
render
:
(
text
,
record
,
index
)
=>
(
<
Space
>
<
Radio
value=
{
record
}
/>
</
Space
>
),
},
{
title
:
'方案名'
,
dataIndex
:
'schemename'
,
key
:
'schemename'
,
align
:
'center'
},
{
title
:
'关联角色'
,
align
:
'center'
,
key
:
'type'
,
render
:
(
text
,
record
,
index
)
=>
(
<
Space
>
<
div
onClick=
{
e
=>
e
.
stopPropagation
()
}
>
<
UserAddOutlined
/>
</
div
>
</
Space
>
),
},
{
title
:
'编辑'
,
align
:
'center'
,
key
:
'schemename'
,
render
:
(
text
,
record
,
index
)
=>
(
<
Space
>
<
div
onClick=
{
e
=>
e
.
stopPropagation
()
}
>
<
Popconfirm
title=
"是否删除该矢量数据?"
okText=
"确认"
cancelText=
"取消"
onConfirm=
{
()
=>
{
delConfirm
(
record
);
}
}
>
<
Button
size=
"small"
danger
>
删除
</
Button
>
</
Popconfirm
>
</
div
>
</
Space
>
),
}
];
const
onSubmit
=
prop
=>
{
setVisible
(
false
);
setFlag
(
flag
+
1
)
};
const
delConfirm
=
(
record
)
=>
{
let
query
=
{
serviceName
:
record
.
serviceName
,
_version
:
9999
,
solution
:
solutionNames
}
deleteVectorService
(
query
).
then
(
res
=>
{
if
(
res
.
success
)
{
setFlag
(
flag
+
1
)
notification
.
success
({
message
:
'提示'
,
duration
:
3
,
description
:
'删除元数据成功'
,
});
}
else
{
notification
.
error
({
message
:
'提示'
,
duration
:
3
,
description
:
'删除元数据失败'
,
});
};
})
}
const
handleAdd
=
()
=>
{
setType
(
'add'
);
setVisible
(
true
);
}
useEffect
(()
=>
{
renderTile
();
},
[
flag
]);
// 获取瓦片数据配置数据
const
renderTile
=
()
=>
{
setTreeLoading
(
true
);
//查询方案
var
schemeConfigQueryRequest
=
GetAllConfig
({
terminalType
:
'scheme'
,
isBaseMap
:
false
})
//查询web方案
var
webSchemeQueryRequest
=
GetAllConfig
({
terminalType
:
'web'
,
isBaseMap
:
false
})
Promise
.
all
([
schemeConfigQueryRequest
,
webSchemeQueryRequest
]).
then
(
res
=>
{
console
.
log
(
'res'
,
res
);
if
(
res
[
0
].
IsSuccess
){
setHandData
(
res
[
0
].
Result
)
}
if
(
res
[
1
].
IsSuccess
){
setWebData
(
res
[
1
].
Result
)
}
})
};
return
(
<>
<
Divider
orientation=
"left"
>
Web
</
Divider
>
<
Table
columns=
{
columns
}
dataSource=
{
webData
}
bordered
rowKey=
"schemename"
scroll=
{
{
y
:
400
}
}
>
</
Table
>
<
Divider
orientation=
"left"
>
手持
</
Divider
>
<
Table
columns=
{
columns
}
dataSource=
{
handData
}
bordered
rowKey=
"schemename"
scroll=
{
{
y
:
400
}
}
>
</
Table
>
</>
)
}
export
default
VectorData
\ No newline at end of file
src/services/webConfig/api.js
View file @
56454852
...
...
@@ -179,8 +179,8 @@ export const GetGISServerMapList = query =>
//发布原数据
export
const
publisService
=
(
query
,
timeout
)
=>
get
(
`
${
CITY_SERVICE
}
/OMS.svc/D_Publish_GS_Service`
,
query
,
timeout
);
export
const
publisService
=
(
query
)
=>
get
(
`
${
CITY_SERVICE
}
/OMS.svc/D_Publish_GS_Service`
,
query
,
{
timeout
:
120000
}
);
//解决方案名称
export
const
getSolutionList
=
(
query
)
=>
...
...
@@ -194,5 +194,17 @@ get(`${CITY_SERVICE}/OMS.svc/D_DeleteVectorService`, query );
export
const
updatePublishedMetaData
=
(
query
)
=>
get
(
`
${
CITY_SERVICE
}
/OMS.svc/D_UpdatePublishedMetaData`
,
query
);
//删除配置
export
const
deleteConfig
=
(
query
)
=>
get
(
`
${
CITY_SERVICE
}
/OMS.svc/DeleteConfig`
,
query
);
//增加瓦片
export
const
bindSchemeBaseMap
=
(
query
)
=>
get
(
`
${
CITY_SERVICE
}
/OMS.svc/BindSchemeBaseMap`
,
query
);
//删除瓦片
export
const
unbindSchemeBaseMap
=
(
query
)
=>
get
(
`
${
CITY_SERVICE
}
/OMS.svc/UnbindSchemeBaseMap`
,
query
);
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