Commit 622d1b1a authored by shaoan123's avatar shaoan123

对接方案配置接口

parent 2bc8f01a
Pipeline #31087 skipped with stages
......@@ -20,7 +20,6 @@ const MapScope = props => {
el: el.current,
});
viewer = pdViewer.viewer;
console.log('viewer', viewer);
pdViewer.viewer.camera.flyTo({
destination: Cesium.Cartesian3.fromDegrees(114.31, 30.52, 15000.0), //武汉
});
......@@ -142,7 +141,7 @@ const MapScope = props => {
confirmModal && confirmModal(mapSettings)
}
else {
message.info("未选择视角,请先选择区域,再点击获取视角按钮获取视角")
message.info("未选择视角,请先选择区域")
}
}
......
import React, { useState, useEffect } from 'react';
import { Form, Modal, Input, Select, AutoComplete, Button, notification } from 'antd';
import {
SetServiceConfig
SetServiceConfig,AddWebSchema
} from '@/services/webConfig/api';
......@@ -17,15 +17,12 @@ const AddModal = props => {
if (validate) {
setLoading(true);
let obj = form.getFieldsValue();
SetServiceConfig({
schemename: obj.schemename,
terminalType: type === 'add' ? 'web' : 'phone',
isBaseMap: 'false',
jsonCfg: type === 'add' ? JSON.stringify({ type: 'dynamic' }) : JSON.stringify({ isDefault: false })
AddWebSchema({
schemename: obj.schemename
})
.then(res => {
setLoading(false);
if (res.msg === "Ok") {
if (res.msg === "") {
form.resetFields();
callBackSubmit();
notification.success({
......@@ -38,7 +35,7 @@ const AddModal = props => {
notification.error({
message: '提示',
duration: 3,
description: '新增失败',
description:res.msg,
});
}
})
......
......@@ -6,7 +6,7 @@ import {
PlusOutlined
} from '@ant-design/icons';
import {
deleteConfig, setServiceType, SetServiceConfig,GetMaplayerByTerminalType
deleteConfig, SettingRoleWebSchema, SetServiceConfig,DeleteWebSchema,GetWebSchemaList,GetSchemaInfoList,IsActionWebSchema
} from '@/services/webConfig/api';
import {
UserAddOutlined
......@@ -31,7 +31,6 @@ const VectorData = props => {
{
title: '默认方案',
align: 'center',
key: 'url',
render: (text, record, index) => (
<Space>
<Checkbox
......@@ -45,14 +44,16 @@ const VectorData = props => {
},
{
title: '方案名',
dataIndex: 'schemename',
key: 'schemename',
align: 'center'
align: 'center',
render: (text, record, index) => (
<Space>
{record.scheme.schemename}
</Space>
),
},
{
title: '关联角色',
align: 'center',
key: 'type',
render: (text, record, index) => (
<Space>
<Space>
......@@ -66,7 +67,6 @@ const VectorData = props => {
{
title: '编辑',
align: 'center',
key: 'schemename',
render: (text, record, index) => (
<Space>
<div onClick={e => e.stopPropagation()}>
......@@ -88,80 +88,76 @@ const VectorData = props => {
}
];
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} 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 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 = {
schemename: record.schemename,
terminalType: record.isStatus,
isBaseMap: false,
jsonCfg: JSON.stringify({
roles: id.join(',')
})
schemaname: record.scheme.schemename,
roles: id.join(',')
}
SetServiceConfig(query).then(res => {
if (res.msg === "Ok") {
SettingRoleWebSchema(query).then(res => {
if (res.msg === "") {
prompt('success', '关联角色成功')
setFlag(flag + 1)
}
......@@ -183,58 +179,17 @@ const VectorData = props => {
//设置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)
}
})
return
}
var beforeDefault = webData.findIndex((item) => item['type'] == 'pipenet');
setServiceType({
schemename: record['schemename'],
type: 'pipenet'
}).then(res => {
IsActionWebSchema({schemaname :record.scheme.schemename}).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)
})
}
if(res.msg===''){
prompt('success', '设置成功')
setFlag(flag + 1)
}
else{
prompt('fail', res.msg)
}
})
}
......@@ -328,12 +283,8 @@ const VectorData = props => {
};
//删除web配置方案
const delWebConfirm = (record) => {
deleteConfig({
schemename: record['schemename'],
terminalType: 'web',
isBaseMap: false
}).then(res => {
if (res.msg === "Ok") {
DeleteWebSchema( record.scheme.schemename).then(res => {
if (res.msg === "") {
prompt('success', '删除成功')
setFlag(flag + 1)
......@@ -365,17 +316,14 @@ const VectorData = props => {
type == 'add' ? listData = webData : listData = handData
let webSchemenameArr = [], schemeArr = []
setTreeLoading(true);
GetMaplayerByTerminalType({
terminalType: 'scheme',
isBaseMap: false
}).then(
GetSchemaInfoList().then(
res => {
if (res.data.scheme && res.data.scheme.optionalLayer.layers.length) {
if (res.data && res.data.length) {
setTreeLoading(false);
listData.map(item => {
webSchemenameArr.push(item.schemename)
webSchemenameArr.push(item.scheme.schemename)
})
res.data.scheme.optionalLayer.layers.map(item => {
res.data.map(item => {
if (!webSchemenameArr.includes(item.schemename))
schemeArr.push(item.schemename)
})
......@@ -410,37 +358,33 @@ const VectorData = props => {
const renderTile = () => {
setCheckLoading(true)
//查询手持方案
var schemeConfigQueryRequest = GetMaplayerByTerminalType({
terminalType: 'phone',
isBaseMap: false
})
// 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)
}
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)
// item.isStatus = 'phone'
// return item
// })
// setHandData(res[0].data.phone.optionalLayer.layers)
// setHandStatus(arr)
}
if (res[1].msg==="Ok" && res[1].data.web) {
// }
if (res[0].msg==="Ok" && res[0].data) {
let arr = []
res[1].data.web.optionalLayer.layers.map((item, index) => {
if (item.type === "pipenet") {
res[0].data.map((item, index) => {
if (item.isDefault) {
arr.push(true)
} else {
arr.push(false)
......@@ -448,7 +392,7 @@ const VectorData = props => {
item.isStatus = 'web'
return item
})
setWebData(res[1].data.web.optionalLayer.layers)
setWebData(res[0].data)
setWebStatus(arr)
}
setCheckLoading(false)
......@@ -481,12 +425,12 @@ const VectorData = props => {
}
}}
rowKey="schemename"
rowKey={(record, index) => record.scheme.schemename}
scroll={{ y: 400 }}
>
</Table>
</div>
<Divider orientation="left"><div className={styles.divider}>手持 <PlusOutlined
{/* <Divider orientation="left"><div className={styles.divider}>手持 <PlusOutlined
onClick={() => { addType('addHand') }}
className={styles.dividerIcon} /></div> </Divider>
<Table
......@@ -505,7 +449,7 @@ const VectorData = props => {
}}
>
</Table>
</Table> */}
</div>
</Spin>
<AddModal
......
......@@ -282,6 +282,27 @@ export const AddSchemaBaseMap = (query) =>
export const DeleteSchemaBaseMap = (query) =>
get(`${PUBLISH_SERVICE}/Maplayer/DeleteSchemaBaseMap`, query);
//设置底图激活
//设置底图激活
export const SchemaSettingIsActive = (query) =>
get(`${PUBLISH_SERVICE}/Maplayer/SchemaSettingIsActive`, query);
\ No newline at end of file
get(`${PUBLISH_SERVICE}/Maplayer/SchemaSettingIsActive`, query);
//获取Web方案配置列表
export const GetWebSchemaList = (query) =>
get(`${PUBLISH_SERVICE}/Maplayer/GetWebSchemaList`, query);
//添加Web方案
export const AddWebSchema = (query) =>
post(`${PUBLISH_SERVICE}/Maplayer/AddWebSchema`, query);
//删除Web方案
export const DeleteWebSchema = (schemaname) =>
get(`${PUBLISH_SERVICE}/Maplayer/DeleteWebSchema?schemaname=${schemaname }`);
//设置web方案是否默认
export const IsActionWebSchema = (query) =>
get(`${PUBLISH_SERVICE}/Maplayer/IsActionWebSchema`, query);
//根据方案名称设置角色
export const SettingRoleWebSchema = (query) =>
get(`${PUBLISH_SERVICE}/Maplayer/SettingRoleWebSchema`, query);
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment