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
1b1c261d
Commit
1b1c261d
authored
Apr 23, 2021
by
shaoan123
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
卡片组件封装
parent
ad6230d5
Pipeline
#26535
skipped with stages
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
95 additions
and
83 deletions
+95
-83
AddModal.jsx
...s/platformCenter/schemeConfig/projectMessage/AddModal.jsx
+1
-1
card.jsx
...ormCenter/schemeConfig/projectMessage/components/card.jsx
+88
-22
projectMessage.jsx
...formCenter/schemeConfig/projectMessage/projectMessage.jsx
+6
-60
No files found.
src/pages/platformCenter/schemeConfig/projectMessage/AddModal.jsx
View file @
1b1c261d
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
{
Form
,
Modal
,
Input
,
Select
,
notification
,
Button
}
from
'antd'
;
import
{
Form
,
Modal
,
Input
,
Select
,
notification
}
from
'antd'
;
import
{
import
{
GetAllConfig
,
GetAllConfig
,
GetVectorService
,
GetVectorService
,
...
...
src/pages/platformCenter/schemeConfig/projectMessage/components/card.jsx
View file @
1b1c261d
import
React
from
'react'
;
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
classnames
from
'classnames'
import
classnames
from
'classnames'
import
styles
from
'../../SchemeConfig.less'
import
styles
from
'../../SchemeConfig.less'
import
{
Popconfirm
,
notification
}
from
'antd'
;
import
{
Popconfirm
,
notification
,
Card
,
Button
}
from
'antd'
;
import
{
import
{
unbindSchemeBaseMap
unbindSchemeBaseMap
}
from
'@/services/webConfig/api'
;
}
from
'@/services/webConfig/api'
;
import
{
import
{
CloseOutlined
CloseOutlined
,
PlusOutlined
}
from
'@ant-design/icons'
;
}
from
'@ant-design/icons'
;
import
AddModal
from
'../AddModal'
const
CardData
=
props
=>
{
const
CardData
=
props
=>
{
const
{
deletebaseMaps
=
()
=>
{
}
}
=
props
;
const
{
deletebaseMaps
=
()
=>
{
}
}
=
props
;
const
[
visible
,
setVisible
]
=
useState
(
false
);
// 弹窗
const
[
flag
,
setFlag
]
=
useState
(
0
);
// 状态更新
const
[
type
,
setType
]
=
useState
(
''
);
// 弹窗类型
const
[
formObj
,
setFormObj
]
=
useState
({});
//删除瓦片
//删除瓦片
const
deletebaseMap
=
(
item
,
baseMapItem
)
=>
{
const
deletebaseMap
=
(
item
,
baseMapItem
)
=>
{
unbindSchemeBaseMap
({
schemename
:
item
.
schemename
,
basemapName
:
baseMapItem
}).
then
(
res
=>
{
unbindSchemeBaseMap
({
schemename
:
item
.
schemename
,
basemapName
:
baseMapItem
}).
then
(
res
=>
{
...
@@ -31,27 +36,88 @@ const CardData = props => {
...
@@ -31,27 +36,88 @@ const CardData = props => {
})
})
}
}
//删除方案
const
deleteTile
=
(
item
)
=>
{
deleteConfig
({
schemename
:
item
.
schemename
,
terminalType
:
'scheme'
,
isBaseMap
:
false
}).
then
(
res
=>
{
if
(
res
.
IsSuccess
)
{
notification
.
success
({
message
:
'提示'
,
duration
:
3
,
description
:
'方案删除成功'
,
});
deletebaseMaps
()
}
else
{
notification
.
error
({
message
:
'提示'
,
duration
:
3
,
description
:
'方案删除失败'
,
});
}
})
}
const
onSubmit
=
prop
=>
{
setVisible
(
false
);
deletebaseMaps
()
};
//增加瓦片
const
addTile
=
(
item
)
=>
{
setFormObj
(
item
);
setType
(
'add'
);
setVisible
(
true
);
}
return
(
return
(
<>
<>
<
div
className=
{
styles
.
mapItem
}
>
<
Card
title=
{
<
div
><
span
className=
{
styles
.
schemeName
}
>
方案名
</
span
>
{
props
.
item
.
schemename
}
</
div
>
}
extra=
{
<
a
href=
"#"
>
<
div
className=
{
classnames
({
<
Popconfirm
[
styles
.
defaultTile
]:
true
,
title=
"是否删除该方案?"
[
styles
.
activeTile
]:
props
.
baseindex
==
props
.
item
.
defaultBaseMap
,
okText=
"确认"
})
}
>
默认
</
div
>
cancelText=
"取消"
<
div
className=
{
styles
.
mapText
}
>
{
props
.
baseMapItem
}
</
div
>
onConfirm=
{
()
=>
{
<
div
className=
{
styles
.
mapIcon
}
>
deleteTile
(
props
.
item
);
<
Popconfirm
}
}
title=
"是否删除该底图?"
>
okText=
"确认"
<
CloseOutlined
/>
cancelText=
"取消"
</
Popconfirm
>
</
a
>
}
style=
{
{
width
:
300
}
}
>
onConfirm=
{
()
=>
{
<
p
><
span
className=
{
styles
.
schemeName
}
>
矢量
</
span
>
{
props
.
item
.
servicename
}
</
p
>
deletebaseMap
(
props
.
item
,
props
.
baseMapItem
);
<
div
className=
{
styles
.
schemeItem
}
><
span
className=
{
styles
.
schemeName
}
>
瓦片
</
span
>
}
}
<
Button
className=
{
styles
.
schemeBtn
}
onClick=
{
()
=>
addTile
(
props
.
item
)
}
>
<
PlusOutlined
/>
添加瓦片
</
Button
>
>
</
div
>
<
CloseOutlined
/>
<
div
style=
{
{
overflowY
:
'scroll'
,
height
:
'5.5rem'
}
}
>
</
Popconfirm
>
</
div
>
{
props
.
item
.
baseMap
&&
props
.
item
.
baseMap
.
length
?
props
.
item
.
baseMap
.
map
((
baseMapItem
,
baseindex
)
=>
{
</
div
>
return
<
div
className=
{
styles
.
mapItem
}
key=
{
baseindex
}
>
<
div
className=
{
classnames
({
[
styles
.
defaultTile
]:
true
,
[
styles
.
activeTile
]:
baseindex
==
props
.
item
.
defaultBaseMap
,
})
}
>
默认
</
div
>
<
div
className=
{
styles
.
mapText
}
>
{
baseMapItem
}
</
div
>
<
div
className=
{
styles
.
mapIcon
}
>
<
Popconfirm
title=
"是否删除该底图?"
okText=
"确认"
cancelText=
"取消"
onConfirm=
{
()
=>
{
deletebaseMap
(
props
.
item
,
baseMapItem
);
}
}
>
<
CloseOutlined
/>
</
Popconfirm
>
</
div
>
</
div
>
})
:
''
}
</
div
>
</
Card
>
<
AddModal
visible=
{
visible
}
onCancel=
{
()
=>
setVisible
(
false
)
}
callBackSubmit=
{
onSubmit
}
type=
{
type
}
formObj=
{
formObj
}
/>
</>
</>
)
)
}
}
...
...
src/pages/platformCenter/schemeConfig/projectMessage/projectMessage.jsx
View file @
1b1c261d
import
{
Button
,
Card
,
notification
,
Col
,
Row
,
Popconfirm
}
from
'antd'
;
import
{
Button
}
from
'antd'
;
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
classnames
from
'classnames'
import
styles
from
'../SchemeConfig.less'
import
styles
from
'../SchemeConfig.less'
import
{
import
{
GetAllConfig
,
deleteConfig
,
unbindSchemeBaseMap
GetAllConfig
}
from
'@/services/webConfig/api'
;
}
from
'@/services/webConfig/api'
;
import
{
CloseOutlined
,
PlusOutlined
}
from
'@ant-design/icons'
;
import
AddModal
from
'./AddModal'
import
AddModal
from
'./AddModal'
import
Cards
from
'./components/card'
import
Cards
from
'./components/card'
const
VectorData
=
props
=>
{
const
VectorData
=
props
=>
{
...
@@ -23,7 +19,7 @@ const VectorData = props => {
...
@@ -23,7 +19,7 @@ const VectorData = props => {
setVisible
(
false
);
setVisible
(
false
);
};
};
const
onDeletebaseMap
=
(
value
)
=>
{
const
onDeletebaseMap
=
(
value
)
=>
{
setFlag
(
flag
+
1
)
setFlag
(
flag
+
1
)
}
}
const
handleAdd
=
()
=>
{
const
handleAdd
=
()
=>
{
setType
(
'schemeAdd'
);
setType
(
'schemeAdd'
);
...
@@ -51,38 +47,7 @@ const VectorData = props => {
...
@@ -51,38 +47,7 @@ const VectorData = props => {
)
)
};
};
//增加瓦片
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
:
'方案删除失败'
,
});
}
})
}
return
(
return
(
<>
<>
<
div
style=
{
{
width
:
'calc(100vw - 265px)'
}
}
>
<
div
style=
{
{
width
:
'calc(100vw - 265px)'
}
}
>
...
@@ -96,27 +61,8 @@ const VectorData = props => {
...
@@ -96,27 +61,8 @@ const VectorData = props => {
<
div
className=
{
styles
.
cardsList
}
>
<
div
className=
{
styles
.
cardsList
}
>
{
tileData
&&
tileData
.
length
?
{
tileData
&&
tileData
.
length
?
tileData
.
map
((
item
,
index
)
=>
{
tileData
.
map
((
item
,
index
)
=>
{
return
<
div
className=
{
styles
.
cardItem
}
key=
{
index
}
span=
{
5
}
offset=
{
2
}
style=
{
{
marginBottom
:
'1rem'
}
}
>
<
Card
title=
{
<
div
><
span
className=
{
styles
.
schemeName
}
>
方案名
</
span
>
{
item
.
schemename
}
</
div
>
}
extra=
{
<
a
href=
"#"
>
return
<
div
className=
{
styles
.
cardItem
}
key=
{
index
}
span=
{
5
}
offset=
{
2
}
style=
{
{
marginBottom
:
'1rem'
}
}
>
<
Popconfirm
<
Cards
item=
{
item
}
deletebaseMaps=
{
onDeletebaseMap
}
></
Cards
>
title=
"是否删除该方案?"
okText=
"确认"
cancelText=
"取消"
onConfirm=
{
()
=>
{
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
)
}
>
<
PlusOutlined
/>
添加瓦片
</
Button
>
</
div
>
<
div
style=
{
{
overflowY
:
'scroll'
,
height
:
'5.5rem'
}
}
>
{
item
.
baseMap
&&
item
.
baseMap
.
length
?
item
.
baseMap
.
map
((
baseMapItem
,
baseindex
)
=>
{
return
<
Cards
key=
{
baseindex
}
baseMapItem=
{
baseMapItem
}
baseindex=
{
baseindex
}
item=
{
item
}
deletebaseMaps=
{
onDeletebaseMap
}
/>
})
:
''
}
</
div
>
</
Card
>
</
div
>
</
div
>
})
:
''
}
})
:
''
}
</
div
>
</
div
>
...
...
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