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
f4880aa8
Commit
f4880aa8
authored
May 13, 2022
by
邓超
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修改数据库初始化添加新文件夹后失败问题
parent
19f0f33d
Pipeline
#50137
passed with stages
in 2 minutes 20 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
124 additions
and
124 deletions
+124
-124
InitDataBase.jsx
src/pages/database/InitDataBase/InitDataBase.jsx
+8
-1
VectorPreviewModal.jsx
...Center/gis/schemeConfig/VectorData/VectorPreviewModal.jsx
+116
-123
No files found.
src/pages/database/InitDataBase/InitDataBase.jsx
View file @
f4880aa8
...
...
@@ -458,15 +458,21 @@ const InitDataBase = props => {
});
});
});
console
.
log
(
mapList
,
'mapList'
);
fileList
.
forEach
(
element
=>
{
// 根据key来获取第一级目录tab的check
let
tabKey
=
mapList
.
get
(
element
.
key
);
element
.
check
=
tabKey
===
undefined
?
null
:
tabKey
;
element
.
modularSolutions
.
forEach
(
item
=>
{
let
mapCheckVersion
=
mapList
.
get
(
item
.
key
);
if
(
mapCheckVersion
===
undefined
)
{
mapCheckVersion
=
{
checkVersion
:
null
,
check
:
null
};
}
// 根据key值去匹配对应的checkVersion
console
.
log
(
mapCheckVersion
,
'mapCheckVersion'
);
item
.
checkVersion
=
mapCheckVersion
.
checkVersion
===
undefined
?
null
:
mapCheckVersion
.
checkVersion
;
console
.
log
(
item
.
checkVersion
,
' item.checkVersion'
);
// 根据key值去匹配对应的二级目录的check
item
.
check
=
mapCheckVersion
.
check
===
undefined
?
null
:
mapCheckVersion
.
check
;
if
(
item
.
check
)
{
...
...
@@ -488,7 +494,8 @@ const InitDataBase = props => {
setInitList
(
fileList
);
setInitLoading
(
false
);
})
.
catch
(()
=>
{
.
catch
(
err
=>
{
console
.
log
(
err
,
'err'
);
notification
.
error
({
message
:
'提示'
,
duration
:
3
,
...
...
src/pages/platformCenter/gis/schemeConfig/VectorData/VectorPreviewModal.jsx
View file @
f4880aa8
import
React
,
{
useEffect
,
useState
,
useRef
}
from
'react'
import
React
,
{
useEffect
,
useState
,
useRef
}
from
'react'
;
import
SiteModal
from
'@/components/Modal/SiteModa'
;
import
{
Input
,
Cascader
,
Button
,
message
,
Spin
}
from
'antd'
import
{
gcj_decrypt
,
exetent2AmapPoint
,
lngLat2WebMercator
,
plan2AMapbound
,
webMercator2LngLat
}
from
'@/utils/transformUtil'
import
{
GetAllConfig
,
GetMetaData
}
from
'@/services/gis/gis'
import
ReactJson
from
'react-json-view'
import
{
Input
,
Cascader
,
Button
,
message
,
Spin
}
from
'antd'
;
import
{
gcj_decrypt
,
exetent2AmapPoint
,
lngLat2WebMercator
,
plan2AMapbound
,
webMercator2LngLat
,
}
from
'@/utils/transformUtil'
;
import
{
GetAllConfig
,
GetMetaData
}
from
'@/services/gis/gis'
;
import
ReactJson
from
'react-json-view'
;
import
{
tr
}
from
'voca'
;
const
{
Search
}
=
Input
;
const
VectorPreviewModal
=
props
=>
{
const
{
metaData
}
=
props
const
mapID
=
useRef
();
const
[
currentMeta
,
setCurrentMeta
]
=
useState
()
const
[
isLoading
,
setIsLoading
]
=
useState
(
false
)
useEffect
(()
=>
{
if
(
document
.
getElementById
(
"map-container"
))
{
if
(
!
mapID
.
current
)
{
//1.加载底图
let
m
=
new
window
.
AMap
.
Map
(
'map-container'
);
mapID
.
current
=
m
}
}
},
[
props
])
useEffect
(()
=>
{
let
map
=
mapID
.
current
map
&&
map
.
clearMap
()
map
&&
map
.
remove
(
map
.
getLayers
())
setIsLoading
(
true
)
map
&&
GetMetaData
(
metaData
.
GISServerProjectName
).
then
(
res2
=>
{
if
(
res2
&&
res2
.
units
)
{
setIsLoading
(
false
)
setCurrentMeta
(
res2
)
const
layers
=
res2
.
layers
||
[];
const
workspace
=
res2
.
mapName
.
split
(
'_'
)[
0
];
const
subLayers
=
layers
.
filter
(
layer
=>
layer
.
subLayerIds
&&
layer
.
subLayerIds
.
length
===
0
).
map
(
layer
=>
layer
.
name
);
const
paramLayers
=
`
${
workspace
}
:
${
subLayers
.
join
(
','
)}
`
;
const
params
=
{
'LAYERS'
:
paramLayers
,
'VERSION'
:
'1.1.1'
,
'_site'
:
''
};
const
wmsOption
=
{
tileSize
:
512
,
url
:
`
${
location
.
origin
}
/Cityinterface/rest/services/MapServer.svc/
${
metaData
.
GISServerProjectName
}
/GeoServerProxy/wms`
,
blend
:
false
,
params
:
params
,
zooms
:
[
2
,
20
],
}
let
wms
=
new
window
.
AMap
.
TileLayer
.
WMS
(
wmsOption
)
map
.
add
(
wms
);
setIsLoading
(
true
)
// wms.complete(() => {
// setIsLoading(false)
// })
wms
.
on
(
"complete"
,()
=>
{
setIsLoading
(
false
)
})
const
extent
=
res2
.
fullExtent
;
if
(
extent
.
xmax
<
100000000
&&
extent
.
xmax
>
0
)
{
const
a
=
webMercator2LngLat
(
extent
.
xmin
,
extent
.
ymin
)
const
b
=
webMercator2LngLat
(
extent
.
xmax
,
extent
.
ymax
)
const
southWest
=
new
AMap
.
LngLat
(
a
[
0
],
a
[
1
])
const
northEast
=
new
AMap
.
LngLat
(
b
[
0
],
b
[
1
])
mapID
.
current
.
setBounds
(
new
AMap
.
Bounds
(
southWest
,
northEast
))
}
}
}
)
},
[
metaData
])
const
resetmap
=
()
=>
{
const
{
metaData
}
=
props
;
const
mapID
=
useRef
();
const
[
currentMeta
,
setCurrentMeta
]
=
useState
();
const
[
isLoading
,
setIsLoading
]
=
useState
(
false
);
useEffect
(()
=>
{
if
(
document
.
getElementById
(
'map-container'
))
{
if
(
!
mapID
.
current
)
{
//1.加载底图
let
m
=
new
window
.
AMap
.
Map
(
'map-container'
);
mapID
.
current
=
m
;
}
}
const
getInitConfig
=
()
=>
{
}
const
onSubmit
=
()
=>
{
}
return
(
<
SiteModal
{
...
props
}
title=
{
"元数据预览"
}
bodyStyle=
{
{
width
:
'100%'
,
minHeight
:
'100px'
}
}
style=
{
{
top
:
200
,
borderRadius
:
'20px'
}
}
width=
"1050px"
cancelText=
"取消"
okText=
"确认"
onOk=
{
()
=>
onSubmit
()
}
>
<
Spin
spinning=
{
isLoading
}
>
<
div
style=
{
{
width
:
"1000px"
,
height
:
"500px"
}
}
>
<
div
style=
{
{
width
:
"1000px"
,
height
:
"500px"
,
position
:
"absolute"
}
}
>
<
div
id=
"map-container"
style=
{
{
width
:
"1000px"
,
height
:
"500px"
}
}
></
div
>
<
div
style=
{
{
top
:
"10px"
,
right
:
"10px"
,
position
:
"absolute"
,
overflowY
:
"scroll"
,
maxHeight
:
"480px"
,
backgroundColor
:
"white"
}
}
>
<
ReactJson
src=
{
currentMeta
}
collapsed=
{
true
}
/>
</
div
>
</
div
>
</
div
>
</
Spin
>
</
SiteModal
>
)
}
export
default
VectorPreviewModal
\ No newline at end of file
},
[
props
]);
useEffect
(()
=>
{
let
map
=
mapID
.
current
;
map
&&
map
.
clearMap
();
map
&&
map
.
remove
(
map
.
getLayers
());
setIsLoading
(
true
);
map
&&
GetMetaData
(
metaData
.
GISServerProjectName
).
then
(
res2
=>
{
if
(
res2
&&
res2
.
units
)
{
setIsLoading
(
false
);
setCurrentMeta
(
res2
);
const
layers
=
res2
.
layers
||
[];
const
workspace
=
res2
.
mapName
.
split
(
'_'
)[
0
];
const
subLayers
=
layers
.
filter
(
layer
=>
layer
.
subLayerIds
&&
layer
.
subLayerIds
.
length
===
0
)
.
map
(
layer
=>
layer
.
name
);
const
paramLayers
=
`
${
workspace
}
:
${
subLayers
.
join
(
','
)}
`
;
const
params
=
{
LAYERS
:
paramLayers
,
VERSION
:
'1.1.1'
,
_site
:
''
,
};
const
wmsOption
=
{
tileSize
:
512
,
url
:
`
${
location
.
origin
}
/Cityinterface/rest/services/MapServer.svc/
${
metaData
.
GISServerProjectName
}
/GeoServerProxy/wms`
,
blend
:
false
,
params
:
params
,
zooms
:
[
2
,
20
],
};
let
wms
=
new
window
.
AMap
.
TileLayer
.
WMS
(
wmsOption
);
map
.
add
(
wms
);
setIsLoading
(
true
);
// wms.complete(() => {
// setIsLoading(false)
// })
wms
.
on
(
'complete'
,
()
=>
{
setIsLoading
(
false
);
});
const
extent
=
res2
.
fullExtent
;
if
(
extent
.
xmax
<
100000000
&&
extent
.
xmax
>
0
)
{
const
a
=
webMercator2LngLat
(
extent
.
xmin
,
extent
.
ymin
);
const
b
=
webMercator2LngLat
(
extent
.
xmax
,
extent
.
ymax
);
const
southWest
=
new
AMap
.
LngLat
(
a
[
0
],
a
[
1
]);
const
northEast
=
new
AMap
.
LngLat
(
b
[
0
],
b
[
1
]);
mapID
.
current
.
setBounds
(
new
AMap
.
Bounds
(
southWest
,
northEast
));
}
}
});
},
[
metaData
]);
const
resetmap
=
()
=>
{};
const
getInitConfig
=
()
=>
{};
const
onSubmit
=
()
=>
{};
return
(
<
SiteModal
{
...
props
}
title=
"管网预览"
bodyStyle=
{
{
width
:
'100%'
,
minHeight
:
'100px'
}
}
style=
{
{
top
:
200
,
borderRadius
:
'20px'
}
}
width=
"1050px"
cancelText=
"取消"
okText=
"确认"
onOk=
{
()
=>
onSubmit
()
}
>
<
Spin
spinning=
{
isLoading
}
>
<
div
style=
{
{
width
:
'1000px'
,
height
:
'500px'
}
}
>
<
div
style=
{
{
width
:
'1000px'
,
height
:
'500px'
,
position
:
'absolute'
}
}
>
<
div
id=
"map-container"
style=
{
{
width
:
'1000px'
,
height
:
'500px'
}
}
/>
<
div
style=
{
{
top
:
'10px'
,
right
:
'10px'
,
position
:
'absolute'
,
overflowY
:
'scroll'
,
maxHeight
:
'480px'
,
maxWidth
:
'250px'
,
backgroundColor
:
'white'
,
}
}
>
<
ReactJson
src=
{
currentMeta
}
/>
</
div
>
</
div
>
</
div
>
</
Spin
>
</
SiteModal
>
);
};
export
default
VectorPreviewModal
;
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