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
d01f930e
Commit
d01f930e
authored
Jan 20, 2022
by
皮倩雯
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: '修改三维配置,地图配置界面留白样式'
parent
39a277af
Pipeline
#43225
skipped with stages
Changes
8
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
1287 additions
and
1277 deletions
+1287
-1277
TileConfig.jsx
...formCenter/gis/dimensionsConfig/TileConfig/TileConfig.jsx
+1
-1
VectorData.jsx
...formCenter/gis/dimensionsConfig/VectorData/VectorData.jsx
+1
-1
projectMessage.jsx
...er/gis/dimensionsConfig/projectMessage/projectMessage.jsx
+82
-76
solutionConfig.jsx
...er/gis/dimensionsConfig/solutionConfig/solutionConfig.jsx
+423
-427
TileConfig.jsx
...platformCenter/gis/schemeConfig/TileConfig/TileConfig.jsx
+184
-191
VectorData.jsx
...platformCenter/gis/schemeConfig/VectorData/VectorData.jsx
+1
-1
projectMessage.jsx
...Center/gis/schemeConfig/projectMessage/projectMessage.jsx
+86
-80
solutionConfig.jsx
...Center/gis/schemeConfig/solutionConfig/solutionConfig.jsx
+509
-500
No files found.
src/pages/platformCenter/gis/dimensionsConfig/TileConfig/TileConfig.jsx
View file @
d01f930e
...
...
@@ -228,7 +228,7 @@ const TileData = props => {
dataSource=
{
tileData
}
bordered
rowKey=
"type"
scroll=
{
{
y
:
4
00
}
}
scroll=
{
{
y
:
6
00
}
}
pagination=
{
{
showTotal
:
(
total
,
range
)
=>
`第${range[0]}-${range[1]} 条/共 ${total} 条`
,
}
}
...
...
src/pages/platformCenter/gis/dimensionsConfig/VectorData/VectorData.jsx
View file @
d01f930e
...
...
@@ -190,7 +190,7 @@ const VectorData = props => {
dataSource=
{
tileData
}
bordered
rowKey=
"id"
scroll=
{
{
y
:
4
00
}
}
scroll=
{
{
y
:
6
00
}
}
pagination=
{
{
showTotal
:
(
total
,
range
)
=>
`第${range[0]}-${range[1]} 条/共 ${total} 条`
,
}
}
...
...
src/pages/platformCenter/gis/dimensionsConfig/projectMessage/projectMessage.jsx
View file @
d01f930e
import
{
Button
,
Spin
}
from
'antd'
;
/* eslint-disable indent */
import
{
Button
,
Spin
}
from
'antd'
;
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
styles
from
'../dimensionsConfig.less'
import
{
GetSchemaInfoList
}
from
'@/services/webConfig/api'
;
import
AddModal
from
'./AddModal'
import
Cards
from
'./components/card'
import
styles
from
'../dimensionsConfig.less'
;
import
{
GetSchemaInfoList
}
from
'@/services/webConfig/api'
;
import
AddModal
from
'./AddModal'
;
import
Cards
from
'./components/card'
;
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
(
''
);
// 弹窗类型
const
[
formObj
,
setFormObj
]
=
useState
({});
const
[
treeLoading
,
setTreeLoading
]
=
useState
(
false
);
// 弹窗显示
const
[
tileData
,
setTileData
]
=
useState
([]);
// 页面初始化数据
const
[
visible
,
setVisible
]
=
useState
(
false
);
// 弹窗
const
[
flag
,
setFlag
]
=
useState
(
0
);
// 状态更新
const
[
type
,
setType
]
=
useState
(
''
);
// 弹窗类型
const
[
formObj
,
setFormObj
]
=
useState
({});
const
onSubmit
=
prop
=>
{
setVisible
(
false
);
setFlag
(
flag
+
1
)
};
const
onDeletebaseMap
=
(
value
)
=>
{
setFlag
(
flag
+
1
)
}
const
handleAdd
=
()
=>
{
setType
(
'schemeAdd'
);
setVisible
(
true
);
}
useEffect
(()
=>
{
renderTile
();
},
[
flag
]);
// 获取瓦片数据配置数据
const
renderTile
=
()
=>
{
setTreeLoading
(
true
);
GetSchemaInfoList
().
then
(
res
=>
{
if
(
res
.
msg
===
'Ok'
)
{
setTreeLoading
(
false
);
setTileData
(
res
.
data
);
}
else
{
setTreeLoading
(
false
);
}
}
)
};
return
(
<>
<
Spin
tip=
"loading..."
spinning=
{
treeLoading
}
>
<
div
style=
{
{
width
:
'calc(100vw - 265px)'
}
}
>
<
div
className=
{
styles
.
tileBtn
}
>
<
Button
type=
"primary"
onClick=
{
()
=>
{
handleAdd
();
}
}
>
新增
</
Button
>
</
div
>
<
div
className=
{
styles
.
cardsList
}
>
{
tileData
&&
tileData
.
length
?
tileData
.
map
((
item
,
index
)
=>
{
return
<
div
className=
{
styles
.
cardItem
}
key=
{
index
}
span=
{
5
}
offset=
{
2
}
style=
{
{
marginBottom
:
'1rem'
}
}
>
<
Cards
item=
{
item
}
deletebaseMaps=
{
onDeletebaseMap
}
></
Cards
>
</
div
>
})
:
''
}
</
div
>
<
AddModal
visible=
{
visible
}
onCancel=
{
()
=>
setVisible
(
false
)
}
callBackSubmit=
{
onSubmit
}
type=
{
type
}
formObj=
{
formObj
}
/>
</
div
>
</
Spin
>
</>
)
}
export
default
VectorData
\ No newline at end of file
const
onSubmit
=
prop
=>
{
setVisible
(
false
);
setFlag
(
flag
+
1
);
};
const
onDeletebaseMap
=
value
=>
{
setFlag
(
flag
+
1
);
};
const
handleAdd
=
()
=>
{
setType
(
'schemeAdd'
);
setVisible
(
true
);
};
useEffect
(()
=>
{
renderTile
();
},
[
flag
]);
// 获取瓦片数据配置数据
const
renderTile
=
()
=>
{
setTreeLoading
(
true
);
GetSchemaInfoList
().
then
(
res
=>
{
if
(
res
.
msg
===
'Ok'
)
{
setTreeLoading
(
false
);
setTileData
(
res
.
data
);
}
else
{
setTreeLoading
(
false
);
}
});
};
return
(
<>
<
Spin
tip=
"loading..."
spinning=
{
treeLoading
}
>
<
div
style=
{
{
height
:
'780px'
,
overflow
:
'scroll'
}
}
>
<
div
className=
{
styles
.
tileBtn
}
>
<
Button
type=
"primary"
onClick=
{
()
=>
{
handleAdd
();
}
}
>
新增
</
Button
>
</
div
>
<
div
className=
{
styles
.
cardsList
}
>
{
tileData
&&
tileData
.
length
?
tileData
.
map
((
item
,
index
)
=>
{
return
(
<
div
className=
{
styles
.
cardItem
}
key=
{
index
}
span=
{
5
}
offset=
{
2
}
style=
{
{
marginBottom
:
'1rem'
}
}
>
<
Cards
item=
{
item
}
deletebaseMaps=
{
onDeletebaseMap
}
/>
</
div
>
);
})
:
''
}
</
div
>
<
AddModal
visible=
{
visible
}
onCancel=
{
()
=>
setVisible
(
false
)
}
callBackSubmit=
{
onSubmit
}
type=
{
type
}
formObj=
{
formObj
}
/>
</
div
>
</
Spin
>
</>
);
};
export
default
VectorData
;
src/pages/platformCenter/gis/dimensionsConfig/solutionConfig/solutionConfig.jsx
View file @
d01f930e
import
{
Space
,
Table
,
Button
,
Popconfirm
,
notification
,
Divider
,
Checkbox
,
Spin
}
from
'antd'
;
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
styles
from
'../dimensionsConfig.less'
import
VisibleRoleModal
from
'@/pages/platformCenter/messageManage/projectManage/components/RolseSelect/VisibleRoleModal'
import
styles
from
'../dimensionsConfig.less'
;
import
VisibleRoleModal
from
'@/pages/platformCenter/messageManage/projectManage/components/RolseSelect/VisibleRoleModal'
;
import
{
PlusOutlined
}
from
'@ant-design/icons'
;
import
{
PlusOutlined
}
from
'@ant-design/icons'
;
import
{
deleteConfig
,
SettingRoleWebSchema
,
SetServiceConfig
,
DeleteWebSchema
,
GetWebSchemaList
,
GetSchemaInfoList
,
IsActionWebSchema
deleteConfig
,
SettingRoleWebSchema
,
SetServiceConfig
,
DeleteWebSchema
,
GetWebSchemaList
,
GetSchemaInfoList
,
IsActionWebSchema
,
}
from
'@/services/webConfig/api'
;
import
{
UserAddOutlined
}
from
'@ant-design/icons'
;
import
AddModal
from
'./AddModal'
import
{
UserAddOutlined
}
from
'@ant-design/icons'
;
import
AddModal
from
'./AddModal'
;
const
VectorData
=
props
=>
{
const
[
treeLoading
,
setTreeLoading
]
=
useState
(
false
);
// 弹窗显示
const
[
schemename
,
setSchemename
]
=
useState
([]);
const
[
record
,
setRecord
]
=
useState
({});
//选中关联角色的方案名
const
[
webCurrent
,
setWebCurrent
]
=
useState
(
0
);
// web列表下标
const
[
handCurrent
,
setHandCurrent
]
=
useState
(
0
);
// hand列表下标
const
[
webData
,
setWebData
]
=
useState
([]);
// web数据
const
[
handData
,
setHandData
]
=
useState
([]);
//手持数据
const
[
visible
,
setVisible
]
=
useState
(
false
);
// 弹窗
const
[
flag
,
setFlag
]
=
useState
(
0
);
// 更新list
const
[
handStatus
,
setHandStatus
]
=
useState
([]);
// 更新状态
const
[
webStatus
,
setWebStatus
]
=
useState
([]);
// 更新状态
const
[
type
,
setType
]
=
useState
(
''
);
// 弹窗类型
const
[
checkLoading
,
setCheckLoading
]
=
useState
(
false
)
const
[
formObj
,
setFormObj
]
=
useState
({
user
:
'admin'
,
password
:
'geoserver'
});
const
columns
=
[
{
title
:
'默认方案'
,
align
:
'center'
,
render
:
(
text
,
record
,
index
)
=>
(
<
Space
>
<
Checkbox
checked=
{
webStatus
[
index
+
webCurrent
*
5
]
}
onChange=
{
e
=>
{
onChangeCheck
(
e
,
record
,
index
+
webCurrent
*
5
);
}
}
/>
</
Space
>
),
},
{
title
:
'方案名'
,
align
:
'center'
,
render
:
(
text
,
record
,
index
)
=>
(
<
Space
>
{
record
.
scheme
.
schemename
}
</
Space
>
),
},
{
title
:
'关联角色'
,
align
:
'center'
,
render
:
(
text
,
record
,
index
)
=>
(
<
Space
>
<
Space
>
<
div
onClick=
{
()
=>
pickRole
(
record
)
}
style=
{
{
cursor
:
'pointer'
}
}
>
<
VisibleRoleModal
onSubmit=
{
onPushSubmit
}
title=
{
"关联角色"
}
initValues
={
record
.
roles
!=
null
?
record
.
roles
.
split
(","):[]}
operate=
{
<
UserAddOutlined
/>
}
/>
</
div
>
</
Space
>
</
Space
>
),
},
{
title
:
'编辑'
,
align
:
'center'
,
render
:
(
text
,
record
,
index
)
=>
(
<
Space
>
<
div
onClick=
{
e
=>
e
.
stopPropagation
()
}
>
<
Popconfirm
title=
"是否删除此条方案?"
okText=
"确认"
cancelText=
"取消"
onConfirm=
{
()
=>
{
delWebConfirm
(
record
);
}
}
>
<
Button
size=
"small"
danger
>
删除
</
Button
>
</
Popconfirm
>
</
div
>
</
Space
>
),
}
];
// const columns1 = [
// {
// title: '查询方案',
// align: 'center',
// render: (text, record, index) => (
// <Space>
// <Checkbox
// checked={handStatus[index + handCurrent * 5]}
// onChange={e => {
// onChangeHand(e, record, index + handCurrent * 5);
// }}
// />
// </Space>
// ),
// },
// {
// title: '方案名',
// align: 'center',
// render: (text, record, index) => (
// <Space>
// {record.scheme.schemename}
// </Space>
// ),
// },
// {
// title: '关联角色',
// align: 'center',
// render: (text, record, index) => (
// <Space>
// <div onClick={() => pickRole(record)} style={{ cursor: 'pointer' }}>
// <VisibleRoleModal onSubmit={onPushSubmit} title={"关联角色"} initValues ={record.roles!=null?record.roles.split(","):[]} operate={<UserAddOutlined />} />
// </div>
// </Space>
// ),
// },
// {
// title: '编辑',
// align: 'center',
// render: (text, record, index) => (
// <Space>
// <div onClick={e => e.stopPropagation()}>
// <Popconfirm
// title="是否删除此条方案?"
// okText="确认"
// cancelText="取消"
// onConfirm={() => {
// delhandConfirm(record);
// }}
// >
// <Button size="small" danger>
// 删除
// </Button>
// </Popconfirm>
// </div>
// </Space>
// ),
// }
// ];
//获取选中的角色
const
onPushSubmit
=
(
value
)
=>
{
let
id
=
[]
if
(
value
.
length
)
{
id
=
value
.
map
(
item
=>
{
return
item
.
id
})
let
query
=
{
schemaname
:
record
.
scheme
.
schemename
,
roles
:
id
.
join
(
','
)
}
SettingRoleWebSchema
(
query
).
then
(
res
=>
{
if
(
res
.
msg
===
""
)
{
prompt
(
'success'
,
'关联角色成功'
)
setFlag
(
flag
+
1
)
}
else
{
prompt
(
'fail'
,
'关联角色失败'
)
}
}).
catch
(
err
=>
{
prompt
(
'fail'
,
'网络请求失败'
)
})
}
const
[
treeLoading
,
setTreeLoading
]
=
useState
(
false
);
// 弹窗显示
const
[
schemename
,
setSchemename
]
=
useState
([]);
const
[
record
,
setRecord
]
=
useState
({});
//选中关联角色的方案名
const
[
webCurrent
,
setWebCurrent
]
=
useState
(
0
);
// web列表下标
const
[
handCurrent
,
setHandCurrent
]
=
useState
(
0
);
// hand列表下标
const
[
webData
,
setWebData
]
=
useState
([]);
// web数据
const
[
handData
,
setHandData
]
=
useState
([]);
//手持数据
const
[
visible
,
setVisible
]
=
useState
(
false
);
// 弹窗
const
[
flag
,
setFlag
]
=
useState
(
0
);
// 更新list
const
[
handStatus
,
setHandStatus
]
=
useState
([]);
// 更新状态
const
[
webStatus
,
setWebStatus
]
=
useState
([]);
// 更新状态
const
[
type
,
setType
]
=
useState
(
''
);
// 弹窗类型
const
[
checkLoading
,
setCheckLoading
]
=
useState
(
false
);
const
[
formObj
,
setFormObj
]
=
useState
({
user
:
'admin'
,
password
:
'geoserver'
});
const
columns
=
[
{
title
:
'默认方案'
,
align
:
'center'
,
render
:
(
text
,
record
,
index
)
=>
(
<
Space
>
<
Checkbox
checked=
{
webStatus
[
index
+
webCurrent
*
5
]
}
onChange=
{
e
=>
{
onChangeCheck
(
e
,
record
,
index
+
webCurrent
*
5
);
}
}
/>
</
Space
>
),
},
{
title
:
'方案名'
,
align
:
'center'
,
render
:
(
text
,
record
,
index
)
=>
<
Space
>
{
record
.
scheme
.
schemename
}
</
Space
>,
},
{
title
:
'关联角色'
,
align
:
'center'
,
render
:
(
text
,
record
,
index
)
=>
(
<
Space
>
<
Space
>
<
div
onClick=
{
()
=>
pickRole
(
record
)
}
style=
{
{
cursor
:
'pointer'
}
}
>
<
VisibleRoleModal
onSubmit=
{
onPushSubmit
}
title=
{
'关联角色'
}
initValues=
{
record
.
roles
!=
null
?
record
.
roles
.
split
(
','
)
:
[]
}
operate=
{
<
UserAddOutlined
/>
}
/>
</
div
>
</
Space
>
</
Space
>
),
},
{
title
:
'编辑'
,
align
:
'center'
,
render
:
(
text
,
record
,
index
)
=>
(
<
Space
>
<
div
onClick=
{
e
=>
e
.
stopPropagation
()
}
>
<
Popconfirm
title=
"是否删除此条方案?"
okText=
"确认"
cancelText=
"取消"
onConfirm=
{
()
=>
{
delWebConfirm
(
record
);
}
}
>
<
Button
size=
"small"
danger
>
删除
</
Button
>
</
Popconfirm
>
</
div
>
</
Space
>
),
},
];
// const columns1 = [
// {
// title: '查询方案',
// align: 'center',
// render: (text, record, index) => (
// <Space>
// <Checkbox
// checked={handStatus[index + handCurrent * 5]}
// onChange={e => {
// onChangeHand(e, record, index + handCurrent * 5);
// }}
// />
// </Space>
// ),
// },
// {
// title: '方案名',
// align: 'center',
// render: (text, record, index) => (
// <Space>
// {record.scheme.schemename}
// </Space>
// ),
// },
// {
// title: '关联角色',
// align: 'center',
// render: (text, record, index) => (
// <Space>
// <div onClick={() => pickRole(record)} style={{ cursor: 'pointer' }}>
// <VisibleRoleModal onSubmit={onPushSubmit} title={"关联角色"} initValues ={record.roles!=null?record.roles.split(","):[]} operate={<UserAddOutlined />} />
// </div>
// </Space>
// ),
// },
// {
// title: '编辑',
// align: 'center',
// render: (text, record, index) => (
// <Space>
// <div onClick={e => e.stopPropagation()}>
// <Popconfirm
// title="是否删除此条方案?"
// okText="确认"
// cancelText="取消"
// onConfirm={() => {
// delhandConfirm(record);
// }}
// >
// <Button size="small" danger>
// 删除
// </Button>
// </Popconfirm>
// </div>
// </Space>
// ),
// }
}
//获取角色
const
pickRole
=
(
record
)
=>
{
setRecord
(
record
)
}
//设置web方案
const
onChangeCheck
=
(
e
,
record
,
index
)
=>
{
setCheckLoading
(
true
)
IsActionWebSchema
({
schemaname
:
record
.
scheme
.
schemename
}).
then
(
res
=>
{
setCheckLoading
(
false
)
if
(
res
.
msg
===
''
){
prompt
(
'success'
,
'设置成功'
)
setFlag
(
flag
+
1
)
}
else
{
prompt
(
'fail'
,
res
.
msg
)
}
// ];
//获取选中的角色
const
onPushSubmit
=
value
=>
{
let
id
=
[];
if
(
value
.
length
)
{
id
=
value
.
map
(
item
=>
{
return
item
.
id
;
});
let
query
=
{
schemaname
:
record
.
scheme
.
schemename
,
roles
:
id
.
join
(
','
),
};
SettingRoleWebSchema
(
query
)
.
then
(
res
=>
{
if
(
res
.
msg
===
''
)
{
prompt
(
'success'
,
'关联角色成功'
);
setFlag
(
flag
+
1
);
}
else
{
prompt
(
'fail'
,
'关联角色失败'
);
}
})
.
catch
(
err
=>
{
prompt
(
'fail'
,
'网络请求失败'
);
});
}
};
//获取角色
const
pickRole
=
record
=>
{
setRecord
(
record
);
};
//设置web方案
const
onChangeCheck
=
(
e
,
record
,
index
)
=>
{
setCheckLoading
(
true
);
IsActionWebSchema
({
schemaname
:
record
.
scheme
.
schemename
}).
then
(
res
=>
{
setCheckLoading
(
false
);
if
(
res
.
msg
===
''
)
{
prompt
(
'success'
,
'设置成功'
);
setFlag
(
flag
+
1
);
}
else
{
prompt
(
'fail'
,
res
.
msg
);
}
});
};
//选择手持方案
const
onChangeHand
=
(
e
,
record
,
index
)
=>
{
setCheckLoading
(
true
)
const
newLoadings
=
[...
handStatus
];
newLoadings
.
map
((
item
,
loadIndex
)
=>
{
return
loadIndex
==
index
?
newLoadings
[
loadIndex
]
=
!
newLoadings
[
loadIndex
]
:
newLoadings
[
loadIndex
]
=
false
})
setHandStatus
(
newLoadings
)
let
query
=
{
schemename
:
record
[
'schemename'
],
terminalType
:
'phone'
,
isBaseMap
:
false
,
jsonCfg
:
JSON
.
stringify
({
isDefault
:
newLoadings
[
index
],
})
}
if
(
!
newLoadings
[
index
])
{
SetServiceConfig
(
query
).
then
(
res
=>
{
setCheckLoading
(
false
)
if
(
res
.
msg
===
"Ok"
)
{
const
changehandData
=
[...
handData
];
changehandData
[
index
].
isDefault
=
false
setHandData
(
changehandData
)
prompt
(
'success'
,
'设置成功'
)
}
else
{
prompt
(
'fail'
,
`
${
record
[
'schemename'
]}
默认设置时遇到错误:`
+
res
.
message
)
}
})
return
//选择手持方案
const
onChangeHand
=
(
e
,
record
,
index
)
=>
{
setCheckLoading
(
true
);
const
newLoadings
=
[...
handStatus
];
newLoadings
.
map
((
item
,
loadIndex
)
=>
{
return
loadIndex
==
index
?
(
newLoadings
[
loadIndex
]
=
!
newLoadings
[
loadIndex
])
:
(
newLoadings
[
loadIndex
]
=
false
);
});
setHandStatus
(
newLoadings
);
let
query
=
{
schemename
:
record
[
'schemename'
],
terminalType
:
'phone'
,
isBaseMap
:
false
,
jsonCfg
:
JSON
.
stringify
({
isDefault
:
newLoadings
[
index
],
}),
};
if
(
!
newLoadings
[
index
])
{
SetServiceConfig
(
query
).
then
(
res
=>
{
setCheckLoading
(
false
);
if
(
res
.
msg
===
'Ok'
)
{
const
changehandData
=
[...
handData
];
changehandData
[
index
].
isDefault
=
false
;
setHandData
(
changehandData
);
prompt
(
'success'
,
'设置成功'
);
}
else
{
prompt
(
'fail'
,
`
${
record
[
'schemename'
]}
默认设置时遇到错误:`
+
res
.
message
);
}
var
beforeDefault
=
handData
.
findIndex
((
item
)
=>
item
[
'isDefault'
]);
SetServiceConfig
({
schemename
:
record
[
'schemename'
],
});
return
;
}
var
beforeDefault
=
handData
.
findIndex
(
item
=>
item
[
'isDefault'
]);
SetServiceConfig
({
schemename
:
record
[
'schemename'
],
terminalType
:
'phone'
,
isBaseMap
:
false
,
jsonCfg
:
JSON
.
stringify
({
isDefault
:
true
,
}),
}).
then
(
res
=>
{
setCheckLoading
(
false
);
if
(
res
.
msg
===
'Ok'
)
{
const
changehandData
=
[...
handData
];
changehandData
[
index
].
isDefault
=
true
;
setHandData
(
changehandData
);
if
(
beforeDefault
!=
-
1
)
{
SetServiceConfig
({
schemename
:
changehandData
[
beforeDefault
].
schemename
,
terminalType
:
'phone'
,
isBaseMap
:
false
,
jsonCfg
:
JSON
.
stringify
({
isDefault
:
true
,
})
}).
then
(
res
=>
{
setCheckLoading
(
false
)
if
(
res
.
msg
===
"Ok"
)
{
const
changehandData
=
[...
handData
];
changehandData
[
index
].
isDefault
=
true
setHandData
(
changehandData
)
if
(
beforeDefault
!=
-
1
)
{
SetServiceConfig
({
schemename
:
changehandData
[
beforeDefault
].
schemename
,
terminalType
:
'phone'
,
isBaseMap
:
false
,
jsonCfg
:
JSON
.
stringify
({
isDefault
:
false
,
})
}).
then
(
res
=>
{
setCheckLoading
(
false
)
if
(
res
.
IsSuccess
)
{
const
changehandData1
=
[...
handData
];
changehandData1
[
beforeDefault
].
isDefault
=
false
setHandData
(
changehandData1
)
prompt
(
'success'
,
'设置成功'
)
return
;
}
prompt
(
'fail'
,
`
${
record
[
'schemename'
]}
默认设置时遇到错误:`
+
res
.
message
)
})
}
isDefault
:
false
,
}),
}).
then
(
res
=>
{
setCheckLoading
(
false
);
if
(
res
.
IsSuccess
)
{
const
changehandData1
=
[...
handData
];
changehandData1
[
beforeDefault
].
isDefault
=
false
;
setHandData
(
changehandData1
);
prompt
(
'success'
,
'设置成功'
);
return
;
}
})
}
const
prompt
=
(
type
,
content
)
=>
{
if
(
type
==
'success'
)
{
notification
.
success
({
message
:
'提示'
,
duration
:
3
,
description
:
content
,
});
}
else
{
notification
.
error
({
message
:
'提示'
,
duration
:
3
,
description
:
content
,
});
prompt
(
'fail'
,
`
${
record
[
'schemename'
]}
默认设置时遇到错误:`
+
res
.
message
);
});
}
}
});
};
const
prompt
=
(
type
,
content
)
=>
{
if
(
type
==
'success'
)
{
notification
.
success
({
message
:
'提示'
,
duration
:
3
,
description
:
content
,
});
}
else
{
notification
.
error
({
message
:
'提示'
,
duration
:
3
,
description
:
content
,
});
}
const
onSubmit
=
prop
=>
{
setVisible
(
false
);
setFlag
(
flag
+
1
)
};
//删除web配置方案
const
delWebConfirm
=
(
record
)
=>
{
DeleteWebSchema
(
record
.
scheme
.
schemename
).
then
(
res
=>
{
if
(
res
.
msg
===
""
)
{
prompt
(
'success'
,
'删除成功'
)
setFlag
(
flag
+
1
)
};
const
onSubmit
=
prop
=>
{
setVisible
(
false
);
setFlag
(
flag
+
1
);
};
//删除web配置方案
const
delWebConfirm
=
record
=>
{
DeleteWebSchema
(
record
.
scheme
.
schemename
).
then
(
res
=>
{
if
(
res
.
msg
===
''
)
{
prompt
(
'success'
,
'删除成功'
);
setFlag
(
flag
+
1
);
}
else
{
prompt
(
'fail'
,
'删除失败'
);
}
});
};
//删除手持配置方案
const
delhandConfirm
=
record
=>
{
deleteConfig
({
schemename
:
record
[
'schemename'
],
terminalType
:
'phone'
,
isBaseMap
:
false
,
}).
then
(
res
=>
{
if
(
res
.
msg
===
'Ok'
)
{
prompt
(
'success'
,
'删除成功'
);
setFlag
(
flag
+
1
);
}
else
{
prompt
(
'fail'
,
'删除失败'
);
}
});
};
//添加方案
const
addType
=
type
=>
{
setType
(
type
);
let
listData
=
[];
type
==
'add'
?
(
listData
=
webData
)
:
(
listData
=
handData
);
let
webSchemenameArr
=
[],
schemeArr
=
[];
setTreeLoading
(
true
);
GetSchemaInfoList
().
then
(
res
=>
{
if
(
res
.
data
&&
res
.
data
.
length
)
{
setTreeLoading
(
false
);
listData
.
map
(
item
=>
{
webSchemenameArr
.
push
(
item
.
scheme
.
schemename
);
});
res
.
data
.
map
(
item
=>
{
if
(
!
webSchemenameArr
.
includes
(
item
.
schemename
))
schemeArr
.
push
(
item
.
schemename
);
});
setSchemename
(
schemeArr
);
if
(
schemeArr
.
length
)
{
setVisible
(
true
);
}
else
{
notification
.
warning
({
message
:
'提示'
,
duration
:
3
,
description
:
'请先配置方案'
,
});
}
}
else
{
setTreeLoading
(
false
);
notification
.
warning
({
message
:
'提示'
,
duration
:
3
,
description
:
'请先配置方案'
,
});
}
});
};
useEffect
(()
=>
{
renderTile
();
},
[
flag
]);
// 获取瓦片数据配置数据
const
renderTile
=
()
=>
{
setCheckLoading
(
true
);
//查询手持方案
// var schemeConfigQueryRequest = GetMaplayerByTerminalType({
// terminalType: 'phone',
// isBaseMap: false
// })
//查询web方案
var
webSchemeQueryRequest
=
GetWebSchemaList
();
Promise
.
all
([
webSchemeQueryRequest
])
.
then
(
res
=>
{
// if (res[0].msg==="Ok" && res[0].data.phone) {
// let arr = []
// res[0].data.phone.optionalLayer.layers.map((item, index) => {
// if (item.isDefault) {
// arr.push(true)
// } else {
// arr.push(false)
// }
}
else
{
prompt
(
'fail'
,
'删除失败'
)
};
})
}
//删除手持配置方案
const
delhandConfirm
=
(
record
)
=>
{
deleteConfig
({
schemename
:
record
[
'schemename'
],
terminalType
:
'phone'
,
isBaseMap
:
false
}).
then
(
res
=>
{
if
(
res
.
msg
===
"Ok"
)
{
prompt
(
'success'
,
'删除成功'
)
setFlag
(
flag
+
1
)
// item.isStatus = 'phone'
// return item
// })
// setHandData(res[0].data.phone.optionalLayer.layers)
// setHandStatus(arr)
// }
if
(
res
[
0
].
msg
===
'Ok'
&&
res
[
0
].
data
)
{
let
arr
=
[];
res
[
0
].
data
.
map
((
item
,
index
)
=>
{
if
(
item
.
isDefault
)
{
arr
.
push
(
true
);
}
else
{
prompt
(
'fail'
,
'删除失败'
)
};
})
}
//添加方案
const
addType
=
(
type
)
=>
{
setType
(
type
);
let
listData
=
[]
type
==
'add'
?
listData
=
webData
:
listData
=
handData
let
webSchemenameArr
=
[],
schemeArr
=
[]
setTreeLoading
(
true
);
GetSchemaInfoList
().
then
(
res
=>
{
if
(
res
.
data
&&
res
.
data
.
length
)
{
setTreeLoading
(
false
);
listData
.
map
(
item
=>
{
webSchemenameArr
.
push
(
item
.
scheme
.
schemename
)
})
res
.
data
.
map
(
item
=>
{
if
(
!
webSchemenameArr
.
includes
(
item
.
schemename
))
schemeArr
.
push
(
item
.
schemename
)
})
setSchemename
(
schemeArr
)
if
(
schemeArr
.
length
)
{
setVisible
(
true
);
}
else
{
notification
.
warning
({
message
:
'提示'
,
duration
:
3
,
description
:
'请先配置方案'
,
});
}
}
else
{
setTreeLoading
(
false
);
notification
.
warning
({
message
:
'提示'
,
duration
:
3
,
description
:
'请先配置方案'
,
});
}
}
)
}
useEffect
(()
=>
{
renderTile
();
},
[
flag
]);
// 获取瓦片数据配置数据
const
renderTile
=
()
=>
{
setCheckLoading
(
true
)
//查询手持方案
// var schemeConfigQueryRequest = GetMaplayerByTerminalType({
// terminalType: 'phone',
// isBaseMap: false
// })
//查询web方案
var
webSchemeQueryRequest
=
GetWebSchemaList
()
Promise
.
all
([
webSchemeQueryRequest
]).
then
(
res
=>
{
// if (res[0].msg==="Ok" && res[0].data.phone) {
// let arr = []
// res[0].data.phone.optionalLayer.layers.map((item, index) => {
// if (item.isDefault) {
// arr.push(true)
// } else {
// arr.push(false)
// }
// item.isStatus = 'phone'
// return item
// })
// setHandData(res[0].data.phone.optionalLayer.layers)
// setHandStatus(arr)
// }
if
(
res
[
0
].
msg
===
"Ok"
&&
res
[
0
].
data
)
{
let
arr
=
[]
res
[
0
].
data
.
map
((
item
,
index
)
=>
{
if
(
item
.
isDefault
)
{
arr
.
push
(
true
)
}
else
{
arr
.
push
(
false
)
}
item
.
isStatus
=
'web'
return
item
})
setWebData
(
res
[
0
].
data
)
setWebStatus
(
arr
)
arr
.
push
(
false
);
}
setCheckLoading
(
false
)
}).
catch
(
e
=>
{
setCheckLoading
(
false
)
})
};
return
(
<>
<
Spin
tip=
"loading..."
spinning=
{
checkLoading
}
>
<
div
className=
{
styles
.
solutionConfig
}
>
<
div
>
<
Divider
orientation=
"left"
><
div
className=
{
styles
.
divider
}
>
Web
<
PlusOutlined
onClick=
{
()
=>
{
addType
(
'add'
)
}
}
className=
{
styles
.
dividerIcon
}
/></
div
></
Divider
>
<
Table
columns=
{
columns
}
dataSource=
{
webData
}
bordered
pagination=
{
{
showTotal
:
(
total
,
range
)
=>
`第${range[0]}-${range[1]} 条/共 ${total} 条`
,
defaultPageSize
:
8
,
onChange
:
(
value
)
=>
{
setWebCurrent
(
value
-
1
)
}
item
.
isStatus
=
'web'
;
return
item
;
});
setWebData
(
res
[
0
].
data
);
setWebStatus
(
arr
);
}
setCheckLoading
(
false
);
})
.
catch
(
e
=>
{
setCheckLoading
(
false
);
});
};
}
}
rowKey=
{
(
record
,
index
)
=>
record
.
scheme
.
schemename
}
scroll=
{
{
y
:
400
}
}
>
</
Table
>
</
div
>
{
/* <Divider orientation="left"><div className={styles.divider}>手持 <PlusOutlined
return
(
<>
<
Spin
tip=
"loading..."
spinning=
{
checkLoading
}
>
<
div
className=
{
styles
.
solutionConfig
}
>
<
div
>
<
Divider
orientation=
"left"
>
<
div
className=
{
styles
.
divider
}
>
{
' '
}
Web
{
' '
}
<
PlusOutlined
onClick=
{
()
=>
{
addType
(
'add'
);
}
}
className=
{
styles
.
dividerIcon
}
/>
</
div
>
</
Divider
>
<
Table
columns=
{
columns
}
dataSource=
{
webData
}
bordered
pagination=
{
{
showTotal
:
(
total
,
range
)
=>
`第${range[0]}-${range[1]} 条/共 ${total} 条`
,
defaultPageSize
:
8
,
onChange
:
value
=>
{
setWebCurrent
(
value
-
1
);
},
}
}
rowKey=
{
(
record
,
index
)
=>
record
.
scheme
.
schemename
}
scroll=
{
{
y
:
600
}
}
/>
</
div
>
{
/* <Divider orientation="left"><div className={styles.divider}>手持 <PlusOutlined
onClick={() => { addType('addHand') }}
className={styles.dividerIcon} /></div> </Divider>
<Table
...
...
@@ -450,17 +447,17 @@ const VectorData = props => {
}}
>
</Table> */
}
</
div
>
</
Spin
>
<
AddModal
visible=
{
visible
}
onCancel=
{
()
=>
setVisible
(
false
)
}
callBackSubmit=
{
onSubmit
}
type=
{
type
}
formObj=
{
formObj
}
listData=
{
schemename
}
/>
</>
)
}
export
default
VectorData
\ No newline at end of file
</
div
>
</
Spin
>
<
AddModal
visible=
{
visible
}
onCancel=
{
()
=>
setVisible
(
false
)
}
callBackSubmit=
{
onSubmit
}
type=
{
type
}
formObj=
{
formObj
}
listData=
{
schemename
}
/>
</>
);
};
export
default
VectorData
;
src/pages/platformCenter/gis/schemeConfig/TileConfig/TileConfig.jsx
View file @
d01f930e
import
{
Space
,
Table
,
Button
,
Popconfirm
,
notification
,
Spin
}
from
'antd'
;
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
styles
from
'../SchemeConfig.less'
import
{
GettMaplayer
,
deleteConfig
}
from
'@/services/webConfig/api'
;
import
AddModal
from
'./AddModal'
import
styles
from
'../SchemeConfig.less'
;
import
{
GettMaplayer
,
deleteConfig
}
from
'@/services/webConfig/api'
;
import
AddModal
from
'./AddModal'
;
const
TileData
=
props
=>
{
const
[
treeLoading
,
setTreeLoading
]
=
useState
(
false
);
// 弹窗显示
const
[
tileData
,
setTileData
]
=
useState
([]);
// table表格数据
const
[
visible
,
setVisible
]
=
useState
(
false
);
// 弹窗
const
[
type
,
setType
]
=
useState
(
''
);
// 弹窗类型
const
[
formObj
,
setFormObj
]
=
useState
({});
const
[
flag
,
setFlag
]
=
useState
(
0
);
// 弹窗类型
const
[
baseMap
,
setBaseMap
]
=
useState
([]);
//底图数据
const
columns
=
[
{
title
:
'服务名'
,
dataIndex
:
'servicename'
,
key
:
'servicename'
,
align
:
'center'
},
{
title
:
'标签'
,
dataIndex
:
'label'
,
key
:
'label'
,
align
:
'center'
},
{
title
:
'类型'
,
dataIndex
:
'type'
,
key
:
'type'
,
align
:
'center'
},
{
title
:
'透明度'
,
dataIndex
:
'alpha'
,
key
:
'alpha'
,
align
:
'center'
},
{
title
:
'编辑'
,
align
:
'center'
,
render
:
(
text
,
record
)
=>
(
<
Space
>
<
Button
type=
"primary"
size=
"small"
onClick=
{
()
=>
{
changebaseMap
(
record
);
}
}
>
编辑
</
Button
>
<
div
onClick=
{
e
=>
e
.
stopPropagation
()
}
>
<
Popconfirm
title=
"是否删除该底图?"
okText=
"确认"
cancelText=
"取消"
onConfirm=
{
()
=>
{
delConfirm
(
record
);
}
}
>
<
Button
size=
"small"
danger
>
删除
</
Button
>
</
Popconfirm
>
</
div
>
</
Space
>
),
},
const
[
treeLoading
,
setTreeLoading
]
=
useState
(
false
);
// 弹窗显示
const
[
tileData
,
setTileData
]
=
useState
([]);
// table表格数据
const
[
visible
,
setVisible
]
=
useState
(
false
);
// 弹窗
const
[
type
,
setType
]
=
useState
(
''
);
// 弹窗类型
const
[
formObj
,
setFormObj
]
=
useState
({});
const
[
flag
,
setFlag
]
=
useState
(
0
);
// 弹窗类型
const
[
baseMap
,
setBaseMap
]
=
useState
([]);
//底图数据
const
columns
=
[
{
title
:
'服务名'
,
dataIndex
:
'servicename'
,
key
:
'servicename'
,
align
:
'center'
,
},
{
title
:
'标签'
,
dataIndex
:
'label'
,
key
:
'label'
,
align
:
'center'
,
},
{
title
:
'类型'
,
dataIndex
:
'type'
,
key
:
'type'
,
align
:
'center'
,
},
{
title
:
'透明度'
,
dataIndex
:
'alpha'
,
key
:
'alpha'
,
align
:
'center'
,
},
{
title
:
'编辑'
,
align
:
'center'
,
render
:
(
text
,
record
)
=>
(
<
Space
>
<
Button
type=
"primary"
size=
"small"
onClick=
{
()
=>
{
changebaseMap
(
record
);
}
}
>
编辑
</
Button
>
<
div
onClick=
{
e
=>
e
.
stopPropagation
()
}
>
<
Popconfirm
title=
"是否删除该底图?"
okText=
"确认"
cancelText=
"取消"
onConfirm=
{
()
=>
{
delConfirm
(
record
);
}
}
>
<
Button
size=
"small"
danger
>
删除
</
Button
>
</
Popconfirm
>
</
div
>
</
Space
>
),
},
];
const
changebaseMap
=
record
=>
{
setType
(
'edit'
);
setFormObj
(
record
);
setVisible
(
true
);
};
const
onSubmit
=
prop
=>
{
setVisible
(
false
);
setFlag
(
flag
+
1
);
};
];
const
changebaseMap
=
(
record
)
=>
{
setType
(
'edit'
);
setFormObj
(
record
);
setVisible
(
true
);
}
const
onSubmit
=
prop
=>
{
setVisible
(
false
);
setFlag
(
flag
+
1
)
};
const
delConfirm
=
(
record
)
=>
{
const
{
servicename
=
''
}
=
record
;
setTreeLoading
(
true
);
deleteConfig
({
servicename
:
servicename
,
terminalType
:
'base'
,
isBaseMap
:
true
}).
then
(
res
=>
{
setFlag
(
flag
+
1
)
setTreeLoading
(
false
);
if
(
res
.
msg
===
'Ok'
)
{
// form.resetFields();
// callBackSubmit();
notification
.
success
({
message
:
'提示'
,
duration
:
3
,
description
:
res
.
message
||
'删除成功'
,
});
}
else
{
notification
.
error
({
message
:
'提示'
,
duration
:
3
,
description
:
res
.
message
||
'删除失败'
,
});
}
}).
catch
(
err
=>
{
setFlag
(
flag
+
1
)
setTreeLoading
(
false
);
})
}
const
handleAdd
=
()
=>
{
if
(
baseMap
.
length
)
{
setType
(
'add'
);
setVisible
(
true
);
const
delConfirm
=
record
=>
{
const
{
servicename
=
''
}
=
record
;
setTreeLoading
(
true
);
deleteConfig
({
servicename
:
servicename
,
terminalType
:
'base'
,
isBaseMap
:
true
,
})
.
then
(
res
=>
{
setFlag
(
flag
+
1
);
setTreeLoading
(
false
);
if
(
res
.
msg
===
'Ok'
)
{
// form.resetFields();
// callBackSubmit();
notification
.
success
({
message
:
'提示'
,
duration
:
3
,
description
:
res
.
message
||
'删除成功'
,
});
}
else
{
notification
.
error
({
message
:
'提示'
,
duration
:
3
,
description
:
res
.
message
||
'删除失败'
,
});
}
else
{
notification
.
warning
({
message
:
'提示'
,
duration
:
3
,
description
:
'地图类型已都存在,可编辑修改'
,
});
}
})
.
catch
(
err
=>
{
setFlag
(
flag
+
1
);
setTreeLoading
(
false
);
});
};
const
handleAdd
=
()
=>
{
if
(
baseMap
.
length
)
{
setType
(
'add'
);
setVisible
(
true
);
}
else
{
notification
.
warning
({
message
:
'提示'
,
duration
:
3
,
description
:
'地图类型已都存在,可编辑修改'
,
});
}
useEffect
(()
=>
{
renderTile
();
},
[
flag
]);
// 获取瓦片数据配置数据
const
renderTile
=
()
=>
{
setTreeLoading
(
true
);
const
baseMapData
=
[
'高德地形'
,
'高德影像'
,
'天地图地形'
,
'天地图影像'
]
GettMaplayer
({
terminalType
:
'base'
,
isBaseMap
:
true
}).
then
(
res
=>
{
if
(
res
.
msg
===
"Ok"
)
{
setTreeLoading
(
false
);
setTileData
(
res
.
data
.
general
.
baseMap
.
layers
);
res
.
data
.
general
.
baseMap
.
layers
.
map
((
item
)
=>
{
let
index
=
baseMapData
.
indexOf
(
item
.
servicename
);
if
(
index
!=
-
1
)
{
baseMapData
.
splice
(
index
,
1
);
}
})
setBaseMap
(
baseMapData
)
}
else
{
setTreeLoading
(
false
);
notification
.
error
({
message
:
'获取失败'
,
description
:
res
.
message
,
});
}
}
)
};
return
(
<>
<
Spin
tip=
"loading..."
spinning=
{
treeLoading
}
>
<
div
className=
{
styles
.
tileBtn
}
>
<
Button
type=
"primary"
onClick=
{
()
=>
{
handleAdd
();
}
}
>
新增
</
Button
>
</
div
>
<
Table
columns=
{
columns
}
dataSource=
{
tileData
}
bordered
rowKey=
"type"
scroll=
{
{
y
:
400
}
}
pagination=
{
{
showTotal
:
(
total
,
range
)
=>
`第${range[0]}-${range[1]} 条/共 ${total} 条`
};
useEffect
(()
=>
{
renderTile
();
},
[
flag
]);
// 获取瓦片数据配置数据
const
renderTile
=
()
=>
{
setTreeLoading
(
true
);
const
baseMapData
=
[
'高德地形'
,
'高德影像'
,
'天地图地形'
,
'天地图影像'
];
GettMaplayer
({
terminalType
:
'base'
,
isBaseMap
:
true
,
}).
then
(
res
=>
{
if
(
res
.
msg
===
'Ok'
)
{
setTreeLoading
(
false
);
setTileData
(
res
.
data
.
general
.
baseMap
.
layers
);
res
.
data
.
general
.
baseMap
.
layers
.
map
(
item
=>
{
let
index
=
baseMapData
.
indexOf
(
item
.
servicename
);
if
(
index
!=
-
1
)
{
baseMapData
.
splice
(
index
,
1
);
}
});
setBaseMap
(
baseMapData
);
}
else
{
setTreeLoading
(
false
);
notification
.
error
({
message
:
'获取失败'
,
description
:
res
.
message
,
});
}
});
};
}
}
>
</
Table
>
<
AddModal
visible=
{
visible
}
onCancel=
{
()
=>
setVisible
(
false
)
}
callBackSubmit=
{
onSubmit
}
type=
{
type
}
formObj=
{
formObj
}
baseMap=
{
baseMap
}
/>
</
Spin
>
</>
)
}
export
default
TileData
\ No newline at end of file
return
(
<>
<
Spin
tip=
"loading..."
spinning=
{
treeLoading
}
>
<
div
className=
{
styles
.
tileBtn
}
>
<
Button
type=
"primary"
onClick=
{
()
=>
{
handleAdd
();
}
}
>
新增
</
Button
>
</
div
>
<
Table
columns=
{
columns
}
dataSource=
{
tileData
}
bordered
rowKey=
"type"
scroll=
{
{
y
:
600
}
}
pagination=
{
{
showTotal
:
(
total
,
range
)
=>
`第${range[0]}-${range[1]} 条/共 ${total} 条`
,
}
}
/>
<
AddModal
visible=
{
visible
}
onCancel=
{
()
=>
setVisible
(
false
)
}
callBackSubmit=
{
onSubmit
}
type=
{
type
}
formObj=
{
formObj
}
baseMap=
{
baseMap
}
/>
</
Spin
>
</>
);
};
export
default
TileData
;
src/pages/platformCenter/gis/schemeConfig/VectorData/VectorData.jsx
View file @
d01f930e
...
...
@@ -215,7 +215,7 @@ const VectorData = props => {
dataSource=
{
tileData
}
bordered
rowKey=
"CreateTime"
scroll=
{
{
y
:
4
00
}
}
scroll=
{
{
y
:
6
00
}
}
pagination=
{
{
showTotal
:
(
total
,
range
)
=>
`第${range[0]}-${range[1]} 条/共 ${total} 条`
,
}
}
...
...
src/pages/platformCenter/gis/schemeConfig/projectMessage/projectMessage.jsx
View file @
d01f930e
import
{
Button
,
Spin
}
from
'antd'
;
/* eslint-disable indent */
import
{
Button
,
Spin
}
from
'antd'
;
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
styles
from
'../SchemeConfig.less'
import
{
GetMaplayerByTerminalType
}
from
'@/services/webConfig/api'
;
import
AddModal
from
'./AddModal'
import
Cards
from
'./components/card'
import
styles
from
'../SchemeConfig.less'
;
import
{
GetMaplayerByTerminalType
}
from
'@/services/webConfig/api'
;
import
AddModal
from
'./AddModal'
;
import
Cards
from
'./components/card'
;
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
(
''
);
// 弹窗类型
const
[
formObj
,
setFormObj
]
=
useState
({});
const
[
treeLoading
,
setTreeLoading
]
=
useState
(
false
);
// 弹窗显示
const
[
tileData
,
setTileData
]
=
useState
([]);
// 页面初始化数据
const
[
visible
,
setVisible
]
=
useState
(
false
);
// 弹窗
const
[
flag
,
setFlag
]
=
useState
(
0
);
// 状态更新
const
[
type
,
setType
]
=
useState
(
''
);
// 弹窗类型
const
[
formObj
,
setFormObj
]
=
useState
({});
const
onSubmit
=
prop
=>
{
setVisible
(
false
);
setFlag
(
flag
+
1
)
};
const
onDeletebaseMap
=
(
value
)
=>
{
setFlag
(
flag
+
1
)
}
const
handleAdd
=
()
=>
{
setType
(
'schemeAdd'
);
setVisible
(
true
);
}
useEffect
(()
=>
{
renderTile
();
},
[
flag
]);
// 获取瓦片数据配置数据
const
renderTile
=
()
=>
{
setTreeLoading
(
true
);
GetMaplayerByTerminalType
({
terminalType
:
'scheme'
,
isBaseMap
:
false
}).
then
(
res
=>
{
console
.
log
(
'res'
,
res
);
if
(
res
.
msg
===
'Ok'
)
{
setTreeLoading
(
false
);
setTileData
(
res
.
data
.
scheme
.
optionalLayer
.
layers
);
}
else
{
setTreeLoading
(
false
);
}
}
)
};
return
(
<>
<
Spin
tip=
"loading..."
spinning=
{
treeLoading
}
>
<
div
style=
{
{
width
:
'calc(100vw - 265px)'
}
}
>
<
div
className=
{
styles
.
tileBtn
}
>
<
Button
type=
"primary"
onClick=
{
()
=>
{
handleAdd
();
}
}
>
新增
</
Button
>
</
div
>
<
div
className=
{
styles
.
cardsList
}
>
{
tileData
&&
tileData
.
length
?
tileData
.
map
((
item
,
index
)
=>
{
return
<
div
className=
{
styles
.
cardItem
}
key=
{
index
}
span=
{
5
}
offset=
{
2
}
style=
{
{
marginBottom
:
'1rem'
}
}
>
<
Cards
item=
{
item
}
deletebaseMaps=
{
onDeletebaseMap
}
></
Cards
>
</
div
>
})
:
''
}
</
div
>
<
AddModal
visible=
{
visible
}
onCancel=
{
()
=>
setVisible
(
false
)
}
callBackSubmit=
{
onSubmit
}
type=
{
type
}
formObj=
{
formObj
}
/>
</
div
>
</
Spin
>
</>
)
}
export
default
VectorData
\ No newline at end of file
const
onSubmit
=
prop
=>
{
setVisible
(
false
);
setFlag
(
flag
+
1
);
};
const
onDeletebaseMap
=
value
=>
{
setFlag
(
flag
+
1
);
};
const
handleAdd
=
()
=>
{
setType
(
'schemeAdd'
);
setVisible
(
true
);
};
useEffect
(()
=>
{
renderTile
();
},
[
flag
]);
// 获取瓦片数据配置数据
const
renderTile
=
()
=>
{
setTreeLoading
(
true
);
GetMaplayerByTerminalType
({
terminalType
:
'scheme'
,
isBaseMap
:
false
,
}).
then
(
res
=>
{
console
.
log
(
'res'
,
res
);
if
(
res
.
msg
===
'Ok'
)
{
setTreeLoading
(
false
);
setTileData
(
res
.
data
.
scheme
.
optionalLayer
.
layers
);
}
else
{
setTreeLoading
(
false
);
}
});
};
return
(
<>
<
Spin
tip=
"loading..."
spinning=
{
treeLoading
}
>
<
div
style=
{
{
height
:
'780px'
,
overflow
:
'scroll'
}
}
>
<
div
className=
{
styles
.
tileBtn
}
>
<
Button
type=
"primary"
onClick=
{
()
=>
{
handleAdd
();
}
}
>
新增
</
Button
>
</
div
>
<
div
className=
{
styles
.
cardsList
}
>
{
tileData
&&
tileData
.
length
?
tileData
.
map
((
item
,
index
)
=>
{
return
(
<
div
className=
{
styles
.
cardItem
}
key=
{
index
}
span=
{
5
}
offset=
{
2
}
style=
{
{
marginBottom
:
'1rem'
}
}
>
<
Cards
item=
{
item
}
deletebaseMaps=
{
onDeletebaseMap
}
/>
</
div
>
);
})
:
''
}
</
div
>
<
AddModal
visible=
{
visible
}
onCancel=
{
()
=>
setVisible
(
false
)
}
callBackSubmit=
{
onSubmit
}
type=
{
type
}
formObj=
{
formObj
}
/>
</
div
>
</
Spin
>
</>
);
};
export
default
VectorData
;
src/pages/platformCenter/gis/schemeConfig/solutionConfig/solutionConfig.jsx
View file @
d01f930e
import
{
Space
,
Table
,
Button
,
Popconfirm
,
notification
,
Divider
,
Checkbox
,
Spin
}
from
'antd'
;
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
styles
from
'../SchemeConfig.less'
import
VisibleRoleModal
from
'@/pages/platformCenter/messageManage/projectManage/components/RolseSelect/VisibleRoleModal'
import
styles
from
'../SchemeConfig.less'
;
import
VisibleRoleModal
from
'@/pages/platformCenter/messageManage/projectManage/components/RolseSelect/VisibleRoleModal'
;
import
{
PlusOutlined
}
from
'@ant-design/icons'
;
import
{
PlusOutlined
}
from
'@ant-design/icons'
;
import
{
deleteConfig
,
setServiceType
,
SetServiceConfig
,
GetMaplayerByTerminalType
deleteConfig
,
setServiceType
,
SetServiceConfig
,
GetMaplayerByTerminalType
,
}
from
'@/services/webConfig/api'
;
import
{
UserAddOutlined
}
from
'@ant-design/icons'
;
import
AddModal
from
'./AddModal'
import
{
UserAddOutlined
}
from
'@ant-design/icons'
;
import
AddModal
from
'./AddModal'
;
const
VectorData
=
props
=>
{
const
[
treeLoading
,
setTreeLoading
]
=
useState
(
false
);
// 弹窗显示
const
[
schemename
,
setSchemename
]
=
useState
([]);
const
[
record
,
setRecord
]
=
useState
({});
//选中关联角色的方案名
const
[
webCurrent
,
setWebCurrent
]
=
useState
(
0
);
// web列表下标
const
[
handCurrent
,
setHandCurrent
]
=
useState
(
0
);
// hand列表下标
const
[
webData
,
setWebData
]
=
useState
([]);
// web数据
const
[
handData
,
setHandData
]
=
useState
([]);
//手持数据
const
[
visible
,
setVisible
]
=
useState
(
false
);
// 弹窗
const
[
flag
,
setFlag
]
=
useState
(
0
);
// 更新list
const
[
handStatus
,
setHandStatus
]
=
useState
([]);
// 更新状态
const
[
webStatus
,
setWebStatus
]
=
useState
([]);
// 更新状态
const
[
type
,
setType
]
=
useState
(
''
);
// 弹窗类型
const
[
checkLoading
,
setCheckLoading
]
=
useState
(
false
)
const
[
formObj
,
setFormObj
]
=
useState
({
user
:
'admin'
,
password
:
'geoserver'
});
const
columns
=
[
{
title
:
'默认方案'
,
align
:
'center'
,
key
:
'url'
,
render
:
(
text
,
record
,
index
)
=>
(
<
Space
>
<
Checkbox
checked=
{
webStatus
[
index
+
webCurrent
*
5
]
}
onChange=
{
e
=>
{
onChangeCheck
(
e
,
record
,
index
+
webCurrent
*
5
);
}
}
/>
</
Space
>
),
},
{
title
:
'方案名'
,
dataIndex
:
'schemename'
,
key
:
'schemename'
,
align
:
'center'
},
{
title
:
'关联角色'
,
align
:
'center'
,
key
:
'type'
,
render
:
(
text
,
record
,
index
)
=>
(
<
Space
>
<
Space
>
<
div
onClick=
{
()
=>
pickRole
(
record
)
}
style=
{
{
cursor
:
'pointer'
}
}
>
<
VisibleRoleModal
onSubmit=
{
onPushSubmit
}
title=
{
"关联角色"
}
initValues=
{
record
.
roles
!=
null
?
record
.
roles
.
split
(
","
)
:
[]
}
operate=
{
<
UserAddOutlined
/>
}
/>
</
div
>
</
Space
>
</
Space
>
),
},
{
title
:
'编辑'
,
align
:
'center'
,
key
:
'schemename'
,
render
:
(
text
,
record
,
index
)
=>
(
<
Space
>
<
div
onClick=
{
e
=>
e
.
stopPropagation
()
}
>
<
Popconfirm
title=
"是否删除此条方案?"
okText=
"确认"
cancelText=
"取消"
onConfirm=
{
()
=>
{
delWebConfirm
(
record
);
}
}
>
<
Button
size=
"small"
danger
>
删除
</
Button
>
</
Popconfirm
>
</
div
>
</
Space
>
),
}
];
const
columns1
=
[
{
title
:
'查询方案'
,
align
:
'center'
,
key
:
'url'
,
render
:
(
text
,
record
,
index
)
=>
(
<
Space
>
<
Checkbox
checked=
{
handStatus
[
index
+
handCurrent
*
5
]
}
onChange=
{
e
=>
{
onChangeHand
(
e
,
record
,
index
+
handCurrent
*
5
);
}
}
/>
</
Space
>
),
},
{
title
:
'方案名'
,
dataIndex
:
'schemename'
,
key
:
'schemename'
,
align
:
'center'
},
{
title
:
'关联角色'
,
align
:
'center'
,
key
:
'type'
,
render
:
(
text
,
record
,
index
)
=>
(
<
Space
>
<
div
onClick=
{
()
=>
pickRole
(
record
)
}
style=
{
{
cursor
:
'pointer'
}
}
>
<
VisibleRoleModal
onSubmit=
{
onPushSubmit
}
selectValue=
{
[]
}
title=
{
"关联角色"
}
initValues=
{
record
.
roles
!=
null
?
record
.
roles
.
split
(
","
)
:
[]
}
operate=
{
<
UserAddOutlined
/>
}
/>
</
div
>
</
Space
>
),
},
{
title
:
'编辑'
,
align
:
'center'
,
key
:
'schemename'
,
render
:
(
text
,
record
,
index
)
=>
(
<
Space
>
<
div
onClick=
{
e
=>
e
.
stopPropagation
()
}
>
<
Popconfirm
title=
"是否删除此条方案?"
okText=
"确认"
cancelText=
"取消"
onConfirm=
{
()
=>
{
delhandConfirm
(
record
);
}
}
>
<
Button
size=
"small"
danger
>
删除
</
Button
>
</
Popconfirm
>
</
div
>
</
Space
>
),
}
];
//获取选中的角色
const
onPushSubmit
=
(
value
)
=>
{
let
id
=
[]
if
(
value
.
length
)
{
id
=
value
.
map
(
item
=>
{
return
item
.
id
})
let
query
=
{
schemename
:
record
.
schemename
,
terminalType
:
record
.
isStatus
,
isBaseMap
:
false
,
jsonCfg
:
JSON
.
stringify
({
roles
:
id
.
join
(
','
)
})
}
SetServiceConfig
(
query
).
then
(
res
=>
{
if
(
res
.
msg
===
"Ok"
)
{
prompt
(
'success'
,
'关联角色成功'
)
setFlag
(
flag
+
1
)
}
else
{
prompt
(
'fail'
,
'关联角色失败'
)
}
}).
catch
(
err
=>
{
prompt
(
'fail'
,
'网络请求失败'
)
})
}
}
//获取角色
const
pickRole
=
(
record
)
=>
{
console
.
log
(
'recird'
,
record
);
setRecord
(
record
)
}
//设置web方案
const
onChangeCheck
=
(
e
,
record
,
index
)
=>
{
setCheckLoading
(
true
)
const
newLoadings
=
[...
webStatus
];
newLoadings
.
map
((
item
,
loadIndex
)
=>
{
return
loadIndex
==
index
?
newLoadings
[
loadIndex
]
=
!
newLoadings
[
loadIndex
]
:
newLoadings
[
loadIndex
]
=
false
const
[
treeLoading
,
setTreeLoading
]
=
useState
(
false
);
// 弹窗显示
const
[
schemename
,
setSchemename
]
=
useState
([]);
const
[
record
,
setRecord
]
=
useState
({});
//选中关联角色的方案名
const
[
webCurrent
,
setWebCurrent
]
=
useState
(
0
);
// web列表下标
const
[
handCurrent
,
setHandCurrent
]
=
useState
(
0
);
// hand列表下标
const
[
webData
,
setWebData
]
=
useState
([]);
// web数据
const
[
handData
,
setHandData
]
=
useState
([]);
//手持数据
const
[
visible
,
setVisible
]
=
useState
(
false
);
// 弹窗
const
[
flag
,
setFlag
]
=
useState
(
0
);
// 更新list
const
[
handStatus
,
setHandStatus
]
=
useState
([]);
// 更新状态
const
[
webStatus
,
setWebStatus
]
=
useState
([]);
// 更新状态
const
[
type
,
setType
]
=
useState
(
''
);
// 弹窗类型
const
[
checkLoading
,
setCheckLoading
]
=
useState
(
false
);
const
[
formObj
,
setFormObj
]
=
useState
({
user
:
'admin'
,
password
:
'geoserver'
});
const
columns
=
[
{
title
:
'默认方案'
,
align
:
'center'
,
key
:
'url'
,
render
:
(
text
,
record
,
index
)
=>
(
<
Space
>
<
Checkbox
checked=
{
webStatus
[
index
+
webCurrent
*
5
]
}
onChange=
{
e
=>
{
onChangeCheck
(
e
,
record
,
index
+
webCurrent
*
5
);
}
}
/>
</
Space
>
),
},
{
title
:
'方案名'
,
dataIndex
:
'schemename'
,
key
:
'schemename'
,
align
:
'center'
,
},
{
title
:
'关联角色'
,
align
:
'center'
,
key
:
'type'
,
render
:
(
text
,
record
,
index
)
=>
(
<
Space
>
<
Space
>
<
div
onClick=
{
()
=>
pickRole
(
record
)
}
style=
{
{
cursor
:
'pointer'
}
}
>
<
VisibleRoleModal
onSubmit=
{
onPushSubmit
}
title=
{
'关联角色'
}
initValues=
{
record
.
roles
!=
null
?
record
.
roles
.
split
(
','
)
:
[]
}
operate=
{
<
UserAddOutlined
/>
}
/>
</
div
>
</
Space
>
</
Space
>
),
},
{
title
:
'编辑'
,
align
:
'center'
,
key
:
'schemename'
,
render
:
(
text
,
record
,
index
)
=>
(
<
Space
>
<
div
onClick=
{
e
=>
e
.
stopPropagation
()
}
>
<
Popconfirm
title=
"是否删除此条方案?"
okText=
"确认"
cancelText=
"取消"
onConfirm=
{
()
=>
{
delWebConfirm
(
record
);
}
}
>
<
Button
size=
"small"
danger
>
删除
</
Button
>
</
Popconfirm
>
</
div
>
</
Space
>
),
},
];
const
columns1
=
[
{
title
:
'查询方案'
,
align
:
'center'
,
key
:
'url'
,
render
:
(
text
,
record
,
index
)
=>
(
<
Space
>
<
Checkbox
checked=
{
handStatus
[
index
+
handCurrent
*
5
]
}
onChange=
{
e
=>
{
onChangeHand
(
e
,
record
,
index
+
handCurrent
*
5
);
}
}
/>
</
Space
>
),
},
{
title
:
'方案名'
,
dataIndex
:
'schemename'
,
key
:
'schemename'
,
align
:
'center'
,
},
{
title
:
'关联角色'
,
align
:
'center'
,
key
:
'type'
,
render
:
(
text
,
record
,
index
)
=>
(
<
Space
>
<
div
onClick=
{
()
=>
pickRole
(
record
)
}
style=
{
{
cursor
:
'pointer'
}
}
>
<
VisibleRoleModal
onSubmit=
{
onPushSubmit
}
selectValue=
{
[]
}
title=
{
'关联角色'
}
initValues=
{
record
.
roles
!=
null
?
record
.
roles
.
split
(
','
)
:
[]
}
operate=
{
<
UserAddOutlined
/>
}
/>
</
div
>
</
Space
>
),
},
{
title
:
'编辑'
,
align
:
'center'
,
key
:
'schemename'
,
render
:
(
text
,
record
,
index
)
=>
(
<
Space
>
<
div
onClick=
{
e
=>
e
.
stopPropagation
()
}
>
<
Popconfirm
title=
"是否删除此条方案?"
okText=
"确认"
cancelText=
"取消"
onConfirm=
{
()
=>
{
delhandConfirm
(
record
);
}
}
>
<
Button
size=
"small"
danger
>
删除
</
Button
>
</
Popconfirm
>
</
div
>
</
Space
>
),
},
];
//获取选中的角色
const
onPushSubmit
=
value
=>
{
let
id
=
[];
if
(
value
.
length
)
{
id
=
value
.
map
(
item
=>
{
return
item
.
id
;
});
let
query
=
{
schemename
:
record
.
schemename
,
terminalType
:
record
.
isStatus
,
isBaseMap
:
false
,
jsonCfg
:
JSON
.
stringify
({
roles
:
id
.
join
(
','
),
}),
};
SetServiceConfig
(
query
)
.
then
(
res
=>
{
if
(
res
.
msg
===
'Ok'
)
{
prompt
(
'success'
,
'关联角色成功'
);
setFlag
(
flag
+
1
);
}
else
{
prompt
(
'fail'
,
'关联角色失败'
);
}
})
setWebStatus
(
newLoadings
)
let
query
=
{
schemename
:
record
[
'schemename'
],
type
:
'dynamic'
}
if
(
!
newLoadings
[
index
])
{
setServiceType
(
query
).
then
(
res
=>
{
setCheckLoading
(
false
)
if
(
res
.
IsSuccess
)
{
const
changehandData
=
[...
webData
];
changehandData
[
index
].
type
=
'dynamic'
setWebData
(
changehandData
)
prompt
(
'success'
,
'设置成功'
)
}
else
{
prompt
(
'fail'
,
`
${
record
[
'schemename'
]}
默认设置时遇到错误:`
+
res
.
message
)
}
})
return
.
catch
(
err
=>
{
prompt
(
'fail'
,
'网络请求失败'
);
});
}
};
//获取角色
const
pickRole
=
record
=>
{
console
.
log
(
'recird'
,
record
);
setRecord
(
record
);
};
//设置web方案
const
onChangeCheck
=
(
e
,
record
,
index
)
=>
{
setCheckLoading
(
true
);
const
newLoadings
=
[...
webStatus
];
newLoadings
.
map
((
item
,
loadIndex
)
=>
{
return
loadIndex
==
index
?
(
newLoadings
[
loadIndex
]
=
!
newLoadings
[
loadIndex
])
:
(
newLoadings
[
loadIndex
]
=
false
);
});
setWebStatus
(
newLoadings
);
let
query
=
{
schemename
:
record
[
'schemename'
],
type
:
'dynamic'
,
};
if
(
!
newLoadings
[
index
])
{
setServiceType
(
query
).
then
(
res
=>
{
setCheckLoading
(
false
);
if
(
res
.
IsSuccess
)
{
const
changehandData
=
[...
webData
];
changehandData
[
index
].
type
=
'dynamic'
;
setWebData
(
changehandData
);
prompt
(
'success'
,
'设置成功'
);
}
else
{
prompt
(
'fail'
,
`
${
record
[
'schemename'
]}
默认设置时遇到错误:`
+
res
.
message
);
}
var
beforeDefault
=
webData
.
findIndex
((
item
)
=>
item
[
'type'
]
==
'pipenet'
);
setServiceType
({
schemename
:
record
[
'schemename'
],
type
:
'pipenet'
}).
then
(
res
=>
{
setCheckLoading
(
false
)
});
return
;
}
var
beforeDefault
=
webData
.
findIndex
(
item
=>
item
[
'type'
]
==
'pipenet'
);
setServiceType
({
schemename
:
record
[
'schemename'
],
type
:
'pipenet'
,
}).
then
(
res
=>
{
setCheckLoading
(
false
);
if
(
res
.
IsSuccess
)
{
const
changehandData
=
[...
webData
];
changehandData
[
index
].
type
=
'pipenet'
;
setWebData
(
changehandData
);
if
(
beforeDefault
!=
-
1
)
{
setServiceType
({
schemename
:
changehandData
[
beforeDefault
].
schemename
,
type
:
'dynamic'
,
}).
then
(
res
=>
{
setCheckLoading
(
false
);
if
(
res
.
IsSuccess
)
{
const
changehandData
=
[...
webData
];
changehandData
[
index
].
type
=
'pipenet'
setWebData
(
changehandData
)
if
(
beforeDefault
!=
-
1
)
{
setServiceType
({
schemename
:
changehandData
[
beforeDefault
].
schemename
,
type
:
'dynamic'
}).
then
(
res
=>
{
setCheckLoading
(
false
)
if
(
res
.
IsSuccess
)
{
const
changehandData1
=
[...
webData
];
changehandData1
[
beforeDefault
].
type
=
'dynamic'
setWebData
(
changehandData1
)
prompt
(
'success'
,
'设置成功'
)
return
;
}
prompt
(
'fail'
,
`
${
record
[
'schemename'
]}
默认设置时遇到错误:`
+
res
.
message
)
})
}
const
changehandData1
=
[...
webData
];
changehandData1
[
beforeDefault
].
type
=
'dynamic'
;
setWebData
(
changehandData1
);
prompt
(
'success'
,
'设置成功'
);
return
;
}
})
}
//选择手持方案
const
onChangeHand
=
(
e
,
record
,
index
)
=>
{
setCheckLoading
(
true
)
const
newLoadings
=
[...
handStatus
];
newLoadings
.
map
((
item
,
loadIndex
)
=>
{
return
loadIndex
==
index
?
newLoadings
[
loadIndex
]
=
!
newLoadings
[
loadIndex
]
:
newLoadings
[
loadIndex
]
=
false
})
setHandStatus
(
newLoadings
)
let
query
=
{
schemename
:
record
[
'schemename'
],
terminalType
:
'phone'
,
isBaseMap
:
false
,
jsonCfg
:
JSON
.
stringify
({
isDefault
:
newLoadings
[
index
],
})
prompt
(
'fail'
,
`
${
record
[
'schemename'
]}
默认设置时遇到错误:`
+
res
.
message
);
});
}
if
(
!
newLoadings
[
index
])
{
SetServiceConfig
(
query
).
then
(
res
=>
{
setCheckLoading
(
false
)
if
(
res
.
msg
===
"Ok"
)
{
const
changehandData
=
[...
handData
];
changehandData
[
index
].
isDefault
=
false
setHandData
(
changehandData
)
prompt
(
'success'
,
'设置成功'
)
}
else
{
prompt
(
'fail'
,
`
${
record
[
'schemename'
]}
默认设置时遇到错误:`
+
res
.
message
)
}
}
});
};
})
return
//选择手持方案
const
onChangeHand
=
(
e
,
record
,
index
)
=>
{
setCheckLoading
(
true
);
const
newLoadings
=
[...
handStatus
];
newLoadings
.
map
((
item
,
loadIndex
)
=>
{
return
loadIndex
==
index
?
(
newLoadings
[
loadIndex
]
=
!
newLoadings
[
loadIndex
])
:
(
newLoadings
[
loadIndex
]
=
false
);
});
setHandStatus
(
newLoadings
);
let
query
=
{
schemename
:
record
[
'schemename'
],
terminalType
:
'phone'
,
isBaseMap
:
false
,
jsonCfg
:
JSON
.
stringify
({
isDefault
:
newLoadings
[
index
],
}),
};
if
(
!
newLoadings
[
index
])
{
SetServiceConfig
(
query
).
then
(
res
=>
{
setCheckLoading
(
false
);
if
(
res
.
msg
===
'Ok'
)
{
const
changehandData
=
[...
handData
];
changehandData
[
index
].
isDefault
=
false
;
setHandData
(
changehandData
);
prompt
(
'success'
,
'设置成功'
);
}
else
{
prompt
(
'fail'
,
`
${
record
[
'schemename'
]}
默认设置时遇到错误:`
+
res
.
message
);
}
var
beforeDefault
=
handData
.
findIndex
((
item
)
=>
item
[
'isDefault'
]);
SetServiceConfig
({
schemename
:
record
[
'schemename'
],
});
return
;
}
var
beforeDefault
=
handData
.
findIndex
(
item
=>
item
[
'isDefault'
]);
SetServiceConfig
({
schemename
:
record
[
'schemename'
],
terminalType
:
'phone'
,
isBaseMap
:
false
,
jsonCfg
:
JSON
.
stringify
({
isDefault
:
true
,
}),
}).
then
(
res
=>
{
setCheckLoading
(
false
);
if
(
res
.
msg
===
'Ok'
)
{
const
changehandData
=
[...
handData
];
changehandData
[
index
].
isDefault
=
true
;
setHandData
(
changehandData
);
if
(
beforeDefault
!=
-
1
)
{
SetServiceConfig
({
schemename
:
changehandData
[
beforeDefault
].
schemename
,
terminalType
:
'phone'
,
isBaseMap
:
false
,
jsonCfg
:
JSON
.
stringify
({
isDefault
:
true
,
})
}).
then
(
res
=>
{
setCheckLoading
(
false
)
if
(
res
.
msg
===
"Ok"
)
{
const
changehandData
=
[...
handData
];
changehandData
[
index
].
isDefault
=
true
setHandData
(
changehandData
)
if
(
beforeDefault
!=
-
1
)
{
SetServiceConfig
({
schemename
:
changehandData
[
beforeDefault
].
schemename
,
terminalType
:
'phone'
,
isBaseMap
:
false
,
jsonCfg
:
JSON
.
stringify
({
isDefault
:
false
,
})
}).
then
(
res
=>
{
setCheckLoading
(
false
)
if
(
res
.
IsSuccess
)
{
const
changehandData1
=
[...
handData
];
changehandData1
[
beforeDefault
].
isDefault
=
false
setHandData
(
changehandData1
)
prompt
(
'success'
,
'设置成功'
)
return
;
}
prompt
(
'fail'
,
`
${
record
[
'schemename'
]}
默认设置时遇到错误:`
+
res
.
message
)
})
}
isDefault
:
false
,
}),
}).
then
(
res
=>
{
setCheckLoading
(
false
);
if
(
res
.
IsSuccess
)
{
const
changehandData1
=
[...
handData
];
changehandData1
[
beforeDefault
].
isDefault
=
false
;
setHandData
(
changehandData1
);
prompt
(
'success'
,
'设置成功'
);
return
;
}
})
}
const
prompt
=
(
type
,
content
)
=>
{
if
(
type
==
'success'
)
{
notification
.
success
({
message
:
'提示'
,
duration
:
3
,
description
:
content
,
});
}
else
{
notification
.
error
({
message
:
'提示'
,
duration
:
3
,
description
:
content
,
});
prompt
(
'fail'
,
`
${
record
[
'schemename'
]}
默认设置时遇到错误:`
+
res
.
message
);
});
}
}
});
};
const
prompt
=
(
type
,
content
)
=>
{
if
(
type
==
'success'
)
{
notification
.
success
({
message
:
'提示'
,
duration
:
3
,
description
:
content
,
});
}
else
{
notification
.
error
({
message
:
'提示'
,
duration
:
3
,
description
:
content
,
});
}
const
onSubmit
=
prop
=>
{
setVisible
(
false
);
setFlag
(
flag
+
1
)
};
//删除web配置方案
const
delWebConfirm
=
(
record
)
=>
{
deleteConfig
({
schemename
:
record
[
'schemename'
],
terminalType
:
'web'
,
isBaseMap
:
false
}).
then
(
res
=>
{
if
(
res
.
msg
===
"Ok"
)
{
prompt
(
'success'
,
'删除成功'
)
setFlag
(
flag
+
1
)
}
else
{
prompt
(
'fail'
,
'删除失败'
)
};
})
}
//删除手持配置方案
const
delhandConfirm
=
(
record
)
=>
{
deleteConfig
({
schemename
:
record
[
'schemename'
],
terminalType
:
'phone'
,
isBaseMap
:
false
}).
then
(
res
=>
{
if
(
res
.
msg
===
"Ok"
)
{
prompt
(
'success'
,
'删除成功'
)
setFlag
(
flag
+
1
)
};
const
onSubmit
=
prop
=>
{
setVisible
(
false
);
setFlag
(
flag
+
1
);
};
//删除web配置方案
const
delWebConfirm
=
record
=>
{
deleteConfig
({
schemename
:
record
[
'schemename'
],
terminalType
:
'web'
,
isBaseMap
:
false
,
}).
then
(
res
=>
{
if
(
res
.
msg
===
'Ok'
)
{
prompt
(
'success'
,
'删除成功'
);
setFlag
(
flag
+
1
);
}
else
{
prompt
(
'fail'
,
'删除失败'
);
}
});
};
//删除手持配置方案
const
delhandConfirm
=
record
=>
{
deleteConfig
({
schemename
:
record
[
'schemename'
],
terminalType
:
'phone'
,
isBaseMap
:
false
,
}).
then
(
res
=>
{
if
(
res
.
msg
===
'Ok'
)
{
prompt
(
'success'
,
'删除成功'
);
setFlag
(
flag
+
1
);
}
else
{
prompt
(
'fail'
,
'删除失败'
);
}
});
};
//添加方案
const
addType
=
type
=>
{
setType
(
type
);
let
listData
=
[];
type
==
'add'
?
(
listData
=
webData
)
:
(
listData
=
handData
);
let
webSchemenameArr
=
[],
schemeArr
=
[];
setTreeLoading
(
true
);
GetMaplayerByTerminalType
({
terminalType
:
'scheme'
,
isBaseMap
:
false
,
}).
then
(
res
=>
{
if
(
res
.
data
.
scheme
&&
res
.
data
.
scheme
.
optionalLayer
.
layers
.
length
)
{
setTreeLoading
(
false
);
listData
.
map
(
item
=>
{
webSchemenameArr
.
push
(
item
.
schemename
);
});
res
.
data
.
scheme
.
optionalLayer
.
layers
.
map
(
item
=>
{
if
(
!
webSchemenameArr
.
includes
(
item
.
schemename
))
schemeArr
.
push
(
item
.
schemename
);
});
setSchemename
(
schemeArr
);
if
(
schemeArr
.
length
)
{
setVisible
(
true
);
}
else
{
notification
.
warning
({
message
:
'提示'
,
duration
:
3
,
description
:
'请先配置方案'
,
});
}
}
else
{
setTreeLoading
(
false
);
notification
.
warning
({
message
:
'提示'
,
duration
:
3
,
description
:
'请先配置方案'
,
});
}
});
};
useEffect
(()
=>
{
renderTile
();
},
[
flag
]);
// 获取瓦片数据配置数据
const
renderTile
=
()
=>
{
setCheckLoading
(
true
);
//查询手持方案
var
schemeConfigQueryRequest
=
GetMaplayerByTerminalType
({
terminalType
:
'phone'
,
isBaseMap
:
false
,
});
//查询web方案
var
webSchemeQueryRequest
=
GetMaplayerByTerminalType
({
terminalType
:
'web'
,
isBaseMap
:
false
,
});
Promise
.
all
([
schemeConfigQueryRequest
,
webSchemeQueryRequest
])
.
then
(
res
=>
{
console
.
log
(
'res'
,
res
);
if
(
res
[
0
].
msg
===
'Ok'
&&
res
[
0
].
data
.
phone
)
{
let
arr
=
[];
res
[
0
].
data
.
phone
.
optionalLayer
.
layers
.
map
((
item
,
index
)
=>
{
if
(
item
.
isDefault
)
{
arr
.
push
(
true
);
}
else
{
prompt
(
'fail'
,
'删除失败'
)
};
})
}
//添加方案
const
addType
=
(
type
)
=>
{
setType
(
type
);
let
listData
=
[]
type
==
'add'
?
listData
=
webData
:
listData
=
handData
let
webSchemenameArr
=
[],
schemeArr
=
[]
setTreeLoading
(
true
);
GetMaplayerByTerminalType
({
terminalType
:
'scheme'
,
isBaseMap
:
false
}).
then
(
res
=>
{
if
(
res
.
data
.
scheme
&&
res
.
data
.
scheme
.
optionalLayer
.
layers
.
length
)
{
setTreeLoading
(
false
);
listData
.
map
(
item
=>
{
webSchemenameArr
.
push
(
item
.
schemename
)
})
res
.
data
.
scheme
.
optionalLayer
.
layers
.
map
(
item
=>
{
if
(
!
webSchemenameArr
.
includes
(
item
.
schemename
))
schemeArr
.
push
(
item
.
schemename
)
})
setSchemename
(
schemeArr
)
if
(
schemeArr
.
length
)
{
setVisible
(
true
);
}
else
{
notification
.
warning
({
message
:
'提示'
,
duration
:
3
,
description
:
'请先配置方案'
,
});
}
}
else
{
setTreeLoading
(
false
);
notification
.
warning
({
message
:
'提示'
,
duration
:
3
,
description
:
'请先配置方案'
,
});
}
arr
.
push
(
false
);
}
)
}
useEffect
(()
=>
{
renderTile
();
},
[
flag
]);
// 获取瓦片数据配置数据
const
renderTile
=
()
=>
{
setCheckLoading
(
true
)
//查询手持方案
var
schemeConfigQueryRequest
=
GetMaplayerByTerminalType
({
terminalType
:
'phone'
,
isBaseMap
:
false
})
//查询web方案
var
webSchemeQueryRequest
=
GetMaplayerByTerminalType
({
terminalType
:
'web'
,
isBaseMap
:
false
})
Promise
.
all
([
schemeConfigQueryRequest
,
webSchemeQueryRequest
]).
then
(
res
=>
{
console
.
log
(
'res'
,
res
);
if
(
res
[
0
].
msg
===
"Ok"
&&
res
[
0
].
data
.
phone
)
{
let
arr
=
[]
res
[
0
].
data
.
phone
.
optionalLayer
.
layers
.
map
((
item
,
index
)
=>
{
if
(
item
.
isDefault
)
{
arr
.
push
(
true
)
}
else
{
arr
.
push
(
false
)
}
item
.
isStatus
=
'phone'
return
item
})
setHandData
(
res
[
0
].
data
.
phone
.
optionalLayer
.
layers
)
setHandStatus
(
arr
)
item
.
isStatus
=
'phone'
;
return
item
;
});
setHandData
(
res
[
0
].
data
.
phone
.
optionalLayer
.
layers
);
setHandStatus
(
arr
);
}
if
(
res
[
1
].
msg
===
'Ok'
&&
res
[
1
].
data
.
web
)
{
let
arr
=
[];
res
[
1
].
data
.
web
.
optionalLayer
.
layers
.
map
((
item
,
index
)
=>
{
if
(
item
.
type
===
'pipenet'
)
{
arr
.
push
(
true
);
}
else
{
arr
.
push
(
false
);
}
if
(
res
[
1
].
msg
===
"Ok"
&&
res
[
1
].
data
.
web
)
{
let
arr
=
[]
res
[
1
].
data
.
web
.
optionalLayer
.
layers
.
map
((
item
,
index
)
=>
{
if
(
item
.
type
===
"pipenet"
)
{
arr
.
push
(
true
)
}
else
{
arr
.
push
(
false
)
}
item
.
isStatus
=
'web'
return
item
})
setWebData
(
res
[
1
].
data
.
web
.
optionalLayer
.
layers
)
setWebStatus
(
arr
)
}
setCheckLoading
(
false
)
}).
catch
(
e
=>
{
setCheckLoading
(
false
)
})
};
return
(
<>
<
Spin
tip=
"loading..."
spinning=
{
checkLoading
}
>
<
div
className=
{
styles
.
solutionConfig
}
>
<
div
>
<
Divider
orientation=
"left"
><
div
className=
{
styles
.
divider
}
>
Web
<
PlusOutlined
onClick=
{
()
=>
{
addType
(
'add'
)
}
}
className=
{
styles
.
dividerIcon
}
/></
div
></
Divider
>
<
Table
columns=
{
columns
}
dataSource=
{
webData
}
bordered
pagination=
{
{
showTotal
:
(
total
,
range
)
=>
`第${range[0]}-${range[1]} 条/共 ${total} 条`
,
defaultPageSize
:
8
,
onChange
:
(
value
)
=>
{
setWebCurrent
(
value
-
1
)
}
}
}
rowKey=
"schemename"
scroll=
{
{
y
:
400
}
}
>
</
Table
>
</
div
>
<
Divider
orientation=
"left"
><
div
className=
{
styles
.
divider
}
>
手持
<
PlusOutlined
onClick=
{
()
=>
{
addType
(
'addHand'
)
}
}
className=
{
styles
.
dividerIcon
}
/></
div
>
</
Divider
>
<
Table
columns=
{
columns1
}
dataSource=
{
handData
}
bordered
rowKey=
"schemename"
scroll=
{
{
y
:
400
}
}
pagination=
{
{
showTotal
:
(
total
,
range
)
=>
`第${range[0]}-${range[1]} 条/共 ${total} 条`
,
defaultPageSize
:
8
,
onChange
:
(
value
)
=>
{
setHandCurrent
(
value
-
1
)
}
item
.
isStatus
=
'web'
;
return
item
;
});
setWebData
(
res
[
1
].
data
.
web
.
optionalLayer
.
layers
);
setWebStatus
(
arr
);
}
setCheckLoading
(
false
);
})
.
catch
(
e
=>
{
setCheckLoading
(
false
);
});
};
}
}
>
</
Table
>
</
div
>
</
Spin
>
<
AddModal
visible=
{
visible
}
onCancel=
{
()
=>
setVisible
(
false
)
}
callBackSubmit=
{
onSubmit
}
type=
{
type
}
formObj=
{
formObj
}
listData=
{
schemename
}
return
(
<>
<
Spin
tip=
"loading..."
spinning=
{
checkLoading
}
>
<
div
className=
{
styles
.
solutionConfig
}
>
<
div
>
<
Divider
orientation=
"left"
>
<
div
className=
{
styles
.
divider
}
>
{
' '
}
Web
{
' '
}
<
PlusOutlined
onClick=
{
()
=>
{
addType
(
'add'
);
}
}
className=
{
styles
.
dividerIcon
}
/>
</
div
>
</
Divider
>
<
Table
columns=
{
columns
}
dataSource=
{
webData
}
bordered
pagination=
{
{
showTotal
:
(
total
,
range
)
=>
`第${range[0]}-${range[1]} 条/共 ${total} 条`
,
defaultPageSize
:
8
,
onChange
:
value
=>
{
setWebCurrent
(
value
-
1
);
},
}
}
rowKey=
"schemename"
scroll=
{
{
y
:
400
}
}
/>
</>
)
}
export
default
VectorData
\ No newline at end of file
</
div
>
<
Divider
orientation=
"left"
>
<
div
className=
{
styles
.
divider
}
>
手持
{
' '
}
<
PlusOutlined
onClick=
{
()
=>
{
addType
(
'addHand'
);
}
}
className=
{
styles
.
dividerIcon
}
/>
</
div
>
{
' '
}
</
Divider
>
<
Table
columns=
{
columns1
}
dataSource=
{
handData
}
bordered
rowKey=
"schemename"
scroll=
{
{
y
:
600
}
}
pagination=
{
{
showTotal
:
(
total
,
range
)
=>
`第${range[0]}-${range[1]} 条/共 ${total} 条`
,
defaultPageSize
:
8
,
onChange
:
value
=>
{
setHandCurrent
(
value
-
1
);
},
}
}
/>
</
div
>
</
Spin
>
<
AddModal
visible=
{
visible
}
onCancel=
{
()
=>
setVisible
(
false
)
}
callBackSubmit=
{
onSubmit
}
type=
{
type
}
formObj=
{
formObj
}
listData=
{
schemename
}
/>
</>
);
};
export
default
VectorData
;
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