Commit 622d1b1a authored by shaoan123's avatar shaoan123

对接方案配置接口

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